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/ChunkIndex.hpp | |
| parent | 23d88e5f1c8f0c8652a07050fcfa8ff126e85d4a (diff) | |
| download | meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.tar.zst meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.zip | |
Propagation in lighting system
Diffstat (limited to 'src/World/ChunkIndex.hpp')
| -rw-r--r-- | src/World/ChunkIndex.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/World/ChunkIndex.hpp b/src/World/ChunkIndex.hpp index 7d6fdbf..ed3347b 100644 --- a/src/World/ChunkIndex.hpp +++ b/src/World/ChunkIndex.hpp @@ -1,6 +1,9 @@ #pragma once #include "../Common/Sizes.hpp" +#include "../Math/Vector.hpp" +#include "ChunkDimensions.hpp" +#include "Position.hpp" namespace MC::World { @@ -9,7 +12,13 @@ struct ChunkIndex { ChunkIndex(I32 x, I32 y) : x(x), y(y) {} Vector<3> middle() const { - return {(x + 0.5f) * Chunk::Width, Chunk::Height / 2.0f, (y + 0.5f) * Chunk::Width}; + using namespace ChunkDimensions; + return {(x + 0.5f) * Width, Height / 2.0f, (y + 0.5f) * Width}; + } + + Position::BlockWorld world(Position::BlockLocal local) const { + using namespace ChunkDimensions; + return {x * Width + local.x(), local.y(), y * Width + local.z()}; } I32 x, y; |
