SLProject 4.0.000
SLAnimation Class Reference

SLAnimation is the base container for all animation data. More...

#include <SLAnimation.h>

Public Member Functions

 SLAnimation (const SLstring &name, SLfloat duration)
 
 ~SLAnimation ()
 
SLfloat nextKeyframeTime (SLfloat time)
 
SLfloat prevKeyframeTime (SLfloat time)
 
SLbool affectsNode (SLNode *node)
 
void apply (SLfloat time, SLfloat weight=1.0f, SLfloat scale=1.0f)
 
void applyToNode (SLNode *node, SLfloat time, SLfloat weight=1.0f, SLfloat scale=1.0f)
 
void apply (SLAnimSkeleton *skel, SLfloat time, SLfloat weight=1.0f, SLfloat scale=1.0f)
 
void resetNodes ()
 
void drawNodeVisuals (SLSceneView *sv)
 
SLNodeAnimTrackcreateNodeAnimTrack ()
 
SLNodeAnimTrackcreateNodeAnimTrack (SLuint trackID)
 
SLNodeAnimTrackcreateNodeAnimTrackForTranslation (SLNode *target, const SLVec3f &endPos)
 
SLNodeAnimTrackcreateNodeAnimTrackForRotation (SLNode *target, SLfloat angleDeg1, const SLVec3f &axis)
 
SLNodeAnimTrackcreateNodeAnimTrackForRotation2 (SLNode *target, SLfloat angleDeg0, SLfloat angleDeg1, const SLVec3f &axis)
 
SLNodeAnimTrackcreateNodeAnimTrackForRotation3 (SLNode *target, SLfloat angleDeg0, SLfloat angleDeg1, SLfloat angleDeg2, const SLVec3f &axis)
 
SLNodeAnimTrackcreateNodeAnimTrackForRotation4 (SLNode *target, SLfloat angleDeg0, SLfloat angleDeg1, SLfloat angleDeg2, SLfloat angleDeg3, const SLVec3f &axis)
 
SLNodeAnimTrackcreateNodeAnimTrackForRotation360 (SLNode *target, const SLVec3f &axis)
 
SLNodeAnimTrackcreateNodeAnimTrackForScaling (SLNode *target, const SLVec3f &endScale)
 
SLNodeAnimTrackcreateNodeAnimTrackForEllipse (SLNode *target, SLfloat radiusA, SLAxis axisA, SLfloat radiusB, SLAxis axisB)
 
const SLstringname ()
 
SLfloat lengthSec () const
 
void name (const SLstring &name)
 
void lengthSec (SLfloat lengthSec)
 

Protected Attributes

SLstring _name
 name of the animation More...
 
SLfloat _lengthSec
 duration of the animation in seconds More...
 
SLMNodeAnimTrack _nodeAnimTracks
 map of all the node tracks in this animation More...
 

Detailed Description

SLAnimation is the base container for all animation data.

SLAnimation is a container for multiple SLAnimTrack that build an animation. E.g. a walk animation would consist of all the SLAnimTrack that make a SLAnimSkeleton walk. It also knows the length of the animation.

An animation for a SLAnimSkeleton with n joints must consist of 1 to n SLNodeAnimTrack. The SLAnimation class keeps a map with index -> SLNodeAnimTrack pairs, the index for the SLNodeAnimTrack must match the index of a bone in the target SLAnimSkeleton. This method allows us to animate multiple identical, or similar SLSkeletons with the same SLAnimation.

Constructor & Destructor Documentation

◆ SLAnimation()

SLAnimation::SLAnimation ( const SLstring name,
SLfloat  duration 
)

Constructor

◆ ~SLAnimation()

SLAnimation::~SLAnimation ( )

Destructor

Member Function Documentation

◆ affectsNode()

SLbool SLAnimation::affectsNode ( SLNode node)

Returns true if node is the animationTarget of any of the SLNodeAnimationTracks in this animation.

◆ apply() [1/2]

void SLAnimation::apply ( SLAnimSkeleton skel,
SLfloat  time,
SLfloat  weight = 1.0f,
SLfloat  scale = 1.0f 
)

Applies all the tracks to their respective joints in the passed in skeleton.

◆ apply() [2/2]

void SLAnimation::apply ( SLfloat  time,
SLfloat  weight = 1.0f,
SLfloat  scale = 1.0f 
)

Applies all animation tracks for the passed in timestamp, weight and scale.

◆ applyToNode()

void SLAnimation::applyToNode ( SLNode node,
SLfloat  time,
SLfloat  weight = 1.0f,
SLfloat  scale = 1.0f 
)

Applies all node tracks of this animation on a single node

◆ createNodeAnimTrack() [1/2]

SLNodeAnimTrack * SLAnimation::createNodeAnimTrack ( )

Creates a new SLNodeAnimationTrack with the next free handle.

◆ createNodeAnimTrack() [2/2]

SLNodeAnimTrack * SLAnimation::createNodeAnimTrack ( SLuint  trackID)

Creates a new SLNodeAnimationTrack with the passed in track id.

◆ createNodeAnimTrackForEllipse()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForEllipse ( SLNode target,
SLfloat  radiusA,
SLAxis  axisA,
SLfloat  radiusB,
SLAxis  axisB 
)

Specialized SLNodeAnimationTrack creator for an elliptic node animation

◆ createNodeAnimTrackForRotation()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForRotation ( SLNode target,
SLfloat  angleDeg,
const SLVec3f axis 
)

Specialized SLNodeAnimationTrack creator for a two keyframe rotation animation from 0° to angleDeg.

◆ createNodeAnimTrackForRotation2()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForRotation2 ( SLNode target,
SLfloat  angleDeg0,
SLfloat  angleDeg1,
const SLVec3f axis 
)

Specialized SLNodeAnimationTrack creator for 2 keyframes at angleDeg0 and angleDeg1.

◆ createNodeAnimTrackForRotation3()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForRotation3 ( SLNode target,
SLfloat  angleDeg0,
SLfloat  angleDeg1,
SLfloat  angleDeg2,
const SLVec3f axis 
)

Specialized SLNodeAnimationTrack creator for 3 keyframes at angleDeg0, angleDeg1 and angleDeg2.

◆ createNodeAnimTrackForRotation360()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForRotation360 ( SLNode target,
const SLVec3f axis 
)

Specialized SLNodeAnimationTrack creator for a 360 deg. node rotation track with 3 keyframes from 0° to 180° to 360°.

◆ createNodeAnimTrackForRotation4()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForRotation4 ( SLNode target,
SLfloat  angleDeg0,
SLfloat  angleDeg1,
SLfloat  angleDeg2,
SLfloat  angleDeg3,
const SLVec3f axis 
)

Specialized SLNodeAnimationTrack creator for 4 keyframes at angleDeg0, angleDeg1, angleDeg2 and angleDeg3.

◆ createNodeAnimTrackForScaling()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForScaling ( SLNode target,
const SLVec3f endScale 
)

Specialized SLNodeAnimationTrack creator for a two keyframe scaling animation

◆ createNodeAnimTrackForTranslation()

SLNodeAnimTrack * SLAnimation::createNodeAnimTrackForTranslation ( SLNode target,
const SLVec3f endPos 
)

Specialized SLNodeAnimationTrack creator for a two keyframe translation animation

◆ drawNodeVisuals()

void SLAnimation::drawNodeVisuals ( SLSceneView sv)

Draws the visualizations of all node tracks

◆ lengthSec() [1/2]

SLfloat SLAnimation::lengthSec ( ) const
inline

◆ lengthSec() [2/2]

void SLAnimation::lengthSec ( SLfloat  lengthSec)

Setter for the animation length

◆ name() [1/2]

const SLstring & SLAnimation::name ( )
inline

◆ name() [2/2]

void SLAnimation::name ( const SLstring name)
inline

◆ nextKeyframeTime()

SLfloat SLAnimation::nextKeyframeTime ( SLfloat  time)

Returns the timestamp for the next keyframe in all of the tracks.

◆ prevKeyframeTime()

SLfloat SLAnimation::prevKeyframeTime ( SLfloat  time)

Returns the timestamp for the previous keyframe in all of the tracks.

◆ resetNodes()

void SLAnimation::resetNodes ( )

Resets all default animation targets to their initial state.

Member Data Documentation

◆ _lengthSec

SLfloat SLAnimation::_lengthSec
protected

duration of the animation in seconds

◆ _name

SLstring SLAnimation::_name
protected

name of the animation

◆ _nodeAnimTracks

SLMNodeAnimTrack SLAnimation::_nodeAnimTracks
protected

map of all the node tracks in this animation


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