Open 3D Engine EMotionFX Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <SubMesh.h>
Inherits MCore::RefCounted.
Public Member Functions | |
uint32 | GetStartIndex () const |
uint32 | GetStartVertex () const |
uint32 | GetStartPolygon () const |
uint32 * | GetIndices () const |
uint8 * | GetPolygonVertexCounts () const |
uint32 | GetNumVertices () const |
uint32 | GetNumIndices () const |
uint32 | GetNumPolygons () const |
Mesh * | GetParentMesh () const |
void | SetParentMesh (Mesh *mesh) |
void | SetStartIndex (uint32 indexOffset) |
void | SetStartPolygon (uint32 polygonNumber) |
void | SetStartVertex (uint32 vertexOffset) |
void | SetNumIndices (uint32 numIndices) |
void | SetNumVertices (uint32 numVertices) |
void | SetNumBones (size_t numBones) |
void | SetBone (size_t index, size_t nodeIndex) |
MCORE_INLINE size_t | GetNumBones () const |
MCORE_INLINE size_t | GetBone (size_t index) const |
MCORE_INLINE size_t * | GetBones () |
MCORE_INLINE const AZStd::vector< size_t > & | GetBonesArray () const |
MCORE_INLINE AZStd::vector< size_t > & | GetBonesArray () |
void | ReinitBonesArray (SkinningInfoVertexAttributeLayer *skinLayer) |
size_t | FindBoneIndex (size_t nodeNr) const |
void | RemapBone (size_t oldNodeNr, size_t newNodeNr) |
void | RemoveBone (size_t index) |
SubMesh * | Clone (Mesh *newParentMesh) |
uint32 | CalcNumTriangles () const |
Public Member Functions inherited from MCore::RefCounted | |
RefCounted () | |
virtual | ~RefCounted () |
void | IncreaseReferenceCount () |
void | DecreaseReferenceCount () |
void | Destroy () |
uint32 | GetReferenceCount () const |
Static Public Member Functions | |
static SubMesh * | Create (Mesh *parentMesh, uint32 startVertex, uint32 startIndex, uint32 startPolygon, uint32 numVerts, uint32 numIndices, uint32 numPolygons, size_t numBones) |
Protected Member Functions | |
SubMesh (Mesh *parentMesh, uint32 startVertex, uint32 startIndex, uint32 startPolygon, uint32 numVerts, uint32 numIndices, uint32 numPolygons, size_t numBones) | |
~SubMesh () | |
Protected Member Functions inherited from MCore::RefCounted | |
virtual void | Delete () |
Protected Attributes | |
AZStd::vector< size_t > | m_bones |
uint32 | m_startVertex |
uint32 | m_startIndex |
uint32 | m_startPolygon |
uint32 | m_numVertices |
uint32 | m_numIndices |
uint32 | m_numPolygons |
Mesh * | m_parentMesh |
The submesh class. A submesh is a part of a mesh, with vertex and polygon data having the same material properties. This allows us to easily render these submeshes on the graphics hardware on an efficient way. You can see the SubMesh class as a draw primitive. It specifies a range inside the Mesh class's vertex data and combines this with a material and a possible list of bones. The submesh itself do not store any vertex data. All vertex and polygon (indices) are stored in the Mesh class. You can access this parent mesh by the GetParentMesh() method. All vertex and index data of all submeshes are stored in big arrays which contain all data for all submeshes. This prevents small memory allocations and allows very efficient mesh updates. The submeshes contain information about what place in the arrays the data for this submesh is stored. So where the vertex data begins, and how many vertices are following after that. As well as where the index values start in the big array, and how many indices will follow for this submesh. Also there are some methods which gives you easy access to the vertex and index data stored inside the parent mesh, so that you do not have to deal with the offsets returned by GetStartIndex() and GetStartVertex().
|
protected |
Constructor.
parentMesh | A pointer to the Mesh to which this submesh belongs to. |
startVertex | The start vertex. |
startIndex | The start index. |
startPolygon | The start polygon number. |
numVerts | Number of vertices which submesh holds. |
numIndices | Number of indices which submesh holds. |
numPolygons | The number of polygons inside this submesh. |
numBones | The number of bones inside the submesh. |
|
protected |
Destructor.
uint32 EMotionFX::SubMesh::CalcNumTriangles | ( | ) | const |
Calculate how many triangles this submesh has. In case the mesh contains polygons of more than 3 vertices, triangulation will be taken into account.
Clone the submesh. Please note that this method does not actually add the clone to the new (specified) parent mesh.
newParentMesh | A pointer to the mesh that will get the cloned submesh added to it. |
|
static |
Creation method.
parentMesh | A pointer to the Mesh to which this submesh belongs to. |
startVertex | The start vertex. |
startIndex | The start index. |
startPolygon | The start polygon number. |
numVerts | Number of vertices which submesh holds. |
numIndices | Number of indices which submesh holds. |
numPolygons | The number of polygons inside this submesh. |
numBones | The number of bones inside the submesh. |
size_t EMotionFX::SubMesh::FindBoneIndex | ( | size_t | nodeNr | ) | const |
Find the bone number, which would be in range of [0..GetNumBones()-1] for a given node number. So you can use this to map a global node number into a local index inside the array of bones of this submesh. This is useful when giving each vertex a list of offsets into the bone matrix array inside your shader.
nodeNr | The global node number that is a bone. This must be in range with the number of nodes in the actor. |
|
inline |
Get the node index for a given bone.
index | The bone number, which must be in range of [0..GetNumBones()-1]. |
|
inline |
Get direct access to the bone values, by getting a pointer to the first bone index. Each integer in the array represents the node number that acts as bone on this submesh.
|
inline |
Get direct access to the bones array. Each integer in the array represents the node number that acts as bone on this submesh.
|
inline |
Get direct access to the bones array. Each integer in the array represents the node number that acts as bone on this submesh.
uint32* EMotionFX::SubMesh::GetIndices | ( | ) | const |
Get a pointer to the index data for this submesh. The number of indices to follow equals the value returned by GetNumIndices(). The index values are stored on an absolute way, so they point directly into the vertex data arrays of the Mesh where this submesh belongs to.
|
inline |
Get the number of bones used by this submesh.
uint32 EMotionFX::SubMesh::GetNumIndices | ( | ) | const |
Return the number of indices.
uint32 EMotionFX::SubMesh::GetNumPolygons | ( | ) | const |
Return the number of polygons.
uint32 EMotionFX::SubMesh::GetNumVertices | ( | ) | const |
Return the number of vertices.
Mesh* EMotionFX::SubMesh::GetParentMesh | ( | ) | const |
Return parent mesh.
uint8* EMotionFX::SubMesh::GetPolygonVertexCounts | ( | ) | const |
Get the pointer to the polygon vertex counts. The number of integers inside this buffer equals GetNumPolygons().
uint32 EMotionFX::SubMesh::GetStartIndex | ( | ) | const |
Get the start index. This is the offset in the index array of the parent mesh where the index data for this submesh starts. So it is not the start vertex or whatsoever. The index array of the parent mesh contains the index data of all its submeshes. So it is one big array, with all index data of the submeshes sticked after eachother. The value returned by this method just contains the offset in the array where the index data for this submesh starts. The number of index values to follow equals the value returned by GetNumIndices(). You can also request a pointer to the first index value of this submesh by using the method GetIndices(). Please keep in mind that the index values stored are absolute and not relative. This means that index values for every submesh point directly into the array of vertex data from the Mesh where this submesh is a part of.
uint32 EMotionFX::SubMesh::GetStartPolygon | ( | ) | const |
Get the start polygon. This represents the polygon index inside the parent mesh where the polygon vertex count data starts for this submesh.
uint32 EMotionFX::SubMesh::GetStartVertex | ( | ) | const |
Get the start vertex offset. This offset points into the vertex data arrays (positions, normals, uvs) of the parent mesh. The number of vertices to follow equals the amount returned by GetNumVertices().
void EMotionFX::SubMesh::ReinitBonesArray | ( | SkinningInfoVertexAttributeLayer * | skinLayer | ) |
Reinitialize the bones. Iterate over the influences from the given skin and make sure all bones used in there are inside the local bones array.
[in] | skinLayer | Pointer to the skinning attribute layer used to deform the mesh. |
void EMotionFX::SubMesh::RemapBone | ( | size_t | oldNodeNr, |
size_t | newNodeNr | ||
) |
Remap bone to a new bone. This will overwrite the given old bones with the new one.
oldNodeNr | The node number to be searched and replaced. |
newNodeNr | The node number with which the old bones will be replaced with. |
void EMotionFX::SubMesh::RemoveBone | ( | size_t | index | ) |
Remove the given bone from the bones list.
index | The index of the bone to be removed in range of [0..GetNumBones()-1]. |
void EMotionFX::SubMesh::SetBone | ( | size_t | index, |
size_t | nodeIndex | ||
) |
Set the index of a given bone.
index | The bone number, which must be in range of [0..GetNumBones()-1]. |
nodeIndex | The node index number that acts as bone on this submesh. |
void EMotionFX::SubMesh::SetNumBones | ( | size_t | numBones | ) |
Set the number of bones that is being used by this submesh.
numBones | The number of bones used by the submesh. |
void EMotionFX::SubMesh::SetNumIndices | ( | uint32 | numIndices | ) |
Set the number of indices used by this submesh.
numIndices | The number of indices used by this submesh. |
void EMotionFX::SubMesh::SetNumVertices | ( | uint32 | numVertices | ) |
Set the number of vertices used by this submesh.
numVertices | The number of vertices used by this submesh. |
void EMotionFX::SubMesh::SetParentMesh | ( | Mesh * | mesh | ) |
Set parent mesh.
mesh | A pointer to the parent mesh to which this submesh belongs to. |
void EMotionFX::SubMesh::SetStartIndex | ( | uint32 | indexOffset | ) |
Set the offset in the index array of the mesh where this submesh is part of.
indexOffset | The offset inside the index array of the mesh returned by GetParentMesh(). |
void EMotionFX::SubMesh::SetStartPolygon | ( | uint32 | polygonNumber | ) |
Set the start polygon number.
polygonNumber | The polygon number inside the polygon vertex count array of the mesh returned by GetParentMesh(). |
void EMotionFX::SubMesh::SetStartVertex | ( | uint32 | vertexOffset | ) |
Set the offset in the vertex array of the mesh where this submesh is part of.
vertexOffset | The offset inside the index array of the mesh returned by GetParentMesh(). |
|
protected |
The collection of bones. These are stored as node numbers that point into the actor.
|
protected |
The number of indices in this submesh.
|
protected |
The number of polygons in this submesh.
|
protected |
The number of vertices in this submesh.
|
protected |
The parent mesh.
|
protected |
The start index number in the index array of the parent mesh.
|
protected |
The start polygon number in the polygon vertex count array of the parent mesh.
|
protected |
The start vertex number in the vertex data arrays of the parent mesh.