From 2d01424e25f0ecfddae753032fe18e451771476f Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 23 Feb 2011 17:02:43 -0600
Subject: SH-301 Use avatar distance and radius when calculating LoD for rigged
 attachments.

---
 indra/newview/llvovolume.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 5c1d10ba7d..161cbe6aa9 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1204,9 +1204,20 @@ BOOL LLVOVolume::calcLOD()
 
 	S32 cur_detail = 0;
 	
-	F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length();
-	F32 distance = mDrawable->mDistanceWRTCamera; //llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE);
-	distance *= sDistanceFactor;
+	F32 radius;
+	F32 distance;
+
+	if (mDrawable->isState(LLDrawable::RIGGED))
+	{
+		LLVOAvatar* avatar = getAvatar(); 
+		distance = avatar->mDrawable->mDistanceWRTCamera;
+		radius = avatar->getBinRadius();
+	}
+	else
+	{
+		distance = mDrawable->mDistanceWRTCamera;
+		radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length();
+	}
 			
 	F32 rampDist = LLVOVolume::sLODFactor * 2;
 	
-- 
cgit v1.2.3