arsa  2.7
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
irr::scene::ISceneNodeAnimator Class Referenceabstract

Animates a scene node. Can animate position, rotation, material, and so on. More...

#include <ISceneNodeAnimator.h>

Inheritance diagram for irr::scene::ISceneNodeAnimator:
irr::io::IAttributeExchangingObject irr::IEventReceiver irr::IReferenceCounted irr::scene::ISceneNodeAnimatorCameraFPS irr::scene::ISceneNodeAnimatorCameraMaya irr::scene::ISceneNodeAnimatorCollisionResponse

Public Member Functions

 ISceneNodeAnimator ()
 
virtual void animateNode (ISceneNode *node, u32 timeMs)=0
 Animates a scene node. More...
 
virtual ISceneNodeAnimatorcreateClone (ISceneNode *node, ISceneManager *newManager=0)=0
 Creates a clone of this animator. More...
 
virtual bool isEventReceiverEnabled () const
 Returns true if this animator receives events. More...
 
virtual bool OnEvent (const SEvent &event) _IRR_OVERRIDE_
 Event receiver, override this function for camera controlling animators. More...
 
virtual ESCENE_NODE_ANIMATOR_TYPE getType () const
 Returns type of the scene node animator. More...
 
virtual bool hasFinished (void) const
 Returns if the animator has finished. More...
 
virtual void setStartTime (u32 time, bool resetPauseTime=true)
 Reset a time-based movement by changing the starttime. More...
 
virtual irr::u32 getStartTime () const
 Get the starttime. More...
 
virtual void setEnabled (bool enabled, u32 timeNow=0)
 Sets the enabled state of this element. More...
 
virtual bool isEnabled () const
 
virtual void serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_
 Writes attributes of the scene node animator. More...
 
virtual void deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_
 Reads attributes of the scene node animator. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 
- Public Member Functions inherited from irr::IEventReceiver
virtual ~IEventReceiver ()
 Destructor. More...
 

Protected Member Functions

void cloneMembers (const ISceneNodeAnimator *toCopyFrom)
 
- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Protected Attributes

bool IsEnabled
 
u32 PauseTimeSum
 Only enabled animators are updated. More...
 
u32 PauseTimeStart
 Sum up time which the animator was disabled. More...
 
u32 StartTime
 Last time setEnabled(false) was called with a timer > 0. More...
 

Detailed Description

Animates a scene node. Can animate position, rotation, material, and so on.

A scene node animator is able to animate a scene node in a very simple way. It may change its position, rotation, scale and/or material. There are lots of animators to choose from. You can create scene node animators with the ISceneManager interface.

Definition at line 31 of file ISceneNodeAnimator.h.

Constructor & Destructor Documentation

◆ ISceneNodeAnimator()

irr::scene::ISceneNodeAnimator::ISceneNodeAnimator ( )
inline

Definition at line 34 of file ISceneNodeAnimator.h.

35  {
36  }
u32 PauseTimeSum
Only enabled animators are updated.
u32 StartTime
Last time setEnabled(false) was called with a timer > 0.
u32 PauseTimeStart
Sum up time which the animator was disabled.

Member Function Documentation

◆ animateNode()

virtual void irr::scene::ISceneNodeAnimator::animateNode ( ISceneNode node,
u32  timeMs 
)
pure virtual

Animates a scene node.

Parameters
nodeNode to animate.
timeMsCurrent time in milliseconds.

◆ cloneMembers()

void irr::scene::ISceneNodeAnimator::cloneMembers ( const ISceneNodeAnimator toCopyFrom)
inlineprotected

This method can be used by clone() implementations of derived classes

Parameters
toCopyFromThe animator from which the values are copied

Definition at line 151 of file ISceneNodeAnimator.h.

152  {
153  IsEnabled = toCopyFrom->IsEnabled;
154  PauseTimeSum = toCopyFrom->IsEnabled;
155  PauseTimeStart = toCopyFrom->PauseTimeStart;
156  StartTime = toCopyFrom->StartTime;
157  }
u32 PauseTimeSum
Only enabled animators are updated.
u32 StartTime
Last time setEnabled(false) was called with a timer > 0.
u32 PauseTimeStart
Sum up time which the animator was disabled.

◆ createClone()

virtual ISceneNodeAnimator* irr::scene::ISceneNodeAnimator::createClone ( ISceneNode node,
ISceneManager newManager = 0 
)
pure virtual

Creates a clone of this animator.

Please note that you will have to drop (IReferenceCounted::drop()) the returned pointer after calling this.

◆ deserializeAttributes()

virtual void irr::scene::ISceneNodeAnimator::deserializeAttributes ( io::IAttributes in,
io::SAttributeReadWriteOptions options = 0 
)
inlinevirtual

Reads attributes of the scene node animator.

Reimplemented from irr::io::IAttributeExchangingObject.

Definition at line 139 of file ISceneNodeAnimator.h.

140  {
141  IsEnabled = in->getAttributeAsBool("IsEnabled", IsEnabled);
142  PauseTimeSum = 0;
143  PauseTimeStart = 0;
144  }
u32 PauseTimeSum
Only enabled animators are updated.
GLuint in
u32 PauseTimeStart
Sum up time which the animator was disabled.

◆ getStartTime()

virtual irr::u32 irr::scene::ISceneNodeAnimator::getStartTime ( ) const
inlinevirtual

Get the starttime.

This will return 0 for by animators which don't work with a starttime unless a starttime was manually set

Definition at line 96 of file ISceneNodeAnimator.h.

97  {
98  return StartTime;
99  }
u32 StartTime
Last time setEnabled(false) was called with a timer > 0.

◆ getType()

virtual ESCENE_NODE_ANIMATOR_TYPE irr::scene::ISceneNodeAnimator::getType ( ) const
inlinevirtual

Returns type of the scene node animator.

Definition at line 64 of file ISceneNodeAnimator.h.

65  {
66  return ESNAT_UNKNOWN;
67  }
Unknown scene node animator.

◆ hasFinished()

virtual bool irr::scene::ISceneNodeAnimator::hasFinished ( void  ) const
inlinevirtual

Returns if the animator has finished.

This is only valid for non-looping animators with a discrete end state.

Returns
true if the animator has finished, false if it is still running.

Definition at line 72 of file ISceneNodeAnimator.h.

73  {
74  return false;
75  }

◆ isEnabled()

virtual bool irr::scene::ISceneNodeAnimator::isEnabled ( ) const
inlinevirtual

Definition at line 126 of file ISceneNodeAnimator.h.

127  {
128  return IsEnabled;
129  }

◆ isEventReceiverEnabled()

virtual bool irr::scene::ISceneNodeAnimator::isEventReceiverEnabled ( ) const
inlinevirtual

Returns true if this animator receives events.

When attached to an active camera, this animator will be able to respond to events such as mouse and keyboard events.

Definition at line 52 of file ISceneNodeAnimator.h.

53  {
54  return false;
55  }

◆ OnEvent()

virtual bool irr::scene::ISceneNodeAnimator::OnEvent ( const SEvent event)
inlinevirtual

Event receiver, override this function for camera controlling animators.

Implements irr::IEventReceiver.

Definition at line 58 of file ISceneNodeAnimator.h.

59  {
60  return false;
61  }

◆ serializeAttributes()

virtual void irr::scene::ISceneNodeAnimator::serializeAttributes ( io::IAttributes out,
io::SAttributeReadWriteOptions options = 0 
) const
inlinevirtual

Writes attributes of the scene node animator.

Reimplemented from irr::io::IAttributeExchangingObject.

Definition at line 132 of file ISceneNodeAnimator.h.

133  {
134  out->addBool("IsEnabled", IsEnabled);
135  // timers not serialized as they usually depend on system-time which is different on each application start.
136  }

◆ setEnabled()

virtual void irr::scene::ISceneNodeAnimator::setEnabled ( bool  enabled,
u32  timeNow = 0 
)
inlinevirtual

Sets the enabled state of this element.

Parameters
enabledWhen set to false ISceneNodes will not update the animator anymore. Animators themselves usually don't care. So manual calls to animateNode still work.
timeNowWhen set to values > 0 on enabling and disabling an internal timer will be increased by the time disabled time. Animator decide themselves how to handle that timer, but generally setting it will allow you to pause an animator, so it will continue at the same position when you enable it again. To use that pass irr::ITimer::getTime() as value. Animators with no timers will just ignore this.

Definition at line 110 of file ISceneNodeAnimator.h.

111  {
112  if ( enabled == IsEnabled )
113  return;
114  IsEnabled = enabled;
115  if ( enabled )
116  {
117  if ( timeNow > 0 && PauseTimeStart > 0 )
118  PauseTimeSum += timeNow-PauseTimeStart;
119  }
120  else
121  {
122  PauseTimeStart = timeNow;
123  }
124  }
u32 PauseTimeSum
Only enabled animators are updated.
GLenum GLenum GLsizei const GLuint GLboolean enabled
u32 PauseTimeStart
Sum up time which the animator was disabled.

◆ setStartTime()

virtual void irr::scene::ISceneNodeAnimator::setStartTime ( u32  time,
bool  resetPauseTime = true 
)
inlinevirtual

Reset a time-based movement by changing the starttime.

By default most animators start on object creation. This value is ignored by animators which don't work with a starttime. Known problems: CSceneNodeAnimatorRotation currently overwrites this value constantly (might be changed in the future).

Parameters
timeCommonly you will use irr::ITimer::getTime().
resetPauseTimeReset internal pause time for enabling/diabling animators as well

Definition at line 84 of file ISceneNodeAnimator.h.

85  {
86  StartTime = time;
87  if ( resetPauseTime )
88  {
89  PauseTimeStart = 0;
90  PauseTimeSum = 0;
91  }
92  }
u32 PauseTimeSum
Only enabled animators are updated.
u32 StartTime
Last time setEnabled(false) was called with a timer > 0.
u32 PauseTimeStart
Sum up time which the animator was disabled.

Member Data Documentation

◆ IsEnabled

bool irr::scene::ISceneNodeAnimator::IsEnabled
protected

Definition at line 159 of file ISceneNodeAnimator.h.

◆ PauseTimeStart

u32 irr::scene::ISceneNodeAnimator::PauseTimeStart
protected

Sum up time which the animator was disabled.

Definition at line 161 of file ISceneNodeAnimator.h.

◆ PauseTimeSum

u32 irr::scene::ISceneNodeAnimator::PauseTimeSum
protected

Only enabled animators are updated.

Definition at line 160 of file ISceneNodeAnimator.h.

◆ StartTime

u32 irr::scene::ISceneNodeAnimator::StartTime
protected

Last time setEnabled(false) was called with a timer > 0.

Definition at line 162 of file ISceneNodeAnimator.h.


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