private HeightMap GetWorldHeightMap()
        {
            float   mapWidth     = meshSettings.numVertsPerLine * _terrainSizeInChunks.x;
            float   mapHeight    = meshSettings.numVertsPerLine * _terrainSizeInChunks.y;
            Vector2 sampleCenter = Vector2.zero * meshSettings.meshWorldSize / meshSettings.meshScale;

            return(HeightMapGenerator.GenerateHeightMap(meshSettings.numVertsPerLine, meshSettings.numVertsPerLine, heightMapSettings, sampleCenter));
        }
示例#2
0
        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)
            {
                DrawMesh(MeshGenerator.GenerateTerrainMesh(heightMap.values, meshSettings, editorPreviewLOD));
            }
            else if (drawMode == DrawMode.FalloffMap)
            {
                DrawTexture(TextureGenerator.TextureFromHeightMap(new HeightMap(FalloffGenerator.GenerateFalloffMap(meshSettings.numVertsPerLine), 0, 1)));
            }
        }
示例#3
0
 public void Load()
 {
     ThreadedDataRequester.RequestData(() => HeightMapGenerator.GenerateHeightMap(meshSettings.numVertsPerLine, meshSettings.numVertsPerLine, heightMapSettings, sampleCentre), OnHeightMapReceived);
 }
        private HeightMap GetChunkHeightMap(Vector2 ChunkCoord)
        {
            Vector2 sampleCenter = ChunkCoord * meshSettings.meshWorldSize / meshSettings.meshScale;

            return(HeightMapGenerator.GenerateHeightMap(meshSettings.numVertsPerLine, meshSettings.numVertsPerLine, heightMapSettings, sampleCenter));
        }