diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/clip__trav_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/clip__trav_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/clip__trav_8cpp-source.html | 554 |
1 files changed, 554 insertions, 0 deletions
diff --git a/docs/doxygen/nel/clip__trav_8cpp-source.html b/docs/doxygen/nel/clip__trav_8cpp-source.html new file mode 100644 index 00000000..6d69ed98 --- /dev/null +++ b/docs/doxygen/nel/clip__trav_8cpp-source.html @@ -0,0 +1,554 @@ +<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </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> + + +<!-- 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> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.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">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <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> </center> +<hr><h1>clip_trav.cpp</h1><a href="clip__trav_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 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="types__nl_8h.html">nel/misc/types_nl.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="clip__trav_8h.html">3d/clip_trav.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="hrc__trav_8h.html">3d/hrc_trav.h</a>"</font> +00031 <font class="preprocessor">#include "<a class="code" href="render__trav_8h.html">3d/render_trav.h</a>"</font> +00032 <font class="preprocessor">#include "<a class="code" href="anim__detail__trav_8h.html">3d/anim_detail_trav.h</a>"</font> +00033 <font class="preprocessor">#include "<a class="code" href="load__balancing__trav_8h.html">3d/load_balancing_trav.h</a>"</font> +00034 <font class="preprocessor">#include "<a class="code" href="cluster_8h.html">3d/cluster.h</a>"</font> +00035 <font class="preprocessor">#include "<a class="code" href="scene__group_8h.html">3d/scene_group.h</a>"</font> +00036 <font class="preprocessor">#include "<a class="code" href="transform__shape_8h.html">3d/transform_shape.h</a>"</font> +00037 <font class="preprocessor">#include "<a class="code" href="camera_8h.html">3d/camera.h</a>"</font> +00038 <font class="preprocessor">#include "<a class="code" href="quad__grid__clip__cluster_8h.html">3d/quad_grid_clip_cluster.h</a>"</font> +00039 <font class="preprocessor">#include "<a class="code" href="quad__grid__clip__manager_8h.html">3d/quad_grid_clip_manager.h</a>"</font> +00040 <font class="preprocessor">#include "<a class="code" href="root__model_8h.html">3d/root_model.h</a>"</font> +00041 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font> +00042 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font> +00043 <font class="preprocessor">#include "<a class="code" href="skeleton__model_8h.html">3d/skeleton_model.h</a>"</font> +00044 <font class="preprocessor">#include "<a class="code" href="fast__floor_8h.html">3d/fast_floor.h</a>"</font> +00045 +00046 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00047 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00048 +00049 +00050 <font class="keyword">namespace </font>NL3D +00051 { +00052 +00053 +00054 <font class="comment">// ***************************************************************************</font> +<a name="l00055"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a0">00055</a> CClipTrav::CClipTrav() : ViewPyramid(6), WorldPyramid(6) +00056 { +00057 <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>.reserve(1024); +00058 <a class="code" href="classNL3D_1_1CClipTrav.html#m0">CurrentDate</a> = 0; +00059 <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.create (64, 16.0f); +00060 +00061 <a class="code" href="classNL3D_1_1CClipTrav.html#m4">ForceNoFrustumClip</a>= <font class="keyword">false</font>; +00062 <a class="code" href="classNL3D_1_1CClipTrav.html#o1">_QuadGridClipManager</a>= NULL; +00063 +00064 +00065 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>= NULL; +00066 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_4">AnimDetailTrav</a>= NULL; +00067 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_5">LoadBalancingTrav</a>= NULL; +00068 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_6">LightTrav</a>= NULL; +00069 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_7">RenderTrav</a> = NULL; +00070 } +00071 +00072 <font class="comment">// ***************************************************************************</font> +<a name="l00073"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a1">00073</a> CClipTrav::~CClipTrav() +00074 { +00075 } +00076 +00077 <font class="comment">// ***************************************************************************</font> +<a name="l00078"></a><a class="code" href="classNL3D_1_1CClipTrav.html#z395_0">00078</a> IObs* CClipTrav::createDefaultObs()<font class="keyword"> const</font> +00079 <font class="keyword"></font>{ +00080 <font class="keywordflow">return</font> <font class="keyword">new</font> CDefaultClipObs; +00081 } +00082 +00083 <font class="comment">// ***************************************************************************</font> +<a name="l00084"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a10">00084</a> <font class="keywordtype">bool</font> CClipTrav::fullSearch (vector<CCluster*>& result, CInstanceGroup *pIG, CVector& pos) +00085 { +00086 uint32 i, j; +00087 +00088 <font class="keywordflow">for</font> (i = 0; i < pIG->_ClusterInstances.size(); ++i) +00089 { +00090 <font class="keywordflow">for</font> (j = 0; j < pIG->_ClusterInstances[i]->Children.size(); ++j) +00091 { +00092 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CClipTrav.html#a10">fullSearch</a> (result, pIG->_ClusterInstances[i]->Children[j]->Group, pos)) +00093 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00094 } +00095 } +00096 +00097 <font class="keywordflow">for</font> (i = 0; i < pIG->_ClusterInstances.size(); ++i) +00098 { +00099 <font class="keywordflow">if</font> (pIG->_ClusterInstances[i]->isIn(pos)) +00100 result.push_back (pIG->_ClusterInstances[i]); +00101 } +00102 <font class="keywordflow">if</font> (result.size() > 0) +00103 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00104 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00105 } +00106 +00107 <font class="comment">// ***************************************************************************</font> +<a name="l00108"></a><a class="code" href="classNL3D_1_1CClipTrav.html#z395_3">00108</a> <font class="keywordtype">void</font> CClipTrav::traverse() +00109 { +00110 <a class="code" href="hierarchical__timer_8h.html#a4">H_AUTO</a>( NL3D_TravClip ); +00111 +00112 <font class="comment">// Increment the current date of the traversal</font> +00113 ++<a class="code" href="classNL3D_1_1CClipTrav.html#m0">CurrentDate</a>; +00114 <font class="comment">// Update Clip infos.</font> +00115 ITravCameraScene::update(); +00116 +00117 <font class="comment">// Compute pyramid in view basis.</font> +00118 CVector pfoc(0,0,0); +00119 CVector lb(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_0">Left</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_4">Near</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_2">Bottom</a> ); +00120 CVector lt(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_0">Left</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_4">Near</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_3">Top</a> ); +00121 CVector rb(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_1">Right</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_4">Near</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_2">Bottom</a> ); +00122 CVector rt(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_1">Right</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_4">Near</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_3">Top</a> ); +00123 +00124 CVector lbFar(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_0">Left</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_5">Far</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_2">Bottom</a>); +00125 CVector ltFar(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_0">Left</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_5">Far</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_3">Top</a> ); +00126 CVector rtFar(<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_1">Right</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_5">Far</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_3">Top</a> ); +00127 +00128 uint32 i, j; +00129 +00130 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a0">NL3D_CLIP_PLANE_NEAR</a>].make(lt, lb, rt); +00131 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a1">NL3D_CLIP_PLANE_FAR</a>].make(lbFar, ltFar, rtFar); +00132 +00133 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a2">NL3D_CLIP_PLANE_LEFT</a>].make(pfoc, lt, lb); +00134 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a3">NL3D_CLIP_PLANE_TOP</a>].make(pfoc, rt, lt); +00135 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a4">NL3D_CLIP_PLANE_RIGHT</a>].make(pfoc, rb, rt); +00136 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[<a class="code" href="clip__trav_8h.html#a5">NL3D_CLIP_PLANE_BOTTOM</a>].make(pfoc, lb, rb); +00137 +00138 <font class="comment">// Compute pyramid in World basis.</font> +00139 <font class="comment">// The vector transformation M of a plane p is computed as p*M-1.</font> +00140 <font class="comment">// Here, ViewMatrix== CamMatrix-1. Hence the following formula.</font> +00141 <font class="keywordflow">for</font> (i = 0; i < 6; i++) +00142 { +00143 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_2">WorldPyramid</a>[i]= <a class="code" href="classNL3D_1_1CClipTrav.html#z397_0">ViewPyramid</a>[i]*<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_8">ViewMatrix</a>; +00144 } +00145 +00146 <font class="comment">// bkup this pyramid (because this one may be modified by the cluster system).</font> +00147 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_1">WorldFrustumPyramid</a>= <a class="code" href="classNL3D_1_1CClipTrav.html#z397_2">WorldPyramid</a>; +00148 +00149 +00150 <font class="comment">// update the QuadGridClipManager.</font> +00151 <font class="keywordflow">if</font>(_QuadGridClipManager) +00152 { +00153 <a class="code" href="classNL3D_1_1CClipTrav.html#o1">_QuadGridClipManager</a>->updateClustersFromCamera(<font class="keyword">this</font>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_9">CamPos</a>); +00154 } +00155 +00156 <font class="comment">// Clear the traversals list.</font> +00157 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CClipTrav.html#z397_4">AnimDetailTrav</a> && <a class="code" href="classNL3D_1_1CClipTrav.html#z397_5">LoadBalancingTrav</a> && <a class="code" href="classNL3D_1_1CClipTrav.html#z397_6">LightTrav</a> && <a class="code" href="classNL3D_1_1CClipTrav.html#z397_7">RenderTrav</a>); +00158 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_4">AnimDetailTrav</a>->clearVisibleList(); +00159 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_5">LoadBalancingTrav</a>->clearVisibleList(); +00160 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_6">LightTrav</a>->clearLightedList(); +00161 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_7">RenderTrav</a>->clearRenderList(); +00162 +00163 +00164 <font class="comment">/* For all objects marked visible in preceding render, reset Visible state here.</font> +00165 <font class="comment"> NB: must reset Visible State to false because sometimes ClipObs::traverse() are even not executed</font> +00166 <font class="comment"> (Cluster clip, QuadGridClipManager clip...).</font> +00167 <font class="comment"> And somes models read this Visible state. eg: Skins/StickedObjects test the Visible state of </font> +00168 <font class="comment"> their _AncestorSkeletonModel.</font> +00169 <font class="comment"> */</font> +00170 <font class="keywordflow">for</font> (i=0;i<<a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>.size();i++) +00171 { +00172 <font class="comment">// if the observer still exists (see ~IBaseClipObs())</font> +00173 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>[i] ) +00174 { +00175 <font class="comment">// disable his visibility.</font> +00176 <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>[i]->Visible= <font class="keyword">false</font>; +00177 <font class="comment">// let him know that it is no more in the list.</font> +00178 <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>[i]->_IndexInVisibleList= -1; +00179 } +00180 } +00181 <font class="comment">// Clear The visible List.</font> +00182 <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>.clear(); +00183 +00184 +00185 <font class="comment">// Found where is the camera</font> +00186 <font class="comment">//========================</font> +00187 +00188 <font class="comment">// Found the cluster where the camera is</font> +00189 <font class="keyword">static</font> vector<CCluster*> vCluster; +00190 +00191 vCluster.clear(); +00192 +00193 <font class="comment">// In which cluster is the camera ?</font> +00194 <font class="keywordtype">bool</font> bInWorld = <font class="keyword">true</font>; +00195 CQuadGrid<CCluster*>::CIterator itAcc; +00196 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CClipTrav.html#m2">Camera</a>->getClusterSystem() == (CInstanceGroup*)-1) +00197 { +00198 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CClipTrav.html#a10">fullSearch</a>(vCluster, <a class="code" href="classNL3D_1_1CClipTrav.html#m1">RootCluster</a>->Group, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_9">CamPos</a>)) +00199 bInWorld = <font class="keyword">false</font>; +00200 <font class="keywordflow">for</font> (i = 0; i < vCluster.size(); ++i) +00201 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a>(NULL, vCluster[i]); +00202 } +00203 <font class="keywordflow">else</font> +00204 { +00205 <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.select (<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_9">CamPos</a>, <a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_9">CamPos</a>); +00206 itAcc = <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.begin(); +00207 <font class="keywordflow">while</font> (itAcc != <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.end()) +00208 { +00209 CCluster *pCluster = *itAcc; +00210 <font class="keywordflow">if</font> (pCluster->Group == <a class="code" href="classNL3D_1_1CClipTrav.html#m2">Camera</a>->getClusterSystem()) +00211 <font class="keywordflow">if</font> (pCluster->isIn (<a class="code" href="classNL3D_1_1ITravCameraScene.html#z877_9">CamPos</a>)) +00212 { +00213 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a> (NULL, pCluster); +00214 vCluster.push_back (pCluster); +00215 bInWorld = <font class="keyword">false</font>; +00216 } +00217 ++itAcc; +00218 } +00219 } +00220 +00222 <font class="keywordflow">if</font> (bInWorld) +00223 { +00224 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a> (NULL, <a class="code" href="classNL3D_1_1CClipTrav.html#m1">RootCluster</a>); +00225 vCluster.push_back (<a class="code" href="classNL3D_1_1CClipTrav.html#m1">RootCluster</a>); +00226 } +00227 +00228 +00229 <font class="comment">// Manage Moving Objects</font> +00230 <font class="comment">//=====================</font> +00231 +00232 <font class="comment">// Unlink the moving objects from their clusters</font> +00233 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects.size(); ++i) +00234 { +00235 CTransformShape *pTfmShp = dynamic_cast<CTransformShape*>(<a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00236 <font class="keywordflow">if</font> (pTfmShp == NULL) +00237 <font class="keywordflow">continue</font>; +00238 +00239 <font class="keyword">static</font> vector<IModel*> vModels; +00240 vModels.clear(); +00241 IModel *pFather = <a class="code" href="classNL3D_1_1ITrav.html#z623_10">getFirstParent</a> (<a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00242 <font class="keywordflow">while</font> (pFather != NULL) +00243 { +00244 <font class="comment">// Does the father is a cluster, or a CQuadGridClipCluster ??</font> +00245 <font class="keywordflow">if</font> ( dynamic_cast<CCluster*>(pFather)!= NULL || dynamic_cast<CQuadGridClipCluster*>(pFather)!=NULL ) +00246 { +00247 vModels.push_back (pFather); +00248 } +00249 pFather = <a class="code" href="classNL3D_1_1ITrav.html#z623_11">getNextParent</a> (<a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00250 } +00251 <font class="keywordflow">for</font> (j = 0; j < vModels.size(); ++j) +00252 { +00253 <a class="code" href="classNL3D_1_1ITrav.html#z623_3">unlink</a> (vModels[j], <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00254 } +00255 <a class="code" href="classNL3D_1_1ITrav.html#z623_3">unlink</a> (NULL, <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00256 } +00257 +00258 <font class="comment">// Affect the moving objects to their clusters</font> +00259 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects.size(); ++i) +00260 { +00261 CTransformShape *pTfmShp = dynamic_cast<CTransformShape*>(<a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a>->_MovingObjects[i]); +00262 <font class="keywordflow">if</font> (pTfmShp == NULL) +00263 <font class="keywordflow">continue</font>; +00264 +00265 <font class="keywordtype">bool</font> bInWorld = <font class="keyword">true</font>; +00266 CAABBox box; +00267 pTfmShp->getAABBox (box); +00268 <font class="comment">// Transform the box in the world</font> +00269 CVector c = box.getCenter(); +00270 CVector p = box.getCenter()+box.getHalfSize(); +00271 <font class="keyword">const</font> CMatrix &wm = pTfmShp->getWorldMatrix(); +00272 c = wm * c; +00273 p = wm * p; +00274 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = (p - c).norm(); +00275 +00276 <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.select (c+CVector(<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>), c+CVector(-<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>,-<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>,-<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)); +00277 itAcc = <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.begin(); +00278 <font class="keywordflow">while</font> (itAcc != <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.end()) +00279 { +00280 CCluster *pCluster = *itAcc; +00281 <font class="keywordflow">if</font> (pCluster->Group == pTfmShp->getClusterSystem()) +00282 <font class="keywordflow">if</font> (pCluster->isIn (c,<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)) +00283 { +00284 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a> (pCluster, pTfmShp); +00285 bInWorld = <font class="keyword">false</font>; +00286 } +00287 ++itAcc; +00288 } +00289 +00290 <font class="comment">// Moving object in the world -> link to root or to the CQuadGridClipManager.</font> +00291 <font class="keywordflow">if</font> (bInWorld) +00292 { +00293 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CClipTrav.html#o1">_QuadGridClipManager</a> && pTfmShp->isQuadGridClipEnabled() ) +00294 { +00295 <font class="comment">// try to insert in the best cluster of the _QuadGridClipManager.</font> +00296 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CClipTrav.html#o1">_QuadGridClipManager</a>->linkModel(pTfmShp, <font class="keyword">this</font>)) +00297 <font class="comment">// if fails, link to "root".</font> +00298 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a> (<a class="code" href="classNL3D_1_1CClipTrav.html#m1">RootCluster</a>, pTfmShp); +00299 } +00300 <font class="keywordflow">else</font> +00301 { +00302 <a class="code" href="classNL3D_1_1ITrav.html#z623_2">link</a> (<a class="code" href="classNL3D_1_1CClipTrav.html#m1">RootCluster</a>, pTfmShp); +00303 } +00304 } +00305 } +00306 +00307 <font class="comment">// Clip the graph.</font> +00308 <font class="comment">//=====================</font> +00309 +00310 <font class="comment">// Traverse the graph.</font> +00311 <font class="keywordflow">if</font> (Root) +00312 <a class="code" href="classNL3D_1_1ITrav.html#n0">Root</a>->traverse (NULL); +00313 +00314 +00315 <font class="comment">// Unlink the cluster where we are</font> +00316 <font class="keywordflow">for</font> (i = 0; i < vCluster.size(); ++i) +00317 { +00318 <a class="code" href="classNL3D_1_1ITrav.html#z623_3">unlink</a> (NULL, vCluster[i]); +00319 } +00320 +00321 +00322 <font class="comment">// Load Balance the Skeleton CLod state here. </font> +00323 <font class="comment">// =========================</font> +00324 <font class="comment">/* Can't do it in LoadBalancingTrav because sons with _AncestorSkeletonModel!=NULL may be hiden if a skeleton</font> +00325 <font class="comment"> is displayed in CLod mode.</font> +00326 <font class="comment"> So must do it here, then clip all sons of AncestoreSkeletonModelGroup.</font> +00327 <font class="comment"> */</font> +00328 <a class="code" href="classNL3D_1_1CClipTrav.html#c0">loadBalanceSkeletonCLod</a>(); +00329 +00330 +00331 <font class="comment">// At the end of the clip traverse, must update clip for Objects which have a skeleton ancestor</font> +00332 <font class="comment">// =========================</font> +00333 <font class="comment">// those are linked to the SonsOfAncestorSkeletonModelGroup, so traverse it now.</font> +00334 <font class="keywordflow">if</font> (SonsOfAncestorSkeletonModelGroup) +00335 <a class="code" href="classNL3D_1_1CClipTrav.html#m5">SonsOfAncestorSkeletonModelGroup</a>->getObs(ClipTravId)->traverse(NULL); +00336 +00337 +00338 <font class="comment">// Update Here the Skin render Lists of All visible Skeletons</font> +00339 <font class="comment">// =========================</font> +00340 <font class="comment">/*</font> +00341 <font class="comment"> Done here, because AnimDetail and Render need correct lists. NB: important to do it </font> +00342 <font class="comment"> before Render Traversal, because updateSkinRenderLists() may change the transparency flag!!</font> +00343 <font class="comment"> NB: can't do it in the clipObs of the skeleton since _DisplayLodCharacterFlag must be updated for this frame.</font> +00344 <font class="comment"> */</font> +00345 CScene::ItSkeletonModelList itSkel; +00346 <font class="keywordflow">for</font>(itSkel= <a class="code" href="classNL3D_1_1ITravScene.html#m0">Scene</a>->getSkeletonModelListBegin(); itSkel!=<a class="code" href="classNL3D_1_1ITravScene.html#m0">Scene</a>->getSkeletonModelListEnd(); itSkel++) +00347 { +00348 CSkeletonModel *sm= *itSkel; +00349 <font class="comment">// if visible</font> +00350 <font class="keywordflow">if</font>(sm->isClipVisible()) +00351 sm->updateSkinRenderLists(); +00352 } +00353 +00354 } +00355 +00356 +00357 <font class="comment">// ***************************************************************************</font> +<a name="l00358"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a4">00358</a> <font class="keywordtype">void</font> CClipTrav::setHrcTrav (CHrcTrav* trav) +00359 { +00360 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_3">HrcTrav</a> = trav; +00361 } +00362 +00363 <font class="comment">// ***************************************************************************</font> +<a name="l00364"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a5">00364</a> <font class="keywordtype">void</font> CClipTrav::setAnimDetailTrav(CAnimDetailTrav *trav) +00365 { +00366 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_4">AnimDetailTrav</a>= trav; +00367 } +00368 +00369 <font class="comment">// ***************************************************************************</font> +<a name="l00370"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a6">00370</a> <font class="keywordtype">void</font> CClipTrav::setLoadBalancingTrav(CLoadBalancingTrav *trav) +00371 { +00372 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_5">LoadBalancingTrav</a>= trav; +00373 } +00374 +00375 <font class="comment">// ***************************************************************************</font> +<a name="l00376"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a7">00376</a> <font class="keywordtype">void</font> CClipTrav::setLightTrav (CLightTrav* trav) +00377 { +00378 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_6">LightTrav</a> = trav; +00379 } +00380 +00381 <font class="comment">// ***************************************************************************</font> +<a name="l00382"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a8">00382</a> <font class="keywordtype">void</font> CClipTrav::setRenderTrav (CRenderTrav* trav) +00383 { +00384 <a class="code" href="classNL3D_1_1CClipTrav.html#z397_7">RenderTrav</a> = trav; +00385 } +00386 +00387 <font class="comment">// ***************************************************************************</font> +<a name="l00388"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a9">00388</a> <font class="keywordtype">void</font> CClipTrav::setQuadGridClipManager(CQuadGridClipManager *mgr) +00389 { +00390 <a class="code" href="classNL3D_1_1CClipTrav.html#o1">_QuadGridClipManager</a>= mgr; +00391 } +00392 +00393 <font class="comment">// ***************************************************************************</font> +<a name="l00394"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a2">00394</a> <font class="keywordtype">void</font> CClipTrav::registerCluster (CCluster* pCluster) +00395 { +00396 pCluster->AccelIt = <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.insert (pCluster->getBBox().getMin(), pCluster->getBBox().getMax(), pCluster); +00397 } +00398 +00399 <font class="comment">// ***************************************************************************</font> +<a name="l00400"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a3">00400</a> <font class="keywordtype">void</font> CClipTrav::unregisterCluster (CCluster* pCluster) +00401 { +00402 <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.selectAll(); +00403 CQuadGrid<CCluster*>::CIterator itAcc = <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.begin(); +00404 <font class="keywordflow">while</font> (itAcc != <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.end()) +00405 { +00406 CCluster *pC = *itAcc; +00407 <font class="keywordflow">if</font> (pCluster == pC) +00408 { +00409 <a class="code" href="classNL3D_1_1CClipTrav.html#m3">Accel</a>.erase (itAcc); +00410 <font class="keywordflow">break</font>; +00411 } +00412 ++itAcc; +00413 } +00414 } +00415 +00416 +00417 <font class="comment">// ***************************************************************************</font> +<a name="l00418"></a><a class="code" href="classNL3D_1_1CClipTrav.html#a11">00418</a> <font class="keywordtype">void</font> CClipTrav::setSonsOfAncestorSkeletonModelGroup(CRootModel *m) +00419 { +00420 <a class="code" href="classNL3D_1_1CClipTrav.html#m5">SonsOfAncestorSkeletonModelGroup</a>= m; +00421 } +00422 +00423 +00424 <font class="comment">// ***************************************************************************</font> +<a name="l00425"></a><a class="code" href="classNL3D_1_1CClipTrav.html#z396_0">00425</a> <font class="keywordtype">void</font> CClipTrav::addVisibleObs(CTransformClipObs *obs) +00426 { +00427 obs->_IndexInVisibleList= <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>.size(); +00428 <a class="code" href="classNL3D_1_1CClipTrav.html#o0">_VisibleList</a>.push_back(obs); +00429 } +00430 +00431 +00432 <font class="comment">// ***************************************************************************</font> +<a name="l00433"></a><a class="code" href="classNL3D_1_1CClipTrav.html#c0">00433</a> <font class="keywordtype">void</font> CClipTrav::loadBalanceSkeletonCLod() +00434 { +00435 CScene::ItSkeletonModelList itSkel; +00436 <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.clear(); +00437 +00438 <font class="comment">// **** compute CLod priority of each skeleton,</font> +00439 <font class="keywordflow">for</font>(itSkel= <a class="code" href="classNL3D_1_1ITravScene.html#m0">Scene</a>->getSkeletonModelListBegin(); itSkel!=<a class="code" href="classNL3D_1_1ITravScene.html#m0">Scene</a>->getSkeletonModelListEnd(); itSkel++) +00440 { +00441 CSkeletonModel *sm= *itSkel; +00442 <font class="keywordtype">float</font> pr= sm->computeDisplayLodCharacterPriority(); +00443 <font class="comment">// If valid priority (CLOd enabled, and skeleton visible)</font> +00444 <font class="keywordflow">if</font>(pr>0) +00445 { +00446 <font class="comment">// if the priority is >1, then display as CLod</font> +00447 <font class="keywordflow">if</font>(pr>1) +00448 sm->setDisplayLodCharacterFlag(<font class="keyword">true</font>); +00449 <font class="comment">// else load balance.</font> +00450 <font class="keywordflow">else</font> +00451 { +00452 CSkeletonKey key; +00453 <font class="comment">// don't bother OptFastFloor precision. NB: 0<pr<=1 here.</font> +00454 key.Priority= <a class="code" href="namespaceNL3D.html#a362">OptFastFloor</a>(pr*0xFFFFFF00); +00455 key.SkeletonModel= sm; +00456 <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.push_back(key); +00457 } +00458 } +00459 } +00460 +00461 <font class="comment">// **** sort by priority in ascending order</font> +00462 uint nMaxSkelsInNotCLodForm= <a class="code" href="classNL3D_1_1ITravScene.html#m0">Scene</a>->getMaxSkeletonsInNotCLodForm(); +00463 <font class="comment">// Optim: need it only if too many skels</font> +00464 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.size()>nMaxSkelsInNotCLodForm) +00465 { +00466 sort(<a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.begin(), <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.end()); +00467 } +00468 +00469 <font class="comment">// **** set CLod flag </font> +00470 uint n= <a class="code" href="bit__set_8cpp.html#a0">min</a>(nMaxSkelsInNotCLodForm, <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.size()); +00471 uint i; +00472 <font class="comment">// The lowest priority are displayed in std form</font> +00473 <font class="keywordflow">for</font>(i=0;i<n;i++) +00474 { +00475 <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>[i].SkeletonModel->setDisplayLodCharacterFlag(<font class="keyword">false</font>); +00476 } +00477 <font class="comment">// the other are displayed in CLod form</font> +00478 <font class="keywordflow">for</font>(i=n;i<<a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>.size();i++) +00479 { +00480 <a class="code" href="classNL3D_1_1CClipTrav.html#o2">_TmpSortSkeletons</a>[i].SkeletonModel->setDisplayLodCharacterFlag(<font class="keyword">true</font>); +00481 } +00482 +00483 } +00484 +00485 +00486 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </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> |