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/ChunkRegistry.hpp | |
| parent | 23d88e5f1c8f0c8652a07050fcfa8ff126e85d4a (diff) | |
| download | meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.tar.zst meowcraft-2eef7cf49b7a15559ee7bb6719411bcf67386213.zip | |
Propagation in lighting system
Diffstat (limited to 'src/World/ChunkRegistry.hpp')
| -rw-r--r-- | src/World/ChunkRegistry.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
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 <optional> +#include <unordered_map> +#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> chunk = {}; + + std::optional<GFX::Mesh> land_mesh_data = {}; + std::optional<GFX::Mesh> water_mesh_data = {}; + + std::optional<GFX::BindableMesh> land_mesh = {}; + std::optional<GFX::BindableMesh> water_mesh = {}; + }; + + Data& get(ChunkIndex index); + + Data& find(Position::BlockWorld pos); + Data& find(ChunkIndex chunk, Position::BlockLocal pos); +private: + std::unordered_map<ChunkIndex, Data> m_chunks; +}; + +} |
