FIX: rendering issue of mirrored model

jira: STUDIO-10869

Change-Id: I985ae6fd0df917fbd4bd537220048b59df902c9a
This commit is contained in:
jun.zhang 2025-03-17 14:35:00 +08:00 committed by lane.wei
parent c690ba82b1
commit 576d59f6c8
1 changed files with 9 additions and 3 deletions

View File

@ -747,9 +747,15 @@ Transform3d GLVolume::world_matrix() const
bool GLVolume::is_left_handed() const bool GLVolume::is_left_handed() const
{ {
const Vec3d &m1 = m_instance_transformation.get_mirror(); // reference <Real-Time Rendering Fourth Edition> page 84
const Vec3d &m2 = m_volume_transformation.get_mirror(); // link: https://www.realtimerendering.com/
return m1.x() * m1.y() * m1.z() * m2.x() * m2.y() * m2.z() < 0.; const auto model_matrix = world_matrix().matrix();
Eigen::Matrix3d subMatrix = model_matrix.block<3, 3>(0, 0);
const auto det = subMatrix.determinant();
if (det < 1e-6f) {
return true;
}
return false;
} }
const BoundingBoxf3& GLVolume::transformed_bounding_box() const const BoundingBoxf3& GLVolume::transformed_bounding_box() const