PixelLightAPI  .
Public Member Functions | Protected Attributes
PLMath::Octree Class Reference

Base octree class. More...

#include <Octree.h>

Inheritance diagram for PLMath::Octree:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLMATH_API Octree ()
 Constructor.
virtual PLMATH_API ~Octree ()
 Destructor.
PLMATH_API bool IsBuild () const
 Returns whether the octree is build or not.
PLMATH_API void Init (Octree *pParent=nullptr, int nSubdivide=-1, PLCore::uint32 nMinGeometries=0, PLCore::uint32 nIDOffset=0)
 Initializes the octree.
PLMATH_API void Destroy ()
 Destroys the octree.
PLMATH_API PLCore::uint32 GetLevel () const
 Returns the subdivision level.
PLMATH_API bool IsVisible () const
 Returns whether the octree is currently visible or not.
PLMATH_API void SetVisible (bool bVisible=true)
 Sets whether the octree is currently visible or not.
PLMATH_API const BoundingBoxGetBoundingBox () const
 Returns the octrees bounding box.
PLMATH_API int GetSubdivide () const
 Returns the subdivide.
PLMATH_API PLCore::uint32 GetMinGeometries () const
 Returns the minimum number of geometries per octree.
PLMATH_API const Vector3GetPos () const
 Returns the current position.
PLMATH_API void SetPos (const Vector3 &vPos)
 Set the current position.
PLMATH_API const Vector3GetScale () const
 Returns the current scale.
PLMATH_API void SetScale (const Vector3 &vScale)
 Set the current scale.
PLMATH_API const Matrix3x3GetRot () const
 Returns the current rotation matrix.
PLMATH_API void SetRot (const Matrix3x3 &mRot)
 Set the current rotation matrix.
PLMATH_API void UpdateVisibility (const PlaneSet &cPlaneSet, PLCore::Bitset *pBitset=nullptr)
 Updates the visibility information of the octree.
PLMATH_API void CheckSphere (const Vector3 &vPos, float fRadius)
 Check whether a sphere intersects with this octree.
PLMATH_API void CheckBox (const BoundingBox &cBox)
 Check whether a box intersects with this octree.

Protected Attributes

PLCore::uint32 m_nIDOffset
PLCore::uint32 m_nID
Octreem_pTopmost
Octreem_pParent
PLCore::uint32 m_nLevel
PLCore::uint32 m_nNumOfChildren
Octree ** m_ppChild
BoundingBox m_cBoundingBox
Vector3 m_vPos
Vector3 m_vBBCenter
bool m_bVisible
bool m_bBuild
int m_nSubdivide
PLCore::uint32 m_nMinGeometries

Detailed Description

Base octree class.

Remarks:
Visualization of the coordinate system and were the octree sectors are:
                             top _\                  back
       y               ____________\__________________|
       |                           |\ 0  \ 1  \       |
       |                           | \----\----\
       |                           |  \_3__\_2__\_____|
       |________ x     ____________|  | 3  | 2  |     |
       \                   bottom _\  |____|____|    front
        \                           \ |    |    |
         \                           \|_7__|_6__|
         z                           ||         ||
                                     ||         ||
                                 left |         | right
                                      |         |

    Sector position description:
           x       y         z
     0.  left     top       back
     1.  right    top       back
     2.  right    top       front
     3.  left     top       front
     4.  left     bottom    back
     5.  right    bottom    back
     6.  right    bottom    front
     7.  left     bottom    front

    -x = left     +x = right
    -y = bottom   +y = top
    -z = back     +z = front

Constructor & Destructor Documentation

PLMATH_API PLMath::Octree::Octree ( )

Constructor.

virtual PLMATH_API PLMath::Octree::~Octree ( ) [virtual]

Destructor.


Member Function Documentation

PLMATH_API bool PLMath::Octree::IsBuild ( ) const

Returns whether the octree is build or not.

Returns:
'true' if the octree is build, else 'false'
PLMATH_API void PLMath::Octree::Init ( Octree pParent = nullptr,
int  nSubdivide = -1,
PLCore::uint32  nMinGeometries = 0,
PLCore::uint32  nIDOffset = 0 
)

Initializes the octree.

Parameters:
[in]pParentParent octree, can be a null pointer
[in]nSubdivideSubdivide
[in]nMinGeometriesMinimum geometries per octree
[in]nIDOffsetID offset
Note:
  • You should destroy the old octree before you initialize the new one!
PLMATH_API void PLMath::Octree::Destroy ( )

Destroys the octree.

PLMATH_API PLCore::uint32 PLMath::Octree::GetLevel ( ) const

Returns the subdivision level.

Returns:
Subdivision level
PLMATH_API bool PLMath::Octree::IsVisible ( ) const

Returns whether the octree is currently visible or not.

Returns:
'true' if the octree is visible, else 'false'
PLMATH_API void PLMath::Octree::SetVisible ( bool  bVisible = true)

Sets whether the octree is currently visible or not.

Parameters:
[in]bVisibleShould the octree be visible?
PLMATH_API const BoundingBox& PLMath::Octree::GetBoundingBox ( ) const

Returns the octrees bounding box.

Returns:
Bounding box
PLMATH_API int PLMath::Octree::GetSubdivide ( ) const

Returns the subdivide.

Returns:
Subdivide
PLMATH_API PLCore::uint32 PLMath::Octree::GetMinGeometries ( ) const

Returns the minimum number of geometries per octree.

Returns:
Minimum number of geometries per octree
PLMATH_API const Vector3& PLMath::Octree::GetPos ( ) const

Returns the current position.

Returns:
Current position
PLMATH_API void PLMath::Octree::SetPos ( const Vector3 vPos)

Set the current position.

Parameters:
[in]vPosNew position
PLMATH_API const Vector3& PLMath::Octree::GetScale ( ) const

Returns the current scale.

Returns:
Current scale
PLMATH_API void PLMath::Octree::SetScale ( const Vector3 vScale)

Set the current scale.

Parameters:
[in]vScaleNew scale
PLMATH_API const Matrix3x3& PLMath::Octree::GetRot ( ) const

Returns the current rotation matrix.

Returns:
Current rotation matrix
PLMATH_API void PLMath::Octree::SetRot ( const Matrix3x3 mRot)

Set the current rotation matrix.

Parameters:
[in]mRotNew rotation matrix
PLMATH_API void PLMath::Octree::UpdateVisibility ( const PlaneSet cPlaneSet,
PLCore::Bitset pBitset = nullptr 
)

Updates the visibility information of the octree.

Parameters:
[in]cPlaneSetPlane set to check
[out]pBitsetOptional (can be a null pointer) bit set which can for instance be filled in CustomVisible() and CustomInvisible() with current visibility information
Remarks:
The result must be handled in the derived octree class. The function it will call CustomVisible()/CustomInvisible() to mark an octree as visible or invisible.
PLMATH_API void PLMath::Octree::CheckSphere ( const Vector3 vPos,
float  fRadius 
)

Check whether a sphere intersects with this octree.

Parameters:
[in]vPosCenter of the sphere
[in]fRadiusRadius of the sphere
See also:
PLMATH_API void PLMath::Octree::CheckBox ( const BoundingBox cBox)

Check whether a box intersects with this octree.

Parameters:
[in]cBoxBox to test
See also:

Member Data Documentation

PLCore::uint32 PLMath::Octree::m_nIDOffset [protected]

ID offset from parent (0-7)

PLCore::uint32 PLMath::Octree::m_nID [protected]

Octree ID

Topmost octree (always valid!)

Octree parent, can be a null pointer

PLCore::uint32 PLMath::Octree::m_nLevel [protected]

Node level (0 = topmost)

PLCore::uint32 PLMath::Octree::m_nNumOfChildren [protected]

Number of children

The children, can be a null pointer

Octree bounding box

World position (m_vPos+m_vBBCenter = real world position)

Original bounding box center

bool PLMath::Octree::m_bVisible [protected]

Is the octree visible?

bool PLMath::Octree::m_bBuild [protected]

is the octree build?

Subdivide

PLCore::uint32 PLMath::Octree::m_nMinGeometries [protected]

Minimum number of geometries per octree


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:20
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported