From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03583.html | 890 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 890 insertions(+) create mode 100644 docs/doxygen/nel/a03583.html (limited to 'docs/doxygen/nel/a03583.html') diff --git a/docs/doxygen/nel/a03583.html b/docs/doxygen/nel/a03583.html new file mode 100644 index 00000000..69cefa86 --- /dev/null +++ b/docs/doxygen/nel/a03583.html @@ -0,0 +1,890 @@ + + +NeL: CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis > class Reference + + + +
+

CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis > Class Reference

#include <track_tcb.h> +

+

Inheritance diagram for CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >: +

+ +CTCBTools< CKeyT, T, TMapTimeCKey > + +

Detailed Description

+ITrack implementation for CQuat TCB keyframer.

+

Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 386 of file track_tcb.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

virtual const IAnimatedValue & getValue () const
 From ITrack.

From ITrackKeyFramer
virtual void compile ()
 compile (precalc).

virtual void evalKey (const CKeyTCBQuat *previous, const CKeyTCBQuat *next, TAnimationTime datePrevious, TAnimationTime dateNext, TAnimationTime date)
 evalKey (runtime).


Private Types

typedef TMapTimeCKey::iterator TMapTimeCKeyIterator

Private Member Functions

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

void computeHermiteBasis (float d, float hb[4])
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 (CKeyTCBQuat &keyBefore, CKeyTCBQuat &key, CKeyTCBQuat &keyAfter, float timeBefore, float time, float timeAfter, float rangeDelta, bool firstKey, bool endKey, bool isLoop)
float ease (const CKeyT *key, float d)

Private Attributes

CAnimatedValueBlendable< CQuat > _Value
+


Member Typedef Documentation

+

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

+ +

+Definition at line 51 of file track_tcb.h.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
virtual void CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::compile  )  [inline, virtual]
+
+ + + + + +
+   + + +

+compile (precalc). +

+ +

+Definition at line 430 of file track_tcb.h. +

+References CTCBTools< CKeyT, T, TMapTimeCKey >::compileTCBEase(), CTrackKeyFramerTCB< CKeyT, T >::computeTCBKey(), NLMISC::CMatrix::invert(), NLMISC::CMatrix::normalize(), NLMISC::CMatrix::setRot(), and sint. +

+

00431         {
+00432                 ITrackKeyFramer<CKeyTCBQuat>::compile();
+00433 
+00434                 // Ease Precompute.
+00435                 compileTCBEase(_MapKey, getLoopMode());
+00436 
+00437                 TMapTimeCKey::iterator  it;
+00438                 TMapTimeCKey::iterator  itNext;
+00439                 TMapTimeCKey::iterator  itPrev;
+00440 
+00441                 // Compute absolute quaternions.
+00442                 for (it= _MapKey.begin();it!=_MapKey.end();)
+00443                 {
+00444                         CKeyTCBQuat             &key= it->second;
+00445 
+00446                         // Compute Local AngleAxis.
+00447                         if(it!= _MapKey.begin())
+00448                         {
+00449                                 NLMISC::CMatrix         mat;
+00450                                 mat.setRot(itPrev->second.Quat);
+00451                                 mat.invert();
+00452                                 key.LocalAngleAxis.Axis= mat*key.Value.Axis;
+00453                                 key.LocalAngleAxis.Angle= key.Value.Angle;
+00454                         }
+00455                         else
+00456                                 key.LocalAngleAxis= key.Value;
+00457 
+00458 
+00459                         key.LocalAngleAxis.Axis.normalize();
+00460                         // make angle positive.
+00461                         if(key.LocalAngleAxis.Angle<0.f)
+00462                         {
+00463                                 key.LocalAngleAxis.Axis= -key.LocalAngleAxis.Axis;
+00464                                 key.LocalAngleAxis.Angle= -key.LocalAngleAxis.Angle;
+00465                         }
+00466 
+00467                         // relative quat
+00468                         key.Quat.setAngleAxis(key.LocalAngleAxis);
+00469 
+00470                         // absolute quat
+00471                         if (it!= _MapKey.begin())
+00472                                 key.Quat = itPrev->second.Quat * key.Quat;
+00473 
+00474                         // next key.
+00475                         itPrev= it;
+00476                         it++;
+00477                 }
+00478 
+00479                 // Tangents Precompute.
+00480                 sint    nKeys= _MapKey.size();
+00481                 if(nKeys<=1)
+00482                         return;
+00483 
+00484                 // rangeDelta is the length of effective Range - length of LastKey-FirstKey.
+00485                 // NB: if RangeLock, rangeDelta==0.
+00486                 float   rangeDelta;
+00487                 // NB: _RangeDelta has just been compiled in ITrackKeyFramer<CKeyTCBQuat>::compile().
+00488                 rangeDelta= getCompiledRangeDelta();
+00489 
+00490                 it= _MapKey.begin();                            // first key.
+00491                 itNext= it; itNext++;                           // second key.
+00492                 itPrev= _MapKey.end(); itPrev--;        // last key.
+00493 
+00494                 // Compute all keys.
+00495                 for(;it!=_MapKey.end();)
+00496                 {
+00497                         // NB: we are the last key if itNext==_MapKey.begin().
+00498                         computeTCBKey(itPrev->second, it->second, itNext->second, 
+00499                                 itPrev->first, it->first, itNext->first, rangeDelta, it==_MapKey.begin(), itNext==_MapKey.begin(), getLoopMode());
+00500 
+00501                         // Next key!!
+00502                         itPrev= it;
+00503                         it++;
+00504                         itNext++;
+00505                         // loop.
+00506                         if(itNext==_MapKey.end())
+00507                                 itNext= _MapKey.begin();
+00508                 }
+00509 
+00510         }
+
+

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

+compute TCB ease information. +

+ +

+Definition at line 56 of file track_tcb.h. +

+Referenced by compile(), and CTrackKeyFramerTCB< CKeyT, T >::compile(). +

+

00057         {
+00058                 TMapTimeCKeyIterator    it= mapKey.begin();
+00059                 for(;it!=mapKey.end();it++)
+00060                 {
+00061                         TMapTimeCKeyIterator    next= it;
+00062                         next++;
+00063 
+00064                         // loop mgt. must compute ease from last to first (usefull if _RangeLock is false).
+00065                         if(next==mapKey.end() && loopMode && mapKey.size()>1)
+00066                                 next= mapKey.begin();
+00067 
+00068                         // Ease Precompute.
+00069                         //=================
+00070                         CKeyT   &key= it->second;
+00071                         if(next!=mapKey.end())
+00072                         {
+00073                                 float   e0= it->second.EaseFrom;
+00074                                 float   e1= next->second.EaseTo;
+00075                                 float   s =  e0 + e1;
+00076                                 
+00077                                 // "normalize".
+00078                                 if (s > 1.0f)
+00079                                 {
+00080                                         e0 = e0/s;
+00081                                         e1 = e1/s;
+00082                                 }
+00083 
+00084                                 // precalc ease factors.
+00085                                 key.Ease0= e0;
+00086                                 key.Ease1= e1;
+00087                                 key.EaseK= 1/(2.0f - e0 - e1);
+00088                                 if(e0)
+00089                                         key.EaseKOverEase0= key.EaseK / e0;
+00090                                 if(e1)
+00091                                         key.EaseKOverEase1= key.EaseK / e1;
+00092                         }
+00093                         else
+00094                         {
+00095                                 // force ease() to just return d (see ease()).
+00096                                 key.EaseK = 0.5f;
+00097                         }
+00098 
+00099                 }
+00100         }
+
+

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

+ +

+Definition at line 121 of file track_tcb.h. +

+Referenced by CTrackKeyFramerTCB< CKeyT, T >::evalKey(). +

+

00122         {
+00123                 float d2,d3,a;
+00124                 
+00125                 d2 = d*d;
+00126                 d3 = d2*d;
+00127                 a  = 3.0f*d2 - 2.0f*d3;
+00128                 hb[0] = 1.0f - a;
+00129                 hb[1] = a;
+00130                 hb[2] = d3 - 2.0f*d2 + d;
+00131                 hb[3] = d3 - d2;
+00132         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+template<class CKeyT, class T, class TMapTimeCKey>
void 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 136 of file track_tcb.h. +

+Referenced by computeTCBKey(), and CTrackKeyFramerTCB< CKeyT, T >::computeTCBKey(). +

+

00138         {
+00139                 float fp,fn;
+00140 
+00141                 if(isLoop || (!firstKey && !endKey))
+00142                 {
+00143                         float   dtm;
+00144                         // Compute Time deltas.
+00145                         if (firstKey)
+00146                         {
+00147                                 dtm = 0.5f * (rangeDelta + timeAfter - time);
+00148                                 fp = rangeDelta / dtm;
+00149                                 fn = (timeAfter - time) / dtm;
+00150                         }
+00151                         else if (endKey)
+00152                         {
+00153                                 dtm = 0.5f * (rangeDelta + time - timeBefore);
+00154                                 fp = rangeDelta / dtm;
+00155                                 fn = (time - timeBefore) / dtm;
+00156                         }
+00157                         else
+00158                         {
+00159                                 dtm = 0.5f * (timeAfter - timeBefore);
+00160                                 fp = (time - timeBefore) / dtm;
+00161                                 fn = (timeAfter - time) / dtm;
+00162                         }
+00163                         float   c= (float)fabs( key.Continuity );
+00164                         fp = fp + c - c * fp;
+00165                         fn = fn + c - c * fn;
+00166                 }
+00167                 else
+00168                 {
+00169                         // firstkey and lastkey of not loop track.
+00170                         fp = 1.0f;
+00171                         fn = 1.0f;
+00172                 }
+00173 
+00174                 // Compute tangents factors.
+00175                 float   tm,cm,cp,bm,bp,tmcm,tmcp;
+00176 
+00177                 cm = 1.0f - key.Continuity;
+00178                 tm = 0.5f * ( 1.0f - key.Tension );
+00179                 cp = 2.0f - cm;
+00180                 bm = 1.0f - key.Bias;
+00181                 bp = 2.0f - bm;
+00182                 tmcm = tm*cm;   tmcp = tm*cp;
+00183 
+00184                 // tgts factors.
+00185                 ksm = tmcm*bp*fp;       ksp = tmcp*bm*fp;
+00186                 kdm = tmcp*bp*fn;       kdp = tmcm*bm*fn;
+00187 
+00188         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::computeTCBKey CKeyTCBQuat &  keyBefore,
CKeyTCBQuat &  key,
CKeyTCBQuat &  keyAfter,
float  timeBefore,
float  time,
float  timeAfter,
float  rangeDelta,
bool  firstKey,
bool  endKey,
bool  isLoop
[inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 520 of file track_tcb.h. +

+References CTCBTools< CKeyT, T, TMapTimeCKey >::computeTCBFactors(). +

+

00522         {
+00523                 CQuat  qp, qm;
+00524                 
+00525                 // compute qm.
+00526                 if (!firstKey || isLoop)
+00527                 {
+00528                         float   angle= key.LocalAngleAxis.Angle;
+00529                         CVector &axis= key.LocalAngleAxis.Axis;
+00530 
+00531                         if (angle > 2*NLMISC::Pi- NLMISC::QuatEpsilon)
+00532                         {
+00533                                 qm.set(axis.x, axis.y, axis.z, 0.0f);
+00534                                 qm = qm.log();
+00535                         }
+00536                         else
+00537                         {
+00538                                 CQuat   qprev= keyBefore.Quat;
+00539                                 qprev.makeClosest(key.Quat);
+00540                                 qm = CQuat::lnDif(qprev, key.Quat);
+00541                         }
+00542                 }
+00543                 
+00544                 // compute qp.
+00545                 if (!endKey || isLoop)
+00546                 {
+00547                         float   angle= keyAfter.LocalAngleAxis.Angle;
+00548                         CVector &axis= keyAfter.LocalAngleAxis.Axis;
+00549 
+00550                         if (angle > 2*NLMISC::Pi- NLMISC::QuatEpsilon)
+00551                         {
+00552                                 qp.set(axis.x, axis.y, axis.z, 0.0f);
+00553                                 qp = qp.log();
+00554                         }
+00555                         else
+00556                         {
+00557                                 CQuat   qnext= keyAfter.Quat;
+00558                                 qnext.makeClosest(key.Quat);
+00559                                 qp = CQuat::lnDif(key.Quat, qnext);
+00560                         }
+00561                 }
+00562                 
+00563                 // not loop mgt.
+00564                 if (firstKey && !isLoop)
+00565                         qm = qp;
+00566                 if (endKey && !isLoop)
+00567                         qp = qm;
+00568 
+00569 
+00570                 // compute tangents factors.
+00571                 float   ksm, ksp, kdm, kdp;
+00572                 computeTCBFactors(key, timeBefore, time, timeAfter, rangeDelta, firstKey, endKey, isLoop, ksm,ksp,kdm,kdp);
+00573 
+00574 
+00575                 // A/B.
+00576                 CQuat   qa, qb;
+00577                 qb= (qm * (1.0f-ksm) + qp * (-ksp)        ) * 0.5f;
+00578                 qa= (qm * kdm            + qp * (kdp-1.0f) ) * 0.5f;
+00579                 qa = qa.exp();
+00580                 qb = qb.exp();
+00581 
+00582                 key.A = key.Quat * qa;
+00583                 key.B = key.Quat * qb;
+00584         }
+
+

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

+ +

+Definition at line 103 of file track_tcb.h. +

+Referenced by evalKey(), and CTrackKeyFramerTCB< CKeyT, T >::evalKey(). +

+

00104         {
+00105                 if (d==0.0f || d==1.0f) return d;
+00106                 // k==0.5f <=> e0+e1 == 0.
+00107                 if (key->EaseK == 0.5f) return d;
+00108 
+00109                 if (d < key->Ease0)
+00110                         return key->EaseKOverEase0 * d*d;
+00111                 else if (d < 1.0f - key->Ease1)
+00112                         return key->EaseK * (2.0f*d - key->Ease0);
+00113                 else
+00114                 {
+00115                         d = 1.0f - d;
+00116                         return 1.0f - key->EaseKOverEase1 * d*d;
+00117                 }
+00118         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::evalKey const CKeyTCBQuat *  previous,
const CKeyTCBQuat *  next,
TAnimationTime  datePrevious,
TAnimationTime  dateNext,
TAnimationTime  date
[inline, virtual]
+
+ + + + + +
+   + + +

+evalKey (runtime). +

+ +

+Definition at line 401 of file track_tcb.h. +

+References NLMISC::clamp(), and CTCBTools< CKeyT, T, TMapTimeCKey >::ease(). +

+

00404         {
+00405                 if(previous && next)
+00406                 {
+00407                         // lerp from previous to cur.
+00408                         date-= datePrevious;
+00409                         date*= previous->OODeltaTime;
+00410                         NLMISC::clamp(date, 0,1);
+00411 
+00412                         // ease.
+00413                         date = ease(previous, date);
+00414 
+00415                         // quad slerp.
+00416                         _Value.Value= CQuat::squadrev(next->LocalAngleAxis, previous->Quat, previous->A, next->B, next->Quat, date);
+00417                 }
+00418                 else
+00419                 {
+00420                         if (previous)
+00421                                 _Value.Value= previous->Quat;
+00422                         else
+00423                                 if (next)
+00424                                         _Value.Value= next->Quat;
+00425                 }
+00426 
+00427         }
+
+

+ + + + +
+ + + + + + + + + +
virtual const IAnimatedValue& CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::getValue  )  const [inline, virtual]
+
+ + + + + +
+   + + +

+From ITrack. +

+ +

+Definition at line 392 of file track_tcb.h. +

+

00393         {
+00394                 return _Value;
+00395         }
+
+


Field Documentation

+

+ + + + +
+ + +
CAnimatedValueBlendable<CQuat> CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::_Value [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 517 of file track_tcb.h.

+


The documentation for this class was generated from the following file: +
Generated on Tue Mar 16 06:43:54 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1