Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Static Public Member Functions | List of all members
cTerrainShapeGen Class Referenceabstract

The interface that a terrain shape generator must implement A terrain shape generator takes chunk coords on input and outputs a 3D array of "shape" for that chunk. More...

#include <ComposableGenerator.h>

Inheritance diagram for cTerrainShapeGen:
Inheritance graph
[legend]

Public Member Functions

virtual void GenShape (cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape)=0
 Generates the shape for the given chunk. More...
 
virtual void InitializeShapeGen (cIniFile &a_IniFile)
 Reads parameters from the ini file, prepares generator for use. More...
 
virtual ~cTerrainShapeGen ()
 

Static Public Member Functions

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

The interface that a terrain shape generator must implement A terrain shape generator takes chunk coords on input and outputs a 3D array of "shape" for that chunk.

The shape here represents the distinction between air and solid; there's no representation of Water since that is added by the composition geenrator. The output array is indexed [y + 256 * z + 16 * 256 * x], so that it's fast to later compose a single column of the terrain, which is the dominant operation following the shape generation. The generator may request biome information from the underlying BiomeGen, it may even request information for other chunks than the one it's currently generating (neighbors - for averaging)

Definition at line 78 of file ComposableGenerator.h.

Constructor & Destructor Documentation

◆ ~cTerrainShapeGen()

virtual cTerrainShapeGen::~cTerrainShapeGen ( )
inlinevirtual

Definition at line 81 of file ComposableGenerator.h.

Member Function Documentation

◆ CreateShapeGen()

std::unique_ptr< cTerrainShapeGen > cTerrainShapeGen::CreateShapeGen ( cIniFile a_IniFile,
cBiomeGen a_BiomeGen,
int  a_Seed,
bool &  a_CacheOffByDefault 
)
static

Creates the correct TerrainShapeGen descendant based on the ini file settings and the seed provided.

a_BiomeGen is the underlying biome generator, some shape generators may depend on it providing additional biomes data around the chunk a_CacheOffByDefault gets set to whether the cache should be disabled by default Implemented in ShapeGen.cpp!

Definition at line 78 of file ShapeGen.cpp.

◆ GenShape()

virtual void cTerrainShapeGen::GenShape ( cChunkCoords  a_ChunkCoords,
cChunkDesc::Shape a_Shape 
)
pure virtual

Generates the shape for the given chunk.

Implemented in cTwoHeights, cTerrainHeightToShapeGen, cBiomalNoise3DComposable, cNoise3DComposable, cEndGen, and cDistortedHeightmap.

◆ InitializeShapeGen()

virtual void cTerrainShapeGen::InitializeShapeGen ( cIniFile a_IniFile)
inlinevirtual

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

Reimplemented in cTwoHeights, cTerrainHeightToShapeGen, cBiomalNoise3DComposable, cNoise3DComposable, cEndGen, and cDistortedHeightmap.

Definition at line 87 of file ComposableGenerator.h.


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