diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-19 16:10:00 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-19 16:10:00 +0100 |
commit | b3b96d645ef9b09338c6f93bbe95100f3ce1a57d (patch) | |
tree | 7a27c4048661ef35a81e1ac389fb7307fca486c9 | |
parent | Updated bindings for new cChunkDesc functions (diff) | |
download | cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar.gz cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar.bz2 cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar.lz cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar.xz cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.tar.zst cuberite-b3b96d645ef9b09338c6f93bbe95100f3ce1a57d.zip |
-rw-r--r-- | source/Generating/BioGen.cpp | 15 | ||||
-rw-r--r-- | source/Generating/BioGen.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/source/Generating/BioGen.cpp b/source/Generating/BioGen.cpp index e5c863d75..40fa0de53 100644 --- a/source/Generating/BioGen.cpp +++ b/source/Generating/BioGen.cpp @@ -595,24 +595,27 @@ void cBioGenMultiStepMap::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap) { - for (int z = 0; z < cChunkDef::Width; z++) + // Linear interpolation over 8x8 blocks + for (int z = 0; z < 17; z += 8) { float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize; - for (int x = 0; x < cChunkDef::Width; x++) + for (int x = 0; x < 17; x += 8) { float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize; double NoiseT = m_Noise.CubicNoise3D( NoiseCoordX, NoiseCoordZ, 7000); NoiseT += 0.5 * m_Noise.CubicNoise3D(2 * NoiseCoordX, 2 * NoiseCoordZ, 8000); NoiseT += 0.1 * m_Noise.CubicNoise3D(8 * NoiseCoordX, 8 * NoiseCoordZ, 9000); - a_TemperatureMap[x + 16 * z] = std::max(0, std::min(255, (int)(128 + NoiseT * 128))); + a_TemperatureMap[x + 17 * z] = std::max(0, std::min(255, (int)(128 + NoiseT * 128))); double NoiseH = m_Noise.CubicNoise3D( NoiseCoordX, NoiseCoordZ, 9000); NoiseH += 0.5 * m_Noise.CubicNoise3D(2 * NoiseCoordX, 2 * NoiseCoordZ, 5000); NoiseH += 0.1 * m_Noise.CubicNoise3D(8 * NoiseCoordX, 8 * NoiseCoordZ, 1000); - a_HumidityMap[x + 16 * z] = std::max(0, std::min(255, (int)(128 + NoiseH * 128))); + a_HumidityMap[x + 17 * z] = std::max(0, std::min(255, (int)(128 + NoiseH * 128))); } // for x } // for z + IntArrayLinearInterpolate2D(a_TemperatureMap, 17, 17, 8, 8); + IntArrayLinearInterpolate2D(a_HumidityMap, 17, 17, 8, 8); } @@ -643,6 +646,7 @@ void cBioGenMultiStepMap::DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, con } ; for (int z = 0; z < cChunkDef::Width; z++) { + int idxZ = 17 * z; for (int x = 0; x < cChunkDef::Width; x++) { if (cChunkDef::GetBiome(a_BiomeMap, x, z) != -1) @@ -650,7 +654,7 @@ void cBioGenMultiStepMap::DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, con // Already set before continue; } - int idx = x + 16 * z; + int idx = idxZ + x; int Temperature = a_TemperatureMap[idx] / 16; // -> [0..15] range int Humidity = a_HumidityMap[idx] / 16; // -> [0..15] range cChunkDef::SetBiome(a_BiomeMap, x, z, BiomeMap[Temperature + 16 * Humidity]); @@ -680,6 +684,7 @@ void cBioGenMultiStepMap::FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, co case biOcean: cChunkDef::SetBiome(a_BiomeMap, x, z, biFrozenOcean); break; } } // for x + idx += 1; } // for z } diff --git a/source/Generating/BioGen.h b/source/Generating/BioGen.h index 0df80967f..88ca3e438 100644 --- a/source/Generating/BioGen.h +++ b/source/Generating/BioGen.h @@ -183,7 +183,7 @@ protected: float m_RiverWidthThreshold; float m_LandBiomesSize; - typedef int IntMap[256]; // x + 16 * z, expected trimmed into [0..255] range + typedef int IntMap[17 * 17]; // x + 17 * z, expected trimmed into [0..255] range // cBiomeGen overrides: virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; |