aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/landscape__collision__grid_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/landscape__collision__grid_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/landscape__collision__grid_8cpp-source.html362
1 files changed, 362 insertions, 0 deletions
diff --git a/docs/doxygen/nel/landscape__collision__grid_8cpp-source.html b/docs/doxygen/nel/landscape__collision__grid_8cpp-source.html
new file mode 100644
index 00000000..e4651c1e
--- /dev/null
+++ b/docs/doxygen/nel/landscape__collision__grid_8cpp-source.html
@@ -0,0 +1,362 @@
+<!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>landscape_collision_grid.cpp</h1><a href="landscape__collision__grid_8cpp.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">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="landscape__collision__grid_8h.html">3d/landscape_collision_grid.h</a>"</font>
+00029 <font class="preprocessor">#include &lt;algorithm&gt;</font>
+00030
+00031
+00032 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00034
+00035 <font class="keyword">namespace </font>NL3D
+00036 {
+00037
+00038
+00039 <font class="comment">// ***************************************************************************</font>
+<a name="l00040"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a0">00040</a> CLandscapeCollisionGrid::CLandscapeCollisionGrid(CVisualCollisionManager *owner)
+00041 {
+00042 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o0">_Owner</a>= owner;
+00043 <font class="comment">// reset list to NULL.</font>
+00044 memset(<a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>, 0, <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>*<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a> * <font class="keyword">sizeof</font>(CVisualTileDescNode*));
+00045 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o1">_Cleared</a>= <font class="keyword">true</font>;
+00046
+00047 <font class="comment">// sizepower.</font>
+00048 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="namespaceNLMISC.html#a225">isPowerOf2</a>(<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>));
+00049 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o3">_SizePower</a>= <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a>(<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>);
+00050 }
+00051
+00052 <font class="comment">// ***************************************************************************</font>
+<a name="l00053"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a1">00053</a> CLandscapeCollisionGrid::~CLandscapeCollisionGrid()
+00054 {
+00055 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a2">clear</a>();
+00056 }
+00057
+00058 <font class="comment">// ***************************************************************************</font>
+<a name="l00059"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a2">00059</a> <font class="keywordtype">void</font> CLandscapeCollisionGrid::clear()
+00060 {
+00061 <font class="comment">// already cleared? do nothing.</font>
+00062 <font class="keywordflow">if</font>(_Cleared)
+00063 <font class="keywordflow">return</font>;
+00064
+00065 <font class="comment">// Parse all quads.</font>
+00066 sint i;
+00067 <font class="keywordflow">for</font>(i=0;i&lt;<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>*<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>;i++)
+00068 {
+00069 CVisualTileDescNode *ptr, *next;
+00070 ptr= <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>[i];
+00071
+00072 <font class="comment">// delete list of node.</font>
+00073 <font class="keywordflow">while</font>(ptr)
+00074 {
+00075 next= ptr-&gt;Next;
+00076 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o0">_Owner</a>-&gt;deleteVisualTileDescNode(ptr);
+00077 ptr= next;
+00078 }
+00079
+00080 <font class="comment">// reset root.</font>
+00081 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>[i]= NULL;
+00082 }
+00083
+00084 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o1">_Cleared</a>= <font class="keyword">true</font>;
+00085 }
+00086
+00087
+00088 <font class="comment">// ***************************************************************************</font>
+<a name="l00089"></a><a class="code" href="structNL3D_1_1CVector2i.html">00089</a> <font class="keyword">struct </font>CVector2i
+00090 {
+<a name="l00091"></a><a class="code" href="structNL3D_1_1CVector2i.html#m1">00091</a> sint <a class="code" href="structNL3D_1_1CVector2i.html#m0">x</a>,<a class="code" href="structNL3D_1_1CVector2i.html#m1">y</a>;
+00092
+00093 };
+00094
+00095
+00096 <font class="comment">// ***************************************************************************</font>
+00097 <font class="comment">// fastFloor function.</font>
+00098 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00099 <font class="preprocessor"></font>
+00100 <font class="comment">// The magic constant value. support both positive and negative numbers.</font>
+00101 <font class="keyword">static</font> <font class="keywordtype">double</font> FastFloorMagicConst=pow(2,52)+pow(2,51);
+00102 <font class="keyword">static</font> uint FastFloorBkupCW;
+00103 <font class="comment">// init float CW.</font>
+00104 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a372">fastFloorBegin</a>()
+00105 {
+00106 FastFloorBkupCW= _controlfp(0, 0);
+00107 _controlfp( _RC_DOWN|_PC_53, _MCW_RC|_MCW_PC );
+00108 }
+00109
+00110 <font class="comment">// reset float CW.</font>
+00111 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a373">fastFloorEnd</a>()
+00112 {
+00113 _controlfp(FastFloorBkupCW, _MCW_RC|_MCW_PC);
+00114 }
+00115
+00116 <font class="comment">// Force __stdcall to not pass parameters in registers.</font>
+00117 <font class="keyword">static</font> <font class="keyword">inline</font> sint __stdcall <a class="code" href="namespaceNL3D.html#a374">fastFloor</a>(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
+00118 {
+00119 sint32 QWord[2];
+00120 sint32 *Qw=QWord;
+00121 sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00122 __asm
+00123 {
+00124 fld <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>
+00125 fadd FastFloorMagicConst
+00126 mov ebx,Qw
+00127 fstp qword ptr [ebx]
+00128 mov eax,dword ptr [ebx]
+00129 mov <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, eax
+00130 }
+00131
+00132 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00133 }
+00134
+00135 <font class="preprocessor">#else</font>
+00136 <font class="preprocessor"></font><font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a372">fastFloorBegin</a>() {}
+00137 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a373">fastFloorEnd</a>() {}
+00138 <font class="keyword">static</font> <font class="keyword">inline</font> sint <a class="code" href="namespaceNL3D.html#a374">fastFloor</a>(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
+00139 {
+00140 <font class="keywordflow">return</font> (sint)floor(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>);
+00141 }
+00142 <font class="preprocessor">#endif</font>
+00143 <font class="preprocessor"></font>
+00144
+00145
+00146 <font class="comment">// ***************************************************************************</font>
+<a name="l00147"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a3">00147</a> <font class="keywordtype">void</font> CLandscapeCollisionGrid::build(<font class="keyword">const</font> std::vector&lt;CPatchQuadBlock*&gt; &amp;quadBlocks, <font class="keyword">const</font> CVector &amp;delta)
+00148 {
+00149 sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00150 <font class="keyword">static</font> CVector2i floorVals[<a class="code" href="patch_8h.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>*<a class="code" href="patch_8h.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>];
+00151
+00152 <font class="comment">// first clear</font>
+00153 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a2">clear</a>();
+00154
+00155 <font class="comment">// init for fast floor.</font>
+00156 <a class="code" href="namespaceNL3D.html#a372">fastFloorBegin</a>();
+00157
+00158 <font class="comment">// then fill.</font>
+00159 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o1">_Cleared</a>= <font class="keyword">false</font>;
+00160 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o4">_Delta</a>= delta;
+00161 <font class="comment">// parse all quad blocks.</font>
+00162 <font class="keywordflow">for</font>(sint i=0; i&lt;(sint)quadBlocks.size();i++)
+00163 {
+00164 CPatchQuadBlock &amp;qb= *quadBlocks[i];
+00165 sint lenS= qb.PatchBlockId.S1 - qb.PatchBlockId.S0;
+00166 sint lenT= qb.PatchBlockId.T1 - qb.PatchBlockId.T0;
+00167
+00168 <font class="comment">// First, floor all vertices of interest.</font>
+00169 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;lenT+1; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00170 {
+00171 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;lenS+1; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00172 {
+00173 sint <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="patch_8h.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
+00174 <font class="comment">// Add delta, and floor to sint.</font>
+00175 floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].x= <a class="code" href="namespaceNL3D.html#a374">fastFloor</a>(qb.Vertices[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].x + delta.x);
+00176 floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].y= <a class="code" href="namespaceNL3D.html#a374">fastFloor</a>(qb.Vertices[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].y + delta.y);
+00177 }
+00178 }
+00179
+00180 <font class="comment">// Then compute min max for all quads, and insert quad id in the quadGrid.</font>
+00181 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;lenT; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00182 {
+00183 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;lenS; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00184 {
+00185 sint minx, maxx, miny, maxy;
+00186 sint <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="patch_8h.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
+00187 <font class="comment">// Compute min max of the 4 vertices.</font>
+00188 minx= floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].x; maxx= floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].x;
+00189 miny= floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].y; maxy= floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].y;
+00190 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>++;
+00191 minx= <a class="code" href="bit__set_8cpp.html#a0">min</a>(minx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>); maxx= max(maxx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>);
+00192 miny= <a class="code" href="bit__set_8cpp.html#a0">min</a>(miny, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>); maxy= max(maxy, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>);
+00193 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>+= <a class="code" href="patch_8h.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>;
+00194 minx= <a class="code" href="bit__set_8cpp.html#a0">min</a>(minx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>); maxx= max(maxx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>);
+00195 miny= <a class="code" href="bit__set_8cpp.html#a0">min</a>(miny, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>); maxy= max(maxy, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>);
+00196 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>--;
+00197 minx= <a class="code" href="bit__set_8cpp.html#a0">min</a>(minx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>); maxx= max(maxx, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>);
+00198 miny= <a class="code" href="bit__set_8cpp.html#a0">min</a>(miny, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>); maxy= max(maxy, floorVals[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>].<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>);
+00199
+00200 <font class="comment">// store minmax in the quad.</font>
+00201 sint quadId= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="patch_8h.html#a9">NL_PATCH_BLOCK_MAX_QUAD</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
+00202 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#c0">addQuadToGrid</a>(i, quadId, minx, maxx, miny, maxy);
+00203 }
+00204 }
+00205 }
+00206
+00207 <font class="comment">// init for fast floor.</font>
+00208 <a class="code" href="namespaceNL3D.html#a373">fastFloorEnd</a>();
+00209 }
+00210
+00211
+00212 <font class="comment">// ***************************************************************************</font>
+<a name="l00213"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#c0">00213</a> <font class="keywordtype">void</font> CLandscapeCollisionGrid::addQuadToGrid(uint16 paBlockId, uint16 quadId, sint x0, sint x1, sint y0, sint y1)
+00214 {
+00215 <font class="comment">// coordinate should be positive.</font>
+00216 <a class="code" href="debug_8h.html#a6">nlassert</a>(x0&gt;=0 &amp;&amp; x1&gt;=x0);
+00217 <a class="code" href="debug_8h.html#a6">nlassert</a>(y0&gt;=0 &amp;&amp; y1&gt;=y0);
+00218
+00219 <font class="comment">// first, transform coordinate (in meters) in quadgrid eltSize (ie 2 meters).</font>
+00220 x0= (x0&gt;&gt;1); <font class="comment">// floor().</font>
+00221 x1= (x1&gt;&gt;1) + 1; <font class="comment">// equivalent of ceil().</font>
+00222 y0= (y0&gt;&gt;1); <font class="comment">// floor().</font>
+00223 y1= (y1&gt;&gt;1) + 1; <font class="comment">// equivalent of ceil().</font>
+00224
+00225 <font class="comment">// setup bounds in quadgrid coordinate.</font>
+00226 <font class="keywordflow">if</font>(x1-x0&gt;=<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>)
+00227 x0=0, x1= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>;
+00228 <font class="keywordflow">else</font>
+00229 {
+00230 x0&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00231 x1&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00232 <font class="keywordflow">if</font>(x1&lt;=x0)
+00233 x1+=<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>;
+00234 }
+00235 <font class="keywordflow">if</font>(y1-y0&gt;=<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>)
+00236 y0=0, y1= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>;
+00237 <font class="keywordflow">else</font>
+00238 {
+00239 y0&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00240 y1&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00241 <font class="keywordflow">if</font>(y1&lt;=y0)
+00242 y1+=<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>;
+00243 }
+00244
+00245 <font class="comment">// fill all cases with element.</font>
+00246 sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00247 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= y0;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;y1;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00248 {
+00249 sint xe,ye;
+00250 ye= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &amp;(<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1);
+00251 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= x0;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00252 {
+00253 xe= <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &amp;(<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1);
+00254 <font class="comment">// which case we add the element.</font>
+00255 sint gridId= (ye&lt;&lt;<a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o3">_SizePower</a>)+xe;
+00256
+00257 <font class="comment">// allocate element.</font>
+00258 CVisualTileDescNode *elt= <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o0">_Owner</a>-&gt;newVisualTileDescNode();
+00259
+00260 <font class="comment">// fill elt.</font>
+00261 elt-&gt;PatchQuadBlocId= paBlockId;
+00262 elt-&gt;QuadId= quadId;
+00263
+00264 <font class="comment">// bind elt to the list.</font>
+00265 elt-&gt;Next= <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>[gridId];
+00266 <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>[gridId]= elt;
+00267 }
+00268 }
+00269 }
+00270
+00271
+00272 <font class="comment">// ***************************************************************************</font>
+<a name="l00273"></a><a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#a4">00273</a> CVisualTileDescNode *CLandscapeCollisionGrid::select(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;pos)
+00274 {
+00275 <font class="comment">// compute pos in the quadgrid.</font>
+00276 CVector localPos;
+00277 localPos= pos + <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o4">_Delta</a>;
+00278 <font class="comment">// cases are 2x2 meters.</font>
+00279 localPos/=2;
+00280
+00281 <font class="comment">// floor, bound in quadgrid coordinate.</font>
+00282 sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00283 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= (sint)floor(localPos.x);
+00284 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= (sint)floor(localPos.y);
+00285 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00286 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&amp;= <a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>-1;
+00287
+00288 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeCollisionGrid.html#o2">_Grid</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="landscape__collision__grid_8h.html#a0">NL_COLGRID_SIZE</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
+00289 }
+00290
+00291
+00292
+00293 } <font class="comment">// NL3D</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>