public void DrawMapInEditor() { textureData.ApplyToMaterial(terrainMaterial); textureData.UpdateMeshHeights(terrainMaterial, heightMapSettings.minHeight, heightMapSettings.maxHeight); HeightMap heightMap = HeightMapGenerator.GenerateHeightMap(meshSettings.numVertsPerLine, meshSettings.numVertsPerLine, heightMapSettings, Vector2.zero); if (drawMode == DrawMode.NoiseMap) { DrawTexture(TextureGenerator.TextureFromHeightMap(heightMap)); } else if (drawMode == DrawMode.Mesh) { MeshData meshData = MeshGenerator.GenerateTerrainMesh(heightMap.values, meshSettings, editorPreviewLOD); DrawMesh(meshData); ObjectsGenerator.GeneratePointsRandom(objectData.objectList, meshData.CreateMesh(), meshSettings, heightMapSettings.noiseSettings.seed); ObjectsGenerator.SpawnObjects(objectData, transform, meshSettings, heightMapSettings.noiseSettings.seed); } else if (drawMode == DrawMode.FalloffMap) { DrawTexture(TextureGenerator.TextureFromHeightMap(new HeightMap(FalloffGenerator.GenerateFalloffMap(meshSettings.numVertsPerLine), 0, 1))); } }
public void UpdateTerrainChunkObjects() { ObjectsGenerator.GeneratePointsRandom(objectsData.objectList, chunkMesh, meshSettings, heightMapSettings.noiseSettings.seed); ObjectsGenerator.SpawnObjects(objectsData, meshObject.transform, meshSettings, heightMapSettings.noiseSettings.seed); }