diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a03373.html | 972 |
1 files changed, 972 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03373.html b/docs/doxygen/nel/a03373.html new file mode 100644 index 00000000..17cd4b36 --- /dev/null +++ b/docs/doxygen/nel/a03373.html @@ -0,0 +1,972 @@ +<!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::CShadowPolyReceiver class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CShadowPolyReceiver Class Reference</h1><code>#include <<a class="el" href="a06375.html">shadow_poly_receiver.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +A class used to append/remove triangles that will be rendered for ShadowMap Additionally it can be used also for Camera collision for instance. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2003 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00057">57</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.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><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera0">addTriangle</a> (const <a class="el" href="a03616.html">NLMISC::CTriangle</a> &tri)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Append a triangle to the poly receiver. <a href="#NL3D_1_1CShadowPolyReceivera0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera1">CShadowPolyReceiver</a> (<a class="el" href="a04558.html#a15">uint</a> quadGridSize=32, float quadGridCellSize=4.f)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CShadowPolyReceivera1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera2">getCameraCollision</a> (const <a class="el" href="a03128.html">CVector</a> &start, const <a class="el" href="a03128.html">CVector</a> &end, float radius, bool cone)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera3">removeTriangle</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">remove a triangle from the poly receiver. <a href="#NL3D_1_1CShadowPolyReceivera3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera4">render</a> (<a class="el" href="a02434.html">IDriver</a> *drv, <a class="el" href="a02839.html">CMaterial</a> &shadowMat, const <a class="el" href="a03370.html">CShadowMap</a> *shadowMap, const <a class="el" href="a03128.html">CVector</a> &casterPos, const <a class="el" href="a03128.html">CVector</a> &vertDelta)</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a03273.html">CQuadGrid</a>< <a class="el" href="a03374.html">CTriangleId</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery0">TTriangleGrid</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a03128.html">CVector</a>,<br> + <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd0">allocateVertex</a> (const <a class="el" href="a03128.html">CVector</a> &<a class="el" href="a04223.html#a576">v</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd1">incVertexRefCount</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a11">uint32</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">TTriangleGrid</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< TTriangleGrid::CIterator > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03692.html">CVertexBuffer</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03375.html">CVectorId</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivery0" doxytag="NL3D::CShadowPolyReceiver::TTriangleGrid" ></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"> typedef <a class="el" href="a03273.html">CQuadGrid</a><<a class="el" href="a03374.html">CTriangleId</a>> <a class="el" href="a03273.html">NL3D::CShadowPolyReceiver::TTriangleGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00105">105</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivery1" doxytag="NL3D::CShadowPolyReceiver::TVertexMap" ></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"> typedef std::map<<a class="el" href="a03128.html">CVector</a>, <a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">NL3D::CShadowPolyReceiver::TVertexMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00097">97</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivera1" doxytag="NL3D::CShadowPolyReceiver::CShadowPolyReceiver" ></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::CShadowPolyReceiver::CShadowPolyReceiver </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>quadGridSize</em> = 32, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>quadGridCellSize</em> = 4.f</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00043">43</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06300.html#l00433">NL3D::CQuadGrid< T >::create()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00044 { +00045 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.reserve(64); +00046 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.reserve(64); +00047 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.reserve(64); +00048 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.reserve(64); +00049 +00050 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz772_1">create</a>(quadGridSize, quadGridCellSize); +00051 +00052 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag); +00053 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivera0" doxytag="NL3D::CShadowPolyReceiver::addTriangle" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NL3D::CShadowPolyReceiver::addTriangle </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03616.html">NLMISC::CTriangle</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>tri</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Append a triangle to the poly receiver. +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00057">57</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00113">_RenderTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a06374.html#l00134">allocateVertex()</a>, <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06374.html#l00183">incVertexRefCount()</a>, <a class="el" href="a06300.html#l00516">NL3D::CQuadGrid< T >::insert()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05646.html#l00237">v</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>. +<p> +Referenced by <a class="el" href="a05862.html#l03658">NL3D::CLandscape::appendToShadowPolyReceiver()</a>. +<p> +<div class="fragment"><pre>00058 { +00059 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>; +00060 +00061 <span class="comment">// Look for a free triangle entry.</span> +00062 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.empty()) +00063 { +00064 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.push_back(TTriangleGrid::CIterator()); +00065 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size()-1; +00066 <span class="comment">// enlarge render size.</span> +00067 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a>.resize(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size() * 3); +00068 } +00069 <span class="keywordflow">else</span> +00070 { +00071 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.back(); +00072 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.pop_back(); +00073 } +00074 +00075 <span class="comment">// Allocate vertices, reusing same ones.</span> +00076 CTriangleId triId; +00077 CVector <a class="code" href="a04223.html#a576">v</a>[3]; +00078 <a class="code" href="a04223.html#a576">v</a>[0]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>; +00079 <a class="code" href="a04223.html#a576">v</a>[1]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>; +00080 <a class="code" href="a04223.html#a576">v</a>[2]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>; +00081 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<3;i++) +00082 { +00083 <span class="comment">// Find the vertex in the map.</span> +00084 TVertexMap::iterator it; +00085 it= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.find(v[i]); +00086 <span class="comment">// if not found, allocate it</span> +00087 <span class="keywordflow">if</span>(it==<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.end()) +00088 { +00089 triId.Vertex[i]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd0">allocateVertex</a>(v[i]); +00090 } +00091 <span class="comment">// else get its id</span> +00092 <span class="keywordflow">else</span> +00093 { +00094 triId.Vertex[i]= it->second; +00095 } +00096 +00097 <span class="comment">// increment the reference of this vertex</span> +00098 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd1">incVertexRefCount</a>(triId.Vertex[i]); +00099 } +00100 +00101 <span class="comment">// Insert the triangle in the quadGrid.</span> +00102 <a class="code" href="a02156.html">CAABBox</a> bb; +00103 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_1">setCenter</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>); +00104 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>); +00105 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +00106 <span class="comment">// insert in QuadGrid and store iterator for future remove</span> +00107 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>[<span class="keywordtype">id</span>]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_2">insert</a>(bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>(), bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>(), triId); +00108 +00109 <span class="keywordflow">return</span> <span class="keywordtype">id</span>; +00110 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd0" doxytag="NL3D::CShadowPolyReceiver::allocateVertex" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NL3D::CShadowPolyReceiver::allocateVertex </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>v</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00134">134</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>. +<p> +<div class="fragment"><pre>00135 { +00136 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>; +00137 +00138 <span class="comment">// Look for a free vertex entry.</span> +00139 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.empty()) +00140 { +00141 <span class="comment">// Add the vertex, and init refCount to 0.</span> +00142 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.push_back(v); +00143 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size()-1; +00144 +00145 <span class="comment">// Resize the VBuffer at max possible</span> +00146 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setNumVertices(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size()); +00147 } +00148 <span class="keywordflow">else</span> +00149 { +00150 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.back(); +00151 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.pop_back(); +00152 <span class="comment">// init entry</span> +00153 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>]= <a class="code" href="a04223.html#a576">v</a>; +00154 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount= 0; +00155 } +00156 +00157 <span class="comment">// insert in the map (should not be here)</span> +00158 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.insert( make_pair(v, <span class="keywordtype">id</span>) ); +00159 +00160 <span class="keywordflow">return</span> <span class="keywordtype">id</span>; +00161 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivera2" doxytag="NL3D::CShadowPolyReceiver::getCameraCollision" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float NL3D::CShadowPolyReceiver::getCameraCollision </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>start</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>end</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>radius</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>cone</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Use the triangles added for camera 3rd person collision return a [0,1] value. 0 => collision at start. 1 => no collision. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>radius</em> </td><td>is the radius of the 'cylinder' </td></tr> + <tr><td valign=top><em>cone</em> </td><td>if true, the object tested is a cone (radius goes to end)</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06374.html#l00308">308</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a05533.html#l00057">NL3D::CCameraCol::BBox</a>, <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a05532.html#l00048">NL3D::CCameraCol::build()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05532.html#l00131">NL3D::CCameraCol::minimizeDistanceAgainstTri()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>. +<p> +Referenced by <a class="el" href="a05862.html#l03714">NL3D::CLandscape::getCameraCollision()</a>. +<p> +<div class="fragment"><pre>00309 { +00310 <span class="comment">// **** build the camera collision info</span> +00311 CCameraCol camCol; +00312 camCol.build(start, end, radius, cone); +00313 +00314 <span class="comment">// select with quadGrid</span> +00315 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(camCol.BBox.getMin(), camCol.BBox.getMax()); +00316 +00317 <span class="comment">// **** For all triangles, test if intersect the camera collision</span> +00318 TTriangleGrid::CIterator it; +00319 <span class="keywordtype">float</span> sqrMinDist= FLT_MAX; +00320 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++) +00321 { +00322 CTriangleId &triId= *it; +00323 camCol.minimizeDistanceAgainstTri( +00324 _Vertices[triId.Vertex[0]], +00325 _Vertices[triId.Vertex[1]], +00326 _Vertices[triId.Vertex[2]], +00327 sqrMinDist); +00328 } +00329 +00330 <span class="comment">// **** return the collision found, between [0,1]</span> +00331 <span class="keywordflow">if</span>(sqrMinDist == FLT_MAX) +00332 <span class="keywordflow">return</span> 1; +00333 <span class="keywordflow">else</span> +00334 { +00335 <span class="keywordtype">float</span> f= 1; +00336 <span class="keywordtype">float</span> d= (end-start).norm(); +00337 <span class="keywordflow">if</span>(d>0) +00338 { +00339 f= sqrtf(sqrMinDist) / d; +00340 f= <a class="code" href="a04061.html#a0">min</a>(f, 1.f); +00341 } +00342 <span class="keywordflow">return</span> f; +00343 } +00344 +00345 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd1" doxytag="NL3D::CShadowPolyReceiver::incVertexRefCount" ></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::CShadowPolyReceiver::incVertexRefCount </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>id</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00183">183</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00046">NL3D_SPR_MAX_REF_COUNT</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>. +<p> +<div class="fragment"><pre>00184 { +00185 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size()); +00186 <a class="code" href="a04199.html#a6">nlassert</a>(_Vertices[<span class="keywordtype">id</span>].RefCount < NL3D_SPR_MAX_REF_COUNT); +00187 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount++; +00188 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd2" doxytag="NL3D::CShadowPolyReceiver::releaseVertex" ></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::CShadowPolyReceiver::releaseVertex </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>id</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00164">164</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00113">removeTriangle()</a>. +<p> +<div class="fragment"><pre>00165 { +00166 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size()); +00167 <span class="comment">// dec ref</span> +00168 <a class="code" href="a04199.html#a6">nlassert</a>(_Vertices[<span class="keywordtype">id</span>].RefCount>0); +00169 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount--; +00170 <span class="comment">// no more used?</span> +00171 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount==0) +00172 { +00173 <span class="comment">// Free it.</span> +00174 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.push_back(<span class="keywordtype">id</span>); +00175 <span class="comment">// Remove it from map.</span> +00176 TVertexMap::iterator it= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.find(_Vertices[<span class="keywordtype">id</span>]); +00177 <a class="code" href="a04199.html#a6">nlassert</a>(it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.end()); +00178 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.erase(it); +00179 } +00180 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivera3" doxytag="NL3D::CShadowPolyReceiver::removeTriangle" ></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::CShadowPolyReceiver::removeTriangle </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>id</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +remove a triangle from the poly receiver. +<p> + +<p> +Definition at line <a class="el" href="a06374.html#l00113">113</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a06300.html#l00468">NL3D::CQuadGrid< T >::erase()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06374.html#l00164">releaseVertex()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>. +<p> +Referenced by <a class="el" href="a05862.html#l03669">NL3D::CLandscape::removeFromShadowPolyReceiver()</a>. +<p> +<div class="fragment"><pre>00114 { +00115 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size()); +00116 <span class="comment">// Must not be NULL iterator.</span> +00117 <a class="code" href="a04199.html#a6">nlassert</a>(_Triangles[<span class="keywordtype">id</span>]!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>()); +00118 +00119 <span class="comment">// Release Vertices</span> +00120 <span class="keyword">const</span> CTriangleId &triId= *<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>[<span class="keywordtype">id</span>]; +00121 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[0]); +00122 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[1]); +00123 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[2]); +00124 +00125 <span class="comment">// Delete Triangle.</span> +00126 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_1">erase</a>(_Triangles[<span class="keywordtype">id</span>]); +00127 _Triangles[<span class="keywordtype">id</span>]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>(); +00128 <span class="comment">// Append to free list.</span> +00129 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.push_back(<span class="keywordtype">id</span>); +00130 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceivera4" doxytag="NL3D::CShadowPolyReceiver::render" ></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::CShadowPolyReceiver::render </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02434.html">IDriver</a> * </td> + <td class="mdname" nowrap> <em>drv</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02839.html">CMaterial</a> & </td> + <td class="mdname" nowrap> <em>shadowMat</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03370.html">CShadowMap</a> * </td> + <td class="mdname" nowrap> <em>shadowMap</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>casterPos</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>vertDelta</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +clip, and render with a shadow map. Matrix setup should be OK. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>vertDelta</em> </td><td>(for landscape). add this value from vertices before rendering.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06374.html#l00192">192</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>. +<p> +References <a class="el" href="a06375.html#l00113">_RenderTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05385.html#l00090">NLMISC::CAABBox::getCenter()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06371.html#l00074">NL3D::CShadowMap::LocalBoundingBox</a>, <a class="el" href="a06371.html#l00069">NL3D::CShadowMap::LocalClipPlanes</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06375.html#l00043">NL3D_SPR_NUM_CLIP_PLANE</a>, <a class="el" href="a06375.html#l00045">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>, <a class="el" href="a06375.html#l00044">NL3D_SPR_NUM_CLIP_PLANE_SHIFT</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera56">NL3D::IDriver::renderTriangles()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05972.html#l00267">NLMISC::CMatrix::setPos()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>. +<p> +Referenced by <a class="el" href="a05862.html#l03681">NL3D::CLandscape::receiveShadowMap()</a>. +<p> +<div class="fragment"><pre>00193 { +00194 <a class="code" href="a04558.html#a15">uint</a> i, j; +00195 +00196 <span class="comment">// **** Fill Triangles that are hit by the Caster</span> +00197 <span class="comment">// First select with quadGrid</span> +00198 <a class="code" href="a02156.html">CAABBox</a> worldBB; +00199 worldBB= shadowMap->LocalBoundingBox; +00200 worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_1">setCenter</a>(worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_0">getCenter</a>() + casterPos); +00201 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>(), worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>()); +00202 +00203 <span class="comment">// For all triangles, reset vertices flags.</span> +00204 TTriangleGrid::CIterator it; +00205 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++) +00206 { +00207 CTriangleId &triId= *it; +00208 <span class="keywordflow">for</span>(i=0;i<3;i++) +00209 { +00210 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[triId.Vertex[i]].Flags= 0; +00211 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[triId.Vertex[i]].VBIdx= -1; +00212 } +00213 } +00214 +00215 <span class="comment">// Copute the world Clip Volume</span> +00216 <span class="keyword">static</span> std::vector<CPlane> worldClipPlanes; +00217 CMatrix worldMat; +00218 <span class="comment">// set -casterPos, because to transform a plane, we must do plane * M-1</span> +00219 worldMat.setPos(-casterPos); +00220 <span class="comment">// Allow max bits of planes clip.</span> +00221 worldClipPlanes.resize(<a class="code" href="a04061.html#a0">min</a>((<a class="code" href="a04558.html#a15">uint</a>)shadowMap->LocalClipPlanes.size(), (<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a04952.html#a0">NL3D_SPR_NUM_CLIP_PLANE</a>)); +00222 <span class="comment">// Transform into world</span> +00223 <span class="keywordflow">for</span>(i=0;i<worldClipPlanes.size();i++) +00224 { +00225 worldClipPlanes[i]= shadowMap->LocalClipPlanes[i] * worldMat; +00226 } +00227 +00228 <span class="comment">// For All triangles, clip them.</span> +00229 <a class="code" href="a04558.html#a15">uint</a> currentTriIdx= 0; +00230 <a class="code" href="a04558.html#a15">uint</a> currentVbIdx= 0; +00231 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++) +00232 { +00233 CTriangleId &triId= *it; +00234 <a class="code" href="a04558.html#a15">uint</a> triFlag= <a class="code" href="a04952.html#a2">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>; +00235 +00236 <span class="comment">// for all vertices, clip them</span> +00237 <span class="keywordflow">for</span>(i=0;i<3;i++) +00238 { +00239 <a class="code" href="a04558.html#a15">uint</a> vid= triId.Vertex[i]; +00240 <a class="code" href="a04558.html#a15">uint</a> vertexFlags= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[vid].Flags; +00241 +00242 <span class="comment">// if this vertex is still not computed</span> +00243 <span class="keywordflow">if</span>(!vertexFlags) +00244 { +00245 <span class="comment">// For all planes of the Clip Volume, clip this vertex.</span> +00246 <span class="keywordflow">for</span>(j=0;j<worldClipPlanes.size();j++) +00247 { +00248 <span class="comment">// out if in front</span> +00249 <span class="keywordtype">bool</span> out= worldClipPlanes[j]*_Vertices[vid] > 0; +00250 +00251 vertexFlags|= ((<a class="code" href="a04558.html#a15">uint</a>)out)<<j; +00252 } +00253 +00254 <span class="comment">// add the bit flag to say "computed".</span> +00255 vertexFlags|= <a class="code" href="a04952.html#a1">NL3D_SPR_NUM_CLIP_PLANE_SHIFT</a>; +00256 +00257 <span class="comment">// store</span> +00258 _Vertices[vid].Flags= vertexFlags; +00259 } +00260 +00261 <span class="comment">// And all vertex bits.</span> +00262 triFlag&= vertexFlags; +00263 } +00264 +00265 <span class="comment">// if triangle not clipped, add the triangle</span> +00266 <span class="keywordflow">if</span>( (triFlag & <a class="code" href="a04952.html#a2">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>)==0 ) +00267 { +00268 <span class="comment">// Add the 3 vertices to the VB, and to the index buffer.</span> +00269 <span class="keywordflow">for</span>(i=0;i<3;i++) +00270 { +00271 <a class="code" href="a04558.html#a15">uint</a> vid= triId.Vertex[i]; +00272 <a class="code" href="a04558.html#a14">sint</a> vbId= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[vid].VBIdx; +00273 +00274 <span class="comment">// if not yet inserted in the VB, do it.</span> +00275 <span class="keywordflow">if</span>(vbId==-1) +00276 { +00277 <span class="comment">// allocate a new place in the VBuffer</span> +00278 vbId= currentVbIdx++; +00279 _Vertices[vid].VBIdx= vbId; +00280 <span class="comment">// set the coord</span> +00281 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setVertexCoord(vbId, _Vertices[vid]+vertDelta); +00282 } +00283 +00284 <span class="comment">// add the index to the tri list.</span> +00285 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a>[currentTriIdx++]= vbId; +00286 } +00287 } +00288 } +00289 +00290 +00291 <span class="comment">// **** Render</span> +00292 drv->activeVertexBuffer(_VB); +00293 drv->renderTriangles(shadowMat, &_RenderTriangles[0], currentTriIdx/3); +00294 <span class="comment">// TestYoyo. Show in Red triangles selected</span> +00295 <span class="comment">/*static CMaterial tam;</span> +00296 <span class="comment"> tam.initUnlit();</span> +00297 <span class="comment"> tam.setColor(CRGBA(255,0,0,128));</span> +00298 <span class="comment"> tam.setZFunc(CMaterial::always);</span> +00299 <span class="comment"> tam.setZWrite(false);</span> +00300 <span class="comment"> tam.setBlend(true);</span> +00301 <span class="comment"> tam.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha);</span> +00302 <span class="comment"> tam.setDoubleSided(true);</span> +00303 <span class="comment"> drv->renderTriangles(tam, &_RenderTriangles[0], currentTriIdx/3);*/</span> +00304 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr0" doxytag="NL3D::CShadowPolyReceiver::_FreeTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">NL3D::CShadowPolyReceiver::_FreeTriangles</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00108">108</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, and <a class="el" href="a06374.html#l00113">removeTriangle()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr1" doxytag="NL3D::CShadowPolyReceiver::_FreeVertices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">NL3D::CShadowPolyReceiver::_FreeVertices</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00096">96</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00134">allocateVertex()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, and <a class="el" href="a06374.html#l00164">releaseVertex()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr2" doxytag="NL3D::CShadowPolyReceiver::_RenderTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a11">uint32</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">NL3D::CShadowPolyReceiver::_RenderTriangles</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00113">113</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, and <a class="el" href="a06374.html#l00192">render()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr3" doxytag="NL3D::CShadowPolyReceiver::_TriangleGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03273.html">TTriangleGrid</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">NL3D::CShadowPolyReceiver::_TriangleGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00106">106</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, <a class="el" href="a06374.html#l00308">getCameraCollision()</a>, <a class="el" href="a06374.html#l00113">removeTriangle()</a>, and <a class="el" href="a06374.html#l00192">render()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr4" doxytag="NL3D::CShadowPolyReceiver::_Triangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<TTriangleGrid::CIterator> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">NL3D::CShadowPolyReceiver::_Triangles</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00107">107</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr5" doxytag="NL3D::CShadowPolyReceiver::_VB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03692.html">CVertexBuffer</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">NL3D::CShadowPolyReceiver::_VB</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00112">112</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr6" doxytag="NL3D::CShadowPolyReceiver::_VertexMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">NL3D::CShadowPolyReceiver::_VertexMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00098">98</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. +<p> +Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00134">allocateVertex()</a>, and <a class="el" href="a06374.html#l00164">releaseVertex()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr7" doxytag="NL3D::CShadowPolyReceiver::_Vertices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03375.html">CVectorId</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">NL3D::CShadowPolyReceiver::_Vertices</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06375.html#l00095">95</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06375.html">shadow_poly_receiver.h</a><li><a class="el" href="a06374.html">shadow_poly_receiver.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:43:27 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> |