aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03456.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/a03456.html311
1 files changed, 311 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03456.html b/docs/doxygen/nel/a03456.html
new file mode 100644
index 00000000..ffccf926
--- /dev/null
+++ b/docs/doxygen/nel/a03456.html
@@ -0,0 +1,311 @@
+<!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::CStripifier 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::CStripifier Class Reference</h1><code>#include &lt;<a class="el" href="a06474.html">stripifier.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wrapper to NVidia(tm) Stripifier <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
+Nevrax France </dd></dl>
+<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06474.html#l00043">43</a> of file <a class="el" href="a06474.html">stripifier.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03456.html#NL3D_1_1CStripifiera0">CStripifier</a> ()</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CStripifiera0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03456.html#NL3D_1_1CStripifiera1">optimizeTriangles</a> (const <a class="el" href="a03105.html">CPrimitiveBlock</a> &amp;<a class="el" href="a04223.html#a647">in</a>, <a class="el" href="a03105.html">CPrimitiveBlock</a> &amp;out, <a class="el" href="a04558.html#a15">uint</a> cacheSize=10)</td></tr>
+
+</table>
+<hr><h2>Constructor &amp; Destructor Documentation</h2>
+<a class="anchor" name="NL3D_1_1CStripifiera0" doxytag="NL3D::CStripifier::CStripifier" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> NL3D::CStripifier::CStripifier </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Constructor.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06473.html#l00042">42</a> of file <a class="el" href="a06473.html">stripifier.cpp</a>.
+<p>
+<div class="fragment"><pre>00043 {
+00044 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NL3D_1_1CStripifiera1" doxytag="NL3D::CStripifier::optimizeTriangles" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NL3D::CStripifier::optimizeTriangles </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03105.html">CPrimitiveBlock</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>in</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a03105.html">CPrimitiveBlock</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>out</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>cacheSize</em> = 10</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+reorganize triangles to get efficiency of GPU vertex-cache. Default vertex cache is 10. out get the same list of triangles, but in different order. any list of lines / quads in out are not modified. NB: &amp;in == &amp;out is possible.
+<p>
+Definition at line <a class="el" href="a06473.html#l00196">196</a> of file <a class="el" href="a06473.html">stripifier.cpp</a>.
+<p>
+References <a class="el" href="a06473.html#l00190">NL3D::CCornerNode::FaceId</a>, <a class="el" href="a06473.html#l00134">NL3D::CVertexCache::getVertexInCache()</a>, <a class="el" href="a05646.html#l01122">in</a>, <a class="el" href="a06473.html#l00188">NL3D::CCornerNode::Next</a>, <a class="el" href="a06197.html#l00109">NL3D::CPrimitiveBlock::reserveTri()</a>, <a class="el" href="a06197.html#l00114">NL3D::CPrimitiveBlock::setNumTri()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06473.html#l00139">NL3D::CVertexCache::tempTouchVertex()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06473.html#l00161">NL3D::COrderFace::v</a>, <a class="el" href="a05646.html#l00237">v</a>, and <a class="el" href="a06473.html#l00191">NL3D::CCornerNode::VertexId</a>.
+<p>
+Referenced by <a class="el" href="a06011.html#l00093">NL3D::CMeshMRMSkinnedGeom::CLod::optimizeTriangleOrder()</a>, <a class="el" href="a06005.html#l00164">NL3D::CMeshMRMGeom::CLod::optimizeTriangleOrder()</a>, and <a class="el" href="a05989.html#l00153">NL3D::CMeshGeom::optimizeTriangleOrder()</a>.
+<p>
+<div class="fragment"><pre>00197 {
+00198 vector&lt;COrderFace&gt; inFaces;
+00199 <a class="code" href="a04558.html#a14">sint</a> i;
+00200 <a class="code" href="a04558.html#a14">sint</a> numTris= <a class="code" href="a04223.html#a647">in</a>.getNumTri();
+00201
+00202 <span class="comment">// TestYoyo: All the same tri =&gt; perfect vertex caching...</span>
+00203 <span class="comment">/*out.setNumTri(numTris);</span>
+00204 <span class="comment"> for(i=0;i&lt; numTris; i++)</span>
+00205 <span class="comment"> {</span>
+00206 <span class="comment"> uint32 v0= *(in.getTriPointer()+0);</span>
+00207 <span class="comment"> uint32 v1= *(in.getTriPointer()+1);</span>
+00208 <span class="comment"> uint32 v2= *(in.getTriPointer()+2);</span>
+00209 <span class="comment"> out.setTri(i, v0, v1, v2);</span>
+00210 <span class="comment"> }</span>
+00211 <span class="comment"> return;*/</span>
+00212
+00213
+00214 <span class="comment">// prepare inIndices.</span>
+00215 <span class="comment">//--------------------</span>
+00216 inFaces.resize(numTris);
+00217 <span class="keywordflow">for</span>(i=0;i&lt; numTris; i++)
+00218 {
+00219 inFaces[i].v[0]= <a class="code" href="a04223.html#a647">in</a>.getTriPointer()[i*3 + 0];
+00220 inFaces[i].v[1]= <a class="code" href="a04223.html#a647">in</a>.getTriPointer()[i*3 + 1];
+00221 inFaces[i].v[2]= <a class="code" href="a04223.html#a647">in</a>.getTriPointer()[i*3 + 2];
+00222 inFaces[i].Inserted= <span class="keyword">false</span>;
+00223 }
+00224
+00225
+00226 <span class="comment">// build our cache, and compute max number of vertices.</span>
+00227 <span class="comment">//--------------------</span>
+00228 <span class="keywordtype">int</span> numVerts=0;
+00229 <span class="keywordflow">for</span> (i = 0; i &lt; numTris; i++)
+00230 {
+00231 numVerts= max(numVerts, (<span class="keywordtype">int</span>)inFaces[i].<a class="code" href="a04223.html#a576">v</a>[0]);
+00232 numVerts= max(numVerts, (<span class="keywordtype">int</span>)inFaces[i].<a class="code" href="a04223.html#a576">v</a>[1]);
+00233 numVerts= max(numVerts, (<span class="keywordtype">int</span>)inFaces[i].<a class="code" href="a04223.html#a576">v</a>[2]);
+00234 }
+00235 numVerts++;
+00236 CVertexCache vertexCache(cacheSize, numVerts);
+00237
+00238
+00239 <span class="comment">// Compute vertex connectivity.</span>
+00240 <span class="comment">//--------------------</span>
+00241 vector&lt;CCornerNode*&gt; vertexConnectivity;
+00242 vector&lt;CCornerNode&gt; cornerAllocator;
+00243 cornerAllocator.resize(numTris * 3);
+00244 vertexConnectivity.resize(numVerts, NULL);
+00245 <span class="comment">// For all triangles.</span>
+00246 <span class="keywordflow">for</span> (i = 0; i &lt; numTris; i++)
+00247 {
+00248 COrderFace *ordFace= &amp;inFaces[i];
+00249 <span class="comment">// For each corner, allocate and fill</span>
+00250 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> j=0; j&lt;3;j++)
+00251 {
+00252 <a class="code" href="a04558.html#a14">sint</a> vertexId= ordFace-&gt;v[j];
+00253
+00254 <span class="comment">// allocate a corner</span>
+00255 CCornerNode *corner= &amp;cornerAllocator[i*3 + j];
+00256
+00257 <span class="comment">// fill it.</span>
+00258 corner-&gt;FaceId= i;
+00259 corner-&gt;VertexId= vertexId;
+00260 <span class="comment">// Link it to the vertex list of faces.</span>
+00261 corner-&gt;Next= vertexConnectivity[vertexId];
+00262 vertexConnectivity[vertexId]= corner;
+00263 }
+00264 }
+00265
+00266
+00267 <span class="comment">// build output optimized triangles</span>
+00268 <span class="comment">//--------------------</span>
+00269 out.setNumTri(0);
+00270 out.reserveTri(numTris);
+00271
+00272 <span class="keywordflow">for</span>(i=0; i&lt;numTris; i++)
+00273 {
+00274 <span class="comment">// force insertion of the ith face.</span>
+00275 <a class="code" href="a04558.html#a14">sint</a> nextToInsert= i;
+00276 <span class="keywordtype">bool</span> nextToInsertFound= <span class="keyword">true</span>;
+00277 <span class="keywordflow">while</span>( nextToInsertFound )
+00278 {
+00279 nextToInsertFound= <span class="keyword">false</span>;
+00280
+00281 <span class="comment">// if the face is not yet inserted.</span>
+00282 <span class="keywordflow">if</span>(!inFaces[nextToInsert].Inserted)
+00283 {
+00284 <span class="comment">// must insert this face.</span>
+00285 inFaces[nextToInsert].insertInPB(out, vertexCache);
+00286
+00287 <a class="code" href="a04558.html#a14">sint</a> minC= 3;
+00288
+00289 <span class="comment">// look only for faces which use vertices in VertexCache, to get a face with at least one vertex.</span>
+00290 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;cacheSize; j++)
+00291 {
+00292 <span class="comment">// get a vertex from the vertex cache.</span>
+00293 <a class="code" href="a04558.html#a15">uint</a> vertexId= vertexCache.getVertexInCache(j);
+00294 <span class="comment">// if empty entry</span>
+00295 <span class="keywordflow">if</span>(vertexId==0xFFFFFFFF)
+00296 <span class="keywordflow">continue</span>;
+00297
+00298 <span class="comment">// parse list of faces which use this vertex.</span>
+00299 CCornerNode *corner= vertexConnectivity[vertexId];
+00300 <span class="keywordflow">while</span>(corner)
+00301 {
+00302 <a class="code" href="a04558.html#a15">uint</a> faceId= corner-&gt;FaceId;
+00303
+00304 <span class="comment">// if the face is not yet inserted.</span>
+00305 <span class="keywordflow">if</span>(!inFaces[faceId].Inserted)
+00306 {
+00307 <a class="code" href="a04558.html#a14">sint</a> c= inFaces[faceId].countCacheMiss(vertexCache);
+00308 <span class="comment">// insert first any face which don't add any vertex in the cache.</span>
+00309 <span class="keywordflow">if</span>(c==0)
+00310 {
+00311 inFaces[faceId].insertInPB(out, vertexCache);
+00312 }
+00313 <span class="comment">// else the one which add the minimum of vertex possible: nextToInsert</span>
+00314 <span class="keywordflow">else</span>
+00315 {
+00316 <span class="comment">// Add cost of faces that use vertices pushed out (better results...)</span>
+00317 <a class="code" href="a04558.html#a15">uint</a> numVOut= c;
+00318 <a class="code" href="a04558.html#a15">uint</a> k;
+00319 <span class="keywordflow">for</span>(k=cacheSize-numVOut; k&lt;cacheSize; k++)
+00320 {
+00321 <a class="code" href="a04558.html#a15">uint</a> vertexOutId= vertexCache.getVertexInCache(k);
+00322 <span class="keywordflow">if</span>(vertexOutId==0xFFFFFFFF)
+00323 <span class="keywordflow">continue</span>;
+00324 <span class="comment">// TempRemove the vertex from the cache</span>
+00325 vertexCache.tempTouchVertex(vertexOutId, <span class="keyword">false</span>);
+00326 }
+00327 <span class="comment">// parse all faces that still use those out vertices.</span>
+00328 <span class="keywordflow">for</span>(k=cacheSize-numVOut; k&lt;cacheSize; k++)
+00329 {
+00330 <a class="code" href="a04558.html#a15">uint</a> vertexOutId= vertexCache.getVertexInCache(k);
+00331 <span class="keywordflow">if</span>(vertexOutId==0xFFFFFFFF)
+00332 <span class="keywordflow">continue</span>;
+00333 CCornerNode *cornerOut= vertexConnectivity[vertexOutId];
+00334 <span class="keywordflow">while</span>(cornerOut)
+00335 {
+00336 <a class="code" href="a04558.html#a15">uint</a> faceOutId= cornerOut-&gt;FaceId;
+00337
+00338 <span class="comment">// if the face is not yet inserted AND not the one treated</span>
+00339 <span class="keywordflow">if</span>(!inFaces[faceOutId].Inserted &amp;&amp; faceOutId!=faceId)
+00340 {
+00341 <span class="comment">// Add cache miss of this face</span>
+00342 c+= inFaces[faceOutId].countCacheMiss(vertexCache);
+00343 }
+00344
+00345 <span class="comment">// next corner</span>
+00346 cornerOut= cornerOut-&gt;Next;
+00347 }
+00348 }
+00349 <span class="comment">// reset touch</span>
+00350 <span class="keywordflow">for</span>(k=cacheSize-numVOut; k&lt;cacheSize; k++)
+00351 {
+00352 <a class="code" href="a04558.html#a15">uint</a> vertexOutId= vertexCache.getVertexInCache(k);
+00353 <span class="keywordflow">if</span>(vertexOutId==0xFFFFFFFF)
+00354 <span class="keywordflow">continue</span>;
+00355 <span class="comment">// restore TempTouch the vertex from the cache</span>
+00356 vertexCache.tempTouchVertex(vertexOutId, <span class="keyword">true</span>);
+00357 }
+00358
+00359
+00360 <span class="comment">// take the minimum cost</span>
+00361 <span class="keywordflow">if</span>(c&lt;minC)
+00362 {
+00363 nextToInsert= faceId;
+00364 nextToInsertFound= <span class="keyword">true</span>;
+00365 minC= c;
+00366 }
+00367 }
+00368 }
+00369
+00370 <span class="comment">// next corner</span>
+00371 corner= corner-&gt;Next;
+00372 }
+00373
+00374 }
+00375
+00376 <span class="comment">// if nextToInsertFound, then nextToInsert has the face which add the minimum of vertex possible in the cache</span>
+00377 }
+00378 }
+00379
+00380 }
+00381
+00382 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a06474.html">stripifier.h</a><li><a class="el" href="a06473.html">stripifier.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:47:29 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>