NL3D::CTrackSampledCommon Class Reference

#include <track_sampled_common.h>

Inheritance diagram for NL3D::CTrackSampledCommon:

NL3D::ITrack NLMISC::IStreamable NL3D::UTrack NLMISC::IClassable NL3D::CTrackSampledQuat NL3D::CTrackSampledVector

Detailed Description

Abstract Base class for CTrackSampledQuat and CTrackSampledVector

Author:
Lionel Berenguier

Nevrax France

Date:
2002

Definition at line 45 of file track_sampled_common.h.

Public Member Functions

 CTrackSampledCommon ()
 Constructor.

virtual void eval (const TAnimationTime &date)=0
virtual std::string getClassName ()=0
virtual const IAnimatedValuegetValue () const=0
virtual void serial (IStream &f)=0
void setLoopMode (bool mode)
 Change the loop mode. true default.

virtual ~CTrackSampledCommon ()

Protected Types

enum  TEvalType { EvalDiscard, EvalKey0, EvalInterpolate }

Protected Member Functions

void buildCommon (const std::vector< uint16 > &timeList, float beginTime, float endTime)
TEvalType evalTime (const TAnimationTime &date, uint numKeys, uint &keyId0, uint &keyId1, float &interpValue)
void serialCommon (NLMISC::IStream &f)

Protected Attributes

float _BeginTime
float _DeltaTime
float _EndTime
bool _LoopMode
float _OODeltaTime
float _OOTotalRange
NLMISC::CObjectVector< CTimeBlock_TimeBlocks
float _TotalRange


Member Enumeration Documentation

enum NL3D::CTrackSampledCommon::TEvalType [protected]
 

Enumeration values:
EvalDiscard 
EvalKey0 
EvalInterpolate 

Definition at line 103 of file track_sampled_common.h.


Constructor & Destructor Documentation

NL3D::CTrackSampledCommon::CTrackSampledCommon  ) 
 

Constructor.

Definition at line 50 of file track_sampled_common.cpp.

00051 {
00052         _LoopMode= true;
00053 }

NL3D::CTrackSampledCommon::~CTrackSampledCommon  )  [virtual]
 

Definition at line 56 of file track_sampled_common.cpp.

00057 {
00058 }


Member Function Documentation

void NL3D::CTrackSampledCommon::buildCommon const std::vector< uint16 > &  timeList,
float  beginTime,
float  endTime
[protected]
 

Build the track time from a list of Keys.

Parameters:
timeList the list of key time. First must be ==0. nlassert if difference between 2 keys is > 255
beginTime map to the timeList[0] time.
endTime map to the timeList[size-1] time.

Definition at line 106 of file track_sampled_common.cpp.

References _OODeltaTime, _TimeBlocks, NLMISC::CObjectVector< CTimeBlock >::clear(), NL3D::CTrackSampledCommon::CTimeBlock::KeyOffset, nlassert, NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::CObjectVector< CTimeBlock >::resize(), sint32, NLMISC::CObjectVector< uint8, false >::size(), NL3D::CTrackSampledCommon::CTimeBlock::TimeOffset, NL3D::CTrackSampledCommon::CTimeBlock::Times, and uint.

00107 {
00108         nlassert( endTime>beginTime || (beginTime==endTime && timeList.size()<=1) );
00109         uint i;
00110 
00111         // reset.
00112         uint    numKeys= timeList.size();
00113         _TimeBlocks.clear();
00114 
00115         // Special case of 0 or 1 key.
00116         //===================
00117         if(numKeys<=1)
00118         {
00119                 _BeginTime= beginTime;
00120                 _EndTime= endTime;
00121                 _TotalRange= 0;
00122                 _OOTotalRange= 0;
00123                 _DeltaTime= 0;
00124                 _OODeltaTime= 0;
00125                 if(numKeys==1)
00126                 {
00127                         _TimeBlocks.resize(1);
00128                         _TimeBlocks[0].TimeOffset= 0;
00129                         _TimeBlocks[0].Times.resize(1);
00130                         _TimeBlocks[0].Times[0]= 0;
00131                 }
00132 
00133                 return;
00134         }
00135 
00136         // Compute All Time blocks.
00137         //===================
00138         sint32          lastBlockFrame= -1000000;
00139         nlassert(timeList[0] == 0);
00140         // Header info for creating timeBlocks
00141         vector<uint>    timeBlockKeyId;
00142         vector<uint>    timeBlockNumKeys;
00143 
00144         // compute how many time block we need.
00145         for(i=0; i<numKeys; i++)
00146         {
00147                 // verify growing order, and time difference.
00148                 if(i>0)
00149                 {
00150                         nlassert(timeList[i]>timeList[i-1]);
00151                         nlassert(timeList[i]-timeList[i-1] <= 255 );
00152                 }
00153                 // If the current frame is to far from the last TimeBlock frame (or if 1st timeBlock), must create a new timeBlock
00154                 if(timeList[i]-lastBlockFrame>255)
00155                 {
00156                         // create a new timeblock
00157                         timeBlockKeyId.push_back(i);
00158                         // Add this key to this new time Block (numKey == 1).
00159                         timeBlockNumKeys.push_back(1);
00160                         lastBlockFrame= timeList[i];
00161                 }
00162                 else
00163                 {
00164                         // Add this key to the timeBlock.
00165                         timeBlockNumKeys[timeBlockNumKeys.size()-1]++;
00166                 }
00167         }
00168 
00169         // Build the timeBlocks.
00170         _TimeBlocks.resize(timeBlockKeyId.size());
00171         for(i=0; i<timeBlockKeyId.size(); i++)
00172         {
00173                 CTimeBlock      &timeBlock= _TimeBlocks[i];
00174                 uint            firstKeyId= timeBlockKeyId[i];
00175                 uint            numKeys= timeBlockNumKeys[i];
00176                 // compute the offset time and key
00177                 timeBlock.KeyOffset= firstKeyId;
00178                 timeBlock.TimeOffset= timeList[firstKeyId];
00179                 // create array of key
00180                 timeBlock.Times.resize(numKeys);
00181                 for(uint j=0;j<timeBlock.Times.size(); j++)
00182                 {
00183                         // get the key time and make it local to the timeBlock.
00184                         timeBlock.Times[j]= timeList[firstKeyId+j] - timeBlock.TimeOffset;
00185                 }
00186         }
00187 
00188         // Compute other params
00189         //===================
00190         _BeginTime= beginTime;
00191         _EndTime= endTime;
00192         // compute deltatime for a frame to an other
00193         uint    totalFrameCount= timeList[numKeys-1] - timeList[0];
00194         nlassert(totalFrameCount>0);
00195         _DeltaTime= (_EndTime-_BeginTime) / totalFrameCount;
00196         _OODeltaTime= (float)(1.0 / _DeltaTime);
00197         // Compute range of anim
00198         _TotalRange= _EndTime-_BeginTime;
00199         _OOTotalRange= float(1.0/_TotalRange);
00200 
00201 }

virtual void NL3D::ITrack::eval const TAnimationTime date  )  [pure virtual, inherited]
 

Evaluation of the value of the track for this time.

The result is internaly stored to simplify access at the polymorphic values. To get the value, call ITrack::getValue().

Implemented in NL3D::ITrackDefault, NL3D::ITrackKeyFramer< CKeyT >, NL3D::CTrackSampledQuat, NL3D::CTrackSampledVector, NL3D::ITrackKeyFramer< CKeyBezierVector >, NL3D::ITrackKeyFramer< CKeyTCBVector >, NL3D::ITrackKeyFramer< CKeyVector >, NL3D::ITrackKeyFramer< CKeyTCBQuat >, NL3D::ITrackKeyFramer< CKeyRGBA >, NL3D::ITrackKeyFramer< CKeyInt >, NL3D::ITrackKeyFramer< CKeyBool >, NL3D::ITrackKeyFramer< CKeyFloat >, NL3D::ITrackKeyFramer< CKeyQuat >, NL3D::ITrackKeyFramer< CKeyBezierFloat >, NL3D::ITrackKeyFramer< CKeyTCBFloat >, NL3D::ITrackKeyFramer< CKeyString >, and NL3D::ITrackKeyFramer< CKeyBezierQuat >.

Referenced by NL3D::ITrack::interpolate().

CTrackSampledCommon::TEvalType NL3D::CTrackSampledCommon::evalTime const TAnimationTime date,
uint  numKeys,
uint keyId0,
uint keyId1,
float &  interpValue
[protected]
 

Definition at line 211 of file track_sampled_common.cpp.

References _OODeltaTime, _TimeBlocks, NLMISC::clamp(), EvalDiscard, EvalInterpolate, EvalKey0, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::CObjectVector< CTimeBlock >::getPtr(), NL3D::CTrackSampledCommon::CTimeBlock::KeyOffset, nlassert, NLMISC::searchLowerBound(), sint, NLMISC::CObjectVector< uint8, false >::size(), NLMISC::CObjectVector< CTimeBlock >::size(), t, NL3D::TAnimationTime, NL3D::CTrackSampledCommon::CTimeBlock::TimeOffset, NL3D::CTrackSampledCommon::CTimeBlock::Times, uint, and uint8.

Referenced by NL3D::CTrackSampledVector::eval(), and NL3D::CTrackSampledQuat::eval().

00212 {
00213         // Empty? quit
00214         if(numKeys==0)
00215                 return EvalDiscard;
00216 
00217         // One Key? easy, and quit.
00218         if(numKeys==1)
00219         {
00220                 keyId0= 0;
00221                 return EvalKey0;
00222         }
00223 
00224         // manage Loop
00225         //=====================
00226         float   localTime;
00227         if(_LoopMode)
00228         {
00229                 nlassert(_TotalRange>0);
00230                 // get relative to BeginTime.
00231                 localTime= date-_BeginTime;
00232 
00233                 // force us to be in interval [0, _TotalRange[.
00234                 if( localTime<0 || localTime>=_TotalRange )
00235                 {
00236                         double  d= localTime*_OOTotalRange;
00237 
00238                         // floor(d) is the truncated number of loops.
00239                         d= localTime- floor(d)*_TotalRange;
00240                         localTime= (float)d;
00241 
00242                         // For precision problems, ensure correct range.
00243                         if(localTime<0 || localTime >= _TotalRange)
00244                                 localTime= 0;
00245                 }
00246 
00247         }
00248         else
00249         {
00250                 // get relative to BeginTime.
00251                 localTime= date-_BeginTime;
00252         }
00253 
00254 
00255         // Find the first key before localTime
00256         //=====================
00257         // get the frame in the track.
00258         sint    frame= (sint)floor(localTime*_OODeltaTime);
00259         // clamp to uint16
00260         clamp(frame, 0, 65535);
00261 
00262         // Search the TimeBlock.
00263         CTimeBlock      keyTB;
00264         keyTB.TimeOffset= frame;
00265         uint            tbId;
00266         tbId= searchLowerBound(_TimeBlocks.getPtr(), _TimeBlocks.size(), keyTB);
00267 
00268         // get this timeBlock.
00269         CTimeBlock      &timeBlock= _TimeBlocks[tbId];
00270         // get frame relative to this timeBlock.
00271         sint    frameRel= frame-timeBlock.TimeOffset;
00272         // clamp to uint8
00273         clamp(frameRel, 0, 255);
00274         // get the key in this timeBlock.
00275         uint    keyIdRel;
00276         keyIdRel= searchLowerBound(timeBlock.Times.getPtr(), timeBlock.Times.size(), (uint8)frameRel);
00277         
00278         // Get the Frame and Value of Key0.
00279         uint            frameKey0= timeBlock.TimeOffset + timeBlock.Times[keyIdRel];
00280         // this is the key to evaluate
00281         keyId0= timeBlock.KeyOffset + keyIdRel;
00282 
00283 
00284         // Interpolate with next key
00285         //=====================
00286 
00287         // If not the last Key
00288         if(keyId0<numKeys-1)
00289         {
00290                 // Get the next key.
00291                 keyId1= keyId0+1;
00292                 uint            frameKey1;
00293                 // If last key of the timeBlock, get the first time of the next timeBlock.
00294                 if( keyIdRel+1 >= timeBlock.Times.size() )
00295                 {
00296                         nlassert(tbId+1<_TimeBlocks.size());
00297                         frameKey1= _TimeBlocks[tbId+1].TimeOffset;
00298                 }
00299                 else
00300                 {
00301                         frameKey1= timeBlock.TimeOffset + timeBlock.Times[keyIdRel+1];
00302                 }
00303 
00304                 // unpack time.
00305                 float   time0= frameKey0*_DeltaTime;
00306                 float   time1= frameKey1*_DeltaTime;
00307 
00308                 // interpolate.
00309                 float   t= (localTime-time0);
00310                 // If difference is one frame, optimize.
00311                 if(frameKey1-frameKey0==1)
00312                         t*= _OODeltaTime;
00313                 else
00314                         t/= (time1-time0);
00315                 clamp(t, 0.f, 1.f);
00316 
00317                 // store this interp value.
00318                 interpValue= t;
00319 
00320                 return EvalInterpolate;
00321         }
00322         // else (last key of anim), just eval this key.
00323         return EvalKey0;
00324 }

TAnimationTime NL3D::CTrackSampledCommon::getBeginTime  )  const [virtual]
 

Get the begin time of the track

Implements NL3D::UTrack.

Definition at line 67 of file track_sampled_common.cpp.

References NL3D::TAnimationTime.

00068 {
00069         return _BeginTime;
00070 }

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().

TAnimationTime NL3D::CTrackSampledCommon::getEndTime  )  const [virtual]
 

Get the end time of the track

Implements NL3D::UTrack.

Definition at line 73 of file track_sampled_common.cpp.

References NL3D::TAnimationTime.

00074 {
00075         return _EndTime;
00076 }

bool NL3D::CTrackSampledCommon::getLoopMode  )  const [virtual]
 

get LoopMode. 2 mode only: "constant" (<=>false), and "loop" (<=> true). NB: same mode if time < getBeginTIme() and if time > getEndTime()

Implements NL3D::ITrack.

Definition at line 61 of file track_sampled_common.cpp.

00062 {
00063         return _LoopMode;
00064 }

virtual const IAnimatedValue& NL3D::ITrack::getValue  )  const [pure virtual, inherited]
 

Get the track current value.

Returns:
the last value evaluated by ITrack::eval().

Implemented in NL3D::CTrackDefaultBlendable< T >, NL3D::CTrackDefaultNotBlendable< T >, NL3D::CTrackKeyFramerConstNotBlendable< CKeyT, T >, NL3D::CTrackKeyFramerConstBlendable< CKeyT, T >, NL3D::CTrackKeyFramerLinear< CKeyT, T >, NL3D::CTrackKeyFramerLinear< CKeyQuat, CQuat >, NL3D::CTrackKeyFramerTCB< CKeyT, T >, NL3D::CTrackKeyFramerBezier< CKeyT, T >, NL3D::CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >, NL3D::CTrackSampledQuat, NL3D::CTrackSampledVector, NL3D::CTrackDefaultBlendable< float >, NL3D::CTrackDefaultBlendable< NLMISC::CRGBA >, NL3D::CTrackDefaultBlendable< CQuat >, NL3D::CTrackDefaultBlendable< sint32 >, NL3D::CTrackDefaultBlendable< CVector >, NL3D::CTrackDefaultNotBlendable< std::string >, NL3D::CTrackDefaultNotBlendable< bool >, NL3D::CTrackKeyFramerConstNotBlendable< CKeyBool, bool >, NL3D::CTrackKeyFramerConstNotBlendable< CKeyString, std::string >, NL3D::CTrackKeyFramerConstBlendable< CKeyVector, CVector >, NL3D::CTrackKeyFramerConstBlendable< CKeyInt, sint32 >, NL3D::CTrackKeyFramerConstBlendable< CKeyFloat, float >, NL3D::CTrackKeyFramerConstBlendable< CKeyRGBA, NLMISC::CRGBA >, NL3D::CTrackKeyFramerConstBlendable< CKeyQuat, CQuat >, NL3D::CTrackKeyFramerLinear< CKeyVector, CVector >, NL3D::CTrackKeyFramerLinear< CKeyInt, sint32 >, NL3D::CTrackKeyFramerLinear< CKeyFloat, float >, NL3D::CTrackKeyFramerLinear< CKeyRGBA, NLMISC::CRGBA >, NL3D::CTrackKeyFramerTCB< CKeyTCBFloat, float >, NL3D::CTrackKeyFramerTCB< CKeyTCBVector, NLMISC::CRGBA >, NL3D::CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >, NL3D::CTrackKeyFramerTCB< CKeyTCBVector, CVector >, NL3D::CTrackKeyFramerTCB< CKeyTCBFloat, sint32 >, NL3D::CTrackKeyFramerBezier< CKeyBezierFloat, sint32 >, NL3D::CTrackKeyFramerBezier< CKeyBezierVector, CVector >, NL3D::CTrackKeyFramerBezier< CKeyBezierFloat, float >, and NL3D::CTrackKeyFramerBezier< CKeyBezierVector, NLMISC::CRGBA >.

Referenced by NL3D::CChannelMixer::eval(), NL3D::CChannelMixer::evalSingleChannel(), NL3D::ITrack::interpolate(), NL3D::CAnimationOptimizer::optimizeTrack(), and NL3D::CChannelMixer::refreshList().

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.

virtual void NLMISC::IStreamable::serial IStream f  )  [pure virtual, inherited]
 

Implemented in NL3D::CFlareShape, NL3D::CTextureCross, NL3D::CMesh, NL3D::CMeshGeom, NL3D::CMeshMRMGeom, NL3D::CMeshMRM, NL3D::CMeshMRMSkinnedGeom, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CMeshVPPerPixelLight, NL3D::CMeshVPWindTree, NL3D::CParticleSystemProcess, NL3D::CParticleSystemShape, NL3D::CPSAttribMaker< T >, NL3D::CPSAttribMakerBinOp< T >, NL3D::CPSAttribMakerT< T, F >, NL3D::CPSAttribMakerMemoryBase< T >, NL3D::CPSAttribMakerMemory< uint32 >, NL3D::CPSAttribMakerMemory< sint32 >, NL3D::CPSAttribMakerMemory< float >, NL3D::CPSDot, NL3D::CPSEmitter, NL3D::CPSEmitterDirectionnal, NL3D::CPSRadialEmitter, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, NL3D::CPSEmitterConic, NL3D::CPSSphericalEmitter, NL3D::CPSFace, NL3D::CPSFaceLookAt, NL3D::CPSFanLight, NL3D::CPSForce, NL3D::CPSForceIntensityHelper, NL3D::CIsotropicForceT< T >, NL3D::CPSDirectionnalForce, NL3D::CPSGravity, NL3D::CPSCentralGravity, NL3D::CPSSpring, NL3D::CPSCylindricVortex, NL3D::CPSMagneticForce, NL3D::CPSLight, NL3D::CPSLocated, NL3D::CPSLocatedBindable, NL3D::CPSTargetLocatedBindable, NL3D::CPSMesh, NL3D::CPSConstraintMesh, NL3D::CPSParticle, NL3D::CPSPlaneBasisFollowSpeed, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonBase, NL3D::CPSRibbonLookAt, NL3D::CPSShockWave, NL3D::CPSSound, NL3D::CPSTailDot, NL3D::CPSZone, NL3D::CPSZonePlane, NL3D::CPSZoneSphere, NL3D::CPSZoneDisc, NL3D::CPSZoneCylinder, NL3D::CPSZoneRectangle, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::ITexture, NL3D::CTextureBlend, NL3D::CTextureBump, NL3D::CTextureCube, NL3D::CTextureDLM, NL3D::CTextureEmboss, NL3D::CTextureFar, NL3D::CTextureFile, NL3D::CTextureFont, NL3D::CTextureGrouped, NL3D::CTextureMem, NL3D::CTextureMultiFile, NL3D::CTextureNear, NL3D::CTrackDefaultBlendable< T >, NL3D::CTrackDefaultNotBlendable< T >, NL3D::ITrackKeyFramer< CKeyT >, NL3D::CTrackSampledQuat, NL3D::CTrackSampledVector, NL3D::CWaterShape, NL3D::CWaveMakerShape, NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, NLAIC::IBasicInterface, NLAISCRIPT::COperandVoid, NLAISCRIPT::COperandAnyObject, NLAISCRIPT::COperandSimple, NLAISCRIPT::COperandSimpleListOr, NLAISCRIPT::COperandUnknown, NLAISCRIPT::COperationType, NLAISCRIPT::COperationTypeGD, NLAISCRIPT::COperandListType, CAutomataDesc, NL3D::CPSAttribMaker< float >, NL3D::CPSAttribMaker< CPlaneBasis >, NL3D::CPSAttribMaker< NLMISC::CRGBA >, NL3D::CPSAttribMaker< uint32 >, NL3D::CPSAttribMaker< CRGBA >, NL3D::CPSAttribMaker< sint32 >, NL3D::CPSAttribMakerBinOp< float >, NL3D::CPSAttribMakerBinOp< CPlaneBasis >, NL3D::CPSAttribMakerBinOp< uint32 >, NL3D::CPSAttribMakerBinOp< NLMISC::CRGBA >, NL3D::CPSAttribMakerBinOp< sint32 >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueGradientFunc< NLMISC::CRGBA > >, NL3D::CPSAttribMakerT< sint32, CPSValueBlendFunc< sint32 > >, NL3D::CPSAttribMakerT< T, CPSValueGradientFunc< T > >, NL3D::CPSAttribMakerT< sint32, CPSValueGradientFunc< sint32 > >, NL3D::CPSAttribMakerT< uint32, CPSValueGradientFunc< uint32 > >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueBlendFunc< NLMISC::CRGBA > >, NL3D::CPSAttribMakerT< float, CPSFloatCurveFunctor >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< float, CPSValueGradientFunc< float > >, NL3D::CPSAttribMakerT< float, CPSValueBlendFunc< float > >, NL3D::CPSAttribMakerT< T, CPSValueBlendSampleFunc< T, n > >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueBlendSampleFunc< NLMISC::CRGBA, n > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >, NL3D::CPSAttribMakerT< T, CPSValueBlendFunc< T > >, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >, NL3D::CPSAttribMakerMemoryBase< float >, NL3D::CPSAttribMakerMemoryBase< CPlaneBasis >, NL3D::CPSAttribMakerMemoryBase< NLMISC::CRGBA >, NL3D::CPSAttribMakerMemoryBase< uint32 >, NL3D::CPSAttribMakerMemoryBase< sint32 >, NL3D::CIsotropicForceT< CPSTurbulForceFunc >, NL3D::CIsotropicForceT< CPSFluidFrictionFunctor >, NL3D::CTrackDefaultBlendable< float >, NL3D::CTrackDefaultBlendable< NLMISC::CRGBA >, NL3D::CTrackDefaultBlendable< CQuat >, NL3D::CTrackDefaultBlendable< sint32 >, NL3D::CTrackDefaultBlendable< CVector >, NL3D::CTrackDefaultNotBlendable< std::string >, NL3D::CTrackDefaultNotBlendable< bool >, NL3D::ITrackKeyFramer< CKeyBezierVector >, NL3D::ITrackKeyFramer< CKeyTCBVector >, NL3D::ITrackKeyFramer< CKeyVector >, NL3D::ITrackKeyFramer< CKeyTCBQuat >, NL3D::ITrackKeyFramer< CKeyRGBA >, NL3D::ITrackKeyFramer< CKeyInt >, NL3D::ITrackKeyFramer< CKeyBool >, NL3D::ITrackKeyFramer< CKeyFloat >, NL3D::ITrackKeyFramer< CKeyQuat >, NL3D::ITrackKeyFramer< CKeyBezierFloat >, NL3D::ITrackKeyFramer< CKeyTCBFloat >, NL3D::ITrackKeyFramer< CKeyString >, and NL3D::ITrackKeyFramer< CKeyBezierQuat >.

Referenced by NL3D::CMeshMRMGeom::loadHeader().

void NL3D::CTrackSampledCommon::serialCommon NLMISC::IStream f  )  [protected]
 

Definition at line 90 of file track_sampled_common.cpp.

References _OODeltaTime, _TimeBlocks, NLMISC::IStream::serial(), and NLMISC::IStream::serialVersion().

00091 {
00092         (void)f.serialVersion(0);
00093 
00094         f.serial(_LoopMode);
00095         f.serial(_BeginTime);
00096         f.serial(_EndTime) ;
00097         f.serial(_TotalRange);
00098         f.serial(_OOTotalRange);
00099         f.serial(_DeltaTime);
00100         f.serial(_OODeltaTime);
00101         f.serial(_TimeBlocks);
00102 
00103 }

void NL3D::CTrackSampledCommon::setLoopMode bool  mode  ) 
 

Change the loop mode. true default.

Definition at line 204 of file track_sampled_common.cpp.

Referenced by NL3D::CAnimationOptimizer::optimizeTrack().

00205 {
00206         _LoopMode= mode;
00207 }


Field Documentation

float NL3D::CTrackSampledCommon::_BeginTime [protected]
 

Definition at line 68 of file track_sampled_common.h.

float NL3D::CTrackSampledCommon::_DeltaTime [protected]
 

Definition at line 73 of file track_sampled_common.h.

float NL3D::CTrackSampledCommon::_EndTime [protected]
 

Definition at line 69 of file track_sampled_common.h.

bool NL3D::CTrackSampledCommon::_LoopMode [protected]
 

Definition at line 67 of file track_sampled_common.h.

float NL3D::CTrackSampledCommon::_OODeltaTime [protected]
 

Definition at line 74 of file track_sampled_common.h.

Referenced by buildCommon(), evalTime(), and serialCommon().

float NL3D::CTrackSampledCommon::_OOTotalRange [protected]
 

Definition at line 71 of file track_sampled_common.h.

NLMISC::CObjectVector<CTimeBlock> NL3D::CTrackSampledCommon::_TimeBlocks [protected]
 

Definition at line 98 of file track_sampled_common.h.

Referenced by buildCommon(), evalTime(), and serialCommon().

float NL3D::CTrackSampledCommon::_TotalRange [protected]
 

Definition at line 70 of file track_sampled_common.h.


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