// show the result to the screen private void getDisplay() { MapData mapData = GenerateMap(Vector2.zero); if (FindObjectOfType <MapDisplay>()) { MapDisplay display = FindObjectOfType <MapDisplay>(); if (mode == DrawMode.Noise) { display.drawTexture2D(GenerateTexture.TextureFromNoiseMap(mapData.noiseMap)); } else if (mode == DrawMode.Color) { display.drawTexture2D(GenerateTexture.textureFromColorMap(mapChunkSize , mapChunkSize, mapData.colorMap)); } else if (mode == DrawMode.Mesh) { display.drawMesh(MashGenerator.GenerateMash(mapData.noiseMap, heightMultiplier, meshHeightCurve, previewLOD), GenerateTexture.textureFromColorMap(mapChunkSize , mapChunkSize, mapData.colorMap)); } } else { print("Not found"); } }
void OnMapDataReceived(MapData mapData) { //mapGenerator.RequestMeshData (mapData, OnMeshDataReceived); this.mapData = mapData; mapDataReceived = true; Texture2D texture = GenerateTexture.textureFromColorMap(MapGenerator.mapChunkSize, MapGenerator.mapChunkSize, mapData.colorMap); meshRenderer.material.mainTexture = texture; UpdateTerrainChunk(); }