From 1d92a950df91d7e6d3a34e925f445bc389a3fa93 Mon Sep 17 00:00:00 2001
From: "Matthew Breindel (Falcon)" <falcon@lindenlab.com>
Date: Tue, 18 May 2010 11:26:53 -0700
Subject: [PATCH] Modified color scheme for visualization of physics reps.

---
 indra/newview/app_settings/settings.xml | 18 +++++++++++++++++-
 indra/newview/llspatialpartition.cpp    | 13 ++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 107f98071cc..2e7ff939ee0 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5427,7 +5427,7 @@
     <key>Type</key>
     <string>F32</string>
     <key>Value</key>
-    <real>128.0</real>
+    <real>50.0</real>
   </map>
   <key>ObjectCostLowColor</key>
   <map>
@@ -5445,6 +5445,22 @@
       <real>0.5</real>
     </array>
   </map>
+  <key>ObjectCostMidColor</key>
+  <map>
+    <key>Comment</key>
+    <string>Color for object with a medium object cost.</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Color4</string>
+    <key>Value</key>
+    <array>
+      <real>1.0</real>
+      <real>0.75</real>
+      <real>0.0</real>
+      <real>0.65</real>
+    </array>
+  </map>
   <key>ObjectCostHighColor</key>
   <map>
     <key>Comment</key>
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 1290e6b9a65..9bfc12c7abb 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2676,9 +2676,20 @@ void renderPhysicsShape(LLDrawable* drawable)
 		F32 cost = volume->getObjectCost();
 
 		LLColor4 low = gSavedSettings.getColor4("ObjectCostLowColor");
+		LLColor4 mid = gSavedSettings.getColor4("ObjectCostMidColor");
 		LLColor4 high = gSavedSettings.getColor4("ObjectCostHighColor");
 
-		LLColor4 color = lerp(low, high, cost/threshold);
+		F32 normalizedCost = 1.f - exp( -(cost / threshold) );
+
+		LLColor4 color;
+		if ( normalizedCost <= 0.5f )
+		{
+			color = lerp( low, mid, 2.f * normalizedCost );
+		}
+		else
+		{
+			color = lerp( mid, high, 2.f * ( normalizedCost - 0.5f ) );
+		}
 
 		U32 data_mask = LLVertexBuffer::MAP_VERTEX;
 
-- 
GitLab