aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__attrib__maker__template_8h-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/ps__attrib__maker__template_8h-source.html')
-rw-r--r--docs/doxygen/nel/ps__attrib__maker__template_8h-source.html473
1 files changed, 473 insertions, 0 deletions
diff --git a/docs/doxygen/nel/ps__attrib__maker__template_8h-source.html b/docs/doxygen/nel/ps__attrib__maker__template_8h-source.html
new file mode 100644
index 00000000..a8a864f7
--- /dev/null
+++ b/docs/doxygen/nel/ps__attrib__maker__template_8h-source.html
@@ -0,0 +1,473 @@
+<!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>ps_attrib_maker_template.h</h1><a href="ps__attrib__maker__template_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#ifndef NL_PS_ATTRIB_MAKER_TEMPLATE_H</font>
+00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_PS_ATTRIB_MAKER_TEMPLATE_H</font>
+00028 <font class="preprocessor"></font>
+00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="ps__attrib__maker__helper_8h.html">3d/ps_attrib_maker_helper.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="ps__plane__basis_8h.html">3d/ps_plane_basis.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="fast__floor_8h.html">3d/fast_floor.h</a>"</font>
+00033
+00034 <font class="keyword">namespace </font>NL3D {
+00035
+00036 <font class="comment">/*</font>
+00037 <font class="comment"> * In this file, we define several template that helps to create attributes maker such as gradient (of float, int, vector etc) </font>
+00038 <font class="comment"> * attributes maker are used in the particle system to generate values, such as size, color etc. see ps_attrib_maker.h</font>
+00039 <font class="comment"> * for more informations</font>
+00040 <font class="comment"> */</font>
+00041
+00042
+00043
+00044
+00050 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt;
+00051 <font class="keyword">inline</font> T <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(<font class="keyword">const</font> T &amp;t1, <font class="keyword">const</font> T &amp;t2, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>)
+00052 {
+00053 <font class="keywordflow">return</font> T(<a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a> * t2 + (1.f - <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>) * t1);
+00054 }
+00055
+00056
+00058 <font class="keyword">template</font> &lt;&gt;
+00059 <font class="keyword">inline</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> &amp;t1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> &amp;t2, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>)
+00060 {
+00061 <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> result;
+00062 result.<a class="code" href="classNLMISC_1_1CRGBA.html#a7">blendFromui</a>(t1, t2, <a class="code" href="namespaceNL3D.html#a362">OptFastFloor</a>(255.0f * <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>));
+00063 <font class="keywordflow">return</font> result;
+00064 }
+00065
+00066
+00068 <font class="keyword">template</font> &lt;&gt;
+00069 <font class="keyword">inline</font> CPlaneBasis <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(<font class="keyword">const</font> CPlaneBasis &amp;t1, <font class="keyword">const</font> CPlaneBasis &amp;t2, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>)
+00070 {
+00071 <font class="keywordflow">return</font> CPlaneBasis(<a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(t1.getNormal(), t2.getNormal(), <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>));
+00072 }
+00073
+00074
+<a name="l00076"></a><a class="code" href="structNL3D_1_1CPSValueBlendFuncBase.html">00076</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">struct </font>CPSValueBlendFuncBase
+00077 {
+00078 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="structNL3D_1_1CPSValueBlendFuncBase.html#a0">getValues</a>(T &amp;startValue, T &amp;endValue) <font class="keyword">const</font> = 0;
+00079 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="structNL3D_1_1CPSValueBlendFuncBase.html#a1">setValues</a>(T startValue, T endValue) = 0;
+00080 };
+00081
+00082
+00083
+<a name="l00093"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html">00093</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">class </font>CPSValueBlendFunc : <font class="keyword">public</font> CPSValueBlendFuncBase&lt;T&gt;
+00094 {
+00095 <font class="keyword">public</font>:
+00097
+00098
+<a name="l00099"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z714_0">00099</a> <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z714_0">CPSValueBlendFunc</a>() {}
+00100
+<a name="l00102"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z714_1">00102</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z714_1">serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+00103 {
+00104 f.serialVersion(1);
+00105 f.serial(<a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n0">_StartValue</a>, <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n1">_EndValue</a>);
+00106 }
+00108
+00110 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font>
+00111 <font class="preprocessor"></font> __forceinline
+00112 <font class="preprocessor"> #endif</font>
+<a name="l00113"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#a0">00113</a> <font class="preprocessor"></font> T <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#a0">operator()</a>(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> time)<font class="keyword"> const</font>
+00114 <font class="keyword"> </font>{
+00115
+00116 <font class="keywordflow">return</font> <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(<a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n0">_StartValue</a>, <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n1">_EndValue</a>, time); <font class="comment">// a cast to T is necessary, because </font>
+00117 <font class="comment">// the specialization couls be done with integer</font>
+00118 }
+00119
+00121
+00122
+<a name="l00123"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_0">00123</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_0">getValues</a>(T &amp;startValue, T &amp;endValue)<font class="keyword"> const</font>
+00124 <font class="keyword"> </font>{
+00125 startValue = (*this)(0);
+00126 endValue = (*this)(1);
+00127 }
+00128
+<a name="l00130"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_1">00130</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_1">setValues</a>(T startValue, T endValue)
+00131 {
+00132 <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n0">_StartValue</a> = startValue;
+00133 <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n1">_EndValue</a> = endValue;
+00134 }
+00135
+<a name="l00137"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_2">00137</a> T <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#z715_2">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00138 <font class="keyword"> </font>{
+00139 <font class="keywordflow">return</font> std::max((*<font class="keyword">this</font>)(0), (*<font class="keyword">this</font>)(1));
+00140 }
+00142
+00143 <font class="keyword">protected</font>:
+<a name="l00144"></a><a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n0">00144</a> T <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n0">_StartValue</a>, <a class="code" href="classNL3D_1_1CPSValueBlendFunc.html#n1">_EndValue</a>;
+00145 };
+00146
+00147
+<a name="l00158"></a><a class="code" href="classNL3D_1_1CPSValueBlender.html">00158</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">class </font>CPSValueBlender : <font class="keyword">public</font> CPSAttribMakerT&lt;T, CPSValueBlendFunc&lt;T&gt; &gt;
+00159 {
+00160 <font class="keyword">public</font>:
+<a name="l00165"></a><a class="code" href="classNL3D_1_1CPSValueBlender.html#a0">00165</a> <a class="code" href="classNL3D_1_1CPSValueBlender.html#a0">CPSValueBlender</a>(<font class="keywordtype">float</font> nbCycles) : <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#a3">CPSAttribMakerT</a>&lt;T, CPSValueBlendFunc&lt;T&gt; &gt;(nbCycles)
+00166 {
+00167 }
+00168
+<a name="l00169"></a><a class="code" href="classNL3D_1_1CPSValueBlender.html#a1">00169</a> <font class="keyword">virtual</font> T <a class="code" href="classNL3D_1_1CPSValueBlender.html#a1">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#m0">_F</a>.getMaxValue(); }
+00170
+00171 <font class="comment">// serialization is done by CPSAttribMakerT</font>
+00172 };
+00173
+00174
+00175
+00176
+<a name="l00188"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html">00188</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T, const u<font class="keywordtype">int</font> n&gt; <font class="keyword">class </font>CPSValueBlendSampleFunc : <font class="keyword">public</font> CPSValueBlendFuncBase&lt;T&gt;
+00189 {
+00190 <font class="keyword">public</font>:
+00192 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font>
+00193 <font class="preprocessor"></font> __forceinline
+00194 <font class="preprocessor"> #endif</font>
+<a name="l00195"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a0">00195</a> <font class="preprocessor"></font> T <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a0">operator()</a>(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> time)<font class="keyword"> const</font>
+00196 <font class="keyword"> </font>{
+00197
+00198 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[<a class="code" href="namespaceNL3D.html#a362">OptFastFloor</a>(time * n)];
+00199 }
+00200
+00202
+<a name="l00203"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a1">00203</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a1">getValues</a>(T &amp;startValue, T &amp;endValue)<font class="keyword"> const</font>
+00204 <font class="keyword"> </font>{
+00205 startValue = <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[0];
+00206 endValue = <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[n];
+00207 }
+00208
+00210
+<a name="l00211"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a2">00211</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a2">setValues</a>(T startValue, T endValue)
+00212 {
+00213 <font class="keywordtype">float</font> step = 1.f / n;
+00214 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a> = 0.0f;
+00215 <font class="keywordflow">for</font> (uint k = 0; k &lt; n; ++k)
+00216 {
+00217 <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[k] = <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(startValue, endValue, <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>);
+00218 <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a> += step;
+00219 }
+00220 <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[n] = endValue;
+00221 }
+00222
+<a name="l00224"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a3">00224</a> <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a3">CPSValueBlendSampleFunc</a>() {}
+00225
+<a name="l00227"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a4">00227</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a4">serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+00228 {
+00229 f.serialVersion(1);
+00230 <font class="keywordflow">if</font> (f.isReading())
+00231 {
+00232 T t1, t2;
+00233 f.<a class="code" href="classNLMISC_1_1CRGBA.html#a6">serial</a>(t1, t2);
+00234 <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a2">setValues</a>(t1, t2);
+00235 }
+00236 <font class="keywordflow">else</font>
+00237 {
+00238 f.serial(<a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[0], <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[n]);
+00239 }
+00240 }
+00241
+<a name="l00242"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a5">00242</a> T <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#a5">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00243 <font class="keyword"> </font>{
+00244 <font class="keywordflow">return</font> std::max((*<font class="keyword">this</font>)(0), (*<font class="keyword">this</font>)(1));
+00245 }
+00246
+00247 <font class="keyword">protected</font>:
+<a name="l00248"></a><a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">00248</a> T <a class="code" href="classNL3D_1_1CPSValueBlendSampleFunc.html#n0">_Values</a>[n + 1];
+00249 };
+00250
+00251
+00252
+00253
+<a name="l00259"></a><a class="code" href="classNL3D_1_1CPSValueBlenderSample.html">00259</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T, const u<font class="keywordtype">int</font> n&gt; <font class="keyword">class </font>CPSValueBlenderSample : <font class="keyword">public</font> CPSAttribMakerT&lt;T, CPSValueBlendSampleFunc&lt;T, n&gt; &gt;
+00260 {
+00261 <font class="keyword">public</font>:
+00262
+<a name="l00267"></a><a class="code" href="classNL3D_1_1CPSValueBlenderSample.html#a0">00267</a> <a class="code" href="classNL3D_1_1CPSValueBlenderSample.html#a0">CPSValueBlenderSample</a>(<font class="keywordtype">float</font> nbCycles) : <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#a3">CPSAttribMakerT</a>&lt;T, CPSValueBlendSampleFunc&lt;T, n&gt; &gt;(nbCycles)
+00268 {
+00269 }
+<a name="l00270"></a><a class="code" href="classNL3D_1_1CPSValueBlenderSample.html#a1">00270</a> <font class="keyword">virtual</font> T <a class="code" href="classNL3D_1_1CPSValueBlenderSample.html#a1">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#m0">_F</a>.getMaxValue(); }
+00271 };
+00272
+00273
+00274
+00275
+<a name="l00283"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html">00283</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">class </font>CPSValueGradientFunc
+00284 {
+00285 <font class="keyword">public</font>:
+00287 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font>
+00288 <font class="preprocessor"></font> __forceinline
+00289 <font class="preprocessor"> #endif</font>
+<a name="l00290"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a0">00290</a> <font class="preprocessor"></font> T <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a0">operator()</a>(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> time)<font class="keyword"> const</font>
+00291 <font class="keyword"> </font>{
+00292 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>[<a class="code" href="namespaceNL3D.html#a362">OptFastFloor</a>(time * <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a>)];
+00293 }
+00294
+<a name="l00296"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a1">00296</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a1">getValues</a>(T *tab)<font class="keyword"> const</font>
+00297 <font class="keyword"> </font>{
+00298 <a class="code" href="debug_8h.html#a6">nlassert</a>(tab);
+00299 T *pt = tab;
+00300 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> = 0;
+00301 <font class="keywordflow">for</font> (uint32 k = 0; k &lt;= (<a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a> / <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>); ++k, <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> + <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>)
+00302 {
+00303 *pt++ =<a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>];
+00304 }
+00305 }
+00306
+<a name="l00308"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a2">00308</a> T <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a2">getValue</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+00309 <font class="keyword"> </font>{
+00310 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a3">getNumValues</a>());
+00311 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> * <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>];
+00312 }
+00313
+00314
+00315
+00316
+<a name="l00317"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a3">00317</a> uint32 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a3">getNumValues</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a> / <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>) + 1; }
+00318
+00327 <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a4">setValues</a>(<font class="keyword">const</font> T *ValueTab, uint32 numValues, uint32 nbStages);
+00328
+<a name="l00330"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a5">00330</a> uint32 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a5">getNumStages</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>; }
+00331
+<a name="l00333"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a6">00333</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a6">setNumStages</a>(uint32 numStages)
+00334 {
+00335 std::vector&lt;T&gt; <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>;
+00336 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.resize(<a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a3">getNumValues</a>());
+00337 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a1">getValues</a>(&amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>[0]);
+00338 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a4">setValues</a>(&amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>[0], <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a3">getNumValues</a>(), numStages);
+00339 }
+00340
+00342 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a7">serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream);
+00343
+00344
+<a name="l00345"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a8">00345</a> T <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a8">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00346 <font class="keyword"> </font>{
+00347 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">_MaxValue</a>;
+00348 }
+00349
+<a name="l00351"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a9">00351</a> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a9">CPSValueGradientFunc</a>() : <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>(0), <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a>(0)
+00352 {
+00353 }
+<a name="l00355"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a10">00355</a> <font class="keyword">virtual</font> <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a10">~CPSValueGradientFunc</a>() {}
+00356
+00357
+00358
+00359 <font class="keyword">protected</font>:
+00360 <font class="comment">// a table of Values that interpolate the values given</font>
+<a name="l00361"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">00361</a> std::vector&lt;T&gt; <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>;
+00362
+00363
+00364 <font class="comment">// number of interpolated value between each 'key'</font>
+<a name="l00365"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">00365</a> uint32 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a>;
+00366
+00367 <font class="comment">// total number of value in the tab</font>
+<a name="l00368"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">00368</a> uint32 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a>;
+00369
+00370
+00371 <font class="comment">// the max value</font>
+<a name="l00372"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">00372</a> T <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">_MaxValue</a>;
+00373 };
+00374
+00375
+00376
+00377
+<a name="l00383"></a><a class="code" href="classNL3D_1_1CPSValueGradient.html">00383</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">class </font>CPSValueGradient : <font class="keyword">public</font> CPSAttribMakerT&lt;T, CPSValueGradientFunc&lt;T&gt; &gt;
+00384 {
+00385 <font class="keyword">public</font>:
+00386
+<a name="l00391"></a><a class="code" href="classNL3D_1_1CPSValueGradient.html#a0">00391</a> <a class="code" href="classNL3D_1_1CPSValueGradient.html#a0">CPSValueGradient</a>(<font class="keywordtype">float</font> nbCycles) : <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#a3">CPSAttribMakerT</a>&lt;T, CPSValueGradientFunc&lt;T&gt; &gt;(nbCycles)
+00392 {
+00393 }
+<a name="l00394"></a><a class="code" href="classNL3D_1_1CPSValueGradient.html#a1">00394</a> <font class="keyword">virtual</font> T <a class="code" href="classNL3D_1_1CPSValueGradient.html#a1">getMaxValue</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttribMakerT.html#m0">_F</a>.getMaxValue(); }
+00395 };
+00396
+00397
+00398
+00399
+00401 <font class="comment">// methods implementations //</font>
+00403 <font class="comment"></font>
+00404
+00405
+00406
+00407 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt;
+<a name="l00408"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a4">00408</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSValueGradientFunc&lt;T&gt;::setValues(<font class="keyword">const</font> T *valueTab, uint32 numValues, uint32 nbStages)
+00409 {
+00410 <a class="code" href="debug_8h.html#a6">nlassert</a>(numValues &gt; 1);
+00411 <a class="code" href="debug_8h.html#a6">nlassert</a>(nbStages &gt; 0);
+00412
+00413 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n1">_NbStages</a> = nbStages;
+00414 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">_MaxValue</a> = valueTab[0];
+00415 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a> = (numValues - 1) * nbStages;
+00416 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>.resize(<a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n2">_NbValues</a> + 1);
+00417
+00418
+00419 <font class="keywordtype">float</font> step = 1.0f / float(nbStages);
+00420 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>;
+00421
+00422 std::vector&lt;T&gt;::iterator dest = <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n0">_Tab</a>.begin();
+00423 <font class="comment">// copy the tab performing linear interpolation between values given in parameter</font>
+00424 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; (numValues - 1); ++k)
+00425 {
+00426 <font class="keywordflow">if</font> (!(valueTab[k] &lt; <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">_MaxValue</a>))
+00427 {
+00428 <a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#n3">_MaxValue</a> = valueTab[k];
+00429 }
+00430
+00431 <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a> = 0;
+00432
+00433 <font class="keywordflow">for</font>(uint32 <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; nbStages; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
+00434 {
+00435 <font class="comment">// use the right version of the template function PSValueBlend</font>
+00436 <font class="comment">// to do the job</font>
+00437 *dest++ = <a class="code" href="namespaceNL3D.html#a413">PSValueBlend</a>(valueTab[k], valueTab[k + 1], <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>);
+00438 <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a> += step;
+00439 }
+00440 }
+00441 *dest++ = valueTab[numValues - 1];
+00442 }
+00443
+00444
+00445
+00446
+00447
+00448 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt;
+<a name="l00449"></a><a class="code" href="classNL3D_1_1CPSValueGradientFunc.html#a7">00449</a> <font class="keywordtype">void</font> CPSValueGradientFunc&lt;T&gt;::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+00450 {
+00451 f.serialVersion(1);
+00452 f.serial(_NbStages);
+00453 <font class="keywordflow">if</font> (f.isReading())
+00454 {
+00455
+00456 <font class="comment">// reload the number of keys </font>
+00457
+00458 uint32 numVal;
+00459 f.serial(numVal);
+00460 _NbValues = (numVal - 1) * _NbStages;
+00461
+00462 <font class="comment">// create the table on the stack for small gradient</font>
+00463 <font class="keywordflow">if</font> (numVal &lt; 256)
+00464 {
+00465 T tab[256];
+00466 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; numVal; ++k)
+00467 {
+00468 f.serial(tab[k]);
+00469 }
+00470 setValues(tab, numVal, _NbStages);
+00471 }
+00472 <font class="keywordflow">else</font>
+00473 {
+00474 std::vector&lt;T&gt; tab(numVal);
+00475 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; numVal; ++k)
+00476 {
+00477 f.serial(tab[k]);
+00478 }
+00479 setValues(&amp;tab[0], numVal, _NbStages);
+00480 }
+00481 }
+00482 <font class="keywordflow">else</font>
+00483 {
+00484 <font class="comment">// saves the number of keys</font>
+00485 uint32 numKeyValues = getNumValues();
+00486 f.serial(numKeyValues);
+00487
+00488
+00489 <font class="comment">// save each key </font>
+00490 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; numKeyValues; ++k)
+00491 {
+00492 f.serial(_Tab[k * _NbStages]);
+00493 }
+00494 }
+00495 }
+00496
+00497 } <font class="comment">// NL3D</font>
+00498
+00499
+00500 <font class="preprocessor">#endif // NL_PS_ATTRIB_MAKER_TEMPLATE_H</font>
+00501 <font class="preprocessor"></font>
+00502 <font class="comment">/* End of ps_attrib_maker_template.h */</font>
+</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>