# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CTrackSampledQuat Class Reference

This track is supposed to be Lighter in memory than CTrackKeyFramerTCBQuat, and also is maybe faster. More...

#include <track_sampled_quat.h>

Inheritance diagram for NL3D::CTrackSampledQuat:

NL3D::CTrackSampledCommon NL3D::ITrack NLMISC::IStreamable NL3D::UTrack NLMISC::IClassable List of all members.

Public Methods

 CTrackSampledQuat ()
 Constructor. More...

virtual ~CTrackSampledQuat ()
 NLMISC_DECLARE_CLASS (CTrackSampledQuat)
void build (const std::vector< uint16 > &timeList, const std::vector< CQuat > &keyList, float beginTime, float endTime)
 Build the track from a list of CKey. More...

virtual void eval (const TAnimationTime &date)
 Evaluation of the value of the track for this time. More...

virtual const IAnimatedValuegetValue () const
 Get the track current value. More...

virtual void serial (NLMISC::IStream &f)

Protected Attributes

CAnimatedValueQuat _Value
NLMISC::CObjectVector< CQuatPack,
false > 
_Keys

Detailed Description

This track is supposed to be Lighter in memory than CTrackKeyFramerTCBQuat, and also is maybe faster.

The track is an oversampled version of CTrackKeyFramerTCBQuat (or any quat interpolator), to 30 fps for example, but each key is 9 bytes in memory, instead of 96. Only linear interpolation is performed (use CQuat::slerp) between 2 keys. And Keys are precomputed to be correctly on the same quaternion hemisphere from the preceding to the next.

9 bytes per key is achieved by encoding this way: 1 byte for the length/key time, measured in samples, and not in second (hence we can skip at max 255 keys). 8 byte for a light normalized quaternion: x,y,z,w are stored in 16 bits.

Author:
Lionel Berenguier , Nevrax France
Date:
2002

Definition at line 59 of file track_sampled_quat.h.


Constructor & Destructor Documentation

NL3D::CTrackSampledQuat::CTrackSampledQuat  
 

Constructor.

Definition at line 109 of file track_sampled_quat.cpp.

NL3D::CTrackSampledQuat::~CTrackSampledQuat   [virtual]
 

Definition at line 114 of file track_sampled_quat.cpp.


Member Function Documentation

void NL3D::CTrackSampledQuat::build const std::vector< uint16 > &    timeList,
const std::vector< CQuat > &    keyList,
float    beginTime,
float    endTime
 

Build the track from a list of CKey.

They must be already precompiled. ie they must all lies on the same hemisphere from prec key. nlassert if ! same length.

Parameters:
timeList  the list of key time. First must be ==0. nlassert if difference between 2 keys is > 255
keyList  the list of keys, not yet compressed to CQuatPack (done internally)
beginTime  map to the timeList[0] time.
endTime  map to the timeList[size-1] time.

Definition at line 159 of file track_sampled_quat.cpp.

References _Keys, NL3D::CTrackSampledCommon::_TimeBlocks, NLMISC::CObjectVector< CTimeBlock >::clear, NLMISC::CObjectVector< CQuatPack, false >::clear, nlassert, and NLMISC::CObjectVector< CQuatPack, false >::resize.

void NL3D::CTrackSampledQuat::eval const TAnimationTime   date [virtual]
 

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

Implements NL3D::ITrack.

Definition at line 186 of file track_sampled_quat.cpp.

References _Keys, _Value, NL3D::CTrackSampledCommon::EvalDiscard, NL3D::CTrackSampledCommon::EvalInterpolate, NL3D::CTrackSampledCommon::EvalKey0, NL3D::CTrackSampledCommon::evalTime, nlstop, NLMISC::CObjectVector< CQuatPack, false >::size, NL3D::TAnimationTime, and NL3D::CTrackSampledCommon::TEvalType.

const IAnimatedValue & NL3D::CTrackSampledQuat::getValue   const [virtual]
 

Get the track current value.

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

Implements NL3D::ITrack.

Definition at line 119 of file track_sampled_quat.cpp.

References _Value.

NL3D::CTrackSampledQuat::NLMISC_DECLARE_CLASS CTrackSampledQuat   
 

void NL3D::CTrackSampledQuat::serial NLMISC::IStream   f [virtual]
 

Implements NLMISC::IStreamable.

Definition at line 125 of file track_sampled_quat.cpp.

References NL3D::CTrackSampledCommon::_BeginTime, NL3D::CTrackSampledCommon::_DeltaTime, NL3D::CTrackSampledCommon::_EndTime, _Keys, NL3D::CTrackSampledCommon::_LoopMode, NL3D::CTrackSampledCommon::_OODeltaTime, NL3D::CTrackSampledCommon::_OOTotalRange, NL3D::CTrackSampledCommon::_TimeBlocks, NL3D::CTrackSampledCommon::_TotalRange, NLMISC::IStream::serial, and NLMISC::IStream::serialVersion.


Member Data Documentation

NLMISC::CObjectVector<CQuatPack, false> NL3D::CTrackSampledQuat::_Keys [protected]
 

Definition at line 131 of file track_sampled_quat.h.

Referenced by build, eval, and serial.

CAnimatedValueQuat NL3D::CTrackSampledQuat::_Value [protected]
 

Definition at line 128 of file track_sampled_quat.h.

Referenced by eval, and getValue.


The documentation for this class was generated from the following files: