debug window: use block type from slider in block picking
parent
52696f2dde
commit
07068d740a
|
@ -34,6 +34,7 @@ namespace chunkmanager
|
||||||
// Queue of chunks to be meshed
|
// Queue of chunks to be meshed
|
||||||
ChunkPriorityQueue chunks_to_mesh_queue;
|
ChunkPriorityQueue chunks_to_mesh_queue;
|
||||||
|
|
||||||
|
int block_to_place{2};
|
||||||
|
|
||||||
// Init chunkmanager. Chunk indices and start threads
|
// Init chunkmanager. Chunk indices and start threads
|
||||||
int chunks_volume_real;
|
int chunks_volume_real;
|
||||||
|
@ -86,6 +87,8 @@ namespace chunkmanager
|
||||||
update_thread = std::thread(update);
|
update_thread = std::thread(update);
|
||||||
gen_thread = std::thread(generate);
|
gen_thread = std::thread(generate);
|
||||||
mesh_thread = std::thread(mesh);
|
mesh_thread = std::thread(mesh);
|
||||||
|
|
||||||
|
debug::window::set_parameter("block_type_return", &block_to_place);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method for world generation thread(s)
|
// Method for world generation thread(s)
|
||||||
|
@ -254,7 +257,7 @@ namespace chunkmanager
|
||||||
if(!chunks.find(a1, calculateIndex(px1, py1, pz1))) return;
|
if(!chunks.find(a1, calculateIndex(px1, py1, pz1))) return;
|
||||||
Chunk::Chunk* c1 = a1->second;
|
Chunk::Chunk* c1 = a1->second;
|
||||||
// place the new block (only stone for now)
|
// place the new block (only stone for now)
|
||||||
c1->setBlock( Block::STONE, bx1, by1, bz1);
|
c1->setBlock((Block)block_to_place, bx1, by1, bz1);
|
||||||
|
|
||||||
// mark the mesh of the chunk the be updated
|
// mark the mesh of the chunk the be updated
|
||||||
chunks_to_mesh_queue.push(std::make_pair(c1, MESHING_PRIORITY_PLAYER_EDIT));
|
chunks_to_mesh_queue.push(std::make_pair(c1, MESHING_PRIORITY_PLAYER_EDIT));
|
||||||
|
|
|
@ -59,7 +59,6 @@ namespace debug{
|
||||||
parameters[key] = value;
|
parameters[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int block_type{0};
|
|
||||||
void show_debug_window(){
|
void show_debug_window(){
|
||||||
ImGui::Begin("Debug Window");
|
ImGui::Begin("Debug Window");
|
||||||
|
|
||||||
|
@ -92,7 +91,7 @@ namespace debug{
|
||||||
ImGui::SliderInt("Crosshair type",
|
ImGui::SliderInt("Crosshair type",
|
||||||
std::any_cast<int*>(parameters.at("crosshair_type_return")), 0, 1);
|
std::any_cast<int*>(parameters.at("crosshair_type_return")), 0, 1);
|
||||||
ImGui::SliderInt("Block to place",
|
ImGui::SliderInt("Block to place",
|
||||||
block_type, 2, 6);
|
std::any_cast<int*>(parameters.at("block_type_return")), 2, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui::CollapsingHeader("Mesh")){
|
if(ImGui::CollapsingHeader("Mesh")){
|
||||||
|
|
Loading…
Reference in New Issue