mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: add world and player tab item
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <Cubed/tools/cubed_assert.hpp>
|
||||
#include <Cubed/tools/cubed_hash.hpp>
|
||||
#include <Cubed/tools/math_tools.hpp>
|
||||
#include <Cubed/tools/perlin_noise.hpp>
|
||||
|
||||
#include <execution>
|
||||
|
||||
@@ -671,4 +672,27 @@ void World::hot_reload() {
|
||||
need_gen();
|
||||
}
|
||||
|
||||
void World::rebuild_world() {
|
||||
if (m_is_rebuilding) {
|
||||
return;
|
||||
}
|
||||
m_is_rebuilding = true;
|
||||
stop_gen_thread();
|
||||
|
||||
{
|
||||
std::scoped_lock lk(m_chunks_mutex, m_new_chunk_queue_mutex);
|
||||
m_chunks.clear();
|
||||
m_new_chunk_queue.clear();
|
||||
}
|
||||
m_could_gen = true;
|
||||
PerlinNoise::reload();
|
||||
start_gen_thread();
|
||||
need_gen();
|
||||
|
||||
m_is_rebuilding = false;
|
||||
for (auto& player : m_players) {
|
||||
player.second.set_player_pos({0.0f, 255.0f, 0.0f});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user