From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/classNL3D_1_1CAnimationOptimizer.html | 1197 ++++++++++++++++++++ 1 file changed, 1197 insertions(+) create mode 100644 docs/doxygen/nel/classNL3D_1_1CAnimationOptimizer.html (limited to 'docs/doxygen/nel/classNL3D_1_1CAnimationOptimizer.html') diff --git a/docs/doxygen/nel/classNL3D_1_1CAnimationOptimizer.html b/docs/doxygen/nel/classNL3D_1_1CAnimationOptimizer.html new file mode 100644 index 00000000..a34dd132 --- /dev/null +++ b/docs/doxygen/nel/classNL3D_1_1CAnimationOptimizer.html @@ -0,0 +1,1197 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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::CAnimationOptimizer Class Reference

Purpose 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

ITrackcloneTrack (const ITrack *trackIn)
bool isTrackOptimisable (const ITrack *trackIn)
ITrackoptimizeTrack (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  
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 47 of file animation_optimizer.cpp. +

+References _QuaternionThresholdHighPrec, _QuaternionThresholdLowPrec, _SampleFrameRate, _VectorThresholdHighPrec, and _VectorThresholdLowPrec.

+


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  
+
+ + + + + +
+   + + +

+see addLowPrecisionTrack. This clear the array. +

+ +

+Definition at line 605 of file animation_optimizer.cpp. +

+References _LowPrecTrackKeyName.

+

+ + + + +
+ + + + + + + + + + +
ITrack * NL3D::CAnimationOptimizer::cloneTrack const ITrack  trackIn [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 138 of file animation_optimizer.cpp. +

+Referenced by optimize, and optimizeTrack.

+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CAnimationOptimizer::isLowPrecisionTrack const std::string &   trackName [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 611 of file animation_optimizer.cpp. +

+References _LowPrecTrackKeyName. +

+Referenced by optimize.

+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CAnimationOptimizer::isTrackOptimisable const ITrack  trackIn [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 156 of file animation_optimizer.cpp. +

+References nlassert. +

+Referenced by optimize.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::CAnimationOptimizer::nearlySameQuaternion const CQuatD &   quat0,
const CQuatD &   quat1
[private]
+
+ + + + + +
+   + + +

+return true if suppose same quaternion. +

+NB: quaternion must be normalized. NB: test if quat1==quat0 or quat1==-quat0 of course. +

+Definition at line 423 of file animation_optimizer.cpp. +

+References _QuaternionThreshold. +

+Referenced by optimizeQuatTrack, and testConstantQuatTrack.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::CAnimationOptimizer::nearlySameVector const CVectorD &   v0,
const CVectorD &   v1
[private]
+
+ + + + + +
+   + + +

+return true if suppose same vector. +

+ +

+Definition at line 576 of file animation_optimizer.cpp. +

+References _VectorThreshold. +

+Referenced by optimizeVectorTrack, and testConstantVectorTrack.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CAnimationOptimizer::optimize const CAnimation  animIn,
CAnimation  animOut
+
+ + + + + +
+   + + +

+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]
+
+ + + + + +
+   + + +

+optimze the current track. +

+ +

+Definition at line 341 of file animation_optimizer.cpp. +

+References _QuatKeyList, _TimeList, nearlySameQuaternion, nlassert, and t. +

+Referenced by optimizeTrack.

+

+ + + + +
+ + + + + + + + + + +
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]
+
+ + + + + +
+   + + +

+optimze the current track. +

+ +

+Definition at line 499 of file animation_optimizer.cpp. +

+References _TimeList, _VectorKeyList, nearlySameVector, nlassert, and t. +

+Referenced by optimizeTrack.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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]
+
+ + + + + +
+   + + +

+sample the track from beginTime to endTime, sample to numSamples, such that key[0].Time==beginTime and key[numSamples-1].Time==endTime. +

+ +

+Definition at line 449 of file animation_optimizer.cpp. +

+References _TimeList, _VectorKeyList, and t. +

+Referenced by optimizeTrack.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
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
+
+ + + + + +
+   + + +

+Set the Sample Frame Rate (>0) Default is 30 fps. +

+NB: final numSamples must be <65535, else assert at optimize() time. +

+Definition at line 78 of file animation_optimizer.cpp. +

+References _SampleFrameRate, and nlassert.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CAnimationOptimizer::setVectorThreshold double   lowPrecThre,
double   highPrecThre
+
+ + + + + +
+   + + +

+Same principle as for setQuaternionThreshold(), but for vector tracks (positions/scale). +

+Default is 0.001 and 0.0001. Above this value, 2 vectors are said different. NB: comparing 2 vectors is made by geting the norm of the difference +

+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 68 of file animation_optimizer.cpp. +

+References _VectorThresholdHighPrec, _VectorThresholdLowPrec, and nlassert.

+

+ + + + +
+ + + + + + + + + +
bool NL3D::CAnimationOptimizer::testConstantQuatTrack   [private]
+
+ + + + + +
+   + + +

+Test if the current track is constant (ie always same quaternion value) NB: test if q==qRef or q==-qRef of course. +

+ +

+Definition at line 321 of file animation_optimizer.cpp. +

+References _QuatKeyList, nearlySameQuaternion, and nlassert. +

+Referenced by optimizeTrack.

+

+ + + + +
+ + + + + + + + + +
bool NL3D::CAnimationOptimizer::testConstantVectorTrack   [private]
+
+ + + + + +
+   + + +

+Test if the current track is constant (ie always same Vector value). +

+ +

+Definition at line 479 of file animation_optimizer.cpp. +

+References _VectorKeyList, nearlySameVector, and nlassert. +

+Referenced by optimizeTrack.

+


Member Data Documentation

+

+ + + + +
+ + +
std::vector<std::string> NL3D::CAnimationOptimizer::_LowPrecTrackKeyName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 116 of file animation_optimizer.h. +

+Referenced by addLowPrecisionTrack, clearLowPrecisionTracks, and isLowPrecisionTrack.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_QuaternionThreshold [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 109 of file animation_optimizer.h. +

+Referenced by nearlySameQuaternion, and optimize.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_QuaternionThresholdHighPrec [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file animation_optimizer.h. +

+Referenced by CAnimationOptimizer, optimize, and setQuaternionThreshold.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_QuaternionThresholdLowPrec [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 107 of file animation_optimizer.h. +

+Referenced by CAnimationOptimizer, optimize, and setQuaternionThreshold.

+

+ + + + +
+ + +
std::vector<CQuat> NL3D::CAnimationOptimizer::_QuatKeyList [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 120 of file animation_optimizer.h. +

+Referenced by optimizeQuatTrack, optimizeTrack, sampleQuatTrack, and testConstantQuatTrack.

+

+ + + + +
+ + +
float NL3D::CAnimationOptimizer::_SampleFrameRate [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 106 of file animation_optimizer.h. +

+Referenced by CAnimationOptimizer, optimizeTrack, and setSampleFrameRate.

+

+ + + + +
+ + +
std::vector<uint16> NL3D::CAnimationOptimizer::_TimeList [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 119 of file animation_optimizer.h. +

+Referenced by optimizeQuatTrack, optimizeTrack, optimizeVectorTrack, sampleQuatTrack, and sampleVectorTrack.

+

+ + + + +
+ + +
std::vector<CVector> NL3D::CAnimationOptimizer::_VectorKeyList [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 123 of file animation_optimizer.h. +

+Referenced by optimizeTrack, optimizeVectorTrack, sampleVectorTrack, and testConstantVectorTrack.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_VectorThreshold [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 112 of file animation_optimizer.h. +

+Referenced by nearlySameVector, and optimize.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_VectorThresholdHighPrec [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 111 of file animation_optimizer.h. +

+Referenced by CAnimationOptimizer, optimize, and setVectorThreshold.

+

+ + + + +
+ + +
double NL3D::CAnimationOptimizer::_VectorThresholdLowPrec [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 110 of file animation_optimizer.h. +

+Referenced by CAnimationOptimizer, optimize, and setVectorThreshold.

+


The documentation for this class was generated from the following files: + + + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1