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

Clips three-dimensional triangles against a set of provided planes. More...

#include <CeresEngine/Mesh/TriangleClipper.hpp>

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

Public Member Functions

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)
 

Private Member Functions

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.
 

Private Attributes

TVector3< TvertexBuffer [BUFFER_SIZE]
 
TVector2< TuvBuffer [BUFFER_SIZE]
 

Static Private Attributes

static const int BUFFER_SIZE = 64 * 3
 

Additional Inherited Members

- Protected Member Functions inherited from CeresEngine::TriangleClipper< T >
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 inherited from CeresEngine::TriangleClipper< T >
ClipMesh mesh
 

Detailed Description

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

Clips three-dimensional triangles against a set of provided planes.

Member Function Documentation

◆ clip()

template<typename T >
void CeresEngine::TriangleClipper3D< T >::clip ( UInt8 vertices,
UInt8 uvs,
UInt32  numTris,
UInt32  vertexStride,
const Vector< TPlane< T > > &  clipPlanes,
const std::function< void(TVector3< T > *, TVector2< T > *, UInt32)> &  writeCallback 
)

◆ convertToMesh()

template<typename T >
void CeresEngine::TriangleClipper3D< T >::convertToMesh ( const std::function< void(TVector3< T > *, TVector2< T > *, UInt32)> &  writeCallback)
private

Converts clipped vertices back into triangles and outputs them via the provided callback.

Member Data Documentation

◆ BUFFER_SIZE

template<typename T >
const int CeresEngine::TriangleClipper3D< T >::BUFFER_SIZE = 64 * 3
staticprivate

◆ uvBuffer

template<typename T >
TVector2<T> CeresEngine::TriangleClipper3D< T >::uvBuffer[BUFFER_SIZE]
private

◆ vertexBuffer

template<typename T >
TVector3<T> CeresEngine::TriangleClipper3D< T >::vertexBuffer[BUFFER_SIZE]
private

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