GlsAnimation Library  1.0.5
Provides classes and functions to support animating GL Studio objects programmatically or with script files
Classes | Public Types | Public Member Functions | List of all members
disti::GlsKeyframeCurve< T > Class Template Reference

Class template for keyframe curves of different types (double, Vector, etc.) More...

#include <gls_keyframe.h>

Inheritance diagram for disti::GlsKeyframeCurve< T >:
disti::GlsKeyframeCurveBase

Public Types

typedef stdortr1::shared_ptr< GlsKeyframeCurvePtr
 Alias for easier reading.
 
typedef stdortr1::shared_ptr< const GlsKeyframeCurvePtrConst
 Alias for easier reading.
 
typedef T Value
 The templated type.
 
typedef Detail::DefaultInterpolator< Value >::Type DefaultInterpolator
 The default interpolator for the given Value type.
 
- Public Types inherited from disti::GlsKeyframeCurveBase
typedef double Key
 The key type (usually time, but not always)
 
typedef std::size_t Size
 The size type for sizes and indices.
 
typedef std::pair< Key, KeyKeyPair
 Alias for easier reading.
 

Public Member Functions

 GlsKeyframeCurve (const GlsKeyframeInterpolator< Value > *const interpolator=new DefaultInterpolator())
 
 GlsKeyframeCurve (typename GlsKeyframeInterpolator< Value >::PtrConst interpolator)
 
Size GetKeyframeCount () const
 Override from GlsKeyframeCurveBase.
 
KeyPair GetMinMaxKeys () const
 Override from GlsKeyframeCurveBase.
 
void AddKeyframe (const Key &key, const Value &value, const Key &tolerance=Detail::g_glsAnimationFloatTolerance)
 
Value Interpolate (const Key &key) const
 
- Public Member Functions inherited from disti::GlsKeyframeCurveBase
virtual ~GlsKeyframeCurveBase ()
 Destructor.
 

Detailed Description

template<class T>
class disti::GlsKeyframeCurve< T >

Class template for keyframe curves of different types (double, Vector, etc.)

Constructor & Destructor Documentation

template<class T>
disti::GlsKeyframeCurve< T >::GlsKeyframeCurve ( const GlsKeyframeInterpolator< Value > *const  interpolator = new DefaultInterpolator())
inlineexplicit

Constructor

Parameters
interpolatorAn interpolating functor. The curve takes ownership of the functor. If unspecified, the curve defaults to a linear interpolator, except for string types where it defaults to a gated interpolator.
template<class T>
disti::GlsKeyframeCurve< T >::GlsKeyframeCurve ( typename GlsKeyframeInterpolator< Value >::PtrConst  interpolator)
inlineexplicit

Constructor

Parameters
interpolatorAn interpolating functor. The interpolator has shared ownership and can be used by multiple curves.

Member Function Documentation

template<class T>
void disti::GlsKeyframeCurve< T >::AddKeyframe ( const Key key,
const Value value,
const Key tolerance = Detail::g_glsAnimationFloatTolerance 
)
inline

Add the specified keyframe the sorted list.

Parameters
keyThe key (often time, sometimes some other units) for the curve.
valueThe value at the location of the given key.
toleranceThe tolerance for comparing floating-point keys to be equal.
Note
If the key is equal (within the given tolerance) to an existing key, the value will be replaced rather than appended.
Precondition
The key is not NaN.
template<class T>
Value disti::GlsKeyframeCurve< T >::Interpolate ( const Key key) const
inline

Interpolates the keyframes at the specified value.

Parameters
keyThe key to be interpolated in between keyframes.
Returns
If GetKeyframeCount()==0 or key is NaN, the default value is returned. If GetKeyframeCount()==1, the only value present is returned regardless of the given key. If the key is outside the range of the keyframes, the clamped value is returned. Otherwise, the value is interpolated linearly in between the keyframes.

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