X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunk.hpp;h=cc0ae8e0a9508b9e0369288f4b26dc9f5c624eed;hb=9240fdf2e68ee014da0d0a89a7fb2f29ebf28e2d;hp=23ed869aa7ed17b08d91dd5bf57eff9b163cbf15;hpb=825f479edf9867938b6789215ad7ae6303596cba;p=blank.git diff --git a/src/world/Chunk.hpp b/src/world/Chunk.hpp index 23ed869..cc0ae8e 100644 --- a/src/world/Chunk.hpp +++ b/src/world/Chunk.hpp @@ -156,7 +156,12 @@ public: void *BlockData() noexcept { return &blocks[0]; } const void *BlockData() const noexcept { return &blocks[0]; } - static constexpr std::size_t BlockSize() noexcept { return sizeof(blocks) + sizeof(light); } + static constexpr std::size_t BlockSize() noexcept { return offsetof(Chunk, position) - offsetof(Chunk, blocks); } + + bool Generated() const noexcept { return generated; } + void SetGenerated() noexcept { generated = true; } + bool Lighted() const noexcept { return lighted; } + void ScanLights(); void Ref() noexcept { ++ref_count; } void UnRef() noexcept { --ref_count; } @@ -174,8 +179,12 @@ public: private: const BlockTypeRegistry *types; Chunk *neighbor[Block::FACE_COUNT]; + Block blocks[size]; unsigned char light[size]; + bool generated; + bool lighted; + Pos position; int ref_count; bool dirty_model;