diff options
author | Mattes D <github@xoft.cz> | 2014-11-17 16:50:28 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-11-17 16:50:28 +0100 |
commit | f9cfc36643b7cc0a2b8f46455d452beb6e444e0d (patch) | |
tree | f1463ba7da2afbfaf85cee045191f3e41b6a2abe /src/Generating/Noise3DGenerator.cpp | |
parent | Fixed a wrong assert in cClientHandle::SetViewDistance(). (diff) | |
download | cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar.gz cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar.bz2 cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar.lz cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar.xz cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.tar.zst cuberite-f9cfc36643b7cc0a2b8f46455d452beb6e444e0d.zip |
Diffstat (limited to 'src/Generating/Noise3DGenerator.cpp')
-rw-r--r-- | src/Generating/Noise3DGenerator.cpp | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp index f2af75999..654e9d01f 100644 --- a/src/Generating/Noise3DGenerator.cpp +++ b/src/Generating/Noise3DGenerator.cpp @@ -61,35 +61,6 @@ public: -/** Linearly interpolates between two values. -Assumes that a_Ratio is in range [0, 1]. */ -inline static NOISE_DATATYPE Lerp(NOISE_DATATYPE a_Val1, NOISE_DATATYPE a_Val2, NOISE_DATATYPE a_Ratio) -{ - return a_Val1 + (a_Val2 - a_Val1) * a_Ratio; -} - - - - - -/** Linearly interpolates between two values, clamping the ratio to [0, 1] first. */ -inline static NOISE_DATATYPE ClampedLerp(NOISE_DATATYPE a_Val1, NOISE_DATATYPE a_Val2, NOISE_DATATYPE a_Ratio) -{ - if (a_Ratio < 0) - { - return a_Val1; - } - if (a_Ratio > 1) - { - return a_Val2; - } - return Lerp(a_Val1, a_Val2, a_Ratio); -} - - - - - //////////////////////////////////////////////////////////////////////////////// // cNoise3DGenerator: @@ -249,10 +220,10 @@ void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DAT NOISE_DATATYPE NoiseW[DIM_X * DIM_Y * DIM_Z]; // Workspace that the noise calculation can use and trash // Our noise array has different layout, XZY, instead of regular chunk's XYZ, that's why the coords are "renamed" - NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width)) / m_FrequencyX; - NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((a_ChunkX + 1) * cChunkDef::Width) - 1) / m_FrequencyX; - NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width)) / m_FrequencyZ; - NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((a_ChunkZ + 1) * cChunkDef::Width) - 1) / m_FrequencyZ; + NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((a_ChunkX + 1) * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width)) / m_FrequencyZ; + NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((a_ChunkZ + 1) * cChunkDef::Width)) / m_FrequencyZ; NOISE_DATATYPE StartY = 0; NOISE_DATATYPE EndY = ((NOISE_DATATYPE)256) / m_FrequencyY; |