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/ChunkRegistry.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/World/ChunkRegistry.hpp (limited to 'src/World/ChunkRegistry.hpp') diff --git a/src/World/ChunkRegistry.hpp b/src/World/ChunkRegistry.hpp new file mode 100644 index 0000000..86e5d06 --- /dev/null +++ b/src/World/ChunkRegistry.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include "Chunk.hpp" +#include "ChunkIndex.hpp" +#include "Position.hpp" +#include "../GFX/Binder.hpp" + +namespace MC::World { + +class ChunkRegistry { +public: + enum class Status { + Empty, + WaitingForGeneration, + WaitingForReification, + Done + }; + + // I think a Chunk entity should just store all this by itself... + struct Data { + ChunkIndex index; + Status status; + std::optional chunk = {}; + + std::optional land_mesh_data = {}; + std::optional water_mesh_data = {}; + + std::optional land_mesh = {}; + std::optional water_mesh = {}; + }; + + Data& get(ChunkIndex index); + + Data& find(Position::BlockWorld pos); + Data& find(ChunkIndex chunk, Position::BlockLocal pos); +private: + std::unordered_map m_chunks; +}; + +} -- cgit 1.4.1