#include <track_keyframer.h>
Inheritance diagram for NL3D::CTrackKeyFramerTCB< CKeyT, T >:
Nevrax France
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 IAnimatedValue & | getValue () 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 | |
UTrackKeyframer * | createBezierFloatTrack () |
UTrackKeyframer * | createLinearFloatTrack () |
UTrackKeyframer * | createTCBFloatTrack () |
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 |
|
Definition at line 874 of file track_keyframer.h. |
|
Definition at line 65 of file track_keyframer.h. |
|
Definition at line 710 of file track_keyframer.h. |
|
Fail if not A Float Bezier Keyframer.
Reimplemented in NL3D::CTrackKeyFramerBezierFloat. Definition at line 220 of file u_track.h.
00220 {return false;} |
|
Add a key in the keyframer. The key passed is duplicated in the track.
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 } |
|
Fail if not A Float Linear Keyframer.
Reimplemented in NL3D::CTrackKeyFramerLinearFloat. Definition at line 218 of file u_track.h.
00218 {return false;} |
|
Fail if not A Float TCB Keyframer.
Reimplemented in NL3D::CTrackKeyFramerTCBFloat. Definition at line 222 of file u_track.h.
00222 {return false;} |
|
compile (precalc).
Reimplemented from NL3D::ITrackKeyFramer< CKeyT >. Definition at line 912 of file track_keyframer.h. |
|
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; |
|
Definition at line 1018 of file track_keyframer.h. |
|
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 { |
|
Definition at line 1026 of file track_keyframer.h. |
|
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 */ |
|
Definition at line 985 of file track_keyframer.h. |
|
Definition at line 1005 of file track_keyframer.h. |
|
Definition at line 87 of file track_keyframer.cpp.
00088 { 00089 return new CTrackKeyFramerBezierFloat; 00090 } |
|
Definition at line 83 of file track_keyframer.cpp.
00084 { 00085 return new CTrackKeyFramerLinearFloat; 00086 } |
|
Definition at line 91 of file track_keyframer.cpp.
00092 { 00093 return new CTrackKeyFramerTCBFloat; 00094 } |
|
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> |
|
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 } |
|
evalKey (runtime).
Implements NL3D::ITrackKeyFramer< CKeyT >. Definition at line 882 of file track_keyframer.h. |
|
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 } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
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 }
|
|
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 } |
|
From UTrackKeyframer, retrieve the keys that are in the given range [t1, t2] of the track
Implements NL3D::UTrackKeyframer. Definition at line 35 of file track_keyframer.cpp. References NL3D::ITrackKeyFramer< CKeyT >::_MapKey, nlassert, and NL3D::TAnimationTime.
|
|
get LoopMode. From ITrack
Implements NL3D::ITrack. Definition at line 133 of file track_keyframer.h.
00133 {return _LoopMode;}
|
|
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 } |
|
From ITrack.
Implements NL3D::ITrack. Definition at line 866 of file track_keyframer.h. |
|
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.
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 } |
|
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.
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 } |
|
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.
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 } |
|
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.
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 } |
|
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.
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 } |
|
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.
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 } |
|
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.
Implements NL3D::UTrack. |
|
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;}
|
|
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 } |
|
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 } |
|
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;}
|
|
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 } |
|
Definition at line 287 of file track_keyframer.h. Referenced by NL3D::ITrackKeyFramer< CKeyT >::getKeysInRange(). |
|
Definition at line 981 of file track_keyframer.h. |