Merge branch 'master' into fs_emboss

This commit is contained in:
Filip Sykala - NTB T15p 2022-12-02 15:57:11 +01:00
commit 57695056ed
17 changed files with 1398 additions and 1030 deletions

View file

@ -1351,11 +1351,26 @@ void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObje
m_render_sla_auxiliaries = visible;
#if ENABLE_RAYCAST_PICKING
std::vector<std::shared_ptr<SceneRaycasterItem>>* raycasters = get_raycasters_for_picking(SceneRaycaster::EType::Volume);
#endif // ENABLE_RAYCAST_PICKING
for (GLVolume* vol : m_volumes.volumes) {
#if ENABLE_RAYCAST_PICKING
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)
&& vol->composite_id.volume_id < 0)
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)
&& vol->composite_id.volume_id < 0) {
vol->is_active = visible;
auto it = std::find_if(raycasters->begin(), raycasters->end(), [vol](std::shared_ptr<SceneRaycasterItem> item) { return item->get_raycaster() == vol->mesh_raycaster.get(); });
if (it != raycasters->end())
(*it)->set_active(vol->is_active);
}
#else
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)
&& vol->composite_id.volume_id < 0)
vol->is_active = visible;
#endif // ENABLE_RAYCAST_PICKING
}
}
@ -5548,12 +5563,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];
@ -5582,6 +5602,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
}