|
|
| Chunk (World *world, ChunkID coords, std::unique_ptr< IChunkData > data) |
| |
|
| Chunk (Chunk &)=delete |
| |
|
| Chunk (Chunk &&)=delete |
| |
| const ChunkID & | id () const |
| |
| glm::ivec3 | position () const |
| |
| virtual glm::ivec3 | dims () const |
| | Get the dimensions of this chunk type.
|
| |
|
World * | world () const |
| |
|
template<typename T > |
| T * | worldAs () const |
| |
|
void | populateTerrainData () |
| | Generates the chunk data per TerrainGenerator if not generated yet.
|
| |
|
bool | generated () const |
| |
| bool | generateMesh () |
| | Generates the mesh data for the chunk.
|
| |
|
const Block * | getBlock (glm::ivec3 pos, BlockState **state=nullptr) |
| |
|
void | setBlock (const glm::ivec3 &pos, BlockID block) |
| |
|
void | setBlock (const glm::ivec3 &pos, BlockID block, BlockState state) |
| |
|
void | setBlock (const glm::ivec3 &pos, MultiBlock &&multiBlock) |
| |
| IChunkData * | data () |
| |
| const IChunkData * | data () const |
| |
| void | render (Engine &engine, const Camera *camera, int pass) override |
| | Renders the chunk.
|
| |
|
VariantBlock::Neighbours | getNeighbouringBlocks (glm::ivec3 pos) const |
| |
| virtual void | afterGenerated () |
| |
| void | serialize (std::ostream &out) const override |
| |
| void | deserialize (std::istream &in) override |
| |
|
|
static glm::ivec3 | Dims {16, 16, 16} |
| |
|
|
GeometryState | calculateGeometryState (const Block *block, const BlockState *state) const |
| |
|
void | generateMeshForGeometry (const MeshGenContext &ctx) |
| |
|
void | generateMeshForBlock (const Block *block, glm::ivec3 pos, const BlockState *state, const glm::ivec3 &chunkBlockCoords) |
| |
|
void | generateMeshForBlock (const VariantBlock *block, glm::ivec3 pos, const BlockState *state, const glm::ivec3 &chunkBlockCoords) |
| |
|
void | generateMeshForBlock (const MultiBlock *block, glm::ivec3 pos, const BlockState *state, const glm::ivec3 &chunkBlockCoords) |
| |
◆ afterGenerated()
| virtual void engine::Chunk::afterGenerated |
( |
| ) |
|
|
inlinevirtual |
◆ data() [1/2]
- Returns
- ChunkData structure containing all the block/terrain data.
◆ data() [2/2]
- Returns
- const ChunkData structure containing all the block/terrain data.
◆ deserialize()
| void Chunk::deserialize |
( |
std::istream & |
in | ) |
|
|
overridevirtual |
◆ dims()
| virtual glm::ivec3 engine::Chunk::dims |
( |
| ) |
const |
|
inlinevirtual |
Get the dimensions of this chunk type.
- Returns
- The dimensions (x, y, z) of the chunk.
- Note
- Override this in derived classes to provide custom chunk dimensions.
◆ generateMesh()
| bool Chunk::generateMesh |
( |
| ) |
|
Generates the mesh data for the chunk.
- Returns
- true if the mesh was generated, false if it was already generating.
- Note
- This function is thread-safe.
◆ id()
| const ChunkID & engine::Chunk::id |
( |
| ) |
const |
|
inline |
- Returns
- ID or coordinates of the chunk in the world.
◆ position()
| glm::ivec3 engine::Chunk::position |
( |
| ) |
const |
|
inline |
- Returns
- Position of the chunk in world space.
◆ render()
| void Chunk::render |
( |
Engine & |
engine, |
|
|
const Camera * |
camera, |
|
|
int |
pass |
|
) |
| |
|
overridevirtual |
Renders the chunk.
- Parameters
-
| pass | Pass == 0 will render the whole chunk, pass == 1 will render opaque blocks, pass == 2 will render transparent blocks. |
Implements engine::Renderable.
◆ serialize()
| void Chunk::serialize |
( |
std::ostream & |
out | ) |
const |
|
overridevirtual |
The documentation for this class was generated from the following files:
- src/level/Chunk.h
- src/level/Chunk.cpp