mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
fixing allocator
This commit is contained in:
@@ -88,6 +88,8 @@ void World::GenerateWorld()
|
||||
std::this_thread::sleep_for(16ms);
|
||||
continue;
|
||||
}
|
||||
std::queue<std::reference_wrapper<Chunk>> mesh_generation_queue;
|
||||
|
||||
for(std::int32_t x = m_current_chunk_position.x - RENDER_DISTANCE; x <= m_current_chunk_position.x + RENDER_DISTANCE; x++)
|
||||
{
|
||||
for(std::int32_t z = m_current_chunk_position.y - RENDER_DISTANCE; z <= m_current_chunk_position.y + RENDER_DISTANCE; z++)
|
||||
@@ -98,12 +100,18 @@ void World::GenerateWorld()
|
||||
if(!res.first->second.GetActor())
|
||||
{
|
||||
res.first->second.GenerateChunk();
|
||||
res.first->second.GenerateMesh();
|
||||
m_chunks_to_upload.Push(std::ref(res.first->second));
|
||||
mesh_generation_queue.push(std::ref(res.first->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!mesh_generation_queue.empty())
|
||||
{
|
||||
auto chunk = mesh_generation_queue.front();
|
||||
mesh_generation_queue.pop();
|
||||
chunk.get().GenerateMesh();
|
||||
m_chunks_to_upload.Push(chunk);
|
||||
}
|
||||
m_generation_status = GenerationState::Finished;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user