diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-25 21:01:40 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-25 21:01:40 +0200 |
commit | a39e19e94a1086cc2c5974cecc5d383cd26b3d12 (patch) | |
tree | dc98ab0b293b7ab43865d4b8bba460f9073cb40b /src/Generating | |
parent | Speed up the NetherClumpFoliage finisher. (diff) | |
download | cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar.gz cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar.bz2 cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar.lz cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar.xz cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.tar.zst cuberite-a39e19e94a1086cc2c5974cecc5d383cd26b3d12.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/FinishGen.cpp | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index b2585bfee..4c40270e8 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -45,42 +45,14 @@ static inline bool IsWater(BLOCKTYPE a_BlockType) void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc) { - double ChunkX = a_ChunkDesc.GetChunkX() + 0.1; // We can't devide through 0 so lets add 0.1 to all the chunk coordinates. - double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1; - - NOISE_DATATYPE Val1 = m_Noise.IntNoise2D((int) (ChunkX * ChunkZ * 0.01f), (int) (ChunkZ / ChunkX * 0.01f)); - NOISE_DATATYPE Val2 = m_Noise.IntNoise2D((int) (ChunkX / ChunkZ / 0.01f), (int) (ChunkZ * ChunkX / 0.01f)); + int ChunkX = a_ChunkDesc.GetChunkX(); + int ChunkZ = a_ChunkDesc.GetChunkZ(); - if (Val1 < 0) - { - Val1 = -Val1; - } - - if (Val2 < 0) - { - Val2 = -Val2; - } + int Val1 = m_Noise.IntNoise2DInt(ChunkX ^ ChunkZ, ChunkZ + ChunkX); + int Val2 = m_Noise.IntNoise2DInt(ChunkZ ^ ChunkX, ChunkZ - ChunkX); - int PosX, PosZ; - // Calculate PosX - if (Val1 <= 1) - { - PosX = (int) floor(Val1 * 16); - } - else - { - PosX = (int) floor(16 / Val1); - } - - // Calculate PosZ - if (Val2 <= 1) - { - PosZ = (int) floor(Val2 * 16); - } - else - { - PosZ = (int) floor(16 / Val2); - } + int PosX = Val1 % 16; + int PosZ = Val2 % 16; for (int y = 1; y < cChunkDef::Height; y++) { |