From e8779cd9e54416349e67d9e5c48b35bab43b69e9 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 1 Mar 2012 19:22:05 -0800 Subject: In ScenePresence, removed several private variables used to store public parameters. They were only used by the get/set and make code harder to refactor. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 152 +++++++---------------- 1 file changed, 44 insertions(+), 108 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 40c8d06..e982bfe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,15 +341,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - - protected Vector3 m_CameraPosition; - - public Vector3 CameraPosition - { - get { return m_CameraPosition; } - private set { m_CameraPosition = value; } - } + protected Vector3 m_lastCameraPosition; + + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation { @@ -358,29 +352,10 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - protected Vector3 m_CameraAtAxis; - protected Vector3 m_CameraLeftAxis; - protected Vector3 m_CameraUpAxis; - - public Vector3 CameraAtAxis - { - get { return m_CameraAtAxis; } - private set { m_CameraAtAxis = value; } - } - - - public Vector3 CameraLeftAxis - { - get { return m_CameraLeftAxis; } - private set { m_CameraLeftAxis = value; } - } - - public Vector3 CameraUpAxis - { - get { return m_CameraUpAxis; } - private set { m_CameraUpAxis = value; } - } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } + public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat { @@ -396,33 +371,15 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public readonly string Firstname; - public readonly string Lastname; - - private string m_grouptitle; - - public string Grouptitle - { - get { return m_grouptitle; } - set { m_grouptitle = value; } - } - - // Agent's Draw distance. - protected float m_DrawDistance; - - public float DrawDistance - { - get { return m_DrawDistance; } - private set { m_DrawDistance = value; } - } - - protected bool m_allowMovement = true; + public string Firstname { get; private set; } + public string Lastname { get; private set; } + + public string Grouptitle { get; set; } - public bool AllowMovement - { - get { return m_allowMovement; } - set { m_allowMovement = value; } - } + // Agent's Draw distance. + public float DrawDistance { get; set; } + + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -447,15 +404,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - - private byte m_state; - - public byte State - { - get { return m_state; } - set { m_state = value; } - } + } + + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -463,31 +414,16 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - - /// - /// This works out to be the ClientView object associated with this avatar, or it's client connection manager - /// - private IClientAPI m_controllingClient; - - public IClientAPI ControllingClient - { - get { return m_controllingClient; } - private set { m_controllingClient = value; } - } + } + + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { - get { return (IClientCore) m_controllingClient; } - } - - protected Vector3 m_parentPosition; - - public Vector3 ParentPosition - { - get { return m_parentPosition; } - set { m_parentPosition = value; } - } + { + get { return (IClientCore)ControllingClient; } + } + + public Vector3 ParentPosition { get; set; } /// /// Position of this avatar relative to the region the avatar is in @@ -825,18 +761,18 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP - vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE - vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE - vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1333,7 +1269,7 @@ namespace OpenSim.Region.Framework.Scenes // Convert it to a Matrix and/or Quaternion CameraAtAxis = agentData.CameraAtAxis; CameraLeftAxis = agentData.CameraLeftAxis; - m_CameraUpAxis = agentData.CameraUpAxis; + CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting // When we get to the point of re-computing neighbors everytime this @@ -1343,9 +1279,9 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - - m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; @@ -3077,8 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; - cAgent.UpAxis = m_CameraUpAxis; + cAgent.LeftAxis = CameraLeftAxis; + cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3163,8 +3099,8 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; - m_CameraUpAxis = cAgent.UpAxis; + CameraLeftAxis = cAgent.LeftAxis; + CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the -- cgit v1.1 From 6e3523e25e8d5538ed63984241093c1cfb6f2388 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 04:08:07 +0000 Subject: minor: remove mono compiler warning --- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index e4b607d..e16903c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -65,8 +65,7 @@ namespace OpenSim.Region.Framework.Tests // Create an object embedded inside the first UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); - TaskInventoryItem taskSceneObjectItem - = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); + TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); -- cgit v1.1 From 8d249f8456f6bf70f4d81098007a02b1ede5587e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 2 Mar 2012 09:19:13 -0800 Subject: ScenePresence line endings and fix AllowMovement default to true. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 60 ++++++++++++------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e982bfe..ec6bb89 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,8 +341,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - + protected Vector3 m_lastCameraPosition; + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation @@ -352,9 +352,9 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - public Vector3 CameraAtAxis { get; set; } - public Vector3 CameraLeftAxis { get; set; } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat @@ -371,14 +371,14 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public string Firstname { get; private set; } - public string Lastname { get; private set; } - + public string Firstname { get; private set; } + public string Lastname { get; private set; } + public string Grouptitle { get; set; } - // Agent's Draw distance. - public float DrawDistance { get; set; } - + // Agent's Draw distance. + public float DrawDistance { get; set; } + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -404,8 +404,8 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - + } + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -414,15 +414,15 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - + } + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { + { get { return (IClientCore)ControllingClient; } - } - + } + public Vector3 ParentPosition { get; set; } /// @@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { AttachmentsSyncLock = new Object(); - + AllowMovement = true; IsChildAgent = true; m_sendCourseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); @@ -761,17 +761,17 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP - vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1279,8 +1279,8 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; + cAgent.LeftAxis = CameraLeftAxis; cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3099,7 +3099,7 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; + CameraLeftAxis = cAgent.LeftAxis; CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this -- cgit v1.1