CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::TriangleClipper< T > Class Template Reference

Implementation from: http://www.geometrictools.com/Documentation/ClipMesh.pdf. More...

#include <CeresEngine/Mesh/TriangleClipper.hpp>

Inheritance diagram for CeresEngine::TriangleClipper< T >:
CeresEngine::TriangleClipper2D< T > CeresEngine::TriangleClipper3D< T >

Classes

struct  ClipEdge
 Single edge in the clipped mesh. More...
 
struct  ClipFace
 Single polygon in the clipped mesh. More...
 
struct  ClipMesh
 Contains vertices, edges and faces of the clipped mesh. More...
 
struct  ClipVert
 Single vertex in the clipped mesh. More...
 

Protected Member Functions

void addEdgesAndFaces ()
 Register all edges and faces, using the mesh vertices as a basis.
 
Int32 clipByPlane (const TPlane< T > &plane)
 Clips the current mesh with the provided plane.
 
Int32 processVertices (const TPlane< T > &plane)
 Clips vertices of the current mesh by the provided plane.
 
void processEdges ()
 Clips edges of the current mesh.
 
void processFaces ()
 Clips the faces (polygons) of the current mesh.
 
void getOrderedFaces (Vector< Vector< UInt32 > > &sortedFaces)
 Returns a set of non-culled vertex indices for every visible face in the 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.
 
TVector3< TgetNormal (Vector< UInt32 > &sortedVertices, UInt32 numVertices)
 Calculates the normal for vertices related to the provided vertex indices.
 
bool getOpenPolyline (ClipFace &face, UInt32 &start, UInt32 &end)
 Checks is the polygon shape of the provided face open or closed.
 

Protected Attributes

ClipMesh mesh
 

Detailed Description

template<typename T>
class CeresEngine::TriangleClipper< T >

Implementation from: http://www.geometrictools.com/Documentation/ClipMesh.pdf.

Member Function Documentation

◆ addEdgesAndFaces()

template<typename T >
void CeresEngine::TriangleClipper< T >::addEdgesAndFaces ( )
protected

Register all edges and faces, using the mesh vertices as a basis.

Assumes vertices are not indexed and that every three vertices form a face.

◆ clipByPlane()

template<typename T >
Int32 CeresEngine::TriangleClipper< T >::clipByPlane ( const TPlane< T > &  plane)
protected

Clips the current mesh with the provided plane.

◆ getNormal()

template<typename T >
TVector3< T > CeresEngine::TriangleClipper< T >::getNormal ( Vector< UInt32 > &  sortedVertices,
UInt32  numVertices 
)
protected

Calculates the normal for vertices related to the provided vertex indices.

◆ getOpenPolyline()

template<typename T >
bool CeresEngine::TriangleClipper< T >::getOpenPolyline ( ClipFace face,
UInt32 start,
UInt32 end 
)
protected

Checks is the polygon shape of the provided face open or closed.

If open, returns true and outputs endpoints of the polyline.

◆ getOrderedFaces()

template<typename T >
void CeresEngine::TriangleClipper< T >::getOrderedFaces ( Vector< Vector< UInt32 > > &  sortedFaces)
protected

Returns a set of non-culled vertex indices for every visible face in the mesh.

This should be called after clipping operation is complete to retrieve valid vertices.

◆ getOrderedVertices()

template<typename T >
void CeresEngine::TriangleClipper< T >::getOrderedVertices ( const ClipFace face,
Vector< UInt32 > &  vertices 
)
protected

Returns a set of ordered and non-culled vertices for the provided face of the mesh.

◆ processEdges()

template<typename T >
void CeresEngine::TriangleClipper< T >::processEdges ( )
protected

Clips edges of the current mesh.

processVertices() must be called beforehand.

◆ processFaces()

template<typename T >
void CeresEngine::TriangleClipper< T >::processFaces ( )
protected

Clips the faces (polygons) of the current mesh.

processEdges() must be called beforehand.

◆ processVertices()

template<typename T >
Int32 CeresEngine::TriangleClipper< T >::processVertices ( const TPlane< T > &  plane)
protected

Clips vertices of the current mesh by the provided plane.

Member Data Documentation

◆ mesh

template<typename T >
ClipMesh CeresEngine::TriangleClipper< T >::mesh
protected

The documentation for this class was generated from the following file: