aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-15 15:25:02 -0700
committerJohn Hurliman2009-10-15 15:25:02 -0700
commitd44b50ee462978b4899c0b142f6ecbfb553f06b6 (patch)
tree650046925796d20c18ed2e2028f951286d93662d /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.zip
opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.gz
opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.bz2
opensim-SC_OLD-d44b50ee462978b4899c0b142f6ecbfb553f06b6.tar.xz
* 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)
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs11
4 files changed, 15 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d3d397d..d13d4fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1194,15 +1194,6 @@ namespace OpenSim.Region.Framework.Scenes
1194 } 1194 }
1195 1195
1196 /// <summary> 1196 /// <summary>
1197 /// Perform delegate action on all clients subscribing to updates from this region.
1198 /// </summary>
1199 /// <returns></returns>
1200 public void Broadcast(Action<IClientAPI> whatToDo)
1201 {
1202 ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); });
1203 }
1204
1205 /// <summary>
1206 /// Backup the scene. This acts as the main method of the backup thread. 1197 /// Backup the scene. This acts as the main method of the backup thread.
1207 /// </summary> 1198 /// </summary>
1208 /// <returns></returns> 1199 /// <returns></returns>
@@ -3048,17 +3039,13 @@ namespace OpenSim.Region.Framework.Scenes
3048 } 3039 }
3049 3040
3050 m_eventManager.TriggerOnRemovePresence(agentID); 3041 m_eventManager.TriggerOnRemovePresence(agentID);
3051 Broadcast(delegate(IClientAPI client) 3042 ForEachClient(
3052 { 3043 delegate(IClientAPI client)
3053 try 3044 {
3054 { 3045 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
3055 client.SendKillObject(avatar.RegionHandle, avatar.LocalId); 3046 try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }
3056 } 3047 catch (NullReferenceException) { }
3057 catch (NullReferenceException) 3048 });
3058 {
3059 //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
3060 }
3061 });
3062 3049
3063 ForEachScenePresence( 3050 ForEachScenePresence(
3064 delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 3051 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@@ -3143,7 +3130,7 @@ namespace OpenSim.Region.Framework.Scenes
3143 return; 3130 return;
3144 } 3131 }
3145 } 3132 }
3146 Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); 3133 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
3147 } 3134 }
3148 3135
3149 #endregion 3136 #endregion
@@ -4211,7 +4198,7 @@ namespace OpenSim.Region.Framework.Scenes
4211 4198
4212 public void ForEachClient(Action<IClientAPI> action) 4199 public void ForEachClient(Action<IClientAPI> action)
4213 { 4200 {
4214 m_sceneGraph.ForEachClient(action); 4201 ClientManager.ForEach(action);
4215 } 4202 }
4216 4203
4217 public void ForEachSOG(Action<SceneObjectGroup> action) 4204 public void ForEachSOG(Action<SceneObjectGroup> action)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 9cd2247..04397ad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1107,23 +1107,6 @@ namespace OpenSim.Region.Framework.Scenes
1107 return UUID.Zero; 1107 return UUID.Zero;
1108 } 1108 }
1109 1109
1110 protected internal void ForEachClient(Action<IClientAPI> action)
1111 {
1112 List<ScenePresence> splist = GetScenePresences();
1113 foreach (ScenePresence presence in splist)
1114 {
1115 try
1116 {
1117 action(presence.ControllingClient);
1118 }
1119 catch (Exception e)
1120 {
1121 // Catch it and move on. This includes situations where splist has inconsistent info
1122 m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message);
1123 }
1124 }
1125 }
1126
1127 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1110 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1128 { 1111 {
1129 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1112 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 801a7db..377cb6e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -853,16 +853,6 @@ if (m_shape != null) {
853 return m_offsetPosition + m_groupPosition; } 853 return m_offsetPosition + m_groupPosition; }
854 } 854 }
855 855
856 public UUID ObjectCreator
857 {
858 get { return _creatorID; }
859 }
860
861 public UUID ObjectOwner
862 {
863 get { return _ownerID; }
864 }
865
866 public SceneObjectGroup ParentGroup 856 public SceneObjectGroup ParentGroup
867 { 857 {
868 get { return m_parentGroup; } 858 get { return m_parentGroup; }
@@ -1440,7 +1430,7 @@ if (m_shape != null) {
1440 // Move afterwards ResetIDs as it clears the localID 1430 // Move afterwards ResetIDs as it clears the localID
1441 dupe.LocalId = localID; 1431 dupe.LocalId = localID;
1442 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1432 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1443 dupe._lastOwnerID = ObjectOwner; 1433 dupe._lastOwnerID = OwnerID;
1444 1434
1445 byte[] extraP = new byte[Shape.ExtraParams.Length]; 1435 byte[] extraP = new byte[Shape.ExtraParams.Length];
1446 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 1436 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
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
2455 m_perfMonMS = Environment.TickCount; 2455 m_perfMonMS = Environment.TickCount;
2456 2456
2457 Vector3 pos = m_pos; 2457 Vector3 pos = m_pos;
2458 Vector3 vel = Velocity;
2459 Quaternion rot = m_bodyRot;
2460 pos.Z -= m_appearance.HipOffset; 2458 pos.Z -= m_appearance.HipOffset;
2461 remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), 2459
2462 new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid); 2460 remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
2461 LocalId, pos, Velocity, m_bodyRot, m_uuid);
2463 2462
2464 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2463 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2465 m_scene.StatsReporter.AddAgentUpdates(1); 2464 m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2473,7 +2472,7 @@ namespace OpenSim.Region.Framework.Scenes
2473 { 2472 {
2474 m_perfMonMS = Environment.TickCount; 2473 m_perfMonMS = Environment.TickCount;
2475 2474
2476 m_scene.Broadcast(SendTerseUpdateToClient); 2475 m_scene.ForEachClient(SendTerseUpdateToClient);
2477 2476
2478 m_lastVelocity = m_velocity; 2477 m_lastVelocity = m_velocity;
2479 lastPhysPos = AbsolutePosition; 2478 lastPhysPos = AbsolutePosition;
@@ -2774,7 +2773,7 @@ namespace OpenSim.Region.Framework.Scenes
2774 if (m_isChildAgent) 2773 if (m_isChildAgent)
2775 return; 2774 return;
2776 2775
2777 m_scene.Broadcast( 2776 m_scene.ForEachClient(
2778 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); }); 2777 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); });
2779 } 2778 }
2780 2779