aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03190.html
blob: 9d13517e349ae8b0ceebe53b34c65c9663cc87ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!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::CPSFaceHelper 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&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CPSFaceHelper Class Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Well, we could have put a method template in <a class="el" href="a03186.html">CPSFace</a>, but some compilers want the definition of the methods in the header, and some compilers don't want friend with function template, so we use a static method template of a friend class instead, which gives us the same result :) 
<p>

<p>
Definition at line <a class="el" href="a06231.html#l00051">51</a> of file <a class="el" href="a06231.html">ps_face.cpp</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T, class U&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03190.html#NL3D_1_1CPSFaceHelpere0">drawFaces</a> (T posIt, U indexIt, <a class="el" href="a03186.html">CPSFace</a> &amp;f, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, <a class="el" href="a04558.html#a11">uint32</a> srcStep)</td></tr>

</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CPSFaceHelpere0" doxytag="NL3D::CPSFaceHelper::drawFaces" ></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" colspan="4">
template&lt;class T, class U&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CPSFaceHelper::drawFaces </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T&nbsp;</td>
          <td class="mdname" nowrap> <em>posIt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>U&nbsp;</td>
          <td class="mdname" nowrap> <em>indexIt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03186.html">CPSFace</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>f</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>&nbsp;</td>
          <td class="mdname" nowrap> <em>size</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>srcStep</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline, static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06231.html#l00055">55</a> of file <a class="el" href="a06231.html">ps_face.cpp</a>.
<p>
References <a class="el" href="a06258.html#l00844">NL3D::CPSMaterial::_Mat</a>, <a class="el" href="a06247.html#l01026">NL3D::CPSLocatedBindable::_Owner</a>, <a class="el" href="a06258.html#l00289">NL3D::CPSSizedParticle::_ParticleSize</a>, <a class="el" href="a06258.html#l00697">NL3D::CPSRotated3DPlaneParticle::_PlaneBasis</a>, <a class="el" href="a06258.html#l00695">NL3D::CPSRotated3DPlaneParticle::_PlaneBasisScheme</a>, <a class="el" href="a06232.html#l00140">NL3D::CPSFace::_PrecompBasis</a>, <a class="el" href="a06258.html#l00290">NL3D::CPSSizedParticle::_SizeScheme</a>, <a class="el" href="a06258.html#l00472">NL3D::CPSTexturedParticle::_Tex</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06249.html#l00039">CHECK_VERTEX_BUFFER</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06262.html#l00146">NL3D::CPSQuad::getNeededVB()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a06711.html#l00473">NL3D::CVertexBuffer::getVertexSize()</a>, <a class="el" href="a06246.html#l00500">NL3D::CPSLocated::incrementNbDrawnParticles()</a>, <a class="el" href="a06258.html#l00519">NL3D::CPSMultiTexturedParticle::isMultiTextureEnabled()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; CPlaneBasis &gt;::make()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; float &gt;::make()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06152.html#l00060">PARTICLES_CHECK_MEM</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera54">NL3D::IDriver::renderQuads()</a>, <a class="el" href="a06246.html#l02142">NL3D::CPSLocatedBindable::setupDriverModelMatrix()</a>, <a class="el" href="a06257.html#l00733">NL3D::CPSMultiTexturedParticle::setupMaterial()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05646.html#l00244">stride</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06262.html#l00520">NL3D::CPSQuad::updateMatBeforeRendering()</a>, <a class="el" href="a06262.html#l00386">NL3D::CPSQuad::updateVbColNUVForRender()</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06259.html#l00048">NL3D::CPlaneBasis::X</a>, <a class="el" href="a06259.html#l00049">NL3D::CPlaneBasis::Y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>.
<p>
<div class="fragment"><pre>00056         {
00057                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;
00058                 <a class="code" href="a04199.html#a6">nlassert</a>(f._Owner);             
00059                 IDriver *driver = f.getDriver();
00060 
00061                 f.updateMatBeforeRendering(driver);
00062 
00063                 CVertexBuffer &amp;vb = f.getNeededVB();
00064                 <a class="code" href="a04558.html#a7">uint8</a> *currVertex;      
00065 
00066                 <span class="comment">// number of left faces to draw, number of faces to process at once</span>
00067                 <a class="code" href="a04558.html#a11">uint32</a> leftFaces = <a class="code" href="a04223.html#a587">size</a>, toProcess;
00068                 f._Owner-&gt;incrementNbDrawnParticles(size); <span class="comment">// for benchmark purpose             </span>
00069                 f.setupDriverModelMatrix();
00070                 driver-&gt;activeVertexBuffer(vb);
00071                 <span class="keywordflow">if</span> (f.isMultiTextureEnabled())
00072                 {
00073                         f.setupMaterial(f._Tex, driver, f._Mat);
00074                 }
00075                 <span class="keywordtype">float</span> sizeBuf[CPSQuad::quadBufSize];
00076                 <span class="keywordtype">float</span> *ptSize;          
00077                 T endPosIt;
00078 
00079                 <span class="comment">// if constant size is used, the pointer points always the same float </span>
00080                 <a class="code" href="a04558.html#a11">uint32</a> ptSizeIncrement = f._SizeScheme ? 1 : 0;
00081 
00082                 <span class="keywordflow">if</span> (f._PrecompBasis.size()) <span class="comment">// do we use precomputed basis ?</span>
00083                 {                                       
00084                         <span class="keywordflow">do</span>
00085                         {               
00086                                 toProcess = leftFaces &gt; CPSQuad::quadBufSize ? CPSQuad::quadBufSize : leftFaces;
00087                                 currVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer() ; 
00088                                 <span class="keywordflow">if</span> (f._SizeScheme)
00089                                 {                               
00090                                         ptSize = (<span class="keywordtype">float</span> *) (f._SizeScheme-&gt;make(f._Owner, size - leftFaces, sizeBuf, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));                                                         
00091                                 }
00092                                 <span class="keywordflow">else</span>
00093                                 {       
00094                                         ptSize = &amp;f._ParticleSize;                      
00095                                 }                                       
00096                                 f.updateVbColNUVForRender(vb, size - leftFaces, toProcess, srcStep);                    
00097                                 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a582">stride</a> = vb.getVertexSize();
00098                                 endPosIt = posIt + toProcess;                                                   
00099                                 <span class="keywordflow">do</span>              
00100                                 {                       
00101                                         <span class="keyword">const</span> CPlaneBasis &amp;currBasis = f._PrecompBasis[*indexIt].Basis;
00102                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00103                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  + *ptSize * currBasis.X.x;                    
00104                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  + *ptSize * currBasis.X.y;                    
00105                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  + *ptSize * currBasis.X.z;                    
00106                                         currVertex += <a class="code" href="a04223.html#a582">stride</a>;
00107 
00108                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00109                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  + *ptSize * currBasis.Y.x;                    
00110                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  + *ptSize * currBasis.Y.y;                    
00111                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  + *ptSize * currBasis.Y.z;                    
00112                                         currVertex += <a class="code" href="a04223.html#a582">stride</a>;
00113 
00114                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00115                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  - *ptSize * currBasis.X.x;                    
00116                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  - *ptSize * currBasis.X.y;                    
00117                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  - *ptSize * currBasis.X.z;                    
00118                                         currVertex += <a class="code" href="a04223.html#a582">stride</a>;
00119 
00120                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00121                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  - *ptSize * currBasis.Y.x;                    
00122                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  - *ptSize * currBasis.Y.y;                    
00123                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  - *ptSize * currBasis.Y.z;                    
00124                                         currVertex += <a class="code" href="a04223.html#a582">stride</a>;                                           
00125                                         ptSize += ptSizeIncrement;
00126                                         ++indexIt;
00127                                         ++posIt;
00128                                 }
00129                                 <span class="keywordflow">while</span> (posIt != endPosIt);
00130                                 driver-&gt;renderQuads(f._Mat, 0, toProcess);                              
00131                                 leftFaces -= toProcess;
00132                         }
00133                         <span class="keywordflow">while</span> (leftFaces);
00134                 }
00135                 <span class="keywordflow">else</span>
00136                 {
00137                         <span class="comment">// must compute each particle basis at each time</span>
00138                         <span class="keyword">static</span> CPlaneBasis planeBasis[CPSQuad::quadBufSize]; <span class="comment">// buffer to compute each particle basis</span>
00139                         CPlaneBasis *currBasis;
00140                         <a class="code" href="a04558.html#a11">uint32</a>    ptPlaneBasisIncrement = f._PlaneBasisScheme ? 1 : 0;
00141                         <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> vSize = vb.getVertexSize();
00142                         <span class="keywordflow">do</span>
00143                         {                       
00144                                 toProcess = leftFaces &gt; CPSQuad::quadBufSize ? CPSQuad::quadBufSize : leftFaces;
00145                                 currVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer() ; 
00146                                 <span class="keywordflow">if</span> (f._SizeScheme)
00147                                 {                               
00148                                         ptSize  = (<span class="keywordtype">float</span> *) (f._SizeScheme-&gt;make(f._Owner, size - leftFaces, sizeBuf, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));                                                                
00149                                 }
00150                                 <span class="keywordflow">else</span>
00151                                 {       
00152                                         ptSize = &amp;f._ParticleSize;                      
00153                                 }
00154 
00155                                 <span class="keywordflow">if</span> (f._PlaneBasisScheme)
00156                                 {
00157                                         currBasis = (CPlaneBasis *) (f._PlaneBasisScheme-&gt;make(f._Owner, size - leftFaces, planeBasis, <span class="keyword">sizeof</span>(CPlaneBasis), toProcess, <span class="keyword">true</span>, srcStep));                         
00158                                 }
00159                                 <span class="keywordflow">else</span>
00160                                 {
00161                                         currBasis = &amp;f._PlaneBasis;
00162                                 }                                               
00163                                 f.updateVbColNUVForRender(vb, size - leftFaces, toProcess, srcStep);                                            
00164                                 endPosIt = posIt + toProcess;                                   
00165                                 <span class="keywordflow">do</span>              
00166                                 {                       
00167                                         <span class="comment">// we use this instead of the + operator, because we avoid 4 constructor calls this way</span>
00168                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00169                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  + *ptSize * currBasis-&gt;X.x;                   
00170                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  + *ptSize * currBasis-&gt;X.y;                   
00171                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  + *ptSize * currBasis-&gt;X.z;                   
00172                                         currVertex += vSize;
00173 
00174                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00175                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  + *ptSize * currBasis-&gt;Y.x;                   
00176                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  + *ptSize * currBasis-&gt;Y.y;                   
00177                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  + *ptSize * currBasis-&gt;Y.z;                   
00178                                         currVertex += vSize;
00179 
00180                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00181                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  - *ptSize * currBasis-&gt;X.x;                   
00182                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  - *ptSize * currBasis-&gt;X.y;                   
00183                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  - *ptSize * currBasis-&gt;X.z;                   
00184                                         currVertex += vSize;
00185 
00186                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, currVertex);
00187                                         ((CVector *) currVertex)-&gt;x = (*posIt).x  - *ptSize * currBasis-&gt;Y.x;                   
00188                                         ((CVector *) currVertex)-&gt;y = (*posIt).y  - *ptSize * currBasis-&gt;Y.y;                   
00189                                         ((CVector *) currVertex)-&gt;z = (*posIt).z  - *ptSize * currBasis-&gt;Y.z;                   
00190                                         currVertex += vSize;
00191                                         ptSize += ptSizeIncrement;                                              
00192                                         ++posIt;
00193                                         currBasis += ptPlaneBasisIncrement;
00194                                 }
00195                                 <span class="keywordflow">while</span> (posIt != endPosIt);
00196                                 driver-&gt;renderQuads(f._Mat, 0, toProcess);                              
00197                                 leftFaces -= toProcess;
00198                         }
00199                         <span class="keywordflow">while</span> (leftFaces);
00200                 }
00201                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;    
00202         }
</pre></div>    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a06231.html">ps_face.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:11:18 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>