From 47cb1a25fe63743ea7788933020493b3c45a8472 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 10 Oct 2018 20:39:02 +0100
Subject: [PATCH] SL-9849 - color tweaks for dynamic bounding box. show
 impostor extents varies line thickness depending on how recently impostor was
 generated

---
 indra/newview/llspatialpartition.cpp | 11 ++++++++---
 indra/newview/llvoavatar.cpp         |  4 +++-
 indra/newview/llvoavatar.h           |  1 +
 indra/newview/pipeline.cpp           |  1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 32aa974bf1..1dc1e65fe5 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2178,9 +2178,14 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 						{
 							bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3());
 							bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f);
-							F32 r = 0.5 + 0.5 * has_scale_constraint;
-							F32 g = 0.5 + 0.5 * has_pos_constraint;
-							gGL.diffuseColor4f(r,g,0,1); 
+							if (has_pos_constraint || has_scale_constraint)
+							{
+								gGL.diffuseColor4f(1,0,0,1); 
+							}
+							else
+							{
+								gGL.diffuseColor4f(0,1,0.5,1); 
+							}
 						}
 						else
 						{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 8005be6776..7b0029892c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -630,6 +630,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mTyping(FALSE),
 	mMeshValid(FALSE),
 	mVisible(FALSE),
+	mLastImpostorUpdateFrameTime(0.f),
 	mWindFreq(0.f),
 	mRipplePhase( 0.f ),
 	mBelowWater(FALSE),
@@ -4959,7 +4960,8 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
 
 		gGL.begin(LLRender::LINES); 
 		gGL.color4f(1.f,1.f,1.f,1.f);
-		glLineWidth(2.f);
+		F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f);
+		glLineWidth(thickness);
 		gGL.vertex3fv((pos+left-up).mV);
 		gGL.vertex3fv((pos-left-up).mV);
 		gGL.vertex3fv((pos-left-up).mV);
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 3e65f8d5a7..4d2b40347d 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -528,6 +528,7 @@ public:
 	static void updateImpostors();
 	LLRenderTarget mImpostor;
 	BOOL		mNeedsImpostorUpdate;
+	F32SecondsImplicit mLastImpostorUpdateFrameTime;
     const LLVector3*  getLastAnimExtents() const { return mLastAnimExtents; }
 private:
 	LLVector3	mImpostorOffset;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index b493219851..e7f50f6b59 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -11661,6 +11661,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 
 	avatar->mNeedsImpostorUpdate = FALSE;
 	avatar->cacheImpostorValues();
+	avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds;
 
 	LLVertexBuffer::unbind();
 	LLGLState::checkStates();
-- 
GitLab