private float Get3DNoise(float x, float y, float z) { var a = highGenerator.Generate(PointF.CreateXZ(x, y)); var b = highGenerator.Generate(PointF.CreateXZ(y, z)); var c = highGenerator.Generate(PointF.CreateXZ(z, x)); return((a + b + c) / 3); }
public Chunk <Block> Generate(Chunk <Block> chunk) { for (byte i = 0; i < Chunk <Block> .XLength; i++) { for (byte k = 0; k < Chunk <Block> .ZLength; k++) { var innerPoint = PointF.CreateXZ(chunk.Position.X * Chunk <Block> .XLength + i, chunk.Position.Z * Chunk <Block> .ZLength + k); var value = (int)(highGenerator.Generate(innerPoint) + 3); for (var y = value; y >= 0; y--) { var position = new PointB(i, (byte)y, k); chunk[position] = new Block(BaseBlocks.Bedrock, position); } } } return(chunk); }
public Chunk <Block> Generate(PointI point) { var chunk = new Chunk <Block>(point); for (byte i = 0; i < Chunk <Block> .XLength; i++) { for (byte k = 0; k < Chunk <Block> .ZLength; k++) { var innerPoint = PointF.CreateXZ(point.X * Chunk <Block> .XLength + i, point.Z * Chunk <Block> .ZLength + k); var value = (int)(highGenerator.Generate(innerPoint) * 22f + 100); for (var j = value; j >= 0; j--) { var position = new PointB(i, (byte)j, k); chunk[position] = new Block(j == value ? BaseBlocks.Grass : BaseBlocks.Dirt, position); } } } return(chunk); }
public Chunk <Block> Generate(PointI point) { var chunk = new Chunk <Block>(point); for (byte i = 0; i < Chunk <Block> .XLength; i++) { for (byte k = 0; k < Chunk <Block> .ZLength; k++) { var innerPoint = PointF.CreateXZ(point.X * Chunk <Block> .XLength + i, point.Z * Chunk <Block> .ZLength + k); var value = (int)(highGenerator.Generate(innerPoint) * 22f + 100); var acme = new PointB(i, (byte)value, k); chunk[acme] = new Block(BaseBlocks.Grass, acme); for (var y = value - 1; y >= 0; y--) { var position = new PointB(i, (byte)y, k); chunk[position] = new Block(BaseBlocks.Dirt, position); } } } return(chunk); }