コード例 #1
0
        void OnMapDataReceived(MapData mapData)
        {
            this.mapData    = mapData;
            mapDataReceived = true;

            Texture2D texture = TextureGenerater.TextureFromColourMap(mapData.colourMap, MapGen.mapChunkSize, MapGen.mapChunkSize);

            meshRenderer.material.mainTexture = texture;

            UpdateTerrainChunk();
        }
コード例 #2
0
    public void DrawMapInEditor()
    {
        MapData mapData = GenerateMapData(Vector2.zero);

        MapDisplay display = FindObjectOfType <MapDisplay>();

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