From 23d88e5f1c8f0c8652a07050fcfa8ff126e85d4a Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 21 Jul 2023 02:17:03 +0200 Subject: Extremely simple chunk-limited lighting --- src/World/Chunk.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/World/Chunk.hpp') diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp index bc44137..5f4844e 100644 --- a/src/World/Chunk.hpp +++ b/src/World/Chunk.hpp @@ -4,7 +4,6 @@ #include "BiomeType.hpp" #include "BlockType.hpp" #include "../GFX/Mesh.hpp" -#include "BlockSide.hpp" namespace MC::World { @@ -18,13 +17,18 @@ public: m_position{(Real)x * Width, 0.0f, (Real)y * Width} {} struct BlockData { + BlockData() : type(BlockType::Air) {} + BlockData(BlockType t) : type(t), light{} {} + BlockType type; + U8 light; Bool empty() const { return type == BlockType::Air; } }; - void set(U32 x, U32 y, U32 z, BlockData data); - BlockData get(U32 x, U32 y, U32 z) const; + const BlockData& at(U32 x, U32 y, U32 z) const; + BlockData& at(U32 x, U32 y, U32 z); + Bool is_empty(U32 x, U32 y, U32 z) const; struct Details { -- cgit 1.4.1