TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Object3DAnimation Class Reference

Object3D animation class. More...

#include <tdme/engine/subsystems/rendering/Object3DAnimation.h>

Collaboration diagram for Object3DAnimation:
Collaboration graph

Classes

struct  FlattenedNode
 
struct  NodeSkinningJoint
 

Public Member Functions

void setAnimation (const string &id, float speed=1.0f)
 Sets up a base animation to play. More...
 
void setAnimationSpeed (float speed)
 Set up animation speed. More...
 
void addOverlayAnimation (const string &id)
 Overlays a animation above the base animation. More...
 
void removeOverlayAnimation (const string &id)
 Removes a overlay animation. More...
 
void removeOverlayAnimationsFinished ()
 Removes all finished overlay animations. More...
 
void removeOverlayAnimations ()
 Removes all overlay animations. More...
 
const string getAnimation ()
 
float getAnimationTime ()
 Returns current base animation time. More...
 
bool hasOverlayAnimation (const string &id)
 Returns if there is currently running a overlay animation with given id. More...
 
float getOverlayAnimationTime (const string &id)
 Returns current overlay animation time. More...
 
const Matrix4x4 getNodeTransformationsMatrix (const string &id)
 Returns transformation matrix for given node. More...
 
void setNodeTransformationsMatrix (const string &id, const Matrix4x4 &matrix)
 Set transformation matrix for given node. More...
 
void unsetNodeTransformationsMatrix (const string &id)
 Unset transformation matrix for given node. More...
 
void computeTransformations (int contextIdx, const Matrix4x4 &objectTransformationsMatrix, int64_t lastFrameAtTime, int64_t currentFrameAtTime)
 Pre render step, computes transformations. More...
 

Protected Member Functions

 Object3DAnimation (Model *model, Engine::AnimationProcessingTarget animationProcessingTarget)
 Public constructor. More...
 
virtual ~Object3DAnimation ()
 Destructor. More...
 
void createTransformationsMatrices (map< string, Matrix4x4 * > &matrices, vector< FlattenedNode > &nodeList, const map< string, Node * > &nodes, Matrix4x4 *parentTransformationsMatrix=nullptr, AnimationState *animationState=nullptr)
 Creates all nodes transformation matrices. More...
 
void updateNodeList (vector< FlattenedNode > &nodeList, int &nodeIdx, const map< string, Node * > &nodes, AnimationState *animationState=nullptr)
 Update node list. More...
 
void updateNodeList (vector< FlattenedNode > &nodeList)
 Update node list. More...
 
void updateNodeLists ()
 Update node lists. More...
 
void computeTransformationsMatrices (vector< FlattenedNode > &nodeList, const Matrix4x4 parentTransformationsMatrix, AnimationState *animationState)
 Calculates all nodes transformation matrices. More...
 
void computeTransformations (vector< FlattenedNode > &nodeList, const Matrix4x4 &instanceTransformationsMatrix, AnimationState &baseAnimation, int contextIdx, int64_t lastFrameAtTime, int64_t currentFrameAtTime)
 Compute transformations for given animation state into given transformations matrices. More...
 
void updateSkinningTransformationsMatrices ()
 Update skinning transformations matrices. More...
 
map< string, Matrix4x4 * > * getSkinningNodesMatrices (Node *node)
 Get skinning nodes matrices. More...
 

Protected Attributes

Modelmodel
 
Engine::AnimationProcessingTarget animationProcessingTarget
 
map< string, Matrix4x4 * > overriddenTransformationsMatrices
 
vector< map< string, Matrix4x4 * > > transformationsMatrices
 
bool hasSkinning
 
bool hasAnimations
 
vector< map< string, Matrix4x4 * > > skinningNodesMatrices
 
vector< Node * > skinningNodes
 
vector< vector< NodeSkinningJoint > > skinningNodesNodeSkinningJoints
 
vector< AnimationStatebaseAnimations
 
int baseAnimationIdx
 
map< string, AnimationState * > overlayAnimationsById
 
map< string, AnimationState * > overlayAnimationsByJointId
 
vector< vector< FlattenedNode > > nodeLists
 

Private Member Functions

int32_t determineSkinnedNodeCount (const map< string, Node * > &nodes)
 Determine skinned node count. More...
 
int32_t determineSkinnedNodeCount (const map< string, Node * > &nodes, int32_t count)
 Determine skinned node count. More...
 
int32_t determineSkinnedNodes (const map< string, Node * > &nodes, vector< Node * > &skinningNodes, int32_t idx)
 Determine skinned nodes. More...
 

Friends

class tdme::engine::subsystems::rendering::ModelUtilitiesInternal
 
class tdme::engine::subsystems::rendering::Object3DBase
 
class tdme::engine::subsystems::rendering::Object3DNode
 
class tdme::engine::subsystems::rendering::Object3DInternal
 

Detailed Description

Object3D animation class.

Author
Andreas Drewke

Definition at line 33 of file Object3DAnimation.h.

Constructor & Destructor Documentation

◆ Object3DAnimation()

Object3DAnimation ( Model model,
Engine::AnimationProcessingTarget  animationProcessingTarget 
)
protected

Public constructor.

Parameters
modelmodel
animationProcessingTargetanimation processing target

Definition at line 41 of file Object3DAnimation.cpp.

◆ ~Object3DAnimation()

~Object3DAnimation ( )
protectedvirtual

Destructor.

Definition at line 95 of file Object3DAnimation.cpp.

Member Function Documentation

◆ addOverlayAnimation()

void addOverlayAnimation ( const string &  id)

Overlays a animation above the base animation.

Parameters
idid

Definition at line 157 of file Object3DAnimation.cpp.

◆ computeTransformations() [1/2]

void computeTransformations ( int  contextIdx,
const Matrix4x4 objectTransformationsMatrix,
int64_t  lastFrameAtTime,
int64_t  currentFrameAtTime 
)

Pre render step, computes transformations.

Parameters
contextIdxcontext index
objectTransformationsMatrixobject transformations matrix
lastFrameAtTimetime of last animation computation
currentFrameAtTimetime of current animation computation

Definition at line 464 of file Object3DAnimation.cpp.

◆ computeTransformations() [2/2]

void computeTransformations ( vector< FlattenedNode > &  nodeList,
const Matrix4x4 instanceTransformationsMatrix,
AnimationState baseAnimation,
int  contextIdx,
int64_t  lastFrameAtTime,
int64_t  currentFrameAtTime 
)
protected

Compute transformations for given animation state into given transformations matrices.

Parameters
nodeListflattened node list
instanceTransformationsMatrixobject transformations matrix
baseAnimationbase animation
contextIdxcontext index
lastFrameAtTimetime of last animation computation
currentFrameAtTimetime of current animation computation

Definition at line 424 of file Object3DAnimation.cpp.

◆ computeTransformationsMatrices()

void computeTransformationsMatrices ( vector< FlattenedNode > &  nodeList,
const Matrix4x4  parentTransformationsMatrix,
AnimationState animationState 
)
protected

Calculates all nodes transformation matrices.

Parameters
nodeListflattened node list
parentTransformationsMatrixparent transformations matrix
animationStateanimation state

Definition at line 356 of file Object3DAnimation.cpp.

◆ createTransformationsMatrices()

void createTransformationsMatrices ( map< string, Matrix4x4 * > &  matrices,
vector< FlattenedNode > &  nodeList,
const map< string, Node * > &  nodes,
Matrix4x4 parentTransformationsMatrix = nullptr,
AnimationState animationState = nullptr 
)
protected

Creates all nodes transformation matrices.

Parameters
matricesmatrices
nodeListflattened node list
nodesnodes
parentTransformationsMatrixparent transformations matrix
animationStateanimation state

Definition at line 291 of file Object3DAnimation.cpp.

◆ determineSkinnedNodeCount() [1/2]

int32_t determineSkinnedNodeCount ( const map< string, Node * > &  nodes)
private

Determine skinned node count.

Parameters
nodesnodes

Definition at line 508 of file Object3DAnimation.cpp.

◆ determineSkinnedNodeCount() [2/2]

int32_t determineSkinnedNodeCount ( const map< string, Node * > &  nodes,
int32_t  count 
)
private

Determine skinned node count.

Parameters
nodesnodes
countcurrent count

Definition at line 513 of file Object3DAnimation.cpp.

◆ determineSkinnedNodes()

int32_t determineSkinnedNodes ( const map< string, Node * > &  nodes,
vector< Node * > &  skinningNodes,
int32_t  idx 
)
private

Determine skinned nodes.

Parameters
nodesnodes
skinningNodesskinning nodes
idxidx

Definition at line 530 of file Object3DAnimation.cpp.

◆ getAnimation()

const string getAnimation ( )
Returns
active animation setup id

Definition at line 228 of file Object3DAnimation.cpp.

◆ getAnimationTime()

float getAnimationTime ( )

Returns current base animation time.

Returns
0.0 <= time <= 1.0

Definition at line 233 of file Object3DAnimation.cpp.

◆ getNodeTransformationsMatrix()

const Matrix4x4 getNodeTransformationsMatrix ( const string &  id)

Returns transformation matrix for given node.

Parameters
idnode id
Returns
transformation matrix or identity matrix if not found

Definition at line 253 of file Object3DAnimation.cpp.

◆ getOverlayAnimationTime()

float getOverlayAnimationTime ( const string &  id)

Returns current overlay animation time.

Parameters
idid
Returns
0.0 <= time <= 1.0

Definition at line 243 of file Object3DAnimation.cpp.

◆ getSkinningNodesMatrices()

map< string, Matrix4x4 * > * getSkinningNodesMatrices ( Node node)
protected

Get skinning nodes matrices.

Parameters
nodenode
Returns
matrices

Definition at line 548 of file Object3DAnimation.cpp.

◆ hasOverlayAnimation()

bool hasOverlayAnimation ( const string &  id)

Returns if there is currently running a overlay animation with given id.

Parameters
idid
Returns
animation is running

Definition at line 238 of file Object3DAnimation.cpp.

◆ removeOverlayAnimation()

void removeOverlayAnimation ( const string &  id)

Removes a overlay animation.

Parameters
idid

Definition at line 180 of file Object3DAnimation.cpp.

◆ removeOverlayAnimations()

void removeOverlayAnimations ( )

Removes all overlay animations.

Definition at line 216 of file Object3DAnimation.cpp.

◆ removeOverlayAnimationsFinished()

void removeOverlayAnimationsFinished ( )

Removes all finished overlay animations.

Definition at line 197 of file Object3DAnimation.cpp.

◆ setAnimation()

void setAnimation ( const string &  id,
float  speed = 1.0f 
)

Sets up a base animation to play.

Parameters
idid
speedspeed whereas 1.0 is default speed

Definition at line 111 of file Object3DAnimation.cpp.

◆ setAnimationSpeed()

void setAnimationSpeed ( float  speed)

Set up animation speed.

Parameters
speedspeed whereas 1.0 is default speed

Definition at line 152 of file Object3DAnimation.cpp.

◆ setNodeTransformationsMatrix()

void setNodeTransformationsMatrix ( const string &  id,
const Matrix4x4 matrix 
)

Set transformation matrix for given node.

Parameters
idnode id
matrixtransformation matrix

Definition at line 268 of file Object3DAnimation.cpp.

◆ unsetNodeTransformationsMatrix()

void unsetNodeTransformationsMatrix ( const string &  id)

Unset transformation matrix for given node.

Parameters
idnode id

Definition at line 280 of file Object3DAnimation.cpp.

◆ updateNodeList() [1/2]

void updateNodeList ( vector< FlattenedNode > &  nodeList)
inlineprotected

Update node list.

Parameters
nodeListflattened node list

Definition at line 127 of file Object3DAnimation.h.

◆ updateNodeList() [2/2]

void updateNodeList ( vector< FlattenedNode > &  nodeList,
int &  nodeIdx,
const map< string, Node * > &  nodes,
AnimationState animationState = nullptr 
)
protected

Update node list.

Parameters
nodeListflattened node list
nodeIdxnode index
nodesnodes
animationStateanimation state

Definition at line 328 of file Object3DAnimation.cpp.

◆ updateNodeLists()

void updateNodeLists ( )
inlineprotected

Update node lists.

Definition at line 135 of file Object3DAnimation.h.

◆ updateSkinningTransformationsMatrices()

void updateSkinningTransformationsMatrices ( )
inlineprotected

Update skinning transformations matrices.

Definition at line 417 of file Object3DAnimation.cpp.

Friends And Related Function Documentation

◆ tdme::engine::subsystems::rendering::ModelUtilitiesInternal

Definition at line 35 of file Object3DAnimation.h.

◆ tdme::engine::subsystems::rendering::Object3DBase

Definition at line 36 of file Object3DAnimation.h.

◆ tdme::engine::subsystems::rendering::Object3DInternal

Definition at line 38 of file Object3DAnimation.h.

◆ tdme::engine::subsystems::rendering::Object3DNode

Definition at line 37 of file Object3DAnimation.h.

Member Data Documentation

◆ animationProcessingTarget

Engine::AnimationProcessingTarget animationProcessingTarget
protected

Definition at line 78 of file Object3DAnimation.h.

◆ baseAnimationIdx

int baseAnimationIdx
protected

Definition at line 87 of file Object3DAnimation.h.

◆ baseAnimations

vector<AnimationState> baseAnimations
protected

Definition at line 86 of file Object3DAnimation.h.

◆ hasAnimations

bool hasAnimations
protected

Definition at line 82 of file Object3DAnimation.h.

◆ hasSkinning

bool hasSkinning
protected

Definition at line 81 of file Object3DAnimation.h.

◆ model

Model* model
protected

Definition at line 77 of file Object3DAnimation.h.

◆ nodeLists

vector<vector<FlattenedNode> > nodeLists
protected

Definition at line 90 of file Object3DAnimation.h.

◆ overlayAnimationsById

map<string, AnimationState*> overlayAnimationsById
protected

Definition at line 88 of file Object3DAnimation.h.

◆ overlayAnimationsByJointId

map<string, AnimationState*> overlayAnimationsByJointId
protected

Definition at line 89 of file Object3DAnimation.h.

◆ overriddenTransformationsMatrices

map<string, Matrix4x4*> overriddenTransformationsMatrices
protected

Definition at line 79 of file Object3DAnimation.h.

◆ skinningNodes

vector<Node*> skinningNodes
protected

Definition at line 84 of file Object3DAnimation.h.

◆ skinningNodesMatrices

vector<map<string, Matrix4x4*> > skinningNodesMatrices
protected

Definition at line 83 of file Object3DAnimation.h.

◆ skinningNodesNodeSkinningJoints

vector<vector<NodeSkinningJoint> > skinningNodesNodeSkinningJoints
protected

Definition at line 85 of file Object3DAnimation.h.

◆ transformationsMatrices

vector<map<string, Matrix4x4*> > transformationsMatrices
protected

Definition at line 80 of file Object3DAnimation.h.


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