|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CAnimationOptimizer Class ReferencePurpose of this class is to optimize for memory and speed a CAnimation.
More...
#include <animation_optimizer.h>
List of all members.
Public Methods |
| CAnimationOptimizer () |
| Constructor. More...
|
void | setQuaternionThreshold (double lowPrecThre, double highPrecThre) |
| Set the Quaternion Error Thresholds. More...
|
void | setVectorThreshold (double lowPrecThre, double highPrecThre) |
| Same principle as for setQuaternionThreshold(), but for vector tracks (positions/scale). More...
|
void | addLowPrecisionTrack (const std::string &name) |
| see setQuaternionThreshold(). More...
|
void | clearLowPrecisionTracks () |
| see addLowPrecisionTrack. This clear the array. More...
|
void | setSampleFrameRate (float frameRate) |
| Set the Sample Frame Rate (>0) Default is 30 fps. More...
|
void | optimize (const CAnimation &animIn, CAnimation &animOut) |
| optimize an animation animOut is the same as animIn, but optimized. More...
|
Private Methods |
ITrack * | cloneTrack (const ITrack *trackIn) |
bool | isTrackOptimisable (const ITrack *trackIn) |
ITrack * | optimizeTrack (const ITrack *trackIn) |
bool | isLowPrecisionTrack (const std::string &trackName) |
|
void | sampleQuatTrack (const ITrack *trackIn, float beginTime, float endTime, uint numSamples) |
| sample the track from beginTime to endTime, sample to numSamples, such that key[0].Time==beginTime and key[numSamples-1].Time==endTime. More...
|
bool | testConstantQuatTrack () |
| Test if the current track is constant (ie always same quaternion value) NB: test if q==qRef or q==-qRef of course. More...
|
void | optimizeQuatTrack () |
| optimze the current track. More...
|
bool | nearlySameQuaternion (const CQuatD &quat0, const CQuatD &quat1) |
| return true if suppose same quaternion. More...
|
|
void | sampleVectorTrack (const ITrack *trackIn, float beginTime, float endTime, uint numSamples) |
| sample the track from beginTime to endTime, sample to numSamples, such that key[0].Time==beginTime and key[numSamples-1].Time==endTime. More...
|
bool | testConstantVectorTrack () |
| Test if the current track is constant (ie always same Vector value). More...
|
void | optimizeVectorTrack () |
| optimze the current track. More...
|
bool | nearlySameVector (const CVectorD &v0, const CVectorD &v1) |
| return true if suppose same vector. More...
|
Private Attributes |
float | _SampleFrameRate |
double | _QuaternionThresholdLowPrec |
double | _QuaternionThresholdHighPrec |
double | _QuaternionThreshold |
double | _VectorThresholdLowPrec |
double | _VectorThresholdHighPrec |
double | _VectorThreshold |
std::vector< std::string > | _LowPrecTrackKeyName |
std::vector< uint16 > | _TimeList |
std::vector< CQuat > | _QuatKeyList |
std::vector< CVector > | _VectorKeyList |
Detailed Description
Purpose of this class is to optimize for memory and speed a CAnimation.
Quaternion tracks are optimized. They are transformed to CTrackSampledQuat or CTrackDefaultQuat. Vector tracks are optimized. They are transformed to CTrackSampledVector or CTrackDefaultVector. -
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2002
Definition at line 54 of file animation_optimizer.h.
Constructor & Destructor Documentation
NL3D::CAnimationOptimizer::CAnimationOptimizer |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CAnimationOptimizer::addLowPrecisionTrack |
( |
const std::string & |
name |
) |
|
|
|
see setQuaternionThreshold().
Any track which contains this name will be considered as a Low precision track. Default setup is empty, so all track are "high precision" track. A good setup is for example addLowPrecisionTrack("Finger") and addLowPrecisionTrack("Ponytail") Warning: case sensitive
Definition at line 599 of file animation_optimizer.cpp.
References _LowPrecTrackKeyName. |
void NL3D::CAnimationOptimizer::clearLowPrecisionTracks |
( |
|
) |
|
|
ITrack * NL3D::CAnimationOptimizer::cloneTrack |
( |
const ITrack * |
trackIn |
) |
[private] |
|
bool NL3D::CAnimationOptimizer::isLowPrecisionTrack |
( |
const std::string & |
trackName |
) |
[private] |
|
bool NL3D::CAnimationOptimizer::isTrackOptimisable |
( |
const ITrack * |
trackIn |
) |
[private] |
|
bool NL3D::CAnimationOptimizer::nearlySameQuaternion |
( |
const CQuatD & |
quat0, |
|
|
const CQuatD & |
quat1 |
|
) |
[private] |
|
bool NL3D::CAnimationOptimizer::nearlySameVector |
( |
const CVectorD & |
v0, |
|
|
const CVectorD & |
v1 |
|
) |
[private] |
|
|
optimize an animation animOut is the same as animIn, but optimized.
If a track can't be optimized, it is just duplicated in animOut.
Definition at line 86 of file animation_optimizer.cpp.
References _QuaternionThreshold, _QuaternionThresholdHighPrec, _QuaternionThresholdLowPrec, _VectorThreshold, _VectorThresholdHighPrec, _VectorThresholdLowPrec, cloneTrack, NLMISC::contReset, isLowPrecisionTrack, isTrackOptimisable, nlassert, and optimizeTrack. |
void NL3D::CAnimationOptimizer::optimizeQuatTrack |
( |
|
) |
[private] |
|
ITrack * NL3D::CAnimationOptimizer::optimizeTrack |
( |
const ITrack * |
trackIn |
) |
[private] |
|
|
Definition at line 177 of file animation_optimizer.cpp.
References _QuatKeyList, _SampleFrameRate, _TimeList, _VectorKeyList, cloneTrack, nlassert, nlstop, optimizeQuatTrack, optimizeVectorTrack, sampleQuatTrack, sampleVectorTrack, testConstantQuatTrack, and testConstantVectorTrack.
Referenced by optimize. |
void NL3D::CAnimationOptimizer::optimizeVectorTrack |
( |
|
) |
[private] |
|
void NL3D::CAnimationOptimizer::sampleQuatTrack |
( |
const ITrack * |
trackIn, |
|
|
float |
beginTime, |
|
|
float |
endTime, |
|
|
uint |
numSamples |
|
) |
[private] |
|
|
sample the track from beginTime to endTime, sample to numSamples, such that key[0].Time==beginTime and key[numSamples-1].Time==endTime.
NB: quaternion are normalized, and are makeClosest()-ed from sample to the next.
Definition at line 282 of file animation_optimizer.cpp.
References _QuatKeyList, _TimeList, and t.
Referenced by optimizeTrack. |
void NL3D::CAnimationOptimizer::sampleVectorTrack |
( |
const ITrack * |
trackIn, |
|
|
float |
beginTime, |
|
|
float |
endTime, |
|
|
uint |
numSamples |
|
) |
[private] |
|
void NL3D::CAnimationOptimizer::setQuaternionThreshold |
( |
double |
lowPrecThre, |
|
|
double |
highPrecThre |
|
) |
|
|
|
Set the Quaternion Error Thresholds.
must be>=0. Default is 0.0001 and 0.000001. Above this value, 2 quaternions are said different. NB: comparing 2 quaternions is made by multiplying the one with the inverse of the other. the W component is then tested and must be >1-threshold (modulo sign) to conclude to equality. Since quat.W= cos(angle/2), you can deduce the angle threshold with angleThre= acos(1-thre)*2
Give 2 value, one For Low precision and High precision. Default setup use high precision. Use addLowPrecisionTrack() to drive low precision tracks.
Definition at line 58 of file animation_optimizer.cpp.
References _QuaternionThresholdHighPrec, _QuaternionThresholdLowPrec, and nlassert. |
void NL3D::CAnimationOptimizer::setSampleFrameRate |
( |
float |
frameRate |
) |
|
|
void NL3D::CAnimationOptimizer::setVectorThreshold |
( |
double |
lowPrecThre, |
|
|
double |
highPrecThre |
|
) |
|
|
bool NL3D::CAnimationOptimizer::testConstantQuatTrack |
( |
|
) |
[private] |
|
bool NL3D::CAnimationOptimizer::testConstantVectorTrack |
( |
|
) |
[private] |
|
Member Data Documentation
std::vector<std::string> NL3D::CAnimationOptimizer::_LowPrecTrackKeyName [private]
|
|
double NL3D::CAnimationOptimizer::_QuaternionThreshold [private]
|
|
double NL3D::CAnimationOptimizer::_QuaternionThresholdHighPrec [private]
|
|
double NL3D::CAnimationOptimizer::_QuaternionThresholdLowPrec [private]
|
|
std::vector<CQuat> NL3D::CAnimationOptimizer::_QuatKeyList [private]
|
|
float NL3D::CAnimationOptimizer::_SampleFrameRate [private]
|
|
std::vector<uint16> NL3D::CAnimationOptimizer::_TimeList [private]
|
|
std::vector<CVector> NL3D::CAnimationOptimizer::_VectorKeyList [private]
|
|
double NL3D::CAnimationOptimizer::_VectorThreshold [private]
|
|
double NL3D::CAnimationOptimizer::_VectorThresholdHighPrec [private]
|
|
double NL3D::CAnimationOptimizer::_VectorThresholdLowPrec [private]
|
|
The documentation for this class was generated from the following files:
|
|