VR-Vantage
Loading...
Searching...
No Matches
DtOctree.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2023 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
9#pragma once
10
14
15#include <list>
16
17
18namespace makVrv {
19
26 template<class T>
28 {
29 public:
31 DtOctree( DtOctree * parent, DtOctree* treeRoot, size_t maxDepth );
32
35
40
43
46 {
47 return myNumNodes;
48 };
49
53
56
60 DtOctree* myChildren[ 2 ][ 2 ][ 2 ];
61
65 bool isTwiceSize( const DtAxisAlignedBoundingBox<T> &box ) const;
66
71 void getChildIndexes( const DtAxisAlignedBoundingBox<T> &, int *x, int *y, int *z ) const;
72
76
77
78 typedef std::list< DtOctreeNode<T> * > NodeList;
79 typedef std::vector< DtOctreeNode<T> * > NodeVector;
80
83
85 void addOctreeNode(DtOctreeNode<T>* pOctreeNode, DtOctree<T>* pOctree, size_t depth = 0);
87
88 void findVisibleObjects(NodeVector& visibleNodes
89 , DtOctree* pOctree, const DtCamera<T>* pCamera, bool foundVisible) const;
90 void findVisibleObjects(NodeVector& visibleNodes
91 , DtOctree* pOctree, const Frustum<T>* pFrustum, bool foundVisible) const;
92 protected:
93
95 inline void ref()
96 {
97 myNumNodes++;
98
99 if (myParent != 0)
100 {
101 myParent->ref();
102 }
103 };
104
106 inline void unref()
107 {
108 myNumNodes--;
109
110 if (myParent != 0)
111 {
112 myParent->unref();
113 };
114 }
115
118
121
124
126 };
127
128} //namespace makVrv
129
130#include "DtOctree.inl"
Axis Aligned Bounding Box class.
Camera forward declarations.
DtOctree inlines.
OctreeNode forward declarations.
Template for 32/64 bit Axis Aligned bounding boxesnot virtual because its stored as is on the GPU.
Definition DtAxisAlignedBoundingBox.h:28
Template for 32/64 bit Cameras.
Definition DtCamera.h:44
void findVisibleObjects(NodeVector &visibleNodes, DtOctree *pOctree, const DtCamera< T > *pCamera, bool foundVisible) const
bool isTwiceSize(const DtAxisAlignedBoundingBox< T > &box) const
Returns true is the box will fit in a child.
Definition DtOctree.inl:20
size_t myMaxDepth
Definition DtOctree.h:125
void removeNode(DtOctreeNode< T > *)
Removes an Octree scene node to this octree level.
Definition DtOctree.inl:128
void getChildIndexes(const DtAxisAlignedBoundingBox< T > &, int *x, int *y, int *z) const
It's assumed the the given box has already been proven to fit into a child.
Definition DtOctree.inl:39
DtAxisAlignedBoundingBox< float32 > myBox
Definition DtOctree.h:52
void unref()
Decrements the overall node count of this octree and all its parents.
Definition DtOctree.h:106
std::vector< DtOctreeNode< T > * > NodeVector
Definition DtOctree.h:79
void ref()
Increments the overall node count of this octree and all its parents.
Definition DtOctree.h:95
void updateOctreeNode(DtOctreeNode< T > *pOctreeNode)
Definition DtOctree.inl:148
std::list< DtOctreeNode< T > * > NodeList
Definition DtOctree.h:78
DtOctree(DtOctree *parent, DtOctree *treeRoot, size_t maxDepth)
CTOR.
Definition DtOctree.inl:67
int numNodes()
Returns the number of scene nodes attached to this octree.
Definition DtOctree.h:45
int myNumNodes
Definition DtOctree.h:117
DtVector3< float32 > myHalfSize
Definition DtOctree.h:55
DtOctree * myChildren[2][2][2]
Definition DtOctree.h:60
NodeList myNodes
Definition DtOctree.h:82
~DtOctree()
DTOR.
Definition DtOctree.inl:99
void removeOctreeNode(DtOctreeNode< T > *pOctreeNode)
Definition DtOctree.inl:262
void getCullBounds(DtAxisAlignedBoundingBox< T > *) const
Definition DtOctree.inl:142
void addOctreeNode(DtOctreeNode< T > *pOctreeNode, DtOctree< T > *pOctree, size_t depth=0)
Definition DtOctree.inl:187
void findVisibleObjects(NodeVector &visibleNodes, DtOctree *pOctree, const Frustum< T > *pFrustum, bool foundVisible) const
DtOctree * myParent
Definition DtOctree.h:120
void addNode(DtOctreeNode< T > *)
Definition DtOctree.inl:116
DtOctree * myOctreeRoot
Definition DtOctree.h:123
OctreeNode class.
Definition DtOctreeNode.h:21
2 dimensional vector
Definition DtVector3.h:27
Template for 32/64 bit bit frustums.
Definition DtCamera.h:160
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16