summaryrefslogtreecommitdiffstats
path: root/src/Generating/HeiGen.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-13 21:28:50 +0100
committerMattes D <github@xoft.cz>2014-11-13 21:28:50 +0100
commit7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40 (patch)
treeffb4c4568b3a0d17ace705d1f8e8683935c80511 /src/Generating/HeiGen.h
parentGenerator: Shape initial refactoring. (diff)
downloadcuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.gz
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.bz2
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.lz
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.xz
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.zst
cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.zip
Diffstat (limited to 'src/Generating/HeiGen.h')
-rw-r--r--src/Generating/HeiGen.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Generating/HeiGen.h b/src/Generating/HeiGen.h
index d91ace3bd..fe0a023e4 100644
--- a/src/Generating/HeiGen.h
+++ b/src/Generating/HeiGen.h
@@ -63,6 +63,38 @@ protected:
+/** Caches heightmaps in multiple underlying caches to improve the distribution and lower the chain length. */
+class cHeiGenMultiCache:
+ public cTerrainHeightGen
+{
+public:
+ cHeiGenMultiCache(cTerrainHeightGenPtr a_HeightGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
+
+ // cTerrainHeightGen overrides:
+ virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override;
+
+ /** Retrieves height at the specified point in the cache, returns true if found, false if not found */
+ bool GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height);
+
+protected:
+ typedef SharedPtr<cHeiGenCache> cHeiGenCachePtr;
+ typedef std::vector<cHeiGenCachePtr> cHeiGenCachePtrs;
+
+
+ /** The coefficient used to turn Z coords into index (x + Coeff * z). */
+ static const size_t m_CoeffZ = 5;
+
+ /** Number of sub-caches, pulled out of m_SubCaches.size() for performance reasons. */
+ size_t m_NumSubCaches;
+
+ /** The individual sub-caches. */
+ cHeiGenCachePtrs m_SubCaches;
+};
+
+
+
+
+
class cHeiGenFlat :
public cTerrainHeightGen
{