summaryrefslogtreecommitdiff
path: root/indra/llmath/lloctree.h
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2014-08-04 21:35:57 +0000
committerMonty Brandenberg <monty@lindenlab.com>2014-08-04 21:35:57 +0000
commit8fe0084108202f307291d5d9be586e5186c2b1de (patch)
treeade28d7acd7eaf455657260db2b1dc5768e475e4 /indra/llmath/lloctree.h
parent9fb96b416f0612882ddcaa658945a5b3f73ff331 (diff)
parent9a8b1552f0fbff3cde1c8fa5e24924e237008814 (diff)
Merge. Refresh from viewer-library-refresh after 3.7.13 release.
Diffstat (limited to 'indra/llmath/lloctree.h')
-rwxr-xr-xindra/llmath/lloctree.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index 02220c41d8..7b5240c651 100755
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -36,6 +36,8 @@
extern U32 gOctreeMaxCapacity;
+extern float gOctreeMinSize;
+
/*#define LL_OCTREE_PARANOIA_CHECK 0
#if LL_DARWIN
#define LL_OCTREE_MAX_CAPACITY 32
@@ -106,6 +108,7 @@ public:
: mParent((oct_node*)parent),
mOctant(octant)
{
+ llassert(size[0] >= gOctreeMinSize*0.5f);
//always keep a NULL terminated list to avoid out of bounds exceptions in debug builds
mData.push_back(NULL);
mDataEnd = &mData[0];
@@ -213,7 +216,7 @@ public:
F32 size = mSize[0];
F32 p_size = size * 2.f;
- return (radius <= 0.001f && size <= 0.001f) ||
+ return (radius <= gOctreeMinSize && size <= gOctreeMinSize) ||
(radius <= p_size && radius > size);
}
@@ -319,7 +322,7 @@ public:
//is it here?
if (isInside(data->getPositionGroup()))
{
- if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
+ if (((getElementCount() < gOctreeMaxCapacity || getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius()) ||
(data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)))
{ //it belongs here
mData.push_back(NULL);
@@ -356,8 +359,9 @@ public:
LLVector4a val;
val.setSub(center, getCenter());
val.setAbs(val);
-
- S32 lt = val.lessThan(LLVector4a::getEpsilon()).getGatheredBits() & 0x7;
+ LLVector4a min_diff(gOctreeMinSize);
+
+ S32 lt = val.lessThan(min_diff).getGatheredBits() & 0x7;
if( lt == 0x7 )
{
@@ -389,6 +393,7 @@ public:
}
#endif
+ llassert(size[0] >= gOctreeMinSize*0.5f);
//make the new kid
child = new LLOctreeNode<T>(center, size, this);
addChild(child);
@@ -796,6 +801,8 @@ public:
this->setSize(size2);
this->updateMinMax();
+ llassert(size[0] >= gOctreeMinSize);
+
//copy our children to a new branch
LLOctreeNode<T>* newnode = new LLOctreeNode<T>(center, size, this);