NL3D::CQuadGridClipCluster Class Reference

#include <quad_grid_clip_cluster.h>


Detailed Description

A cluster of object for fast BBox clip.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 118 of file quad_grid_clip_cluster.h.

Public Member Functions

void addModel (const NLMISC::CAABBox &worldBBox, CTransformShape *model)
void clip (CClipTrav *clipTrav)
 CQuadGridClipCluster (uint numDist, float distMax, const NLMISC::CAABBox &pivot)
 Constructor.

const NLMISC::CAABBoxgetBBox () const
bool isEmpty () const
sint profileNumChildren (uint distLevel) const
void removeModel (CTransformShape *model)
void resetSons (CClipTrav *clipTrav)
 ~CQuadGridClipCluster ()

Data Fields

CFastPtrListNode ListNode

Protected Attributes

float _DistMax
uint _NumDist
uint _NumDistTotal
CQuadGridClipClusterQTreeNode _Root

Friends

class CQuadGridClipClusterQTreeNode


Constructor & Destructor Documentation

NL3D::CQuadGridClipCluster::CQuadGridClipCluster uint  numDist,
float  distMax,
const NLMISC::CAABBox pivot
 

Constructor.

Definition at line 399 of file quad_grid_clip_cluster.cpp.

References _DistMax, _NumDist, _NumDistTotal, NL3D::CQuadGridClipClusterQTreeNode::init(), NL3D_QUADGRID_CLIP_CLUSTER_DEPTH, and uint.

00400 {
00401         _DistMax= distMax;
00402         _NumDist= numDist;
00403         _NumDistTotal= _NumDist+1;
00404 
00405         _Root.init(this, NL3D_QUADGRID_CLIP_CLUSTER_DEPTH, true, pivot);
00406 }

NL3D::CQuadGridClipCluster::~CQuadGridClipCluster  ) 
 

Definition at line 409 of file quad_grid_clip_cluster.cpp.

00410 {
00411 }


Member Function Documentation

void NL3D::CQuadGridClipCluster::addModel const NLMISC::CAABBox worldBBox,
CTransformShape model
 

Definition at line 414 of file quad_grid_clip_cluster.cpp.

References _DistMax, _NumDist, NL3D::CTransformShape::_QuadClusterListNode, NLMISC::clamp(), NL3D::CTransformShape::getDistMax(), NL3D::CQuadGridClipClusterQTreeNode::insertModel(), NL3D::CFastPtrListNode::isLinked(), nlassert, and sint.

Referenced by NL3D::CQuadGridClipManager::linkModel().

00415 {
00416         // check not already inserted
00417         nlassert(!model->_QuadClusterListNode.isLinked());
00418 
00419         // Add the model to the good distance list
00420         float   modelDistMax= model->getDistMax();
00421         sint    distSetup;
00422         if(modelDistMax<0)
00423                 distSetup= _NumDist;
00424         else
00425         {
00426                 distSetup= (sint)floor(_NumDist*modelDistMax/_DistMax);
00427                 // NB: if >=_DistMax, then distSetup==_NumDist, meaning infinite distance (never dist clipped)
00428                 clamp(distSetup, 0, (sint)_NumDist);
00429         }
00430 
00431         // add / recurs to the quadtree
00432         _Root.insertModel(worldBBox, distSetup, model);
00433 }

void NL3D::CQuadGridClipCluster::clip CClipTrav clipTrav  ) 
 

Definition at line 444 of file quad_grid_clip_cluster.cpp.

References NL3D::CQuadGridClipClusterQTreeNode::clip(), and H_AUTO_USE.

00445 {
00446         H_AUTO_USE( NL3D_QuadClip_ClusterClip );
00447 
00448         // clip the quadtree
00449         _Root.clip(clipTrav);
00450 }

const NLMISC::CAABBox& NL3D::CQuadGridClipCluster::getBBox  )  const [inline]
 

Definition at line 138 of file quad_grid_clip_cluster.h.

References NL3D::CQuadGridClipClusterQTreeNode::BBox.

Referenced by NL3D::CQuadGridClipManager::profile().

00138 {return _Root.BBox;}

bool NL3D::CQuadGridClipCluster::isEmpty  )  const [inline]
 

Definition at line 137 of file quad_grid_clip_cluster.h.

References NL3D::CQuadGridClipClusterQTreeNode::Empty.

Referenced by NL3D::CQuadGridClipManager::linkModel(), and NL3D::CQuadGridClipManager::profile().

00137 {return _Root.Empty;}

sint NL3D::CQuadGridClipCluster::profileNumChildren uint  distLevel  )  const
 

Definition at line 460 of file quad_grid_clip_cluster.cpp.

References NL3D::CQuadGridClipClusterQTreeNode::profileNumChildren(), sint, and uint.

Referenced by NL3D::CQuadGridClipManager::profile().

00461 {
00462         uint    result= 0;
00463         _Root.profileNumChildren(distLevel, result);
00464         return result;
00465 }

void NL3D::CQuadGridClipCluster::removeModel CTransformShape model  ) 
 

Definition at line 437 of file quad_grid_clip_cluster.cpp.

References NL3D::CTransformShape::_QuadClusterListNode, and NL3D::CFastPtrListNode::unlink().

00438 {
00439         model->_QuadClusterListNode.unlink();
00440 }

void NL3D::CQuadGridClipCluster::resetSons CClipTrav clipTrav  ) 
 

Definition at line 453 of file quad_grid_clip_cluster.cpp.

References NL3D::CQuadGridClipClusterQTreeNode::resetSons().

Referenced by NL3D::CQuadGridClipManager::deleteCaseModels().

00454 {
00455         _Root.resetSons(clipTrav);
00456 }


Friends And Related Function Documentation

friend class CQuadGridClipClusterQTreeNode [friend]
 

Definition at line 144 of file quad_grid_clip_cluster.h.


Field Documentation

float NL3D::CQuadGridClipCluster::_DistMax [protected]
 

Definition at line 147 of file quad_grid_clip_cluster.h.

Referenced by addModel(), NL3D::CQuadGridClipClusterQTreeNode::clip(), CQuadGridClipCluster(), and NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip().

uint NL3D::CQuadGridClipCluster::_NumDist [protected]
 

Definition at line 149 of file quad_grid_clip_cluster.h.

Referenced by addModel(), NL3D::CQuadGridClipClusterQTreeNode::clip(), CQuadGridClipCluster(), and NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip().

uint NL3D::CQuadGridClipCluster::_NumDistTotal [protected]
 

Definition at line 151 of file quad_grid_clip_cluster.h.

Referenced by CQuadGridClipCluster(), and NL3D::CQuadGridClipClusterQTreeNode::init().

CQuadGridClipClusterQTreeNode NL3D::CQuadGridClipCluster::_Root [protected]
 

Definition at line 154 of file quad_grid_clip_cluster.h.

CFastPtrListNode NL3D::CQuadGridClipCluster::ListNode
 

Definition at line 122 of file quad_grid_clip_cluster.h.

Referenced by NL3D::CQuadGridClipManager::linkModel().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:33:58 2004 for NeL by doxygen 1.3.6