aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs100
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs100
2 files changed, 102 insertions, 98 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 1090c42..39502b6 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -1181,9 +1181,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1181 if (face > -1) 1181 if (face > -1)
1182 { 1182 {
1183 texcolor = tex.CreateFace((uint)face).RGBA; 1183 texcolor = tex.CreateFace((uint)face).RGBA;
1184 texcolor.R = (float)color.x; 1184 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1185 texcolor.G = (float)color.y; 1185 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1186 texcolor.B = (float)color.z; 1186 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1187 tex.FaceTextures[face].RGBA = texcolor; 1187 tex.FaceTextures[face].RGBA = texcolor;
1188 part.UpdateTexture(tex); 1188 part.UpdateTexture(tex);
1189 return; 1189 return;
@@ -1195,15 +1195,15 @@ namespace OpenSim.Region.ScriptEngine.Common
1195 if (tex.FaceTextures[i] != null) 1195 if (tex.FaceTextures[i] != null)
1196 { 1196 {
1197 texcolor = tex.FaceTextures[i].RGBA; 1197 texcolor = tex.FaceTextures[i].RGBA;
1198 texcolor.R = (float)color.x; 1198 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1199 texcolor.G = (float)color.y; 1199 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1200 texcolor.B = (float)color.z; 1200 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1201 tex.FaceTextures[i].RGBA = texcolor; 1201 tex.FaceTextures[i].RGBA = texcolor;
1202 } 1202 }
1203 texcolor = tex.DefaultTexture.RGBA; 1203 texcolor = tex.DefaultTexture.RGBA;
1204 texcolor.R = (float)color.x; 1204 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1205 texcolor.G = (float)color.y; 1205 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1206 texcolor.B = (float)color.z; 1206 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1207 tex.DefaultTexture.RGBA = texcolor; 1207 tex.DefaultTexture.RGBA = texcolor;
1208 } 1208 }
1209 part.UpdateTexture(tex); 1209 part.UpdateTexture(tex);
@@ -1340,7 +1340,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1340 if (face > -1) 1340 if (face > -1)
1341 { 1341 {
1342 texcolor = tex.CreateFace((uint)face).RGBA; 1342 texcolor = tex.CreateFace((uint)face).RGBA;
1343 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1343 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1344 tex.FaceTextures[face].RGBA = texcolor; 1344 tex.FaceTextures[face].RGBA = texcolor;
1345 part.UpdateTexture(tex); 1345 part.UpdateTexture(tex);
1346 return; 1346 return;
@@ -1352,12 +1352,12 @@ namespace OpenSim.Region.ScriptEngine.Common
1352 if (tex.FaceTextures[i] != null) 1352 if (tex.FaceTextures[i] != null)
1353 { 1353 {
1354 texcolor = tex.FaceTextures[i].RGBA; 1354 texcolor = tex.FaceTextures[i].RGBA;
1355 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1355 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1356 tex.FaceTextures[i].RGBA = texcolor; 1356 tex.FaceTextures[i].RGBA = texcolor;
1357 } 1357 }
1358 } 1358 }
1359 texcolor = tex.DefaultTexture.RGBA; 1359 texcolor = tex.DefaultTexture.RGBA;
1360 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1360 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1361 tex.DefaultTexture.RGBA = texcolor; 1361 tex.DefaultTexture.RGBA = texcolor;
1362 part.UpdateTexture(tex); 1362 part.UpdateTexture(tex);
1363 return; 1363 return;
@@ -1444,9 +1444,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1444 if (light) 1444 if (light)
1445 { 1445 {
1446 part.Shape.LightEntry = true; 1446 part.Shape.LightEntry = true;
1447 part.Shape.LightColorR = (float)color.x; 1447 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
1448 part.Shape.LightColorG = (float)color.y; 1448 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
1449 part.Shape.LightColorB = (float)color.z; 1449 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
1450 part.Shape.LightIntensity = intensity; 1450 part.Shape.LightIntensity = intensity;
1451 part.Shape.LightRadius = radius; 1451 part.Shape.LightRadius = radius;
1452 part.Shape.LightFalloff = falloff; 1452 part.Shape.LightFalloff = falloff;
@@ -2866,9 +2866,9 @@ namespace OpenSim.Region.ScriptEngine.Common
2866 if (face > -1) 2866 if (face > -1)
2867 { 2867 {
2868 texcolor = tex.CreateFace((uint)face).RGBA; 2868 texcolor = tex.CreateFace((uint)face).RGBA;
2869 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2869 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2870 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2870 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2871 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2871 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2872 tex.FaceTextures[face].RGBA = texcolor; 2872 tex.FaceTextures[face].RGBA = texcolor;
2873 part.UpdateTexture(tex); 2873 part.UpdateTexture(tex);
2874 return; 2874 return;
@@ -2876,25 +2876,25 @@ namespace OpenSim.Region.ScriptEngine.Common
2876 else if (face == -1) 2876 else if (face == -1)
2877 { 2877 {
2878 texcolor = tex.DefaultTexture.RGBA; 2878 texcolor = tex.DefaultTexture.RGBA;
2879 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2879 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2880 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2880 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2881 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2881 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2882 tex.DefaultTexture.RGBA = texcolor; 2882 tex.DefaultTexture.RGBA = texcolor;
2883 for (uint i = 0; i < 32; i++) 2883 for (uint i = 0; i < 32; i++)
2884 { 2884 {
2885 if (tex.FaceTextures[i] != null) 2885 if (tex.FaceTextures[i] != null)
2886 { 2886 {
2887 texcolor = tex.FaceTextures[i].RGBA; 2887 texcolor = tex.FaceTextures[i].RGBA;
2888 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2888 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2889 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2889 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2890 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2890 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2891 tex.FaceTextures[i].RGBA = texcolor; 2891 tex.FaceTextures[i].RGBA = texcolor;
2892 } 2892 }
2893 } 2893 }
2894 texcolor = tex.DefaultTexture.RGBA; 2894 texcolor = tex.DefaultTexture.RGBA;
2895 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2895 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2896 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2896 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2897 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2897 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2898 tex.DefaultTexture.RGBA = texcolor; 2898 tex.DefaultTexture.RGBA = texcolor;
2899 part.UpdateTexture(tex); 2899 part.UpdateTexture(tex);
2900 return; 2900 return;
@@ -2913,34 +2913,34 @@ namespace OpenSim.Region.ScriptEngine.Common
2913 if (face > -1) 2913 if (face > -1)
2914 { 2914 {
2915 texcolor = tex.CreateFace((uint)face).RGBA; 2915 texcolor = tex.CreateFace((uint)face).RGBA;
2916 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2916 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2917 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2917 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2918 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2918 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2919 tex.FaceTextures[face].RGBA = texcolor; 2919 tex.FaceTextures[face].RGBA = texcolor;
2920 part.UpdateTexture(tex); 2920 part.UpdateTexture(tex);
2921 } 2921 }
2922 else if (face == -1) 2922 else if (face == -1)
2923 { 2923 {
2924 texcolor = tex.DefaultTexture.RGBA; 2924 texcolor = tex.DefaultTexture.RGBA;
2925 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2925 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2926 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2926 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2927 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2927 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2928 tex.DefaultTexture.RGBA = texcolor; 2928 tex.DefaultTexture.RGBA = texcolor;
2929 for (uint i = 0; i < 32; i++) 2929 for (uint i = 0; i < 32; i++)
2930 { 2930 {
2931 if (tex.FaceTextures[i] != null) 2931 if (tex.FaceTextures[i] != null)
2932 { 2932 {
2933 texcolor = tex.FaceTextures[i].RGBA; 2933 texcolor = tex.FaceTextures[i].RGBA;
2934 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2934 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2935 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2935 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2936 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2936 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2937 tex.FaceTextures[i].RGBA = texcolor; 2937 tex.FaceTextures[i].RGBA = texcolor;
2938 } 2938 }
2939 } 2939 }
2940 texcolor = tex.DefaultTexture.RGBA; 2940 texcolor = tex.DefaultTexture.RGBA;
2941 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2941 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2942 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2942 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2943 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2943 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2944 tex.DefaultTexture.RGBA = texcolor; 2944 tex.DefaultTexture.RGBA = texcolor;
2945 part.UpdateTexture(tex); 2945 part.UpdateTexture(tex);
2946 } 2946 }
@@ -3161,8 +3161,10 @@ namespace OpenSim.Region.ScriptEngine.Common
3161 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 3161 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
3162 { 3162 {
3163 m_host.AddScriptLPS(1); 3163 m_host.AddScriptLPS(1);
3164 Vector3 av3 = new Vector3((float)color.x, (float)color.y, (float)color.z); 3164 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
3165 m_host.SetText(text, av3, alpha); 3165 Util.Clip((float)color.y, 0.0f, 1.0f),
3166 Util.Clip((float)color.z, 0.0f, 1.0f));
3167 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
3166 } 3168 }
3167 3169
3168 public double llWater(LSL_Types.Vector3 offset) 3170 public double llWater(LSL_Types.Vector3 offset)
@@ -6154,7 +6156,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6154 if (face > -1) 6156 if (face > -1)
6155 { 6157 {
6156 texcolor = tex.CreateFace((uint)face).RGBA; 6158 texcolor = tex.CreateFace((uint)face).RGBA;
6157 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6159 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6158 tex.FaceTextures[face].RGBA = texcolor; 6160 tex.FaceTextures[face].RGBA = texcolor;
6159 part.UpdateTexture(tex); 6161 part.UpdateTexture(tex);
6160 return; 6162 return;
@@ -6162,19 +6164,19 @@ namespace OpenSim.Region.ScriptEngine.Common
6162 else if (face == -1) 6164 else if (face == -1)
6163 { 6165 {
6164 texcolor = tex.DefaultTexture.RGBA; 6166 texcolor = tex.DefaultTexture.RGBA;
6165 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6167 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6166 tex.DefaultTexture.RGBA = texcolor; 6168 tex.DefaultTexture.RGBA = texcolor;
6167 for (uint i = 0; i < 32; i++) 6169 for (uint i = 0; i < 32; i++)
6168 { 6170 {
6169 if (tex.FaceTextures[i] != null) 6171 if (tex.FaceTextures[i] != null)
6170 { 6172 {
6171 texcolor = tex.FaceTextures[i].RGBA; 6173 texcolor = tex.FaceTextures[i].RGBA;
6172 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6174 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6173 tex.FaceTextures[i].RGBA = texcolor; 6175 tex.FaceTextures[i].RGBA = texcolor;
6174 } 6176 }
6175 } 6177 }
6176 texcolor = tex.DefaultTexture.RGBA; 6178 texcolor = tex.DefaultTexture.RGBA;
6177 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6179 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6178 tex.DefaultTexture.RGBA = texcolor; 6180 tex.DefaultTexture.RGBA = texcolor;
6179 part.UpdateTexture(tex); 6181 part.UpdateTexture(tex);
6180 return; 6182 return;
@@ -6193,26 +6195,26 @@ namespace OpenSim.Region.ScriptEngine.Common
6193 if (face > -1) 6195 if (face > -1)
6194 { 6196 {
6195 texcolor = tex.CreateFace((uint)face).RGBA; 6197 texcolor = tex.CreateFace((uint)face).RGBA;
6196 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6198 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6197 tex.FaceTextures[face].RGBA = texcolor; 6199 tex.FaceTextures[face].RGBA = texcolor;
6198 part.UpdateTexture(tex); 6200 part.UpdateTexture(tex);
6199 } 6201 }
6200 else if (face == -1) 6202 else if (face == -1)
6201 { 6203 {
6202 texcolor = tex.DefaultTexture.RGBA; 6204 texcolor = tex.DefaultTexture.RGBA;
6203 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6205 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6204 tex.DefaultTexture.RGBA = texcolor; 6206 tex.DefaultTexture.RGBA = texcolor;
6205 for (uint i = 0; i < 32; i++) 6207 for (uint i = 0; i < 32; i++)
6206 { 6208 {
6207 if (tex.FaceTextures[i] != null) 6209 if (tex.FaceTextures[i] != null)
6208 { 6210 {
6209 texcolor = tex.FaceTextures[i].RGBA; 6211 texcolor = tex.FaceTextures[i].RGBA;
6210 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6212 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6211 tex.FaceTextures[i].RGBA = texcolor; 6213 tex.FaceTextures[i].RGBA = texcolor;
6212 } 6214 }
6213 } 6215 }
6214 texcolor = tex.DefaultTexture.RGBA; 6216 texcolor = tex.DefaultTexture.RGBA;
6215 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6217 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6216 tex.DefaultTexture.RGBA = texcolor; 6218 tex.DefaultTexture.RGBA = texcolor;
6217 part.UpdateTexture(tex); 6219 part.UpdateTexture(tex);
6218 } 6220 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7a654ce..00f843f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -990,9 +990,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
990 if (face > -1) 990 if (face > -1)
991 { 991 {
992 texcolor = tex.CreateFace((uint)face).RGBA; 992 texcolor = tex.CreateFace((uint)face).RGBA;
993 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 993 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
994 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 994 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
995 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 995 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
996 tex.FaceTextures[face].RGBA = texcolor; 996 tex.FaceTextures[face].RGBA = texcolor;
997 part.UpdateTexture(tex); 997 part.UpdateTexture(tex);
998 return; 998 return;
@@ -1004,15 +1004,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1004 if (tex.FaceTextures[i] != null) 1004 if (tex.FaceTextures[i] != null)
1005 { 1005 {
1006 texcolor = tex.FaceTextures[i].RGBA; 1006 texcolor = tex.FaceTextures[i].RGBA;
1007 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 1007 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1008 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 1008 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1009 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 1009 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1010 tex.FaceTextures[i].RGBA = texcolor; 1010 tex.FaceTextures[i].RGBA = texcolor;
1011 } 1011 }
1012 texcolor = tex.DefaultTexture.RGBA; 1012 texcolor = tex.DefaultTexture.RGBA;
1013 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 1013 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1014 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 1014 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1015 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 1015 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1016 tex.DefaultTexture.RGBA = texcolor; 1016 tex.DefaultTexture.RGBA = texcolor;
1017 } 1017 }
1018 part.UpdateTexture(tex); 1018 part.UpdateTexture(tex);
@@ -1149,7 +1149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1149 if (face > -1) 1149 if (face > -1)
1150 { 1150 {
1151 texcolor = tex.CreateFace((uint)face).RGBA; 1151 texcolor = tex.CreateFace((uint)face).RGBA;
1152 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1152 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1153 tex.FaceTextures[face].RGBA = texcolor; 1153 tex.FaceTextures[face].RGBA = texcolor;
1154 part.UpdateTexture(tex); 1154 part.UpdateTexture(tex);
1155 return; 1155 return;
@@ -1161,12 +1161,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1161 if (tex.FaceTextures[i] != null) 1161 if (tex.FaceTextures[i] != null)
1162 { 1162 {
1163 texcolor = tex.FaceTextures[i].RGBA; 1163 texcolor = tex.FaceTextures[i].RGBA;
1164 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1164 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1165 tex.FaceTextures[i].RGBA = texcolor; 1165 tex.FaceTextures[i].RGBA = texcolor;
1166 } 1166 }
1167 } 1167 }
1168 texcolor = tex.DefaultTexture.RGBA; 1168 texcolor = tex.DefaultTexture.RGBA;
1169 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 1169 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1170 tex.DefaultTexture.RGBA = texcolor; 1170 tex.DefaultTexture.RGBA = texcolor;
1171 part.UpdateTexture(tex); 1171 part.UpdateTexture(tex);
1172 return; 1172 return;
@@ -1253,9 +1253,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1253 if (light) 1253 if (light)
1254 { 1254 {
1255 part.Shape.LightEntry = true; 1255 part.Shape.LightEntry = true;
1256 part.Shape.LightColorR = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 1256 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
1257 part.Shape.LightColorG = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 1257 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
1258 part.Shape.LightColorB = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 1258 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
1259 part.Shape.LightIntensity = intensity; 1259 part.Shape.LightIntensity = intensity;
1260 part.Shape.LightRadius = radius; 1260 part.Shape.LightRadius = radius;
1261 part.Shape.LightFalloff = falloff; 1261 part.Shape.LightFalloff = falloff;
@@ -2710,9 +2710,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2710 if (face > -1) 2710 if (face > -1)
2711 { 2711 {
2712 texcolor = tex.CreateFace((uint)face).RGBA; 2712 texcolor = tex.CreateFace((uint)face).RGBA;
2713 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2713 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2714 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2714 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2715 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2715 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2716 tex.FaceTextures[face].RGBA = texcolor; 2716 tex.FaceTextures[face].RGBA = texcolor;
2717 part.UpdateTexture(tex); 2717 part.UpdateTexture(tex);
2718 return; 2718 return;
@@ -2720,25 +2720,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2720 else if (face == -1) 2720 else if (face == -1)
2721 { 2721 {
2722 texcolor = tex.DefaultTexture.RGBA; 2722 texcolor = tex.DefaultTexture.RGBA;
2723 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2723 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2724 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2724 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2725 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2725 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2726 tex.DefaultTexture.RGBA = texcolor; 2726 tex.DefaultTexture.RGBA = texcolor;
2727 for (uint i = 0; i < 32; i++) 2727 for (uint i = 0; i < 32; i++)
2728 { 2728 {
2729 if (tex.FaceTextures[i] != null) 2729 if (tex.FaceTextures[i] != null)
2730 { 2730 {
2731 texcolor = tex.FaceTextures[i].RGBA; 2731 texcolor = tex.FaceTextures[i].RGBA;
2732 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2732 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2733 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2733 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2734 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2734 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2735 tex.FaceTextures[i].RGBA = texcolor; 2735 tex.FaceTextures[i].RGBA = texcolor;
2736 } 2736 }
2737 } 2737 }
2738 texcolor = tex.DefaultTexture.RGBA; 2738 texcolor = tex.DefaultTexture.RGBA;
2739 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2739 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2740 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2740 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2741 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2741 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2742 tex.DefaultTexture.RGBA = texcolor; 2742 tex.DefaultTexture.RGBA = texcolor;
2743 part.UpdateTexture(tex); 2743 part.UpdateTexture(tex);
2744 return; 2744 return;
@@ -2757,34 +2757,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2757 if (face > -1) 2757 if (face > -1)
2758 { 2758 {
2759 texcolor = tex.CreateFace((uint)face).RGBA; 2759 texcolor = tex.CreateFace((uint)face).RGBA;
2760 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2760 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2761 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2761 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2762 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2762 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2763 tex.FaceTextures[face].RGBA = texcolor; 2763 tex.FaceTextures[face].RGBA = texcolor;
2764 part.UpdateTexture(tex); 2764 part.UpdateTexture(tex);
2765 } 2765 }
2766 else if (face == -1) 2766 else if (face == -1)
2767 { 2767 {
2768 texcolor = tex.DefaultTexture.RGBA; 2768 texcolor = tex.DefaultTexture.RGBA;
2769 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2769 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2770 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2770 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2771 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2771 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2772 tex.DefaultTexture.RGBA = texcolor; 2772 tex.DefaultTexture.RGBA = texcolor;
2773 for (uint i = 0; i < 32; i++) 2773 for (uint i = 0; i < 32; i++)
2774 { 2774 {
2775 if (tex.FaceTextures[i] != null) 2775 if (tex.FaceTextures[i] != null)
2776 { 2776 {
2777 texcolor = tex.FaceTextures[i].RGBA; 2777 texcolor = tex.FaceTextures[i].RGBA;
2778 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2778 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2779 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2779 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2780 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2780 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2781 tex.FaceTextures[i].RGBA = texcolor; 2781 tex.FaceTextures[i].RGBA = texcolor;
2782 } 2782 }
2783 } 2783 }
2784 texcolor = tex.DefaultTexture.RGBA; 2784 texcolor = tex.DefaultTexture.RGBA;
2785 texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); 2785 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
2786 texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); 2786 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
2787 texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); 2787 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
2788 tex.DefaultTexture.RGBA = texcolor; 2788 tex.DefaultTexture.RGBA = texcolor;
2789 part.UpdateTexture(tex); 2789 part.UpdateTexture(tex);
2790 } 2790 }
@@ -2990,8 +2990,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2990 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 2990 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
2991 { 2991 {
2992 m_host.AddScriptLPS(1); 2992 m_host.AddScriptLPS(1);
2993 Vector3 av3 = new Vector3((float)color.x, (float)color.y, (float)color.z); 2993 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
2994 m_host.SetText(text, av3, alpha); 2994 Util.Clip((float)color.y, 0.0f, 1.0f),
2995 Util.Clip((float)color.z, 0.0f, 1.0f));
2996 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
2995 m_host.ParentGroup.HasGroupChanged = true; 2997 m_host.ParentGroup.HasGroupChanged = true;
2996 } 2998 }
2997 2999
@@ -5959,7 +5961,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5959 if (face > -1) 5961 if (face > -1)
5960 { 5962 {
5961 texcolor = tex.CreateFace((uint)face).RGBA; 5963 texcolor = tex.CreateFace((uint)face).RGBA;
5962 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 5964 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
5963 tex.FaceTextures[face].RGBA = texcolor; 5965 tex.FaceTextures[face].RGBA = texcolor;
5964 part.UpdateTexture(tex); 5966 part.UpdateTexture(tex);
5965 return; 5967 return;
@@ -5967,19 +5969,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5967 else if (face == -1) 5969 else if (face == -1)
5968 { 5970 {
5969 texcolor = tex.DefaultTexture.RGBA; 5971 texcolor = tex.DefaultTexture.RGBA;
5970 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 5972 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
5971 tex.DefaultTexture.RGBA = texcolor; 5973 tex.DefaultTexture.RGBA = texcolor;
5972 for (uint i = 0; i < 32; i++) 5974 for (uint i = 0; i < 32; i++)
5973 { 5975 {
5974 if (tex.FaceTextures[i] != null) 5976 if (tex.FaceTextures[i] != null)
5975 { 5977 {
5976 texcolor = tex.FaceTextures[i].RGBA; 5978 texcolor = tex.FaceTextures[i].RGBA;
5977 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 5979 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
5978 tex.FaceTextures[i].RGBA = texcolor; 5980 tex.FaceTextures[i].RGBA = texcolor;
5979 } 5981 }
5980 } 5982 }
5981 texcolor = tex.DefaultTexture.RGBA; 5983 texcolor = tex.DefaultTexture.RGBA;
5982 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 5984 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
5983 tex.DefaultTexture.RGBA = texcolor; 5985 tex.DefaultTexture.RGBA = texcolor;
5984 part.UpdateTexture(tex); 5986 part.UpdateTexture(tex);
5985 return; 5987 return;
@@ -5998,26 +6000,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5998 if (face > -1) 6000 if (face > -1)
5999 { 6001 {
6000 texcolor = tex.CreateFace((uint)face).RGBA; 6002 texcolor = tex.CreateFace((uint)face).RGBA;
6001 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6003 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6002 tex.FaceTextures[face].RGBA = texcolor; 6004 tex.FaceTextures[face].RGBA = texcolor;
6003 part.UpdateTexture(tex); 6005 part.UpdateTexture(tex);
6004 } 6006 }
6005 else if (face == -1) 6007 else if (face == -1)
6006 { 6008 {
6007 texcolor = tex.DefaultTexture.RGBA; 6009 texcolor = tex.DefaultTexture.RGBA;
6008 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6010 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6009 tex.DefaultTexture.RGBA = texcolor; 6011 tex.DefaultTexture.RGBA = texcolor;
6010 for (uint i = 0; i < 32; i++) 6012 for (uint i = 0; i < 32; i++)
6011 { 6013 {
6012 if (tex.FaceTextures[i] != null) 6014 if (tex.FaceTextures[i] != null)
6013 { 6015 {
6014 texcolor = tex.FaceTextures[i].RGBA; 6016 texcolor = tex.FaceTextures[i].RGBA;
6015 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6017 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6016 tex.FaceTextures[i].RGBA = texcolor; 6018 tex.FaceTextures[i].RGBA = texcolor;
6017 } 6019 }
6018 } 6020 }
6019 texcolor = tex.DefaultTexture.RGBA; 6021 texcolor = tex.DefaultTexture.RGBA;
6020 texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); 6022 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6021 tex.DefaultTexture.RGBA = texcolor; 6023 tex.DefaultTexture.RGBA = texcolor;
6022 part.UpdateTexture(tex); 6024 part.UpdateTexture(tex);
6023 } 6025 }