From 6b69d4b5b648253f894707723af0e2eae9f71445 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 29 Jul 2023 03:31:42 +0200 Subject: Move chunk reification to worker threads and set stage for chunk-unbound lighting --- src/World/ChunkRegistry.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/World/ChunkRegistry.hpp') diff --git a/src/World/ChunkRegistry.hpp b/src/World/ChunkRegistry.hpp index 86e5d06..2c515c5 100644 --- a/src/World/ChunkRegistry.hpp +++ b/src/World/ChunkRegistry.hpp @@ -5,7 +5,6 @@ #include "Chunk.hpp" #include "ChunkIndex.hpp" #include "Position.hpp" -#include "../GFX/Binder.hpp" namespace MC::World { @@ -14,7 +13,9 @@ public: enum class Status { Empty, WaitingForGeneration, + NeedsReification, WaitingForReification, + Damaged, Done }; @@ -24,11 +25,17 @@ public: Status status; std::optional chunk = {}; - std::optional land_mesh_data = {}; - std::optional water_mesh_data = {}; + std::optional land_mesh = {}; + std::optional water_mesh = {}; - std::optional land_mesh = {}; - std::optional water_mesh = {}; + Status get_status() const { + if (status == Status::Done && chunk.value().is_damaged()) { return Status::Damaged; } + return status; + } + + void damage() { + if (status == Status::Done) chunk.value().damage(); + } }; Data& get(ChunkIndex index); -- cgit 1.4.1