Cuberite
A lightweight, fast and extensible game server for Minecraft
|
A simple cache that stores N most recently generated chunks' heightmaps; N being settable upon creation. More...
#include <HeiGen.h>
Classes | |
struct | sCacheData |
Public Member Functions | |
cHeiGenCache (cTerrainHeightGen &a_HeiGenToCache, size_t a_CacheSize) | |
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... | |
Public Member Functions inherited from cTerrainHeightGen | |
virtual void | InitializeHeightGen (cIniFile &a_IniFile) |
Initializes the generator, reading its parameters from the INI file. More... | |
virtual | ~cTerrainHeightGen () |
Protected Attributes | |
std::vector< sCacheData > | m_CacheData |
std::vector< size_t > | m_CacheOrder |
size_t | m_CacheSize |
cTerrainHeightGen & | m_HeiGenToCache |
The terrain height generator that is being cached. More... | |
size_t | m_NumHits |
size_t | m_NumMisses |
size_t | m_TotalChain |
Additional Inherited Members | |
Static Public Member Functions inherited from cTerrainHeightGen | |
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... | |
A simple cache that stores N most recently generated chunks' heightmaps; N being settable upon creation.
cHeiGenCache::cHeiGenCache | ( | cTerrainHeightGen & | a_HeiGenToCache, |
size_t | a_CacheSize | ||
) |
Definition at line 109 of file HeiGen.cpp.
|
overridevirtual |
Retrieves the heightmap for the specified chunk.
Implements cTerrainHeightGen.
Definition at line 128 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 181 of file HeiGen.cpp.
bool cHeiGenCache::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 202 of file HeiGen.cpp.
|
protected |
|
protected |