Clips two-dimensional triangles against a set of provided planes.
Definition TriangleClipper.hpp:101
void clip(UInt8 *vertices, UInt8 *uvs, UInt32 numTris, UInt32 vertexStride, const Vector< TPlane< T > > &clipPlanes, const std::function< void(TVector2< T > *, TVector2< T > *, UInt32)> &writeCallback)
void convertToMesh(const std::function< void(TVector2< T > *, TVector2< T > *, UInt32)> &writeCallback)
Converts clipped vertices back into triangles and outputs them via the provided callback.
TVector2< T > vertexBuffer[BUFFER_SIZE]
Definition TriangleClipper.hpp:113
static const int BUFFER_SIZE
Definition TriangleClipper.hpp:112
TVector2< T > uvBuffer[BUFFER_SIZE]
Definition TriangleClipper.hpp:114
Clips three-dimensional triangles against a set of provided planes.
Definition TriangleClipper.hpp:118
void clip(UInt8 *vertices, UInt8 *uvs, UInt32 numTris, UInt32 vertexStride, const Vector< TPlane< T > > &clipPlanes, const std::function< void(TVector3< T > *, TVector2< T > *, UInt32)> &writeCallback)
TVector3< T > vertexBuffer[BUFFER_SIZE]
Definition TriangleClipper.hpp:130
void convertToMesh(const std::function< void(TVector3< T > *, TVector2< T > *, UInt32)> &writeCallback)
Converts clipped vertices back into triangles and outputs them via the provided callback.
static const int BUFFER_SIZE
Definition TriangleClipper.hpp:129
TVector2< T > uvBuffer[BUFFER_SIZE]
Definition TriangleClipper.hpp:131
Implementation from: http://www.geometrictools.com/Documentation/ClipMesh.pdf.
Definition TriangleClipper.hpp:20
void getOrderedFaces(Vector< Vector< UInt32 > > &sortedFaces)
Returns a set of non-culled vertex indices for every visible face in the mesh.
Int32 clipByPlane(const TPlane< T > &plane)
Clips the current mesh with the provided plane.
TVector3< T > getNormal(Vector< UInt32 > &sortedVertices, UInt32 numVertices)
Calculates the normal for vertices related to the provided vertex indices.
void processFaces()
Clips the faces (polygons) of the current mesh.
void getOrderedVertices(const ClipFace &face, Vector< UInt32 > &vertices)
Returns a set of ordered and non-culled vertices for the provided face of the mesh.
bool getOpenPolyline(ClipFace &face, UInt32 &start, UInt32 &end)
Checks is the polygon shape of the provided face open or closed.
Int32 processVertices(const TPlane< T > &plane)
Clips vertices of the current mesh by the provided plane.
void processEdges()
Clips edges of the current mesh.
ClipMesh mesh
Definition TriangleClipper.hpp:97
void addEdgesAndFaces()
Register all edges and faces, using the mesh vertices as a basis.
Definition Application.hpp:19
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
std::int32_t Int32
Definition DataTypes.hpp:21
std::uint8_t UInt8
Definition DataTypes.hpp:17
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Single edge in the clipped mesh.
Definition TriangleClipper.hpp:34
ClipEdge()
Definition TriangleClipper.hpp:35
bool visible
Definition TriangleClipper.hpp:39
UInt32 verts[2]
Definition TriangleClipper.hpp:37
Vector< UInt32 > faces
Definition TriangleClipper.hpp:38
Single polygon in the clipped mesh.
Definition TriangleClipper.hpp:43
Vector< UInt32 > edges
Definition TriangleClipper.hpp:46
bool visible
Definition TriangleClipper.hpp:47
ClipFace()
Definition TriangleClipper.hpp:44
TVector3< T > normal
Definition TriangleClipper.hpp:48
Contains vertices, edges and faces of the clipped mesh.
Definition TriangleClipper.hpp:52
Vector< ClipVert > verts
Definition TriangleClipper.hpp:55
Vector< ClipFace > faces
Definition TriangleClipper.hpp:57
ClipMesh()
Definition TriangleClipper.hpp:53
Vector< ClipEdge > edges
Definition TriangleClipper.hpp:56
Single vertex in the clipped mesh.
Definition TriangleClipper.hpp:23
T distance
Definition TriangleClipper.hpp:28
UInt32 occurs
Definition TriangleClipper.hpp:29
TVector2< T > uv
Definition TriangleClipper.hpp:27
TVector3< T > point
Definition TriangleClipper.hpp:26
bool visible
Definition TriangleClipper.hpp:30
ClipVert()
Definition TriangleClipper.hpp:24