diff options
author | Melanie Thielker | 2008-09-14 15:18:58 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-14 15:18:58 +0000 |
commit | de44f765e35b314226e18e5c9fae98050cd496aa (patch) | |
tree | b24935e41d1d520785673045dff73507df14ef34 | |
parent | MessageServer gets the agent position (positionx/y/z) as float, not as int in (diff) | |
download | opensim-SC-de44f765e35b314226e18e5c9fae98050cd496aa.zip opensim-SC-de44f765e35b314226e18e5c9fae98050cd496aa.tar.gz opensim-SC-de44f765e35b314226e18e5c9fae98050cd496aa.tar.bz2 opensim-SC-de44f765e35b314226e18e5c9fae98050cd496aa.tar.xz |
Mantis #2186
Prevent illegal color values from being set.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 24f19a0..7a654ce 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)color.x; | 993 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
994 | texcolor.G = (float)color.y; | 994 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
995 | texcolor.B = (float)color.z; | 995 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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)color.x; | 1007 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
1008 | texcolor.G = (float)color.y; | 1008 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
1009 | texcolor.B = (float)color.z; | 1009 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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)color.x; | 1013 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
1014 | texcolor.G = (float)color.y; | 1014 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
1015 | texcolor.B = (float)color.z; | 1015 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
1016 | tex.DefaultTexture.RGBA = texcolor; | 1016 | tex.DefaultTexture.RGBA = texcolor; |
1017 | } | 1017 | } |
1018 | part.UpdateTexture(tex); | 1018 | part.UpdateTexture(tex); |
@@ -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)color.x; | 1256 | part.Shape.LightColorR = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
1257 | part.Shape.LightColorG = (float)color.y; | 1257 | part.Shape.LightColorG = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
1258 | part.Shape.LightColorB = (float)color.z; | 1258 | part.Shape.LightColorB = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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; |