diff options
author | Homer Horwitz | 2008-09-13 22:48:30 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-09-13 22:48:30 +0000 |
commit | 37e6ce24a2060a7d943b45c8015576f016021e5e (patch) | |
tree | 7f911c0248cb8e5bc92f3f9870de35cb6139956d /OpenSim/Region | |
parent | * Adds regiondata and estatedata persistence in Sqlite. This commit is actu... (diff) | |
download | opensim-SC-37e6ce24a2060a7d943b45c8015576f016021e5e.zip opensim-SC-37e6ce24a2060a7d943b45c8015576f016021e5e.tar.gz opensim-SC-37e6ce24a2060a7d943b45c8015576f016021e5e.tar.bz2 opensim-SC-37e6ce24a2060a7d943b45c8015576f016021e5e.tar.xz |
Fixed several cases of inverted colors and alpha in DNE and XEngine.
Added clamping to 0.0 - 1.0 for R, G, B, and A.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 70 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 70 |
2 files changed, 70 insertions, 70 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index f2add80..1090c42 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -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.Abs(alpha - 1); | 1343 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
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.Abs(alpha - 1); | 1355 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
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.Abs(alpha - 1); | 1360 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
1361 | tex.DefaultTexture.RGBA = texcolor; | 1361 | tex.DefaultTexture.RGBA = texcolor; |
1362 | part.UpdateTexture(tex); | 1362 | part.UpdateTexture(tex); |
1363 | return; | 1363 | return; |
@@ -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.Abs(color.x - 1); | 2869 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2870 | texcolor.G = (float)Math.Abs(color.y - 1); | 2870 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2871 | texcolor.B = (float)Math.Abs(color.z - 1); | 2871 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2879 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2880 | texcolor.G = (float)Math.Abs(color.y - 1); | 2880 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2881 | texcolor.B = (float)Math.Abs(color.z - 1); | 2881 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2888 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2889 | texcolor.G = (float)Math.Abs(color.y - 1); | 2889 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2890 | texcolor.B = (float)Math.Abs(color.z - 1); | 2890 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2895 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2896 | texcolor.G = (float)Math.Abs(color.y - 1); | 2896 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2897 | texcolor.B = (float)Math.Abs(color.z - 1); | 2897 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2916 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2917 | texcolor.G = (float)Math.Abs(color.y - 1); | 2917 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2918 | texcolor.B = (float)Math.Abs(color.z - 1); | 2918 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2925 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2926 | texcolor.G = (float)Math.Abs(color.y - 1); | 2926 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2927 | texcolor.B = (float)Math.Abs(color.z - 1); | 2927 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2934 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2935 | texcolor.G = (float)Math.Abs(color.y - 1); | 2935 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2936 | texcolor.B = (float)Math.Abs(color.z - 1); | 2936 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2941 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2942 | texcolor.G = (float)Math.Abs(color.y - 1); | 2942 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2943 | texcolor.B = (float)Math.Abs(color.z - 1); | 2943 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
2944 | tex.DefaultTexture.RGBA = texcolor; | 2944 | tex.DefaultTexture.RGBA = texcolor; |
2945 | part.UpdateTexture(tex); | 2945 | part.UpdateTexture(tex); |
2946 | } | 2946 | } |
@@ -6154,7 +6154,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6154 | if (face > -1) | 6154 | if (face > -1) |
6155 | { | 6155 | { |
6156 | texcolor = tex.CreateFace((uint)face).RGBA; | 6156 | texcolor = tex.CreateFace((uint)face).RGBA; |
6157 | texcolor.A = (float)Math.Abs(alpha - 1); | 6157 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6158 | tex.FaceTextures[face].RGBA = texcolor; | 6158 | tex.FaceTextures[face].RGBA = texcolor; |
6159 | part.UpdateTexture(tex); | 6159 | part.UpdateTexture(tex); |
6160 | return; | 6160 | return; |
@@ -6162,19 +6162,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6162 | else if (face == -1) | 6162 | else if (face == -1) |
6163 | { | 6163 | { |
6164 | texcolor = tex.DefaultTexture.RGBA; | 6164 | texcolor = tex.DefaultTexture.RGBA; |
6165 | texcolor.A = (float)Math.Abs(alpha - 1); | 6165 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6166 | tex.DefaultTexture.RGBA = texcolor; | 6166 | tex.DefaultTexture.RGBA = texcolor; |
6167 | for (uint i = 0; i < 32; i++) | 6167 | for (uint i = 0; i < 32; i++) |
6168 | { | 6168 | { |
6169 | if (tex.FaceTextures[i] != null) | 6169 | if (tex.FaceTextures[i] != null) |
6170 | { | 6170 | { |
6171 | texcolor = tex.FaceTextures[i].RGBA; | 6171 | texcolor = tex.FaceTextures[i].RGBA; |
6172 | texcolor.A = (float)Math.Abs(alpha - 1); | 6172 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6173 | tex.FaceTextures[i].RGBA = texcolor; | 6173 | tex.FaceTextures[i].RGBA = texcolor; |
6174 | } | 6174 | } |
6175 | } | 6175 | } |
6176 | texcolor = tex.DefaultTexture.RGBA; | 6176 | texcolor = tex.DefaultTexture.RGBA; |
6177 | texcolor.A = (float)Math.Abs(alpha - 1); | 6177 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6178 | tex.DefaultTexture.RGBA = texcolor; | 6178 | tex.DefaultTexture.RGBA = texcolor; |
6179 | part.UpdateTexture(tex); | 6179 | part.UpdateTexture(tex); |
6180 | return; | 6180 | return; |
@@ -6193,26 +6193,26 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6193 | if (face > -1) | 6193 | if (face > -1) |
6194 | { | 6194 | { |
6195 | texcolor = tex.CreateFace((uint)face).RGBA; | 6195 | texcolor = tex.CreateFace((uint)face).RGBA; |
6196 | texcolor.A = (float)Math.Abs(alpha - 1); | 6196 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6197 | tex.FaceTextures[face].RGBA = texcolor; | 6197 | tex.FaceTextures[face].RGBA = texcolor; |
6198 | part.UpdateTexture(tex); | 6198 | part.UpdateTexture(tex); |
6199 | } | 6199 | } |
6200 | else if (face == -1) | 6200 | else if (face == -1) |
6201 | { | 6201 | { |
6202 | texcolor = tex.DefaultTexture.RGBA; | 6202 | texcolor = tex.DefaultTexture.RGBA; |
6203 | texcolor.A = (float)Math.Abs(alpha - 1); | 6203 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6204 | tex.DefaultTexture.RGBA = texcolor; | 6204 | tex.DefaultTexture.RGBA = texcolor; |
6205 | for (uint i = 0; i < 32; i++) | 6205 | for (uint i = 0; i < 32; i++) |
6206 | { | 6206 | { |
6207 | if (tex.FaceTextures[i] != null) | 6207 | if (tex.FaceTextures[i] != null) |
6208 | { | 6208 | { |
6209 | texcolor = tex.FaceTextures[i].RGBA; | 6209 | texcolor = tex.FaceTextures[i].RGBA; |
6210 | texcolor.A = (float)Math.Abs(alpha - 1); | 6210 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6211 | tex.FaceTextures[i].RGBA = texcolor; | 6211 | tex.FaceTextures[i].RGBA = texcolor; |
6212 | } | 6212 | } |
6213 | } | 6213 | } |
6214 | texcolor = tex.DefaultTexture.RGBA; | 6214 | texcolor = tex.DefaultTexture.RGBA; |
6215 | texcolor.A = (float)Math.Abs(alpha - 1); | 6215 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6216 | tex.DefaultTexture.RGBA = texcolor; | 6216 | tex.DefaultTexture.RGBA = texcolor; |
6217 | part.UpdateTexture(tex); | 6217 | part.UpdateTexture(tex); |
6218 | } | 6218 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b27aa07..24f19a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -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.Abs(alpha); | 1152 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
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.Abs(alpha); | 1164 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
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.Abs(alpha); | 1169 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
1170 | tex.DefaultTexture.RGBA = texcolor; | 1170 | tex.DefaultTexture.RGBA = texcolor; |
1171 | part.UpdateTexture(tex); | 1171 | part.UpdateTexture(tex); |
1172 | return; | 1172 | return; |
@@ -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.Abs(color.x - 1); | 2713 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2714 | texcolor.G = (float)Math.Abs(color.y - 1); | 2714 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2715 | texcolor.B = (float)Math.Abs(color.z - 1); | 2715 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2723 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2724 | texcolor.G = (float)Math.Abs(color.y - 1); | 2724 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2725 | texcolor.B = (float)Math.Abs(color.z - 1); | 2725 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2732 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2733 | texcolor.G = (float)Math.Abs(color.y - 1); | 2733 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2734 | texcolor.B = (float)Math.Abs(color.z - 1); | 2734 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2739 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2740 | texcolor.G = (float)Math.Abs(color.y - 1); | 2740 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2741 | texcolor.B = (float)Math.Abs(color.z - 1); | 2741 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2760 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2761 | texcolor.G = (float)Math.Abs(color.y - 1); | 2761 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2762 | texcolor.B = (float)Math.Abs(color.z - 1); | 2762 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2769 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2770 | texcolor.G = (float)Math.Abs(color.y - 1); | 2770 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2771 | texcolor.B = (float)Math.Abs(color.z - 1); | 2771 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2778 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2779 | texcolor.G = (float)Math.Abs(color.y - 1); | 2779 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2780 | texcolor.B = (float)Math.Abs(color.z - 1); | 2780 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
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.Abs(color.x - 1); | 2785 | texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0); |
2786 | texcolor.G = (float)Math.Abs(color.y - 1); | 2786 | texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0); |
2787 | texcolor.B = (float)Math.Abs(color.z - 1); | 2787 | texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0); |
2788 | tex.DefaultTexture.RGBA = texcolor; | 2788 | tex.DefaultTexture.RGBA = texcolor; |
2789 | part.UpdateTexture(tex); | 2789 | part.UpdateTexture(tex); |
2790 | } | 2790 | } |
@@ -5959,7 +5959,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5959 | if (face > -1) | 5959 | if (face > -1) |
5960 | { | 5960 | { |
5961 | texcolor = tex.CreateFace((uint)face).RGBA; | 5961 | texcolor = tex.CreateFace((uint)face).RGBA; |
5962 | texcolor.A = (float)Math.Abs(alpha - 1); | 5962 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
5963 | tex.FaceTextures[face].RGBA = texcolor; | 5963 | tex.FaceTextures[face].RGBA = texcolor; |
5964 | part.UpdateTexture(tex); | 5964 | part.UpdateTexture(tex); |
5965 | return; | 5965 | return; |
@@ -5967,19 +5967,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5967 | else if (face == -1) | 5967 | else if (face == -1) |
5968 | { | 5968 | { |
5969 | texcolor = tex.DefaultTexture.RGBA; | 5969 | texcolor = tex.DefaultTexture.RGBA; |
5970 | texcolor.A = (float)Math.Abs(alpha - 1); | 5970 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
5971 | tex.DefaultTexture.RGBA = texcolor; | 5971 | tex.DefaultTexture.RGBA = texcolor; |
5972 | for (uint i = 0; i < 32; i++) | 5972 | for (uint i = 0; i < 32; i++) |
5973 | { | 5973 | { |
5974 | if (tex.FaceTextures[i] != null) | 5974 | if (tex.FaceTextures[i] != null) |
5975 | { | 5975 | { |
5976 | texcolor = tex.FaceTextures[i].RGBA; | 5976 | texcolor = tex.FaceTextures[i].RGBA; |
5977 | texcolor.A = (float)Math.Abs(alpha - 1); | 5977 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
5978 | tex.FaceTextures[i].RGBA = texcolor; | 5978 | tex.FaceTextures[i].RGBA = texcolor; |
5979 | } | 5979 | } |
5980 | } | 5980 | } |
5981 | texcolor = tex.DefaultTexture.RGBA; | 5981 | texcolor = tex.DefaultTexture.RGBA; |
5982 | texcolor.A = (float)Math.Abs(alpha - 1); | 5982 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
5983 | tex.DefaultTexture.RGBA = texcolor; | 5983 | tex.DefaultTexture.RGBA = texcolor; |
5984 | part.UpdateTexture(tex); | 5984 | part.UpdateTexture(tex); |
5985 | return; | 5985 | return; |
@@ -5998,26 +5998,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5998 | if (face > -1) | 5998 | if (face > -1) |
5999 | { | 5999 | { |
6000 | texcolor = tex.CreateFace((uint)face).RGBA; | 6000 | texcolor = tex.CreateFace((uint)face).RGBA; |
6001 | texcolor.A = (float)Math.Abs(alpha - 1); | 6001 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6002 | tex.FaceTextures[face].RGBA = texcolor; | 6002 | tex.FaceTextures[face].RGBA = texcolor; |
6003 | part.UpdateTexture(tex); | 6003 | part.UpdateTexture(tex); |
6004 | } | 6004 | } |
6005 | else if (face == -1) | 6005 | else if (face == -1) |
6006 | { | 6006 | { |
6007 | texcolor = tex.DefaultTexture.RGBA; | 6007 | texcolor = tex.DefaultTexture.RGBA; |
6008 | texcolor.A = (float)Math.Abs(alpha - 1); | 6008 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6009 | tex.DefaultTexture.RGBA = texcolor; | 6009 | tex.DefaultTexture.RGBA = texcolor; |
6010 | for (uint i = 0; i < 32; i++) | 6010 | for (uint i = 0; i < 32; i++) |
6011 | { | 6011 | { |
6012 | if (tex.FaceTextures[i] != null) | 6012 | if (tex.FaceTextures[i] != null) |
6013 | { | 6013 | { |
6014 | texcolor = tex.FaceTextures[i].RGBA; | 6014 | texcolor = tex.FaceTextures[i].RGBA; |
6015 | texcolor.A = (float)Math.Abs(alpha - 1); | 6015 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6016 | tex.FaceTextures[i].RGBA = texcolor; | 6016 | tex.FaceTextures[i].RGBA = texcolor; |
6017 | } | 6017 | } |
6018 | } | 6018 | } |
6019 | texcolor = tex.DefaultTexture.RGBA; | 6019 | texcolor = tex.DefaultTexture.RGBA; |
6020 | texcolor.A = (float)Math.Abs(alpha - 1); | 6020 | texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0); |
6021 | tex.DefaultTexture.RGBA = texcolor; | 6021 | tex.DefaultTexture.RGBA = texcolor; |
6022 | part.UpdateTexture(tex); | 6022 | part.UpdateTexture(tex); |
6023 | } | 6023 | } |