Painting gizmos and sinking objects:

1. Do not show what's below the bed when a gizmo is open
2. Triangulate the cut so people don't see inside
3. If regular clipping plane is used, the cuts are mutually clipped by one another
4. Painting itself ignores the hidden part of the object
This commit is contained in:
Lukas Matena 2021-08-07 08:12:32 +02:00
parent b174dacc85
commit 13604469fd
5 changed files with 152 additions and 17 deletions

View file

@ -71,6 +71,11 @@ public:
// This is supposed to be in world coordinates.
void set_plane(const ClippingPlane& plane);
// In case the object is clipped by two planes (e.g. in case of sinking
// objects), this will be used to clip the triagnulated cut.
// Pass ClippingPlane::ClipsNothing to turn this off.
void set_limiting_plane(const ClippingPlane& plane);
// Which mesh to cut. MeshClipper remembers const * to it, caller
// must make sure that it stays valid.
void set_mesh(const TriangleMesh& mesh);
@ -92,6 +97,7 @@ private:
const TriangleMesh* m_mesh = nullptr;
const TriangleMesh* m_negative_mesh = nullptr;
ClippingPlane m_plane;
ClippingPlane m_limiting_plane = ClippingPlane::ClipsNothing();
std::vector<Vec2f> m_triangles2d;
GLIndexedVertexArray m_vertex_array;
bool m_triangles_valid = false;