working on chunk generation

This commit is contained in:
2025-05-09 09:37:23 +02:00
parent 2336835250
commit 8c94d86fd4
18 changed files with 242 additions and 155 deletions

29
Application/Chunk.cpp git.filemode.normal_file
View File

@@ -0,0 +1,29 @@
#include <Chunk.h>
#include <algorithm>
Chunk::Chunk(Scop::Scene& world, Scop::Vec2ui offset) : m_data(CHUNK_VOLUME), m_offset(offset), m_position(std::move(offset) * Scop::Vec2ui{ CHUNK_SIZE })
{
}
void Chunk::GenerateChunk()
{
std::fill(m_data.begin(), m_data.end(), 0);
for(std::uint32_t x = 0; x < CHUNK_SIZE.x; x++)
{
for(std::uint32_t z = 0; z < CHUNK_SIZE.z; z++)
{
std::uint32_t pos_x = m_position.x + x;
std::uint32_t pos_z = m_position.y + z;
for(std::uint32_t y = 0; y < CHUNK_SIZE.y; y++)
{
std::uint32_t index = (z * CHUNK_SIZE.x * CHUNK_SIZE.y) + (y * CHUNK_SIZE.x) + x;
// Implement noise here
m_data[index] = y < 10 ? 1 : 0;
}
}
}
}