PixelLightAPI  .
Public Types | Public Member Functions | Public Attributes
PLRenderer::Animation Class Reference

Animation control. More...

#include <Animation.h>

Inheritance diagram for PLRenderer::Animation:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EFlags { Loop = 1<<0, PingPong = 1<<1 }
 Animation flags. More...

Public Member Functions

PLRENDERER_API Animation (const PLCore::String &sName="", AnimationManager *pManager=nullptr)
 Constructor.
virtual PLRENDERER_API ~Animation ()
 Destructor.
PLRENDERER_API void Reset ()
 Resets the animation.
bool IsActive () const
 Get the animation active status.
void SetActive (bool bActive=true)
 Set the animation active status.
PLCore::uint32 GetType () const
 Type of animation.
void SetType (PLCore::uint32 nType=0)
 Sets the animation type.
PLRENDERER_API void Start (PLCore::uint32 nStart, PLCore::uint32 nEnd, float fSpeed=24.0f, PLCore::uint32 nFlags=0)
 Starts an animation.
PLRENDERER_API void Start (AnimationInfo &cAnimationInfo, bool bRestart=false)
 Starts an animation.
PLRENDERER_API void Stop ()
 Stops the animation.
void Pause ()
 Pause the animation.
void Continue ()
 Continues the animation.
AnimationInfoGetAnimation () const
 Returns the animation information.
float GetWeight () const
 Gets the animation weight.
void SetWeight (float fWeight=1.0f)
 Sets the animation weight.
float GetSpeed () const
 Get the animation speed.
void SetSpeed (float fSpeed=24.0f)
 Set the animation speed.
PLCore::uint32 GetFlags () const
 Get the animation information flags.
void SetFlags (PLCore::uint32 nFlags=0)
 Sets the animation information flags.
bool IsRunning () const
 Get the animation running status.
PLCore::uint32 GetStartFrame () const
 Returns the start frame.
PLCore::uint32 GetEndFrame () const
 Returns the end frame.
PLCore::uint32 GetNumOfFrames () const
 Returns the number of frames.
PLRENDERER_API float GetFrame () const
 Get the current animation frame.
PLRENDERER_API float GetProgress () const
 Gets the progress from the current state to the next state (0.0-1.0)
PLRENDERER_API PLCore::uint32 GetCurrentFrame () const
 Get the current animation frame as an integer.
PLRENDERER_API void SetCurrentFrame (float fFrame)
 Set the current animation frame.
PLRENDERER_API PLCore::uint32 GetNextFrame () const
 Get the next animation frame as an integer.
PLRENDERER_API void Update (float fTimeDifference)
 Updates the animation.
bool GetEvents () const
 Returns whether animation events are enabled or not.
void SetEvents (bool bEvents=true)
 Sets whether animation events are enabled or not.
PLRENDERER_API Animationoperator= (const Animation &cSource)

Public Attributes

PLCore::Event EventStart
PLCore::Event EventStop
PLCore::Event EventFrameChange
PLCore::Event< int > EventSpecialFrame

Detailed Description

Animation control.


Member Enumeration Documentation

Animation flags.

Enumerator:
Loop 

Loop animation

PingPong 

Ping pong animation


Constructor & Destructor Documentation

PLRENDERER_API PLRenderer::Animation::Animation ( const PLCore::String sName = "",
AnimationManager pManager = nullptr 
)

Constructor.

Parameters:
[in]sNameElement name to set
[in]pManagerAnimation manager using this element, can be a null pointer
virtual PLRENDERER_API PLRenderer::Animation::~Animation ( ) [virtual]

Destructor.


Member Function Documentation

PLRENDERER_API void PLRenderer::Animation::Reset ( )

Resets the animation.

bool PLRenderer::Animation::IsActive ( ) const [inline]

Get the animation active status.

Returns:
'true' if the animation is active, else 'false'
void PLRenderer::Animation::SetActive ( bool  bActive = true) [inline]

Set the animation active status.

Parameters:
[in]bActiveShould the animation be active?
Note:
  • If an animation is inactive it is ignored
PLCore::uint32 PLRenderer::Animation::GetType ( ) const [inline]

Type of animation.

Returns:
Animation type (for instance 0=skeleton 1=vertex)
void PLRenderer::Animation::SetType ( PLCore::uint32  nType = 0) [inline]

Sets the animation type.

Parameters:
[in]nTypeAnimation type (for instance 0=skeleton 1=vertex)
PLRENDERER_API void PLRenderer::Animation::Start ( PLCore::uint32  nStart,
PLCore::uint32  nEnd,
float  fSpeed = 24.0f,
PLCore::uint32  nFlags = 0 
)

Starts an animation.

Parameters:
[in]nStartStart frame (inclusive)
[in]nEndEnd frame (inclusive)
[in]fSpeedAnimation speed, if negative, the animation is played reversed
[in]nFlagsAnimation flags (see EFlags)
Note:
  • Use the start function below which accepts a AnimationInfo as parameter for more complex animations
PLRENDERER_API void PLRenderer::Animation::Start ( AnimationInfo cAnimationInfo,
bool  bRestart = false 
)

Starts an animation.

Parameters:
[in]cAnimationInfoThe animation information
[in]bRestartRestart animation if it is already currently played?
Note:
  • cAnimationInfo must stay a valid reference as long as the animation is played!
  • Because events are stored in the animation information it's possible that events are caused during the animation playback if an scene node is set
PLRENDERER_API void PLRenderer::Animation::Stop ( )

Stops the animation.

void PLRenderer::Animation::Pause ( ) [inline]

Pause the animation.

Continues the animation.

Returns the animation information.

Returns:
Animation information, a null pointer if there's no one
float PLRenderer::Animation::GetWeight ( ) const [inline]

Gets the animation weight.

Returns:
Animation weight (normally 0.0-1.0)
void PLRenderer::Animation::SetWeight ( float  fWeight = 1.0f) [inline]

Sets the animation weight.

Parameters:
[in]fWeightAnimation weight (normally 0.0-1.0)
float PLRenderer::Animation::GetSpeed ( ) const [inline]

Get the animation speed.

Returns:
Current speed of the animation, if negative, the animation is played reversed
void PLRenderer::Animation::SetSpeed ( float  fSpeed = 24.0f) [inline]

Set the animation speed.

Parameters:
[in]fSpeedNew speed for the animation, if negative, the animation is played reversed
PLCore::uint32 PLRenderer::Animation::GetFlags ( ) const [inline]

Get the animation information flags.

Returns:
Animation information flags (see EFlags)
void PLRenderer::Animation::SetFlags ( PLCore::uint32  nFlags = 0) [inline]

Sets the animation information flags.

Parameters:
[in]nFlagsAnimation information flags (see EFlags)
bool PLRenderer::Animation::IsRunning ( ) const [inline]

Get the animation running status.

Returns:
'true' if the animation is currently running, else 'false'
PLCore::uint32 PLRenderer::Animation::GetStartFrame ( ) const [inline]

Returns the start frame.

Returns:
The start frame (inclusive)
PLCore::uint32 PLRenderer::Animation::GetEndFrame ( ) const [inline]

Returns the end frame.

Returns:
The end frame (inclusive)
PLCore::uint32 PLRenderer::Animation::GetNumOfFrames ( ) const [inline]

Returns the number of frames.

Returns:
The number of frames
PLRENDERER_API float PLRenderer::Animation::GetFrame ( ) const

Get the current animation frame.

Returns:
Current animation frame (for instance 2.6)
PLRENDERER_API float PLRenderer::Animation::GetProgress ( ) const

Gets the progress from the current state to the next state (0.0-1.0)

Returns:
Current animation frame (for instance 0.6)
PLRENDERER_API PLCore::uint32 PLRenderer::Animation::GetCurrentFrame ( ) const

Get the current animation frame as an integer.

Returns:
Current animation frame as an integer
Note:
  • This function returns an integer for the current animation frame, e.g. if the animation frame is at 2.6f, it will return 2
PLRENDERER_API void PLRenderer::Animation::SetCurrentFrame ( float  fFrame)

Set the current animation frame.

Parameters:
[in]fFrameCurrent animation frame
Note:
  • If the given frame is out of bounds, it's clamped automatically
PLRENDERER_API PLCore::uint32 PLRenderer::Animation::GetNextFrame ( ) const

Get the next animation frame as an integer.

Returns:
Next animation frame as an integer
See also:
PLRENDERER_API void PLRenderer::Animation::Update ( float  fTimeDifference)

Updates the animation.

Parameters:
[in]fTimeDifferencePast time since last frame (use e.g. PLCore::Timing::GetInstance()->GetTimeDifference())
bool PLRenderer::Animation::GetEvents ( ) const [inline]

Returns whether animation events are enabled or not.

Returns:
'true' if animation events are enabled, else 'false'
Note:
  • If animation events are enabled special frames are able to send an event message to the scene node connected with the animation
void PLRenderer::Animation::SetEvents ( bool  bEvents = true) [inline]

Sets whether animation events are enabled or not.

Parameters:
[in]bEventsAre animation events enabled?
See also:
PLRENDERER_API Animation& PLRenderer::Animation::operator= ( const Animation cSource)

Member Data Documentation

Animation has been started

Animation has been stopped

Current frame change event

Special marked frame reached event, event ID as parameter (see 'AnimationEvent')


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:38
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported