IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
IMS_Animation_Base Class Referenceabstract
Inheritance diagram for IMS_Animation_Base:
IMS_Animation_Continuous IMS_Animation_Sequential IMS_Animation_Tracking

Public Member Functions

 IMS_Animation_Base (ANIMATIONDATA *_data)
 
virtual void AddAnimationToVessel (IMS2 *_vessel, int _meshindex, MATRIX3 moduleorientation, VECTOR3 modulelocalpos)
 Adds the animation to the vessel using the orbiter API. More...
 
virtual void RemoveAnimationFromVessel ()
 Removes the animation from the vessel. More...
 
virtual void InitStateFromScenario (vector< string > &line)
 Initialises the animation state from a scenario line. More...
 
virtual AnimationEvent_BasePropagateAnimation (double simdt)=0
 propagates the animation and returns an AnimationFinishedEvent if the animation stoped. More...
 
virtual AnimationEvent_BaseStartAnimation (StartAnimationEvent *startevent)
 Starts the animation. More...
 
virtual void ModifyAnimation (ModifyAnimationEvent *modifyevent)
 Modifies an animation, usually its speed and direction. More...
 
virtual void StopAnimation ()
 Stops the animation. More...
 
bool IsRunning ()
 
virtual string GetScenarioLine ()
 
virtual void DisableAnimation ()
 Disables updating of the animation state in orbiter. More...
 
virtual void EnableAnimation ()
 Enables updating of the animation state in orbiter. More...
 
double GetState ()
 
void GetDependencies (vector< ANIMATIONDEPENDENCY > &OUT_dependencies)
 Fills the passed reference with the dependencies of this animation.
 

Protected Member Functions

MGROUP_ROTATE * createRotationComponent (ANIMCOMPONENTDATA *comp, VECTOR3 modulelocalpos, MATRIX3 moduleorientation)
 Creates a rotation animation component that can be added to the animation on the vessel. More...
 
MGROUP_TRANSLATE * createTranslationComponent (ANIMCOMPONENTDATA *comp, VECTOR3 modulelocalpos, MATRIX3 moduleorientation)
 Creates a translation animation component that can be added to the animation on the vessel. More...
 
MGROUP_SCALE * createScaleComponent (ANIMCOMPONENTDATA *comp, VECTOR3 modulelocalpos, MATRIX3 moduleorientation)
 Creates a scale animation component that can be added to the animation on the vessel. More...
 

Protected Attributes

IMS2 * vessel
 The vessel this animation is currently a part of.
 
ANIMATIONDATAdata
 Pointer to the data defining this animation.
 
double speed = 0.0
 The current speed/direction of the animation.
 
int orbiterid
 The orbiter-generated identifier for this animation.
 
double state = 0.0
 The current state of the animation (>= 0.0 <= 1.0)
 
int meshindex = 0
 The orbiter generated index of the mesh this animation acts on.
 
double maxspeed = 1e12
 The maximum speed the animation can have. Effects not yet implemented.
 
vector< UINT * > animationgroups
 List meshgroup indices this animation acts on.
 
vector< ANIMATIONCOMPONENT_HANDLE > animationcomponents
 List of orbiter-internal components this animation consists of.
 
bool enabled = false
 An animation is disabled when the vessel visual doesn't exist. state still gets propagated, but the animation state on the vessel doesn't get updated.
 

Detailed Description

Abstract base class for animations

Constructor & Destructor Documentation

IMS_Animation_Base::IMS_Animation_Base ( ANIMATIONDATA _data)
Parameters
_dataPointer to the data that describes the animation

Member Function Documentation

void IMS_Animation_Base::AddAnimationToVessel ( IMS2 *  _vessel,
int  _meshindex,
MATRIX3  moduleorientation,
VECTOR3  modulelocalpos 
)
virtual

Adds the animation to the vessel using the orbiter API.

Parameters
_vesselThe vessel to add the animation to
_meshindexThe index of the mesh that is influenced by this animation
moduleorientationMatrix to transform from module-relative to vessel-relative coordinates
modulelocalposVessel-relative position of the module containing this animation

Reimplemented in IMS_Animation_Tracking.

MGROUP_ROTATE * IMS_Animation_Base::createRotationComponent ( ANIMCOMPONENTDATA *  comp,
VECTOR3  modulelocalpos,
MATRIX3  moduleorientation 
)
protected

Creates a rotation animation component that can be added to the animation on the vessel.

Parameters
compThe data to create the component from
modulelocalposThe vessel-relative position of the module this animation is part of
moduleorientationTransformation matrix from vessel-relative to module-relative orientation
Returns
A pointer to the created MGROUP_ROTATE object
Note
Once the component is added to an orbiter animation, it must be destroyed by destroying the animation with oapi calls. Destroying the object otherwise will lead to a crash. Not adding the returned component to an orbiter animation will result in a memory leak.
See also
createTranslationComponent()
createScaleComponent()
MGROUP_SCALE * IMS_Animation_Base::createScaleComponent ( ANIMCOMPONENTDATA *  comp,
VECTOR3  modulelocalpos,
MATRIX3  moduleorientation 
)
protected

Creates a scale animation component that can be added to the animation on the vessel.

Parameters
compThe data to create the component from
modulelocalposThe vessel-relative position of the module this animation is part of
moduleorientationTransformation matrix from vessel-relative to module-relative orientation
Returns
A pointer to the created MGROUP_ROTATE object
Note
Once the component is added to an orbiter animation, it must be destroyed by destroying the animation with oapi calls. Destroying the object otherwise will lead to a crash. Not adding the returned component to an orbiter animation will result in a memory leak.
See also
createTranslationComponent()
createRotationComponent()
Todo:
As there have been no scaling animations yet, this is untested!
MGROUP_TRANSLATE * IMS_Animation_Base::createTranslationComponent ( ANIMCOMPONENTDATA *  comp,
VECTOR3  modulelocalpos,
MATRIX3  moduleorientation 
)
protected

Creates a translation animation component that can be added to the animation on the vessel.

Parameters
compThe data to create the component from
modulelocalposThe vessel-relative position of the module this animation is part of
moduleorientationTransformation matrix from vessel-relative to module-relative orientation
Returns
A pointer to the created MGROUP_TRANSLATE object
Note
Once the component is added to an orbiter animation, it must be destroyed by destroying the animation with oapi calls. Destroying the object otherwise will lead to a crash. Not adding the returned component to an orbiter animation will result in a memory leak.
See also
createRotationComponent()
createScaleComponent()
void IMS_Animation_Base::DisableAnimation ( )
virtual

Disables updating of the animation state in orbiter.

Animations should be disabled when a vessel visual does not exist (not close enough to camera) or if the whole vessel doesn't exist. The animation state will still propagate even if disabled, so when the vessel are created it will be as if the animation never stoped

Reimplemented in IMS_Animation_Tracking.

void IMS_Animation_Base::EnableAnimation ( )
virtual

Enables updating of the animation state in orbiter.

See also
DisableAnimation()

Reimplemented in IMS_Animation_Tracking.

string IMS_Animation_Base::GetScenarioLine ( )
virtual
Returns
a string describing the state of the animation to write into a scenario file.

Reimplemented in IMS_Animation_Tracking, and IMS_Animation_Continuous.

double IMS_Animation_Base::GetState ( )
inline
Returns
The current state of the animation
void IMS_Animation_Base::InitStateFromScenario ( vector< string > &  line)
virtual

Initialises the animation state from a scenario line.

Parameters
lineA list of strings, representing the scenario line cut by " "

Reimplemented in IMS_Animation_Tracking, and IMS_Animation_Continuous.

bool IMS_Animation_Base::IsRunning ( )
Returns
True if the animation is currently running, false otherwise.
Note
direction is not considered
void IMS_Animation_Base::ModifyAnimation ( ModifyAnimationEvent modifyevent)
virtual

Modifies an animation, usually its speed and direction.

Parameters
modifyeventThe event that modifies the animation

Reimplemented in IMS_Animation_Tracking.

virtual AnimationEvent_Base* IMS_Animation_Base::PropagateAnimation ( double  simdt)
pure virtual

propagates the animation and returns an AnimationFinishedEvent if the animation stoped.

propagation behavior has to be implemented by child classes.

Parameters
simdtThe time elapsed since the last frame

Implemented in IMS_Animation_Tracking, IMS_Animation_Continuous, and IMS_Animation_Sequential.

void IMS_Animation_Base::RemoveAnimationFromVessel ( )
virtual

Removes the animation from the vessel.

debug

Reimplemented in IMS_Animation_Tracking.

AnimationEvent_Base * IMS_Animation_Base::StartAnimation ( StartAnimationEvent startevent)
virtual

Starts the animation.

Parameters
starteventThe StartAnimationEvent that triggers the start of the animation

Reimplemented in IMS_Animation_Tracking.

void IMS_Animation_Base::StopAnimation ( )
virtual

Stops the animation.

Note
stopping behavior is implemented by inheriting classes

Reimplemented in IMS_Animation_Tracking, and IMS_Animation_Continuous.


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