Measuring: Fixed rendering of point features when the object is scaled
This commit is contained in:
parent
1922213725
commit
8312dc2454
@ -467,13 +467,14 @@ void GLGizmoMeasure::on_render()
|
||||
|
||||
auto render_feature = [this, set_matrix_uniforms](const Measure::SurfaceFeature& feature, const std::vector<ColorRGBA>& colors,
|
||||
const Transform3d& model_matrix, float inv_zoom, bool update_raycasters) {
|
||||
const Transform3d model_matrix_scale_inverse = Geometry::Transformation(model_matrix).get_scaling_factor_matrix().inverse();
|
||||
switch (feature.get_type())
|
||||
{
|
||||
default: { assert(false); break; }
|
||||
case Measure::SurfaceFeatureType::Point:
|
||||
{
|
||||
const Vec3d& position = feature.get_point();
|
||||
const Transform3d feature_matrix = model_matrix * Geometry::translation_transform(position) * Geometry::scale_transform(inv_zoom);
|
||||
const Transform3d feature_matrix = model_matrix * Geometry::translation_transform(position) * model_matrix_scale_inverse * Geometry::scale_transform(inv_zoom);
|
||||
set_matrix_uniforms(feature_matrix);
|
||||
m_sphere.model.set_color(colors.front());
|
||||
m_sphere.model.render();
|
||||
@ -488,7 +489,7 @@ void GLGizmoMeasure::on_render()
|
||||
{
|
||||
const auto& [center, radius, normal] = feature.get_circle();
|
||||
// render center
|
||||
const Transform3d center_matrix = model_matrix * Geometry::translation_transform(center) * Geometry::scale_transform(inv_zoom);
|
||||
const Transform3d center_matrix = model_matrix * Geometry::translation_transform(center) * model_matrix_scale_inverse * Geometry::scale_transform(inv_zoom);
|
||||
set_matrix_uniforms(center_matrix);
|
||||
m_sphere.model.set_color(colors.front());
|
||||
m_sphere.model.render();
|
||||
@ -515,7 +516,7 @@ void GLGizmoMeasure::on_render()
|
||||
// render extra point
|
||||
const std::optional<Vec3d> extra = feature.get_extra_point();
|
||||
if (extra.has_value()) {
|
||||
const Transform3d point_matrix = model_matrix * Geometry::translation_transform(*extra) * Geometry::scale_transform(inv_zoom);
|
||||
const Transform3d point_matrix = model_matrix * Geometry::translation_transform(*extra) * model_matrix_scale_inverse * Geometry::scale_transform(inv_zoom);
|
||||
set_matrix_uniforms(point_matrix);
|
||||
m_sphere.model.set_color(colors.front());
|
||||
m_sphere.model.render();
|
||||
|
Loading…
Reference in New Issue
Block a user