mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
GLCanvas3DManager moved from being a static member of _3DScene to be a normal member of GUI_App
This commit is contained in:
parent
47604b6326
commit
0b629eb905
24 changed files with 738 additions and 24 deletions
|
@ -13,6 +13,9 @@
|
|||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "slic3r/GUI/GUI_ObjectSettings.hpp"
|
||||
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
||||
#if ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
#include "slic3r/GUI/MeshUtils.hpp"
|
||||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/PresetBundle.hpp"
|
||||
|
@ -414,7 +417,11 @@ bool GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec
|
|||
if (! m_c->m_mesh_raycaster)
|
||||
return false;
|
||||
|
||||
#if ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
#else
|
||||
const Camera& camera = m_parent.get_camera();
|
||||
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||
Geometry::Transformation trafo = volume->get_instance_transformation();
|
||||
|
@ -524,7 +531,11 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||
points_inside.push_back(points[idx].cast<float>());
|
||||
|
||||
// Only select/deselect points that are actually visible
|
||||
#if ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
for (size_t idx : m_c->m_mesh_raycaster->get_unobscured_idxs(trafo, wxGetApp().plater()->get_camera(), points_inside, m_c->m_clipping_plane.get()))
|
||||
#else
|
||||
for (size_t idx : m_c->m_mesh_raycaster->get_unobscured_idxs(trafo, m_parent.get_camera(), points_inside, m_c->m_clipping_plane.get()))
|
||||
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
{
|
||||
if (rectangle_status == GLSelectionRectangle::Deselect)
|
||||
unselect_point(points_idxs[idx]);
|
||||
|
@ -1321,8 +1332,14 @@ void GLGizmoSlaSupports::update_clipping_plane(bool keep_normal) const
|
|||
{
|
||||
if (! m_c->m_model_object)
|
||||
return;
|
||||
|
||||
#if ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
Vec3d normal = (keep_normal && m_c->m_clipping_plane->get_normal() != Vec3d::Zero() ?
|
||||
m_c->m_clipping_plane->get_normal() : -m_parent.get_camera().get_dir_forward());
|
||||
m_c->m_clipping_plane->get_normal() : -wxGetApp().plater()->get_camera().get_dir_forward());
|
||||
#else
|
||||
Vec3d normal = (keep_normal && m_c->m_clipping_plane->get_normal() != Vec3d::Zero() ?
|
||||
m_c->m_clipping_plane->get_normal() : -m_parent.get_camera().get_dir_forward());
|
||||
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
|
||||
const Vec3d& center = m_c->m_model_object->instances[m_c->m_active_instance]->get_offset() + Vec3d(0., 0., m_z_shift);
|
||||
float dist = normal.dot(center);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue