diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 109 |
1 files changed, 88 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4788a24..8e419f9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -790,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
790 | } | 790 | } |
791 | catch (Exception e) | 791 | catch (Exception e) |
792 | { | 792 | { |
793 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 793 | m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e); |
794 | } | 794 | } |
795 | } | 795 | } |
796 | } | 796 | } |
@@ -2972,17 +2972,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2972 | /// <param name="scale"></param> | 2972 | /// <param name="scale"></param> |
2973 | public void Resize(Vector3 scale) | 2973 | public void Resize(Vector3 scale) |
2974 | { | 2974 | { |
2975 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); | 2975 | scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); |
2976 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); | 2976 | scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); |
2977 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); | 2977 | scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); |
2978 | 2978 | ||
2979 | PhysicsActor pa = PhysActor; | 2979 | PhysicsActor pa = PhysActor; |
2980 | |||
2981 | if (pa != null && pa.IsPhysical) | 2980 | if (pa != null && pa.IsPhysical) |
2982 | { | 2981 | { |
2983 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); | 2982 | scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); |
2984 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); | 2983 | scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); |
2985 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); | 2984 | scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); |
2986 | } | 2985 | } |
2987 | 2986 | ||
2988 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | 2987 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); |
@@ -3567,23 +3566,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3567 | } | 3566 | } |
3568 | 3567 | ||
3569 | /// <summary> | 3568 | /// <summary> |
3570 | /// Set the color of prim faces | 3569 | /// Set the color & alpha of prim faces |
3571 | /// </summary> | 3570 | /// </summary> |
3572 | /// <param name="color"></param> | ||
3573 | /// <param name="face"></param> | 3571 | /// <param name="face"></param> |
3574 | public void SetFaceColor(Vector3 color, int face) | 3572 | /// <param name="color"></param> |
3573 | /// <param name="alpha"></param> | ||
3574 | public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha) | ||
3575 | { | 3575 | { |
3576 | Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); | ||
3577 | float clippedAlpha = alpha.HasValue ? | ||
3578 | Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0; | ||
3579 | |||
3576 | // The only way to get a deep copy/ If we don't do this, we can | 3580 | // The only way to get a deep copy/ If we don't do this, we can |
3577 | // mever detect color changes further down. | 3581 | // never detect color changes further down. |
3578 | Byte[] buf = Shape.Textures.GetBytes(); | 3582 | Byte[] buf = Shape.Textures.GetBytes(); |
3579 | Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); | 3583 | Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); |
3580 | Color4 texcolor; | 3584 | Color4 texcolor; |
3581 | if (face >= 0 && face < GetNumberOfSides()) | 3585 | if (face >= 0 && face < GetNumberOfSides()) |
3582 | { | 3586 | { |
3583 | texcolor = tex.CreateFace((uint)face).RGBA; | 3587 | texcolor = tex.CreateFace((uint)face).RGBA; |
3584 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | 3588 | texcolor.R = clippedColor.X; |
3585 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | 3589 | texcolor.G = clippedColor.Y; |
3586 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | 3590 | texcolor.B = clippedColor.Z; |
3591 | if (alpha.HasValue) | ||
3592 | { | ||
3593 | texcolor.A = clippedAlpha; | ||
3594 | } | ||
3587 | tex.FaceTextures[face].RGBA = texcolor; | 3595 | tex.FaceTextures[face].RGBA = texcolor; |
3588 | UpdateTextureEntry(tex.GetBytes()); | 3596 | UpdateTextureEntry(tex.GetBytes()); |
3589 | return; | 3597 | return; |
@@ -3595,15 +3603,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3595 | if (tex.FaceTextures[i] != null) | 3603 | if (tex.FaceTextures[i] != null) |
3596 | { | 3604 | { |
3597 | texcolor = tex.FaceTextures[i].RGBA; | 3605 | texcolor = tex.FaceTextures[i].RGBA; |
3598 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | 3606 | texcolor.R = clippedColor.X; |
3599 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | 3607 | texcolor.G = clippedColor.Y; |
3600 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | 3608 | texcolor.B = clippedColor.Z; |
3609 | if (alpha.HasValue) | ||
3610 | { | ||
3611 | texcolor.A = clippedAlpha; | ||
3612 | } | ||
3601 | tex.FaceTextures[i].RGBA = texcolor; | 3613 | tex.FaceTextures[i].RGBA = texcolor; |
3602 | } | 3614 | } |
3603 | texcolor = tex.DefaultTexture.RGBA; | 3615 | texcolor = tex.DefaultTexture.RGBA; |
3604 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | 3616 | texcolor.R = clippedColor.X; |
3605 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | 3617 | texcolor.G = clippedColor.Y; |
3606 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | 3618 | texcolor.B = clippedColor.Z; |
3619 | if (alpha.HasValue) | ||
3620 | { | ||
3621 | texcolor.A = clippedAlpha; | ||
3622 | } | ||
3607 | tex.DefaultTexture.RGBA = texcolor; | 3623 | tex.DefaultTexture.RGBA = texcolor; |
3608 | } | 3624 | } |
3609 | UpdateTextureEntry(tex.GetBytes()); | 3625 | UpdateTextureEntry(tex.GetBytes()); |
@@ -4891,6 +4907,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
4891 | ScheduleFullUpdate(); | 4907 | ScheduleFullUpdate(); |
4892 | } | 4908 | } |
4893 | 4909 | ||
4910 | public void UpdateSlice(float begin, float end) | ||
4911 | { | ||
4912 | if (end < begin) | ||
4913 | { | ||
4914 | float temp = begin; | ||
4915 | begin = end; | ||
4916 | end = temp; | ||
4917 | } | ||
4918 | end = Math.Min(1f, Math.Max(0f, end)); | ||
4919 | begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f); | ||
4920 | if (begin < 0.02f && end < 0.02f) | ||
4921 | { | ||
4922 | begin = 0f; | ||
4923 | end = 0.02f; | ||
4924 | } | ||
4925 | |||
4926 | ushort uBegin = (ushort)(50000.0 * begin); | ||
4927 | ushort uEnd = (ushort)(50000.0 * (1f - end)); | ||
4928 | bool updatePossiblyNeeded = false; | ||
4929 | PrimType primType = GetPrimType(); | ||
4930 | if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING) | ||
4931 | { | ||
4932 | if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd) | ||
4933 | { | ||
4934 | m_shape.ProfileBegin = uBegin; | ||
4935 | m_shape.ProfileEnd = uEnd; | ||
4936 | updatePossiblyNeeded = true; | ||
4937 | } | ||
4938 | } | ||
4939 | else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd) | ||
4940 | { | ||
4941 | m_shape.PathBegin = uBegin; | ||
4942 | m_shape.PathEnd = uEnd; | ||
4943 | updatePossiblyNeeded = true; | ||
4944 | } | ||
4945 | |||
4946 | if (updatePossiblyNeeded && ParentGroup != null) | ||
4947 | { | ||
4948 | ParentGroup.HasGroupChanged = true; | ||
4949 | } | ||
4950 | if (updatePossiblyNeeded && PhysActor != null) | ||
4951 | { | ||
4952 | PhysActor.Shape = m_shape; | ||
4953 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
4954 | } | ||
4955 | if (updatePossiblyNeeded) | ||
4956 | { | ||
4957 | ScheduleFullUpdate(); | ||
4958 | } | ||
4959 | } | ||
4960 | |||
4894 | /// <summary> | 4961 | /// <summary> |
4895 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics | 4962 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics |
4896 | /// engine can use it. | 4963 | /// engine can use it. |