VoxelEngine
 
Loading...
Searching...
No Matches
engine::IChunkData Class Referenceabstract

Interface for chunk data representation. More...

#include <IChunkData.h>

Inheritance diagram for engine::IChunkData:
engine::ISerializable engine::DenseGrid

Public Member Functions

 IChunkData (glm::ivec3 dims)
 
void serialize (std::ostream &out) const override=0
 
void deserialize (std::istream &in) override=0
 
virtual BlockID getBlock (const glm::ivec3 &pos) const =0
 
virtual MultiBlockgetMultiBlock (const glm::ivec3 &pos)=0
 
virtual void setBlock (const glm::ivec3 &pos, BlockID block)=0
 
virtual void setBlock (const glm::ivec3 &pos, BlockID block, BlockState state)=0
 
virtual void setMultiBlock (const glm::ivec3 &pos, MultiBlock &&multiBlock)=0
 
virtual BlockStategetState (const glm::ivec3 &pos)=0
 
virtual const BlockStategetState (const glm::ivec3 &pos) const =0
 
virtual BlockStategetOrCreateState (const glm::ivec3 &pos)=0
 
virtual void setState (const glm::ivec3 &pos, BlockState &&state)=0
 
virtual void clearState (const glm::ivec3 &pos)=0
 
void clear (const glm::ivec3 &pos)
 
bool isEmpty (const glm::ivec3 &pos) const
 
BlockID getBlockAndState (const glm::ivec3 &pos, BlockState *&state)
 
BlockID getBlockAndState (const glm::ivec3 &pos, const BlockState *&state) const
 
BlockID getAll (const glm::ivec3 &pos, BlockState *&state, MultiBlock *&multiBlock)
 

Public Attributes

glm::ivec3 dims
 
bool populated = false
 

Detailed Description

Interface for chunk data representation.

Note
The concrete implementation must represent the whole chunk range, from (0, 0, 0) to (dims.x - 1, dims.y - 1, dims.z - 1).
For representing invalid blockID use InvalidBlockID from Globals.h

Member Function Documentation

◆ clear()

void engine::IChunkData::clear ( const glm::ivec3 &  pos)
inline

Helpers

◆ deserialize()

void engine::IChunkData::deserialize ( std::istream &  in)
overridepure virtual

Implements engine::ISerializable.

◆ getBlock()

virtual BlockID engine::IChunkData::getBlock ( const glm::ivec3 &  pos) const
pure virtual

access

Implemented in engine::DenseGrid.

◆ getState()

virtual BlockState * engine::IChunkData::getState ( const glm::ivec3 &  pos)
pure virtual

access

Implemented in engine::DenseGrid.

◆ serialize()

void engine::IChunkData::serialize ( std::ostream &  out) const
overridepure virtual

Implements engine::ISerializable.


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