mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-12 07:03:34 +00:00
working on chunk generation
This commit is contained in:
@@ -10,9 +10,27 @@ World::World(Scop::Scene& scene) : m_scene(scene), m_narrator(scene.CreateNarrat
|
||||
material_params.albedo = std::make_shared<Scop::Texture>(Scop::LoadBMPFile(GetResourcesPath() / "prototype.bmp", map_size), map_size.x, map_size.y);
|
||||
p_block_material = std::make_shared<Scop::Material>(material_params);
|
||||
|
||||
auto narrator_update = [](Scop::NonOwningPtr<Scop::Scene> scene, Scop::Inputs& input, float delta)
|
||||
auto narrator_update = [this](Scop::NonOwningPtr<Scop::Scene> scene, Scop::Inputs& input, float delta)
|
||||
{
|
||||
if(m_chunks.empty())
|
||||
GenerateWorld();
|
||||
};
|
||||
|
||||
m_narrator.AttachScript(std::make_shared<Scop::NativeNarratorScript>(std::function<void()>{}, narrator_update, std::function<void()>{}));
|
||||
}
|
||||
|
||||
[[nodiscard]] Chunk& World::GetChunk(Scop::Vec2i position)
|
||||
{
|
||||
}
|
||||
|
||||
void World::GenerateWorld()
|
||||
{
|
||||
for(std::int32_t x = 0; x < 4; x++)
|
||||
{
|
||||
for(std::int32_t z = 0; z < 4; z++)
|
||||
{
|
||||
m_chunks.emplace_back(*this, Scop::Vec2i{ x, z });
|
||||
m_chunks.back().GenerateChunk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user