Exemple #1
0
    public void DrawMapInEditor()
    {
        textureData.ApplyToMaterial(terrainMaterial);
        textureData.UpdateMeshHeights(terrainMaterial, heightMapSettings.minHeight, heightMapSettings.maximumMapHeight);
        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(WorldMesh.GenerateTerrainMesh(heightMap.values, meshSettings, editorPreviewLOD));
            //DrawWater();
        }
        else if (drawMode == DrawMode.FalloffMap)
        {
            DrawTexture(TextureGenerator.TextureFromHeightMap(new HeightMap(WorldFalloff.GenerateFalloffMap(meshSettings.numVertsPerLine), 0, 1, heightMapSettings.maximumMapHeight)));
        }
    }
Exemple #2
0
 public void RequestMesh(HeightMap heightMap, MeshSettings meshSettings)
 {
     hasRequestedMesh = true;
     ThreadedDataRequester.RequestData(() => WorldMesh.GenerateTerrainMesh(heightMap.values, meshSettings, lod), OnMeshDataReveiced);
 }