FIX: Selected shadow position is not correct in assembly view

Change-Id: If727e8f70dc85fb256cad6d9de9bb4913cb11896
(cherry picked from commit a3540aa72566a6606ee3533b4770d010d1edd58c)
This commit is contained in:
zhimin.zeng 2023-02-24 16:16:22 +08:00 committed by Lane.Wei
parent 0532f837fa
commit b2c457eec6
2 changed files with 2 additions and 26 deletions

View file

@ -569,26 +569,6 @@ Transform3d GLVolume::world_matrix() const
return m; return m;
} }
//BBS: scaled_matrix
Transform3d GLVolume::world_matrix( float scale_factor) const
{
//const Vec3d& volume_translation = m_volume_transformation.get_offset();
//Vec3d scaling_factor = { scale_factor, scale_factor, scale_factor };
Vec3d ofs2ass = m_offset_to_assembly * (GLVolume::explosion_ratio - 1.0);
Vec3d volofs2obj = m_volume_transformation.get_offset() * (GLVolume::explosion_ratio - 1.0);
Transform3d volume_matrix = Geometry::assemble_transform(
m_volume_transformation.get_offset() + ofs2ass + volofs2obj,
m_volume_transformation.get_rotation(),
m_volume_transformation.get_scaling_factor() * scale_factor,
m_volume_transformation.get_mirror()
);
Transform3d m = m_instance_transformation.get_matrix() * volume_matrix;
//m.translation()(2) += m_sla_shift_z;
return m;
}
bool GLVolume::is_left_handed() const bool GLVolume::is_left_handed() const
{ {
const Vec3d &m1 = m_instance_transformation.get_mirror(); const Vec3d &m1 = m_instance_transformation.get_mirror();
@ -834,8 +814,6 @@ void GLVolume::render(bool with_outline) const
fclose(file); fclose(file);
} }
#endif #endif
Transform3d matrix = world_matrix();
render_body(); render_body();
//BOOST_LOG_TRIVIAL(info) << boost::format(": %1%, outline render body, shader name %2%")%__LINE__ %shader->get_name(); //BOOST_LOG_TRIVIAL(info) << boost::format(": %1%, outline render body, shader name %2%")%__LINE__ %shader->get_name();
@ -887,7 +865,8 @@ void GLVolume::render(bool with_outline) const
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
matrix = world_matrix(scale); Transform3d matrix = world_matrix();
matrix.scale(scale);
glsafe(::glMultMatrixd(matrix.data())); glsafe(::glMultMatrixd(matrix.data()));
this->indexed_vertex_array.render(this->tverts_range, this->qverts_range); this->indexed_vertex_array.render(this->tverts_range, this->qverts_range);
//BOOST_LOG_TRIVIAL(info) << boost::format(": %1%, outline render for body, shader name %2%")%__LINE__ %shader->get_name(); //BOOST_LOG_TRIVIAL(info) << boost::format(": %1%, outline render for body, shader name %2%")%__LINE__ %shader->get_name();

View file

@ -501,9 +501,6 @@ public:
Transform3d world_matrix() const; Transform3d world_matrix() const;
bool is_left_handed() const; bool is_left_handed() const;
//BBS: world_matrix with scale factor
Transform3d world_matrix(float scale_factor) const;
const BoundingBoxf3& transformed_bounding_box() const; const BoundingBoxf3& transformed_bounding_box() const;
// non-caching variant // non-caching variant
BoundingBoxf3 transformed_convex_hull_bounding_box(const Transform3d &trafo) const; BoundingBoxf3 transformed_convex_hull_bounding_box(const Transform3d &trafo) const;