diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-09-19 15:53:44 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-09-19 15:53:44 +0100 |
commit | 301821337bf692d9f8d56230dc620efa74fcd275 (patch) | |
tree | 4fd0a73f691033ae91a12c4500d924a1375571b6 /indra | |
parent | 02b7a9a0fa0f6e1b9a9695f7cc80ceb10b1d8071 (diff) |
SL-9680, SL-9673 - set attachment distance floor at 0.01 to avoid triggering divide-by-zero prevention logic. Force HUD attachments to always be full detail.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lldrawable.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 24 |
2 files changed, 23 insertions, 15 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 6f48b8a968..55db721ccf 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -913,12 +913,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); - //LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() - // << " pos (ignored) " << pos - // << " cam pos " << cam_pos - // << " cam region pos " << cam_region_pos - // << " box " << av_box[0] << "," << av_box[1] << LL_ENDL; - mDistanceWRTCamera = ll_round(cam_to_box_offset.magVec(), 0.01f); + mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); + LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() + << " pos (ignored) " << pos + << " cam pos " << cam_pos + << " cam region pos " << cam_region_pos + << " box " << av_box[0] << "," << av_box[1] + << " -> dist " << mDistanceWRTCamera + << LL_ENDL; mVObjp->updateLOD(); return; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8de97c711d..913460b3d1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1344,24 +1344,22 @@ BOOL LLVOVolume::calcLOD() 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; + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } else { // Volume in a rigged mesh attached to a regular avatar. -#if 0 // Note this isn't really a radius, so distance calcs are off by factor of 2 - radius = avatar->getBinRadius(); -#else + //radius = avatar->getBinRadius(); // SL-937: add dynamic box handling for rigged mesh on regular avatars. const LLVector3* box = avatar->getLastAnimExtents(); LLVector3 diag = box[1] - box[0]; radius = diag.magVec(); // preserve old BinRadius behavior - 2x off -#endif + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1371,7 +1369,7 @@ BOOL LLVOVolume::calcLOD() radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length(); if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1414,7 +1412,15 @@ BOOL LLVOVolume::calcLOD() mLODAdjustedDistance = distance; - cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); + if (isHUDAttachment()) + { + // HUDs always show at highest detail + cur_detail = 3; + } + else + { + 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)) { @@ -1434,7 +1440,7 @@ BOOL LLVOVolume::calcLOD() if (cur_detail != mLOD) { - LL_DEBUGS("CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD + LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD << " distance " << distance << " radius " << radius << " rampDist " << rampDist << " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1) << " mRiggedVolume " << (void*)getRiggedVolume() |