Castor3D
..
|
Subdividers main class C3D_API. More...
Public Member Functions | |
C3D_API | Subdivider () |
Default constructor. More... | |
virtual C3D_API | ~Subdivider () |
Destructor. More... | |
virtual C3D_API void | Subdivide (SubmeshSPtr p_submesh, int p_occurences, bool p_generateBuffers=true, bool p_threaded=false) |
Main subdivision function. More... | |
virtual C3D_API void | Cleanup () |
Cleans all member variables. More... | |
C3D_API BufferElementGroupSPtr | AddPoint (real x, real y, real z) |
Creates and adds a vertex to my list. More... | |
C3D_API BufferElementGroupSPtr | AddPoint (Castor::Point3r const &p_v) |
Adds a vertex to my list. More... | |
C3D_API BufferElementGroupSPtr | AddPoint (real *p_v) |
Creates and adds a vertex to my list. More... | |
virtual C3D_API Face | AddFace (uint32_t a, uint32_t b, uint32_t c) |
Creates and adds a face. More... | |
virtual C3D_API int | IsInMyPoints (Castor::Point3r const &p_vertex, double p_precision) |
Tests if the given Point3r is in mine. More... | |
C3D_API uint32_t | GetPointsCount () const |
Retrieves the points count. More... | |
C3D_API BufferElementGroupSPtr | GetPoint (uint32_t i) const |
Retrieves the wanted point. More... | |
C3D_API VertexPtrArray const & | GetPoints () const |
void | SetSubdivisionEndCallback (SubdivisionEndFunction p_pfnSubdivisionEnd) |
Defines a function to execute when the threaded subdivision ends. More... | |
Protected Types | |
typedef std::function< void(Subdivider &) > | SubdivisionEndFunction |
Protected Member Functions | |
C3D_API uint32_t | DoSubdivideThreaded () |
Threaded subdivision function. More... | |
C3D_API Castor3D::BufferElementGroupSPtr | DoTryAddPoint (Castor::Point3r const &p_point) |
Checks if the given point is in my list and if not creates and adds it. More... | |
virtual C3D_API void | DoSubdivide (SubmeshSPtr p_submesh, bool p_generateBuffers, bool p_threaded) |
Main subdivision function. More... | |
virtual C3D_API void | DoInitialise () |
Initialisation function. More... | |
C3D_API void | DoSwapBuffers () |
Swaps the internal faces with the submeshes ones. More... | |
virtual C3D_API void | DoSubdivide ()=0 |
Effectively subdivides the submesh. More... | |
C3D_API void | DoSetTextCoords (BufferElementGroup const &p_a, BufferElementGroup const &p_b, BufferElementGroup const &p_c, BufferElementGroup &p_d, BufferElementGroup &p_e, BufferElementGroup &p_f) |
Computes the texture coordinates for given vertices, creates the faces. More... | |
C3D_API void | DoSetTextCoords (BufferElementGroup const &p_a, BufferElementGroup const &p_b, BufferElementGroup const &p_c, BufferElementGroup &p_p) |
Computes the texture coordinates for the new vertex, creates the faces. More... | |
Protected Attributes | |
SubmeshSPtr | m_submesh |
The submesh being subdivided. More... | |
FaceArray | m_arrayFaces |
The faces. More... | |
bool | m_bGenerateBuffers |
Tells if the buffers must be generatef. More... | |
SubdivisionEndFunction | m_pfnSubdivisionEnd |
The subdivision end callback. More... | |
std::shared_ptr< std::thread > | m_pThread |
The subdivision thread. More... | |
bool | m_bThreaded |
Tells that the subdivision is threaded. More... | |
std::recursive_mutex | m_mutex |
The subdivision thread mutex. More... | |
Subdividers main class C3D_API.
|
protected |
C3D_API Castor3D::Subdivider::Subdivider | ( | ) |
Default constructor.
|
virtual |
Destructor.
|
virtual |
Creates and adds a face.
[in] | a | The first face's vertex index |
[in] | b | The second face's vertex index |
[in] | c | The third face's vertex index |
C3D_API BufferElementGroupSPtr Castor3D::Subdivider::AddPoint | ( | real | x, |
real | y, | ||
real | z | ||
) |
Creates and adds a vertex to my list.
[in] | x,y,z | The vertex coordinates |
C3D_API BufferElementGroupSPtr Castor3D::Subdivider::AddPoint | ( | Castor::Point3r const & | p_v | ) |
Adds a vertex to my list.
[in] | p_v | The vertex to add |
C3D_API BufferElementGroupSPtr Castor3D::Subdivider::AddPoint | ( | real * | p_v | ) |
Creates and adds a vertex to my list.
[in] | p_v | The vertex coordinates |
|
virtual |
Cleans all member variables.
|
protectedvirtual |
Initialisation function.
|
protected |
Computes the texture coordinates for given vertices, creates the faces.
[in] | p_a,p_b,p_c | The source vertices |
[in] | p_d,p_e,p_f | The new vertices |
|
protected |
Computes the texture coordinates for the new vertex, creates the faces.
[in] | p_a,p_b,p_c | The source vertices |
[in] | p_p | The new vertex |
|
protectedvirtual |
Main subdivision function.
[in] | p_submesh | The submesh to subdivide |
[in] | p_generateBuffers | Tells if the buffers must be generated after subdivision |
[in] | p_threaded | Tells if subdivision must be threaded |
|
protectedpure virtual |
Effectively subdivides the submesh.
|
protected |
Threaded subdivision function.
|
protected |
Swaps the internal faces with the submeshes ones.
|
protected |
Checks if the given point is in my list and if not creates and adds it.
[in] | p_point | The vertex coordinates |
C3D_API BufferElementGroupSPtr Castor3D::Subdivider::GetPoint | ( | uint32_t | i | ) | const |
Retrieves the wanted point.
[in] | i | The point index |
C3D_API VertexPtrArray const& Castor3D::Subdivider::GetPoints | ( | ) | const |
C3D_API uint32_t Castor3D::Subdivider::GetPointsCount | ( | ) | const |
Retrieves the points count.
|
virtual |
Tests if the given Point3r is in mine.
[in] | p_vertex | The vertex to test |
[in] | p_precision | The comparison precision |
|
inline |
Defines a function to execute when the threaded subdivision ends.
[in] | p_pfnSubdivisionEnd | Pointer over the function to execute |
References m_pfnSubdivisionEnd.
|
virtual |
Main subdivision function.
[in] | p_submesh | The submesh to subdivide |
[in] | p_occurences | The subdivisions occurences |
[in] | p_generateBuffers | Tells if the buffers must be generated after subdivision |
[in] | p_threaded | Tells if subdivision must be threaded |
|
protected |
The faces.
|
protected |
Tells if the buffers must be generatef.
|
protected |
Tells that the subdivision is threaded.
|
protected |
The subdivision thread mutex.
|
protected |
The subdivision end callback.
Referenced by SetSubdivisionEndCallback().
|
protected |
The subdivision thread.
|
protected |
The submesh being subdivided.