NL3D::CTrackKeyFramerTCB< CKeyT, T > Class Template Reference

#include <track_keyframer.h>

Inheritance diagram for NL3D::CTrackKeyFramerTCB< CKeyT, T >:

NL3D::ITrackKeyFramer< CKeyT > NL3D::CTCBTools< CKeyT, T, TMapTimeCKey > NL3D::ITrack NL3D::UTrackKeyframer NLMISC::IStreamable NL3D::UTrack NLMISC::IClassable NL3D::CTrackKeyFramerTCBQuat NL3D::CTrackKeyFramerTCBRGBA

Detailed Description

template<class CKeyT, class T>
class NL3D::CTrackKeyFramerTCB< CKeyT, T >

ITrack implementation for TCB keyframer.

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 861 of file track_keyframer.h.

Public Types

typedef std::map< TAnimationTime,
CKeyT > 
TMapTimeCKey

Public Member Functions

virtual bool addBezierFloatKey (const UKeyBezierFloat &key)
 Fail if not A Float Bezier Keyframer.

void addKey (const CKeyT &key, TAnimationTime time)
virtual bool addLinearFloatKey (const UKeyLinearFloat &key)
 Fail if not A Float Linear Keyframer.

virtual bool addTCBFloatKey (const UKeyTCBFloat &key)
 Fail if not A Float TCB Keyframer.

virtual void eval (const TAnimationTime &inDate)
 From ITrack.

virtual TAnimationTime getBeginTime () const
virtual std::string getClassName ()=0
virtual TAnimationTime getEndTime () const
void getKeysInRange (TAnimationTime t1, TAnimationTime t2, std::vector< TAnimationTime > &result)
virtual bool getLoopMode () const
 get LoopMode. From ITrack

TAnimationTime getRangeDelta () const
 rangeDelta is (length of effective Range) - (length of LastKey-FirstKey). NB: if RangeLock, rangeDelta==0.

virtual const IAnimatedValuegetValue () const
 From ITrack.

bool isRangeLocked () const
 return true if Range is locked to first/last key. use getBeginTime and getEndTime to get the effective begin/end range times...

void lockRange ()
 range is computed from frist and last key time (default).

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 Serial the template.

void setLoopMode (bool loop)
 set LoopMode. 2 mode only: "constant" (<=>false), and "loop" (<=> true). same mode for in and out...

void unlockRange (TAnimationTime begin, TAnimationTime end)
 set an explicit animation range. (see getBeginTime() / setEndTime() ).


Static Public Member Functions

UTrackKeyframercreateBezierFloatTrack ()
UTrackKeyframercreateLinearFloatTrack ()
UTrackKeyframercreateTCBFloatTrack ()

Protected Types

typedef CKeyT::TValueType TKeyValueType

Protected Member Functions

float getCompiledRangeDelta ()
 This is for Deriver compile(), because _RangeDelta (getRangeDelta()) is himself computed in compile().


Protected Attributes

TMapTimeCKey _MapKey

Private Types

typedef TMapTimeCKey::iterator TMapTimeCKeyIterator

Private Member Functions

void compileTCBEase (TMapTimeCKey &mapKey, bool loopMode)
 compute TCB ease information.

void computeFirstKey (CKeyT &keyFirst, CKeyT &keyAfter)
void computeHermiteBasis (float d, float hb[4])
void computeLastKey (CKeyT &keyLast, CKeyT &keyBefore)
void computeTCBFactors (const CKeyT &key, float timeBefore, float time, float timeAfter, float rangeDelta, bool firstKey, bool endKey, bool isLoop, float &ksm, float &ksp, float &kdm, float &kdp)
void computeTCBKey (CKeyT &keyBefore, CKeyT &key, CKeyT &keyAfter, float timeBefore, float time, float timeAfter, float rangeDelta, bool firstKey, bool endKey, bool isLoop)
void computeTCBKeyLinear (CKeyT &key0, CKeyT &key1)
float ease (const CKeyT *key, float d)

Private Attributes

CAnimatedValueBlendable< T > _Value


Member Typedef Documentation

template<class CKeyT, class T>
typedef CKeyT::TValueType NL3D::CTrackKeyFramerTCB< CKeyT, T >::TKeyValueType [protected]
 

Definition at line 874 of file track_keyframer.h.

template<class CKeyT>
typedef std::map<TAnimationTime, CKeyT> NL3D::ITrackKeyFramer< CKeyT >::TMapTimeCKey [inherited]
 

Definition at line 65 of file track_keyframer.h.

template<class CKeyT, class T, class TMapTimeCKey>
typedef TMapTimeCKey::iterator NL3D::CTCBTools< CKeyT, T, TMapTimeCKey >::TMapTimeCKeyIterator [protected, inherited]
 

Definition at line 710 of file track_keyframer.h.


Member Function Documentation

virtual bool NL3D::UTrackKeyframer::addBezierFloatKey const UKeyBezierFloat key  )  [inline, virtual, inherited]
 

Fail if not A Float Bezier Keyframer.

Reimplemented in NL3D::CTrackKeyFramerBezierFloat.

Definition at line 220 of file u_track.h.

00220 {return false;}

template<class CKeyT>
void NL3D::ITrackKeyFramer< CKeyT >::addKey const CKeyT &  key,
TAnimationTime  time
[inline, inherited]
 

Add a key in the keyframer.

The key passed is duplicated in the track.

Parameters:
key is the key value to add in the keyframer.
time is the time of the key to add in the keyframer.

Definition at line 90 of file track_keyframer.h.

00091         {
00092                 // Insert the key in the map
00093                 _MapKey.insert (TMapTimeCKey::value_type (time, key));
00094 
00095                 // must precalc at next eval.
00096                 _Dirty= true;
00097         }

virtual bool NL3D::UTrackKeyframer::addLinearFloatKey const UKeyLinearFloat key  )  [inline, virtual, inherited]
 

Fail if not A Float Linear Keyframer.

Reimplemented in NL3D::CTrackKeyFramerLinearFloat.

Definition at line 218 of file u_track.h.

00218 {return false;}

virtual bool NL3D::UTrackKeyframer::addTCBFloatKey const UKeyTCBFloat key  )  [inline, virtual, inherited]
 

Fail if not A Float TCB Keyframer.

Reimplemented in NL3D::CTrackKeyFramerTCBFloat.

Definition at line 222 of file u_track.h.

00222 {return false;}

template<class CKeyT, class T>
virtual void NL3D::CTrackKeyFramerTCB< CKeyT, T >::compile  )  [inline, protected, virtual]
 

compile (precalc).

Reimplemented from NL3D::ITrackKeyFramer< CKeyT >.

Definition at line 912 of file track_keyframer.h.

template<class CKeyT, class T, class TMapTimeCKey>
void NL3D::CTCBTools< CKeyT, T, TMapTimeCKey >::compileTCBEase TMapTimeCKey &  mapKey,
bool  loopMode
[inline, protected, inherited]
 

compute TCB ease information.

Definition at line 715 of file track_keyframer.h.

00718         {
00719                 CKeyFloat       k;
00720                 k.Value= key.Value;
00721                 addKey(k, key.Time);
00722                 return true;
00723         }       
00724 };
00725 class CTrackKeyFramerLinearVector : public CTrackKeyFramerLinear<CKeyVector, CVector>
00726 {
00727 public:
00728         NLMISC_DECLARE_CLASS (CTrackKeyFramerLinearVector);
00729 };
00730 class CTrackKeyFramerLinearQuat : public CTrackKeyFramerLinear<CKeyQuat, CQuat>
00731 {
00732 public:
00733         NLMISC_DECLARE_CLASS (CTrackKeyFramerLinearQuat);
00734 };
00735 class CTrackKeyFramerLinearInt : public CTrackKeyFramerLinear<CKeyInt, sint32>
00736 {
00737 public:
00738         NLMISC_DECLARE_CLASS (CTrackKeyFramerLinearInt);
00739 };
00740 class CTrackKeyFramerLinearRGBA : public CTrackKeyFramerLinear<CKeyRGBA, NLMISC::CRGBA>
00741 {
00742 public:
00743         NLMISC_DECLARE_CLASS (CTrackKeyFramerLinearRGBA);
00744 };
00745 
00746 
00747 // TCB tracks.
00748 class CTrackKeyFramerTCBFloat : public CTrackKeyFramerTCB<CKeyTCBFloat, float>
00749 {
00750 public:
00751         NLMISC_DECLARE_CLASS (CTrackKeyFramerTCBFloat);
00752 
00753         virtual bool    addTCBFloatKey(const UKeyTCBFloat &key)
00754         {
00755                 CKeyTCBFloat    k;
00756                 k.Value= key.Value;
00757                 k.Bias= key.Bias;
00758                 k.Continuity= key.Continuity;
00759                 k.Tension= key.Tension;

template<class CKeyT, class T>
void NL3D::CTrackKeyFramerTCB< CKeyT, T >::computeFirstKey CKeyT &  keyFirst,
CKeyT &  keyAfter
[inline, private]
 

Definition at line 1018 of file track_keyframer.h.

template<class CKeyT, class T, class TMapTimeCKey>
void NL3D::CTCBTools< CKeyT, T, TMapTimeCKey >::computeHermiteBasis float  d,
float  hb[4]
[inline, protected, inherited]
 

Definition at line 780 of file track_keyframer.h.

00782                              : public CTrackKeyFramerTCB<CKeyTCBVector, NLMISC::CRGBA>
00783 {
00784 public:
00785         NLMISC_DECLARE_CLASS (CTrackKeyFramerTCBRGBA);
00786 };
00787 
00788 
00789 // Bezier tracks.
00790 class CTrackKeyFramerBezierFloat : public CTrackKeyFramerBezier<CKeyBezierFloat, float>
00791 {

template<class CKeyT, class T>
void NL3D::CTrackKeyFramerTCB< CKeyT, T >::computeLastKey CKeyT &  keyLast,
CKeyT &  keyBefore
[inline, private]
 

Definition at line 1026 of file track_keyframer.h.

template<class CKeyT, class T, class TMapTimeCKey>
void NL3D::CTCBTools< CKeyT, T, TMapTimeCKey >::computeTCBFactors const CKeyT &  key,
float  timeBefore,
float  time,
float  timeAfter,
float  rangeDelta,
bool  firstKey,
bool  endKey,
bool  isLoop,
float &  ksm,
float &  ksp,
float &  kdm,
float &  kdp
[inline, protected, inherited]
 

Definition at line 795 of file track_keyframer.h.

00796         {
00797                 CKeyBezierFloat k;
00798                 k.Value= key.Value;
00799                 k.InTan= key.TanIn;
00800                 k.OutTan= key.TanOut;
00801                 k.Step= key.Step;
00802                 addKey(k, key.Time);
00803                 return true;
00804         }       
00805 };
00806 class CTrackKeyFramerBezierVector : public CTrackKeyFramerBezier<CKeyBezierVector, CVector>
00807 {
00808 public:
00809         NLMISC_DECLARE_CLASS (CTrackKeyFramerBezierVector);
00810 };
00811 class CTrackKeyFramerBezierQuat : public CTrackKeyFramerBezier<CKeyBezierQuat, CQuat>
00812 {
00813 public:
00814         NLMISC_DECLARE_CLASS (CTrackKeyFramerBezierQuat);
00815 };
00816 class CTrackKeyFramerBezierInt : public CTrackKeyFramerBezier<CKeyBezierFloat, sint32>
00817 {
00818 public:
00819         NLMISC_DECLARE_CLASS (CTrackKeyFramerBezierInt);
00820 };
00821 class CTrackKeyFramerBezierRGBA : public CTrackKeyFramerBezier<CKeyBezierVector, NLMISC::CRGBA>
00822 {
00823 public:
00824         NLMISC_DECLARE_CLASS (CTrackKeyFramerBezierRGBA);
00825 };
00826 
00827 
00828 
00829 
00830 
00831 } // NL3D
00832 
00833 
00834 #endif // NL_TRACK_KEYFRAMER_H
00835 
00836 /* End of track_keyframer.h */
00837 /* End of track_keyframer.h */

template<class CKeyT, class T>
void NL3D::CTrackKeyFramerTCB< CKeyT, T >::computeTCBKey CKeyT &  keyBefore,
CKeyT &  key,
CKeyT &  keyAfter,
float  timeBefore,
float  time,
float  timeAfter,
float  rangeDelta,
bool  firstKey,
bool  endKey,
bool  isLoop
[inline, private]
 

Definition at line 985 of file track_keyframer.h.

template<class CKeyT, class T>
void NL3D::CTrackKeyFramerTCB< CKeyT, T >::computeTCBKeyLinear CKeyT &  key0,
CKeyT &  key1
[inline, private]
 

Definition at line 1005 of file track_keyframer.h.

UTrackKeyframer * NL3D::UTrackKeyframer::createBezierFloatTrack  )  [static, inherited]
 

Definition at line 87 of file track_keyframer.cpp.

00088 {
00089         return new CTrackKeyFramerBezierFloat;
00090 }

UTrackKeyframer * NL3D::UTrackKeyframer::createLinearFloatTrack  )  [static, inherited]
 

Definition at line 83 of file track_keyframer.cpp.

00084 {
00085         return new CTrackKeyFramerLinearFloat;
00086 }

UTrackKeyframer * NL3D::UTrackKeyframer::createTCBFloatTrack  )  [static, inherited]
 

Definition at line 91 of file track_keyframer.cpp.

00092 {
00093         return new CTrackKeyFramerTCBFloat;
00094 }

template<class CKeyT, class T, class TMapTimeCKey>
float NL3D::CTCBTools< CKeyT, T, TMapTimeCKey >::ease const CKeyT *  key,
float  d
[inline, protected, inherited]
 

Definition at line 762 of file track_keyframer.h.

00767                                : public CTrackKeyFramerTCB<CKeyTCBVector, CVector>
00768 {
00769 public:
00770         NLMISC_DECLARE_CLASS (CTrackKeyFramerTCBVector);
00771 };
00772 class CTrackKeyFramerTCBQuat : public CTrackKeyFramerTCB<CKeyTCBQuat, NLMISC::CAngleAxis>
00773 {
00774 public:
00775         NLMISC_DECLARE_CLASS (CTrackKeyFramerTCBQuat);
00776 };
00777 class CTrackKeyFramerTCBInt : public CTrackKeyFramerTCB<CKeyTCBFloat, sint32>

template<class CKeyT>
virtual void NL3D::ITrackKeyFramer< CKeyT >::eval const TAnimationTime inDate  )  [inline, virtual, inherited]
 

From ITrack.

Implements NL3D::ITrack.

Definition at line 137 of file track_keyframer.h.

00138         {
00139                 float   date= inDate;
00140                 const CKeyT *previous=NULL;
00141                 const CKeyT *next=NULL;
00142                 TAnimationTime datePrevious = 0;
00143                 TAnimationTime dateNext = 0;
00144 
00145                 // must precalc ??
00146                 testAndClean();
00147 
00148                 // No keys?
00149                 if(_MapKey.empty())
00150                         return;
00151 
00152 
00153                 // Loop gestion.
00154                 if(_LoopMode && _MapKey.size()>1 )
00155                 {
00156                         nlassert(_LoopEnd > _LoopStart);
00157 
00158                         // force us to be in interval [_LoopStart, _LoopEnd[.
00159                         if( date<_LoopStart || date>=_LoopEnd )
00160                         {
00161                                 double  d= (date-_LoopStart)*_OOTotalRange;
00162 
00163                                 // floor(d) is the truncated number of loops.
00164                                 d= date- floor(d)*_TotalRange;
00165                                 date= (float)d;
00166 
00167                                 // For precision problems, ensure correct range.
00168                                 if(date<_LoopStart || date >= _LoopEnd)
00169                                         date= _LoopStart;
00170                         }
00171                 }
00172 
00173 
00174                 // Return upper key
00175                 typename TMapTimeCKey::iterator ite=_MapKey.upper_bound (date);
00176 
00177                 // First next ?
00178                 if (ite!=_MapKey.end())
00179                 {
00180                         // Next
00181                         next= &(ite->second);
00182                         dateNext=ite->first;
00183                 }
00184                 // loop mgt.
00185                 else if (_LoopMode && _MapKey.size()>1 )
00186                 {
00187                         // loop to first!!
00188                         next= &(_MapKey.begin()->second);
00189                         // must slerp from last to first, 
00190                         dateNext= _LoopEnd;
00191                 }
00192                 else if (!_LoopMode && _MapKey.size()>=1 )
00193                 {
00194                         // clamp to the last
00195                         typename TMapTimeCKey::iterator iteLast= ite;
00196                         iteLast--;
00197                         next= &(iteLast->second);
00198                 }
00199 
00200 
00201                 // First previous ?
00202                 if ((!_MapKey.empty())&&(ite!=_MapKey.begin()))
00203                 {
00204                         if (ite!=_MapKey.end())
00205                         {
00206                                 // Previous
00207                                 ite--;
00208                                 previous= &(ite->second);
00209                                 datePrevious=ite->first;
00210                         }
00211                 }
00212                 else if (!_MapKey.empty())
00213                 {
00214                         // Clamp at beginTime
00215                         next= &(ite->second);
00216                         dateNext=ite->first;
00217                 }
00218 
00219                 // Call evalutation fonction
00220                 evalKey (previous, next, datePrevious, dateNext, date);
00221         }

template<class CKeyT, class T>
virtual void NL3D::CTrackKeyFramerTCB< CKeyT, T >::evalKey const CKeyT *  previous,
const CKeyT *  next,
TAnimationTime  datePrevious,
TAnimationTime  dateNext,
TAnimationTime  date
[inline, protected, virtual]
 

evalKey (runtime).

Implements NL3D::ITrackKeyFramer< CKeyT >.

Definition at line 882 of file track_keyframer.h.

template<class CKeyT>
virtual TAnimationTime NL3D::ITrackKeyFramer< CKeyT >::getBeginTime  )  const [inline, virtual, inherited]
 

Get the begin time of the track

Implements NL3D::UTrack.

Definition at line 224 of file track_keyframer.h.

00225         {
00226                 // must precalc ??
00227                 testAndClean();
00228 
00229                 return _RangeBegin;
00230         }

virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
 

Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc.

Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

template<class CKeyT>
float NL3D::ITrackKeyFramer< CKeyT >::getCompiledRangeDelta  )  [inline, protected, inherited]
 

This is for Deriver compile(), because _RangeDelta (getRangeDelta()) is himself computed in compile().

Definition at line 291 of file track_keyframer.h.

00292         {
00293                 return _RangeDelta;
00294         }

template<class CKeyT>
virtual TAnimationTime NL3D::ITrackKeyFramer< CKeyT >::getEndTime  )  const [inline, virtual, inherited]
 

Get the end time of the track

Implements NL3D::UTrack.

Definition at line 231 of file track_keyframer.h.

00232         {
00233                 // must precalc ??
00234                 testAndClean();
00235 
00236                 return _RangeEnd;
00237         }

template<class T>
void NL3D::ITrackKeyFramer< T >::getKeysInRange TAnimationTime  t1,
TAnimationTime  t2,
std::vector< TAnimationTime > &  result
[virtual, inherited]
 

From UTrackKeyframer, retrieve the keys that are in the given range [t1, t2] of the track

Parameters:
result a vector that will be cleared, and filled with the date ofthe keys

Implements NL3D::UTrackKeyframer.

Definition at line 35 of file track_keyframer.cpp.

References NL3D::ITrackKeyFramer< CKeyT >::_MapKey, nlassert, and NL3D::TAnimationTime.

00036 {
00037         nlassert(t1 <= t2);
00038         typename TMapTimeCKey::const_iterator it = _MapKey.lower_bound(t1);
00039         typename TMapTimeCKey::const_iterator ub = _MapKey.upper_bound(t2);
00040         result.clear();         
00041         while (it != ub)
00042         {                       
00043                 result.push_back(it->first);
00044                 ++it;
00045         }
00046 }

template<class CKeyT>
virtual bool NL3D::ITrackKeyFramer< CKeyT >::getLoopMode  )  const [inline, virtual, inherited]
 

get LoopMode. From ITrack

Implements NL3D::ITrack.

Definition at line 133 of file track_keyframer.h.

00133 {return _LoopMode;}

template<class CKeyT>
TAnimationTime NL3D::ITrackKeyFramer< CKeyT >::getRangeDelta  )  const [inline, inherited]
 

rangeDelta is (length of effective Range) - (length of LastKey-FirstKey). NB: if RangeLock, rangeDelta==0.

Definition at line 120 of file track_keyframer.h.

00121         {
00122                 // update track.
00123                 testAndClean();
00124 
00125                 return _RangeDelta;
00126         }

template<class CKeyT, class T>
virtual const IAnimatedValue& NL3D::CTrackKeyFramerTCB< CKeyT, T >::getValue  )  const [inline, virtual]
 

From ITrack.

Implements NL3D::ITrack.

Definition at line 866 of file track_keyframer.h.

bool NL3D::ITrack::interpolate TAnimationTime  time,
bool &  res
[virtual, inherited]
 

Interplation a bool value. You should be sure that the track you use to interpolate your value is a bool track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 202 of file track.cpp.

References NL3D::CAnimatedValueBool, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, NL3D::TAnimationTime, and value.

00203 {
00204         NL3D_HAUTO_UTRACK_INTERPOLATE;
00205 
00206         // Evaluate it 
00207         eval (time);
00208 
00209         // Get a pointer on the value
00210         const CAnimatedValueBool *value=dynamic_cast<const CAnimatedValueBool*>(&getValue ());
00211 
00212         // Type is good ?
00213         if (value)
00214         {
00215                 // Ok, return the value
00216                 res=value->Value;
00217                 return true;
00218         }
00219         else
00220                 // No, return false
00221                 return false;
00222 }

bool NL3D::ITrack::interpolate TAnimationTime  time,
std::string &  res
[virtual, inherited]
 

Interplation a string value. You should be sure that the track you use to interpolate your value is a string track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 178 of file track.cpp.

References NL3D::CAnimatedValueString, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, NL3D::TAnimationTime, and value.

00179 {
00180         NL3D_HAUTO_UTRACK_INTERPOLATE;
00181 
00182         // Evaluate it 
00183         eval (time);
00184 
00185         // Get a pointer on the value
00186         const CAnimatedValueString *value=dynamic_cast<const CAnimatedValueString*>(&getValue ());
00187 
00188         // Type is good ?
00189         if (value)
00190         {
00191                 // Ok, return the value
00192                 res=value->Value;
00193                 return true;
00194         }
00195         else
00196                 // No, return false
00197                 return false;
00198 }

bool NL3D::ITrack::interpolate TAnimationTime  time,
NLMISC::CQuat res
[virtual, inherited]
 

Interplation a CQuat value. You should be sure that the track you use to interpolate your value is a CQuat track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 154 of file track.cpp.

References NL3D::CAnimatedValueQuat, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, NL3D::TAnimationTime, and value.

00155 {
00156         NL3D_HAUTO_UTRACK_INTERPOLATE;
00157 
00158         // Evaluate it 
00159         eval (time);
00160 
00161         // Get a pointer on the value
00162         const CAnimatedValueQuat *value=dynamic_cast<const CAnimatedValueQuat*>(&getValue ());
00163 
00164         // Type is good ?
00165         if (value)
00166         {
00167                 // Ok, return the value
00168                 res=value->Value;
00169                 return true;
00170         }
00171         else
00172                 // No, return false
00173                 return false;
00174 }

bool NL3D::ITrack::interpolate TAnimationTime  time,
NLMISC::CVector res
[virtual, inherited]
 

Interplation a CVector value. You should be sure that the track you use to interpolate your value is a CVector track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 130 of file track.cpp.

References NL3D::CAnimatedValueVector, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, NL3D::TAnimationTime, and value.

00131 {
00132         NL3D_HAUTO_UTRACK_INTERPOLATE;
00133 
00134         // Evaluate it 
00135         eval (time);
00136 
00137         // Get a pointer on the value
00138         const CAnimatedValueVector *value=dynamic_cast<const CAnimatedValueVector*>(&getValue ());
00139 
00140         // Type is good ?
00141         if (value)
00142         {
00143                 // Ok, return the value
00144                 res=value->Value;
00145                 return true;
00146         }
00147         else
00148                 // No, return false
00149                 return false;
00150 }

bool NL3D::ITrack::interpolate TAnimationTime  time,
NLMISC::CRGBA res
[virtual, inherited]
 

Interplation a CRGBA value. You should be sure that the track you use to interpolate your value is an CRGBA track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 106 of file track.cpp.

References NL3D::CAnimatedValueRGBA, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, NL3D::TAnimationTime, and value.

00107 {
00108         NL3D_HAUTO_UTRACK_INTERPOLATE;
00109 
00110         // Evaluate it 
00111         eval (time);
00112 
00113         // Get a pointer on the value
00114         const CAnimatedValueRGBA *value=dynamic_cast<const CAnimatedValueRGBA*>(&getValue ());
00115 
00116         // Type is good ?
00117         if (value)
00118         {
00119                 // Ok, return the value
00120                 res=value->Value;
00121                 return true;
00122         }
00123         else
00124                 // No, return false
00125                 return false;
00126 }

bool NL3D::ITrack::interpolate TAnimationTime  time,
sint32 res
[virtual, inherited]
 

Interplation an integer value. You should be sure that the track you use to interpolate your value is an integer track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

Definition at line 82 of file track.cpp.

References NL3D::CAnimatedValueInt, NL3D::ITrack::eval(), NL3D::ITrack::getValue(), NL3D_HAUTO_UTRACK_INTERPOLATE, res, sint32, NL3D::TAnimationTime, and value.

00083 {
00084         NL3D_HAUTO_UTRACK_INTERPOLATE;
00085 
00086         // Evaluate it 
00087         eval (time);
00088 
00089         // Get a pointer on the value
00090         const CAnimatedValueInt *value=dynamic_cast<const CAnimatedValueInt*>(&getValue ());
00091 
00092         // Type is good ?
00093         if (value)
00094         {
00095                 // Ok, return the value
00096                 res=value->Value;
00097                 return true;
00098         }
00099         else
00100                 // No, return false
00101                 return false;
00102 }

virtual bool NL3D::ITrack::interpolate TAnimationTime  time,
float &  res
[virtual, inherited]
 

Interplation a float value. You should be sure that the track you use to interpolate your value is a float track! An assertion will be raised in debug if the type is wrong.

Parameters:
time is the time you want the evaluate the value. If time higher than the time gived by getEndTime (), the value returned is the interpolation value at getEndTime (). If time smaller than the time gived by getBeginTime (), the value returned is the interpolation value at getBeginTime ().
res is the reference on the value to get the result.
Returns:
true if interplation is successful. false if the type asked is wrong.

Implements NL3D::UTrack.

template<class CKeyT>
bool NL3D::ITrackKeyFramer< CKeyT >::isRangeLocked  )  const [inline, inherited]
 

return true if Range is locked to first/last key. use getBeginTime and getEndTime to get the effective begin/end range times...

Definition at line 116 of file track_keyframer.h.

00116 {return _RangeLock;}

template<class CKeyT>
void NL3D::ITrackKeyFramer< CKeyT >::lockRange  )  [inline, inherited]
 

range is computed from frist and last key time (default).

Definition at line 109 of file track_keyframer.h.

00110         {
00111                 _RangeLock= true;
00112                 _Dirty= true;
00113         }

template<class CKeyT>
virtual void NL3D::ITrackKeyFramer< CKeyT >::serial NLMISC::IStream f  )  throw (NLMISC::EStream) [inline, virtual, inherited]
 

Serial the template.

Implements NLMISC::IStreamable.

Definition at line 241 of file track_keyframer.h.

00242         {
00243                 // Serial version
00244                 (void)f.serialVersion (0);
00245 
00246                 f.serialCont(_MapKey);
00247                 f.serial(_RangeLock, _RangeBegin, _RangeEnd);
00248                 f.serial(_LoopMode);
00249 
00250                 if(f.isReading())
00251                         _Dirty= true;
00252         }

template<class CKeyT>
void NL3D::ITrackKeyFramer< CKeyT >::setLoopMode bool  loop  )  [inline, inherited]
 

set LoopMode. 2 mode only: "constant" (<=>false), and "loop" (<=> true). same mode for in and out...

Definition at line 130 of file track_keyframer.h.

00130 {_LoopMode= loop; _Dirty= true;}

template<class CKeyT>
void NL3D::ITrackKeyFramer< CKeyT >::unlockRange TAnimationTime  begin,
TAnimationTime  end
[inline, inherited]
 

set an explicit animation range. (see getBeginTime() / setEndTime() ).

Definition at line 100 of file track_keyframer.h.

00101         {
00102                 _RangeLock= false;
00103                 _RangeBegin= begin;
00104                 _RangeEnd= end;
00105                 _Dirty= true;
00106         }


Field Documentation

template<class CKeyT>
TMapTimeCKey NL3D::ITrackKeyFramer< CKeyT >::_MapKey [protected, inherited]
 

Definition at line 287 of file track_keyframer.h.

Referenced by NL3D::ITrackKeyFramer< CKeyT >::getKeysInRange().

template<class CKeyT, class T>
CAnimatedValueBlendable<T> NL3D::CTrackKeyFramerTCB< CKeyT, T >::_Value [private]
 

Definition at line 981 of file track_keyframer.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 08:12:13 2004 for NeL by doxygen 1.3.6