Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cDistortedHeightmap Class Reference

#include <DistortedHeightmap.h>

Inheritance diagram for cDistortedHeightmap:
Inheritance graph
[legend]
Collaboration diagram for cDistortedHeightmap:
Collaboration graph
[legend]

Classes

struct  sGenParam
 

Public Member Functions

 cDistortedHeightmap (int a_Seed, cBiomeGen &a_BiomeGen)
 
- Public Member Functions inherited from cTerrainShapeGen
virtual ~cTerrainShapeGen ()
 

Protected Types

typedef cChunkDef::BiomeMap BiomeNeighbors[3][3]
 

Protected Member Functions

void GenerateHeightArray (void)
 Generates the m_DistortedHeightmap array for the current chunk. More...
 
virtual void GenShape (cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape) override
 Generates the shape for the given chunk. More...
 
void GetDistortAmpsAt (BiomeNeighbors &a_Neighbors, int a_RelX, int a_RelZ, NOISE_DATATYPE &a_DistortAmpX, NOISE_DATATYPE &a_DistortAmpZ)
 Calculates the X and Z distortion amplitudes based on the neighbors' biomes. More...
 
int GetHeightmapAt (NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
 Calculates the heightmap value (before distortion) at the specified (floating-point) coords. More...
 
void Initialize (cIniFile &a_IniFile)
 Reads the settings from the ini file. More...
 
virtual void InitializeShapeGen (cIniFile &a_IniFile) override
 Reads parameters from the ini file, prepares generator for use. More...
 
void PrepareState (cChunkCoords a_ChunkCoords)
 Unless the LastChunk coords are equal to coords given, prepares the internal state (noise arrays, heightmap). More...
 
void UpdateDistortAmps (void)
 Updates m_DistortAmpX/Z[] based on m_CurChunkX and m_CurChunkZ. More...
 

Protected Attributes

cBiomeGenm_BiomeGen
 The bime generator to query for biomes. More...
 
cChunkCoords m_CurChunkCoords
 
cChunkDef::HeightMap m_CurChunkHeights
 Heightmap for the current chunk, before distortion (from m_HeightGen). More...
 
NOISE_DATATYPE m_DistortAmpX [DIM_X *DIM_Z]
 
NOISE_DATATYPE m_DistortAmpZ [DIM_X *DIM_Z]
 
NOISE_DATATYPE m_DistortedHeightmap [17 *257 *17]
 
NOISE_DATATYPE m_FrequencyX
 
NOISE_DATATYPE m_FrequencyY
 
NOISE_DATATYPE m_FrequencyZ
 
cHeiGenCache m_HeightGen
 Cache for m_UnderlyingHeiGen. More...
 
bool m_IsInitialized
 True if Initialize() has been called. More...
 
cPerlinNoise m_NoiseDistortX
 
cPerlinNoise m_NoiseDistortZ
 
int m_SeaLevel
 
cHeiGenBiomal m_UnderlyingHeiGen
 The generator that provides the base heightmap (before distortion). More...
 

Static Protected Attributes

static const int DIM_X = 1 + (17 / INTERPOL_X)
 
static const int DIM_Y = 1 + (257 / INTERPOL_Y)
 
static const int DIM_Z = 1 + (17 / INTERPOL_Z)
 
static const int INTERPOL_X = 8
 
static const int INTERPOL_Y = 4
 
static const int INTERPOL_Z = 8
 
static const sGenParam m_GenParam [256]
 This table assigns a relative maximum overhang size in each direction to biomes. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cTerrainShapeGen
static std::unique_ptr< cTerrainShapeGenCreateShapeGen (cIniFile &a_IniFile, cBiomeGen &a_BiomeGen, int a_Seed, bool &a_CacheOffByDefault)
 Creates the correct TerrainShapeGen descendant based on the ini file settings and the seed provided. More...
 

Detailed Description

Definition at line 25 of file DistortedHeightmap.h.

Member Typedef Documentation

◆ BiomeNeighbors

typedef cChunkDef::BiomeMap cDistortedHeightmap::BiomeNeighbors[3][3]
protected

Definition at line 32 of file DistortedHeightmap.h.

Constructor & Destructor Documentation

◆ cDistortedHeightmap()

cDistortedHeightmap::cDistortedHeightmap ( int  a_Seed,
cBiomeGen a_BiomeGen 
)

Definition at line 121 of file DistortedHeightmap.cpp.

Member Function Documentation

◆ GenerateHeightArray()

void cDistortedHeightmap::GenerateHeightArray ( void  )
protected

Generates the m_DistortedHeightmap array for the current chunk.

Definition at line 181 of file DistortedHeightmap.cpp.

◆ GenShape()

void cDistortedHeightmap::GenShape ( cChunkCoords  a_ChunkCoords,
cChunkDesc::Shape a_Shape 
)
overrideprotectedvirtual

Generates the shape for the given chunk.

Implements cTerrainShapeGen.

Definition at line 232 of file DistortedHeightmap.cpp.

◆ GetDistortAmpsAt()

void cDistortedHeightmap::GetDistortAmpsAt ( BiomeNeighbors a_Neighbors,
int  a_RelX,
int  a_RelZ,
NOISE_DATATYPE a_DistortAmpX,
NOISE_DATATYPE a_DistortAmpZ 
)
protected

Calculates the X and Z distortion amplitudes based on the neighbors' biomes.

Definition at line 317 of file DistortedHeightmap.cpp.

◆ GetHeightmapAt()

int cDistortedHeightmap::GetHeightmapAt ( NOISE_DATATYPE  a_X,
NOISE_DATATYPE  a_Z 
)
protected

Calculates the heightmap value (before distortion) at the specified (floating-point) coords.

Definition at line 261 of file DistortedHeightmap.cpp.

◆ Initialize()

void cDistortedHeightmap::Initialize ( cIniFile a_IniFile)
protected

Reads the settings from the ini file.

Skips reading if already initialized.

Definition at line 143 of file DistortedHeightmap.cpp.

◆ InitializeShapeGen()

void cDistortedHeightmap::InitializeShapeGen ( cIniFile a_IniFile)
overrideprotectedvirtual

Reads parameters from the ini file, prepares generator for use.

Reimplemented from cTerrainShapeGen.

Definition at line 252 of file DistortedHeightmap.cpp.

◆ PrepareState()

void cDistortedHeightmap::PrepareState ( cChunkCoords  a_ChunkCoords)
protected

Unless the LastChunk coords are equal to coords given, prepares the internal state (noise arrays, heightmap).

Definition at line 163 of file DistortedHeightmap.cpp.

◆ UpdateDistortAmps()

void cDistortedHeightmap::UpdateDistortAmps ( void  )
protected

Updates m_DistortAmpX/Z[] based on m_CurChunkX and m_CurChunkZ.

Definition at line 293 of file DistortedHeightmap.cpp.

Member Data Documentation

◆ DIM_X

const int cDistortedHeightmap::DIM_X = 1 + (17 / INTERPOL_X)
staticprotected

Definition at line 40 of file DistortedHeightmap.h.

◆ DIM_Y

const int cDistortedHeightmap::DIM_Y = 1 + (257 / INTERPOL_Y)
staticprotected

Definition at line 41 of file DistortedHeightmap.h.

◆ DIM_Z

const int cDistortedHeightmap::DIM_Z = 1 + (17 / INTERPOL_Z)
staticprotected

Definition at line 42 of file DistortedHeightmap.h.

◆ INTERPOL_X

const int cDistortedHeightmap::INTERPOL_X = 8
staticprotected

Definition at line 35 of file DistortedHeightmap.h.

◆ INTERPOL_Y

const int cDistortedHeightmap::INTERPOL_Y = 4
staticprotected

Definition at line 36 of file DistortedHeightmap.h.

◆ INTERPOL_Z

const int cDistortedHeightmap::INTERPOL_Z = 8
staticprotected

Definition at line 37 of file DistortedHeightmap.h.

◆ m_BiomeGen

cBiomeGen& cDistortedHeightmap::m_BiomeGen
protected

The bime generator to query for biomes.

Definition at line 56 of file DistortedHeightmap.h.

◆ m_CurChunkCoords

cChunkCoords cDistortedHeightmap::m_CurChunkCoords
protected

Definition at line 52 of file DistortedHeightmap.h.

◆ m_CurChunkHeights

cChunkDef::HeightMap cDistortedHeightmap::m_CurChunkHeights
protected

Heightmap for the current chunk, before distortion (from m_HeightGen).

Used for optimization.

Definition at line 65 of file DistortedHeightmap.h.

◆ m_DistortAmpX

NOISE_DATATYPE cDistortedHeightmap::m_DistortAmpX[DIM_X *DIM_Z]
protected

Definition at line 76 of file DistortedHeightmap.h.

◆ m_DistortAmpZ

NOISE_DATATYPE cDistortedHeightmap::m_DistortAmpZ[DIM_X *DIM_Z]
protected

Definition at line 77 of file DistortedHeightmap.h.

◆ m_DistortedHeightmap

NOISE_DATATYPE cDistortedHeightmap::m_DistortedHeightmap[17 *257 *17]
protected

Definition at line 53 of file DistortedHeightmap.h.

◆ m_FrequencyX

NOISE_DATATYPE cDistortedHeightmap::m_FrequencyX
protected

Definition at line 48 of file DistortedHeightmap.h.

◆ m_FrequencyY

NOISE_DATATYPE cDistortedHeightmap::m_FrequencyY
protected

Definition at line 49 of file DistortedHeightmap.h.

◆ m_FrequencyZ

NOISE_DATATYPE cDistortedHeightmap::m_FrequencyZ
protected

Definition at line 50 of file DistortedHeightmap.h.

◆ m_GenParam

const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam
staticprotected

This table assigns a relative maximum overhang size in each direction to biomes.

Both numbers indicate a number which will multiply the noise value for each coord; this means that you can have different-sized overhangs in each direction. Usually you'd want to keep both numbers the same. The numbers are "relative", not absolute maximum; overhangs of a slightly larger size are possible due to the way that noise is calculated.

Definition at line 73 of file DistortedHeightmap.h.

◆ m_HeightGen

cHeiGenCache cDistortedHeightmap::m_HeightGen
protected

Cache for m_UnderlyingHeiGen.

Definition at line 62 of file DistortedHeightmap.h.

◆ m_IsInitialized

bool cDistortedHeightmap::m_IsInitialized
protected

True if Initialize() has been called.

Used to initialize-once even with multiple init entrypoints (HeiGen / CompoGen).

Definition at line 80 of file DistortedHeightmap.h.

◆ m_NoiseDistortX

cPerlinNoise cDistortedHeightmap::m_NoiseDistortX
protected

Definition at line 44 of file DistortedHeightmap.h.

◆ m_NoiseDistortZ

cPerlinNoise cDistortedHeightmap::m_NoiseDistortZ
protected

Definition at line 45 of file DistortedHeightmap.h.

◆ m_SeaLevel

int cDistortedHeightmap::m_SeaLevel
protected

Definition at line 47 of file DistortedHeightmap.h.

◆ m_UnderlyingHeiGen

cHeiGenBiomal cDistortedHeightmap::m_UnderlyingHeiGen
protected

The generator that provides the base heightmap (before distortion).

Definition at line 59 of file DistortedHeightmap.h.


The documentation for this class was generated from the following files: