aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSignpostMarv2012-08-17 15:09:52 +0100
committerJustin Clark-Casey (justincc)2012-08-20 23:10:25 +0100
commitb863a15a820be7c3b86b27ef24944d6a85fa5360 (patch)
tree864d4a4bee8a22d81bb091dbd642ff0930baf9ec
parentfix typo (diff)
downloadopensim-SC_OLD-b863a15a820be7c3b86b27ef24944d6a85fa5360.zip
opensim-SC_OLD-b863a15a820be7c3b86b27ef24944d6a85fa5360.tar.gz
opensim-SC_OLD-b863a15a820be7c3b86b27ef24944d6a85fa5360.tar.bz2
opensim-SC_OLD-b863a15a820be7c3b86b27ef24944d6a85fa5360.tar.xz
single operation for PRIM_COLOR
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
2 files changed, 50 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0535dcb..6741e5e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2896,6 +2896,55 @@ namespace OpenSim.Region.Framework.Scenes
2896 } 2896 }
2897 2897
2898 /// <summary> 2898 /// <summary>
2899 /// Set the color & alpha of prim faces
2900 /// </summary>
2901 /// <param name="face"></param>
2902 /// <param name="color"></param>
2903 /// <param name="alpha"></param>
2904 public void SetFaceColorAlpha(int face, Vector3 color, double alpha)
2905 {
2906 // The only way to get a deep copy/ If we don't do this, we can
2907 // never detect color changes further down.
2908 Byte[] buf = Shape.Textures.GetBytes();
2909 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
2910 Color4 texcolor;
2911 if (face >= 0 && face < GetNumberOfSides())
2912 {
2913 texcolor = tex.CreateFace((uint)face).RGBA;
2914 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
2915 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
2916 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
2917 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2918 tex.FaceTextures[face].RGBA = texcolor;
2919 UpdateTextureEntry(tex.GetBytes());
2920 return;
2921 }
2922 else if (face == ALL_SIDES)
2923 {
2924 for (uint i = 0; i < GetNumberOfSides(); i++)
2925 {
2926 if (tex.FaceTextures[i] != null)
2927 {
2928 texcolor = tex.FaceTextures[i].RGBA;
2929 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
2930 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
2931 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
2932 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2933 tex.FaceTextures[i].RGBA = texcolor;
2934 }
2935 texcolor = tex.DefaultTexture.RGBA;
2936 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
2937 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
2938 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
2939 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
2940 tex.DefaultTexture.RGBA = texcolor;
2941 }
2942 UpdateTextureEntry(tex.GetBytes());
2943 return;
2944 }
2945 }
2946
2947 /// <summary>
2899 /// Get the number of sides that this part has. 2948 /// Get the number of sides that this part has.
2900 /// </summary> 2949 /// </summary>
2901 /// <returns></returns> 2950 /// <returns></returns>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4645e7a..dbbfbd3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7484,8 +7484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7484 LSL_Vector color=rules.GetVector3Item(idx++); 7484 LSL_Vector color=rules.GetVector3Item(idx++);
7485 double alpha=(double)rules.GetLSLFloatItem(idx++); 7485 double alpha=(double)rules.GetLSLFloatItem(idx++);
7486 7486
7487 part.SetFaceColor(color, face); 7487 part.SetFaceColorAlpha(face, new Vector3((float)color.x, (float)color.y, (float)color.z), alpha);
7488 SetAlpha(part, alpha, face);
7489 7488
7490 break; 7489 break;
7491 7490