World / local coordinates: Fixed wrong scaling of a group selection,

changed the "anisotropic scaling" - "embed vertices" message,
fixed scaling in the world coordinate system, so it does not count
the modifiers into the bounding box size.
This commit is contained in:
bubnikv 2019-05-07 15:43:53 +02:00
parent a351e99bac
commit 6881911411
4 changed files with 40 additions and 16 deletions

View file

@ -430,10 +430,16 @@ const BoundingBoxf3& Selection::get_unscaled_instance_bounding_box() const
{
if (m_unscaled_instance_bounding_box_dirty)
calc_unscaled_instance_bounding_box();
return m_unscaled_instance_bounding_box;
}
const BoundingBoxf3& Selection::get_scaled_instance_bounding_box() const
{
if (m_scaled_instance_bounding_box_dirty)
calc_scaled_instance_bounding_box();
return m_scaled_instance_bounding_box;
}
void Selection::start_dragging()
{
if (!m_valid)
@ -1416,11 +1422,11 @@ void Selection::calc_bounding_box() const
void Selection::calc_unscaled_instance_bounding_box() const
{
m_unscaled_instance_bounding_box = BoundingBoxf3();
if (m_valid)
{
for (unsigned int i : m_list)
{
if (m_valid) {
for (unsigned int i : m_list) {
const GLVolume &volume = *(*m_volumes)[i];
if (volume.is_modifier)
continue;
Transform3d trafo = volume.get_instance_transformation().get_matrix(false, false, true, false) * volume.get_volume_transformation().get_matrix();
trafo.translation()(2) += volume.get_sla_shift_z();
m_unscaled_instance_bounding_box.merge(volume.transformed_convex_hull_bounding_box(trafo));
@ -1429,6 +1435,22 @@ void Selection::calc_unscaled_instance_bounding_box() const
m_unscaled_instance_bounding_box_dirty = false;
}
void Selection::calc_scaled_instance_bounding_box() const
{
m_scaled_instance_bounding_box = BoundingBoxf3();
if (m_valid) {
for (unsigned int i : m_list) {
const GLVolume &volume = *(*m_volumes)[i];
if (volume.is_modifier)
continue;
Transform3d trafo = volume.get_instance_transformation().get_matrix(false, false, false, false) * volume.get_volume_transformation().get_matrix();
trafo.translation()(2) += volume.get_sla_shift_z();
m_scaled_instance_bounding_box.merge(volume.transformed_convex_hull_bounding_box(trafo));
}
}
m_scaled_instance_bounding_box_dirty = false;
}
void Selection::render_selected_volumes() const
{
float color[3] = { 1.0f, 1.0f, 1.0f };