File AnimationScheduler.h¶
-
namespace
Ogre
¶ File: MovableText.h
Description: This creates a billboarding object that display a text. Note: This object must have a dedicated scene node since it will rotate it to face the camera (OGRE 2.1)
- Author
2003 by cTh see gavocanov@rambler.ru 2006 by barraq see nospam@barraquand.com 2012 to work with newer versions of OGRE by MindCalamity mindcalamity@gmail.com 2015 to work on OGRE 2.1 (but not on older versions anymore) by Jayray jeremy.richert1@gmail.com
-
namespace
Gsage
¶ -
class
Animation
- #include <AnimationScheduler.h>
Class that wraps ogre animation state, adds speed definition
Public Functions
-
Animation
()¶
-
virtual
~Animation
()¶
-
void
initialize
(OgreV1::AnimationState *state)¶
-
void
update
(double time)¶ Calls Ogre::AnimationState addTime with adjusted speed
- Parameters
time
: Time in seconds
-
void
enable
(double time = DEFAULT_FADE_SPEED)¶ Enables animation
- Parameters
time
: Time to fade in
-
void
disable
(double time = DEFAULT_FADE_SPEED)¶ Disables animation
- Parameters
time
: Time to fade out
-
float
getTimePosition
()¶ Gets current time position of anim
-
void
setTimePosition
(double value)¶ Sets current time position of anim
- Parameters
value
: Time in seconds
-
float
getLength
()¶ Gets animation length
-
bool
getEnabled
()¶ Gets enabled
-
void
setEnabled
(bool value)¶ Change enabled animation state immediately
- Parameters
value
: Enable anim
-
bool
getLoop
()¶ Gets loop enabled
-
void
setLoop
(bool value)¶ Sets loop value
- Parameters
value
:
-
bool
hasEnded
()¶ Gets animation finished (if not looping)
-
double
getSpeed
()¶ Gets animation speed
-
void
setSpeed
(float speed)¶ Sets animation speed
-
void
rewind
(double offset = 0)¶ Rewind animation to the beginning, depends on direction
- Parameters
offset
: If speed >= 0: 0 + offset, else: length - offset
Private Members
-
OgreV1::AnimationState *
mAnimationState
¶
-
bool
mFadeIn
¶
-
bool
mFadeOut
¶
-
float
mFadeTime
¶
-
float
mSpeed
¶
Friends
-
friend
Gsage::AnimationScheduler
-
-
class
AnimationController
- #include <AnimationScheduler.h>
Animation controller
Public Functions
-
AnimationController
(const AnimationController &other)¶
-
virtual
~AnimationController
()¶
-
void
start
()¶ Starts animation with predefined parameters
-
void
finish
()¶ Stops animation
-
bool
hasEnded
()¶ Check that wrapped animation ended
-
AnimationController
operator=
(const AnimationController &other)¶
-
-
class
AnimationGroup
- #include <AnimationScheduler.h>
Container for several animations
Public Functions
-
AnimationGroup
()¶
-
AnimationGroup
(OgreRenderComponent *c)¶
-
virtual
~AnimationGroup
()¶
-
bool
initialize
(const DataProxy &dict, Ogre::SceneManager *sceneManager)¶ Initialize animation groups
-
double
getSpeed
()¶ Gets animations speed
-
void
setSpeed
(float value)¶ Sets animations speed
- Parameters
value
: 1 is normal speed
-
bool
hasEnded
()¶ Checks that all animations ended
Friends
-
friend
Gsage::AnimationScheduler
-
-
class
AnimationScheduler
: public Serializable<AnimationScheduler> - #include <AnimationScheduler.h>
Class that reads all animation information, configures states, then manages all animations playback
Public Functions
-
AnimationScheduler
()¶
-
virtual
~AnimationScheduler
()¶
-
void
setRenderComponent
(OgreRenderComponent *c)¶
-
bool
initialize
(const DataProxy &dict, Ogre::SceneManager *sceneManager, OgreRenderComponent *renderComponent)¶ Read dict and configure groups, read anim states from entities
- Parameters
dict
: DataProxy to get settings fromsceneManager
: Ogre::SceneManager to get entities fromrenderComponent
: target render component
-
bool
adjustSpeed
(const std::string &name, double speed)¶ Adjust animation speed
-
bool
play
(const std::string &name, int times = LOOP, double speed = 0, double offset = 0, bool reset = false)¶ Play animations from animations group
-
void
resetState
()¶ Reset animation state
-
void
update
(double time)¶ Update animations
- Parameters
time
: Time delta in seconds
Private Types
-
typedef std::map<std::string, AnimationGroup>
AnimationGroups
¶
-
typedef std::queue<AnimationController>
AnimationQueue
¶
-
typedef std::map<std::string, AnimationQueue>
AnimationQueues
¶
Private Functions
-
void
playDefaultAnimation
()¶ Plays default animation, if present
-
bool
queueAnimation
(AnimationGroup &animation, double speed, double offset, bool reset)¶ Queue animation
-
void
setStates
(const DataProxy &dict)¶ Set animation states
- Parameters
dict
: DataProxy with settings
-
const DataProxy &
getStates
() const¶ Get animation states serialized
Private Members
-
AnimationQueues
mAnimationQueues
¶
-
AnimationGroups
mAnimationGroups
¶
-
Animations
mAnimations
¶
-
float
mDefaultAnimationSpeed
¶
-
std::string
mDefaultAnimation
¶
-
std::string
mCurrentAnimation
¶
-
DataProxy
mAnimationStatesDict
¶
-
OgreRenderComponent *
mRenderComponent
¶
-
bool
mInitialized
¶
-
-
class