diff options
Diffstat (limited to 'docs/doxygen/nel/a02207.html')
-rw-r--r-- | docs/doxygen/nel/a02207.html | 1648 |
1 files changed, 1648 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02207.html b/docs/doxygen/nel/a02207.html new file mode 100644 index 00000000..87ad07c9 --- /dev/null +++ b/docs/doxygen/nel/a02207.html @@ -0,0 +1,1648 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CAnimationOptimizer class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CAnimationOptimizer Class Reference</h1><code>#include <<a class="el" href="a05446.html">animation_optimizer.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Purpose of this class is to optimize for memory and speed a <a class="el" href="a02205.html">CAnimation</a>. Quaternion tracks are optimized. They are transformed to <a class="el" href="a03591.html">CTrackSampledQuat</a> or <a class="el" href="a03548.html">CTrackDefaultQuat</a>. Vector tracks are optimized. They are transformed to <a class="el" href="a03593.html">CTrackSampledVector</a> or <a class="el" href="a03551.html">CTrackDefaultVector</a>. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00054">54</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera0">addLowPrecisionTrack</a> (const std::string &name)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera1">CAnimationOptimizer</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CAnimationOptimizera1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera2">clearLowPrecisionTracks</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">see addLowPrecisionTrack. This clear the array. <a href="#NL3D_1_1CAnimationOptimizera2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera3">optimize</a> (const <a class="el" href="a02205.html">CAnimation</a> &animIn, <a class="el" href="a02205.html">CAnimation</a> &animOut)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera4">setQuaternionThreshold</a> (double lowPrecThre, double highPrecThre)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera5">setSampleFrameRate</a> (float frameRate)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera6">setVectorThreshold</a> (double lowPrecThre, double highPrecThre)</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03542.html">ITrack</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerd0">cloneTrack</a> (const <a class="el" href="a03542.html">ITrack</a> *trackIn)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerd1">isLowPrecisionTrack</a> (const std::string &trackName)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerd2">isTrackOptimisable</a> (const <a class="el" href="a03542.html">ITrack</a> *trackIn)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03542.html">ITrack</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerd3">optimizeTrack</a> (const <a class="el" href="a03542.html">ITrack</a> *trackIn)</td></tr> + +<tr><td colspan="2"><div class="groupHeader"></div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_0">nearlySameQuaternion</a> (const <a class="el" href="a03298.html">CQuatD</a> &quat0, const <a class="el" href="a03298.html">CQuatD</a> &quat1)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_1">optimizeQuatTrack</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_2">sampleQuatTrack</a> (const <a class="el" href="a03542.html">ITrack</a> *trackIn, float beginTime, float endTime, <a class="el" href="a04558.html#a15">uint</a> numSamples)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_3">testConstantQuatTrack</a> ()</td></tr> + +<tr><td colspan="2"><div class="groupHeader"></div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_0">nearlySameVector</a> (const <a class="el" href="a03664.html">CVectorD</a> &v0, const <a class="el" href="a03664.html">CVectorD</a> &v1)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_1">optimizeVectorTrack</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_2">sampleVectorTrack</a> (const <a class="el" href="a03542.html">ITrack</a> *trackIn, float beginTime, float endTime, <a class="el" href="a04558.html#a15">uint</a> numSamples)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_3">testConstantVectorTrack</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::string > </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr0">_LowPrecTrackKeyName</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr1">_QuaternionThreshold</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr2">_QuaternionThresholdHighPrec</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr3">_QuaternionThresholdLowPrec</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03296.html">CQuat</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr5">_SampleFrameRate</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a9">uint16</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03128.html">CVector</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr8">_VectorThreshold</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr9">_VectorThresholdHighPrec</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>double </td><td class="memItemRight" valign=bottom><a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr10">_VectorThresholdLowPrec</a></td></tr> + +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera1" doxytag="NL3D::CAnimationOptimizer::CAnimationOptimizer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NL3D::CAnimationOptimizer::CAnimationOptimizer </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00047">47</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00108">_QuaternionThresholdHighPrec</a>, <a class="el" href="a05446.html#l00107">_QuaternionThresholdLowPrec</a>, <a class="el" href="a05446.html#l00106">_SampleFrameRate</a>, <a class="el" href="a05446.html#l00111">_VectorThresholdHighPrec</a>, and <a class="el" href="a05446.html#l00110">_VectorThresholdLowPrec</a>. +<p> +<div class="fragment"><pre>00048 { +00049 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr5">_SampleFrameRate</a>= 30; +00050 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr3">_QuaternionThresholdLowPrec</a>= 1.0 - 0.0001; +00051 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr2">_QuaternionThresholdHighPrec</a>= 1.0 - 0.000001; +00052 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr10">_VectorThresholdLowPrec</a>= 0.001; +00053 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr9">_VectorThresholdHighPrec</a>= 0.0001; +00054 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera0" doxytag="NL3D::CAnimationOptimizer::addLowPrecisionTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::addLowPrecisionTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>name</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +see <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera4">setQuaternionThreshold()</a>. 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 +<p> +Definition at line <a class="el" href="a05445.html#l00599">599</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00116">_LowPrecTrackKeyName</a>. +<p> +<div class="fragment"><pre>00600 { +00601 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr0">_LowPrecTrackKeyName</a>.push_back(name); +00602 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera2" doxytag="NL3D::CAnimationOptimizer::clearLowPrecisionTracks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::clearLowPrecisionTracks </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +see addLowPrecisionTrack. This clear the array. +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00605">605</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00116">_LowPrecTrackKeyName</a>. +<p> +<div class="fragment"><pre>00606 { +00607 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr0">_LowPrecTrackKeyName</a>.clear(); +00608 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerd0" doxytag="NL3D::CAnimationOptimizer::cloneTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03542.html">ITrack</a> * NL3D::CAnimationOptimizer::cloneTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03542.html">ITrack</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>trackIn</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00138">138</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05979.html#l00331">NLMISC::CMemStream::invert()</a>, and <a class="el" href="a06462.html#l00492">NLMISC::IStream::serialPolyPtr()</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00086">optimize()</a>, and <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00139 { +00140 <a class="code" href="a02271.html">CMemStream</a> memStream; +00141 +00142 <span class="comment">// write to the stream.</span> +00143 ITrack *trackInSerial= const_cast<ITrack*>(trackIn); +00144 memStream.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_6">serialPolyPtr</a>(trackInSerial); +00145 +00146 <span class="comment">// read from the stream.</span> +00147 memStream.<a class="code" href="a02271.html#NLMISC_1_1CStringStreama12">invert</a>(); +00148 ITrack *ret= NULL; +00149 memStream.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_6">serialPolyPtr</a>(ret); +00150 +00151 <span class="keywordflow">return</span> ret; +00152 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerd1" doxytag="NL3D::CAnimationOptimizer::isLowPrecisionTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::isLowPrecisionTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>trackName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00611">611</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00116">_LowPrecTrackKeyName</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00086">optimize()</a>. +<p> +<div class="fragment"><pre>00612 { +00613 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr0">_LowPrecTrackKeyName</a>.size(); i++) +00614 { +00615 <span class="comment">// if find a substr of the key, it is a low prec track</span> +00616 <span class="keywordflow">if</span>( trackName.find(_LowPrecTrackKeyName[i]) != string::npos ) +00617 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00618 } +00619 +00620 <span class="comment">// no key found</span> +00621 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00622 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerd2" doxytag="NL3D::CAnimationOptimizer::isTrackOptimisable" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::isTrackOptimisable </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03542.html">ITrack</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>trackIn</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00156">156</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00086">optimize()</a>. +<p> +<div class="fragment"><pre>00157 { +00158 <a class="code" href="a04199.html#a6">nlassert</a>(trackIn); +00159 +00160 <span class="comment">// If the track is a Linear, Bezier or a TCB track, suppose we can optimize it. Constant may not be interressant....</span> +00161 <span class="keywordflow">if</span>( dynamic_cast<const CTrackKeyFramerTCBQuat*>(trackIn) || +00162 dynamic_cast<const CTrackKeyFramerBezierQuat*>(trackIn) || +00163 dynamic_cast<const CTrackKeyFramerLinearQuat*>(trackIn) ) +00164 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00165 +00166 <span class="comment">// If the track is a Linear, Bezier or a TCB track, suppose we can optimize it. Constant may not be interressant....</span> +00167 <span class="keywordflow">if</span>( dynamic_cast<const CTrackKeyFramerTCBVector*>(trackIn) || +00168 dynamic_cast<const CTrackKeyFramerBezierVector*>(trackIn) || +00169 dynamic_cast<const CTrackKeyFramerLinearVector*>(trackIn) ) +00170 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00171 +00172 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00173 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz28_0" doxytag="NL3D::CAnimationOptimizer::nearlySameQuaternion" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::nearlySameQuaternion </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03298.html">CQuatD</a> & </td> + <td class="mdname" nowrap> <em>quat0</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03298.html">CQuatD</a> & </td> + <td class="mdname" nowrap> <em>quat1</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return true if suppose same quaternion. NB: quaternion must be normalized. NB: test if quat1==quat0 or quat1==-quat0 of course. +<p> +Definition at line <a class="el" href="a05445.html#l00423">423</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00109">_QuaternionThreshold</a>, <a class="el" href="a06308.html#l00139">NLMISC::CQuatT< double >::conjugate()</a>, and <a class="el" href="a06308.html#l00077">NLMISC::CQuatT< double >::w</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00341">optimizeQuatTrack()</a>, and <a class="el" href="a05445.html#l00321">testConstantQuatTrack()</a>. +<p> +<div class="fragment"><pre>00424 { +00425 <span class="comment">// true if exactly same, or exactly inverse</span> +00426 <span class="keywordflow">if</span>(quat0==quat1 || quat0==-quat1) +00427 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00428 +00429 <span class="comment">// Else compute the rotation to go from qRef to q. Use double for better presion.</span> +00430 <a class="code" href="a03298.html">CQuatD</a> quatDif; +00431 quatDif= quat1 * quat0.<a class="code" href="a03297.html#NLMISC_1_1CQuatTz2008_0">conjugate</a>(); +00432 <span class="comment">// inverse the quaternion if necessary. ie make closest to the identity quaternion.</span> +00433 <span class="keywordflow">if</span>(quatDif.<a class="code" href="a03297.html#NLMISC_1_1CQuatTo0">w</a><0) +00434 quatDif= -quatDif; +00435 +00436 <span class="comment">// compare "angle threshold"</span> +00437 <span class="keywordflow">return</span> (quatDif.<a class="code" href="a03297.html#NLMISC_1_1CQuatTo0">w</a> >= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr1">_QuaternionThreshold</a>); +00438 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz29_0" doxytag="NL3D::CAnimationOptimizer::nearlySameVector" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::nearlySameVector </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03664.html">CVectorD</a> & </td> + <td class="mdname" nowrap> <em>v0</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03664.html">CVectorD</a> & </td> + <td class="mdname" nowrap> <em>v1</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return true if suppose same vector. +<p> +Definition at line <a class="el" href="a05445.html#l00576">576</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00112">_VectorThreshold</a>, and <a class="el" href="a06685.html#l00115">NLMISC::CVectorD::norm()</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00499">optimizeVectorTrack()</a>, and <a class="el" href="a05445.html#l00479">testConstantVectorTrack()</a>. +<p> +<div class="fragment"><pre>00577 { +00578 <span class="comment">// true if exactly same</span> +00579 <span class="keywordflow">if</span>(v0==v1) +00580 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00581 +00582 <span class="comment">// Else compute the dif, use double for better precision</span> +00583 <a class="code" href="a03664.html">CVectorD</a> vDif; +00584 vDif= v1-v0; +00585 +00586 <span class="comment">// compare norm</span> +00587 <span class="keywordflow">return</span> (vDif.<a class="code" href="a03664.html#NLMISC_1_1CVectorDz2077_0">norm</a>() <= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr8">_VectorThreshold</a>); +00588 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera3" doxytag="NL3D::CAnimationOptimizer::optimize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::optimize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02205.html">CAnimation</a> & </td> + <td class="mdname" nowrap> <em>animIn</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02205.html">CAnimation</a> & </td> + <td class="mdname" nowrap> <em>animOut</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +optimize an animation animOut is the same as animIn, but optimized. If a track can't be optimized, it is just duplicated in animOut. +<p> +Definition at line <a class="el" href="a05445.html#l00086">86</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00109">_QuaternionThreshold</a>, <a class="el" href="a05446.html#l00108">_QuaternionThresholdHighPrec</a>, <a class="el" href="a05446.html#l00107">_QuaternionThresholdLowPrec</a>, <a class="el" href="a05446.html#l00112">_VectorThreshold</a>, <a class="el" href="a05446.html#l00111">_VectorThresholdHighPrec</a>, <a class="el" href="a05446.html#l00110">_VectorThresholdLowPrec</a>, <a class="el" href="a05443.html#l00064">NL3D::CAnimation::addTrack()</a>, <a class="el" href="a05445.html#l00138">cloneTrack()</a>, <a class="el" href="a05443.html#l00157">NL3D::CAnimation::getEndTime()</a>, <a class="el" href="a05444.html#l00077">NL3D::CAnimation::getIdTrackByName()</a>, <a class="el" href="a05444.html#l00103">NL3D::CAnimation::getTrack()</a>, <a class="el" href="a05443.html#l00108">NL3D::CAnimation::getTrackNames()</a>, <a class="el" href="a05445.html#l00611">isLowPrecisionTrack()</a>, <a class="el" href="a05445.html#l00156">isTrackOptimisable()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05445.html#l00177">optimizeTrack()</a>, <a class="el" href="a05443.html#l00251">NL3D::CAnimation::setMinEndTime()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00087 { +00088 <span class="comment">// reset animOut</span> +00089 <a class="code" href="a05378.html#a381">contReset</a>(animOut); +00090 +00091 <span class="comment">// Parse all tracks of the animation.</span> +00092 set<string> setString; +00093 animIn.getTrackNames (setString); +00094 set<string>::iterator it; +00095 +00096 <span class="keywordflow">for</span>(it=setString.begin();it!=setString.end();it++) +00097 { +00098 <span class="keyword">const</span> string &trackName= *it; +00099 <a class="code" href="a04558.html#a15">uint</a> trackId= animIn.getIdTrackByName(trackName); +00100 <a class="code" href="a04199.html#a6">nlassert</a>(trackId!=CAnimation::NotFound); +00101 <span class="keyword">const</span> ITrack *track= animIn.getTrack(trackId); +00102 +00103 <span class="comment">// If the track is optimisable.</span> +00104 ITrack *newTrack; +00105 <span class="keywordflow">if</span>(<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerd2">isTrackOptimisable</a>(track)) +00106 { +00107 <span class="comment">// choose the threshold according to precision wanted</span> +00108 <span class="keywordflow">if</span>( <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerd1">isLowPrecisionTrack</a>(trackName) ) +00109 { +00110 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr1">_QuaternionThreshold</a>= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr3">_QuaternionThresholdLowPrec</a>; +00111 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr8">_VectorThreshold</a>= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr10">_VectorThresholdLowPrec</a>; +00112 } +00113 <span class="keywordflow">else</span> +00114 { +00115 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr1">_QuaternionThreshold</a>= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr2">_QuaternionThresholdHighPrec</a>; +00116 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr8">_VectorThreshold</a>= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr9">_VectorThresholdHighPrec</a>; +00117 } +00118 +00119 <span class="comment">// optimize it.</span> +00120 newTrack= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerd3">optimizeTrack</a>(track); +00121 } +00122 <span class="keywordflow">else</span> +00123 { +00124 <span class="comment">// just clone it.</span> +00125 newTrack= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerd0">cloneTrack</a>(track); +00126 } +00127 +00128 <span class="comment">// Add it to the animation</span> +00129 animOut.addTrack(trackName, newTrack); +00130 } +00131 +00132 <span class="comment">// Set min animation length</span> +00133 animOut.setMinEndTime (animIn.getEndTime ()); +00134 <a class="code" href="a04199.html#a6">nlassert</a> (animOut.getEndTime() == animIn.getEndTime()); +00135 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz28_1" doxytag="NL3D::CAnimationOptimizer::optimizeQuatTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::optimizeQuatTrack </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +optimze the current track +<p> +Definition at line <a class="el" href="a05445.html#l00341">341</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00120">_QuatKeyList</a>, <a class="el" href="a05446.html#l00119">_TimeList</a>, <a class="el" href="a05445.html#l00423">nearlySameQuaternion()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00342 { +00343 <a class="code" href="a04558.html#a15">uint</a> numSamples= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>.size(); +00344 <a class="code" href="a04199.html#a6">nlassert</a>(numSamples>0); +00345 +00346 <span class="comment">// <=2 key? => no opt possible..</span> +00347 <span class="keywordflow">if</span>(numSamples<=2) +00348 <span class="keywordflow">return</span>; +00349 +00350 <span class="comment">// prepare dest opt</span> +00351 std::vector<uint16> optTimeList; +00352 std::vector<CQuat> optKeyList; +00353 optTimeList.reserve(numSamples); +00354 optKeyList.reserve(numSamples); +00355 +00356 <span class="comment">// Add the first key.</span> +00357 optTimeList.push_back(_TimeList[0]); +00358 optKeyList.push_back(_QuatKeyList[0]); +00359 <span class="keywordtype">double</span> timeRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>[0]; +00360 <a class="code" href="a03298.html">CQuatD</a> quatRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>[0]; +00361 +00362 <span class="comment">// For all keys, but the first and the last, test if can remove them.</span> +00363 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=1; i<numSamples-1; i++) +00364 { +00365 <a class="code" href="a03298.html">CQuatD</a> quatCur= _QuatKeyList[i]; +00366 <a class="code" href="a03298.html">CQuatD</a> quatNext= _QuatKeyList[i+1]; +00367 <span class="keywordtype">double</span> timeCur= _TimeList[i]; +00368 <span class="keywordtype">double</span> timeNext= _TimeList[i+1]; +00369 +00370 <span class="comment">// must add the key?</span> +00371 <span class="keywordtype">bool</span> mustAdd= <span class="keyword">false</span>; +00372 +00373 <span class="comment">// If the Delta time are too big, abort (CTrackSampledQuat limitation)</span> +00374 <span class="keywordflow">if</span>(timeNext-timeRef>255) +00375 { +00376 mustAdd= <span class="keyword">true</span>; +00377 } +00378 <span class="comment">// If the next quaternion or the current quaternion are not on same hemisphere than ref, abort.</span> +00379 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="a03297.html#NLMISC_1_1CQuatTz2014_0">CQuatD::dotProduct</a>(quatCur, quatRef)<0 || <a class="code" href="a03297.html#NLMISC_1_1CQuatTz2014_0">CQuatD::dotProduct</a>(quatNext, quatRef)<0 ) +00380 { +00381 mustAdd= <span class="keyword">true</span>; +00382 } +00383 <span class="comment">// else, test interpolation</span> +00384 <span class="keywordflow">else</span> +00385 { +00386 <span class="comment">// If the 3 quats are nearly equals, it is ok (avoid interpolation)</span> +00387 <span class="keywordflow">if</span>( <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_0">nearlySameQuaternion</a>(quatRef, quatCur) && <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_0">nearlySameQuaternion</a>(quatRef, quatNext) ) +00388 mustAdd= <span class="keyword">false</span>; +00389 <span class="keywordflow">else</span> +00390 { +00391 <span class="comment">// interpolate.</span> +00392 <a class="code" href="a03298.html">CQuatD</a> quatInterpolated; +00393 <span class="keywordtype">double</span> <a class="code" href="a04223.html#a627">t</a>= (timeCur-timeRef)/(timeNext/timeRef); +00394 quatInterpolated= <a class="code" href="a03297.html#NLMISC_1_1CQuatTz2014_2">CQuatD::slerp</a>(quatRef, quatNext, (<span class="keywordtype">float</span>)t); +00395 +00396 <span class="comment">// test if cur and interpolate are equal.</span> +00397 <span class="keywordflow">if</span>( !<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_0">nearlySameQuaternion</a>(quatCur, quatInterpolated) ) +00398 mustAdd= <span class="keyword">true</span>; +00399 } +00400 } +00401 +00402 <span class="comment">// If must add the key to the optimized track.</span> +00403 <span class="keywordflow">if</span>(mustAdd) +00404 { +00405 optTimeList.push_back(_TimeList[i]); +00406 optKeyList.push_back(_QuatKeyList[i]); +00407 timeRef= _TimeList[i]; +00408 quatRef= _QuatKeyList[i]; +00409 } +00410 } +00411 +00412 <span class="comment">// Add the last key.</span> +00413 optTimeList.push_back(_TimeList[numSamples-1]); +00414 optKeyList.push_back(_QuatKeyList[numSamples-1]); +00415 +00416 <span class="comment">// copy the optimized track to the main one.</span> +00417 _TimeList= optTimeList; +00418 _QuatKeyList= optKeyList; +00419 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerd3" doxytag="NL3D::CAnimationOptimizer::optimizeTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03542.html">ITrack</a> * NL3D::CAnimationOptimizer::optimizeTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03542.html">ITrack</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>trackIn</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05445.html#l00177">177</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00120">_QuatKeyList</a>, <a class="el" href="a05446.html#l00106">_SampleFrameRate</a>, <a class="el" href="a05446.html#l00119">_TimeList</a>, <a class="el" href="a05446.html#l00123">_VectorKeyList</a>, <a class="el" href="a06564.html#l00079">NL3D::CTrackSampledVector::build()</a>, <a class="el" href="a06562.html#l00159">NL3D::CTrackSampledQuat::build()</a>, <a class="el" href="a05445.html#l00138">cloneTrack()</a>, <a class="el" href="a03881.html#NL3D_1_1UTrackz1572_0">NL3D::UTrack::getBeginTime()</a>, <a class="el" href="a03881.html#NL3D_1_1UTrackz1572_1">NL3D::UTrack::getEndTime()</a>, <a class="el" href="a03542.html#NL3D_1_1ITracka2">NL3D::ITrack::getLoopMode()</a>, <a class="el" href="a03542.html#NL3D_1_1ITrackKeyFramer_3_01CKeyVector_01_4a11">NL3D::ITrack::getValue()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a05445.html#l00341">optimizeQuatTrack()</a>, <a class="el" href="a05445.html#l00499">optimizeVectorTrack()</a>, <a class="el" href="a05445.html#l00282">sampleQuatTrack()</a>, <a class="el" href="a05445.html#l00449">sampleVectorTrack()</a>, <a class="el" href="a06560.html#l00204">NL3D::CTrackSampledCommon::setLoopMode()</a>, <a class="el" href="a06556.html#l00162">NL3D::CTrackDefaultBlendable< CVector >::setValue()</a>, <a class="el" href="a06556.html#l00162">NL3D::CTrackDefaultBlendable< CQuat >::setValue()</a>, <a class="el" href="a05445.html#l00321">testConstantQuatTrack()</a>, <a class="el" href="a05445.html#l00479">testConstantVectorTrack()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00086">optimize()</a>. +<p> +<div class="fragment"><pre>00178 { +00179 <span class="comment">// Get track param.</span> +00180 <span class="keywordtype">float</span> beginTime= trackIn->getBeginTime(); +00181 <span class="keywordtype">float</span> endTime= trackIn->getEndTime(); +00182 <a class="code" href="a04199.html#a6">nlassert</a>(endTime>=beginTime); +00183 +00184 <span class="comment">// Get num Sample </span> +00185 <a class="code" href="a04558.html#a15">uint</a> numSamples= (<a class="code" href="a04558.html#a15">uint</a>)ceil( (endTime-beginTime)*_SampleFrameRate); +00186 numSamples= max(1U, numSamples); +00187 <a class="code" href="a04199.html#a6">nlassert</a>(numSamples<65535); +00188 +00189 +00190 <span class="comment">// Optimize Quaternion track??</span> +00191 <span class="comment">//================</span> +00192 <span class="keywordflow">if</span>( dynamic_cast<const CAnimatedValueQuat *>(&trackIn->getValue()) ) +00193 { +00194 <span class="comment">// sample the animation. Store result in _TimeList/_QuatKeyList</span> +00195 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_2">sampleQuatTrack</a>(trackIn, beginTime, endTime, numSamples); +00196 +00197 <span class="comment">// check if the sampled track can be reduced to a TrackDefaultQuat. Test _QuatKeyList.</span> +00198 <span class="keywordflow">if</span>( <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_3">testConstantQuatTrack</a>() ) +00199 { +00200 <span class="comment">// create a default Track Quat.</span> +00201 CTrackDefaultQuat *trackDefault= <span class="keyword">new</span> CTrackDefaultQuat; +00202 <span class="comment">// setup the uniform value.</span> +00203 trackDefault->setValue(_QuatKeyList[0]); +00204 +00205 <span class="comment">// return the result.</span> +00206 <span class="keywordflow">return</span> trackDefault; +00207 } +00208 <span class="comment">// else optimize the sampled animation, and build.</span> +00209 <span class="keywordflow">else</span> +00210 { +00211 <span class="comment">// optimize.</span> +00212 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_1">optimizeQuatTrack</a>(); +00213 +00214 <span class="comment">// Create a sampled quaternion track</span> +00215 CTrackSampledQuat *trackSQ= <span class="keyword">new</span> CTrackSampledQuat; +00216 +00217 <span class="comment">// Copy loop from track.</span> +00218 trackSQ->setLoopMode(trackIn->getLoopMode()); +00219 +00220 <span class="comment">// Build it.</span> +00221 trackSQ->build(_TimeList, _QuatKeyList, beginTime, endTime); +00222 +00223 <span class="comment">// return result.</span> +00224 <span class="keywordflow">return</span> trackSQ; +00225 } +00226 } +00227 <span class="comment">// Optimize Position track??</span> +00228 <span class="comment">//================</span> +00229 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( dynamic_cast<const CAnimatedValueVector *>(&trackIn->getValue()) ) +00230 { +00231 <span class="comment">// sample the animation. Store result in _TimeList/_VectorKeyList</span> +00232 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_2">sampleVectorTrack</a>(trackIn, beginTime, endTime, numSamples); +00233 +00234 <span class="comment">// check if the sampled track can be reduced to a TrackDefaultVector. Test _VectorKeyList.</span> +00235 <span class="keywordflow">if</span>( <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_3">testConstantVectorTrack</a>() ) +00236 { +00237 <span class="comment">// create a default Track Vector.</span> +00238 CTrackDefaultVector *trackDefault= <span class="keyword">new</span> CTrackDefaultVector; +00239 <span class="comment">// setup the uniform value.</span> +00240 trackDefault->setValue(_VectorKeyList[0]); +00241 +00242 <span class="comment">// return the result.</span> +00243 <span class="keywordflow">return</span> trackDefault; +00244 } +00245 <span class="comment">// else optimize the sampled animation, and build.</span> +00246 <span class="keywordflow">else</span> +00247 { +00248 <span class="comment">// optimize.</span> +00249 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_1">optimizeVectorTrack</a>(); +00250 +00251 <span class="comment">// Create a sampled Vector track</span> +00252 CTrackSampledVector *trackSV= <span class="keyword">new</span> CTrackSampledVector; +00253 +00254 <span class="comment">// Copy loop from track.</span> +00255 trackSV->setLoopMode(trackIn->getLoopMode()); +00256 +00257 <span class="comment">// Build it.</span> +00258 trackSV->build(_TimeList, _VectorKeyList, beginTime, endTime); +00259 +00260 <span class="comment">// return result.</span> +00261 <span class="keywordflow">return</span> trackSV; +00262 } +00263 } +00264 <span class="keywordflow">else</span> +00265 { +00266 <span class="comment">// Must be a quaternion track or vector track for now.</span> +00267 <a class="code" href="a04199.html#a12">nlstop</a>; +00268 <span class="comment">// Avoid warning.</span> +00269 <span class="keywordflow">return</span> <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerd0">cloneTrack</a>(trackIn); +00270 } +00271 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz29_1" doxytag="NL3D::CAnimationOptimizer::optimizeVectorTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::optimizeVectorTrack </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +optimze the current track +<p> +Definition at line <a class="el" href="a05445.html#l00499">499</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00119">_TimeList</a>, <a class="el" href="a05446.html#l00123">_VectorKeyList</a>, <a class="el" href="a05445.html#l00576">nearlySameVector()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00500 { +00501 <a class="code" href="a04558.html#a15">uint</a> numSamples= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>.size(); +00502 <a class="code" href="a04199.html#a6">nlassert</a>(numSamples>0); +00503 +00504 <span class="comment">// <=2 key? => no opt possible..</span> +00505 <span class="keywordflow">if</span>(numSamples<=2) +00506 <span class="keywordflow">return</span>; +00507 +00508 <span class="comment">// prepare dest opt</span> +00509 std::vector<uint16> optTimeList; +00510 std::vector<CVector> optKeyList; +00511 optTimeList.reserve(numSamples); +00512 optKeyList.reserve(numSamples); +00513 +00514 <span class="comment">// Add the first key.</span> +00515 optTimeList.push_back(_TimeList[0]); +00516 optKeyList.push_back(_VectorKeyList[0]); +00517 <span class="keywordtype">double</span> timeRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>[0]; +00518 <a class="code" href="a03664.html">CVectorD</a> vectorRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>[0]; +00519 +00520 <span class="comment">// For all keys, but the first and the last, test if can remove them.</span> +00521 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=1; i<numSamples-1; i++) +00522 { +00523 <a class="code" href="a03664.html">CVectorD</a> vectorCur= _VectorKeyList[i]; +00524 <a class="code" href="a03664.html">CVectorD</a> vectorNext= _VectorKeyList[i+1]; +00525 <span class="keywordtype">double</span> timeCur= _TimeList[i]; +00526 <span class="keywordtype">double</span> timeNext= _TimeList[i+1]; +00527 +00528 <span class="comment">// must add the key?</span> +00529 <span class="keywordtype">bool</span> mustAdd= <span class="keyword">false</span>; +00530 +00531 <span class="comment">// If the Delta time are too big, abort (CTrackSampledVector limitation)</span> +00532 <span class="keywordflow">if</span>(timeNext-timeRef>255) +00533 { +00534 mustAdd= <span class="keyword">true</span>; +00535 } +00536 <span class="comment">// else, test interpolation</span> +00537 <span class="keywordflow">else</span> +00538 { +00539 <span class="comment">// If the 3 Vectors are nearly equals, it is ok (avoid interpolation)</span> +00540 <span class="keywordflow">if</span>( <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_0">nearlySameVector</a>(vectorRef, vectorCur) && <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_0">nearlySameVector</a>(vectorRef, vectorNext) ) +00541 mustAdd= <span class="keyword">false</span>; +00542 <span class="keywordflow">else</span> +00543 { +00544 <span class="comment">// interpolate.</span> +00545 <a class="code" href="a03664.html">CVectorD</a> vectorInterpolated; +00546 <span class="keywordtype">double</span> <a class="code" href="a04223.html#a627">t</a>= (timeCur-timeRef)/(timeNext/timeRef); +00547 vectorInterpolated= vectorRef*(1-<a class="code" href="a04223.html#a627">t</a>) + vectorNext*<a class="code" href="a04223.html#a627">t</a>; +00548 +00549 <span class="comment">// test if cur and interpolate are equal.</span> +00550 <span class="keywordflow">if</span>( !<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_0">nearlySameVector</a>(vectorCur, vectorInterpolated) ) +00551 mustAdd= <span class="keyword">true</span>; +00552 } +00553 } +00554 +00555 <span class="comment">// If must add the key to the optimized track.</span> +00556 <span class="keywordflow">if</span>(mustAdd) +00557 { +00558 optTimeList.push_back(_TimeList[i]); +00559 optKeyList.push_back(_VectorKeyList[i]); +00560 timeRef= _TimeList[i]; +00561 vectorRef= _VectorKeyList[i]; +00562 } +00563 } +00564 +00565 <span class="comment">// Add the last key.</span> +00566 optTimeList.push_back(_TimeList[numSamples-1]); +00567 optKeyList.push_back(_VectorKeyList[numSamples-1]); +00568 +00569 <span class="comment">// copy the optimized track to the main one.</span> +00570 _TimeList= optTimeList; +00571 _VectorKeyList= optKeyList; +00572 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz28_2" doxytag="NL3D::CAnimationOptimizer::sampleQuatTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::sampleQuatTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03542.html">ITrack</a> * </td> + <td class="mdname" nowrap> <em>trackIn</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>beginTime</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>endTime</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>numSamples</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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. +<p> +Definition at line <a class="el" href="a05445.html#l00282">282</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00120">_QuatKeyList</a>, <a class="el" href="a05446.html#l00119">_TimeList</a>, <a class="el" href="a03297.html#NLMISC_1_1CQuatTz2012_2">NLMISC::CQuatT< float >::makeClosest()</a>, <a class="el" href="a03297.html#NLMISC_1_1CQuatTz2006_1">NLMISC::CQuatT< float >::normalize()</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00283 { +00284 <span class="comment">// resize tmp samples</span> +00285 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>.resize(numSamples); +00286 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>.resize(numSamples); +00287 +00288 <span class="comment">// Sample the animation.</span> +00289 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a627">t</a>= beginTime; +00290 <span class="keywordtype">float</span> dt= 0; +00291 <span class="keywordflow">if</span>(numSamples>1) +00292 dt= (endTime-beginTime)/(numSamples-1); +00293 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<numSamples; i++, <a class="code" href="a04223.html#a627">t</a>+=dt) +00294 { +00295 CQuat quat; +00296 +00297 <span class="comment">// make exact endTime match (avoid precision problem)</span> +00298 <span class="keywordflow">if</span>(i==numSamples-1) +00299 <a class="code" href="a04223.html#a627">t</a>= endTime; +00300 +00301 <span class="comment">// evaluate the track</span> +00302 const_cast<ITrack*>(trackIn)->interpolate(t, quat); +00303 +00304 <span class="comment">// normalize this quaternion</span> +00305 quat.normalize(); +00306 +00307 <span class="comment">// force on same hemisphere according to precedent frame.</span> +00308 <span class="keywordflow">if</span>(i>0) +00309 { +00310 quat.makeClosest(_QuatKeyList[i-1]); +00311 } +00312 +00313 <span class="comment">// store time and key.</span> +00314 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>[i]= i; +00315 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>[i]= quat; +00316 } +00317 +00318 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz29_2" doxytag="NL3D::CAnimationOptimizer::sampleVectorTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::sampleVectorTrack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03542.html">ITrack</a> * </td> + <td class="mdname" nowrap> <em>trackIn</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>beginTime</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>endTime</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>numSamples</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +sample the track from beginTime to endTime, sample to numSamples, such that key[0].Time==beginTime and key[numSamples-1].Time==endTime. +<p> +Definition at line <a class="el" href="a05445.html#l00449">449</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00119">_TimeList</a>, <a class="el" href="a05446.html#l00123">_VectorKeyList</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00450 { +00451 <span class="comment">// resize tmp samples</span> +00452 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>.resize(numSamples); +00453 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>.resize(numSamples); +00454 +00455 <span class="comment">// Sample the animation.</span> +00456 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a627">t</a>= beginTime; +00457 <span class="keywordtype">float</span> dt= 0; +00458 <span class="keywordflow">if</span>(numSamples>1) +00459 dt= (endTime-beginTime)/(numSamples-1); +00460 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<numSamples; i++, <a class="code" href="a04223.html#a627">t</a>+=dt) +00461 { +00462 CVector vector; +00463 +00464 <span class="comment">// make exact endTime match (avoid precision problem)</span> +00465 <span class="keywordflow">if</span>(i==numSamples-1) +00466 <a class="code" href="a04223.html#a627">t</a>= endTime; +00467 +00468 <span class="comment">// evaluate the track</span> +00469 const_cast<ITrack*>(trackIn)->interpolate(t, vector); +00470 +00471 <span class="comment">// store time and key.</span> +00472 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">_TimeList</a>[i]= i; +00473 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>[i]= vector; +00474 } +00475 +00476 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera4" doxytag="NL3D::CAnimationOptimizer::setQuaternionThreshold" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::setQuaternionThreshold </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">double </td> + <td class="mdname" nowrap> <em>lowPrecThre</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>double </td> + <td class="mdname" nowrap> <em>highPrecThre</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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<p> +Give 2 value, one For Low precision and High precision. Default setup use high precision. Use <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera0">addLowPrecisionTrack()</a> to drive low precision tracks. +<p> +Definition at line <a class="el" href="a05445.html#l00058">58</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00108">_QuaternionThresholdHighPrec</a>, <a class="el" href="a05446.html#l00107">_QuaternionThresholdLowPrec</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00059 { +00060 <a class="code" href="a04199.html#a6">nlassert</a>(lowPrecThre>=0); +00061 <a class="code" href="a04199.html#a6">nlassert</a>(highPrecThre>=0); +00062 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr3">_QuaternionThresholdLowPrec</a>= 1.0 - lowPrecThre; +00063 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr2">_QuaternionThresholdHighPrec</a>= 1.0 - highPrecThre; +00064 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera5" doxytag="NL3D::CAnimationOptimizer::setSampleFrameRate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::setSampleFrameRate </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">float </td> + <td class="mdname1" valign="top" nowrap> <em>frameRate</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set the Sample Frame Rate (>0) Default is 30 fps. NB: final numSamples must be <65535, else assert at <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera3">optimize()</a> time. +<p> +Definition at line <a class="el" href="a05445.html#l00078">78</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00106">_SampleFrameRate</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00079 { +00080 <a class="code" href="a04199.html#a6">nlassert</a>(frameRate>0); +00081 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr5">_SampleFrameRate</a>= frameRate; +00082 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizera6" doxytag="NL3D::CAnimationOptimizer::setVectorThreshold" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CAnimationOptimizer::setVectorThreshold </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">double </td> + <td class="mdname" nowrap> <em>lowPrecThre</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>double </td> + <td class="mdname" nowrap> <em>highPrecThre</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Same principle as for <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera4">setQuaternionThreshold()</a>, 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<p> +Give 2 value, one For Low precision and High precision. Default setup use high precision. Use <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizera0">addLowPrecisionTrack()</a> to drive low precision tracks. +<p> +Definition at line <a class="el" href="a05445.html#l00068">68</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00111">_VectorThresholdHighPrec</a>, <a class="el" href="a05446.html#l00110">_VectorThresholdLowPrec</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00069 { +00070 <a class="code" href="a04199.html#a6">nlassert</a>(lowPrecThre>=0); +00071 <a class="code" href="a04199.html#a6">nlassert</a>(highPrecThre>=0); +00072 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr10">_VectorThresholdLowPrec</a>= lowPrecThre; +00073 <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr9">_VectorThresholdHighPrec</a>= highPrecThre; +00074 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz28_3" doxytag="NL3D::CAnimationOptimizer::testConstantQuatTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::testConstantQuatTrack </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Test if the current track is constant (ie always same quaternion value) NB: test if q==qRef or q==-qRef of course. +<p> +Definition at line <a class="el" href="a05445.html#l00321">321</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00120">_QuatKeyList</a>, <a class="el" href="a05445.html#l00423">nearlySameQuaternion()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00322 { +00323 <a class="code" href="a04558.html#a15">uint</a> numSamples= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>.size(); +00324 <a class="code" href="a04199.html#a6">nlassert</a>(numSamples>0); +00325 +00326 <span class="comment">// Get the first sample as the reference quaternion, and test others from this one.</span> +00327 CQuat quatRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">_QuatKeyList</a>[0]; +00328 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<numSamples;i++) +00329 { +00330 <span class="comment">// All values must be nearly equal to the reference quaternion.</span> +00331 <span class="keywordflow">if</span>(!<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz28_0">nearlySameQuaternion</a>(quatRef, _QuatKeyList[i])) +00332 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00333 } +00334 +00335 <span class="comment">// ok.</span> +00336 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00337 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerz29_3" doxytag="NL3D::CAnimationOptimizer::testConstantVectorTrack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CAnimationOptimizer::testConstantVectorTrack </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Test if the current track is constant (ie always same Vector value) +<p> +Definition at line <a class="el" href="a05445.html#l00479">479</a> of file <a class="el" href="a05445.html">animation_optimizer.cpp</a>. +<p> +References <a class="el" href="a05446.html#l00123">_VectorKeyList</a>, <a class="el" href="a05445.html#l00576">nearlySameVector()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>. +<p> +<div class="fragment"><pre>00480 { +00481 <a class="code" href="a04558.html#a15">uint</a> numSamples= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>.size(); +00482 <a class="code" href="a04199.html#a6">nlassert</a>(numSamples>0); +00483 +00484 <span class="comment">// Get the first sample as the reference Vectorer, and test others from this one.</span> +00485 CVector vectorRef= <a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">_VectorKeyList</a>[0]; +00486 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<numSamples;i++) +00487 { +00488 <span class="comment">// All values must be nearly equal to the reference vector.</span> +00489 <span class="keywordflow">if</span>(!<a class="code" href="a02207.html#NL3D_1_1CAnimationOptimizerz29_0">nearlySameVector</a>(vectorRef, _VectorKeyList[i])) +00490 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00491 } +00492 +00493 <span class="comment">// ok.</span> +00494 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00495 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr0" doxytag="NL3D::CAnimationOptimizer::_LowPrecTrackKeyName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::string> <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr0">NL3D::CAnimationOptimizer::_LowPrecTrackKeyName</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00116">116</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00599">addLowPrecisionTrack()</a>, <a class="el" href="a05445.html#l00605">clearLowPrecisionTracks()</a>, and <a class="el" href="a05445.html#l00611">isLowPrecisionTrack()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr1" doxytag="NL3D::CAnimationOptimizer::_QuaternionThreshold" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr1">NL3D::CAnimationOptimizer::_QuaternionThreshold</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00109">109</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00423">nearlySameQuaternion()</a>, and <a class="el" href="a05445.html#l00086">optimize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr2" doxytag="NL3D::CAnimationOptimizer::_QuaternionThresholdHighPrec" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr2">NL3D::CAnimationOptimizer::_QuaternionThresholdHighPrec</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00108">108</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00047">CAnimationOptimizer()</a>, <a class="el" href="a05445.html#l00086">optimize()</a>, and <a class="el" href="a05445.html#l00058">setQuaternionThreshold()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr3" doxytag="NL3D::CAnimationOptimizer::_QuaternionThresholdLowPrec" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr3">NL3D::CAnimationOptimizer::_QuaternionThresholdLowPrec</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00107">107</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00047">CAnimationOptimizer()</a>, <a class="el" href="a05445.html#l00086">optimize()</a>, and <a class="el" href="a05445.html#l00058">setQuaternionThreshold()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr4" doxytag="NL3D::CAnimationOptimizer::_QuatKeyList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03296.html">CQuat</a>> <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr4">NL3D::CAnimationOptimizer::_QuatKeyList</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00120">120</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00341">optimizeQuatTrack()</a>, <a class="el" href="a05445.html#l00177">optimizeTrack()</a>, <a class="el" href="a05445.html#l00282">sampleQuatTrack()</a>, and <a class="el" href="a05445.html#l00321">testConstantQuatTrack()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr5" doxytag="NL3D::CAnimationOptimizer::_SampleFrameRate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr5">NL3D::CAnimationOptimizer::_SampleFrameRate</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00106">106</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00047">CAnimationOptimizer()</a>, <a class="el" href="a05445.html#l00177">optimizeTrack()</a>, and <a class="el" href="a05445.html#l00078">setSampleFrameRate()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr6" doxytag="NL3D::CAnimationOptimizer::_TimeList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a9">uint16</a>> <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr6">NL3D::CAnimationOptimizer::_TimeList</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00119">119</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00341">optimizeQuatTrack()</a>, <a class="el" href="a05445.html#l00177">optimizeTrack()</a>, <a class="el" href="a05445.html#l00499">optimizeVectorTrack()</a>, <a class="el" href="a05445.html#l00282">sampleQuatTrack()</a>, and <a class="el" href="a05445.html#l00449">sampleVectorTrack()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr7" doxytag="NL3D::CAnimationOptimizer::_VectorKeyList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03128.html">CVector</a>> <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr7">NL3D::CAnimationOptimizer::_VectorKeyList</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00123">123</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00177">optimizeTrack()</a>, <a class="el" href="a05445.html#l00499">optimizeVectorTrack()</a>, <a class="el" href="a05445.html#l00449">sampleVectorTrack()</a>, and <a class="el" href="a05445.html#l00479">testConstantVectorTrack()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr8" doxytag="NL3D::CAnimationOptimizer::_VectorThreshold" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr8">NL3D::CAnimationOptimizer::_VectorThreshold</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00112">112</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00576">nearlySameVector()</a>, and <a class="el" href="a05445.html#l00086">optimize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr9" doxytag="NL3D::CAnimationOptimizer::_VectorThresholdHighPrec" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr9">NL3D::CAnimationOptimizer::_VectorThresholdHighPrec</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00111">111</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00047">CAnimationOptimizer()</a>, <a class="el" href="a05445.html#l00086">optimize()</a>, and <a class="el" href="a05445.html#l00068">setVectorThreshold()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CAnimationOptimizerr10" doxytag="NL3D::CAnimationOptimizer::_VectorThresholdLowPrec" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> double <a class="el" href="a02207.html#NL3D_1_1CAnimationOptimizerr10">NL3D::CAnimationOptimizer::_VectorThresholdLowPrec</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05446.html#l00110">110</a> of file <a class="el" href="a05446.html">animation_optimizer.h</a>. +<p> +Referenced by <a class="el" href="a05445.html#l00047">CAnimationOptimizer()</a>, <a class="el" href="a05445.html#l00086">optimize()</a>, and <a class="el" href="a05445.html#l00068">setVectorThreshold()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05446.html">animation_optimizer.h</a><li><a class="el" href="a05445.html">animation_optimizer.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:44:26 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |