SLA support points improvements

- semi-intelligent algorithm to place support points
- enhanced ImGui dialog with editing/non-editing mode
- support points can have different head diameter (only implemented in GUI so far)
- autogenerated points supporting emerging islands are annotated and the info is kept
This commit is contained in:
Lukas Matena 2019-01-30 08:26:23 +01:00
parent f4243c694f
commit 21026ec9a8
16 changed files with 433 additions and 495 deletions

View file

@ -441,27 +441,16 @@ class GLGizmoSlaSupports : public GLGizmoBase
{
private:
ModelObject* m_model_object = nullptr;
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
ModelObject* m_old_model_object = nullptr;
int m_old_instance_id = -1;
#else
Transform3d m_instance_matrix;
#endif // ENABLE_SLA_SUPPORT_GIZMO_MOD
Vec3f unproject_on_mesh(const Vec2d& mouse_pos);
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
GLUquadricObj* m_quadric;
#endif // ENABLE_SLA_SUPPORT_GIZMO_MOD
Eigen::MatrixXf m_V; // vertices
Eigen::MatrixXi m_F; // facets indices
igl::AABB<Eigen::MatrixXf,3> m_AABB;
struct SourceDataSummary {
#if !ENABLE_SLA_SUPPORT_GIZMO_MOD
BoundingBoxf3 bounding_box;
Transform3d matrix;
#endif // !ENABLE_SLA_SUPPORT_GIZMO_MOD
Vec3d mesh_first_point;
};
@ -472,12 +461,8 @@ private:
public:
explicit GLGizmoSlaSupports(GLCanvas3D& parent);
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
virtual ~GLGizmoSlaSupports();
void set_sla_support_data(ModelObject* model_object, const GLCanvas3D::Selection& selection);
#else
void set_model_object_ptr(ModelObject* model_object);
#endif // ENABLE_SLA_SUPPORT_GIZMO_MOD
void clicked_on_object(const Vec2d& mouse_position);
void delete_current_grabber(bool delete_all);
@ -487,11 +472,7 @@ private:
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
void render_grabbers(const GLCanvas3D::Selection& selection, bool picking = false) const;
#else
void render_grabbers(bool picking = false) const;
#endif // ENABLE_SLA_SUPPORT_GIZMO_MOD
bool is_mesh_update_necessary() const;
void update_mesh();
@ -501,6 +482,10 @@ private:
mutable GLTexture m_reset_texture;
#endif // not ENABLE_IMGUI
bool m_lock_unique_islands = false;
bool m_editing_mode = false;
float m_new_point_head_diameter = 0.4f;
protected:
void on_set_state() override {
if (m_state == On && is_mesh_update_necessary()) {