Motive Animation System
An open source project by FPL.
 All Classes Functions Variables Typedefs Friends Pages
motive::MatrixMotivator4fTemplate< VectorConverter > Class Template Reference

Drive a 4x4 float matrix from a series of basic transformations. More...

#include <motivator.h>

Inheritance diagram for motive::MatrixMotivator4fTemplate< VectorConverter >:
motive::Motivator

Detailed Description

template<class VectorConverter>
class motive::MatrixMotivator4fTemplate< VectorConverter >

Drive a 4x4 float matrix from a series of basic transformations.

The underlying basic transformations can be animated with SetChildTarget1f(), and set to fixed values with SetChildValue1f() and SetChildValue3f().

Internally, we use mathfu::mat4 as our matrix type and mathfu::vec3 as our vector type, but external we allow any matrix type to be specified via the VectorConverter template parameter.

Public Types

typedef VectorConverter C
 
typedef VectorConverter::Matrix4 Mat4
 
typedef VectorConverter::Vector3 Vec3
 
typedef MotivatorXfTemplate< C, 1 > Mot1f
 

Public Member Functions

 MatrixMotivator4fTemplate (const MotivatorInit &init, MotiveEngine *engine)
 
void Initialize (const MotivatorInit &init, MotiveEngine *engine)
 Initialize to the type specified by init.
 
const Mat4 & Value () const
 
Vec3 Position () const
 
MotiveTime TimeRemaining () const
 
int NumChildren () const
 
float ChildValue1f (MotiveChildIndex child_index) const
 
Vec3 ChildValue3f (MotiveChildIndex child_index) const
 
const Mot1fChildMotivator1f (MotiveChildIndex child_index) const
 
void SetChildTarget1f (MotiveChildIndex child_index, const MotiveTarget1f &t)
 
void SetChildValue1f (MotiveChildIndex child_index, float value)
 
void SetChildValue3f (MotiveChildIndex child_index, const Vec3 &value)
 
void BlendToOps (const MatrixOpArray &ops, const SplinePlayback &playback)
 
void SetPlaybackRate (float playback_rate)
 
- Public Member Functions inherited from motive::Motivator
 Motivator (const Motivator &original)
 
Motivatoroperator= (const Motivator &original)
 
 ~Motivator ()
 Remove ourselves from the MotiveProcessor when we're deleted.
 
void Invalidate ()
 
bool Valid () const
 
bool Sane () const
 
MotivatorType Type () const
 
MotiveDimension Dimensions () const
 

Additional Inherited Members

- Protected Member Functions inherited from motive::Motivator
 Motivator (const MotivatorInit &init, MotiveEngine *engine, MotiveDimension dimensions)
 
void InitializeWithDimension (const MotivatorInit &init, MotiveEngine *engine, MotiveDimension dimensions)
 
void Init (MotiveProcessor *processor, MotiveIndex index)
 These should only be called by MotiveProcessor!
 
void Reset ()
 
const MotiveProcessorProcessor () const
 
- Protected Attributes inherited from motive::Motivator
MotiveProcessorprocessor_
 
MotiveIndex index_
 

Member Function Documentation

template<class VectorConverter >
void motive::MatrixMotivator4fTemplate< VectorConverter >::BlendToOps ( const MatrixOpArray ops,
const SplinePlayback playback 
)
inline

Match existing MatrixOps with those in ops and smoothly transition to the new parameters in ops.

template<class VectorConverter >
const Mot1f* motive::MatrixMotivator4fTemplate< VectorConverter >::ChildMotivator1f ( MotiveChildIndex  child_index) const
inline

Returns the Motivator1f that's driving this child, if it's driven by a Motivator1f. Otherwise, returns nullptr.

template<class VectorConverter >
float motive::MatrixMotivator4fTemplate< VectorConverter >::ChildValue1f ( MotiveChildIndex  child_index) const
inline

Return the current value of the child_indexth basic transform that drives this matrix.

Parameters
child_indexThe index into MatrixInit::ops(). The ops() array is a series of basic transformation operations that compose this matrix. Each basic transformation has a current value. We gather this value here.
template<class VectorConverter >
Vec3 motive::MatrixMotivator4fTemplate< VectorConverter >::ChildValue3f ( MotiveChildIndex  child_index) const
inline

Returns the current values of the basic transforms at indices (child_index, child_index + 1, child_index + 2). Useful when you drive all the (x,y,z) components of a translation, scale, or rotation.

Parameters
child_indexThe first index into MatrixInit::ops(). The value at this index is returned in the x component of Vec3. y gets child_index + 1's value, and z gets child_index + 2's value.
template<class VectorConverter >
int motive::MatrixMotivator4fTemplate< VectorConverter >::NumChildren ( ) const
inline

Query the number of matrix operations. This equals the number of operations in the init initializer.

template<class VectorConverter >
Vec3 motive::MatrixMotivator4fTemplate< VectorConverter >::Position ( ) const
inline

Return the translation component of the matrix. The matrix is a 3D affine transform, so the translation component is the fourth column.

template<class VectorConverter >
void motive::MatrixMotivator4fTemplate< VectorConverter >::SetChildTarget1f ( MotiveChildIndex  child_index,
const MotiveTarget1f t 
)
inline

Set the target the 'child_index'th basic transform. Each basic transform can be driven by a child motivator. This call lets us control those child motivators.

Parameters
child_indexThe index into the MatrixInit::ops() that was passed into Initialize(). This operation must have been initialized with a MotivatorInit, not a constant value.
tThe target values for the basic transform to animate towards. Also, optionally, the current value for it to jump to.
template<class VectorConverter >
void motive::MatrixMotivator4fTemplate< VectorConverter >::SetChildValue1f ( MotiveChildIndex  child_index,
float  value 
)
inline

Set the constant value of a child. Each basic matrix transformation can be driven by a constant value instead of a Motivator. This call lets us set those constant values.

Parameters
child_indexThe index into the MatrixInit::ops() that was passed into Initialize(). This operation must have been initialized with a constant value, not a MotivatorInit.
valueThe new constant value of this operation.
template<class VectorConverter >
void motive::MatrixMotivator4fTemplate< VectorConverter >::SetChildValue3f ( MotiveChildIndex  child_index,
const Vec3 &  value 
)
inline

Set the constant values of the basic transforms at indices (child_index, child_index + 1, child_index + 2).

Parameters
child_indexThe first index into MatrixInit::ops(). The constant value at this index is set to the x component of value. child_index + 1's constant is set to value.y, and child_index + 2's constant is set to value.z.
valueThe new constant value for this 3-dimensional operation.
template<class VectorConverter >
MotiveTime motive::MatrixMotivator4fTemplate< VectorConverter >::TimeRemaining ( ) const
inline

Return the time remaining in the current spline animation. Time units are defined by the user.

template<class VectorConverter >
const Mat4& motive::MatrixMotivator4fTemplate< VectorConverter >::Value ( ) const
inline

Return the current value of the Motivator. The processor returns a vector-aligned matrix, so the cast should be valid for any user-defined matrix type.


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