diff options
Diffstat (limited to '')
-rw-r--r-- | source/Generating/StructGen.cpp | 49 |
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 +} + + + + |