diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 098b2d9..2a9ee3a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2851,62 +2851,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | /// <summary> | 2853 | /// <summary> |
2854 | /// Set the color of prim faces | ||
2855 | /// </summary> | ||
2856 | /// <param name="color"></param> | ||
2857 | /// <param name="face"></param> | ||
2858 | public void SetFaceColor(Vector3 color, int face) | ||
2859 | { | ||
2860 | Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); | ||
2861 | |||
2862 | // The only way to get a deep copy/ If we don't do this, we can | ||
2863 | // never detect color changes further down. | ||
2864 | Byte[] buf = Shape.Textures.GetBytes(); | ||
2865 | Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); | ||
2866 | Color4 texcolor; | ||
2867 | if (face >= 0 && face < GetNumberOfSides()) | ||
2868 | { | ||
2869 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
2870 | texcolor.R = clippedColor.X; | ||
2871 | texcolor.G = clippedColor.Y; | ||
2872 | texcolor.B = clippedColor.Z; | ||
2873 | tex.FaceTextures[face].RGBA = texcolor; | ||
2874 | UpdateTextureEntry(tex.GetBytes()); | ||
2875 | return; | ||
2876 | } | ||
2877 | else if (face == ALL_SIDES) | ||
2878 | { | ||
2879 | for (uint i = 0; i < GetNumberOfSides(); i++) | ||
2880 | { | ||
2881 | if (tex.FaceTextures[i] != null) | ||
2882 | { | ||
2883 | texcolor = tex.FaceTextures[i].RGBA; | ||
2884 | texcolor.R = clippedColor.X; | ||
2885 | texcolor.G = clippedColor.Y; | ||
2886 | texcolor.B = clippedColor.Z; | ||
2887 | tex.FaceTextures[i].RGBA = texcolor; | ||
2888 | } | ||
2889 | texcolor = tex.DefaultTexture.RGBA; | ||
2890 | texcolor.R = clippedColor.X; | ||
2891 | texcolor.G = clippedColor.Y; | ||
2892 | texcolor.B = clippedColor.Z; | ||
2893 | tex.DefaultTexture.RGBA = texcolor; | ||
2894 | } | ||
2895 | UpdateTextureEntry(tex.GetBytes()); | ||
2896 | return; | ||
2897 | } | ||
2898 | } | ||
2899 | |||
2900 | /// <summary> | ||
2901 | /// Set the color & alpha of prim faces | 2854 | /// Set the color & alpha of prim faces |
2902 | /// </summary> | 2855 | /// </summary> |
2903 | /// <param name="face"></param> | 2856 | /// <param name="face"></param> |
2904 | /// <param name="color"></param> | 2857 | /// <param name="color"></param> |
2905 | /// <param name="alpha"></param> | 2858 | /// <param name="alpha"></param> |
2906 | public void SetFaceColorAlpha(int face, Vector3 color, double alpha) | 2859 | public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha) |
2907 | { | 2860 | { |
2908 | Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); | 2861 | Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); |
2909 | float clippedAlpha = Util.Clip((float)alpha, 0.0f, 1.0f); | 2862 | float clippedAlpha = alpha.HasValue ? |
2863 | Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0; | ||
2910 | 2864 | ||
2911 | // The only way to get a deep copy/ If we don't do this, we can | 2865 | // The only way to get a deep copy/ If we don't do this, we can |
2912 | // never detect color changes further down. | 2866 | // never detect color changes further down. |
@@ -2919,7 +2873,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2919 | texcolor.R = clippedColor.X; | 2873 | texcolor.R = clippedColor.X; |
2920 | texcolor.G = clippedColor.Y; | 2874 | texcolor.G = clippedColor.Y; |
2921 | texcolor.B = clippedColor.Z; | 2875 | texcolor.B = clippedColor.Z; |
2922 | texcolor.A = clippedAlpha; | 2876 | if (alpha.HasValue) |
2877 | { | ||
2878 | texcolor.A = clippedAlpha; | ||
2879 | } | ||
2923 | tex.FaceTextures[face].RGBA = texcolor; | 2880 | tex.FaceTextures[face].RGBA = texcolor; |
2924 | UpdateTextureEntry(tex.GetBytes()); | 2881 | UpdateTextureEntry(tex.GetBytes()); |
2925 | return; | 2882 | return; |
@@ -2934,14 +2891,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2934 | texcolor.R = clippedColor.X; | 2891 | texcolor.R = clippedColor.X; |
2935 | texcolor.G = clippedColor.Y; | 2892 | texcolor.G = clippedColor.Y; |
2936 | texcolor.B = clippedColor.Z; | 2893 | texcolor.B = clippedColor.Z; |
2937 | texcolor.A = clippedAlpha; | 2894 | if (alpha.HasValue) |
2895 | { | ||
2896 | texcolor.A = clippedAlpha; | ||
2897 | } | ||
2938 | tex.FaceTextures[i].RGBA = texcolor; | 2898 | tex.FaceTextures[i].RGBA = texcolor; |
2939 | } | 2899 | } |
2940 | texcolor = tex.DefaultTexture.RGBA; | 2900 | texcolor = tex.DefaultTexture.RGBA; |
2941 | texcolor.R = clippedColor.X; | 2901 | texcolor.R = clippedColor.X; |
2942 | texcolor.G = clippedColor.Y; | 2902 | texcolor.G = clippedColor.Y; |
2943 | texcolor.B = clippedColor.Z; | 2903 | texcolor.B = clippedColor.Z; |
2944 | texcolor.A = clippedAlpha; | 2904 | if (alpha.HasValue) |
2905 | { | ||
2906 | texcolor.A = clippedAlpha; | ||
2907 | } | ||
2945 | tex.DefaultTexture.RGBA = texcolor; | 2908 | tex.DefaultTexture.RGBA = texcolor; |
2946 | } | 2909 | } |
2947 | UpdateTextureEntry(tex.GetBytes()); | 2910 | UpdateTextureEntry(tex.GetBytes()); |