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