Tech ENABLE_RAYCAST_PICKING_DEBUG - Extended data shown into debug imgui dialog

This commit is contained in:
enricoturri1966 2022-11-29 11:13:09 +01:00
parent 1357914301
commit 5a3f36da01

View File

@ -5508,12 +5508,17 @@ void GLCanvas3D::_picking_pass()
default: { break; }
}
auto add_strings_row_to_table = [&imgui](const std::string& col_1, const ImVec4& col_1_color, const std::string& col_2, const ImVec4& col_2_color) {
auto add_strings_row_to_table = [&imgui](const std::string& col_1, const ImVec4& col_1_color, const std::string& col_2, const ImVec4& col_2_color,
const std::string& col_3 = "", const ImVec4& col_3_color = ImGui::GetStyleColorVec4(ImGuiCol_Text)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(col_1_color, col_1.c_str());
ImGui::TableSetColumnIndex(1);
imgui.text_colored(col_2_color, col_2.c_str());
if (!col_3.empty()) {
ImGui::TableSetColumnIndex(2);
imgui.text_colored(col_3_color, col_3.c_str());
}
};
char buf[1024];
@ -5542,6 +5547,21 @@ void GLCanvas3D::_picking_pass()
add_strings_row_to_table("Gizmo elements", ImGuiWrapper::COL_ORANGE_LIGHT, std::string(buf), ImGui::GetStyleColorVec4(ImGuiCol_Text));
ImGui::EndTable();
}
std::vector<std::shared_ptr<SceneRaycasterItem>>* gizmo_raycasters = m_scene_raycaster.get_raycasters(SceneRaycaster::EType::Gizmo);
if (gizmo_raycasters != nullptr && !gizmo_raycasters->empty()) {
ImGui::Separator();
imgui.text("Gizmo raycasters IDs:");
if (ImGui::BeginTable("GizmoRaycasters", 3)) {
for (size_t i = 0; i < gizmo_raycasters->size(); ++i) {
add_strings_row_to_table(std::to_string(i), ImGuiWrapper::COL_ORANGE_LIGHT,
std::to_string(SceneRaycaster::decode_id(SceneRaycaster::EType::Gizmo, (*gizmo_raycasters)[i]->get_id())), ImGui::GetStyleColorVec4(ImGuiCol_Text),
to_string(Geometry::Transformation((*gizmo_raycasters)[i]->get_transform()).get_offset()), ImGui::GetStyleColorVec4(ImGuiCol_Text));
}
ImGui::EndTable();
}
}
imgui.end();
#endif // ENABLE_RAYCAST_PICKING_DEBUG
}