![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Caches heightmaps in multiple underlying caches to improve the distribution and lower the chain length. More...
#include <HeiGen.h>
Public Member Functions | |
cHeiGenMultiCache (std::unique_ptr< cTerrainHeightGen > a_HeightGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches) | |
virtual void | GenHeightMap (cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override |
Retrieves the heightmap for the specified chunk. More... | |
virtual HEIGHTTYPE | GetHeightAt (int a_BlockX, int a_BlockZ) override |
Returns the height at the specified column. More... | |
bool | GetHeightAt (int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE &a_Height) |
Retrieves height at the specified point in the cache, returns true if found, false if not found. More... | |
![]() | |
virtual void | InitializeHeightGen (cIniFile &a_IniFile) |
Initializes the generator, reading its parameters from the INI file. More... | |
virtual | ~cTerrainHeightGen () |
Protected Attributes | |
size_t | m_NumSubCaches |
Number of sub-caches, pulled out of m_SubCaches.size() for performance reasons. More... | |
std::vector< std::unique_ptr< cHeiGenCache > > | m_SubCaches |
The individual sub-caches. More... | |
std::unique_ptr< cTerrainHeightGen > | m_Underlying |
The underlying height generator. More... | |
Static Protected Attributes | |
static const size_t | m_CoeffZ = 5 |
The coefficient used to turn Z coords into index (x + Coeff * z). More... | |
Additional Inherited Members | |
![]() | |
static std::unique_ptr< cTerrainHeightGen > | CreateHeightGen (cIniFile &a_IniFile, cBiomeGen &a_BiomeGen, int a_Seed, bool &a_CacheOffByDefault) |
Creates a cTerrainHeightGen descendant based on the INI file settings. More... | |
Caches heightmaps in multiple underlying caches to improve the distribution and lower the chain length.
cHeiGenMultiCache::cHeiGenMultiCache | ( | std::unique_ptr< cTerrainHeightGen > | a_HeightGenToCache, |
size_t | a_SubCacheSize, | ||
size_t | a_NumSubCaches | ||
) |
Definition at line 222 of file HeiGen.cpp.
|
overridevirtual |
Retrieves the heightmap for the specified chunk.
Implements cTerrainHeightGen.
Definition at line 238 of file HeiGen.cpp.
|
overridevirtual |
Returns the height at the specified column.
The default implementation calls GenHeightMap(), and then queries the heightmap. Descendants may provide a better-performing method.
Reimplemented from cTerrainHeightGen.
Definition at line 251 of file HeiGen.cpp.
bool cHeiGenMultiCache::GetHeightAt | ( | int | a_ChunkX, |
int | a_ChunkZ, | ||
int | a_RelX, | ||
int | a_RelZ, | ||
HEIGHTTYPE & | a_Height | ||
) |
Retrieves height at the specified point in the cache, returns true if found, false if not found.
Definition at line 272 of file HeiGen.cpp.
|
staticprotected |
|
protected |
|
protected |
|
protected |