diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:19:41 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:19:41 +0100 |
commit | 675b4aa878f16291ce33fced48a2bc7425f635ae (patch) | |
tree | 409914df27a98f65adf866da669429c4de141b6f /source/Generating/Noise3DGenerator.h | |
parent | LineBlockTracer: Using the coord-based block faces. (diff) | |
download | cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.gz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.bz2 cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.lz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.xz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.zst cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.zip |
Diffstat (limited to 'source/Generating/Noise3DGenerator.h')
-rw-r--r-- | source/Generating/Noise3DGenerator.h | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/source/Generating/Noise3DGenerator.h b/source/Generating/Noise3DGenerator.h deleted file mode 100644 index 0d211cddc..000000000 --- a/source/Generating/Noise3DGenerator.h +++ /dev/null @@ -1,106 +0,0 @@ - -// Noise3DGenerator.h - -// Generates terrain using 3D noise, rather than composing. Is a test. - - - - -#pragma once - -#include "ComposableGenerator.h" -#include "../Noise.h" - - - - - -class cNoise3DGenerator : - public cChunkGenerator::cGenerator -{ - typedef cChunkGenerator::cGenerator super; - -public: - cNoise3DGenerator(cChunkGenerator & a_ChunkGenerator); - virtual ~cNoise3DGenerator(); - - virtual void Initialize(cWorld * a_World, 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 = 8; - static const int UPSCALE_Y = 4; - static const int UPSCALE_Z = 8; - - // 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; - static const int DIM_Z = 1 + cChunkDef::Width / UPSCALE_Z; - - cPerlinNoise m_Perlin; // The base 3D noise source for the actual composition - cCubicNoise m_Cubic; // The noise used for heightmap directing - - int m_SeaLevel; - NOISE_DATATYPE m_HeightAmplification; - NOISE_DATATYPE m_MidPoint; // Where the vertical "center" of the noise should be - NOISE_DATATYPE m_FrequencyX; - 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); -} ; - - - - - -class cNoise3DComposable : - public cTerrainHeightGen, - public cTerrainCompositionGen -{ -public: - cNoise3DComposable(int a_Seed); - - void Initialize(cIniFile & a_IniFile); - -protected: - cNoise m_Noise1; - cNoise m_Noise2; - cNoise m_Noise3; - - int m_SeaLevel; - NOISE_DATATYPE m_HeightAmplification; - NOISE_DATATYPE m_MidPoint; // Where the vertical "center" of the noise should be - NOISE_DATATYPE m_FrequencyX; - NOISE_DATATYPE m_FrequencyY; - NOISE_DATATYPE m_FrequencyZ; - NOISE_DATATYPE m_AirThreshold; - - 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, unless the LastChunk coords are equal to coords given - void GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ); - - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; -} ; - - - - |