Open 3D Engine EMotionFX Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
EMotionFX::SkinningInfoVertexAttributeLayer Class Reference

#include <SkinningInfoVertexAttributeLayer.h>

Inherits EMotionFX::VertexAttributeLayer.

Public Types

enum  { TYPE_ID = 0x00000003 }
 

Public Member Functions

uint32 GetType () const override
 
const char * GetTypeString () const override
 
void AddInfluence (size_t attributeNr, size_t nodeNr, float weight, size_t boneNr=0)
 
void RemoveInfluence (size_t attributeNr, size_t influenceNr)
 
MCORE_INLINE size_t GetNumInfluences (size_t attributeNr)
 
MCORE_INLINE SkinInfluenceGetInfluence (size_t attributeNr, size_t influenceNr)
 
MCORE_INLINE MCore::Array2D< SkinInfluence > & GetArray2D ()
 
AZStd::set< uint16 > CalcLocalJointIndices (AZ::u32 numOrgVertices)
 
VertexAttributeLayerClone () override
 
void SwapAttributes (uint32 attribA, uint32 attribB) override
 
void RemapInfluences (size_t oldNodeNr, size_t newNodeNr)
 
void RemoveAttributes (uint32 startAttributeNr, uint32 endAttributeNr) override
 
void RemoveAllInfluencesForNode (size_t nodeNr)
 
void CollectInfluencedNodes (AZStd::vector< uint32 > &influencedNodes, bool clearInfluencedNodesArray=true)
 
void OptimizeMemoryUsage ()
 
void OptimizeInfluences (float tolerance, size_t maxWeights)
 
void ResetToOriginalData () override
 
void CollapseInfluences (size_t attributeNr)
 
- Public Member Functions inherited from EMotionFX::VertexAttributeLayer
virtual uint32 GetType () const =0
 
virtual const char * GetTypeString () const =0
 
virtual VertexAttributeLayerClone ()=0
 
virtual void * GetData ()
 
virtual void * GetOriginalData ()
 
MCORE_INLINE uint32 GetNumAttributes () const
 
MCORE_INLINE bool GetKeepOriginals () const
 
virtual void ResetToOriginalData ()=0
 
virtual void SwapAttributes (uint32 attribA, uint32 attribB)=0
 
virtual void RemoveAttributes (uint32 startAttributeNr, uint32 endAttributeNr)=0
 
virtual bool GetIsAbstractDataClass () const
 
virtual void Scale (float scaleFactor)
 
void SetName (const char *name)
 
const char * GetName () const
 
const AZStd::string & GetNameString () const
 
uint32 GetNameID () const
 
- Public Member Functions inherited from EMotionFX::BaseObject
 BaseObject ()
 
virtual ~BaseObject ()
 
- Public Member Functions inherited from MCore::MemoryObject
 MemoryObject ()
 
virtual ~MemoryObject ()
 
void IncreaseReferenceCount ()
 
void DecreaseReferenceCount ()
 
void Destroy ()
 
uint32 GetReferenceCount () const
 

Static Public Member Functions

static SkinningInfoVertexAttributeLayerCreate (uint32 numAttributes, bool allocData=true)
 

Additional Inherited Members

- Protected Member Functions inherited from EMotionFX::VertexAttributeLayer
 VertexAttributeLayer (uint32 numAttributes, bool keepOriginals=false)
 
virtual ~VertexAttributeLayer ()
 
- Protected Member Functions inherited from EMotionFX::BaseObject
void Delete () override
 
virtual void Delete ()
 
- Protected Attributes inherited from EMotionFX::VertexAttributeLayer
uint32 m_numAttributes
 
uint32 m_nameId
 
bool m_keepOriginals
 

Detailed Description

The vertex attribute layer that contains UV texture coordinates. This layer represents an entire UV mapping channel.

Member Function Documentation

◆ AddInfluence()

void EMotionFX::SkinningInfoVertexAttributeLayer::AddInfluence ( size_t  attributeNr,
size_t  nodeNr,
float  weight,
size_t  boneNr = 0 
)

Add a given influence (using a bone and a weight).

Parameters
attributeNrThe attribute/vertex number.
nodeNrThe node in the actor that will be the bone.
weightThe weight to use in the influence.
boneNrThe bone number, used for optimizations inside the softskin deformer.

◆ CalcLocalJointIndices()

AZStd::set< uint16 > EMotionFX::SkinningInfoVertexAttributeLayer::CalcLocalJointIndices ( AZ::u32  numOrgVertices)

Collect all unique joint indices used by the skin.

Parameters
numOrgVerticesThe number of original vertices in the mesh.
Returns
Vector of unique joint indices used by the skinning info layer.

◆ Clone()

VertexAttributeLayer * EMotionFX::SkinningInfoVertexAttributeLayer::Clone ( )
overridevirtual

Clone the vertex attribute layer.

Returns
A clone of this layer.

Implements EMotionFX::VertexAttributeLayer.

◆ CollapseInfluences()

void EMotionFX::SkinningInfoVertexAttributeLayer::CollapseInfluences ( size_t  attributeNr)

Collapse influences that use the same bones to just one influence. If all influences of the attribute are linked to the same bone, it will collapse these into just one influence with a weight of 1, which will have the same visual results. The advantage of this is that CPU skinning will be much faster for those vertices, as just one influence has to be processed. Please note that this function only works if all influences share the same bone. It does not perform any optimizations when there are say 2 influences using bone A and another two influences using bone B. It only optimizes things when all influences are mapped to bone A.

Parameters
attributeNrThe attribute number (original vertex number) to apply this to.

◆ CollectInfluencedNodes()

void EMotionFX::SkinningInfoVertexAttributeLayer::CollectInfluencedNodes ( AZStd::vector< uint32 > &  influencedNodes,
bool  clearInfluencedNodesArray = true 
)

Collect all nodes to which the skinning info refers to.

Parameters
influencedNodesThe array to which the node numbers which are influenced by the skinning info will be added.
clearInfluencedNodesArrayWhen set to true the given influenced nodes array will be cleared before filling it.

◆ Create()

static SkinningInfoVertexAttributeLayer * EMotionFX::SkinningInfoVertexAttributeLayer::Create ( uint32  numAttributes,
bool  allocData = true 
)
static

The create method.

Parameters
numAttributesThe number of attributes to store inside this layer.
allocDataWhen set to true, it will already allocate space for the amount of attributes.

◆ GetArray2D()

MCORE_INLINE MCore::Array2D< SkinInfluence > & EMotionFX::SkinningInfoVertexAttributeLayer::GetArray2D ( )
inline

Get direct access to the jagged 2D array that contains the skinning influence data. This can be used in the importers for fast loading and not having to add influence per influence.

Returns
A reference to the 2D array containing all the skinning influences.

◆ GetInfluence()

MCORE_INLINE SkinInfluence * EMotionFX::SkinningInfoVertexAttributeLayer::GetInfluence ( size_t  attributeNr,
size_t  influenceNr 
)
inline

Get a given influence.

Parameters
attributeNrThe attribute/vertex number.
influenceNrThe influence number, which must be in range of [0..GetNumInfluences()]
Returns
The given influence.

◆ GetNumInfluences()

MCORE_INLINE size_t EMotionFX::SkinningInfoVertexAttributeLayer::GetNumInfluences ( size_t  attributeNr)
inline

Get the number of influences.

Parameters
attributeNrThe attribute/vertex number.
Returns
The number of influences.

◆ GetType()

uint32 EMotionFX::SkinningInfoVertexAttributeLayer::GetType ( ) const
overridevirtual

Get the unique layer type. This identifies what type of attributes are stored internally. An example could be the type ID of an UV attribute layer, or a layer with colors or one which identifies a layer that contains softskinning information.

Returns
The unique type ID, which identifies what type of data is stored inside this layer. Each class inherited from the VertexAttributeLayer class requires a unique type ID.

Implements EMotionFX::VertexAttributeLayer.

◆ GetTypeString()

const char * EMotionFX::SkinningInfoVertexAttributeLayer::GetTypeString ( ) const
overridevirtual

Get the description of the vertex attributes or layer. You most likely want this to be the class name.

Returns
A pointer to the string containing the name or description of the type of vertex attributes of this layer.

Implements EMotionFX::VertexAttributeLayer.

◆ OptimizeInfluences()

void EMotionFX::SkinningInfoVertexAttributeLayer::OptimizeInfluences ( float  tolerance,
size_t  maxWeights 
)

Optimize the skinning influences & its memory usage. This function assures that the output weights sum up to a value of 1.

Parameters
toleranceThe minimum weight value of an influence, smaller ones will be removed.
maxWeightsThe maximum number of influences per vertex you want to have in the output.

◆ OptimizeMemoryUsage()

void EMotionFX::SkinningInfoVertexAttributeLayer::OptimizeMemoryUsage ( )

Optimize the skinning informations memory usage. This shrinks the skinning influence data as much as possible. This is automatically being called by the importer.

◆ RemapInfluences()

void EMotionFX::SkinningInfoVertexAttributeLayer::RemapInfluences ( size_t  oldNodeNr,
size_t  newNodeNr 
)

Remap all influences from an old bone to a new bone. This will overwrite all influences linked to the old node and replace the link to the new node.

Parameters
oldNodeNrThe node to search and replace all influence links.
newNodeNrThe node with which all found influence links will be replaced with.

◆ RemoveAllInfluencesForNode()

void EMotionFX::SkinningInfoVertexAttributeLayer::RemoveAllInfluencesForNode ( size_t  nodeNr)

Remove all influences which are linked to the given node and optimize the memory usage of the skinning info afterwards.

Parameters
nodeNrThe node in the actor. All influences linked to this node will be removed from the skinning info.

◆ RemoveAttributes()

void EMotionFX::SkinningInfoVertexAttributeLayer::RemoveAttributes ( uint32  startAttributeNr,
uint32  endAttributeNr 
)
overridevirtual

Remove a range of attributes.

Parameters
startAttributeNrThe start attribute number.
endAttributeNrThe end attribute number, which will also be removed.

Implements EMotionFX::VertexAttributeLayer.

◆ RemoveInfluence()

void EMotionFX::SkinningInfoVertexAttributeLayer::RemoveInfluence ( size_t  attributeNr,
size_t  influenceNr 
)

Remove the given influence. The influences won't be deleted from memory. To get rid of the not used memory call OptimizeMemoryUsage().

Parameters
attributeNrThe attribute/vertex number.
influenceNrThe influence number

◆ ResetToOriginalData()

void EMotionFX::SkinningInfoVertexAttributeLayer::ResetToOriginalData ( )
overridevirtual

Reset the layer data to it's original data. This is used to restore for example skinned data back into the data as it is in the base pose. The mesh deformers will use this as a starting point then.

Implements EMotionFX::VertexAttributeLayer.

◆ SwapAttributes()

void EMotionFX::SkinningInfoVertexAttributeLayer::SwapAttributes ( uint32  attribA,
uint32  attribB 
)
overridevirtual

Swap the data for two attributes. You specify two attribute numbers, the data for them should be swapped. This is used for our mesh system and will be called by Mesh::SwapVertex as well.

Parameters
attribAThe first attribute number.
attribBThe second attribute number.

Implements EMotionFX::VertexAttributeLayer.


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