CTrackKeyFramerBezier< CKeyT, T > Class Template Reference

#include <track_bezier.h>


Detailed Description

template<class CKeyT, class T>
class CTrackKeyFramerBezier< CKeyT, T >

ITrack implementation for Bezier keyframer.

Author:
Lionel Berneguier

Nevrax France

Date:
2001

Definition at line 49 of file track_bezier.h.

Public Member Functions

virtual const IAnimatedValue & getValue () const
 From ITrack.


Protected Types

typedef CKeyT::TValueType TKeyValueType

Protected Member Functions

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

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


Private Attributes

CAnimatedValueBlendable< T > _Value


Member Typedef Documentation

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

Definition at line 61 of file track_bezier.h.

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


Member Function Documentation

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

compile (precalc).

Definition at line 108 of file track_bezier.h.

00109         {
00110                 ITrackKeyFramer<CKeyT>::compile();
00111 
00112                 // Nothing else to do!! Tangents are given from user.
00113         }

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

evalKey (runtime).

Definition at line 68 of file track_bezier.h.

References NLMISC::clamp(), s, and CTrackKeyFramerBezier< CKeyT, T >::TKeyValueType.

00071         {
00072                 if(previous && next && !previous->Step)
00073                 {
00074                         // lerp from previous to cur.
00075                         date-= datePrevious;
00076                         date*= previous->OODeltaTime;
00077                         NLMISC::clamp(date, 0,1);
00078 
00079                         // Bezier interpolation.
00080                         float s= date;
00081                         float s2 = s * s;
00082                         float s3 = s2 * s;
00083                         float u = 1.0f - s;
00084                         float u2 = u * u;
00085                         float u3 = u2 * u;
00086 
00087                         // compute Bezier control points from tangents.
00088                         TKeyValueType   cp0, cp1;
00089 
00090                         // NB: loop case: dateNext is always > datePrevious....
00091                         cp0 =   previous->Value + previous->OutTan * (dateNext-datePrevious) / 3.0f;
00092                         cp1 =   next->Value + next->InTan * (dateNext-datePrevious) / 3.0f;
00093                         
00094                         copyToValue(_Value.Value, previous->Value*u3 + cp0*3.0f*u2*s
00095                                 + cp1*3.0f*u*s2 + next->Value*s3);
00096                 }
00097                 else
00098                 {
00099                         if (previous)
00100                                 copyToValue(_Value.Value, previous->Value);
00101                         else
00102                                 if (next)
00103                                         copyToValue(_Value.Value, next->Value);
00104                 }
00105         }

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

From ITrack.

Definition at line 54 of file track_bezier.h.

00055         {
00056                 return _Value;
00057         }


Field Documentation

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

Definition at line 118 of file track_bezier.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