aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs43
1 files changed, 30 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 593e1d3..af06250 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3560,23 +3560,32 @@ namespace OpenSim.Region.Framework.Scenes
3560 } 3560 }
3561 3561
3562 /// <summary> 3562 /// <summary>
3563 /// Set the color of prim faces 3563 /// Set the color & alpha of prim faces
3564 /// </summary> 3564 /// </summary>
3565 /// <param name="color"></param>
3566 /// <param name="face"></param> 3565 /// <param name="face"></param>
3567 public void SetFaceColor(Vector3 color, int face) 3566 /// <param name="color"></param>
3567 /// <param name="alpha"></param>
3568 public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha)
3568 { 3569 {
3570 Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
3571 float clippedAlpha = alpha.HasValue ?
3572 Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0;
3573
3569 // The only way to get a deep copy/ If we don't do this, we can 3574 // The only way to get a deep copy/ If we don't do this, we can
3570 // mever detect color changes further down. 3575 // never detect color changes further down.
3571 Byte[] buf = Shape.Textures.GetBytes(); 3576 Byte[] buf = Shape.Textures.GetBytes();
3572 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); 3577 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
3573 Color4 texcolor; 3578 Color4 texcolor;
3574 if (face >= 0 && face < GetNumberOfSides()) 3579 if (face >= 0 && face < GetNumberOfSides())
3575 { 3580 {
3576 texcolor = tex.CreateFace((uint)face).RGBA; 3581 texcolor = tex.CreateFace((uint)face).RGBA;
3577 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3582 texcolor.R = clippedColor.X;
3578 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3583 texcolor.G = clippedColor.Y;
3579 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3584 texcolor.B = clippedColor.Z;
3585 if (alpha.HasValue)
3586 {
3587 texcolor.A = clippedAlpha;
3588 }
3580 tex.FaceTextures[face].RGBA = texcolor; 3589 tex.FaceTextures[face].RGBA = texcolor;
3581 UpdateTextureEntry(tex.GetBytes()); 3590 UpdateTextureEntry(tex.GetBytes());
3582 return; 3591 return;
@@ -3588,15 +3597,23 @@ namespace OpenSim.Region.Framework.Scenes
3588 if (tex.FaceTextures[i] != null) 3597 if (tex.FaceTextures[i] != null)
3589 { 3598 {
3590 texcolor = tex.FaceTextures[i].RGBA; 3599 texcolor = tex.FaceTextures[i].RGBA;
3591 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3600 texcolor.R = clippedColor.X;
3592 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3601 texcolor.G = clippedColor.Y;
3593 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3602 texcolor.B = clippedColor.Z;
3603 if (alpha.HasValue)
3604 {
3605 texcolor.A = clippedAlpha;
3606 }
3594 tex.FaceTextures[i].RGBA = texcolor; 3607 tex.FaceTextures[i].RGBA = texcolor;
3595 } 3608 }
3596 texcolor = tex.DefaultTexture.RGBA; 3609 texcolor = tex.DefaultTexture.RGBA;
3597 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3610 texcolor.R = clippedColor.X;
3598 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3611 texcolor.G = clippedColor.Y;
3599 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3612 texcolor.B = clippedColor.Z;
3613 if (alpha.HasValue)
3614 {
3615 texcolor.A = clippedAlpha;
3616 }
3600 tex.DefaultTexture.RGBA = texcolor; 3617 tex.DefaultTexture.RGBA = texcolor;
3601 } 3618 }
3602 UpdateTextureEntry(tex.GetBytes()); 3619 UpdateTextureEntry(tex.GetBytes());