summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-07-09 22:30:50 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-07-09 22:30:50 +0100
commit9be476e3bb4cde7b086581931ed39ac137207ffe (patch)
tree149562627e24310c97533aa50fe77e5cccfb8621 /indra/newview/llvovolume.cpp
parent0b5bc866183c7b28aaea93f201e5010b90dd706d (diff)
MAINT-7926, MAINT-8400 - fixes related to bounding box and LOD calculations for rigged meshes in animated objects
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 7f353ea8aa..6bcbebb546 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -108,6 +108,10 @@ static LLTrace::BlockTimerStatHandle FTM_VOLUME_TEXTURES("Volume Textures");
extern BOOL gGLDebugLoggingEnabled;
+#if LL_MSVC
+#pragma optimize("", off)
+#endif
+
// Implementation class of LLMediaDataClientObject. See llmediadataclient.h
class LLMediaDataClientObjectImpl : public LLMediaDataClientObject
{
@@ -219,6 +223,9 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
mFaceMappingChanged = FALSE;
mLOD = MIN_LOD;
+ mLODDistance = 0.0f;
+ mLODAdjustedDistance = 0.0f;
+ mLODRadius = 0.0f;
mTextureAnimp = NULL;
mVolumeChanged = FALSE;
mVObjRadius = LLVector3(1,1,0.5f).length();
@@ -1293,7 +1300,19 @@ BOOL LLVOVolume::calcLOD()
}
distance = avatar->mDrawable->mDistanceWRTCamera;
- radius = avatar->getBinRadius();
+ if (avatar->isControlAvatar())
+ {
+ // MAINT-7926 Handle volumes in an animated object as a special case
+ const LLVector3* box = avatar->getLastAnimExtents();
+ LLVector3 diag = box[1] - box[0];
+ radius = diag.magVec() * 0.5f;
+ //LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
+ }
+ else
+ {
+ // Note this isn't really a radius, so distance calcs are off by factor of 2
+ radius = avatar->getBinRadius();
+ }
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL;
@@ -1313,7 +1332,10 @@ BOOL LLVOVolume::calcLOD()
//hold onto unmodified distance for debugging
//F32 debug_distance = distance;
-
+
+ mLODDistance = distance;
+ mLODRadius = radius;
+
distance *= sDistanceFactor;
F32 rampDist = LLVOVolume::sLODFactor * 2;
@@ -1335,6 +1357,8 @@ BOOL LLVOVolume::calcLOD()
lod_factor *= DEFAULT_FIELD_OF_VIEW / LLViewerCamera::getInstance()->getDefaultFOV();
}
+ mLODAdjustedDistance = distance;
+
cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor);
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT) && mDrawable->getFace(0))