Lodestone.Level
Loading...
Searching...
No Matches
lodestone::level::chunk::section::LevelSection Class Reference

#include <LevelSection.h>

Inheritance diagram for lodestone::level::chunk::section::LevelSection:
Collaboration diagram for lodestone::level::chunk::section::LevelSection:

Public Member Functions

 LevelSection ()=default
 ~LevelSection () override
SectionType type () override
void setBlockLight (int localX, int localY, int localZ, uint8_t lightLevel) override
void setSkyLight (int localX, int localY, int localZ, uint8_t lightLevel) override
const block::instance::BlockInstance & getBlock (int localX, int localY, int localZ) const override
void setBlock (block::instance::BlockInstance &&block, int localX, int localY, int localZ) override
lodestone::common::storage::bits::AbstractBitStorage * getBlockLightStorage () override
lodestone::common::storage::bits::AbstractBitStorage * getSkyLightStorage () override
const common::storage::palette::PalletizedStorage< block::instance::BlockInstance > & getBlockStorage () override
uint64_t getModificationCount () override
Public Member Functions inherited from lodestone::common::util::IHasDerivedTypes< SectionType >
constexpr IHasDerivedTypes ()=default
virtual constexpr ~IHasDerivedTypes ()=default
bool constexpr instanceOf (EType type)

Private Attributes

common::storage::palette::PalletizedStorage< block::instance::BlockInstance > m_blockStorage
common::storage::bits::BitStorage m_blockLightStorage = common::storage::bits::BitStorage(TOTAL_SECTION_3D_SIZE, 4)
common::storage::bits::BitStorage m_skyLightStorage = common::storage::bits::BitStorage(TOTAL_SECTION_3D_SIZE, 4)
const char ** m_biomes = new const char *[TOTAL_SECTION_2D_SIZE]()
unsigned long m_modificationCount = 0

Additional Inherited Members

Static Public Attributes inherited from lodestone::level::chunk::section::Section
static constexpr int TOTAL_SECTION_3D_SIZE = common::constants::CHUNK_WIDTH * common::constants::SECTION_HEIGHT * common::constants::CHUNK_DEPTH
static constexpr int TOTAL_SECTION_2D_SIZE = common::constants::CHUNK_WIDTH * common::constants::CHUNK_DEPTH

Constructor & Destructor Documentation

◆ LevelSection()

lodestone::level::chunk::section::LevelSection::LevelSection ( )
default

◆ ~LevelSection()

lodestone::level::chunk::section::LevelSection::~LevelSection ( )
override
9 {
10 delete[] m_biomes;
11 }
const char ** m_biomes
Definition LevelSection.h:50

Member Function Documentation

◆ getBlock()

const block::instance::BlockInstance & lodestone::level::chunk::section::LevelSection::getBlock ( int localX,
int localY,
int localZ ) const
overridevirtual

Implements lodestone::level::chunk::section::Section.

39 {
40 return m_blockStorage.getValue(INDEX_YZX(localX, localY, localZ, common::constants::CHUNK_WIDTH,
42 }
#define INDEX_YZX(x, y, z, w, d)
common::storage::palette::PalletizedStorage< block::instance::BlockInstance > m_blockStorage
Definition LevelSection.h:41
static constexpr int CHUNK_WIDTH
static constexpr int CHUNK_DEPTH

◆ getBlockLightStorage()

lodestone::common::storage::bits::AbstractBitStorage * lodestone::level::chunk::section::LevelSection::getBlockLightStorage ( )
overridevirtual

Implements lodestone::level::chunk::section::Section.

17 {
18 return &m_blockLightStorage;
19 }
common::storage::bits::BitStorage m_blockLightStorage
Definition LevelSection.h:46

◆ getBlockStorage()

const common::storage::palette::PalletizedStorage< block::instance::BlockInstance > & lodestone::level::chunk::section::LevelSection::getBlockStorage ( )
overridevirtual

◆ getModificationCount()

uint64_t lodestone::level::chunk::section::LevelSection::getModificationCount ( )
overridevirtual

Implements lodestone::level::chunk::section::Section.

48 {
50 }
unsigned long m_modificationCount
Definition LevelSection.h:52

◆ getSkyLightStorage()

lodestone::common::storage::bits::AbstractBitStorage * lodestone::level::chunk::section::LevelSection::getSkyLightStorage ( )
overridevirtual

Implements lodestone::level::chunk::section::Section.

21 {
22 return &m_skyLightStorage;
23 }
common::storage::bits::BitStorage m_skyLightStorage
Definition LevelSection.h:47

◆ setBlock()

void lodestone::level::chunk::section::LevelSection::setBlock ( block::instance::BlockInstance && block,
int localX,
int localY,
int localZ )
overridevirtual

Implements lodestone::level::chunk::section::Section.

52 {
53 if (!block.getBlock())
54 throw std::runtime_error(
55 "attempted to set with instance of null block");
56
57 m_blockStorage.setValue(INDEX_YZX(localX, localY, localZ, common::constants::CHUNK_WIDTH,
58 common::constants::CHUNK_DEPTH), std::move(block));
59
61 }

◆ setBlockLight()

void lodestone::level::chunk::section::LevelSection::setBlockLight ( int localX,
int localY,
int localZ,
uint8_t lightLevel )
overridevirtual

Implements lodestone::level::chunk::section::Section.

25 {
26 this->m_blockLightStorage.setNibble(localX, localY, localZ, lightLevel & 0xF);
27
29 }

◆ setSkyLight()

void lodestone::level::chunk::section::LevelSection::setSkyLight ( int localX,
int localY,
int localZ,
uint8_t lightLevel )
overridevirtual

Implements lodestone::level::chunk::section::Section.

32 {
33 this->m_skyLightStorage.setNibble(localX, localY, localZ, lightLevel & 0xF);
34
36 }

◆ type()

SectionType lodestone::level::chunk::section::LevelSection::type ( )
overridevirtual

Member Data Documentation

◆ m_biomes

const char** lodestone::level::chunk::section::LevelSection::m_biomes = new const char *[TOTAL_SECTION_2D_SIZE]()
private

◆ m_blockLightStorage

common::storage::bits::BitStorage lodestone::level::chunk::section::LevelSection::m_blockLightStorage = common::storage::bits::BitStorage(TOTAL_SECTION_3D_SIZE, 4)
private

◆ m_blockStorage

common::storage::palette::PalletizedStorage<block::instance::BlockInstance> lodestone::level::chunk::section::LevelSection::m_blockStorage
private
Initial value:

◆ m_modificationCount

unsigned long lodestone::level::chunk::section::LevelSection::m_modificationCount = 0
private

◆ m_skyLightStorage

common::storage::bits::BitStorage lodestone::level::chunk::section::LevelSection::m_skyLightStorage = common::storage::bits::BitStorage(TOTAL_SECTION_3D_SIZE, 4)
private

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