#include <track_bezier.h>
Nevrax France
Definition at line 131 of file track_bezier.h.
Public Member Functions | |
virtual const IAnimatedValue & | getValue () const |
From ITrack. | |
Protected Member Functions | |
From ITrackKeyFramer | |
virtual void | compile () |
compile (precalc). | |
virtual void | evalKey (const CKeyBezierQuat *previous, const CKeyBezierQuat *next, TAnimationTime datePrevious, TAnimationTime dateNext, TAnimationTime date) |
evalKey (runtime). | |
Private Attributes | |
CAnimatedValueBlendable< CQuat > | _Value |
|
compile (precalc).
Definition at line 172 of file track_bezier.h.
00173 { 00174 ITrackKeyFramer<CKeyBezierQuat>::compile(); 00175 00176 // makeclosest quaternions, Tangents Precompute. 00177 sint nKeys= _MapKey.size(); 00178 if(nKeys<=1) 00179 return; 00180 00181 TMapTimeCKey::iterator it; 00182 TMapTimeCKey::iterator itNext; 00183 TMapTimeCKey::iterator itPrev; 00184 00185 it= _MapKey.begin(); // first key. 00186 itNext= it; itNext++; // second key. 00187 itPrev= _MapKey.end(); // end key. 00188 00189 // Compute all keys. 00190 for(;it!=_MapKey.end();) 00191 { 00192 00193 CKeyBezierQuat &key= it->second; 00194 CQuat &cur= key.Value; 00195 00196 if(itPrev!= _MapKey.end()) 00197 { 00198 cur.makeClosest(itPrev->second.Value); 00199 } 00200 00201 CQuat prev, next; 00202 00203 // compute prev / next. 00204 if(itPrev!= _MapKey.end()) 00205 prev= itPrev->second.Value; 00206 else 00207 prev= itNext->second.Value; 00208 if(itNext!= _MapKey.end()) 00209 next= itNext->second.Value; 00210 else 00211 next= itPrev->second.Value; 00212 00213 // Compute A. 00214 CQuat qm,qp,r; 00215 00216 qm = CQuat::lnDif(cur, prev); 00217 qp = CQuat::lnDif(cur, next); 00218 r = -.25f*(qm+qp); 00219 key.A= cur*(r.exp()); 00220 00221 // Next key!! 00222 itPrev= it; 00223 it++; 00224 00225 if(itNext!= _MapKey.end()) 00226 itNext++; 00227 } 00228 00229 } |
|
evalKey (runtime).
Definition at line 147 of file track_bezier.h. References NLMISC::clamp().
00150 { 00151 if(previous && next) 00152 { 00153 // lerp from previous to cur. 00154 date-= datePrevious; 00155 date*= previous->OODeltaTime; 00156 NLMISC::clamp(date, 0,1); 00157 00158 // quad slerp. 00159 _Value.Value = CQuat::squad(previous->Value, previous->A, next->A, next->Value, date); 00160 } 00161 else 00162 { 00163 if (previous) 00164 copyToValue(_Value.Value, previous->Value); 00165 else 00166 if (next) 00167 copyToValue(_Value.Value, next->Value); 00168 } 00169 } |
|
From ITrack.
Definition at line 136 of file track_bezier.h.
00137 { 00138 return _Value; 00139 } |
|
Definition at line 234 of file track_bezier.h. |