28 return ((boxSize.
x <= halfm_BoxSize.
x)
29 && (boxSize.
y <= halfm_BoxSize.
y)
30 && (boxSize.
z <= halfm_BoxSize.
z));
40 ,
int *x,
int *y,
int *z)
const
49 if (ncenter.
x > center.
x)
54 if (ncenter.
y > center.
y)
59 if (ncenter.
z > center.
z)
71 for (
int i = 0; i < 2; i++)
73 for (
int j = 0; j < 2; j++)
75 for (
int k = 0; k < 2; k++)
82 if (parent == 0 && treeRoot == 0)
102 for (
int i = 0; i < 2; i++)
104 for (
int j = 0; j < 2; j++)
106 for (
int k = 0; k < 2; k++)
130 typename DtOctree<T>::NodeList::iterator iter = std::find(
myNodes.begin(),
myNodes.end(), n);
169 if (!pOctreeNode->
isIn(container->
myBox))
216 max.x = (octantMin.
x + octantMax.
x) / 2;
221 min.x = (octantMin.
x + octantMax.
x) / 2;
228 max.y = (octantMin.
y + octantMax.
y) / 2;
233 min.y = (octantMin.
y + octantMax.
y) / 2;
240 max.z = (octantMin.
z + octantMax.
z) / 2;
245 min.z = (octantMin.
z + octantMax.
z) / 2;
293 else if (octant == myOctreeRoot)
310 typename DtOctree<T>::NodeList::iterator it = octant->
myNodes.begin();
315 mBoxes.push_back(octant->getWireBoundingBox());
321 while (it != octant->
myNodes.end())
329 vis = camera->
IsVisible(sn->worldAABB());
336 sn->_addToRenderQueue(camera, queue, onlyShadowCasters);
339 visibleNodes.push_back(sn);
343 queue->addRenderable(sn->getDebugRenderable());
346 if (sn->getShowBoundingBox() || mShowBoundingBoxes)
347 sn->_addBoundingBoxToQueue(queue);
356 if ((child = octant->
myChildren[0][0][0]) != 0)
357 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
359 if ((child = octant->
myChildren[1][0][0]) != 0)
360 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
362 if ((child = octant->
myChildren[0][1][0]) != 0)
363 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
365 if ((child = octant->
myChildren[1][1][0]) != 0)
366 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
368 if ((child = octant->
myChildren[0][0][1]) != 0)
369 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
371 if ((child = octant->
myChildren[1][0][1]) != 0)
372 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
374 if ((child = octant->
myChildren[0][1][1]) != 0)
375 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
377 if ((child = octant->
myChildren[1][1][1]) != 0)
378 findVisibleObjects(visibleNodes, child, camera, childfoundvisible);
387 if (octant->numNodes() == 0)
397 else if (octant == myOctreeRoot)
405 octant->getCullBounds(&box);
406 v = frustum->visibility(box);
414 typename DtOctree<T>::NodeList::iterator it = octant->myNodes.begin();
418 while (it != octant->myNodes.end())
426 vis = frustum->isVisible(sn->worldAABB());
430 visibleNodes.push_back(sn);
438 if ((child = octant->myChildren[0][0][0]) != 0)
439 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
441 if ((child = octant->myChildren[1][0][0]) != 0)
442 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
444 if ((child = octant->myChildren[0][1][0]) != 0)
445 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
447 if ((child = octant->myChildren[1][1][0]) != 0)
448 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
450 if ((child = octant->myChildren[0][0][1]) != 0)
451 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
453 if ((child = octant->myChildren[1][0][1]) != 0)
454 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
456 if ((child = octant->myChildren[0][1][1]) != 0)
457 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
459 if ((child = octant->myChildren[1][1][1]) != 0)
460 findVisibleObjects(visibleNodes, child, frustum, childfoundvisible);
#define ASSERT_PREDICATE(p)
Definition DtAssert.h:28
#define SAFE_DELETE(p)
Definition DtCommonUtils.h:21
Template for 32/64 bit Axis Aligned bounding boxesnot virtual because its stored as is on the GPU.
Definition DtAxisAlignedBoundingBox.h:28
bool isNull(void) const
is null?
Definition DtAxisAlignedBoundingBox.inl:203
void setMinMax(const DtVector3< T > &vMin, const DtVector3< T > &vMax)
set the min max values
Definition DtAxisAlignedBoundingBox.inl:79
bool isInfinite(void) const
is infinite extents?
Definition DtAxisAlignedBoundingBox.inl:193
const DtVector3< T > & min(void) const
get the min
Definition DtAxisAlignedBoundingBox.inl:55
const DtVector3< T > & max(void) const
get the max
Definition DtAxisAlignedBoundingBox.inl:61
DtVector3< T > size(void) const
full size
Definition DtAxisAlignedBoundingBox.inl:147
Template for 32/64 bit Cameras.
Definition DtCamera.h:44
VisibilityFromCamera getVisibility(const DtAxisAlignedBoundingBox< T > &box) const
Returns visibility from this camera?
Definition DtCamera.inl:278
bool IsVisible(const DtAxisAlignedBoundingBox< T > &box) const
Is a box visible from this camera?
Definition DtCamera.inl:241
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< T > 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
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
number of SceneNodes in this octree and all its children.
Definition DtOctree.h:117
DtVector3< T > myHalfSize
Vector containing the dimensions of this octree / 2.
Definition DtOctree.h:55
DtOctree * myChildren[2][2][2]
Definition DtOctree.h:60
NodeList myNodes
Public list of SceneNodes attached to this particular octree.
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
DtOctree * myParent
parent octree
Definition DtOctree.h:120
void addNode(DtOctreeNode< T > *)
Definition DtOctree.inl:116
DtOctree * myOctreeRoot
tree root
Definition DtOctree.h:123
OctreeNode class.
Definition DtOctreeNode.h:21
DtOctree< T > * getOctant(void)
Get the octant which this node is in.
Definition DtOctreeNode.inl:33
void setOctant(DtOctree< T > *)
Set the octant which this node is in.
Definition DtOctreeNode.inl:27
bool isIn(const DtAxisAlignedBoundingBox< T > &box)
Determine whether a box is inside this node.
Definition DtOctreeNode.inl:40
DtAxisAlignedBoundingBox< T > myWorldAABB
Definition DtOctreeNode.h:41
2 dimensional vector
Definition DtVector3.h:27
T y
Definition DtVector3.h:135
T z
Definition DtVector3.h:135
T x
Definition DtVector3.h:135
Template for 32/64 bit bit frustums.
Definition DtCamera.h:160
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
VisibilityFromCamera
Definition DtCamera.h:36
@ VISIBILITY_PARTIAL
Definition DtCamera.h:37
@ VISIBILITY_FULL
Definition DtCamera.h:37
@ VISIBILITY_NONE
Definition DtCamera.h:37