diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
commit | 6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch) | |
tree | 7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/Generating/BioGen.h | |
parent | Merge pull request #2958 from LogicParrot/fence (diff) | |
parent | Bulk clearing of whitespace (diff) | |
download | cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2 cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip |
Diffstat (limited to 'src/Generating/BioGen.h')
-rw-r--r-- | src/Generating/BioGen.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h index a5b8cc7e7..576c6b83d 100644 --- a/src/Generating/BioGen.h +++ b/src/Generating/BioGen.h @@ -27,7 +27,7 @@ class cBioGenConstant : { public: cBioGenConstant(void) : m_Biome(biPlains) {} - + protected: EMCSBiome m_Biome; @@ -46,32 +46,32 @@ class cBioGenCache : public cBiomeGen { typedef cBiomeGen super; - + public: cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize); virtual ~cBioGenCache(); - + protected: cBiomeGenPtr m_BioGenToCache; - + struct sCacheData { int m_ChunkX; int m_ChunkZ; cChunkDef::BiomeMap m_BiomeMap; } ; - + // To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data size_t m_CacheSize; size_t * m_CacheOrder; // MRU-ized order, indices into m_CacheData array sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used - + // Cache statistics size_t m_NumHits; size_t m_NumMisses; size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits) - + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; } ; @@ -117,13 +117,13 @@ class cBiomeGenList : public cBiomeGen { typedef cBiomeGen super; - + protected: // List of biomes that the generator is allowed to generate: typedef std::vector<EMCSBiome> EMCSBiomes; EMCSBiomes m_Biomes; int m_BiomesCount; // Pulled out of m_Biomes for faster access - + /** Parses the INI file setting string into m_Biomes. */ void InitializeBiomes(const AString & a_Biomes); } ; @@ -136,10 +136,10 @@ class cBioGenCheckerboard : public cBiomeGenList { typedef cBiomeGenList super; - + protected: int m_BiomeSize; - + // cBiomeGen overrides: virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; @@ -153,20 +153,20 @@ class cBioGenVoronoi : public cBiomeGenList { typedef cBiomeGenList super; - + public: cBioGenVoronoi(int a_Seed) : m_Voronoi(a_Seed) { } - + protected: cVoronoiMap m_Voronoi; - + // cBiomeGen overrides: virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; - + EMCSBiome VoronoiBiome(int a_BlockX, int a_BlockZ); } ; @@ -178,7 +178,7 @@ class cBioGenDistortedVoronoi : public cBiomeGenList { typedef cBiomeGenList super; - + public: cBioGenDistortedVoronoi(int a_Seed) : m_Noise(a_Seed), @@ -190,17 +190,17 @@ public: protected: /** Noise used for the distortion */ cNoise m_Noise; - + /** The underlying Voronoi map of the biomes */ cVoronoiMap m_Voronoi; - + /** Size of the Voronoi cells, also used for distortion amplitude */ int m_CellSize; - + // cBiomeGen overrides: virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; - + /** Distorts the coords using a Perlin-like noise */ void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ); } ; @@ -213,10 +213,10 @@ class cBioGenMultiStepMap : public cBiomeGen { typedef cBiomeGen super; - + public: cBioGenMultiStepMap(int a_Seed); - + protected: // Noises used for composing the perlin-noise: cNoise m_Noise1; @@ -225,42 +225,42 @@ protected: cNoise m_Noise4; cNoise m_Noise5; cNoise m_Noise6; - + int m_Seed; int m_OceanCellSize; int m_MushroomIslandSize; int m_RiverCellSize; double m_RiverWidthThreshold; float m_LandBiomesSize; - + typedef int IntMap[17 * 17]; // x + 17 * z, expected trimmed into [0..255] range typedef double DblMap[17 * 17]; // x + 17 * z, expected trimmed into [0..1] range - + // cBiomeGen overrides: virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; - + /** Step 1: Decides between ocean, land and mushroom, using a DistVoronoi with special conditions and post-processing for mushroom islands Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore. */ void DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); - + /** Step 2: Add rivers to the land Flips some "-1" biomes into biRiver. */ void AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); - + /** Step 3: Decide land biomes using a temperature / humidity map; freeze ocean / river in low temperatures. Flips all remaining "-1" biomes into land biomes. Also flips some biOcean and biRiver into biFrozenOcean, biFrozenRiver, based on temp map. */ void ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); - + /** Distorts the coords using a Perlin-like noise, with a specified cell-size */ void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize); - + /** Builds two Perlin-noise maps, one for temperature, the other for humidity. Trims both into [0..255] range */ void BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap); - + /** Flips all remaining "-1" biomes into land biomes using the two maps */ void DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap); - + /** Flips biOcean and biRiver into biFrozenOcean and biFrozenRiver if the temperature is too low */ void FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap); } ; @@ -273,17 +273,17 @@ class cBioGenTwoLevel : public cBiomeGen { typedef cBiomeGen super; - + public: cBioGenTwoLevel(int a_Seed); - + protected: /** The Voronoi map that decides the groups of biomes */ cVoronoiMap m_VoronoiLarge; - + /** The Voronoi map that decides biomes inside individual biome groups */ cVoronoiMap m_VoronoiSmall; - + // The noises used for the distortion: cNoise m_Noise1; cNoise m_Noise2; |