void Raise() { FilteredNoise raiseNoise1 = new FilteredNoise(new PerlinNoise(random, TerrainDetailOctaves), new PerlinNoise(random, TerrainDetailOctaves)); FilteredNoise raiseNoise2 = new FilteredNoise(new PerlinNoise(random, TerrainDetailOctaves), new PerlinNoise(random, TerrainDetailOctaves)); PerlinNoise raiseNoise3 = new PerlinNoise(random, TerrainFeatureOctaves); // raising const double scale = 1.3; for (int x = 0; x < mapWidth; x++) { for (int y = 0; y < mapLength; y++) { double d2 = raiseNoise1.GetNoise(x * scale, y * scale) / 6.0 - 4; double d3 = raiseNoise2.GetNoise(x * scale, y * scale) / 5.0 + 10.0 - 4; double d4 = raiseNoise3.GetNoise(x, y) / 8.0; if (d4 > 0) { d3 = d2; } double elevation = Math.Max(d2, d3) / 2.0; if (elevation < 0) { elevation *= 0.8; } heightmap[(x + y * mapWidth)] = (int)elevation; } } }
void Erode() { FilteredNoise erodeNoise1 = new FilteredNoise(new PerlinNoise(random, TerrainDetailOctaves), new PerlinNoise(random, TerrainDetailOctaves)); FilteredNoise erodeNoise2 = new FilteredNoise(new PerlinNoise(random, TerrainDetailOctaves), new PerlinNoise(random, TerrainDetailOctaves)); for (int x = 0; x < mapWidth; x++) { for (int y = 0; y < mapLength; y++) { double d1 = erodeNoise1.GetNoise(x * 2, y * 2) / 8.0; int i7 = erodeNoise2.GetNoise(x * 2, y * 2) > 0 ? 1 : 0; if (d1 <= 2) { continue; } int i19 = ((heightmap[(x + y * mapWidth)] - i7) / 2 * 2) + i7; heightmap[(x + y * mapWidth)] = i19; } } }
void Raise() { FilteredNoise raiseNoise1 = new FilteredNoise( new PerlinNoise( random, TerrainDetailOctaves ), new PerlinNoise( random, TerrainDetailOctaves ) ); FilteredNoise raiseNoise2 = new FilteredNoise( new PerlinNoise( random, TerrainDetailOctaves ), new PerlinNoise( random, TerrainDetailOctaves ) ); PerlinNoise raiseNoise3 = new PerlinNoise( random, TerrainFeatureOctaves ); // raising const double scale = 1.3; for( int x = 0; x < mapWidth; x++ ) { for( int y = 0; y < mapLength; y++ ) { double d2 = raiseNoise1.GetNoise( x * scale, y * scale ) / 6.0 - 4; double d3 = raiseNoise2.GetNoise( x * scale, y * scale ) / 5.0 + 10.0 - 4; double d4 = raiseNoise3.GetNoise( x, y ) / 8.0; if( d4 > 0 ) d3 = d2; double elevation = Math.Max( d2, d3 ) / 2.0; if( elevation < 0 ) elevation *= 0.8; heightmap[( x + y * mapWidth )] = (int)elevation; } } }
void Erode() { FilteredNoise erodeNoise1 = new FilteredNoise( new PerlinNoise( random, TerrainDetailOctaves ), new PerlinNoise( random, TerrainDetailOctaves ) ); FilteredNoise erodeNoise2 = new FilteredNoise( new PerlinNoise( random, TerrainDetailOctaves ), new PerlinNoise( random, TerrainDetailOctaves ) ); for( int x = 0; x < mapWidth; x++ ) { for( int y = 0; y < mapLength; y++ ) { double d1 = erodeNoise1.GetNoise( x * 2, y * 2 ) / 8.0; int i7 = erodeNoise2.GetNoise( x * 2, y * 2 ) > 0 ? 1 : 0; if( d1 <= 2 ) continue; int i19 = ( ( heightmap[( x + y * mapWidth )] - i7 ) / 2 * 2 ) + i7; heightmap[( x + y * mapWidth )] = i19; } } }