GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GLC_OctreeNode Class Reference

GLC_OctreeNode : A node of Space partioning implemented with octree. More...

#include <glc_octreenode.h>

Public Member Functions

Constructor / Destructor
 GLC_OctreeNode (const GLC_BoundingBox &, GLC_OctreeNode *pParent=NULL)
 Construct a octree node from the given bounding box within the given octree node.
 
 GLC_OctreeNode (const GLC_OctreeNode &, GLC_OctreeNode *pParent=NULL)
 Construct a octree node from the first given octree node within the second given octree node.
 
virtual ~GLC_OctreeNode ()
 Destructor.
 

Private Types

typedef QList< GLC_OctreeNode * > NodeList
 

Private Member Functions

void unableViewFlag (QSet< GLC_3DViewInstance * > *)
 Unable the node and sub node view flag.
 
void disableViewFlag (QSet< GLC_3DViewInstance * > *)
 Disable the node and sub node view flag.
 

Private Attributes

GLC_BoundingBox m_BoundingBox
 Octree node bounding box.
 
GLC_OctreeNodem_pParent
 Parent Octree node.
 
NodeList m_Children
 Children list of octree node.
 
QSet< GLC_3DViewInstance * > m_3DViewInstanceSet
 This node set of 3DViewInstance.
 
bool m_Empty
 Flag to know if the node is empty.
 

Static Private Attributes

static bool m_useBoundingSphere = true
 Flag to know if intersection is calculated with bounding sphere.
 

Get Functions

GLC_BoundingBoxboundingBox ()
 
bool intersect (const GLC_BoundingBox &boundingBox)
 Return True if this octree node intersect the bounding box.
 
bool hasChild () const
 Return true if this octree has child octree node.
 
GLC_OctreeNodechildAt (int i) const
 Return the child octree node at the given index.
 
int childCount () const
 Return this octree node child octree node count.
 
bool hasGeometry () const
 Return true if this node contains 3D view instances.
 
bool isEmpty () const
 Return true if this octree node is empty.
 
QSet< GLC_3DViewInstance * > setOfIntersectedInstances (const GLC_BoundingBox &bBox)
 Return the list off instances inside or intersect the given bounding box.
 
static bool intersectionWithBoundingSphereUsed ()
 Return true if intersection are calculated with bounded sphere.
 

Set Functions

void addChildren ()
 Add 8 octree node children to this octree node.
 
void addInstance (GLC_3DViewInstance *, int)
 Add 3d view instance in this octree node branch.
 
void updateViewableInstances (const GLC_Frustum &, QSet< GLC_3DViewInstance * > *pInstanceSet=NULL)
 Update 3d view instances visibility of this octree node branch from the given frustum.
 
void removeEmptyChildren ()
 Remove empty child octree node from this octree node.
 
static void useBoundingSphereIntersection (bool)
 Set intersection to bounding sphere.
 

Detailed Description

GLC_OctreeNode : A node of Space partioning implemented with octree.

Definition at line 41 of file glc_octreenode.h.

Member Typedef Documentation

typedef QList<GLC_OctreeNode*> GLC_OctreeNode::NodeList
private

Definition at line 43 of file glc_octreenode.h.

Constructor & Destructor Documentation

GLC_OctreeNode::GLC_OctreeNode ( const GLC_BoundingBox boundingBox,
GLC_OctreeNode pParent = NULL 
)

Construct a octree node from the given bounding box within the given octree node.

Definition at line 28 of file glc_octreenode.cpp.

Referenced by addChildren(), and GLC_OctreeNode().

GLC_OctreeNode::GLC_OctreeNode ( const GLC_OctreeNode octreeNode,
GLC_OctreeNode pParent = NULL 
)

Construct a octree node from the first given octree node within the second given octree node.

Definition at line 39 of file glc_octreenode.cpp.

References GLC_OctreeNode(), and m_Children.

GLC_OctreeNode::~GLC_OctreeNode ( )
virtual

Destructor.

Definition at line 56 of file glc_octreenode.cpp.

References m_Children.

Member Function Documentation

void GLC_OctreeNode::addChildren ( )
void GLC_OctreeNode::addInstance ( GLC_3DViewInstance pInstance,
int  depth 
)

Add 3d view instance in this octree node branch.

Definition at line 178 of file glc_octreenode.cpp.

References addChildren(), GLC_3DViewInstance::boundingBox(), intersect(), GLC_BoundingBox::isEmpty(), m_3DViewInstanceSet, m_Children, and m_Empty.

Referenced by GLC_Octree::updateSpacePartitioning().

GLC_BoundingBox& GLC_OctreeNode::boundingBox ( void  )
inline

Definition at line 65 of file glc_octreenode.h.

References m_BoundingBox.

Referenced by GLC_Octree::createBoxWithMaterial().

GLC_OctreeNode* GLC_OctreeNode::childAt ( int  i) const
inline

Return the child octree node at the given index.

The child must exist

Definition at line 77 of file glc_octreenode.h.

References m_Children.

Referenced by GLC_Octree::createBoxWithMaterial().

int GLC_OctreeNode::childCount ( ) const
inline

Return this octree node child octree node count.

Definition at line 84 of file glc_octreenode.h.

References m_Children.

Referenced by GLC_Octree::createBoxWithMaterial(), and setOfIntersectedInstances().

void GLC_OctreeNode::disableViewFlag ( QSet< GLC_3DViewInstance * > *  pInstanceSet)
private

Disable the node and sub node view flag.

Definition at line 359 of file glc_octreenode.cpp.

References m_3DViewInstanceSet, m_Children, and GLC_3DViewInstance::NoViewable.

Referenced by updateViewableInstances().

bool GLC_OctreeNode::hasChild ( ) const
inline

Return true if this octree has child octree node.

Definition at line 72 of file glc_octreenode.h.

References m_Children.

Referenced by GLC_Octree::createBoxWithMaterial().

bool GLC_OctreeNode::hasGeometry ( ) const
inline

Return true if this node contains 3D view instances.

Definition at line 88 of file glc_octreenode.h.

References m_3DViewInstanceSet.

Referenced by GLC_Octree::createBoxWithMaterial().

bool GLC_OctreeNode::intersect ( const GLC_BoundingBox boundingBox)
inline

Return True if this octree node intersect the bounding box.

Definition at line 162 of file glc_octreenode.h.

References GLC_BoundingBox::intersect(), GLC_BoundingBox::intersectBoundingSphere(), m_BoundingBox, and m_useBoundingSphere.

Referenced by addInstance(), and setOfIntersectedInstances().

bool GLC_OctreeNode::intersectionWithBoundingSphereUsed ( )
static

Return true if intersection are calculated with bounded sphere.

Definition at line 65 of file glc_octreenode.cpp.

References m_useBoundingSphere.

bool GLC_OctreeNode::isEmpty ( void  ) const
inline

Return true if this octree node is empty.

An empty node doesn't contains child and 3d view instance

Definition at line 93 of file glc_octreenode.h.

References m_Empty.

Referenced by GLC_Octree::createBox(), GLC_Octree::createBoxWithMaterial(), and removeEmptyChildren().

void GLC_OctreeNode::removeEmptyChildren ( )

Remove empty child octree node from this octree node.

Definition at line 299 of file glc_octreenode.cpp.

References isEmpty(), m_3DViewInstanceSet, m_Children, m_Empty, m_pParent, and removeEmptyChildren().

Referenced by removeEmptyChildren(), and GLC_Octree::updateSpacePartitioning().

QSet< GLC_3DViewInstance * > GLC_OctreeNode::setOfIntersectedInstances ( const GLC_BoundingBox bBox)

Return the list off instances inside or intersect the given bounding box.

Definition at line 70 of file glc_octreenode.cpp.

References childCount(), intersect(), m_3DViewInstanceSet, and m_Children.

Referenced by GLC_Octree::listOfIntersectedInstances().

void GLC_OctreeNode::unableViewFlag ( QSet< GLC_3DViewInstance * > *  pInstanceSet)
private

Unable the node and sub node view flag.

Definition at line 338 of file glc_octreenode.cpp.

References GLC_3DViewInstance::FullViewable, m_3DViewInstanceSet, and m_Children.

Referenced by updateViewableInstances().

void GLC_OctreeNode::updateViewableInstances ( const GLC_Frustum frustum,
QSet< GLC_3DViewInstance * > *  pInstanceSet = NULL 
)
void GLC_OctreeNode::useBoundingSphereIntersection ( bool  use)
static

Set intersection to bounding sphere.

Definition at line 333 of file glc_octreenode.cpp.

References m_useBoundingSphere.

Member Data Documentation

QSet<GLC_3DViewInstance*> GLC_OctreeNode::m_3DViewInstanceSet
private
GLC_BoundingBox GLC_OctreeNode::m_BoundingBox
private

Octree node bounding box.

Definition at line 143 of file glc_octreenode.h.

Referenced by addChildren(), boundingBox(), intersect(), and updateViewableInstances().

NodeList GLC_OctreeNode::m_Children
private
bool GLC_OctreeNode::m_Empty
private

Flag to know if the node is empty.

Definition at line 155 of file glc_octreenode.h.

Referenced by addInstance(), isEmpty(), and removeEmptyChildren().

GLC_OctreeNode* GLC_OctreeNode::m_pParent
private

Parent Octree node.

Definition at line 146 of file glc_octreenode.h.

Referenced by removeEmptyChildren().

bool GLC_OctreeNode::m_useBoundingSphere = true
staticprivate

Flag to know if intersection is calculated with bounding sphere.

Definition at line 158 of file glc_octreenode.h.

Referenced by intersect(), intersectionWithBoundingSphereUsed(), and useBoundingSphereIntersection().


The documentation for this class was generated from the following files:

©2005-2013 Laurent Ribon