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

            Texture2D texture = TextureSampler2D.TextureFromColourMap(mapData.colourMap, NoiseMapGenerator.mapChunkSize, NoiseMapGenerator.mapChunkSize);

            meshRenderer.material.mainTexture = texture;

            UpdateTerrainChunk();
        }
Ejemplo n.º 2
0
    public void DrawMapInEditor()
    {
        MapData mapData = GenerateMapData(Vector2.zero);

        DrawMap display = FindObjectOfType <DrawMap> ();

        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(TextureSampler2D.TextureFromHeightMap(mapData.heightMap));
        }
        else if (drawMode == DrawMode.ColourMap)
        {
            display.DrawTexture(TextureSampler2D.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, meshHeightMultiplier, meshHeightCurve, editorPreviewLOD), TextureSampler2D.TextureFromColourMap(mapData.colourMap, mapChunkSize, mapChunkSize));
        }
        else if (drawMode == DrawMode.FalloffMap)
        {
            display.DrawTexture(TextureSampler2D.TextureFromHeightMap(FalloffMapGenerator.GenerateFalloffMap(mapChunkSize)));
        }
    }