|
Motive Animation System
An open source project by
FPL.
|
Drives a value towards a target value, or along a path. More...
#include <motivator.h>
Drives a value towards a target value, or along a path.
The value can be one-dimensional (e.g. a float), or multi-dimensional (e.g. a matrix). The dimension is determined by the sub-class: Motivator1f drives a float, MatrixMotivator4f drives a 4x4 float matrix.
Although you can instantiate a Motivator, you probably will not, since there is no mechanism to read data out of a Motivator. Generally, you will instantiate a derived class like Motivator1f, which provides accessor functions.
The way a Motivator's value moves towards its target is determined by the type of a motivator. The type is specified in Motivator::Initialize().
Note that a Motivator does not store any data itself. It is a handle into a MotiveProcessor. Each MotiveProcessor holds all data for motivators of its type.
Only one Motivator can reference a specific index in a MotiveProcessor. Therefore, when you copy a Motivator, the original motivator will become invalid.
Public Member Functions | |
| Motivator (const Motivator &original) | |
| Motivator & | operator= (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 |
Protected Member Functions | |
| 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 MotiveProcessor * | Processor () const |
Protected Attributes | |
| MotiveProcessor * | processor_ |
| MotiveIndex | index_ |
Friends | |
| class | MotiveProcessor |
|
inline |
Transfer ownership of original motivator to this motivator. original motivator is reset and must be initialized again before being read. We want to allow moves primarily so that we can have vectors of Motivators.
Note: This should be a move constructor instead of a copy constructor. However, VS2010~2012 requires move constructors to exist in any class that has a move constructed member. That would be a burden for users of Motivator, so we chose to be practical here instead of pedantically correct. We use the copy constructor and copy operator to do move behavior. See http://en.cppreference.com/w/cpp/language/move_operator
|
inline |
The number of basic values that this Motivator is driving. For example, a 3D position would return 3, since it drives three floats. A single 4x4 matrix would return 1, since it's driving one matrix. The basic value is determined by the MotiveProcessor backing this motivator.
|
inline |
Detatch this Motivator from its MotiveProcessor. Functions other than Initialize() and Valid() can no longer be called afterwards.
Allow Motivators to be moved. original is reset. See the copy constructor for details.
|
inline |
Check consistency of internal state. Useful for debugging. If this function ever returns false, there has been some sort of memory corruption or similar bug.
|
inline |
|
inline |
Return true if this Motivator is currently being driven by a MotiveProcessor. That is, if it has been successfully initialized.
|
friend |
The MotiveProcessor uses the functions below. It does not modify data directly.
|
protected |
A MotiveProcessor processes one MotivatorType, and hosts every Motivator of that type. This index here uniquely identifies this Motivator to the MotiveProcessor.
|
protected |