VOX
A little voxel engine
|
#include <Chunk.hpp>
Classes | |
struct | biomeInfo |
Public Types | |
enum class | genLevel : uint16_t { LIGHT , DECORATE , CAVE , EMPTY } |
enum class | e_biome : uint8_t { FOREST , PLAIN , MOUNTAIN , OCEAN , COAST , DESERT , RIVER , NONE } |
typedef std::array< BlockInfo::Type, BLOCKS_PER_CHUNK > | BlockArray |
typedef std::array< uint8_t, BLOCKS_PER_CHUNK > | LightArray |
typedef std::array< uint8_t, CHUNK_X_SIZE *CHUNK_Z_SIZE > | HeightArray |
typedef std::array< biomeInfo, CHUNK_X_SIZE *CHUNK_Z_SIZE > | BiomeArray |
Public Member Functions | |
Chunk (glm::ivec3 position) | |
Chunk (const glm::ivec3 &position, const BlockArray &blocks, const LightArray &light, const BiomeArray &biome) | |
Chunk (const ChunkData &data) | |
Chunk (const Chunk &other)=delete | |
Chunk (Chunk &&other)=delete | |
Chunk & | operator= (const Chunk &other)=delete |
Chunk & | operator= (const Chunk &&other)=delete |
~Chunk () | |
BlockArray & | getBlocks () |
const BlockArray & | getBlocks () const |
BlockInfo::Type | getBlock (const int &x, const int &y, const int &z) const |
BlockInfo::Type | getBlock (const glm::ivec3 &position) const |
void | setBlock (const int &x, const int &y, const int &z, BlockInfo::Type block) |
void | setBlock (const glm::ivec3 &position, BlockInfo::Type block) |
void | setBlockColumn (const int &x, const int &z, const std::array< BlockInfo::Type, CHUNK_Y_SIZE > &column) |
void | setBlockColumn (const glm::ivec2 &pos, const std::array< BlockInfo::Type, CHUNK_Y_SIZE > &column) |
LightArray & | getLight () |
const LightArray & | getLight () const |
uint8_t | getLight (const int &x, const int &y, const int &z) const |
uint8_t | getLight (const glm::ivec3 &position) const |
void | setLight (const int &x, const int &y, const int &z, uint8_t light) |
void | setLight (const glm::ivec3 &position, uint8_t light) |
uint8_t | getSkyLight (const int &x, const int &y, const int &z) const |
uint8_t | getSkyLight (const glm::ivec3 &position) const |
void | setSkyLight (const int &x, const int &y, const int &z, uint8_t light) |
void | setSkyLight (const glm::ivec3 &position, uint8_t light) |
uint8_t | getBlockLight (const int &x, const int &y, const int &z) const |
uint8_t | getBlockLight (const glm::ivec3 &position) const |
void | setBlockLight (const int &x, const int &y, const int &z, uint8_t light) |
void | setBlockLight (const glm::ivec3 &position, uint8_t light) |
BiomeArray & | getBiomes () |
const BiomeArray & | getBiomes () const |
biomeInfo | getBiome (const int &x, const int &z) const |
biomeInfo | getBiome (const glm::ivec2 &position) const |
void | setBiome (const int &x, const int &z, const biomeInfo &biome) |
void | setBiome (const glm::ivec2 &position, const biomeInfo &biome) |
HeightArray & | getHeights () |
const HeightArray & | getHeights () const |
uint8_t | getHeight (const int &x, const int &z) const |
uint8_t | getHeight (const glm::ivec2 &position) const |
void | setHeight (const int &x, const int &z, uint8_t height) |
void | setHeight (const glm::ivec2 &position, uint8_t height) |
const glm::ivec3 & | getPosition () const |
void | setPosition (const glm::ivec3 &position) |
const int & | x () const |
const int & | y () const |
const int & | z () const |
uint64_t | getMeshID () const |
void | setMeshID (const uint64_t &mesh_id) |
bool | isMeshed () const |
void | setMeshed (bool meshed) |
int | getLoadLevel () const |
int | getHighestLoadLevel () const |
void | setLoadLevel (const int &load_level) |
genLevel | getGenLevel () const |
void | setGenLevel (const genLevel &level) |
Static Public Member Functions | |
static int | toBiomeIndex (int x, int z) |
static int | toBiomeIndex (const glm::ivec2 &position) |
static glm::ivec2 | toBiomeCoord (int index) |
static int | toHeightIndex (const int &x, const int &z) |
static int | toHeightIndex (const glm::ivec2 &position) |
static int | toIndex (const int &x, const int &y, const int &z) |
static glm::ivec3 | toCoord (const int &index) |
Public Attributes | |
Status | status |
std::unordered_set< uint64_t > | entity_ids |
std::unordered_set< uint64_t > | observing_player_ids |
Static Public Attributes | |
static constexpr size_t | DATA_SIZE = sizeof(BlockArray) + sizeof(LightArray) + sizeof(BiomeArray) + sizeof(genLevel) |
typedef std::array<biomeInfo, CHUNK_X_SIZE * CHUNK_Z_SIZE> Chunk::BiomeArray |
typedef std::array<BlockInfo::Type, BLOCKS_PER_CHUNK> Chunk::BlockArray |
typedef std::array<uint8_t, CHUNK_X_SIZE * CHUNK_Z_SIZE> Chunk::HeightArray |
typedef std::array<uint8_t, BLOCKS_PER_CHUNK> Chunk::LightArray |
|
strong |
|
strong |
Chunk::Chunk | ( | glm::ivec3 | position | ) |
Chunk::Chunk | ( | const glm::ivec3 & | position, |
const BlockArray & | blocks, | ||
const LightArray & | light, | ||
const BiomeArray & | biome | ||
) |
Chunk::Chunk | ( | const ChunkData & | data | ) |
|
delete |
|
delete |
Chunk::~Chunk | ( | ) |
Chunk::biomeInfo Chunk::getBiome | ( | const glm::ivec2 & | position | ) | const |
Chunk::biomeInfo Chunk::getBiome | ( | const int & | x, |
const int & | z | ||
) | const |
Chunk::BiomeArray & Chunk::getBiomes | ( | ) |
const Chunk::BiomeArray & Chunk::getBiomes | ( | ) | const |
BlockInfo::Type Chunk::getBlock | ( | const glm::ivec3 & | position | ) | const |
BlockInfo::Type Chunk::getBlock | ( | const int & | x, |
const int & | y, | ||
const int & | z | ||
) | const |
uint8_t Chunk::getBlockLight | ( | const glm::ivec3 & | position | ) | const |
uint8_t Chunk::getBlockLight | ( | const int & | x, |
const int & | y, | ||
const int & | z | ||
) | const |
Chunk::BlockArray & Chunk::getBlocks | ( | ) |
const Chunk::BlockArray & Chunk::getBlocks | ( | ) | const |
Chunk::genLevel Chunk::getGenLevel | ( | ) | const |
uint8_t Chunk::getHeight | ( | const glm::ivec2 & | position | ) | const |
uint8_t Chunk::getHeight | ( | const int & | x, |
const int & | z | ||
) | const |
Chunk::HeightArray & Chunk::getHeights | ( | ) |
const Chunk::HeightArray & Chunk::getHeights | ( | ) | const |
int Chunk::getHighestLoadLevel | ( | ) | const |
Chunk::LightArray & Chunk::getLight | ( | ) |
const Chunk::LightArray & Chunk::getLight | ( | ) | const |
uint8_t Chunk::getLight | ( | const glm::ivec3 & | position | ) | const |
uint8_t Chunk::getLight | ( | const int & | x, |
const int & | y, | ||
const int & | z | ||
) | const |
int Chunk::getLoadLevel | ( | ) | const |
uint64_t Chunk::getMeshID | ( | ) | const |
const glm::ivec3 & Chunk::getPosition | ( | ) | const |
uint8_t Chunk::getSkyLight | ( | const glm::ivec3 & | position | ) | const |
uint8_t Chunk::getSkyLight | ( | const int & | x, |
const int & | y, | ||
const int & | z | ||
) | const |
bool Chunk::isMeshed | ( | ) | const |
void Chunk::setBiome | ( | const glm::ivec2 & | position, |
const biomeInfo & | biome | ||
) |
void Chunk::setBiome | ( | const int & | x, |
const int & | z, | ||
const biomeInfo & | biome | ||
) |
void Chunk::setBlock | ( | const glm::ivec3 & | position, |
BlockInfo::Type | block | ||
) |
void Chunk::setBlock | ( | const int & | x, |
const int & | y, | ||
const int & | z, | ||
BlockInfo::Type | block | ||
) |
void Chunk::setBlockColumn | ( | const glm::ivec2 & | pos, |
const std::array< BlockInfo::Type, CHUNK_Y_SIZE > & | column | ||
) |
void Chunk::setBlockColumn | ( | const int & | x, |
const int & | z, | ||
const std::array< BlockInfo::Type, CHUNK_Y_SIZE > & | column | ||
) |
void Chunk::setBlockLight | ( | const glm::ivec3 & | position, |
uint8_t | light | ||
) |
void Chunk::setBlockLight | ( | const int & | x, |
const int & | y, | ||
const int & | z, | ||
uint8_t | light | ||
) |
void Chunk::setGenLevel | ( | const genLevel & | level | ) |
void Chunk::setHeight | ( | const glm::ivec2 & | position, |
uint8_t | height | ||
) |
void Chunk::setHeight | ( | const int & | x, |
const int & | z, | ||
uint8_t | height | ||
) |
void Chunk::setLight | ( | const glm::ivec3 & | position, |
uint8_t | light | ||
) |
void Chunk::setLight | ( | const int & | x, |
const int & | y, | ||
const int & | z, | ||
uint8_t | light | ||
) |
void Chunk::setLoadLevel | ( | const int & | load_level | ) |
void Chunk::setMeshed | ( | bool | meshed | ) |
void Chunk::setMeshID | ( | const uint64_t & | mesh_id | ) |
void Chunk::setPosition | ( | const glm::ivec3 & | position | ) |
void Chunk::setSkyLight | ( | const glm::ivec3 & | position, |
uint8_t | light | ||
) |
void Chunk::setSkyLight | ( | const int & | x, |
const int & | y, | ||
const int & | z, | ||
uint8_t | light | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inline |
|
inline |
|
inline |
|
staticconstexpr |
std::unordered_set<uint64_t> Chunk::entity_ids |
std::unordered_set<uint64_t> Chunk::observing_player_ids |
Status Chunk::status |