VR-Vantage 2.4 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
Tutorials
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vrvGraphicsUtils
DtOctree.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2017 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
9
#pragma once
10
11
#include <
vrvGraphicsUtils/DtAxisAlignedBoundingBox.h
>
12
#include <
vrvGraphicsUtils/DtOctreeNodeFwdDeclare.h
>
13
#include <
vrvGraphicsUtils/DtCameraFwdDeclare.h
>
14
15
#include <list>
16
17
18
namespace
makVrv {
19
26
template
<
class
T>
27
class
DtOctree
28
{
29
public
:
31
DtOctree
(
DtOctree
* parent,
DtOctree
* treeRoot,
size_t
maxDepth );
32
34
~DtOctree
();
35
39
void
addNode
(
DtOctreeNode<T>
* );
40
42
void
removeNode
(
DtOctreeNode<T>
* );
43
45
int
numNodes
()
46
{
47
return
myNumNodes
;
48
};
49
52
DtAxisAlignedBoundingBox<T>
myBox
;
53
55
DtVector3<T>
myHalfSize
;
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
75
void
getCullBounds
(
DtAxisAlignedBoundingBox<T>
* )
const
;
76
77
78
typedef
std::vector< DtOctreeNode<T> * >
NodeList
;
80
NodeList
myNodes
;
81
82
void
updateOctreeNode
(
DtOctreeNode<T>
* pOctreeNode);
83
void
addOctreeNode
(
DtOctreeNode<T>
* pOctreeNode,
DtOctree<T>
* pOctree,
size_t
depth
= 0);
84
void
removeOctreeNode
(
DtOctreeNode<T>
* pOctreeNode);
85
86
void
findVisibleObjects
(
NodeList
& visibleNodes
87
,
DtOctree
* pOctree,
const
DtCamera<T>
* pCamera,
bool
foundVisible);
88
void
findVisibleObjects
(
NodeList
& visibleNodes
89
,
DtOctree
* pOctree,
const
Frustum<T>
* pFrustum,
bool
foundVisible);
90
protected
:
91
93
inline
void
ref
()
94
{
95
myNumNodes
++;
96
97
if
(
myParent
!= 0 )
myParent
->
ref
();
98
};
99
101
inline
void
unref
()
102
{
103
myNumNodes
--;
104
105
if
(
myParent
!= 0 )
myParent
->
unref
();
106
};
107
109
int
myNumNodes
;
110
112
DtOctree
*
myParent
;
113
115
DtOctree
*
myOctree
;
116
117
size_t
myMaxDepth
;
118
};
119
120
}
//namespace makVrv
121
122
#include "
DtOctree.inl
"
Copyright © 2005-2018 VT MAK. All Rights Reserved (
www.mak.com
)