From 2eef7cf49b7a15559ee7bb6719411bcf67386213 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 22 Jul 2023 17:35:00 +0200 Subject: Propagation in lighting system --- src/World/ChunkIndex.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/World/ChunkIndex.hpp') 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; -- cgit 1.4.1