aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/seg__remanence_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/seg__remanence_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/seg__remanence_8cpp-source.html529
1 files changed, 529 insertions, 0 deletions
diff --git a/docs/doxygen/nel/seg__remanence_8cpp-source.html b/docs/doxygen/nel/seg__remanence_8cpp-source.html
new file mode 100644
index 00000000..fc340689
--- /dev/null
+++ b/docs/doxygen/nel/seg__remanence_8cpp-source.html
@@ -0,0 +1,529 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>seg_remanence.cpp</h1><a href="seg__remanence_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00006 <font class="comment">/* Copyright, 2000, 2001, 2002 Nevrax Ltd.</font>
+00007 <font class="comment"> *</font>
+00008 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00009 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00010 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00011 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00012 <font class="comment"> * any later version.</font>
+00013 <font class="comment"></font>
+00014 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00015 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00016 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00017 <font class="comment"> * General Public License for more details.</font>
+00018 <font class="comment"></font>
+00019 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00020 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00021 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00022 <font class="comment"> * MA 02111-1307, USA.</font>
+00023 <font class="comment"> */</font>
+00024
+00025 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
+00026
+00027 <font class="preprocessor">#include "<a class="code" href="seg__remanence_8h.html">3d/seg_remanence.h</a>"</font>
+00028 <font class="preprocessor">#include "<a class="code" href="seg__remanence__shape_8h.html">3d/seg_remanence_shape.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="vertex__buffer_8h.html">3d/vertex_buffer.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="anim__detail__trav_8h.html">3d/anim_detail_trav.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="skeleton__model_8h.html">3d/skeleton_model.h</a>"</font>
+00034
+00035
+00036
+00037
+00038 <font class="keyword">namespace </font>NL3D
+00039 {
+00040
+00042 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a450">BuildHermiteVector</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;P0,
+00043 <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;P1,
+00044 <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;T0,
+00045 <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;T1,
+00046 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;dest,
+00047 <font class="keywordtype">float</font> lambda
+00048 )
+00049 {
+00050 <font class="keyword">const</font> <font class="keywordtype">float</font> lambda2 = lambda * lambda;
+00051 <font class="keyword">const</font> <font class="keywordtype">float</font> lambda3 = lambda2 * lambda;
+00052 <font class="keyword">const</font> <font class="keywordtype">float</font> h1 = 2 * lambda3 - 3 * lambda2 + 1;
+00053 <font class="keyword">const</font> <font class="keywordtype">float</font> h2 = - 2 * lambda3 + 3 * lambda2;
+00054 <font class="keyword">const</font> <font class="keywordtype">float</font> h3 = lambda3 - 2 * lambda2 + lambda;
+00055 <font class="keyword">const</font> <font class="keywordtype">float</font> h4 = lambda3 - lambda2;
+00057 dest.<a class="code" href="classNLMISC_1_1CVector.html#z332_0">set</a> (h1 * P0.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> + h2 * P1.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> + h3 * T0.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> + h4 * T1.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>,
+00058 h1 * P0.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> + h2 * P1.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> + h3 * T0.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> + h4 * T1.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>,
+00059 h1 * P0.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> + h2 * P1.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> + h3 * T0.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> + h4 * T1.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>);
+00060
+00061 }
+00062
+00063 <font class="comment">//===============================================================</font>
+<a name="l00064"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z787_0">00064</a> CSegRemanence::CSegRemanence() : _NumSlice(0),
+00065 _Started(false),
+00066 _Stopping(false),
+00067 _Restarted(false),
+00068 _UnrollRatio(0),
+00069 _AniMat(NULL)
+00070 {
+00071 IAnimatable::resize(<a class="code" href="classNL3D_1_1CSegRemanence.html#s2s1">AnimValueLast</a>);
+00072 }
+00073
+00074 <font class="comment">//===============================================================</font>
+<a name="l00075"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z787_1">00075</a> CSegRemanence::~CSegRemanence()
+00076 {
+00077 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>;
+00078 <font class="comment">// Auto detach me from skeleton. Must do it here, not in ~CTransform().</font>
+00079 <font class="keywordflow">if</font>(_FatherSkeletonModel)
+00080 {
+00081 <font class="comment">// detach me from the skeleton.</font>
+00082 <font class="comment">// Observers hierarchy is modified.</font>
+00083 <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;detachSkeletonSon(<font class="keyword">this</font>);
+00084 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>==NULL);
+00085 }
+00086 }
+00087
+00088 <font class="comment">//===============================================================</font>
+<a name="l00089"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z787_2">00089</a> CSegRemanence::CSegRemanence(CSegRemanence &amp;other) : CTransformShape(other), _AniMat(NULL)
+00090 {
+00091 <a class="code" href="classNL3D_1_1CSegRemanence.html#c1">copyFromOther</a>(other);
+00092 }
+00093
+00094 <font class="comment">//===============================================================</font>
+<a name="l00095"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z787_3">00095</a> CSegRemanence &amp;CSegRemanence::operator = (CSegRemanence &amp;other)
+00096 {
+00097 <font class="keywordflow">if</font> (<font class="keyword">this</font> != &amp;other)
+00098 {
+00099 (<a class="code" href="classNL3D_1_1CTransformShape.html#b0">CTransformShape</a> &amp;) *<font class="keyword">this</font> = (<a class="code" href="classNL3D_1_1CTransformShape.html#b0">CTransformShape</a> &amp;) other; <font class="comment">// copy base</font>
+00100 <a class="code" href="classNL3D_1_1CSegRemanence.html#c1">copyFromOther</a>(other);
+00101 }
+00102 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
+00103 }
+00104
+00105 <font class="comment">//===============================================================</font>
+<a name="l00106"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#c1">00106</a> <font class="keywordtype">void</font> CSegRemanence::copyFromOther(CSegRemanence &amp;other)
+00107 {
+00108 <font class="keywordflow">if</font> (<font class="keyword">this</font> == &amp;other) <font class="keywordflow">return</font>;
+00109
+00110 CAnimatedMaterial *otherMat = other._AniMat != NULL ? <font class="keyword">new</font> CAnimatedMaterial(*other._AniMat)
+00111 : NULL;
+00112 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>;
+00113 <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a> = otherMat;
+00114
+00115 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a> = other._Ribbons; <font class="comment">// sampled positions at each extremities of segment</font>
+00116 <a class="code" href="classNL3D_1_1CSegRemanence.html#o1">_NumSlice</a> = other._NumSlice;
+00117 <a class="code" href="classNL3D_1_1CSegRemanence.html#o2">_NumCorners</a> = other._NumCorners;
+00118 <a class="code" href="classNL3D_1_1CSegRemanence.html#o3">_Started</a> = other._Started;
+00119 <a class="code" href="classNL3D_1_1CSegRemanence.html#o5">_Restarted</a> = other._Restarted;
+00120 <a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a> = other._Stopping;
+00121 <a class="code" href="classNL3D_1_1CSegRemanence.html#o6">_StartDate</a> = other._StartDate;
+00122 <a class="code" href="classNL3D_1_1CSegRemanence.html#o7">_CurrDate</a> = other._CurrDate;
+00123
+00124 }
+00125
+00126 <font class="comment">//===============================================================</font>
+<a name="l00127"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#d0">00127</a> <font class="keywordtype">void</font> CSegRemanence::registerBasic()
+00128 {
+00129 CMOT::registerModel(<a class="code" href="namespaceNL3D.html#a457">SegRemanenceShapeId</a>, <a class="code" href="namespaceNL3D.html#a277">TransformShapeId</a>, CSegRemanence::creator);
+00130 <font class="comment">// CMOT::registerObs (HrcTravId, SegRemanenceShapeId, CSegRemanenceHrcObs::creator);</font>
+00131 CMOT::registerObs(<a class="code" href="namespaceNL3D.html#a3">AnimDetailTravId</a>, <a class="code" href="namespaceNL3D.html#a457">SegRemanenceShapeId</a>, CSegRemanenceAnimDetailObs::creator);
+00132 }
+00133
+00134
+00135 <font class="comment">//===============================================================</font>
+<a name="l00136"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#a0">00136</a> <font class="keywordtype">void</font> CSegRemanence::render(IDriver *drv, CVertexBuffer &amp;vb, CPrimitiveBlock &amp;pb, CMaterial &amp;mat)
+00137 {
+00138 CSegRemanenceShape *srs = NLMISC::safe_cast&lt;CSegRemanenceShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00139 <font class="keyword">const</font> uint vertexSize = vb.getVertexSize();
+00140 uint8 *datas = (uint8 *) vb.getVertexCoordPointer();
+00141 uint numCorners = <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>.size();
+00142 <font class="keywordflow">for</font>(uint k = 0; k &lt; numCorners; ++k)
+00143 {
+00144 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>[k].fillVB(datas, vertexSize, srs-&gt;getNumSlices(), srs-&gt;getSliceTime());
+00145 datas += (<a class="code" href="classNL3D_1_1CSegRemanence.html#o1">_NumSlice</a> + 1) * vertexSize;
+00146 }
+00147
+00148 <font class="comment">// roll / unroll using texture matrix</font>
+00149 CMatrix texMat;
+00150 texMat.setPos(<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(1.f - <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a>, 0, 0));
+00151 <font class="keywordflow">if</font> (mat.getTexture(0) != NULL)
+00152 mat.setUserTexMat(0, texMat);
+00153
+00154
+00155
+00156 drv-&gt;activeVertexBuffer(vb);
+00157 drv-&gt;render(pb, mat);
+00158
+00159 CScene *scene = NLMISC::safe_cast&lt;ITravScene *&gt;(<a class="code" href="classNL3D_1_1CTransform.html#n0">_HrcObs</a>-&gt;Trav)-&gt;Scene;
+00160 <font class="comment">// change unroll ratio</font>
+00161 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a>)
+00162 {
+00163 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> != 1.f)
+00164 <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(1.f, <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> + scene-&gt;getEllapsedTime() / (srs-&gt;getNumSlices() * srs-&gt;getSliceTime()));
+00165 }
+00166 <font class="keywordflow">else</font>
+00167 {
+00168 <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> = std::max(0.f, <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> - srs-&gt;getRollupRatio() * scene-&gt;getEllapsedTime() / (srs-&gt;getNumSlices() * srs-&gt;getSliceTime()));
+00169 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> == 0.f)
+00170 {
+00171 <a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a> = <font class="keyword">false</font>;
+00172 <a class="code" href="classNL3D_1_1CSegRemanence.html#o3">_Started</a> = <font class="keyword">false</font>;
+00173 }
+00174 }
+00175 }
+00176
+00177 <font class="comment">//===============================================================</font>
+<a name="l00178"></a><a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#a0">00178</a> CSegRemanence::CRibbon::CRibbon() : _LastSamplingDate(0)
+00179 {
+00180 }
+00181
+00182 <font class="comment">//===============================================================</font>
+<a name="l00183"></a><a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#a3">00183</a> <font class="keywordtype">void</font> CSegRemanence::CRibbon::fillVB(uint8 *dest, uint <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>, uint nbSegs, <font class="keywordtype">float</font> sliceTime)
+00184 {
+00185 TSampledPosVect::iterator currIt = <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.begin();
+00186
+00187 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> t0 = (currIt + 1)-&gt;Pos - currIt-&gt;Pos;
+00188 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> t1 = 0.5f * ((currIt + 2)-&gt;Pos - currIt-&gt;Pos);
+00189
+00190 uint leftToDo = nbSegs + 1;
+00191
+00192 <font class="keywordtype">float</font> lambda = 0.f;
+00193 <font class="keywordtype">float</font> lambdaStep = 1.f;
+00194
+00195 <font class="comment">/* nlinfo("===============================");</font>
+00196 <font class="comment"> for(uint k = 0; k &lt; _Ribbon.size(); ++k)</font>
+00197 <font class="comment"> {</font>
+00198 <font class="comment"> nlinfo("pos = (%.2f, %.2f, %.2f)", _Ribbon[k].Pos.x, _Ribbon[k].Pos.y, _Ribbon[k].Pos.z);</font>
+00199 <font class="comment"> }*/</font>
+00200
+00201 <font class="keywordflow">for</font> (;;)
+00202 {
+00203 <font class="keywordtype">float</font> dt = currIt-&gt;SamplingDate - (currIt + 1)-&gt;SamplingDate;
+00204
+00205 <font class="keywordflow">if</font> (dt &lt; 10E-6f) <font class="comment">// we reached the start of ribbon</font>
+00206 {
+00207
+00208 <font class="keywordflow">do</font>
+00209 {
+00210 (<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;) *dest = currIt-&gt;Pos;
+00211 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
+00212 }
+00213 <font class="keywordflow">while</font> (--leftToDo);
+00214 <font class="keywordflow">return</font>;
+00215 }
+00216
+00217 <font class="keywordtype">float</font> newLambdaStep = sliceTime / dt;
+00218 <font class="comment">// readapt lambda</font>
+00219 lambda *= newLambdaStep / lambdaStep;
+00220 lambdaStep = newLambdaStep;
+00221 <font class="keywordflow">for</font>(;;)
+00222 {
+00223 <font class="keywordflow">if</font> (lambda &gt;= 1.f) <font class="keywordflow">break</font>;
+00225 <a class="code" href="namespaceNL3D.html#a450">BuildHermiteVector</a>(currIt-&gt;Pos, (currIt + 1)-&gt;Pos, t0, t1, (<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;) *dest, lambda);
+00226 dest += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
+00227 -- leftToDo;
+00228 <font class="keywordflow">if</font> (!leftToDo) <font class="keywordflow">return</font>;
+00229 lambda += lambdaStep;
+00230 }
+00231
+00232 lambda -= 1.f;
+00233
+00234 <font class="comment">// Start new segment and compute new tangents</font>
+00235 t0 = t1;
+00236 ++currIt;
+00237 t1 = 0.5f * ((currIt + 2)-&gt;Pos - currIt-&gt;Pos);
+00238 }
+00239 }
+00240
+00241 <font class="comment">//===============================================================</font>
+<a name="l00242"></a><a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#a4">00242</a> <font class="keywordtype">void</font> CSegRemanence::CRibbon::duplicateFirstPos()
+00243 {
+00244 uint ribSize = <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.size();
+00245 <font class="keywordflow">for</font>(uint k = 1; k &lt; ribSize; ++k)
+00246 {
+00247 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>[k] = <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>[0];
+00248 }
+00249 }
+00250
+00251 <font class="comment">//===============================================================</font>
+<a name="l00252"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#a2">00252</a> <font class="keywordtype">void</font> CSegRemanence::setupFromShape()
+00253 {
+00254 CSegRemanenceShape *srs = NLMISC::safe_cast&lt;CSegRemanenceShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00255 <font class="keywordflow">if</font> (srs-&gt;getNumCorners() != <a class="code" href="classNL3D_1_1CSegRemanence.html#o2">_NumCorners</a> || srs-&gt;getNumSlices() != <a class="code" href="classNL3D_1_1CSegRemanence.html#o1">_NumSlice</a>)
+00256 {
+00257 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>.resize(srs-&gt;getNumCorners());
+00258 <font class="keywordflow">for</font>(uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>.size(); ++k)
+00259 {
+00260 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>[k].setNumSlices(srs-&gt;getNumSlices());
+00261 }
+00262 <a class="code" href="classNL3D_1_1CSegRemanence.html#o2">_NumCorners</a> = srs-&gt;getNumCorners();
+00263 <a class="code" href="classNL3D_1_1CSegRemanence.html#o1">_NumSlice</a> = srs-&gt;getNumSlices();
+00264 }
+00265 <a class="code" href="classNL3D_1_1CSegRemanence.html#c0">updateOpacityFromShape</a>();
+00266 }
+00267
+00268
+00269 <font class="comment">//===============================================================</font>
+<a name="l00270"></a><a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#a1">00270</a> <font class="keywordtype">void</font> CSegRemanence::CRibbon::setNumSlices(uint numSegs)
+00271 {
+00272 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.resize(numSegs + 3);
+00273 }
+00274
+00275 <font class="comment">//===============================================================</font>
+<a name="l00276"></a><a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#a2">00276</a> <font class="keywordtype">void</font> CSegRemanence::CRibbon::samplePos(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;pos, <font class="keywordtype">float</font> date, <font class="keywordtype">float</font> sliceDuration)
+00277 {
+00278 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.size() != 0);
+00279 <font class="keywordflow">if</font> (date - <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o1">_LastSamplingDate</a> &gt; sliceDuration)
+00280 {
+00281 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.pop_back();
+00282 CSampledPos sp(pos, date);
+00283 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.push_front(sp);
+00284 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o1">_LastSamplingDate</a> = date;
+00285 }
+00286 <font class="keywordflow">else</font>
+00287 {
+00288 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.front().Pos = pos;
+00289 <a class="code" href="classNL3D_1_1CSegRemanence_1_1CRibbon.html#o0">_Ribbon</a>.front().SamplingDate = date;
+00290 }
+00291 }
+00292
+00293 <font class="comment">//===============================================================</font>
+<a name="l00294"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#a1">00294</a> <font class="keywordtype">void</font> CSegRemanence::samplePos(<font class="keywordtype">float</font> date)
+00295 {
+00296 <font class="keywordflow">if</font> (_Started)
+00297 {
+00298 IBaseHrcObs *bho = (IBaseHrcObs *) <a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<a class="code" href="namespaceNL3D.html#a41">HrcTravId</a>);
+00299 CSegRemanenceShape *srs = NLMISC::safe_cast&lt;CSegRemanenceShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00300 uint numCorners = <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>.size();
+00301 <font class="keywordflow">for</font>(uint k = 0; k &lt; numCorners; ++k)
+00302 {
+00303 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>[k].samplePos(bho-&gt;WorldMatrix * srs-&gt;getCorner(k), date, srs-&gt;getSliceTime());
+00304 }
+00305 <font class="keywordflow">if</font> (_Restarted)
+00306 {
+00307 <font class="keywordflow">for</font>(uint k = 0; k &lt; numCorners; ++k)
+00308 {
+00309 <a class="code" href="classNL3D_1_1CSegRemanence.html#o0">_Ribbons</a>[k].duplicateFirstPos();
+00310 }
+00311 <a class="code" href="classNL3D_1_1CSegRemanence.html#o5">_Restarted</a> = <font class="keyword">false</font>;
+00312 <a class="code" href="classNL3D_1_1CSegRemanence.html#o6">_StartDate</a> = date;
+00313 }
+00314 <a class="code" href="classNL3D_1_1CSegRemanence.html#o7">_CurrDate</a> = date;
+00315 }
+00316 }
+00317
+00318 <font class="comment">//===============================================================</font>
+00319 <font class="comment">/*</font>
+00320 <font class="comment">void CSegRemanenceHrcObs::traverse(IObs *caller)</font>
+00321 <font class="comment">{</font>
+00322 <font class="comment"> CTransformHrcObs::traverse (caller);</font>
+00323 <font class="comment"> CSegRemanence *sr = static_cast&lt;CSegRemanence *&gt;(this-&gt;Model);</font>
+00324 <font class="comment"> if (sr-&gt;isStarted())</font>
+00325 <font class="comment"> { </font>
+00326 <font class="comment"> CScene *scene = NLMISC::safe_cast&lt;ITravScene *&gt;(Trav)-&gt;Scene;</font>
+00327 <font class="comment"> if (scene-&gt;getNumRender() != (_LastSampleFrame + 1))</font>
+00328 <font class="comment"> {</font>
+00329 <font class="comment"> if (!sr-&gt;isStopping())</font>
+00330 <font class="comment"> { </font>
+00331 <font class="comment"> // if wasn't visible at previous frame, must invalidate position</font>
+00332 <font class="comment"> sr-&gt;restart();</font>
+00333 <font class="comment"> }</font>
+00334 <font class="comment"> else</font>
+00335 <font class="comment"> {</font>
+00336 <font class="comment"> // ribbon started unrolling when it disapperaed from screen so simply remove it</font>
+00337 <font class="comment"> sr-&gt;stopNoUnroll();</font>
+00338 <font class="comment"> }</font>
+00339 <font class="comment"> } </font>
+00340 <font class="comment"> _LastSampleFrame = scene-&gt;getNumRender();</font>
+00341 <font class="comment"> sr-&gt;setupFromShape();</font>
+00342 <font class="comment"> sr-&gt;samplePos((float) scene-&gt;getCurrentTime());</font>
+00343 <font class="comment"> }</font>
+00344 <font class="comment">}</font>
+00345 <font class="comment">*/</font>
+00346
+00347 <font class="comment">/*</font>
+00348 <font class="comment">//===============================================================</font>
+00349 <font class="comment">CSegRemanenceHrcObs::CSegRemanenceHrcObs() : _LastSampleFrame(0)</font>
+00350 <font class="comment">{ </font>
+00351 <font class="comment">}</font>
+00352 <font class="comment">*/</font>
+00353
+00354 <font class="comment">//===============================================================</font>
+<a name="l00355"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z788_1">00355</a> <font class="keywordtype">void</font> CSegRemanence::start()
+00356 {
+00357 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSegRemanence.html#o3">_Started</a> &amp;&amp; !<a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a>) <font class="keywordflow">return</font>;
+00358 <a class="code" href="classNL3D_1_1CSegRemanence.html#z788_6">restart</a>();
+00359 }
+00360
+00361 <font class="comment">//===============================================================</font>
+<a name="l00362"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z788_6">00362</a> <font class="keywordtype">void</font> CSegRemanence::restart()
+00363 {
+00364 CSegRemanenceShape *srs = NLMISC::safe_cast&lt;CSegRemanenceShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00365 <font class="keywordflow">if</font> (!srs-&gt;getTextureShifting())
+00366 {
+00367 <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> = 1.f;
+00368 }
+00369 <font class="keywordflow">else</font>
+00370 {
+00371 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a>)
+00372 <a class="code" href="classNL3D_1_1CSegRemanence.html#o8">_UnrollRatio</a> = 0.f;
+00373 }
+00374 <a class="code" href="classNL3D_1_1CSegRemanence.html#o3">_Started</a> = <a class="code" href="classNL3D_1_1CSegRemanence.html#o5">_Restarted</a> = <font class="keyword">true</font>;
+00375 <a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a> = <font class="keyword">false</font>;
+00376 }
+00377
+00378 <font class="comment">//===============================================================</font>
+<a name="l00379"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z788_2">00379</a> <font class="keywordtype">void</font> CSegRemanence::stop()
+00380 {
+00381 <a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a> = <font class="keyword">true</font>;
+00382 }
+00383
+00384 <font class="comment">//===============================================================</font>
+<a name="l00385"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#z788_3">00385</a> <font class="keywordtype">void</font> CSegRemanence::stopNoUnroll()
+00386 {
+00387 <a class="code" href="classNL3D_1_1CSegRemanence.html#o3">_Started</a> = <a class="code" href="classNL3D_1_1CSegRemanence.html#o5">_Restarted</a> = <a class="code" href="classNL3D_1_1CSegRemanence.html#o4">_Stopping</a> = <font class="keyword">false</font>;
+00388 }
+00389
+00390 <font class="comment">//===============================================================</font>
+<a name="l00391"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#c0">00391</a> <font class="keywordtype">void</font> CSegRemanence::updateOpacityFromShape()
+00392 {
+00393 CSegRemanenceShape *srs = NLMISC::safe_cast&lt;CSegRemanenceShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00394 <font class="keywordtype">bool</font> transparent = srs-&gt;getMaterial().getBlend();
+00395 <a class="code" href="classNL3D_1_1CTransform.html#a0">setTransparency</a>(transparent);
+00396 <a class="code" href="classNL3D_1_1CTransform.html#a1">setOpacity</a>(!transparent);
+00397 }
+00398
+00399 <font class="comment">//===============================================================</font>
+<a name="l00400"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#a3">00400</a> <font class="keywordtype">void</font> CSegRemanence::setAnimatedMaterial(CAnimatedMaterial *mat)
+00401 {
+00402 <font class="keywordflow">if</font> (mat == <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>) <font class="keywordflow">return</font>;
+00403 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>;
+00404 <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a> = mat;
+00405 <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>-&gt;setFather(<font class="keyword">this</font>, <a class="code" href="classNL3D_1_1CSegRemanence.html#s2s0">OwnerBit</a>);
+00406 }
+00407
+00408 <font class="comment">//===============================================================</font>
+<a name="l00409"></a><a class="code" href="classNL3D_1_1CSegRemanence.html#a5">00409</a> <font class="keywordtype">void</font> CSegRemanence::registerToChannelMixer(CChannelMixer *chanMixer, <font class="keyword">const</font> std::string &amp;prefix)
+00410 {
+00411 CTransformShape::registerToChannelMixer(chanMixer, prefix);
+00412 <font class="keywordflow">if</font> (_AniMat)
+00413 {
+00414 <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>-&gt;registerToChannelMixer(chanMixer, prefix + <a class="code" href="classNL3D_1_1CSegRemanence.html#o9">_AniMat</a>-&gt;getMaterialName() + <font class="stringliteral">"."</font>) ;
+00415 }
+00416 }
+00417
+00418 <font class="comment">//===============================================================</font>
+<a name="l00419"></a><a class="code" href="classNL3D_1_1CSegRemanenceAnimDetailObs.html#a1">00419</a> <font class="keywordtype">void</font> CSegRemanenceAnimDetailObs::traverse(IObs *caller)
+00420 {
+00421 CTransformAnimDetailObs::traverse(caller);
+00422 CSegRemanence *sr = NLMISC::safe_cast&lt;CSegRemanence *&gt;(Model);
+00423 <font class="keywordflow">if</font> (sr-&gt;isStarted())
+00424 {
+00427
+00428 CScene *scene = NLMISC::safe_cast&lt;ITravScene *&gt;(Trav)-&gt;Scene;
+00429 <font class="keywordflow">if</font> (scene-&gt;getNumRender() != (<a class="code" href="classNL3D_1_1CSegRemanenceAnimDetailObs.html#o0">_LastSampleFrame</a> + 1))
+00430 {
+00431 <font class="keywordflow">if</font> (!sr-&gt;isStopping())
+00432 {
+00433 <font class="comment">// if wasn't visible at previous frame, must invalidate position</font>
+00434 sr-&gt;restart();
+00435 }
+00436 <font class="keywordflow">else</font>
+00437 {
+00438 <font class="comment">// ribbon started unrolling when it disapperaed from screen so simply remove it</font>
+00439 sr-&gt;stopNoUnroll();
+00440 }
+00441 }
+00442 <a class="code" href="classNL3D_1_1CSegRemanenceAnimDetailObs.html#o0">_LastSampleFrame</a> = scene-&gt;getNumRender();
+00443 sr-&gt;setupFromShape();
+00444 sr-&gt;samplePos((<font class="keywordtype">float</font>) scene-&gt;getCurrentTime());
+00445
+00448
+00449
+00450 <font class="comment">// test if animated material must be updated.</font>
+00451 <font class="keywordflow">if</font>(sr-&gt;IAnimatable::isTouched(CSegRemanence::OwnerBit))
+00452 {
+00453 <font class="keywordflow">if</font> (sr-&gt;getAnimatedMaterial())
+00454 sr-&gt;getAnimatedMaterial()-&gt;update();
+00455 sr-&gt;clearAnimatedMatFlag();
+00456 }
+00457 }
+00458 }
+00459
+<a name="l00460"></a><a class="code" href="classNL3D_1_1CSegRemanenceAnimDetailObs.html#a0">00460</a> CSegRemanenceAnimDetailObs::CSegRemanenceAnimDetailObs() : _LastSampleFrame(0)
+00461 {
+00462 }
+00463
+00464
+00465
+00466 }
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>