From d6c8be55e23c67fa29e6775078f88bf60339d48c Mon Sep 17 00:00:00 2001 From: Drake Arconis <lightdrake@gmail.com> Date: Mon, 16 Jun 2014 21:58:05 -0400 Subject: [PATCH] Backed out changeset: 39bc57956e09 --- indra/llmath/lloctree.h | 17 ++++++++++++----- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llspatialpartition.cpp | 1 + indra/newview/llviewercontrol.cpp | 1 + indra/newview/pipeline.cpp | 1 + 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 09870824d5..efb0e6ab94 100755 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -38,6 +38,8 @@ extern U32 gOctreeMaxCapacity; +extern float gOctreeMinSize; + /*#define LL_OCTREE_PARANOIA_CHECK 0 #if LL_DARWIN #define LL_OCTREE_MAX_CAPACITY 32 @@ -137,6 +139,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]; @@ -244,7 +247,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); } @@ -350,8 +353,8 @@ public: //is it here? if (isInside(data->getPositionGroup())) { - if (((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius())) || - (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) + if (((getElementCount() < gOctreeMaxCapacity || getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius())) || + (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)) { //it belongs here mData.push_back(NULL); mData[mElementCount] = data; @@ -387,8 +390,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 ) { @@ -420,6 +424,7 @@ public: } #endif + llassert(size[0] >= gOctreeMinSize*0.5f); //make the new kid child = new LLOctreeNode<T>(center, size, this); addChild(child); @@ -827,6 +832,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); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 76cdd0ce3d..1271bc4620 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8102,6 +8102,18 @@ <integer>128</integer> </map> + <key>OctreeMinimumNodeSize</key> + <map> + <key>Comment</key> + <string>Minimum size of any octree node</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.01</real> + </map> + <key>OctreeStaticObjectSizeFactor</key> <map> <key>Comment</key> diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 57e4a9894f..b4786b0b20 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -63,6 +63,7 @@ static U32 sZombieGroups = 0; U32 LLSpatialGroup::sNodeCount = 0; U32 gOctreeMaxCapacity; +F32 gOctreeMinSize; BOOL LLSpatialGroup::sNoDelete = FALSE; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 521d0270bc..2da21b0f17 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -384,6 +384,7 @@ static bool handleRepartition(const LLSD&) if (gPipeline.isInit()) { gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); + gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize"); gObjectList.repartitionObjects(); } return true; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 23adf82850..8bda7456f0 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -492,6 +492,7 @@ void LLPipeline::init() refreshCachedSettings(); gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); + gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize"); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); -- GitLab