diff options
Diffstat (limited to 'src/Generating/Noise3DGenerator.h')
-rw-r--r-- | src/Generating/Noise3DGenerator.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Generating/Noise3DGenerator.h b/src/Generating/Noise3DGenerator.h index f9317abe2..1bbae2584 100644 --- a/src/Generating/Noise3DGenerator.h +++ b/src/Generating/Noise3DGenerator.h @@ -24,21 +24,21 @@ class cNoise3DGenerator : public cChunkGenerator::cGenerator { typedef cChunkGenerator::cGenerator super; - + public: cNoise3DGenerator(cChunkGenerator & a_ChunkGenerator); virtual ~cNoise3DGenerator(); - + virtual void Initialize(cIniFile & a_IniFile) override; virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) override; - + protected: // Linear interpolation step sizes, must be divisors of cChunkDef::Width and cChunkDef::Height, respectively: static const int UPSCALE_X = 4; static const int UPSCALE_Y = 8; static const int UPSCALE_Z = 4; - + // Linear interpolation buffer dimensions, calculated from the step sizes: static const int DIM_X = 1 + cChunkDef::Width / UPSCALE_X; static const int DIM_Y = 1 + cChunkDef::Height / UPSCALE_Y; @@ -49,7 +49,7 @@ protected: /** The noise used for heightmap directing. */ cOctavedNoise<cInterp5DegNoise> m_Cubic; - + int m_SeaLevel; NOISE_DATATYPE m_HeightAmplification; NOISE_DATATYPE m_MidPoint; // Where the vertical "center" of the noise should be @@ -57,13 +57,13 @@ protected: NOISE_DATATYPE m_FrequencyY; NOISE_DATATYPE m_FrequencyZ; NOISE_DATATYPE m_AirThreshold; - + /** Generates the 3D noise array used for terrain generation; a_Noise is of ChunkData-size */ void GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_Noise); - + /** Updates heightmap based on the chunk's contents */ void UpdateHeightmap(cChunkDesc & a_ChunkDesc); - + /** Composes terrain - adds dirt, grass and sand */ void ComposeTerrain(cChunkDesc & a_ChunkDesc); } ; @@ -92,7 +92,7 @@ protected: /** Heightmap-like noise used to provide variance for low-amplitude biomes. */ cOctavedNoise<cInterpolNoise<Interp5Deg>> m_BaseNoise; - + /** The main parameter of the generator, specifies the slope of the vertical linear gradient. A higher value means a steeper slope and a smaller total amplitude of the generated terrain. */ NOISE_DATATYPE m_HeightAmplification; @@ -116,16 +116,16 @@ protected: // Threshold for when the values are considered air: NOISE_DATATYPE m_AirThreshold; - + // Cache for the last calculated chunk (reused between heightmap and composition queries): int m_LastChunkX; int m_LastChunkZ; NOISE_DATATYPE m_NoiseArray[17 * 17 * 257]; // x + 17 * z + 17 * 17 * y - - + + /** Generates the 3D noise array used for terrain generation (m_NoiseArray), unless the LastChunk coords are equal to coords given */ void GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ); - + // cTerrainHeightGen overrides: virtual void GenShape(int a_ChunkX, int a_ChunkZ, cChunkDesc::Shape & a_Shape) override; virtual void InitializeShapeGen(cIniFile & a_IniFile) override { Initialize(a_IniFile); } @@ -165,7 +165,7 @@ protected: /** The underlying biome generator. */ cBiomeGenPtr m_BiomeGen; - + /** Block height of the sealevel, used for composing the terrain. */ int m_SeaLevel; @@ -185,7 +185,7 @@ protected: // Threshold for when the values are considered air: NOISE_DATATYPE m_AirThreshold; - + // Cache for the last calculated chunk (reused between heightmap and composition queries): int m_LastChunkX; int m_LastChunkZ; @@ -196,8 +196,8 @@ protected: /** The sum of m_Weight[]. */ NOISE_DATATYPE m_WeightSum; - - + + /** Generates the 3D noise array used for terrain generation (m_NoiseArray), unless the LastChunk coords are equal to coords given */ void GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ); @@ -206,7 +206,7 @@ protected: /** Returns the parameters for the specified biome. */ void GetBiomeParams(EMCSBiome a_Biome, NOISE_DATATYPE & a_HeightAmp, NOISE_DATATYPE & a_MidPoint); - + // cTerrainShapeGen overrides: virtual void GenShape(int a_ChunkX, int a_ChunkZ, cChunkDesc::Shape & a_Shape) override; virtual void InitializeShapeGen(cIniFile & a_IniFile) override { Initialize(a_IniFile); } |