From d44b50ee462978b4899c0b142f6ecbfb553f06b6 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 15 Oct 2009 15:25:02 -0700
Subject: * Removed some of the redundant broadcast functions in Scene and
SceneGraph so it is clear who/what the broadcast is going to each time *
Removed two redundant parameters from SceneObjectPart * Changed some code in
terse update sending that was meant to work with references to work with
value types (since Vector3 and Quaternion are structs) * Committing a preview
of a new method for sending object updates efficiently (all commented out for
now)
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2a06f9e..387db44 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2455,11 +2455,10 @@ namespace OpenSim.Region.Framework.Scenes
m_perfMonMS = Environment.TickCount;
Vector3 pos = m_pos;
- Vector3 vel = Velocity;
- Quaternion rot = m_bodyRot;
pos.Z -= m_appearance.HipOffset;
- remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z),
- new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid);
+
+ remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
+ LocalId, pos, Velocity, m_bodyRot, m_uuid);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2473,7 +2472,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_perfMonMS = Environment.TickCount;
- m_scene.Broadcast(SendTerseUpdateToClient);
+ m_scene.ForEachClient(SendTerseUpdateToClient);
m_lastVelocity = m_velocity;
lastPhysPos = AbsolutePosition;
@@ -2774,7 +2773,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_isChildAgent)
return;
- m_scene.Broadcast(
+ m_scene.ForEachClient(
delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); });
}
--
cgit v1.1
From 4b75353cbf50de3cae4c48ec90b55f30c1612c92 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 15 Oct 2009 16:35:27 -0700
Subject: Object update prioritization by Jim Greensky of Intel Labs, part one.
This implements a simple distance prioritizer based on initial agent
positions. Re-prioritizing and more advanced priority algorithms will follow
soon
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 58 ++++++++++++++++++------
1 file changed, 44 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 387db44..a5b88c6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -403,12 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
set { m_parentPosition = value; }
}
- public int MaxPrimsPerFrame
- {
- get { return m_sceneViewer.MaxPrimsPerFrame; }
- set { m_sceneViewer.MaxPrimsPerFrame = value; }
- }
-
///
/// Absolute position of this avatar in 'region cordinates'
///
@@ -2457,8 +2451,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
- remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
- LocalId, pos, Velocity, m_bodyRot, m_uuid);
+ remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
+ pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient)));
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2563,9 +2557,9 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
- remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
+ remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
LocalId, m_pos, m_appearance.Texture.GetBytes(),
- m_parentID, rot);
+ m_parentID, rot));
m_scene.StatsReporter.AddAgentUpdates(1);
}
@@ -2634,8 +2628,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
- m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
- m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot);
+ m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
+ m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
if (!m_isChildAgent)
{
@@ -2741,8 +2735,8 @@ namespace OpenSim.Region.Framework.Scenes
}
Quaternion rot = m_bodyRot;
- m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
- m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot);
+ m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
+ m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
}
@@ -3870,5 +3864,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
+ public double GetUpdatePriority(IClientAPI client)
+ {
+ switch (Scene.UpdatePrioritizationScheme)
+ {
+ case Scene.UpdatePrioritizationSchemes.Time:
+ return GetPriorityByTime();
+ case Scene.UpdatePrioritizationSchemes.Distance:
+ return GetPriorityByDistance(client);
+ case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
+ return GetPriorityByDistance(client);
+ default:
+ throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
+ }
+ }
+
+ private double GetPriorityByTime()
+ {
+ return DateTime.Now.ToOADate();
+ }
+
+ private double GetPriorityByDistance(IClientAPI client)
+ {
+ ScenePresence presence = Scene.GetScenePresence(client.AgentId);
+ if (presence != null)
+ {
+ return GetPriorityByDistance((presence.IsChildAgent) ?
+ presence.AbsolutePosition : presence.CameraPosition);
+ }
+ return double.NaN;
+ }
+
+ private double GetPriorityByDistance(Vector3 position)
+ {
+ return Vector3.Distance(AbsolutePosition, position);
+ }
}
}
--
cgit v1.1
From fdb2a75ad357668b860fc5055e0630ef75a3ad20 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sat, 17 Oct 2009 18:01:22 -0700
Subject: Committing the second part of Jim Greensky @ Intel Lab's patch,
re-prioritizing updates
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 112 ++++++++++++++++++++++-
1 file changed, 110 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9d13ad4..f05c3d8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
+using System.Timers;
using OpenMetaverse;
using log4net;
using OpenSim.Framework;
@@ -172,6 +173,11 @@ namespace OpenSim.Region.Framework.Scenes
// Position of agent's camera in world (region cordinates)
protected Vector3 m_CameraCenter = Vector3.Zero;
+ protected Vector3 m_lastCameraCenter = Vector3.Zero;
+
+ protected Timer m_reprioritization_timer;
+ protected bool m_reprioritizing = false;
+ protected bool m_reprioritization_called = false;
// Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion
@@ -639,7 +645,14 @@ namespace OpenSim.Region.Framework.Scenes
m_scriptEngines = m_scene.RequestModuleInterfaces();
- AbsolutePosition = m_controllingClient.StartPos;
+ AbsolutePosition = posLastSignificantMove = m_CameraCenter =
+ m_lastCameraCenter = m_controllingClient.StartPos;
+
+ m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
+ m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
+ m_reprioritization_timer.AutoReset = false;
+
+
AdjustKnownSeeds();
TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here...
@@ -1219,6 +1232,11 @@ namespace OpenSim.Region.Framework.Scenes
// Camera location in world. We'll need to raytrace
// from this location from time to time.
m_CameraCenter = agentData.CameraCenter;
+ if (Vector3.Distance(m_lastCameraCenter, m_CameraCenter) >= Scene.RootReprioritizationDistance)
+ {
+ ReprioritizeUpdates();
+ m_lastCameraCenter = m_CameraCenter;
+ }
// Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion
@@ -2823,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
- if (Util.GetDistanceTo(AbsolutePosition,m_LastChildAgentUpdatePosition) > 32)
+ if (Util.GetDistanceTo(AbsolutePosition, m_LastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance)
{
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
cadu.ActiveGroupID = UUID.Zero.Guid;
@@ -3118,6 +3136,12 @@ namespace OpenSim.Region.Framework.Scenes
if (cAgentData.Position != new Vector3(-1, -1, -1)) // UGH!!
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
+ if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance)
+ {
+ posLastSignificantMove = AbsolutePosition;
+ ReprioritizeUpdates();
+ }
+
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
m_CameraCenter = cAgentData.Center;
@@ -3498,6 +3522,16 @@ namespace OpenSim.Region.Framework.Scenes
{
m_knownChildRegions.Clear();
}
+
+ lock (m_reprioritization_timer)
+ {
+ m_reprioritization_timer.Enabled = false;
+ m_reprioritization_timer.Elapsed -= new ElapsedEventHandler(Reprioritize);
+ }
+ // I don't get it but mono crashes when you try to dispose of this timer,
+ // unsetting the elapsed callback should be enough to allow for cleanup however.
+ //m_reprioritizationTimer.Dispose();
+
m_sceneViewer.Close();
RemoveFromPhysicalScene();
@@ -3913,5 +3947,79 @@ namespace OpenSim.Region.Framework.Scenes
{
return Vector3.Distance(AbsolutePosition, position);
}
+
+ private double GetSOGUpdatePriority(SceneObjectGroup sog)
+ {
+ switch (Scene.UpdatePrioritizationScheme)
+ {
+ case Scene.UpdatePrioritizationSchemes.Time:
+ throw new InvalidOperationException("UpdatePrioritizationScheme for time not supported for reprioritization");
+ case Scene.UpdatePrioritizationSchemes.Distance:
+ return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
+ case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
+ return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
+ default:
+ throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
+ }
+ }
+
+ private double UpdatePriority(UpdatePriorityData data)
+ {
+ EntityBase entity;
+ SceneObjectGroup group;
+
+ if (Scene.Entities.TryGetValue(data.localID, out entity))
+ {
+ group = entity as SceneObjectGroup;
+ if (group != null)
+ return GetSOGUpdatePriority(group);
+
+ ScenePresence presence = entity as ScenePresence;
+ if (presence == null)
+ throw new InvalidOperationException("entity found is neither SceneObjectGroup nor ScenePresence");
+ switch (Scene.UpdatePrioritizationScheme)
+ {
+ case Scene.UpdatePrioritizationSchemes.Time:
+ throw new InvalidOperationException("UpdatePrioritization for time not supported for reprioritization");
+ case Scene.UpdatePrioritizationSchemes.Distance:
+ case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
+ return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
+ default:
+ throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
+ }
+ }
+ else
+ {
+ group = Scene.SceneGraph.GetGroupByPrim(data.localID);
+ if (group != null)
+ return GetSOGUpdatePriority(group);
+ }
+ return double.NaN;
+ }
+
+ private void ReprioritizeUpdates()
+ {
+ if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != Scene.UpdatePrioritizationSchemes.Time)
+ {
+ lock (m_reprioritization_timer)
+ {
+ if (!m_reprioritizing)
+ m_reprioritization_timer.Enabled = m_reprioritizing = true;
+ else
+ m_reprioritization_called = true;
+ }
+ }
+ }
+
+ private void Reprioritize(object sender, ElapsedEventArgs e)
+ {
+ m_controllingClient.ReprioritizeUpdates(StateUpdateTypes.All, UpdatePriority);
+
+ lock (m_reprioritization_timer)
+ {
+ m_reprioritization_timer.Enabled = m_reprioritizing = m_reprioritization_called;
+ m_reprioritization_called = false;
+ }
+ }
}
}
--
cgit v1.1
From 233e16b99cc80190d41143ecdfe01308eb39932a Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 18 Oct 2009 20:24:20 -0700
Subject: * Rewrote the methods that build ObjectUpdate and
ImprovedTerseObjectUpdate packets to fill in the data more accurately and
avoid allocating memory that is immediately thrown away * Changed the
Send*Data structs in IClientAPI to use public readonly members instead of
private members and getters * Made Parallel.ProcessorCount public * Started
switching over packet building methods in LLClientView to use
Util.StringToBytes[256/1024]() instead of Utils.StringToBytes() * More
cleanup of the ScenePresences vs. ClientManager nightmare *
ScenePresence.HandleAgentUpdate() will now time out and drop incoming
AgentUpdate packets after three seconds. This fixes a deadlock on
m_AgentUpdates that was blocking up the LLUDP server
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f05c3d8..bdd80c6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1160,15 +1160,21 @@ namespace OpenSim.Region.Framework.Scenes
///
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
- lock (m_agentUpdates)
+ const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3;
+
+ if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS))
{
- if (m_updatesAllowed)
+ try
{
- RealHandleAgentUpdate(remoteClient, agentData);
- return;
+ if (m_updatesAllowed)
+ {
+ RealHandleAgentUpdate(remoteClient, agentData);
+ return;
+ }
+
+ m_agentUpdates.Add(agentData);
}
-
- m_agentUpdates.Add(agentData);
+ finally { System.Threading.Monitor.Exit(m_agentUpdates); }
}
}
@@ -2471,7 +2477,7 @@ namespace OpenSim.Region.Framework.Scenes
pos.Z -= m_appearance.HipOffset;
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
- pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient)));
+ pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient)));
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@@ -3504,7 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes
public void Close()
{
-
lock (m_attachments)
{
// Delete attachments from scene
@@ -3535,7 +3540,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneViewer.Close();
RemoveFromPhysicalScene();
- GC.Collect();
}
public ScenePresence()
--
cgit v1.1
From 1833c6956892f1c8324ecbe0179103bff2079151 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 20 Oct 2009 15:19:19 -0700
Subject: * Removed the unused m_agentUpdates collection and some extra work
that was being done for AgentUpdate packets * Start LLUDPClients unpaused
(this variable is not being used yet)
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 126 ++++++-----------------
1 file changed, 33 insertions(+), 93 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bdd80c6..d7113bf 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -128,8 +128,6 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_setAlwaysRun;
- private bool m_updatesAllowed = true;
- private List m_agentUpdates = new List();
private string m_movementAnimation = "DEFAULT";
private long m_animPersistUntil = 0;
private bool m_allowFalling = false;
@@ -1090,34 +1088,6 @@ namespace OpenSim.Region.Framework.Scenes
}
- // These methods allow to queue up agent updates (like key presses)
- // until all attachment scripts are running and the animations from
- // AgentDataUpdate have been started. It is essential for combat
- // devices, weapons and AOs that keypresses are not processed
- // until scripts that are potentially interested in them are
- // up and running and that animations a script knows to be running
- // from before a crossing are running again
- //
- public void LockAgentUpdates()
- {
- m_updatesAllowed = false;
- }
-
- public void UnlockAgentUpdates()
- {
- lock (m_agentUpdates)
- {
- if (m_updatesAllowed == false)
- {
- foreach (AgentUpdateArgs a in m_agentUpdates)
- RealHandleAgentUpdate(ControllingClient, a);
- m_agentUpdates.Clear();
- m_updatesAllowed = true;
- }
- }
- }
-
-
///
/// Callback for the Camera view block check. Gets called with the results of the camera view block test
/// hitYN is true when there's something in the way.
@@ -1155,49 +1125,30 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ Array m_dirControlFlags = Enum.GetValues(typeof(Dir_ControlFlags));
+
///
/// This is the event handler for client movement. If a client is moving, this event is triggering.
///
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
- const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3;
-
- if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS))
- {
- try
- {
- if (m_updatesAllowed)
- {
- RealHandleAgentUpdate(remoteClient, agentData);
- return;
- }
-
- m_agentUpdates.Add(agentData);
- }
- finally { System.Threading.Monitor.Exit(m_agentUpdates); }
- }
- }
-
- private void RealHandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
- {
//if (m_isChildAgent)
//{
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
// return;
//}
-
- m_movementUpdateCount++;
- if (m_movementUpdateCount >= int.MaxValue)
- m_movementUpdateCount = 1;
+ m_perfMonMS = Environment.TickCount;
+ ++m_movementUpdateCount;
+ if (m_movementUpdateCount < 1)
+ m_movementUpdateCount = 1;
// Must check for standing up even when PhysicsActor is null,
// since sitting currently removes avatar from physical scene
//m_log.Debug("agentPos:" + AbsolutePosition.ToString());
// This is irritating. Really.
-
if (!AbsolutePosition.IsFinite())
{
RemoveFromPhysicalScene();
@@ -1218,19 +1169,17 @@ namespace OpenSim.Region.Framework.Scenes
{
m_LastFinitePos = m_pos;
}
- //m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true);
+ //m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true);
//ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
//if (land != null)
//{
- //if (land.landData.landingType == (byte)1 && land.landData.userLocation != Vector3.Zero)
- //{
- // agent.startpos = land.landData.userLocation;
- //}
+ //if (land.landData.landingType == (byte)1 && land.landData.userLocation != Vector3.Zero)
+ //{
+ // agent.startpos = land.landData.userLocation;
+ //}
//}
-
- m_perfMonMS = Environment.TickCount;
uint flags = agentData.ControlFlags;
Quaternion bodyRotation = agentData.BodyRotation;
@@ -1253,7 +1202,7 @@ namespace OpenSim.Region.Framework.Scenes
// The Agent's Draw distance setting
m_DrawDistance = agentData.Far;
- if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
+ if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
{
StandUp();
}
@@ -1261,14 +1210,13 @@ namespace OpenSim.Region.Framework.Scenes
// Check if Client has camera in 'follow cam' or 'build' mode.
Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
- m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f)
+ m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f)
&& (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
//m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto);
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast())
{
-
if (m_followCamAuto)
{
Vector3 headadjustment = new Vector3(0, 0, 0.3f);
@@ -1276,24 +1224,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- m_mouseLook = (flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
-
-
-
+ m_mouseLook = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
-
-
lock (scriptedcontrols)
{
if (scriptedcontrols.Count > 0)
{
SendControlToScripts(flags);
flags = RemoveIgnoredControls(flags, IgnoredControls);
-
}
}
-
+
if (PhysicsActor == null)
{
return;
@@ -1302,7 +1244,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_autopilotMoving)
CheckAtSitTarget();
- if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
+ if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
{
// TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value
@@ -1335,13 +1277,13 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor.Flying = false;
else
PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
-
+
if (PhysicsActor.Flying != oldflying)
{
update_movementflag = true;
}
}
-
+
if (q != m_bodyRot)
{
m_bodyRot = q;
@@ -1357,15 +1299,15 @@ namespace OpenSim.Region.Framework.Scenes
// use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
// this prevents 'jumping' in inappropriate situations.
- if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying))
+ if ((m_mouseLook && !m_physicsActor.Flying) || (m_leftButtonDown && !m_physicsActor.Flying))
dirVectors = GetWalkDirectionVectors();
else
dirVectors = Dir_Vectors;
- foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
+ foreach (Dir_ControlFlags DCF in m_dirControlFlags)
{
- if ((flags & (uint) DCF) != 0)
+ if ((flags & (uint)DCF) != 0)
{
bResetMoveToPosition = true;
DCFlagKeyPressed = true;
@@ -1377,18 +1319,18 @@ namespace OpenSim.Region.Framework.Scenes
{
// Why did I get this?
}
-
- if ((m_movementflag & (uint) DCF) == 0)
+
+ if ((m_movementflag & (uint)DCF) == 0)
{
- m_movementflag += (byte) (uint) DCF;
+ m_movementflag += (byte)(uint)DCF;
update_movementflag = true;
}
}
else
{
- if ((m_movementflag & (uint) DCF) != 0)
+ if ((m_movementflag & (uint)DCF) != 0)
{
- m_movementflag -= (byte) (uint) DCF;
+ m_movementflag -= (byte)(uint)DCF;
update_movementflag = true;
}
else
@@ -1479,14 +1421,12 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception)
{
-
//Avoid system crash, can be slower but...
}
-
}
}
}
-
+
// Cause the avatar to stop flying if it's colliding
// with something with the down arrow pressed.
@@ -1494,8 +1434,8 @@ namespace OpenSim.Region.Framework.Scenes
if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly)
{
// Are the landing controls requirements filled?
- bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
- ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
+ bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
+ ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
// Are the collision requirements fulfilled?
bool colliding = (m_physicsActor.IsColliding == true);
@@ -1508,10 +1448,10 @@ namespace OpenSim.Region.Framework.Scenes
if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{
-// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
-// m_log.DebugFormat(
-// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
-
+ // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
+ // m_log.DebugFormat(
+ // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
+
AddNewMovement(agent_control_v3, q);
if (update_movementflag)
--
cgit v1.1