diff options
Diffstat (limited to 'src/Generating/Noise3DGenerator.h')
-rw-r--r-- | src/Generating/Noise3DGenerator.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/Generating/Noise3DGenerator.h b/src/Generating/Noise3DGenerator.h index 9aceffc1d..820d1cbed 100644 --- a/src/Generating/Noise3DGenerator.h +++ b/src/Generating/Noise3DGenerator.h @@ -20,13 +20,11 @@ -class cNoise3DGenerator: - public cChunkGenerator +class cNoise3DGenerator : public cChunkGenerator { using Super = cChunkGenerator; -public: - + public: cNoise3DGenerator(); virtual ~cNoise3DGenerator() override; @@ -34,16 +32,16 @@ public: virtual void GenerateBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void Generate(cChunkDesc & a_ChunkDesc) override; -protected: + 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_X = 1 + cChunkDef::Width / UPSCALE_X; static const int DIM_Y = 1 + cChunkDef::Height / UPSCALE_Y; - static const int DIM_Z = 1 + cChunkDef::Width / UPSCALE_Z; + static const int DIM_Z = 1 + cChunkDef::Width / UPSCALE_Z; /** The base 3D noise source for the actual composition */ cOctavedNoise<cInterp5DegNoise> m_Perlin; @@ -51,7 +49,7 @@ protected: /** The noise used for heightmap directing. */ cOctavedNoise<cInterp5DegNoise> m_Cubic; - int m_SeaLevel; + int m_SeaLevel; NOISE_DATATYPE m_HeightAmplification; NOISE_DATATYPE m_MidPoint; // Where the vertical "center" of the noise should be NOISE_DATATYPE m_FrequencyX; @@ -64,21 +62,20 @@ protected: /** Composes terrain - adds dirt, grass and sand */ void ComposeTerrain(cChunkDesc & a_ChunkDesc); -} ; +}; -class cNoise3DComposable : - public cTerrainShapeGen +class cNoise3DComposable : public cTerrainShapeGen { -public: + public: cNoise3DComposable(int a_Seed); void Initialize(cIniFile & a_IniFile); -protected: + protected: /** The 3D noise that is used to choose between density noise A and B. */ cOctavedNoise<cInterpolNoise<Interp5Deg>> m_ChoiceNoise; @@ -120,27 +117,27 @@ protected: 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 */ + /** Generates the 3D noise array used for terrain generation (m_NoiseArray), unless the LastChunk coords are equal + * to coords given */ void GenerateNoiseArrayIfNeeded(cChunkCoords a_ChunkCoords); // cTerrainHeightGen overrides: virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape & a_Shape) override; virtual void InitializeShapeGen(cIniFile & a_IniFile) override { Initialize(a_IniFile); } -} ; +}; -class cBiomalNoise3DComposable : - public cTerrainShapeGen +class cBiomalNoise3DComposable : public cTerrainShapeGen { -public: + public: cBiomalNoise3DComposable(int a_Seed, cBiomeGen & a_BiomeGen); void Initialize(cIniFile & a_IniFile); -protected: + protected: /** Number of columns around the pixel to query for biomes for averaging. Must be less than or equal to 16. */ static const int AVERAGING_SIZE = 9; @@ -194,7 +191,8 @@ protected: NOISE_DATATYPE m_WeightSum; - /** Generates the 3D noise array used for terrain generation (m_NoiseArray), unless the LastChunk coords are equal to coords given */ + /** Generates the 3D noise array used for terrain generation (m_NoiseArray), unless the LastChunk coords are equal + * to coords given */ void GenerateNoiseArrayIfNeeded(cChunkCoords a_ChunkCoords); /** Calculates the biome-related parameters for the chunk. */ @@ -206,4 +204,4 @@ protected: // cTerrainShapeGen overrides: virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape & a_Shape) override; virtual void InitializeShapeGen(cIniFile & a_IniFile) override { Initialize(a_IniFile); } -} ; +}; |