4 #include <unordered_map>
17 using std::unordered_map;
150 void updateNodeList(vector<FlattenedNode>& nodeList,
int& nodeIdx,
const unordered_map<string, Node*>& nodes,
AnimationState* animationState =
nullptr);
185 void computeAnimation(vector<FlattenedNode>& nodeList,
const Matrix4x4& instanceTransformMatrix,
AnimationState& baseAnimation,
int contextIdx, int64_t lastFrameAtTime, int64_t currentFrameAtTime);
206 void setAnimation(
const string&
id,
float speed = 1.0f);
288 void computeAnimation(
int contextIdx,
const Matrix4x4& objectTransformMatrix, int64_t lastFrameAtTime, int64_t currentFrameAtTime);
AnimationProcessingTarget
Representation of a 3D model.
unordered_map< string, Node * > & getSubNodes()
Returns object's sub nodes.
void setAnimation(const string &id, float speed=1.0f)
Sets up a base animation to play.
vector< unordered_map< string, Matrix4x4 * > > transformMatrices
void computeNodesTransformMatrices(vector< FlattenedNode > &nodeList, const Matrix4x4 parentTransformMatrix, AnimationState *animationState)
Comutes all nodes transform matrices.
virtual ~ObjectAnimation()
Destructor.
const Matrix4x4 getNodeTransformMatrix(const string &id)
Returns transform matrix for given node.
void setNodeTransformMatrix(const string &id, const Matrix4x4 &matrix)
Set transform matrix for given node.
void computeAnimation(vector< FlattenedNode > &nodeList, const Matrix4x4 &instanceTransformMatrix, AnimationState &baseAnimation, int contextIdx, int64_t lastFrameAtTime, int64_t currentFrameAtTime)
Compute animation for given animation state into nodes transform matrices given by flattened node lis...
vector< AnimationState > baseAnimations
void addOverlayAnimation(const string &id)
Overlays a animation above the base animation.
unordered_map< string, AnimationState * > overlayAnimationsById
Engine::AnimationProcessingTarget animationProcessingTarget
float getOverlayAnimationTime(const string &id)
Returns current overlay animation time.
void createNodesTransformMatrices(unordered_map< string, Matrix4x4 * > &matrices, vector< FlattenedNode > &nodeList, const unordered_map< string, Node * > &nodes, Matrix4x4 *parentTransformMatrix=nullptr, AnimationState *animationState=nullptr)
Creates all nodes transform matrices.
void removeOverlayAnimation(const string &id)
Removes a overlay animation.
bool hasOverlayAnimation(const string &id)
Returns if there is currently running a overlay animation with given id.
unordered_map< string, Matrix4x4 * > overriddenTransformMatrices
void updateSkinningJoints()
Update skinning transform matrices.
vector< vector< NodeSkinningJoint > > skinningNodesNodeSkinningJoints
void updateNodeList(vector< FlattenedNode > &nodeList)
Update node list.
const string getAnimation()
unordered_map< string, AnimationState * > overlayAnimationsByJointId
unordered_map< string, Matrix4x4 * > * getSkinningNodesTransformMatrices(Node *node)
Get skinning nodes transform matrices.
ObjectAnimation(Model *model, Engine::AnimationProcessingTarget animationProcessingTarget)
Public constructor.
int32_t determineSkinnedNodeCount(const unordered_map< string, Node * > &nodes)
Determine skinned node count.
void setAnimationSpeed(float speed)
Set up animation speed.
vector< unordered_map< string, Matrix4x4 * > > skinningNodesMatrices
void removeOverlayAnimations()
Removes all overlay animations.
void updateNodeList(vector< FlattenedNode > &nodeList, int &nodeIdx, const unordered_map< string, Node * > &nodes, AnimationState *animationState=nullptr)
Update node list.
vector< Node * > skinningNodes
void unsetNodeTransformMatrix(const string &id)
Unset transform matrix for given node.
float getAnimationTime()
Returns current base animation time.
vector< vector< FlattenedNode > > nodeLists
void updateNodeLists()
Update node lists.
void removeFinishedOverlayAnimations()
Removes all finished overlay animations.
int32_t determineSkinnedNodes(const unordered_map< string, Node * > &nodes, vector< Node * > &skinningNodes, int32_t idx)
Determine skinned nodes.
Object node specifically for rendering.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Matrix4x4 * transformMatrix
const Matrix4x4 * parentTransformMatrix
Matrix4x4 * nodeOverriddenTransformMatrix
AnimationState * nodeAnimationState
FlattenedNode(const string &nodeId, const Matrix4x4 *nodeTransformMatrix, Matrix4x4 *nodeOverriddenTransformMatrix, const Animation *nodeAnimation, AnimationState *nodeAnimationState, const Matrix4x4 *parentTransformMatrix, Matrix4x4 *transformMatrix)
const Matrix4x4 * nodeTransformMatrix
const Animation * nodeAnimation
Matrix4x4 * skinningNodeTransformMatrix
NodeSkinningJoint(const Joint *joint, const Matrix4x4 *nodeTransformMatrix, Matrix4x4 *skinningNodeTransformMatrix)
const Matrix4x4 * nodeTransformMatrix
#define FORBID_CLASS_COPY(CLASS)