void OnMapDataReceived(MapData mapData)
        {
            this.mapData    = mapData;
            mapDataReceived = true;

            Texture2D t = MapTextureGenerator.TextureFromColorMap(mapData.colorMap, MapGenerator.mapChunkSize, MapGenerator.mapChunkSize);

            meshRenderer.material.mainTexture = t;

            UpdateTerrainChunk();
        }
Exemple #2
0
    public void DrawMapInEditor()
    {
        MapData mData = GenerateMapData(Vector2.zero);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(MapTextureGenerator.TextureFromHeightMap(mData.heightMap));
        }
        else if (drawMode == DrawMode.ColorMap)
        {
            display.DrawTexture(MapTextureGenerator.TextureFromColorMap(mData.colorMap, mapChunkSize, mapChunkSize));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MapMeshGenerator.GenerateTerrainMesh(mData.heightMap, meshHeightMultiplier, meshHeightCurve, editorPreviewLOD), MapTextureGenerator.TextureFromColorMap(mData.colorMap, mapChunkSize, mapChunkSize));
        }
    }