aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSignpostMarv2012-08-17 16:53:36 +0100
committerJustin Clark-Casey (justincc)2012-08-17 18:40:49 +0100
commite9ea911563362c4766d34cd948a2915beac06124 (patch)
tree87542410a40fce3e909339112404b6bd76696e9b
parentenables configurable minimum sizes for physical & non-physical prims (diff)
downloadopensim-SC_OLD-e9ea911563362c4766d34cd948a2915beac06124.zip
opensim-SC_OLD-e9ea911563362c4766d34cd948a2915beac06124.tar.gz
opensim-SC_OLD-e9ea911563362c4766d34cd948a2915beac06124.tar.bz2
opensim-SC_OLD-e9ea911563362c4766d34cd948a2915beac06124.tar.xz
adding a clip method to handle Vector3 objects to enable a minor amount of refactoring
-rw-r--r--OpenSim/Framework/Util.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs11
2 files changed, 11 insertions, 6 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8cc29ee..38cb3a6 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -850,6 +850,12 @@ namespace OpenSim.Framework
850 return Math.Min(Math.Max(x, min), max); 850 return Math.Min(Math.Max(x, min), max);
851 } 851 }
852 852
853 public static Vector3 Clip(Vector3 vec, float min, float max)
854 {
855 return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
856 Clip(vec.Z, min, max));
857 }
858
853 /// <summary> 859 /// <summary>
854 /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens. 860 /// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
855 /// </summary> 861 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a7852ec..b7b5e8e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4019,9 +4019,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4019 public void llSetText(string text, LSL_Vector color, double alpha) 4019 public void llSetText(string text, LSL_Vector color, double alpha)
4020 { 4020 {
4021 m_host.AddScriptLPS(1); 4021 m_host.AddScriptLPS(1);
4022 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 4022 Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
4023 Util.Clip((float)color.y, 0.0f, 1.0f), 4023 (float)color.z), 0.0f, 1.0f);
4024 Util.Clip((float)color.z, 0.0f, 1.0f));
4025 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4024 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4026 //m_host.ParentGroup.HasGroupChanged = true; 4025 //m_host.ParentGroup.HasGroupChanged = true;
4027 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4026 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -7635,9 +7634,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7635 string primText = rules.GetLSLStringItem(idx++); 7634 string primText = rules.GetLSLStringItem(idx++);
7636 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 7635 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
7637 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 7636 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
7638 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), 7637 Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
7639 Util.Clip((float)primTextColor.y, 0.0f, 1.0f), 7638 (float)primTextColor.y,
7640 Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); 7639 (float)primTextColor.z), 0.0f, 1.0f);
7641 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 7640 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7642 7641
7643 break; 7642 break;