From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03286.html | 879 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 879 insertions(+) create mode 100644 docs/doxygen/nel/a03286.html (limited to 'docs/doxygen/nel/a03286.html') diff --git a/docs/doxygen/nel/a03286.html b/docs/doxygen/nel/a03286.html new file mode 100644 index 00000000..86b76e7b --- /dev/null +++ b/docs/doxygen/nel/a03286.html @@ -0,0 +1,879 @@ + + +NeL: NL3D::CQuadGridClipClusterQTreeNode class Reference + + + +
+

NL3D::CQuadGridClipClusterQTreeNode Class Reference

#include <quad_grid_clip_cluster.h> +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void clip (CClipTrav *clipTrav)
 CQuadGridClipClusterQTreeNode ()
void init (CQuadGridClipCluster *owner, uint level, bool rootNode, const NLMISC::CAABBox &pivot)
void insertModel (const NLMISC::CAABBox &worldBBox, uint distSetup, CTransformShape *model)
void noFrustumClip (CClipTrav *clipTrav)
void profileNumChildren (uint distLevel, uint &result) const
void resetSons (CClipTrav *clipTrav)
 ~CQuadGridClipClusterQTreeNode ()

Data Fields

NLMISC::CAABBox BBox
NLMISC::CAABBoxExt BBoxExt
bool Empty
bool LeafNode
CQuadGridClipClusterListDist ListNode
CQuadGridClipClusterOwner
NLMISC::CAABBox PivotBBox
bool RootNode
CQuadGridClipClusterQTreeNodeSons [4]
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CQuadGridClipClusterQTreeNode::CQuadGridClipClusterQTreeNode  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 111 of file quad_grid_clip_cluster.cpp. +

+References Empty, LeafNode, RootNode, and Sons. +

+

00112 {
+00113         Sons[0]=NULL;
+00114         Sons[1]=NULL;
+00115         Sons[2]=NULL;
+00116         Sons[3]=NULL;
+00117         Empty= true;
+00118         Owner= NULL;
+00119         RootNode= false;
+00120         LeafNode= false;
+00121 }
+
+

+ + + + +
+ + + + + + + + + +
NL3D::CQuadGridClipClusterQTreeNode::~CQuadGridClipClusterQTreeNode  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 174 of file quad_grid_clip_cluster.cpp. +

+References ListNode, NL3D::CQuadGridClipClusterListDist::Models, nlassert, Sons, and uint. +

+

00175 {
+00176         // erase sons
+00177         uint i;
+00178         for(i=0; i<4;i++)
+00179         {
+00180                 if(Sons[i])
+00181                         delete Sons[i];
+00182                 Sons[i]= NULL;
+00183         }
+00184 
+00185         // check my list
+00186         for(i=0; i<ListNode.Models.size();i++)
+00187         {
+00188                 nlassert(ListNode.Models[i].empty());
+00189         }
+00190 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::clip CClipTrav clipTrav  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 193 of file quad_grid_clip_cluster.cpp. +

+References NL3D::CQuadGridClipCluster::_DistMax, NL3D::CQuadGridClipCluster::_NumDist, BBoxExt, NL3D::CTravCameraScene::CamPos, NLMISC::clamp(), NLMISC::CAABBoxExt::clipBack(), NLMISC::CAABBoxExt::clipFront(), NL3D::CQuadGridClipClusterListDist::clipSons(), Empty, NL3D::CClipTrav::ForceNoFrustumClip, NLMISC::CAABBoxExt::getCenter(), NLMISC::CAABBoxExt::getRadius(), H_AFTER, H_AUTO, H_BEFORE, LeafNode, ListNode, noFrustumClip(), sint, Sons, and NL3D::CClipTrav::WorldPyramid. +

+Referenced by NL3D::CQuadGridClipCluster::clip(). +

+

00194 {
+00195         // if empty (test important for branch and leave clusters)
+00196         if(Empty)
+00197                 return;
+00198 
+00199         H_BEFORE( NL3D_QuadClip_NodeClip );
+00200 
+00201         // Then clip against pyramid
+00202         bool    unspecified= false;
+00203         bool    visible= true;
+00204         for(sint i=0;i<(sint)clipTrav->WorldPyramid.size();i++)
+00205         {
+00206                 // We are sure that pyramid has normalized plane normals.
+00207                 if(!BBoxExt.clipBack(clipTrav->WorldPyramid[i]))
+00208                 {
+00209                         visible= false;
+00210                         break;
+00211                 }
+00212                 // else test is the bbox is partially or fully in the plane
+00213                 else if(!unspecified)
+00214                 {
+00215                         // if clipFront AND clipBack, it means partially.
+00216                         if(BBoxExt.clipFront(clipTrav->WorldPyramid[i]))
+00217                                 unspecified= true;
+00218                 }
+00219         }
+00220 
+00221         H_AFTER( NL3D_QuadClip_NodeClip );
+00222 
+00223         // if visible, parse sons
+00224         if(visible)
+00225         {
+00226                 // clip sons or cluster sons
+00227                 if(unspecified)
+00228                 {
+00229                         if( LeafNode)
+00230                         {
+00231                                 // clip DistMax.
+00232                                 CVector         c= BBoxExt.getCenter();
+00233                                 float           dist= (c - clipTrav->CamPos).norm();
+00234                                 dist-= BBoxExt.getRadius();
+00235                                 sint    minDistSetup= (sint)floor(Owner->_NumDist*dist/Owner->_DistMax);
+00236                                 // NB if too far, set _NumDist (ie will clip only the infinite objects ones)
+00237                                 clamp(minDistSetup, 0, (sint)Owner->_NumDist);
+00238 
+00239                                 // clip the sons individually 
+00240                                 H_AUTO( NL3D_QuadClip_SonsClip );
+00241                                 ListNode.clipSons(minDistSetup);
+00242                         }
+00243                         else
+00244                         {
+00245                                 // clip cluster sons
+00246                                 Sons[0]->clip(clipTrav);
+00247                                 Sons[1]->clip(clipTrav);
+00248                                 Sons[2]->clip(clipTrav);
+00249                                 Sons[3]->clip(clipTrav);
+00250                         }
+00251                 }
+00252                 else
+00253                 {
+00254                         // udpdate the sons, but don't clip, because we know they are fully visible.
+00255                         clipTrav->ForceNoFrustumClip= true;
+00256 
+00257                         // show all cluster sons or sons
+00258                         noFrustumClip(clipTrav);
+00259 
+00260                         // reset flag
+00261                         clipTrav->ForceNoFrustumClip= false;
+00262                 }
+00263         }
+00264 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::init CQuadGridClipCluster owner,
uint  level,
bool  rootNode,
const NLMISC::CAABBox pivot
+
+ + + + + +
+   + + +

+ +

+Definition at line 125 of file quad_grid_clip_cluster.cpp. +

+References NL3D::CQuadGridClipCluster::_NumDistTotal, NLMISC::CAABBox::getCenter(), NLMISC::CAABBox::getHalfSize(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), LeafNode, level, ListNode, NL3D::CQuadGridClipClusterListDist::Models, NL3D_QCC_LEFT_DOWN, NL3D_QCC_LEFT_UP, NL3D_QCC_RIGHT_DOWN, NL3D_QCC_RIGHT_UP, PivotBBox, RootNode, NLMISC::CAABBox::setCenter(), NLMISC::CAABBox::setSize(), Sons, uint, NLMISC::CVector::x, and NLMISC::CVector::y. +

+Referenced by NL3D::CQuadGridClipCluster::CQuadGridClipCluster(). +

+

00126 {
+00127         Owner= owner;
+00128         RootNode= rootNode;
+00129         PivotBBox= pivot;
+00130 
+00131         // If not a leaf, create sons
+00132         if(level>0)
+00133         {
+00134                 LeafNode= false;
+00135 
+00136                 // split pivot for sons
+00137                 CAABBox pivotSon;
+00138                 pivotSon.setSize(PivotBBox.getHalfSize());
+00139                 float   xMin= PivotBBox.getMin().x/2;
+00140                 float   yMin= PivotBBox.getMin().y/2;
+00141                 float   xMax= PivotBBox.getMax().x/2;
+00142                 float   yMax= PivotBBox.getMax().y/2;
+00143                 float   xCenter= PivotBBox.getCenter().x/2;
+00144                 float   yCenter= PivotBBox.getCenter().y/2;
+00145                 // LeftDown
+00146                 pivotSon.setCenter( CVector(xMin+xCenter,yMin+yCenter,0) );
+00147                 Sons[NL3D_QCC_LEFT_DOWN]= new CQuadGridClipClusterQTreeNode;
+00148                 Sons[NL3D_QCC_LEFT_DOWN]->init(owner, level-1, false, pivotSon);
+00149                 // RightDown
+00150                 pivotSon.setCenter( CVector(xMax+xCenter,yMin+yCenter,0) );
+00151                 Sons[NL3D_QCC_RIGHT_DOWN]= new CQuadGridClipClusterQTreeNode;
+00152                 Sons[NL3D_QCC_RIGHT_DOWN]->init(owner, level-1, false, pivotSon);
+00153                 // LeftUp
+00154                 pivotSon.setCenter( CVector(xMin+xCenter,yMax+yCenter,0) );
+00155                 Sons[NL3D_QCC_LEFT_UP]= new CQuadGridClipClusterQTreeNode;
+00156                 Sons[NL3D_QCC_LEFT_UP]->init(owner, level-1, false, pivotSon);
+00157                 // RithgUp
+00158                 pivotSon.setCenter( CVector(xMax+xCenter,yMax+yCenter,0) );
+00159                 Sons[NL3D_QCC_RIGHT_UP]= new CQuadGridClipClusterQTreeNode;
+00160                 Sons[NL3D_QCC_RIGHT_UP]->init(owner, level-1, false, pivotSon);
+00161         }
+00162         else
+00163         {
+00164                 LeafNode= true;
+00165         }
+00166 
+00167         // Create the distMax list only if root or leaf. No models in interleaved branches.
+00168         if( LeafNode)
+00169                 ListNode.Models.resize(Owner->_NumDistTotal);
+00170 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::insertModel const NLMISC::CAABBox worldBBox,
uint  distSetup,
CTransformShape model
+
+ + + + + +
+   + + +

+ +

+Definition at line 301 of file quad_grid_clip_cluster.cpp. +

+References BBox, BBoxExt, Empty, NLMISC::CAABBox::extend(), NLMISC::CAABBox::getCenter(), NLMISC::CAABBox::getHalfSize(), NL3D::CQuadGridClipClusterListDist::insertModel(), LeafNode, ListNode, NL3D_QCC_LEFT_DOWN, NL3D_QCC_LEFT_UP, NL3D_QCC_RIGHT_DOWN, NL3D_QCC_RIGHT_UP, PivotBBox, Sons, uint, NLMISC::CVector::x, and NLMISC::CVector::y. +

+Referenced by NL3D::CQuadGridClipCluster::addModel(). +

+

00302 {
+00303         // if leaf node, insert the model in the list
+00304         if( LeafNode )
+00305         {
+00306                 if(Empty)
+00307                 {
+00308                         Empty= false;
+00309                         BBox= worldBBox;
+00310                 }
+00311                 else
+00312                 {
+00313                         // extend the bbox with 2 corners of the incoming bbox (sufficient for an AABBox).
+00314                         BBox.extend( worldBBox.getCenter() + worldBBox.getHalfSize() );
+00315                         BBox.extend( worldBBox.getCenter() - worldBBox.getHalfSize() );
+00316                 }
+00317 
+00318                 // insert in list
+00319                 ListNode.insertModel(distSetup, model);
+00320         }
+00321         // else, recurs insert in branch
+00322         else
+00323         {
+00324                 // choose what son according to pivot.
+00325                 CQuadGridClipClusterQTreeNode   *selectSon;
+00326                 if( worldBBox.getCenter().y<PivotBBox.getCenter().y )
+00327                 {
+00328                         if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
+00329                                 selectSon= Sons[NL3D_QCC_LEFT_DOWN];
+00330                         else
+00331                                 selectSon= Sons[NL3D_QCC_RIGHT_DOWN];
+00332                 }
+00333                 else
+00334                 {
+00335                         if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
+00336                                 selectSon= Sons[NL3D_QCC_LEFT_UP];
+00337                         else
+00338                                 selectSon= Sons[NL3D_QCC_RIGHT_UP];
+00339                 }
+00340 
+00341                 // insert in this cluster
+00342                 selectSon->insertModel(worldBBox, distSetup, model);
+00343 
+00344                 // extend my boox according to this son cluster.
+00345                 if(Empty)
+00346                 {
+00347                         Empty= false;
+00348                         BBox= selectSon->BBox;
+00349                 }
+00350                 else
+00351                 {
+00352                         // extend the bbox with 2 corners of the son bbox (sufficient for an AABBox).
+00353                         BBox.extend( selectSon->BBox.getCenter() + selectSon->BBox.getHalfSize() );
+00354                         BBox.extend( selectSon->BBox.getCenter() - selectSon->BBox.getHalfSize() );
+00355                 }
+00356         }
+00357 
+00358         // update bboxExt
+00359         BBoxExt= BBox;
+00360 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip CClipTrav clipTrav  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 268 of file quad_grid_clip_cluster.cpp. +

+References NL3D::CQuadGridClipCluster::_DistMax, NL3D::CQuadGridClipCluster::_NumDist, BBoxExt, NL3D::CTravCameraScene::CamPos, NLMISC::clamp(), NL3D::CQuadGridClipClusterListDist::clipSons(), Empty, NLMISC::CAABBoxExt::getCenter(), NLMISC::CAABBoxExt::getRadius(), H_AUTO_USE, LeafNode, ListNode, sint, and Sons. +

+Referenced by clip(). +

+

00269 {
+00270         // if empty (test important for branch and leave clusters)
+00271         if(Empty)
+00272                 return;
+00273 
+00274         // clip the sons
+00275         if( LeafNode)
+00276         {
+00277                 // clip DistMax.
+00278                 CVector         c= BBoxExt.getCenter();
+00279                 float           dist= (c - clipTrav->CamPos).norm();
+00280                 dist-= BBoxExt.getRadius();
+00281                 sint minDistSetup= (sint)floor(Owner->_NumDist*dist/Owner->_DistMax);
+00282                 // NB if too far, set _NumDist (ie will clip only the infinite objects ones)
+00283                 clamp(minDistSetup, 0, (sint)Owner->_NumDist);
+00284 
+00285                 // clip the sons
+00286                 H_AUTO_USE( NL3D_QuadClip_SonsShowNoClip );
+00287                 ListNode.clipSons(minDistSetup);
+00288         }
+00289         else
+00290         {
+00291                 // forceShow of cluster sons
+00292                 Sons[0]->noFrustumClip(clipTrav);
+00293                 Sons[1]->noFrustumClip(clipTrav);
+00294                 Sons[2]->noFrustumClip(clipTrav);
+00295                 Sons[3]->noFrustumClip(clipTrav);
+00296         }
+00297 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::profileNumChildren uint  distLevel,
uint result
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 377 of file quad_grid_clip_cluster.cpp. +

+References ListNode, NL3D::CQuadGridClipClusterListDist::Models, Sons, and uint. +

+Referenced by NL3D::CQuadGridClipCluster::profileNumChildren(). +

+

00378 {
+00379         if(distLevel<ListNode.Models.size())
+00380                 result+= ListNode.Models[distLevel].size();
+00381         // Add cluster sons
+00382         if(Sons[0])
+00383         {
+00384                 Sons[0]->profileNumChildren(distLevel, result);
+00385                 Sons[1]->profileNumChildren(distLevel, result);
+00386                 Sons[2]->profileNumChildren(distLevel, result);
+00387                 Sons[3]->profileNumChildren(distLevel, result);
+00388         }
+00389 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CQuadGridClipClusterQTreeNode::resetSons CClipTrav clipTrav  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 363 of file quad_grid_clip_cluster.cpp. +

+References ListNode, NL3D::CQuadGridClipClusterListDist::resetSons(), and Sons. +

+Referenced by NL3D::CQuadGridClipCluster::resetSons(). +

+

00364 {
+00365         ListNode.resetSons(clipTrav);
+00366         if(Sons[0])
+00367         {
+00368                 Sons[0]->resetSons(clipTrav);
+00369                 Sons[1]->resetSons(clipTrav);
+00370                 Sons[2]->resetSons(clipTrav);
+00371                 Sons[3]->resetSons(clipTrav);
+00372         }
+00373 }
+
+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CAABBox NL3D::CQuadGridClipClusterQTreeNode::BBox +
+
+ + + + + +
+   + + +

+ +

+Definition at line 75 of file quad_grid_clip_cluster.h. +

+Referenced by NL3D::CQuadGridClipCluster::getBBox(), and insertModel().

+

+ + + + +
+ + +
NLMISC::CAABBoxExt NL3D::CQuadGridClipClusterQTreeNode::BBoxExt +
+
+ + + + + +
+   + + +

+ +

+Definition at line 76 of file quad_grid_clip_cluster.h. +

+Referenced by clip(), insertModel(), and noFrustumClip().

+

+ + + + +
+ + +
bool NL3D::CQuadGridClipClusterQTreeNode::Empty +
+
+ + + + + +
+   + + +

+ +

+Definition at line 77 of file quad_grid_clip_cluster.h. +

+Referenced by clip(), CQuadGridClipClusterQTreeNode(), insertModel(), NL3D::CQuadGridClipCluster::isEmpty(), and noFrustumClip().

+

+ + + + +
+ + +
bool NL3D::CQuadGridClipClusterQTreeNode::LeafNode +
+
+ + + + + +
+   + + +

+ +

+Definition at line 82 of file quad_grid_clip_cluster.h. +

+Referenced by clip(), CQuadGridClipClusterQTreeNode(), init(), insertModel(), and noFrustumClip().

+

+ + + + +
+ + +
CQuadGridClipClusterListDist NL3D::CQuadGridClipClusterQTreeNode::ListNode +
+
+ + + + + +
+   + + +

+ +

+Definition at line 72 of file quad_grid_clip_cluster.h. +

+Referenced by clip(), init(), insertModel(), noFrustumClip(), profileNumChildren(), resetSons(), and ~CQuadGridClipClusterQTreeNode().

+

+ + + + +
+ + +
CQuadGridClipCluster* NL3D::CQuadGridClipClusterQTreeNode::Owner +
+
+ + + + + +
+   + + +

+ +

+Definition at line 66 of file quad_grid_clip_cluster.h.

+

+ + + + +
+ + +
NLMISC::CAABBox NL3D::CQuadGridClipClusterQTreeNode::PivotBBox +
+
+ + + + + +
+   + + +

+ +

+Definition at line 85 of file quad_grid_clip_cluster.h. +

+Referenced by init(), and insertModel().

+

+ + + + +
+ + +
bool NL3D::CQuadGridClipClusterQTreeNode::RootNode +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file quad_grid_clip_cluster.h. +

+Referenced by CQuadGridClipClusterQTreeNode(), and init().

+

+ + + + +
+ + +
CQuadGridClipClusterQTreeNode* NL3D::CQuadGridClipClusterQTreeNode::Sons[4] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 69 of file quad_grid_clip_cluster.h. +

+Referenced by clip(), CQuadGridClipClusterQTreeNode(), init(), insertModel(), noFrustumClip(), profileNumChildren(), resetSons(), and ~CQuadGridClipClusterQTreeNode().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 07:34:05 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1