diff options
| author | Mel <einebeere@gmail.com> | 2023-07-22 17:35:00 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-22 17:35:00 +0200 |
| commit | 2eef7cf49b7a15559ee7bb6719411bcf67386213 (patch) | |
| tree | 11eb7a4f437da7bfdde620c10a043960fd423cfb /src/World/Chunk.hpp | |
| parent | 23d88e5f1c8f0c8652a07050fcfa8ff126e85d4a (diff) | |
| download | meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.tar.zst meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.zip | |
Propagation in lighting system
Diffstat (limited to 'src/World/Chunk.hpp')
| -rw-r--r-- | src/World/Chunk.hpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp index 5f4844e..32d3ab3 100644 --- a/src/World/Chunk.hpp +++ b/src/World/Chunk.hpp @@ -1,19 +1,23 @@ #pragma once #include "../Common/Sizes.hpp" +#include "ChunkDimensions.hpp" #include "BiomeType.hpp" #include "BlockType.hpp" +#include "ChunkIndex.hpp" +#include "Position.hpp" #include "../GFX/Mesh.hpp" namespace MC::World { class Chunk { public: - static constexpr U32 Width = 16; - static constexpr U32 Height = 128; + static constexpr U32 Width = ChunkDimensions::Width; + static constexpr U32 Height = ChunkDimensions::Height; Chunk(I64 x, I64 y) : m_blocks{Width * Height * Width, {BlockType::Air}}, + m_index(x, y), m_position{(Real)x * Width, 0.0f, (Real)y * Width} {} struct BlockData { @@ -28,6 +32,8 @@ public: const BlockData& at(U32 x, U32 y, U32 z) const; BlockData& at(U32 x, U32 y, U32 z); + const BlockData& at(Position::BlockLocal pos) const; + BlockData& at(Position::BlockLocal pos); Bool is_empty(U32 x, U32 y, U32 z) const; @@ -43,12 +49,14 @@ public: void set_details(const Details& details) { m_details = details; } Details& details(){ return m_details; } + ChunkIndex index() const; Vector<3> position() const; static Bool is_valid_position(U32 x, U32 y, U32 z); private: static U64 pos(U32 x, U32 y, U32 z); + ChunkIndex m_index; Vector<3> m_position; std::vector<BlockData> m_blocks; |
