From 7b46506822be1dd1559661453ebc580336487683 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Oct 2011 23:15:51 +0100 Subject: fetch SOP.RotationOffset once in UpdateRotation() and compare rather than fetch four separate times. No functional change. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 +++++++++++++++++----- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c8ecc9b..2ff3fb7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -797,7 +797,14 @@ namespace OpenSim.Region.Framework.Scenes m_rotationOffset = actor.Orientation; } } - + +// float roll, pitch, yaw = 0; +// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw); +// +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Got euler {0} for RotationOffset on {1} {2}", +// new Vector3(roll, pitch, yaw), Name, LocalId); + return m_rotationOffset; } @@ -834,6 +841,13 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); } } + +// float roll, pitch, yaw = 0; +// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw); +// +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Set euler {0} for RotationOffset on {1} {2}", +// new Vector3(roll, pitch, yaw), Name, LocalId); } } @@ -4495,12 +4509,13 @@ namespace OpenSim.Region.Framework.Scenes PhysActor = null; } + /// + /// This updates the part's rotation and sends out an update to clients if necessary. + /// + /// public void UpdateRotation(Quaternion rot) { - if ((rot.X != RotationOffset.X) || - (rot.Y != RotationOffset.Y) || - (rot.Z != RotationOffset.Z) || - (rot.W != RotationOffset.W)) + if (rot != RotationOffset) { RotationOffset = rot; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ee6c708..38cdd77 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1769,7 +1769,7 @@ namespace OpenSim.Region.Framework.Scenes Rotation = Quaternion.CreateFromEulers(angle); // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); - + Vector3 agent_control_v3 = new Vector3(); HandleMoveToTargetUpdate(ref agent_control_v3); AddNewMovement(agent_control_v3); -- cgit v1.1 From 9bf8c3e7b73da735a6e8aa865e5d19f16453981c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Oct 2011 23:38:57 +0100 Subject: Add missing doc to rotation/position methods in SOG --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 2d6d4ec..f6d3293 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2808,7 +2808,7 @@ namespace OpenSim.Region.Framework.Scenes #region Rotation /// - /// + /// Update the rotation of the group. /// /// public void UpdateGroupRotationR(Quaternion rot) @@ -2836,7 +2836,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the position and rotation of a group simultaneously. /// /// /// @@ -2870,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the rotation of a single prim within the group. /// /// /// @@ -2899,7 +2899,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the position and rotation simultaneously of a single prim within the group. /// /// /// @@ -2931,7 +2931,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the entire rotation of the group. /// /// public void UpdateRootRotation(Quaternion rot) -- cgit v1.1 From c2da1c4580302a3f1a30b7ad2e70f590aff76167 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Oct 2011 23:43:31 +0100 Subject: set grp.RootPart.GroupPosition for code consistency (and readability) rather than calling SOP.OffsetForNewRegion --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f6d3293..64810d2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2798,11 +2798,6 @@ namespace OpenSim.Region.Framework.Scenes ScheduleGroupForTerseUpdate(); } - public void OffsetForNewRegion(Vector3 offset) - { - m_rootPart.GroupPosition = offset; - } - #endregion #region Rotation -- cgit v1.1 From 61e97ee4c85d79098731eb7ddc074af388c61380 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 29 Oct 2011 00:39:01 +0100 Subject: Remove completely unused SOG.Rotation parameter We always use SOP.Rotation instead --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 -------- .../Framework/Scenes/Tests/SceneObjectLinkingTests.cs | 18 +++++++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 64810d2..2ea9854 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -281,14 +281,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_parts.Count; } } - protected Quaternion m_rotation = Quaternion.Identity; - - public virtual Quaternion Rotation - { - get { return m_rotation; } - set { m_rotation = value; } - } - public Quaternion GroupRotation { get { return m_rootPart.RotationOffset; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 2912a46..90cdd7b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -62,9 +62,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests grp1.AbsolutePosition = new Vector3(10, 10, 10); grp2.AbsolutePosition = Vector3.Zero; - + // <90,0,0> - grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); +// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); // <180,0,0> grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests if (debugtest) { m_log.Debug("parts: " + grp1.Parts.Length); - m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation); + m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation); m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset); m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset); } @@ -152,13 +152,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests grp4.AbsolutePosition = new Vector3(40, 40, 40); // <90,0,0> - grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); +// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); // <180,0,0> grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); // <270,0,0> - grp3.Rotation = (Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0)); +// grp3.UpdateGroupRotationR(Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0)); // <0,90,0> grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0)); @@ -187,12 +187,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests { m_log.Debug("--------After Link-------"); m_log.Debug("Group1: parts:" + grp1.Parts.Length); - m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation); + m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation); m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset); m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+ part2.RotationOffset); m_log.Debug("Group3: parts:" + grp3.Parts.Length); - m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation); + m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.GroupRotation); m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset); m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset); } @@ -240,12 +240,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests { m_log.Debug("--------After De-Link-------"); m_log.Debug("Group1: parts:" + grp1.Parts.Length); - m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.Rotation); + m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.GroupRotation); m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset); m_log.Debug("Group1: Prim2: OffsetPosition:" + part2.OffsetPosition + ", OffsetRotation:" + part2.RotationOffset); m_log.Debug("Group3: parts:" + grp3.Parts.Length); - m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.Rotation); + m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.GroupRotation); m_log.Debug("Group3: Prim1: OffsetPosition:" + part3.OffsetPosition + ", OffsetRotation:" + part3.RotationOffset); m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset); } -- cgit v1.1 From 6d97545b6bdf1b9a468f9116fe3070c5d9f9f3c6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 29 Oct 2011 02:42:53 +0100 Subject: Remove the SyncRoot locking from Scene which was only being done around the main physics loop and ScenePresence position and velocity setting This is no longer necessary with ODECharacter taints (ODEPrim was already not taking part in this). BSCharacter was already tainting. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ---- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 38 ++++++++++-------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++-- 3 files changed, 18 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 302103a..ff05e95 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -509,12 +509,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // This gets locked so things stay thread safe. - public object SyncRoot - { - get { return m_sceneGraph.m_syncRoot; } - } - public string DefaultScriptEngine { get { return m_defaultScriptEngine; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 542bd51..1af18e7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -84,8 +84,6 @@ namespace OpenSim.Region.Framework.Scenes protected int m_activeScripts = 0; protected int m_scriptLPS = 0; - protected internal object m_syncRoot = new object(); - protected internal PhysicsScene _PhyScene; /// @@ -187,26 +185,22 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal float UpdatePhysics(double elapsed) { - lock (m_syncRoot) - { - // Here is where the Scene calls the PhysicsScene. This is a one-way - // interaction; the PhysicsScene cannot access the calling Scene directly. - // But with joints, we want a PhysicsActor to be able to influence a - // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected - // with a joint should be able to move the SceneObjectPart which is the visual - // representation of that joint (for editing and serialization purposes). - // However the PhysicsActor normally cannot directly influence anything outside - // of the PhysicsScene, and the non-physical SceneObjectPart which represents - // the joint in the Scene does not exist in the PhysicsScene. - // - // To solve this, we have an event in the PhysicsScene that is fired when a joint - // has changed position (because one of its associated PhysicsActors has changed - // position). - // - // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). - - return _PhyScene.Simulate((float)elapsed); - } + // Here is where the Scene calls the PhysicsScene. This is a one-way + // interaction; the PhysicsScene cannot access the calling Scene directly. + // But with joints, we want a PhysicsActor to be able to influence a + // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected + // with a joint should be able to move the SceneObjectPart which is the visual + // representation of that joint (for editing and serialization purposes). + // However the PhysicsActor normally cannot directly influence anything outside + // of the PhysicsScene, and the non-physical SceneObjectPart which represents + // the joint in the Scene does not exist in the PhysicsScene. + // + // To solve this, we have an event in the PhysicsScene that is fired when a joint + // has changed position (because one of its associated PhysicsActors has changed + // position). + // + // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). + return _PhyScene.Simulate((float)elapsed); } protected internal void UpdateScenePresenceMovement() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0880e21..bb820aa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -521,8 +521,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - lock (m_scene.SyncRoot) - PhysicsActor.Position = value; + PhysicsActor.Position = value; } catch (Exception e) { @@ -572,8 +571,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - lock (m_scene.SyncRoot) - PhysicsActor.Velocity = value; + PhysicsActor.Velocity = value; } catch (Exception e) { -- cgit v1.1