From 3b74107bf3c6d224bb79c4a0595a0ad16193cc77 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 20 Apr 2015 18:03:25 +0200 Subject: Changed Nether composition to change the threshold from a cubic noise --- src/Generating/CompoGen.cpp | 12 ++++++------ src/Generating/CompoGen.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Generating') diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index cb9c04fd7..744979cc1 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -218,7 +218,7 @@ void cCompoGenClassic::InitializeCompoGen(cIniFile & a_IniFile) cCompoGenNether::cCompoGenNether(int a_Seed) : m_Noise1(a_Seed + 10), m_Noise2(a_Seed * a_Seed * 10 + a_Seed * 1000 + 6000), - m_Threshold(0) + m_MaxThreshold(10000) { } @@ -229,6 +229,8 @@ cCompoGenNether::cCompoGenNether(int a_Seed) : void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) { HEIGHTTYPE MaxHeight = a_ChunkDesc.GetMaxHeight(); + + int Threshold = static_cast(m_Noise1.CubicNoise2D(static_cast(a_ChunkDesc.GetChunkX()) / 50, static_cast(a_ChunkDesc.GetChunkZ()) / 50) * m_MaxThreshold); const int SEGMENT_HEIGHT = 8; const int INTERPOL_X = 16; // Must be a divisor of 16 @@ -287,12 +289,10 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc: for (int y = 0; y < SEGMENT_HEIGHT; y++) { int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT; - BLOCKTYPE Block = E_BLOCK_AIR; - if (Val < m_Threshold) // Don't calculate if the block should be Netherrack or Soulsand when it's already decided that it's air. + if (Val < Threshold) // Don't calculate if the block should be Netherrack when it's already decided that it's air. { - Block = E_BLOCK_NETHERRACK; + a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_NETHERRACK); } - a_ChunkDesc.SetBlockType(x, y + Segment, z, Block); } } @@ -329,7 +329,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc: void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile) { - m_Threshold = a_IniFile.GetValueSetI("Generator", "NetherThreshold", m_Threshold); + m_MaxThreshold = a_IniFile.GetValueSetF("Generator", "NetherMaxThreshold", m_MaxThreshold); } diff --git a/src/Generating/CompoGen.h b/src/Generating/CompoGen.h index 3847688cd..d4d38bfdd 100644 --- a/src/Generating/CompoGen.h +++ b/src/Generating/CompoGen.h @@ -99,7 +99,7 @@ protected: cNoise m_Noise1; cNoise m_Noise2; - int m_Threshold; + double m_MaxThreshold; // cTerrainCompositionGen overrides: virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override; -- cgit v1.2.3 From cc67a8bde9219ff5cc435ad702627792ca8bc76f Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 21 Apr 2015 16:01:27 +0200 Subject: Calculate threshold for each column in a chunk instead for the whole chunk --- src/Generating/CompoGen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Generating') diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 744979cc1..b33a157d0 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -229,8 +229,6 @@ cCompoGenNether::cCompoGenNether(int a_Seed) : void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) { HEIGHTTYPE MaxHeight = a_ChunkDesc.GetMaxHeight(); - - int Threshold = static_cast(m_Noise1.CubicNoise2D(static_cast(a_ChunkDesc.GetChunkX()) / 50, static_cast(a_ChunkDesc.GetChunkZ()) / 50) * m_MaxThreshold); const int SEGMENT_HEIGHT = 8; const int INTERPOL_X = 16; // Must be a divisor of 16 @@ -284,6 +282,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc: // Interpolate between FloorLo and FloorHi: for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) { + int Threshold = static_cast(m_Noise1.CubicNoise2D(static_cast(BaseX + x) / 75, static_cast(BaseZ + z) / 75) * m_MaxThreshold); int Lo = FloorLo[x + 17 * z] / 256; int Hi = FloorHi[x + 17 * z] / 256; for (int y = 0; y < SEGMENT_HEIGHT; y++) -- cgit v1.2.3 From c5189aaf9c3c2685cf320e2a0cbf73059bc05e29 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 21 Apr 2015 16:30:18 +0200 Subject: Changed default MaxThreshold value There is now really a difference between open and dense parts --- src/Generating/CompoGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Generating') diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index b33a157d0..7cadc881a 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -218,7 +218,7 @@ void cCompoGenClassic::InitializeCompoGen(cIniFile & a_IniFile) cCompoGenNether::cCompoGenNether(int a_Seed) : m_Noise1(a_Seed + 10), m_Noise2(a_Seed * a_Seed * 10 + a_Seed * 1000 + 6000), - m_MaxThreshold(10000) + m_MaxThreshold(25000) { } -- cgit v1.2.3