world generation

This commit is contained in:
2025-05-10 14:48:27 +02:00
parent 12d4368f16
commit 9d58289383
12 changed files with 189 additions and 67 deletions

View File

@@ -7,6 +7,9 @@
#include <Chunk.h>
#include <Utils.h>
#include <MeshPool.h>
constexpr std::uint8_t RENDER_DISTANCE = 2;
class World
{
@@ -16,6 +19,7 @@ class World
[[nodiscard]] inline Scop::Scene& GetScene() noexcept { return m_scene; }
[[nodiscard]] inline std::shared_ptr<Scop::Material> GetBlockMaterial() const { return p_block_material; }
[[nodiscard]] Scop::NonOwningPtr<Chunk> GetChunk(Scop::Vec2i position);
[[nodiscard]] inline MeshPool& GetMeshPool() { return m_mesh_pool; }
~World() = default;
@@ -23,8 +27,8 @@ class World
void GenerateWorld();
private:
static constexpr std::uint8_t RENDER_DISTANCE = 2;
std::unordered_map<Scop::Vec2i, Chunk> m_chunks;
MeshPool m_mesh_pool;
std::shared_ptr<Scop::Material> p_block_material;
Scop::Narrator& m_narrator;
Scop::Scene& m_scene;