Fixed shifted clippimg plane triangulation on scaled meshes,
fighting z-fighting has to be done in world coords.
This commit is contained in:
parent
8dfc0422a8
commit
d9f2fd7501
@ -106,7 +106,6 @@ void MeshClipper::recalculate_triangles()
|
|||||||
Transform3d tr = Transform3d::Identity();
|
Transform3d tr = Transform3d::Identity();
|
||||||
tr.rotate(q);
|
tr.rotate(q);
|
||||||
tr = m_trafo.get_matrix() * tr;
|
tr = m_trafo.get_matrix() * tr;
|
||||||
height_mesh += 0.001f; // to avoid z-fighting
|
|
||||||
|
|
||||||
if (m_limiting_plane != ClippingPlane::ClipsNothing())
|
if (m_limiting_plane != ClippingPlane::ClipsNothing())
|
||||||
{
|
{
|
||||||
@ -165,6 +164,8 @@ void MeshClipper::recalculate_triangles()
|
|||||||
|
|
||||||
m_triangles2d = triangulate_expolygons_2f(expolys, m_trafo.get_matrix().matrix().determinant() < 0.);
|
m_triangles2d = triangulate_expolygons_2f(expolys, m_trafo.get_matrix().matrix().determinant() < 0.);
|
||||||
|
|
||||||
|
tr.pretranslate(0.001 * m_plane.get_normal().normalized()); // to avoid z-fighting
|
||||||
|
|
||||||
m_vertex_array.release_geometry();
|
m_vertex_array.release_geometry();
|
||||||
for (auto it=m_triangles2d.cbegin(); it != m_triangles2d.cend(); it=it+3) {
|
for (auto it=m_triangles2d.cbegin(); it != m_triangles2d.cend(); it=it+3) {
|
||||||
m_vertex_array.push_geometry(tr * Vec3d((*(it+0))(0), (*(it+0))(1), height_mesh), up);
|
m_vertex_array.push_geometry(tr * Vec3d((*(it+0))(0), (*(it+0))(1), height_mesh), up);
|
||||||
|
Loading…
Reference in New Issue
Block a user