void Grow() {
PerlinNoise growNoise1 = new PerlinNoise( random, 8 );
PerlinNoise growNoise2 = new PerlinNoise( random, 8 );
for( int x = 0; x < genParams.MapWidth; x++ ) {
for( int y = 0; y < genParams.MapLength; y++ ) {
int elevation = heightmap[(x + y*genParams.MapWidth)];
Block blockAbove = (Block)blocks[(((elevation + 1)*genParams.MapLength + y)*genParams.MapWidth + x)];
int index = (elevation*genParams.MapLength + y)*genParams.MapWidth + x;
if( blockAbove == Block.Air ) {
bool placeSand = growNoise1.GetNoise( x, y ) > 8;
if( (elevation <= waterLevel - 1) && placeSand ) {
blocks[index] = (byte)Block.Sand;
} else {
blocks[index] = (byte)Block.Grass;
}
} else if( ((blockAbove == Block.Water) || (blockAbove == Block.StillWater)) &&
(elevation <= waterLevel - 1) ) {
bool placeGravel = growNoise2.GetNoise( x, y ) > 12;
if( placeGravel ) {
blocks[index] = (byte)Block.Gravel;
}
}
}
}
}