void OnMapDataReceived(MapData mapData) { this.mapData = mapData; mapDataReceived = true; Texture2D texture = TextureGenerater.TextureFromColourMap(mapData.colourMap, MapGen.mapChunkSize, MapGen.mapChunkSize); meshRenderer.material.mainTexture = texture; UpdateTerrainChunk(); }
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))); } }