diff options
author | Melanie Thielker | 2008-09-08 18:15:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-08 18:15:36 +0000 |
commit | e7abde70a211d17ebfbae5e3ff379338a649f567 (patch) | |
tree | ac79095cce47bbfeebbfdd66856541af77bbb13c /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | * some if inversions and added {}'s for readability (diff) | |
download | opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.zip opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.gz opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.bz2 opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.xz |
Mantis #2147
Thank you, ralphos, for a patch the adapts llSetColor and friends to
a change in the underlying types.
Also, thank you for a much cleaner way of casting types out of
lists, which I will adopt throughout.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0cc8279..bc58a8a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1001,9 +1001,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1001 | if (face > -1) | 1001 | if (face > -1) |
1002 | { | 1002 | { |
1003 | texcolor = tex.CreateFace((uint)face).RGBA; | 1003 | texcolor = tex.CreateFace((uint)face).RGBA; |
1004 | texcolor.R = (float)Math.Abs(color.x - 1); | 1004 | texcolor.R = (float)color.x; |
1005 | texcolor.G = (float)Math.Abs(color.y - 1); | 1005 | texcolor.G = (float)color.y; |
1006 | texcolor.B = (float)Math.Abs(color.z - 1); | 1006 | texcolor.B = (float)color.z; |
1007 | tex.FaceTextures[face].RGBA = texcolor; | 1007 | tex.FaceTextures[face].RGBA = texcolor; |
1008 | part.UpdateTexture(tex); | 1008 | part.UpdateTexture(tex); |
1009 | return; | 1009 | return; |
@@ -1015,15 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1015 | if (tex.FaceTextures[i] != null) | 1015 | if (tex.FaceTextures[i] != null) |
1016 | { | 1016 | { |
1017 | texcolor = tex.FaceTextures[i].RGBA; | 1017 | texcolor = tex.FaceTextures[i].RGBA; |
1018 | texcolor.R = (float)Math.Abs(color.x - 1); | 1018 | texcolor.R = (float)color.x; |
1019 | texcolor.G = (float)Math.Abs(color.y - 1); | 1019 | texcolor.G = (float)color.y; |
1020 | texcolor.B = (float)Math.Abs(color.z - 1); | 1020 | texcolor.B = (float)color.z; |
1021 | tex.FaceTextures[i].RGBA = texcolor; | 1021 | tex.FaceTextures[i].RGBA = texcolor; |
1022 | } | 1022 | } |
1023 | texcolor = tex.DefaultTexture.RGBA; | 1023 | texcolor = tex.DefaultTexture.RGBA; |
1024 | texcolor.R = (float)Math.Abs(color.x - 1); | 1024 | texcolor.R = (float)color.x; |
1025 | texcolor.G = (float)Math.Abs(color.y - 1); | 1025 | texcolor.G = (float)color.y; |
1026 | texcolor.B = (float)Math.Abs(color.z - 1); | 1026 | texcolor.B = (float)color.z; |
1027 | tex.DefaultTexture.RGBA = texcolor; | 1027 | tex.DefaultTexture.RGBA = texcolor; |
1028 | } | 1028 | } |
1029 | part.UpdateTexture(tex); | 1029 | part.UpdateTexture(tex); |
@@ -5783,11 +5783,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5783 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 5783 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
5784 | if (remain < 5) | 5784 | if (remain < 5) |
5785 | return; | 5785 | return; |
5786 | LSL_Types.LSLInteger light = new LSL_Types.LSLInteger(rules.Data[idx++].ToString()); | 5786 | bool light = rules.GetLSLIntegerItem(idx++); |
5787 | LSL_Types.Vector3 lightcolor = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5787 | LSL_Types.Vector3 lightcolor = rules.GetVector3Item(idx++); |
5788 | float intensity = (float)Convert.ToDouble(rules.Data[idx++].ToString()); | 5788 | float intensity = (float)rules.GetLSLFloatItem(idx++); |
5789 | float radius = (float)Convert.ToDouble(rules.Data[idx++].ToString()); | 5789 | float radius = (float)rules.GetLSLFloatItem(idx++); |
5790 | float falloff = (float)Convert.ToDouble(rules.Data[idx++].ToString()); | 5790 | float falloff = (float)rules.GetLSLFloatItem(idx++); |
5791 | 5791 | ||
5792 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); | 5792 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); |
5793 | 5793 | ||
@@ -5795,8 +5795,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5795 | case (int)ScriptBaseClass.PRIM_GLOW: | 5795 | case (int)ScriptBaseClass.PRIM_GLOW: |
5796 | if (remain < 2) | 5796 | if (remain < 2) |
5797 | return; | 5797 | return; |
5798 | // TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list | ||
5799 | // as a raw CLI Int32. When / if this is inserted as an | ||
5800 | // LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem | ||
5801 | // face = rules.GetLSLIntegerItem(idx++); | ||
5798 | face = Convert.ToInt32(rules.Data[idx++].ToString()); | 5802 | face = Convert.ToInt32(rules.Data[idx++].ToString()); |
5799 | float glow = (float)Convert.ToDouble(rules.Data[idx++].ToString()); | 5803 | float glow = (float)rules.GetLSLFloatItem(idx++); |
5800 | 5804 | ||
5801 | SetGlow(part, face, glow); | 5805 | SetGlow(part, face, glow); |
5802 | 5806 | ||
@@ -5814,14 +5818,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5814 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 5818 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
5815 | if (remain < 2) | 5819 | if (remain < 2) |
5816 | return; | 5820 | return; |
5821 | // TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list | ||
5822 | // as a raw CLI Int32. When / if this is inserted as an | ||
5823 | // LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem | ||
5824 | // face = rules.GetLSLIntegerItem(idx++); | ||
5817 | face = Convert.ToInt32(rules.Data[idx++].ToString()); | 5825 | face = Convert.ToInt32(rules.Data[idx++].ToString()); |
5818 | string bv = rules.Data[idx++].ToString(); | 5826 | bool st = rules.GetLSLIntegerItem(idx++); |
5819 | bool st; | ||
5820 | if (bv.Equals("1")) | ||
5821 | st = true; | ||
5822 | else | ||
5823 | st = false; | ||
5824 | |||
5825 | SetFullBright(part, face , st); | 5827 | SetFullBright(part, face , st); |
5826 | break; | 5828 | break; |
5827 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 5829 | case (int)ScriptBaseClass.PRIM_MATERIAL: |