Lodestone.Level
Loading...
Searching...
No Matches
LevelSection.h
Go to the documentation of this file.
1//
2// Created by DexrnZacAttack on 10/14/25 using zPc-i2.
3//
4#ifndef LODESTONE_LEVELSECTION_H
5#define LODESTONE_LEVELSECTION_H
6
8
14
16 class LevelSection : public Section {
17 public:
18 LevelSection() = default;
19
20 ~LevelSection() override;
21
22 SectionType type() override;
23
24 void setBlockLight(int localX, int localY, int localZ, uint8_t lightLevel) override;
25
26 void setSkyLight(int localX, int localY, int localZ, uint8_t lightLevel) override;
27
28 const block::instance::BlockInstance &getBlock(int localX, int localY, int localZ) const override;
29
30 void setBlock(block::instance::BlockInstance &&block, int localX, int localY, int localZ) override;
31
33
35
37
38 uint64_t getModificationCount() override;
39
40 private:
43 // TODO: we could also calculate lighting for blocks, could have a map
44 // of xyz -> Block specifically for light blocks
45
48
49 // TODO biome registry
50 const char **m_biomes = new const char *[TOTAL_SECTION_2D_SIZE]();
51
52 unsigned long m_modificationCount = 0;
53 //how many times the section was modified since it was added, I use this to rebuild the mesh when incremented
54 // TODO: should biomes be numeric?
55 };
56} // namespace lodestone::level::chunk::section
57
58#endif // LODESTONE_LEVELSECTION_H
Wraps a block with runtime-modifiable properties.
Definition BlockInstance.h:19
static ImmutableBlockInstance * getInstance()
Definition ImmutableBlockInstance.cpp:10
common::storage::bits::BitStorage m_blockLightStorage
Definition LevelSection.h:46
uint64_t getModificationCount() override
Definition LevelSection.cpp:48
lodestone::common::storage::bits::AbstractBitStorage * getBlockLightStorage() override
Definition LevelSection.cpp:17
void setBlockLight(int localX, int localY, int localZ, uint8_t lightLevel) override
Definition LevelSection.cpp:25
~LevelSection() override
Definition LevelSection.cpp:9
const block::instance::BlockInstance & getBlock(int localX, int localY, int localZ) const override
Definition LevelSection.cpp:39
void setBlock(block::instance::BlockInstance &&block, int localX, int localY, int localZ) override
Definition LevelSection.cpp:52
lodestone::common::storage::bits::AbstractBitStorage * getSkyLightStorage() override
Definition LevelSection.cpp:21
void setSkyLight(int localX, int localY, int localZ, uint8_t lightLevel) override
Definition LevelSection.cpp:31
unsigned long m_modificationCount
Definition LevelSection.h:52
SectionType type() override
Definition LevelSection.cpp:13
common::storage::bits::BitStorage m_skyLightStorage
Definition LevelSection.h:47
common::storage::palette::PalletizedStorage< block::instance::BlockInstance > m_blockStorage
Definition LevelSection.h:41
const common::storage::palette::PalletizedStorage< block::instance::BlockInstance > & getBlockStorage() override
Definition LevelSection.cpp:44
const char ** m_biomes
Definition LevelSection.h:50
static constexpr int TOTAL_SECTION_3D_SIZE
Definition Section.h:23
static constexpr int TOTAL_SECTION_2D_SIZE
Definition Section.h:24
Definition Block.cpp:6
Definition ImmutableSection.cpp:8
SectionType
Definition Section.h:19