SLA gizmo now shows arrows pointing at the points so they are easy to see

This commit is contained in:
Lukas Matena 2019-03-13 14:32:09 +01:00
parent 46d19aa52d
commit 2750a8113d
2 changed files with 83 additions and 33 deletions

View file

@ -471,7 +471,7 @@ private:
ModelObject* m_old_model_object = nullptr;
int m_active_instance = -1;
int m_old_instance_id = -1;
Vec3f unproject_on_mesh(const Vec2d& mouse_pos);
std::pair<Vec3f, Vec3f> unproject_on_mesh(const Vec2d& mouse_pos);
const float RenderPointScale = 1.f;
@ -484,6 +484,16 @@ private:
Geometry::Transformation transformation;
};
class CacheEntry {
public:
CacheEntry(const sla::SupportPoint& point, bool sel, const Vec3f& norm = Vec3f::Zero()) :
support_point(point), selected(sel), normal(norm) {}
sla::SupportPoint support_point;
bool selected; // whether the point is selected
Vec3f normal;
};
// This holds information to decide whether recalculation is necessary:
SourceDataSummary m_source_data;
@ -510,6 +520,7 @@ private:
void render_points(const GLCanvas3D::Selection& selection, bool picking = false) const;
bool is_mesh_update_necessary() const;
void update_mesh();
void update_cache_entry_normal(unsigned int i) const;
#if !ENABLE_IMGUI
void render_tooltip_texture() const;
@ -523,7 +534,7 @@ private:
float m_new_point_head_diameter; // Size of a new point.
float m_minimal_point_distance = 20.f;
float m_density = 100.f;
std::vector<std::pair<sla::SupportPoint, bool>> m_editing_mode_cache; // a support point and whether it is currently selected
mutable std::vector<CacheEntry> m_editing_mode_cache; // a support point and whether it is currently selected
bool m_selection_rectangle_active = false;
Vec2d m_selection_rectangle_start_corner;