From a90cdd9c7ea093110067de38740863f564932b96 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 26 Mar 2019 14:59:44 -0500 Subject: [PATCH] Experimental SHOverrideRiggedBounds setting to generate more accurate avatar bboxes. Defaults to off, for now. --- indra/newview/llspatialpartition.cpp | 4 +++- indra/newview/llvovolume.cpp | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index acaff8b02..b4b894858 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1963,7 +1963,9 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) const LLVector4a* ext; LLVector4a pos, size; - if (drawable->getVOVolume()) + static LLCachedControl sh_override_rigged_bounds("SHOverrideRiggedBounds", false); + LLVOVolume* volume = drawable->getVOVolume(); + if (volume && (!sh_override_rigged_bounds || !volume->isAttachment() || !(drawable->isState(LLDrawable::RIGGED) || volume->isRiggedMesh()))) { //render face bounding boxes for (S32 i = 0; i < drawable->getNumFaces(); i++) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 46669ede9..93114ed83 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1557,10 +1557,21 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global) bool any_valid_boxes = false; - if (getRiggedVolume()) + static LLCachedControl sh_override_rigged_bounds("SHOverrideRiggedBounds", false); + if (sh_override_rigged_bounds && isAttachment() && (mDrawable->isState(LLDrawable::RIGGED) || isRiggedMesh())) { - LL_DEBUGS("RiggedBox") << "rebuilding box, volume face count " << getVolume()->getNumVolumeFaces() << " drawable face count " << mDrawable->getNumFaces() << LL_ENDL; + LLVOAvatar* root = getAvatar(); + if (root) + { + any_valid_boxes = true; + static const LLVector3 PAD_SIZE(.1f, .1f, .1f); + LLVector3 minpos = -PAD_SIZE; + LLVector3 maxpos = PAD_SIZE; + min.load3(minpos.mV,1.f); + max.load3(maxpos.mV, 1.f); + } } + if (!any_valid_boxes) { for (S32 i = 0; i < getVolume()->getNumVolumeFaces(); i++) { LLFace *face = mDrawable->getFace(i);