예제 #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;
            }
        }
예제 #2
0
        void MeshDataThread(MapData mapData, int lod, Action <MeshData> callBack)
        {
            var meshData = MeshGenerrator.GenerateTerrainMesh(mapData.heightMap, terrainData.meshHeightMultiplier, terrainData.meshHeightCurve, lod, terrainData.useFaltShading);

            lock (meshDataThreadInfoQueue) {
                meshDataThreadInfoQueue.Enqueue(new MapThreadInfo <MeshData>(callBack, meshData));
            }
        }