public BiomeConditions(TerrainBiome.Enum layer) { Layer = layer; Weight = new float[TerrainBiome.COUNT]; CheckLayer = new bool[TerrainBiome.COUNT]; }
public static MapInfo EmptyMap(int size, float landHeight, TerrainSplat.Enum ground = TerrainSplat.Enum.Grass, TerrainBiome.Enum biome = TerrainBiome.Enum.Temperate) { MapInfo terrains = new MapInfo(); int splatRes = Mathf.Clamp(Mathf.NextPowerOfTwo((int)(size * 0.50f)), 512, 2048); List <PathData> paths = new List <PathData>(); List <PrefabData> prefabs = new List <PrefabData>(); terrains.pathData = paths.ToArray(); terrains.prefabData = prefabs.ToArray(); terrains.terrainRes = Mathf.Clamp(Mathf.NextPowerOfTwo(size), 512, 4096) + 1; terrains.size = new Vector3(size, 1000, size); terrains.land.heights = SetValues(new float[terrains.terrainRes, terrains.terrainRes], landHeight / 1000f, new Area(0, terrains.terrainRes, 0, terrains.terrainRes)); terrains.water.heights = SetValues(new float[terrains.terrainRes, terrains.terrainRes], 500f / 1000f, new Area(0, terrains.terrainRes, 0, terrains.terrainRes)); terrains.splatRes = splatRes; terrains.splatMap = new float[splatRes, splatRes, 8]; int gndIdx = TerrainSplat.TypeToIndex((int)ground); Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.splatMap[i, j, gndIdx] = 1f; } }); terrains.biomeMap = new float[splatRes, splatRes, 4]; int biomeIdx = TerrainBiome.TypeToIndex((int)biome); Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.biomeMap[i, j, biomeIdx] = 1f; } }); terrains.alphaMap = new bool[splatRes, splatRes]; Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.alphaMap[i, j] = true; } }); terrains.topology = new TerrainMap <int>(new byte[(int)Mathf.Pow(splatRes, 2) * 4 * 1], 1); return(terrains); }