summaryrefslogtreecommitdiffstats
path: root/source/Generating/StructGen.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-25 21:29:56 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-25 21:29:56 +0200
commitc40eb92de3981ec5a1666b64ab469b4d2df0d85a (patch)
tree9ebee5cfe180012ae7765a7bb890abfc718f29e2 /source/Generating/StructGen.cpp
parentAdded the initial version of DirectOverhangs (diff)
downloadcuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.gz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.bz2
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.lz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.xz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.zst
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.zip
Diffstat (limited to '')
-rw-r--r--source/Generating/StructGen.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/source/Generating/StructGen.cpp b/source/Generating/StructGen.cpp
index c9af06afb..044e789b5 100644
--- a/source/Generating/StructGen.cpp
+++ b/source/Generating/StructGen.cpp
@@ -513,7 +513,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cStructGenBiomeOverhangs:
+// cStructGenDirectOverhangs:
cStructGenDirectOverhangs::cStructGenDirectOverhangs(int a_Seed) :
m_Noise1(a_Seed),
@@ -625,3 +625,50 @@ bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cStructGenDistortedMembraneOverhangs:
+
+cStructGenDistortedMembraneOverhangs::cStructGenDistortedMembraneOverhangs(int a_Seed) :
+ m_NoiseX(a_Seed + 1000),
+ m_NoiseY(a_Seed + 2000),
+ m_NoiseZ(a_Seed + 3000),
+ m_NoiseH(a_Seed + 4000)
+{
+}
+
+
+
+
+
+void cStructGenDistortedMembraneOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
+{
+ const NOISE_DATATYPE Frequency = (NOISE_DATATYPE)16;
+ const NOISE_DATATYPE Amount = (NOISE_DATATYPE)1;
+ for (int y = 50; y < 128; y++)
+ {
+ NOISE_DATATYPE NoiseY = (NOISE_DATATYPE)y / 32;
+ // TODO: proper water level - where to get?
+ BLOCKTYPE ReplacementBlock = (y > 62) ? E_BLOCK_AIR : E_BLOCK_STATIONARY_WATER;
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z)) / Frequency;
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x)) / Frequency;
+ NOISE_DATATYPE DistortX = m_NoiseX.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ NOISE_DATATYPE DistortY = m_NoiseY.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ NOISE_DATATYPE DistortZ = m_NoiseZ.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ int MembraneHeight = 96 - (int)((DistortY + m_NoiseH.CubicNoise2D(NoiseX + DistortX, NoiseZ + DistortZ)) * 30);
+ if (MembraneHeight < y)
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, ReplacementBlock);
+ }
+ } // for y
+ } // for x
+ } // for z
+}
+
+
+
+