Measuring: GLGizmoMeasure - Fixed update of circle geometry

This commit is contained in:
enricoturri1966 2022-09-05 09:18:07 +02:00
parent 9a7fd520b1
commit ed7534b8ce
2 changed files with 3 additions and 1 deletions

View File

@ -276,8 +276,9 @@ void GLGizmoMeasure::on_render()
case Measure::SurfaceFeatureType::Circle: case Measure::SurfaceFeatureType::Circle:
{ {
const auto [center, radius, normal] = m_curr_feature->get_circle(); const auto [center, radius, normal] = m_curr_feature->get_circle();
if (m_last_inv_zoom != inv_zoom) { if (m_last_inv_zoom != inv_zoom || m_last_circle != m_curr_feature) {
m_last_inv_zoom = inv_zoom; m_last_inv_zoom = inv_zoom;
m_last_circle = m_curr_feature;
m_circle.reset(); m_circle.reset();
GLModel::Geometry circle_geometry = smooth_torus(64, 16, float(radius), 5.0f * inv_zoom); GLModel::Geometry circle_geometry = smooth_torus(64, 16, float(radius), 5.0f * inv_zoom);
m_circle.mesh_raycaster = std::make_unique<MeshRaycaster>(std::make_shared<const TriangleMesh>(std::move(circle_geometry.get_as_indexed_triangle_set()))); m_circle.mesh_raycaster = std::make_unique<MeshRaycaster>(std::make_shared<const TriangleMesh>(std::move(circle_geometry.get_as_indexed_triangle_set())));

View File

@ -93,6 +93,7 @@ class GLGizmoMeasure : public GLGizmoBase
Vec3d m_first_instance_scale{ Vec3d::Ones() }; Vec3d m_first_instance_scale{ Vec3d::Ones() };
Vec3d m_first_instance_mirror{ Vec3d::Ones() }; Vec3d m_first_instance_mirror{ Vec3d::Ones() };
float m_last_inv_zoom{ 0.0f }; float m_last_inv_zoom{ 0.0f };
std::optional<Measure::SurfaceFeature> m_last_circle;
int m_last_plane_idx{ -1 }; int m_last_plane_idx{ -1 };
bool m_mouse_left_down{ false }; // for detection left_up of this gizmo bool m_mouse_left_down{ false }; // for detection left_up of this gizmo