Castor3D 0.12.0
Multiplatform 3D engine
Public Member Functions | Static Public Attributes | List of all members
castor3d::TriFaceMapping Class Reference

#include <TriFaceMapping.hpp>

Inheritance diagram for castor3d::TriFaceMapping:
Inheritance graph
[legend]
Collaboration diagram for castor3d::TriFaceMapping:
Collaboration graph
[legend]

Public Member Functions

C3D_API TriFaceMapping (Submesh &submesh, VkBufferUsageFlags bufferUsageFlags={})
 Constructor. More...
 
C3D_API void clearFaces ()
 Clears this submesh's face array. More...
 
C3D_API Face addFace (uint32_t a, uint32_t b, uint32_t c)
 Creates and adds a face to the submesh. More...
 
C3D_API void addFaceGroup (FaceIndices const *const begin, FaceIndices const *const end)
 Creates and adds faces to the submesh. More...
 
C3D_API void addQuadFace (uint32_t a, uint32_t b, uint32_t c, uint32_t d, castor::Point3f const &minUV=castor::Point3f(), castor::Point3f const &maxUV=castor::Point3f(1, 1, 1))
 Creates and adds a quad face to the submesh. More...
 
C3D_API void computeFacesFromPolygonVertex ()
 Creates faces from the points. More...
 
C3D_API void computeNormals (InterleavedVertexArray &points, bool reverted=false) const
 Computes normal and tangent for each vertex of the given face. More...
 
C3D_API void computeNormals (Face const &face)
 Computes normal and tangent for each vertex of the given face. More...
 
C3D_API void computeNormals (InterleavedVertexArray &points, Face const &face) const
 Computes normal and tangent for each vertex of the given face. More...
 
C3D_API void computeTangents (Face const &face)
 Computes tangent for each vertex of the given face. More...
 
C3D_API void computeTangents (InterleavedVertexArray &points, Face const &face) const
 Computes tangent for each vertex of the given face. More...
 
C3D_API void computeTangentsFromNormals ()
 Computes tangent for each vertex of the submesh. More...
 
C3D_API void computeTangentsFromNormals (InterleavedVertexArray &points) const
 Computes tangent for each vertex of the submesh. More...
 
C3D_API uint32_t getCount () const override
 
C3D_API uint32_t getComponentsCount () const override
 
C3D_API void sortByDistance (castor::Point3f const &cameraPosition) override
 Sorts the face from farthest to nearest from the camera. More...
 
C3D_API void computeNormals (bool reverted=false) override
 Generates normals and tangents. More...
 
C3D_API SubmeshComponentSPtr clone (Submesh &submesh) const override
 
void addFaceGroup (std::vector< FaceIndices > const &faces)
 Creates and adds faces to the submesh. More...
 
template<size_t Count>
void addFaceGroup (std::array< FaceIndices, Count > const &faces)
 Creates and adds faces to the submesh. More...
 
template<uint32_t Count>
void addFaceGroup (FaceIndices(&faces)[Count])
 Creates and adds faces to the submesh. More...
 
Face const & operator[] (uint32_t index) const
 Retrieves the face at given index. More...
 
FaceArray const & getFaces () const
 
FaceArray & getFaces ()
 
- Public Member Functions inherited from castor3d::IndexMapping
C3D_API IndexMapping (Submesh &submesh, castor::String const &type, VkBufferUsageFlags bufferUsageFlags)
 Constructor. More...
 
virtual C3D_API uint32_t getCount () const =0
 
virtual C3D_API uint32_t getComponentsCount () const =0
 
virtual C3D_API void sortByDistance (castor::Point3f const &cameraPosition)=0
 Sorts the face from farthest to nearest from the camera. More...
 
virtual C3D_API void computeNormals (bool reverted=false)=0
 Generates normals and tangents. More...
 
void gather (ShaderFlags const &shaderFlags, ProgramFlags const &programFlags, MaterialRPtr material, ashes::BufferCRefArray &buffers, std::vector< uint64_t > &offsets, ashes::PipelineVertexInputStateCreateInfoCRefArray &layouts, TextureFlagsArray const &mask, uint32_t &currentLocation) override
 Gathers buffers that need to go in a vertex layout. More...
 
ProgramFlags getProgramFlags (MaterialRPtr material) const override
 
VkBufferUsageFlags getUsageFlags () const override
 
- Public Member Functions inherited from castor3d::SubmeshComponent
C3D_API SubmeshComponent (Submesh &submesh, castor::String const &type, uint32_t id)
 Constructor. More...
 
virtual C3D_API ~SubmeshComponent () noexcept=default
 Destructor. More...
 
C3D_API bool initialise (RenderDevice const &device)
 Initialises the submesh. More...
 
C3D_API void cleanup (RenderDevice const &device)
 Cleans the submesh. More...
 
C3D_API void upload ()
 Uploads data on VRAM. More...
 
virtual C3D_API void gather (ShaderFlags const &shaderFlags, ProgramFlags const &programFlags, MaterialRPtr material, ashes::BufferCRefArray &buffers, std::vector< uint64_t > &offsets, ashes::PipelineVertexInputStateCreateInfoCRefArray &layouts, TextureFlagsArray const &mask, uint32_t &currentLocation)=0
 Gathers buffers that need to go in a vertex layout. More...
 
virtual C3D_API ProgramFlags getProgramFlags (MaterialRPtr material) const =0
 
virtual C3D_API VkBufferUsageFlags getUsageFlags () const
 
virtual C3D_API SubmeshComponentSPtr clone (Submesh &submesh) const =0
 
castor::String const & getType () const
 
void needsUpdate ()
 Sets the component to be updated. More...
 
uint32_t getID ()
 

Static Public Attributes

static C3D_API castor::String const Name
 

Additional Inherited Members

- Protected Attributes inherited from castor3d::IndexMapping
StagingDataUPtr m_staging
 

Constructor & Destructor Documentation

◆ TriFaceMapping()

C3D_API castor3d::TriFaceMapping::TriFaceMapping ( Submesh submesh,
VkBufferUsageFlags  bufferUsageFlags = {} 
)
explicit

Constructor.

Parameters
[in]submeshThe parent submesh.
[in]bufferUsageFlagsThe buffer usage flags.

Member Function Documentation

◆ addFace()

C3D_API Face castor3d::TriFaceMapping::addFace ( uint32_t  a,
uint32_t  b,
uint32_t  c 
)

Creates and adds a face to the submesh.

Parameters
[in]aThe first face's vertex index.
[in]bThe second face's vertex index.
[in]cThe third face's vertex index.
Returns
The created face.

◆ addFaceGroup() [1/4]

C3D_API void castor3d::TriFaceMapping::addFaceGroup ( FaceIndices const *const  begin,
FaceIndices const *const  end 
)

Creates and adds faces to the submesh.

Parameters
[in]beginThe faces data begin.
[in]endThe faces data end.

Referenced by addFaceGroup().

Here is the caller graph for this function:

◆ addFaceGroup() [2/4]

template<uint32_t Count>
void castor3d::TriFaceMapping::addFaceGroup ( FaceIndices(&)  faces[Count])
inline

Creates and adds faces to the submesh.

Parameters
[in]facesThe faces.

References addFaceGroup().

Here is the call graph for this function:

◆ addFaceGroup() [3/4]

template<size_t Count>
void castor3d::TriFaceMapping::addFaceGroup ( std::array< FaceIndices, Count > const &  faces)
inline

Creates and adds faces to the submesh.

Parameters
[in]facesThe faces.

References addFaceGroup().

Here is the call graph for this function:

◆ addFaceGroup() [4/4]

void castor3d::TriFaceMapping::addFaceGroup ( std::vector< FaceIndices > const &  faces)
inline

Creates and adds faces to the submesh.

Parameters
[in]facesThe faces.

References addFaceGroup().

Here is the call graph for this function:

◆ addQuadFace()

C3D_API void castor3d::TriFaceMapping::addQuadFace ( uint32_t  a,
uint32_t  b,
uint32_t  c,
uint32_t  d,
castor::Point3f const &  minUV = castor::Point3f(),
castor::Point3f const &  maxUV = castor::Point3f(1, 1, 1) 
)

Creates and adds a quad face to the submesh.

Parameters
[in]aThe first face's vertex index.
[in]bThe second face's vertex index.
[in]cThe third face's vertex index.
[in]dThe fourth face's vertex index.
[in]minUVThe UV of the bottom left corner.
[in]maxUVThe UV of the top right corner.

◆ clearFaces()

C3D_API void castor3d::TriFaceMapping::clearFaces ( )

Clears this submesh's face array.

◆ clone()

C3D_API SubmeshComponentSPtr castor3d::TriFaceMapping::clone ( Submesh submesh) const
overridevirtual

Returns
Clones this component into given submesh.
Parameters
[in,out]submeshReceives the cloned component.

Implements castor3d::SubmeshComponent.

◆ computeFacesFromPolygonVertex()

C3D_API void castor3d::TriFaceMapping::computeFacesFromPolygonVertex ( )

Creates faces from the points.

Remarks
This function assumes the points are sorted like triangles fan.

◆ computeNormals() [1/4]

C3D_API void castor3d::TriFaceMapping::computeNormals ( bool  reverted = false)
overridevirtual

Generates normals and tangents.

Parameters
[in]revertedTells if normals are inverted.

Implements castor3d::IndexMapping.

◆ computeNormals() [2/4]

C3D_API void castor3d::TriFaceMapping::computeNormals ( Face const &  face)

Computes normal and tangent for each vertex of the given face.

Parameters
[in]faceThe face.

◆ computeNormals() [3/4]

C3D_API void castor3d::TriFaceMapping::computeNormals ( InterleavedVertexArray points,
bool  reverted = false 
) const

Computes normal and tangent for each vertex of the given face.

Parameters
[in,out]pointsThe points.
[in]revertedtrue to invert normals.

◆ computeNormals() [4/4]

C3D_API void castor3d::TriFaceMapping::computeNormals ( InterleavedVertexArray points,
Face const &  face 
) const

Computes normal and tangent for each vertex of the given face.

Parameters
[in,out]pointsThe points.
[in]faceThe face.

◆ computeTangents() [1/2]

C3D_API void castor3d::TriFaceMapping::computeTangents ( Face const &  face)

Computes tangent for each vertex of the given face.

Parameters
[in]faceThe face.

◆ computeTangents() [2/2]

C3D_API void castor3d::TriFaceMapping::computeTangents ( InterleavedVertexArray points,
Face const &  face 
) const

Computes tangent for each vertex of the given face.

Parameters
[in,out]pointsThe points.
[in]faceThe face.

◆ computeTangentsFromNormals() [1/2]

C3D_API void castor3d::TriFaceMapping::computeTangentsFromNormals ( )

Computes tangent for each vertex of the submesh.

Remarks
This function supposes the normals are defined.

◆ computeTangentsFromNormals() [2/2]

C3D_API void castor3d::TriFaceMapping::computeTangentsFromNormals ( InterleavedVertexArray points) const

Computes tangent for each vertex of the submesh.

Remarks
This function supposes the normals are defined.
Parameters
[in,out]pointsThe points.

◆ getComponentsCount()

C3D_API uint32_t castor3d::TriFaceMapping::getComponentsCount ( ) const
overridevirtual

Returns
The components count in an element.

Implements castor3d::IndexMapping.

◆ getCount()

C3D_API uint32_t castor3d::TriFaceMapping::getCount ( ) const
overridevirtual

Returns
The elements count.

Implements castor3d::IndexMapping.

◆ getFaces() [1/2]

FaceArray & castor3d::TriFaceMapping::getFaces ( )
inline
Returns
The faces array.

◆ getFaces() [2/2]

FaceArray const & castor3d::TriFaceMapping::getFaces ( ) const
inline
Returns
The faces array.

◆ operator[]()

Face const & castor3d::TriFaceMapping::operator[] ( uint32_t  index) const
inline

Retrieves the face at given index.

Parameters
[in]indexThe index.
Returns
The value.

◆ sortByDistance()

C3D_API void castor3d::TriFaceMapping::sortByDistance ( castor::Point3f const &  cameraPosition)
overridevirtual

Sorts the face from farthest to nearest from the camera.

Parameters
[in]cameraPositionThe camera position, relative to submesh

Implements castor3d::IndexMapping.

Member Data Documentation

◆ Name

C3D_API castor::String const castor3d::TriFaceMapping::Name
static

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