working on chunk generation

This commit is contained in:
2025-05-09 18:29:41 +02:00
parent 8c94d86fd4
commit 18dd89f485
10 changed files with 221 additions and 23 deletions

View File

@@ -6,21 +6,22 @@
#include <ScopMaths.h>
constexpr Scop::Vec3ui CHUNK_SIZE = Scop::Vec3ui{ 16, 256, 16 };
constexpr std::uint32_t CHUNK_VOLUME = CHUNK_SIZE.x * CHUNK_SIZE.y * CHUNK_SIZE.z;
class Chunk
{
public:
Chunk(Scop::Scene& world, Scop::Vec2ui offset);
Chunk(class World& world, Scop::Vec2i offset);
void GenerateChunk();
std::uint32_t GetBlock(Scop::Vec3i position) const noexcept;
~Chunk() = default;
private:
std::vector<std::uint32_t> m_data;
Scop::Vec2ui m_offset; // In chunks
Scop::Vec2ui m_position; // In blocks
std::vector<std::vector<std::vector<std::uint32_t>>> m_data; // Should be a flat array but I cannot manage to flatten the 3D coordinates correctly
Scop::Vec2i m_offset; // In chunks
Scop::Vec2i m_position; // In blocks
class World& m_world;
Scop::NonOwningPtr<Scop::Actor> p_actor = nullptr;
};