public void DrawMapInEditor() { MapData mapData = GenerateMapData(new Vector2(0, 0)); //pass the position zero MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); if (Mode == DrawMode.NoiseMap) { display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.HeightMap)); } if (Mode == DrawMode.ColorMap) { display.DrawTexture(TextureGenerator.TextureFromColorMap(mapData.ColorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE)); } if (Mode == DrawMode.Mesh) { display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.HeightMap, MeshHeightMultiplier, MeshHeightCurve, EditorPreviewLOD), TextureGenerator.TextureFromColorMap(mapData.ColorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE)); } if (Mode == DrawMode.FalloffMap) { display.DrawTexture(TextureGenerator.TextureFromHeightMap( FallofGenerator.GenerateFalloffMap(MAP_CHUNK_SIZE))); } }
public void GenerateMap() { float[,] noiseMap = Noise.GenerateNoiseMap(MapWidth, MapHeight, NoiseScale); MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); display.DrawNoiseMap(noiseMap); }
public void GenerateMap() { float[,] noiseMap = Noise.GenerateNoiseMap(MapWidth, MapHeight, Seed, NoiseScale, OctavesNumber, Persistance, Lacunarity, Offset); MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); display.DrawNoiseMap(noiseMap); }
public void GenerateMap() { float[,] noiseMap = Noise.GenerateNoiseMap(MAP_CHUNCK_SIZE, MAP_CHUNCK_SIZE, Seed, NoiseScale, OctavesNumber, Persistance, Lacunarity, Offset); //Store the colors in respect of the Map height Color[] colorMap = new Color[MAP_CHUNCK_SIZE * MAP_CHUNCK_SIZE]; // for (int y = 0; y < MAP_CHUNCK_SIZE; y++) { for (int x = 0; x < MAP_CHUNCK_SIZE; x++) { float currentHeight = noiseMap[x, y]; for (int i = 0; i < Regions.Length; i++) { if (currentHeight <= Regions[i].Height) { colorMap [y * MAP_CHUNCK_SIZE + x] = Regions [i].TerrainColor; break; //no need to } } } } MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); if (Mode == DrawMode.NoiseMap) { display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap)); } if (Mode == DrawMode.ColorMap) { display.DrawTexture(TextureGenerator.TextureFromColorMap(colorMap, MAP_CHUNCK_SIZE, MAP_CHUNCK_SIZE)); } if (Mode == DrawMode.Mesh) { display.DrawMesh( MeshGenerator.GenerateTerrainMesh(noiseMap, MeshHeightMultiplier, MeshHeightCurve, LevelOfDetail), TextureGenerator.TextureFromColorMap(colorMap, MAP_CHUNCK_SIZE, MAP_CHUNCK_SIZE)); } }
public void DrawMapInEditor () { MapData mapData = GenerateMapData (new Vector2(0,0));//pass the position zero MapDisplayBehaviour display = FindObjectOfType<MapDisplayBehaviour> (); if (Mode == DrawMode.NoiseMap) { display.DrawTexture (TextureGenerator.TextureFromHeightMap (mapData.HeightMap)); } if (Mode == DrawMode.Mesh) { display.DrawMesh (MeshGenerator.GenerateTerrainMesh (mapData.HeightMap, terrainData.MeshHeightMultiplier, terrainData.MeshHeightCurve, EditorPreviewLOD, terrainData.UseFlatShading)); } if (Mode == DrawMode.FalloffMap) { display.DrawTexture (TextureGenerator.TextureFromHeightMap ( FallofGenerator.GenerateFalloffMap (MapChunkSize))); } }
public void DrawMapInEditor() { MapData mapData = GenerateMapData(); MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); if (Mode == DrawMode.NoiseMap) { display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.HeightMap)); } if (Mode == DrawMode.ColorMap) { display.DrawTexture(TextureGenerator.TextureFromColorMap(mapData.ColorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE)); } if (Mode == DrawMode.Mesh) { display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.HeightMap, MeshHeightMultiplier, MeshHeightCurve, LevelOfDetail), TextureGenerator.TextureFromColorMap(mapData.ColorMap, MAP_CHUNK_SIZE, MAP_CHUNK_SIZE)); } }
public void GenerateMap() { float[,] noiseMap = Noise.GenerateNoiseMap(MapWidth, MapHeight, Seed, NoiseScale, OctavesNumber, Persistance, Lacunarity, Offset); //Store the colors in respect of the Map height Color[] colorMap = new Color[MapWidth * MapHeight]; // for (int y = 0; y < MapHeight; y++) { for (int x = 0; x < MapWidth; x++) { float currentHeight = noiseMap[x, y]; for (int i = 0; i < Regions.Length; i++) { if (currentHeight <= Regions[i].Height) { colorMap [y * MapWidth + x] = Regions [i].TerrainColor; break; //no need to } } } } MapDisplayBehaviour display = FindObjectOfType <MapDisplayBehaviour> (); if (Mode == DrawMode.NoiseMap) { display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap)); } if (Mode == DrawMode.ColorMap) { display.DrawTexture(TextureGenerator.TextureFromColorMap(colorMap, MapWidth, MapHeight)); } }