Tech ENABLE_TRANSFORMATIONS_BY_MATRICES - Reworked method void Selection::translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement) to use matrix multiplication and removed unused method void Selection::translate(unsigned int object_idx, const Vec3d& displacement)

Fixed conflicts during rebase with master
This commit is contained in:
enricoturri1966 2022-05-02 12:46:13 +02:00
parent 2f6f73e10f
commit 55be16d158
2 changed files with 12 additions and 0 deletions

View File

@ -1292,6 +1292,7 @@ void Selection::mirror(Axis axis)
set_bounding_boxes_dirty();
}
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
void Selection::translate(unsigned int object_idx, const Vec3d& displacement)
{
if (!m_valid)
@ -1340,6 +1341,7 @@ void Selection::translate(unsigned int object_idx, const Vec3d& displacement)
this->set_bounding_boxes_dirty();
}
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
void Selection::translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement)
{
@ -1349,7 +1351,11 @@ void Selection::translate(unsigned int object_idx, unsigned int instance_idx, co
for (unsigned int i : m_list) {
GLVolume& v = *(*m_volumes)[i];
if (v.object_idx() == (int)object_idx && v.instance_idx() == (int)instance_idx)
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
v.set_instance_transformation(Geometry::assemble_transform(displacement) * v.get_instance_transformation().get_matrix());
#else
v.set_instance_offset(v.get_instance_offset() + displacement);
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
}
std::set<unsigned int> done; // prevent processing volumes twice
@ -1382,7 +1388,11 @@ void Selection::translate(unsigned int object_idx, unsigned int instance_idx, co
if (v.object_idx() != object_idx || v.instance_idx() != (int)instance_idx)
continue;
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
v.set_instance_transformation(Geometry::assemble_transform(displacement) * v.get_instance_transformation().get_matrix());
#else
v.set_instance_offset(v.get_instance_offset() + displacement);
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
done.insert(j);
}
}

View File

@ -363,7 +363,9 @@ public:
void scale_to_fit_print_volume(const BuildVolume& volume);
void mirror(Axis axis);
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
void translate(unsigned int object_idx, const Vec3d& displacement);
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
void translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement);
#if ENABLE_WORLD_COORDINATE_SCALE_REVISITED