From 1927095d25614bcec73f93e74424110d3feefc7f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 12 May 2013 17:55:49 +0000 Subject: Renamed linear interpolation from Noise.h to a more proper LinearUpscale and moved it to a separate file. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1475 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/BioGen.cpp | 13 +++++++------ source/Generating/CompoGen.cpp | 5 +++-- source/Generating/DistortedHeightmap.cpp | 7 ++++--- source/Generating/HeiGen.cpp | 3 ++- source/Generating/Noise3DGenerator.cpp | 3 ++- source/Generating/StructGen.cpp | 5 +++-- 6 files changed, 21 insertions(+), 15 deletions(-) (limited to 'source/Generating') diff --git a/source/Generating/BioGen.cpp b/source/Generating/BioGen.cpp index 1a73fe109..13e7c88ae 100644 --- a/source/Generating/BioGen.cpp +++ b/source/Generating/BioGen.cpp @@ -6,6 +6,7 @@ #include "Globals.h" #include "BioGen.h" #include "../../iniFile/iniFile.h" +#include "../LinearUpscale.h" @@ -339,8 +340,8 @@ void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::B Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z]); } - IntArrayLinearInterpolate2D(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - IntArrayLinearInterpolate2D(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + ArrayLinearUpscale2D(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + ArrayLinearUpscale2D(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); for (int z = 0; z < cChunkDef::Width; z++) { @@ -446,8 +447,8 @@ void cBioGenMultiStepMap::DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cC { Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z], DistortSize); } - IntArrayLinearInterpolate2D(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - IntArrayLinearInterpolate2D(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + ArrayLinearUpscale2D(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + ArrayLinearUpscale2D(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); // Prepare a 9x9 area of neighboring cell seeds // (assuming that 7x7 cell area is larger than a chunk being generated) @@ -620,8 +621,8 @@ void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_Chunk HumidityMap[x + 17 * z] = NoiseH; } // for x } // for z - ArrayLinearInterpolate2D(TemperatureMap, 17, 17, 8, 8); - ArrayLinearInterpolate2D(HumidityMap, 17, 17, 8, 8); + ArrayLinearUpscale2D(TemperatureMap, 17, 17, 8, 8); + ArrayLinearUpscale2D(HumidityMap, 17, 17, 8, 8); // Re-map into integral values in [0 .. 255] range: for (int idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++) diff --git a/source/Generating/CompoGen.cpp b/source/Generating/CompoGen.cpp index 1d2affc94..c8f8ac069 100644 --- a/source/Generating/CompoGen.cpp +++ b/source/Generating/CompoGen.cpp @@ -10,6 +10,7 @@ #include "Globals.h" #include "CompoGen.h" #include "../BlockID.h" +#include "../LinearUpscale.h" @@ -441,7 +442,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) / 256; } // for x, z - FloorLo[] - IntArrayLinearInterpolate2D(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); // Interpolate segments: for (int Segment = 0; Segment < MaxHeight; Segment += SEGMENT_HEIGHT) @@ -454,7 +455,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) m_Noise2.IntNoise3DInt(BaseX + INTERPOL_Z * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) / 256; } // for x, z - FloorLo[] - IntArrayLinearInterpolate2D(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); // Interpolate between FloorLo and FloorHi: for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) diff --git a/source/Generating/DistortedHeightmap.cpp b/source/Generating/DistortedHeightmap.cpp index 2ffaab089..d44ef60e5 100644 --- a/source/Generating/DistortedHeightmap.cpp +++ b/source/Generating/DistortedHeightmap.cpp @@ -8,6 +8,7 @@ #include "DistortedHeightmap.h" #include "../OSSupport/File.h" #include "../../iniFile/iniFile.h" +#include "../LinearUpscale.h" @@ -157,7 +158,7 @@ void cDistortedHeightmap::GenerateHeightArray(void) CurFloor[idx + x * INTERPOL_X] = (NOISE_DATATYPE)GetHeightmapAt(DistX, DistZ) + (NOISE_DATATYPE)0.5; } // for x } // for z - ArrayLinearInterpolate2D(CurFloor, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(CurFloor, 17, 17, INTERPOL_X, INTERPOL_Z); } // for y // Finish the 3D linear interpolation by interpolating between each XZ-floors on the Y axis @@ -344,8 +345,8 @@ void cDistortedHeightmap::UpdateDistortAmps(void) GetDistortAmpsAt(Biomes, x, z, m_DistortAmpX[x + 17 * z], m_DistortAmpZ[x + 17 * z]); } } - ArrayLinearInterpolate2D(m_DistortAmpX, 17, 17, STEPX, STEPZ); - ArrayLinearInterpolate2D(m_DistortAmpZ, 17, 17, STEPX, STEPZ); + ArrayLinearUpscale2D(m_DistortAmpX, 17, 17, STEPX, STEPZ); + ArrayLinearUpscale2D(m_DistortAmpZ, 17, 17, STEPX, STEPZ); } diff --git a/source/Generating/HeiGen.cpp b/source/Generating/HeiGen.cpp index 99fe5bd32..055ef87e2 100644 --- a/source/Generating/HeiGen.cpp +++ b/source/Generating/HeiGen.cpp @@ -5,6 +5,7 @@ #include "Globals.h" #include "HeiGen.h" +#include "../LinearUpscale.h" @@ -265,7 +266,7 @@ void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMa Height[x + 17 * z] = GetHeightAt(x, z, a_ChunkX, a_ChunkZ, Biomes); } } - ArrayLinearInterpolate2D(Height, 17, 17, STEPX, STEPZ); + ArrayLinearUpscale2D(Height, 17, 17, STEPX, STEPZ); // Copy into the heightmap for (int z = 0; z < cChunkDef::Width; z++) diff --git a/source/Generating/Noise3DGenerator.cpp b/source/Generating/Noise3DGenerator.cpp index e406127ed..cebb982fd 100644 --- a/source/Generating/Noise3DGenerator.cpp +++ b/source/Generating/Noise3DGenerator.cpp @@ -8,6 +8,7 @@ #include "../OSSupport/File.h" #include "../../iniFile/iniFile.h" #include "../LinearInterpolation.h" +#include "../LinearUpscale.h" @@ -439,7 +440,7 @@ void cNoise3DComposable::GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ) } } // Linear-interpolate this XZ floor: - ArrayLinearInterpolate2D(CurFloor, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(CurFloor, 17, 17, INTERPOL_X, INTERPOL_Z); } // Finish the 3D linear interpolation by interpolating between each XZ-floors on the Y axis diff --git a/source/Generating/StructGen.cpp b/source/Generating/StructGen.cpp index 044e789b5..e5ac03b49 100644 --- a/source/Generating/StructGen.cpp +++ b/source/Generating/StructGen.cpp @@ -6,6 +6,7 @@ #include "../BlockID.h" #include "Trees.h" #include "../BlockArea.h" +#include "../LinearUpscale.h" @@ -558,7 +559,7 @@ void cStructGenDirectOverhangs::GenStructures(cChunkDesc & a_ChunkDesc) m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, BaseY, BaseZ + INTERPOL_Z * z) / 256; } // for x, z - FloorLo[] - IntArrayLinearInterpolate2D(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); // Interpolate segments: for (int Segment = BaseY; Segment < MaxHeight; Segment += SEGMENT_HEIGHT) @@ -571,7 +572,7 @@ void cStructGenDirectOverhangs::GenStructures(cChunkDesc & a_ChunkDesc) m_Noise2.IntNoise3DInt(BaseX + INTERPOL_Z * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) / 256; } // for x, z - FloorLo[] - IntArrayLinearInterpolate2D(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); + ArrayLinearUpscale2D(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); // Interpolate between FloorLo and FloorHi: for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) -- cgit v1.2.3