From 466d684fbe26b4ea24a0003120d7a875fbbca037 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 1 Aug 2012 15:18:02 +0100 Subject: [PATCH] implemented --- .../Framework/Scenes/SceneObjectPart.cs | 50 +++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 13 +++++ .../Shared/Api/Runtime/LSL_Constants.cs | 1 + 3 files changed, 64 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bd6369cbac..e84ab0540f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4236,6 +4236,56 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } + public void UpdateSlice(float begin, float end) + { + if (end < begin) + { + float temp = begin; + begin = end; + end = temp; + } + end = Math.Min(1f, Math.Max(0f, end)); + begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f); + if (begin < 0.02f && end < 0.02f) + { + begin = 0f; + end = 0.02f; + } + + ushort uBegin = (ushort)(50000.0 * begin); + ushort uEnd = (ushort)(50000.0 * (1f - end)); + bool updatePossiblyNeeded = false; + if (GetPrimType() == PrimType.SPHERE) + { + if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd) + { + m_shape.ProfileBegin = uBegin; + m_shape.ProfileEnd = uEnd; + updatePossiblyNeeded = true; + } + } + else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd) + { + m_shape.PathBegin = uBegin; + m_shape.PathEnd = uEnd; + updatePossiblyNeeded = true; + } + + if (updatePossiblyNeeded && ParentGroup != null) + { + ParentGroup.HasGroupChanged = true; + } + if (updatePossiblyNeeded && PhysActor != null) + { + PhysActor.Shape = m_shape; + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + } + if (updatePossiblyNeeded) + { + ScheduleFullUpdate(); + } + } + /// /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics /// engine can use it. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 255fc8e59a..75491da818 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7666,6 +7666,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Float gain = rules.GetLSLFloatItem(idx++); TargetOmega(part, axis, (double)spinrate, (double)gain); break; + case (int)ScriptBaseClass.PRIM_SLICE: + if (remain < 1) + return; + LSL_Vector slice = rules.GetVector3Item(idx++); + part.UpdateSlice((float)slice.x, (float)slice.y); + break; case (int)ScriptBaseClass.PRIM_LINK_TARGET: if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. return null; @@ -8340,6 +8346,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_POS_LOCAL: res.Add(new LSL_Vector(GetPartLocalPos(part))); break; + case (int)ScriptBaseClass.PRIM_SLICE: + res.Add(new LSL_Vector( + (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, + 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, + 0 + )); + break; } } return res; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index e1c054d04e..cad8518473 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_OMEGA = 32; public const int PRIM_POS_LOCAL = 33; public const int PRIM_LINK_TARGET = 34; + public const int PRIM_SLICE = 35; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1;