mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	Tech ENABLE_SINKING_CONTOURS -> Sinking contours shown while dragging Move/Rotate/Scale gizmos and show contours for gizmo cut
This commit is contained in:
		
							parent
							
								
									502906178f
								
							
						
					
					
						commit
						b24488ce51
					
				
					 21 changed files with 200 additions and 123 deletions
				
			
		|  | @ -285,9 +285,6 @@ void GLIndexedVertexArray::render( | |||
| } | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| #define ALG_SLICE_MESH 1 | ||||
| #define ALG_SLICE_MESHEX 2 | ||||
| #define ALG_SLICE ALG_SLICE_MESH | ||||
| void GLVolume::SinkingContours::update() | ||||
| { | ||||
|     if (m_parent.is_sinking() && !m_parent.is_below_printbed()) { | ||||
|  | @ -299,78 +296,19 @@ void GLVolume::SinkingContours::update() | |||
|             const TriangleMesh& mesh = GUI::wxGetApp().plater()->model().objects[m_parent.object_idx()]->volumes[m_parent.volume_idx()]->mesh(); | ||||
|             assert(mesh.has_shared_vertices()); | ||||
| 
 | ||||
| #if ALG_SLICE == ALG_SLICE_MESH | ||||
|             MeshSlicingParams slicing_params; | ||||
|             slicing_params.trafo = m_parent.world_matrix(); | ||||
|             Polygons polygons = slice_mesh(mesh.its, 0.0f, slicing_params); | ||||
| 
 | ||||
|             auto append_polygon = [this](const Polygon& polygon, GUI::GLModel::InitializationData& data) { | ||||
|                 if (!polygon.empty()) { | ||||
|                     GUI::GLModel::InitializationData::Entity entity; | ||||
|                     entity.type = GUI::GLModel::PrimitiveType::LineLoop; | ||||
|                     entity.color[0] = 1.0f - m_parent.render_color[0]; | ||||
|                     entity.color[1] = 1.0f - m_parent.render_color[1]; | ||||
|                     entity.color[2] = 1.0f - m_parent.render_color[2]; | ||||
|                     entity.color[3] = m_parent.render_color[3]; | ||||
|                     // contour
 | ||||
|                     entity.positions.reserve(polygon.size() + 1); | ||||
|                     entity.indices.reserve(polygon.size() + 1); | ||||
|                     unsigned int id = 0; | ||||
|                     for (const Point& p : polygon) { | ||||
|                         entity.positions.emplace_back(unscale(p.x(), p.y(), 0.0).cast<float>()); | ||||
|                         entity.indices.emplace_back(id++); | ||||
|                     } | ||||
|                     data.entities.emplace_back(entity); | ||||
|                 } | ||||
|             }; | ||||
| 
 | ||||
|             m_model.reset(); | ||||
|             GUI::GLModel::InitializationData init_data; | ||||
|             for (const Polygon& polygon : polygons) { | ||||
|                 // contour
 | ||||
|                 append_polygon(polygon, init_data); | ||||
|             } | ||||
| #else | ||||
|             MeshSlicingParamsEx slicing_params; | ||||
|             slicing_params.trafo = m_parent.world_matrix(); | ||||
|             std::vector<ExPolygons> list_of_expolys = slice_mesh_ex(mesh.its, std::vector<float>{ 0.0f }, slicing_params); | ||||
| 
 | ||||
|             auto append_polygon = [this](const Polygon& polygon, GUI::GLModel::InitializationData& data) { | ||||
|                 if (!polygon.empty()) { | ||||
|                     GUI::GLModel::InitializationData::Entity entity; | ||||
|                     entity.type = GUI::GLModel::PrimitiveType::LineLoop; | ||||
|                     entity.color[0] = 1.0f - m_parent.render_color[0]; | ||||
|                     entity.color[1] = 1.0f - m_parent.render_color[1]; | ||||
|                     entity.color[2] = 1.0f - m_parent.render_color[2]; | ||||
|                     entity.color[3] = m_parent.render_color[3]; | ||||
|                     // contour
 | ||||
|                     entity.positions.reserve(polygon.size() + 1); | ||||
|                     entity.indices.reserve(polygon.size() + 1); | ||||
|                     unsigned int id = 0; | ||||
|                     for (const Point& p : polygon) { | ||||
|                         entity.positions.emplace_back(unscale(p.x(), p.y(), 0.0).cast<float>()); | ||||
|                         entity.indices.emplace_back(id++); | ||||
|                     } | ||||
|                     data.entities.emplace_back(entity); | ||||
|                 } | ||||
|             m_model.init_from(polygons, 0.0f); | ||||
|             std::array<float, 4> color = { | ||||
|                 1.0f - m_parent.render_color[0], | ||||
|                 1.0f - m_parent.render_color[1], | ||||
|                 1.0f - m_parent.render_color[2], | ||||
|                 m_parent.render_color[3] | ||||
|             }; | ||||
| 
 | ||||
|             m_model.reset(); | ||||
|             GUI::GLModel::InitializationData init_data; | ||||
|             for (const ExPolygons& polygons : list_of_expolys) { | ||||
|                 for (const ExPolygon& polygon : polygons) { | ||||
|                     // contour
 | ||||
|                     append_polygon(polygon.contour, init_data); | ||||
|                     // holes
 | ||||
|                     for (const Polygon& hole : polygon.holes) { | ||||
|                         append_polygon(hole, init_data); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| #endif // ALG_SLICE == ALG_SLICE_MESH
 | ||||
| 
 | ||||
|             if (!init_data.entities.empty()) | ||||
|                 m_model.init_from(init_data); | ||||
|             m_model.set_color(-1, color); | ||||
|         } | ||||
|         else | ||||
|             m_shift = box.center() - m_old_box.center(); | ||||
|  | @ -433,6 +371,9 @@ GLVolume::GLVolume(float r, float g, float b, float a) | |||
|     , force_transparent(false) | ||||
|     , force_native_color(false) | ||||
|     , force_neutral_color(false) | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     , force_sinking_contours(false) | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
|     , tverts_range(0, size_t(-1)) | ||||
|     , qverts_range(0, size_t(-1)) | ||||
| { | ||||
|  | @ -887,7 +828,8 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab | |||
|         volume.first->set_render_color(); | ||||
| 
 | ||||
|         // render sinking contours of non-hovered volumes
 | ||||
|         if (volume.first->is_sinking() && !volume.first->is_below_printbed() && volume.first->hover == GLVolume::HS_None) { | ||||
|         if (volume.first->is_sinking() && !volume.first->is_below_printbed() && | ||||
|             volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) { | ||||
|             shader->stop_using(); | ||||
|             glsafe(::glLineWidth(5.0f)); | ||||
|             volume.first->update_sinking_contours_color(); | ||||
|  | @ -933,8 +875,9 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab | |||
|     } | ||||
| 
 | ||||
|     for (GLVolumeWithIdAndZ& volume : to_render) { | ||||
|         // render sinking contours of hovered volumes
 | ||||
|         if (volume.first->is_sinking() && !volume.first->is_below_printbed() && volume.first->hover != GLVolume::HS_None) { | ||||
|         // render sinking contours of hovered/displaced volumes
 | ||||
|         if (volume.first->is_sinking() && !volume.first->is_below_printbed() && | ||||
|             (volume.first->hover != GLVolume::HS_None || volume.first->force_sinking_contours)) { | ||||
|             shader->stop_using(); | ||||
|             glsafe(::glLineWidth(5.0f)); | ||||
|             glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
|  |  | |||
|  | @ -359,7 +359,11 @@ public: | |||
| 	    bool                force_native_color : 1; | ||||
|         // Whether or not render this volume in neutral
 | ||||
|         bool                force_neutral_color : 1; | ||||
| 	}; | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|         // Whether or not to force rendering of sinking contours
 | ||||
|         bool                force_sinking_contours : 1; | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
|     }; | ||||
| 
 | ||||
|     // Is mouse or rectangle selection over this object to select/deselect it ?
 | ||||
|     EHoverState         	hover; | ||||
|  |  | |||
|  | @ -2964,6 +2964,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     for (GLVolume* volume : m_volumes.volumes) { | ||||
|         volume->force_sinking_contours = false; | ||||
|     } | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
|     if (m_gizmos.on_mouse(evt)) { | ||||
|         if (wxWindow::FindFocus() != m_canvas) | ||||
|             // Grab keyboard focus for input in gizmo dialogs.
 | ||||
|  | @ -2988,6 +2994,25 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | |||
|             default: { break; } | ||||
|             } | ||||
|         } | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|         else if (evt.Dragging()) { | ||||
|             switch (m_gizmos.get_current_type()) | ||||
|             { | ||||
|             case GLGizmosManager::EType::Move: | ||||
|             case GLGizmosManager::EType::Scale: | ||||
|             case GLGizmosManager::EType::Rotate: | ||||
|             { | ||||
|                 const Selection::IndicesList& idxs = m_selection.get_volume_idxs(); | ||||
|                 for (unsigned int idx : idxs) { | ||||
|                     m_volumes.volumes[idx]->force_sinking_contours = true; | ||||
|                 } | ||||
|                 m_dirty = true; | ||||
|                 break; | ||||
|             } | ||||
|             default: { break; } | ||||
|             } | ||||
|         } | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
|         return; | ||||
|     } | ||||
|  |  | |||
|  | @ -7,6 +7,9 @@ | |||
| 
 | ||||
| #include "libslic3r/TriangleMesh.hpp" | ||||
| #include "libslic3r/Model.hpp" | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| #include "libslic3r/Polygon.hpp" | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| #include <boost/filesystem/operations.hpp> | ||||
| #include <boost/algorithm/string/predicate.hpp> | ||||
|  | @ -87,6 +90,35 @@ void GLModel::init_from(const TriangleMesh& mesh) | |||
|     m_render_data.emplace_back(data); | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| void GLModel::init_from(const Polygons& polygons, float z) | ||||
| { | ||||
|     auto append_polygon = [this](const Polygon& polygon, float z, GUI::GLModel::InitializationData& data) { | ||||
|         if (!polygon.empty()) { | ||||
|             GUI::GLModel::InitializationData::Entity entity; | ||||
|             entity.type = GUI::GLModel::PrimitiveType::LineLoop; | ||||
|             // contour
 | ||||
|             entity.positions.reserve(polygon.size() + 1); | ||||
|             entity.indices.reserve(polygon.size() + 1); | ||||
|             unsigned int id = 0; | ||||
|             for (const Point& p : polygon) { | ||||
|                 Vec3f position = unscale(p.x(), p.y(), 0.0).cast<float>(); | ||||
|                 position.z() = z; | ||||
|                 entity.positions.emplace_back(position); | ||||
|                 entity.indices.emplace_back(id++); | ||||
|             } | ||||
|             data.entities.emplace_back(entity); | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     InitializationData init_data; | ||||
|     for (const Polygon& polygon : polygons) { | ||||
|         append_polygon(polygon, z, init_data); | ||||
|     } | ||||
|     init_from(init_data); | ||||
| } | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| bool GLModel::init_from_file(const std::string& filename) | ||||
| { | ||||
|     if (!boost::filesystem::exists(filename)) | ||||
|  |  | |||
|  | @ -9,6 +9,10 @@ | |||
| namespace Slic3r { | ||||
| 
 | ||||
| class TriangleMesh; | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| class Polygon; | ||||
| using Polygons = std::vector<Polygon>; | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| namespace GUI { | ||||
| 
 | ||||
|  | @ -58,6 +62,9 @@ namespace GUI { | |||
| 
 | ||||
|         void init_from(const InitializationData& data); | ||||
|         void init_from(const TriangleMesh& mesh); | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|         void init_from(const Polygons& polygons, float z); | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
|         bool init_from_file(const std::string& filename); | ||||
| 
 | ||||
|         // if entity_id == -1 set the color of all entities
 | ||||
|  |  | |||
|  | @ -154,8 +154,8 @@ public: | |||
| 
 | ||||
|     void update(const UpdateData& data); | ||||
| 
 | ||||
|     void render() const { m_tooltip.clear(); on_render(); } | ||||
|     void render_for_picking() const { on_render_for_picking(); } | ||||
|     void render() { m_tooltip.clear(); on_render(); } | ||||
|     void render_for_picking() { on_render_for_picking(); } | ||||
|     void render_input_window(float x, float y, float bottom_limit); | ||||
| 
 | ||||
|     virtual std::string get_tooltip() const { return ""; } | ||||
|  | @ -175,8 +175,8 @@ protected: | |||
|     virtual void on_start_dragging() {} | ||||
|     virtual void on_stop_dragging() {} | ||||
|     virtual void on_update(const UpdateData& data) {} | ||||
|     virtual void on_render() const = 0; | ||||
|     virtual void on_render_for_picking() const = 0; | ||||
|     virtual void on_render() = 0; | ||||
|     virtual void on_render_for_picking() = 0; | ||||
|     virtual void on_render_input_window(float x, float y, float bottom_limit) {} | ||||
| 
 | ||||
|     // Returns the picking color for the given id, based on the BASE_ID constant
 | ||||
|  |  | |||
|  | @ -16,7 +16,9 @@ | |||
| #include "slic3r/GUI/GUI_ObjectManipulation.hpp" | ||||
| #include "libslic3r/AppConfig.hpp" | ||||
| #include "libslic3r/Model.hpp" | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| #include "libslic3r/TriangleMeshSlicer.hpp" | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
|  | @ -82,9 +84,9 @@ void GLGizmoCut::on_update(const UpdateData& data) | |||
|         set_cut_z(m_start_z + calc_projection(data.mouse_ray)); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoCut::on_render() const | ||||
| void GLGizmoCut::on_render() | ||||
| { | ||||
|     BoundingBoxf3 box = bounding_box(); | ||||
|     const BoundingBoxf3 box = bounding_box(); | ||||
|     Vec3d plane_center = box.center(); | ||||
|     plane_center.z() = m_cut_z; | ||||
|     m_max_z = box.max.z(); | ||||
|  | @ -136,9 +138,16 @@ void GLGizmoCut::on_render() const | |||
|     m_grabbers[0].render(m_hover_id == 0, (float)((box.size().x() + box.size().y() + box.size().z()) / 3.0)); | ||||
| 
 | ||||
|     shader->stop_using(); | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     glsafe(::glPushMatrix()); | ||||
|     glsafe(::glTranslated(m_cut_contours.shift.x(), m_cut_contours.shift.y(), m_cut_contours.shift.z())); | ||||
|     m_cut_contours.contours.render(); | ||||
|     glsafe(::glPopMatrix()); | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| } | ||||
| 
 | ||||
| void GLGizmoCut::on_render_for_picking() const | ||||
| void GLGizmoCut::on_render_for_picking() | ||||
| { | ||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
|     render_grabbers_for_picking(m_parent.get_selection().get_bounding_box()); | ||||
|  | @ -199,10 +208,49 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit) | |||
|         perform_cut(m_parent.get_selection()); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoCut::set_cut_z(double cut_z) const | ||||
| void GLGizmoCut::set_cut_z(double cut_z) | ||||
| { | ||||
|     // Clamp the plane to the object's bounding box
 | ||||
|     m_cut_z = std::clamp(cut_z, 0.0, m_max_z); | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
|     const GLVolume* first_glvolume = selection.get_volume(*selection.get_volume_idxs().begin()); | ||||
|     const BoundingBoxf3& box = first_glvolume->transformed_convex_hull_bounding_box(); | ||||
| 
 | ||||
|     const int object_idx = selection.get_object_idx(); | ||||
|     const int instance_idx = selection.get_instance_idx(); | ||||
| 
 | ||||
|     if (0.0 < m_cut_z && m_cut_z < m_max_z) { | ||||
|         if (m_cut_contours.cut_z != m_cut_z || m_cut_contours.object_idx != object_idx || m_cut_contours.instance_idx != instance_idx) { | ||||
|             m_cut_contours.cut_z = m_cut_z; | ||||
| 
 | ||||
|             if (m_cut_contours.object_idx != object_idx) { | ||||
|                 m_cut_contours.mesh = wxGetApp().plater()->model().objects[object_idx]->raw_mesh(); | ||||
|                 m_cut_contours.mesh.repair(); | ||||
|             } | ||||
| 
 | ||||
|             m_cut_contours.position = box.center(); | ||||
|             m_cut_contours.shift = Vec3d::Zero(); | ||||
|             m_cut_contours.object_idx = object_idx; | ||||
|             m_cut_contours.instance_idx = instance_idx; | ||||
|             m_cut_contours.contours.reset(); | ||||
| 
 | ||||
|             MeshSlicingParams slicing_params; | ||||
|             slicing_params.trafo = first_glvolume->get_instance_transformation().get_matrix(); | ||||
|             const Polygons polys = slice_mesh(m_cut_contours.mesh.its, m_cut_z, slicing_params); | ||||
|             if (!polys.empty()) { | ||||
|                 m_cut_contours.contours.init_from(polys, static_cast<float>(m_cut_z)); | ||||
|                 m_cut_contours.contours.set_color(-1, { 1.0f, 1.0f, 1.0f, 1.0f }); | ||||
|             } | ||||
|         } | ||||
|         else if (box.center() != m_cut_contours.position) { | ||||
|             m_cut_contours.shift = box.center() - m_cut_contours.position; | ||||
|         } | ||||
|     } | ||||
|     else | ||||
|         m_cut_contours.contours.reset(); | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| } | ||||
| 
 | ||||
| void GLGizmoCut::perform_cut(const Selection& selection) | ||||
|  |  | |||
|  | @ -2,7 +2,10 @@ | |||
| #define slic3r_GLGizmoCut_hpp_ | ||||
| 
 | ||||
| #include "GLGizmoBase.hpp" | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
| #include "slic3r/GUI/GLModel.hpp" | ||||
| #include "libslic3r/TriangleMesh.hpp" | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
|  | @ -13,8 +16,8 @@ class GLGizmoCut : public GLGizmoBase | |||
|     static const double Margin; | ||||
|     static const std::array<float, 4> GrabberColor; | ||||
| 
 | ||||
|     mutable double m_cut_z{ 0.0 }; | ||||
|     mutable double m_max_z{ 0.0 }; | ||||
|     double m_cut_z{ 0.0 }; | ||||
|     double m_max_z{ 0.0 }; | ||||
|     double m_start_z{ 0.0 }; | ||||
|     Vec3d m_drag_pos; | ||||
|     Vec3d m_drag_center; | ||||
|  | @ -22,11 +25,26 @@ class GLGizmoCut : public GLGizmoBase | |||
|     bool m_keep_lower{ true }; | ||||
|     bool m_rotate_lower{ false }; | ||||
| 
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     struct CutContours | ||||
|     { | ||||
|         TriangleMesh mesh; | ||||
|         GLModel contours; | ||||
|         double cut_z{ 0.0 }; | ||||
|         Vec3d position{ Vec3d::Zero() }; | ||||
|         Vec3d shift{ Vec3d::Zero() }; | ||||
|         int object_idx{ -1 }; | ||||
|         int instance_idx{ -1 }; | ||||
|     }; | ||||
| 
 | ||||
|     CutContours m_cut_contours; | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| public: | ||||
|     GLGizmoCut(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); | ||||
| 
 | ||||
|     double get_cut_z() const { return m_cut_z; } | ||||
|     void set_cut_z(double cut_z) const; | ||||
|     void set_cut_z(double cut_z); | ||||
| 
 | ||||
|     std::string get_tooltip() const override; | ||||
| 
 | ||||
|  | @ -39,8 +57,8 @@ protected: | |||
|     virtual bool on_is_activable() const override; | ||||
|     virtual void on_start_dragging() override; | ||||
|     virtual void on_update(const UpdateData& data) override; | ||||
|     virtual void on_render() const override; | ||||
|     virtual void on_render_for_picking() const override; | ||||
|     virtual void on_render() override; | ||||
|     virtual void on_render_for_picking() override; | ||||
|     virtual void on_render_input_window(float x, float y, float bottom_limit) override; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -54,7 +54,7 @@ void GLGizmoFlatten::on_start_dragging() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLGizmoFlatten::on_render() const | ||||
| void GLGizmoFlatten::on_render() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| 
 | ||||
|  | @ -69,7 +69,7 @@ void GLGizmoFlatten::on_render() const | |||
|         glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z())); | ||||
|         glsafe(::glMultMatrixd(m.data())); | ||||
|         if (this->is_plane_update_necessary()) | ||||
| 			const_cast<GLGizmoFlatten*>(this)->update_planes(); | ||||
|             update_planes(); | ||||
|         for (int i = 0; i < (int)m_planes.size(); ++i) { | ||||
|             if (i == m_hover_id) | ||||
|                 glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.75f)); | ||||
|  | @ -86,7 +86,7 @@ void GLGizmoFlatten::on_render() const | |||
|     glsafe(::glDisable(GL_BLEND)); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoFlatten::on_render_for_picking() const | ||||
| void GLGizmoFlatten::on_render_for_picking() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| 
 | ||||
|  | @ -99,7 +99,7 @@ void GLGizmoFlatten::on_render_for_picking() const | |||
|         glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z())); | ||||
|         glsafe(::glMultMatrixd(m.data())); | ||||
|         if (this->is_plane_update_necessary()) | ||||
| 			const_cast<GLGizmoFlatten*>(this)->update_planes(); | ||||
|             update_planes(); | ||||
|         for (int i = 0; i < (int)m_planes.size(); ++i) { | ||||
|             glsafe(::glColor4fv(picking_color_component(i).data())); | ||||
|             m_planes[i].vbo.render(); | ||||
|  |  | |||
|  | @ -53,8 +53,8 @@ protected: | |||
|     virtual std::string on_get_name() const override; | ||||
|     virtual bool on_is_activable() const override; | ||||
|     virtual void on_start_dragging() override; | ||||
|     virtual void on_render() const override; | ||||
|     virtual void on_render_for_picking() const override; | ||||
|     virtual void on_render() override; | ||||
|     virtual void on_render_for_picking() override; | ||||
|     virtual void on_set_state() override; | ||||
|     virtual CommonGizmosDataID on_get_requirements() const override; | ||||
| }; | ||||
|  |  | |||
|  | @ -61,7 +61,7 @@ void GLGizmoHollow::set_sla_support_data(ModelObject*, const Selection&) | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void GLGizmoHollow::on_render() const | ||||
| void GLGizmoHollow::on_render() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
|     const CommonGizmosDataObjects::SelectionInfo* sel_info = m_c->selection_info(); | ||||
|  | @ -88,7 +88,7 @@ void GLGizmoHollow::on_render() const | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| void GLGizmoHollow::on_render_for_picking() const | ||||
| void GLGizmoHollow::on_render_for_picking() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| //#if ENABLE_RENDER_PICKING_PASS
 | ||||
|  |  | |||
|  | @ -39,8 +39,8 @@ public: | |||
| private: | ||||
|     bool on_init() override; | ||||
|     void on_update(const UpdateData& data) override; | ||||
|     void on_render() const override; | ||||
|     void on_render_for_picking() const override; | ||||
|     void on_render() override; | ||||
|     void on_render_for_picking() override; | ||||
| 
 | ||||
|     void render_points(const Selection& selection, bool picking = false) const; | ||||
|     void hollow_mesh(bool postpone_error_messages = false); | ||||
|  |  | |||
|  | @ -87,7 +87,7 @@ void GLGizmoMove3D::on_update(const UpdateData& data) | |||
|         m_displacement.z() = calc_projection(data); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoMove3D::on_render() const | ||||
| void GLGizmoMove3D::on_render() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| 
 | ||||
|  | @ -151,7 +151,7 @@ void GLGizmoMove3D::on_render() const | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLGizmoMove3D::on_render_for_picking() const | ||||
| void GLGizmoMove3D::on_render_for_picking() | ||||
| { | ||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -39,8 +39,8 @@ protected: | |||
|     virtual void on_start_dragging() override; | ||||
|     virtual void on_stop_dragging() override; | ||||
|     virtual void on_update(const UpdateData& data) override; | ||||
|     virtual void on_render() const override; | ||||
|     virtual void on_render_for_picking() const override; | ||||
|     virtual void on_render() override; | ||||
|     virtual void on_render_for_picking() override; | ||||
| 
 | ||||
| private: | ||||
|     double calc_projection(const UpdateData& data) const; | ||||
|  |  | |||
|  | @ -66,8 +66,8 @@ class GLGizmoPainterBase : public GLGizmoBase | |||
| private: | ||||
|     ObjectID m_old_mo_id; | ||||
|     size_t m_old_volumes_size = 0; | ||||
|     void on_render() const override {} | ||||
|     void on_render_for_picking() const override {} | ||||
|     void on_render() override {} | ||||
|     void on_render_for_picking() override {} | ||||
| 
 | ||||
| public: | ||||
|     GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); | ||||
|  |  | |||
|  | @ -125,7 +125,7 @@ void GLGizmoRotate::on_update(const UpdateData& data) | |||
|     m_angle = theta; | ||||
| } | ||||
| 
 | ||||
| void GLGizmoRotate::on_render() const | ||||
| void GLGizmoRotate::on_render() | ||||
| { | ||||
|     if (!m_grabbers[0].enabled) | ||||
|         return; | ||||
|  | @ -169,7 +169,7 @@ void GLGizmoRotate::on_render() const | |||
|     glsafe(::glPopMatrix()); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoRotate::on_render_for_picking() const | ||||
| void GLGizmoRotate::on_render_for_picking() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| 
 | ||||
|  | @ -483,17 +483,17 @@ void GLGizmoRotate3D::on_stop_dragging() | |||
|         m_gizmos[m_hover_id].stop_dragging(); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoRotate3D::on_render() const | ||||
| void GLGizmoRotate3D::on_render() | ||||
| { | ||||
|     glsafe(::glClear(GL_DEPTH_BUFFER_BIT)); | ||||
| 
 | ||||
|     if ((m_hover_id == -1) || (m_hover_id == 0)) | ||||
|     if (m_hover_id == -1 || m_hover_id == 0) | ||||
|         m_gizmos[X].render(); | ||||
| 
 | ||||
|     if ((m_hover_id == -1) || (m_hover_id == 1)) | ||||
|     if (m_hover_id == -1 || m_hover_id == 1) | ||||
|         m_gizmos[Y].render(); | ||||
| 
 | ||||
|     if ((m_hover_id == -1) || (m_hover_id == 2)) | ||||
|     if (m_hover_id == -1 || m_hover_id == 2) | ||||
|         m_gizmos[Z].render(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -55,8 +55,8 @@ protected: | |||
|     std::string on_get_name() const override { return ""; } | ||||
|     void on_start_dragging() override; | ||||
|     void on_update(const UpdateData& data) override; | ||||
|     void on_render() const override; | ||||
|     void on_render_for_picking() const override; | ||||
|     void on_render() override; | ||||
|     void on_render_for_picking() override; | ||||
| 
 | ||||
| private: | ||||
|     void render_circle() const; | ||||
|  | @ -124,10 +124,10 @@ protected: | |||
|             g.update(data); | ||||
|         } | ||||
|     } | ||||
|     void on_render() const override; | ||||
|     void on_render_for_picking() const override | ||||
|     void on_render() override; | ||||
|     void on_render_for_picking() override | ||||
|     { | ||||
|         for (const GLGizmoRotate& g : m_gizmos) { | ||||
|         for (GLGizmoRotate& g : m_gizmos) { | ||||
|             g.render_for_picking(); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -115,7 +115,7 @@ void GLGizmoScale3D::on_update(const UpdateData& data) | |||
|         do_scale_uniform(data); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoScale3D::on_render() const | ||||
| void GLGizmoScale3D::on_render() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
| 
 | ||||
|  | @ -294,7 +294,7 @@ void GLGizmoScale3D::on_render() const | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLGizmoScale3D::on_render_for_picking() const | ||||
| void GLGizmoScale3D::on_render_for_picking() | ||||
| { | ||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
|     render_grabbers_for_picking(m_parent.get_selection().get_bounding_box()); | ||||
|  |  | |||
|  | @ -52,8 +52,8 @@ protected: | |||
|     virtual bool on_is_activable() const override; | ||||
|     virtual void on_start_dragging() override; | ||||
|     virtual void on_update(const UpdateData& data) override; | ||||
|     virtual void on_render() const override; | ||||
|     virtual void on_render_for_picking() const override; | ||||
|     virtual void on_render() override; | ||||
|     virtual void on_render_for_picking() override; | ||||
| 
 | ||||
| private: | ||||
|     void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const; | ||||
|  |  | |||
|  | @ -74,7 +74,7 @@ void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const S | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void GLGizmoSlaSupports::on_render() const | ||||
| void GLGizmoSlaSupports::on_render() | ||||
| { | ||||
|     ModelObject* mo = m_c->selection_info()->model_object(); | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
|  | @ -101,7 +101,7 @@ void GLGizmoSlaSupports::on_render() const | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| void GLGizmoSlaSupports::on_render_for_picking() const | ||||
| void GLGizmoSlaSupports::on_render_for_picking() | ||||
| { | ||||
|     const Selection& selection = m_parent.get_selection(); | ||||
|     //glsafe(::glEnable(GL_DEPTH_TEST));
 | ||||
|  |  | |||
|  | @ -70,8 +70,8 @@ public: | |||
| private: | ||||
|     bool on_init() override; | ||||
|     void on_update(const UpdateData& data) override; | ||||
|     void on_render() const override; | ||||
|     void on_render_for_picking() const override; | ||||
|     void on_render() override; | ||||
|     void on_render_for_picking() override; | ||||
| 
 | ||||
|     void render_points(const Selection& selection, bool picking = false) const; | ||||
|     bool unsaved_changes() const; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966