From 205ee49c79b2a0304278d8c75ac515199a35e8ca Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 6 May 2013 16:46:48 +0000 Subject: DistortedHeightmap: Optimized by linear interpolation git-svn-id: http://mc-server.googlecode.com/svn/trunk@1451 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/DistortedHeightmap.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source/Generating/DistortedHeightmap.h') diff --git a/source/Generating/DistortedHeightmap.h b/source/Generating/DistortedHeightmap.h index 83c638ce8..2b962940a 100644 --- a/source/Generating/DistortedHeightmap.h +++ b/source/Generating/DistortedHeightmap.h @@ -48,11 +48,9 @@ protected: int m_CurChunkX; int m_CurChunkZ; - NOISE_DATATYPE m_NoiseArray[17 * 17 * NOISE_SIZE_Y]; - NOISE_DATATYPE * m_NoiseArrayX; - NOISE_DATATYPE * m_NoiseArrayZ; + NOISE_DATATYPE m_DistortedHeightmap[17 * 17 * 257]; - cBiomeGen & m_BiomeGen; + cBiomeGen & m_BiomeGen; cHeiGenBiomal m_UnderlyingHeiGen; // This generator provides us with base heightmap (before distortion) cHeiGenCache m_HeightGen; // Cache above m_UnderlyingHeiGen @@ -74,15 +72,12 @@ protected: /// Unless the LastChunk coords are equal to coords given, prepares the internal state (noise arrays, heightmap) void PrepareState(int a_ChunkX, int a_ChunkZ); - /// Generates the 3D noise array using the specified noise objects - void GenerateNoiseArray(NOISE_DATATYPE * a_NoiseArray, cNoise & a_Noise1, cNoise & a_Noise2, cNoise & a_Noise3); + /// Generates the m_DistortedHeightmap array for the current chunk + void GenerateHeightArray(void); /// Calculates the heightmap value (before distortion) at the specified (floating-point) coords int GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z); - /// Calculates the height (after distortion) - int GetValue(int a_NoiseArrayIdx, int a_RelX, int a_RelZ); - /// Updates m_DistortAmpX/Z[] based on m_CurChunkX and m_CurChunkZ void UpdateDistortAmps(void); -- cgit v1.2.3