summaryrefslogtreecommitdiffstats
path: root/src/Generating/BioGen.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Generating/BioGen.h')
-rw-r--r--src/Generating/BioGen.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h
index 20d199611..5fd0844d9 100644
--- a/src/Generating/BioGen.h
+++ b/src/Generating/BioGen.h
@@ -48,12 +48,12 @@ class cBioGenCache :
typedef cBiomeGen super;
public:
- cBioGenCache(cBiomeGen * a_BioGenToCache, int a_CacheSize); // Doesn't take ownership of a_BioGenToCache
- ~cBioGenCache();
+ cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize);
+ virtual ~cBioGenCache();
protected:
- cBiomeGen * m_BioGenToCache;
+ cBiomeGenPtr m_BioGenToCache;
struct sCacheData
{
@@ -87,19 +87,21 @@ class cBioGenMulticache :
typedef cBiomeGen super;
public:
- /*
- a_CacheSize defines the size of each singular cache
- a_CachesLength defines how many caches are used for the multicache
- */
- cBioGenMulticache(cBiomeGen * a_BioGenToCache, size_t a_CacheSize, size_t a_CachesLength); // Doesn't take ownership of a_BioGenToCache
- ~cBioGenMulticache();
+ /* Creates a new multicache - a cache that divides the caching into several sub-caches based on the chunk coords.
+ This allows us to use shorter cache depths with faster lookups for more covered area. (#381)
+ a_SubCacheSize defines the size of each sub-cache
+ a_NumSubCaches defines how many sub-caches are used for the multicache. */
+ cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
protected:
- typedef std::vector<cBiomeGen *> cBiomeGens;
+ typedef std::vector<cBiomeGenPtr> cBiomeGenPtrs;
+
+ /** Number of sub-caches. Pulled out of m_Caches.size() for faster access. */
+ size_t m_NumSubCaches;
- size_t m_CachesLength;
- cBiomeGens m_Caches;
+ /** Individual sub-caches. */
+ cBiomeGenPtrs m_Caches;
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
@@ -285,12 +287,7 @@ protected:
/// The Voronoi map that decides biomes inside individual biome groups
cVoronoiMap m_VoronoiSmall;
- /// The noise used to distort the input X coord
- cPerlinNoise m_DistortX;
-
- /// The noise used to distort the inupt Z coord
- cPerlinNoise m_DistortZ;
-
+ // The noises used for the distortion:
cNoise m_Noise1;
cNoise m_Noise2;
cNoise m_Noise3;
@@ -298,6 +295,14 @@ protected:
cNoise m_Noise5;
cNoise m_Noise6;
+ // Frequencies and amplitudes for the distortion noises:
+ float m_FreqX1, m_AmpX1;
+ float m_FreqX2, m_AmpX2;
+ float m_FreqX3, m_AmpX3;
+ float m_FreqZ1, m_AmpZ1;
+ float m_FreqZ2, m_AmpZ2;
+ float m_FreqZ3, m_AmpZ3;
+
// cBiomeGen overrides:
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;