コード例 #1
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 (this.drawMode == DrawMode.NoiseMap)
        {
            DrawTexture(Texture_Generator.TextureFromHeightMap(heightMap));
        }

        else if (this.drawMode == DrawMode.Mesh)
        {
            DrawMesh(Mesh_Generator.GenerateTerrainMesh(heightMap.values, meshSettings, this.editorPreviewLevelOfDetail));
        }
        else if (this.drawMode == DrawMode.FalloffMap)
        {
            DrawTexture(Texture_Generator.TextureFromHeightMap(new HeightMap(FalloffGenerator.GenerateFalloffMap(meshSettings.NumVertsPerLine), 0, 1)));
        }
    }
コード例 #2
0
 public void RequestMesh(HeightMap heightMap, MeshSettings meshSettings)
 {
     hasRequestedMesh = true;
     ThreadedDataRequester.RequestData(() => Mesh_Generator.GenerateTerrainMesh(heightMap.values, meshSettings, lod), OnMeshDataReceived);
 }