Exemple #1
0
        public void DrawMapInEditor()
        {
            var mapData = GenerateMapData(Vector2.zero);

            MapDisplay display = FindObjectOfType <MapDisplay>();

            switch (this.drawMode)
            {
            case DrawMode.ColorMap:
                display.DrawTexture(TextureGenerator.TextureFromColourMap(mapData.colorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE));
                break;

            case DrawMode.NoiseMap:
                display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.heightMap));
                break;

            case DrawMode.Mesh:
                display.DrawMesh(MeshGenerrator.GenerateTerrainMesh(mapData.heightMap, terrainData.meshHeightMultiplier, terrainData.meshHeightCurve, editorPreviewLOD, terrainData.useFaltShading), TextureGenerator.TextureFromColourMap(mapData.colorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE));
                break;

            case DrawMode.FalloffMap:
                display.DrawTexture(TextureGenerator.TextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(MAP_CHUNK_SIZE)));
                break;
            }
        }