aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2010-06-09 16:48:37 +0100
committerMelanie2010-06-09 16:48:37 +0100
commit6b2d2413f7026c41e7abb55c72c583670cb6011d (patch)
tree6596f0132d36f74f2e57c9b1bd891d95eb0e5a33 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentAdd the BEGIN; I had missed (diff)
downloadopensim-SC_OLD-6b2d2413f7026c41e7abb55c72c583670cb6011d.zip
opensim-SC_OLD-6b2d2413f7026c41e7abb55c72c583670cb6011d.tar.gz
opensim-SC_OLD-6b2d2413f7026c41e7abb55c72c583670cb6011d.tar.bz2
opensim-SC_OLD-6b2d2413f7026c41e7abb55c72c583670cb6011d.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs56
3 files changed, 55 insertions, 62 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 48ffbce..e80dff7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -362,6 +362,7 @@ namespace OpenSim.Region.Framework.Scenes
362 private int m_update_backup = 200; 362 private int m_update_backup = 200;
363 private int m_update_terrain = 50; 363 private int m_update_terrain = 50;
364 private int m_update_land = 1; 364 private int m_update_land = 1;
365 private int m_update_coarse_locations = 50;
365 366
366 private int frameMS; 367 private int frameMS;
367 private int physicsMS2; 368 private int physicsMS2;
@@ -1445,6 +1446,18 @@ namespace OpenSim.Region.Framework.Scenes
1445 if (m_frame % m_update_objects == 0) 1446 if (m_frame % m_update_objects == 0)
1446 m_sceneGraph.UpdateObjectGroups(); 1447 m_sceneGraph.UpdateObjectGroups();
1447 1448
1449 if (m_frame % m_update_coarse_locations == 0)
1450 {
1451 List<Vector3> coarseLocations;
1452 List<UUID> avatarUUIDs;
1453 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
1454 // Send coarse locations to clients
1455 ForEachScenePresence(delegate(ScenePresence presence)
1456 {
1457 presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
1458 });
1459 }
1460
1448 int tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1461 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1449 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1462 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1450 m_sceneGraph.UpdatePreparePhysics(); 1463 m_sceneGraph.UpdatePreparePhysics();
@@ -3329,9 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes
3329 catch (NullReferenceException) { } 3342 catch (NullReferenceException) { }
3330 }); 3343 });
3331 3344
3332 ForEachScenePresence(
3333 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
3334
3335 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); 3345 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
3336 if (agentTransactions != null) 3346 if (agentTransactions != null)
3337 { 3347 {
@@ -3383,14 +3393,6 @@ namespace OpenSim.Region.Framework.Scenes
3383 } 3393 }
3384 } 3394 }
3385 3395
3386 /// <summary>
3387 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
3388 /// </summary>
3389 public void NotifyMyCoarseLocationChange()
3390 {
3391 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
3392 }
3393
3394 #endregion 3396 #endregion
3395 3397
3396 #region Entities 3398 #region Entities
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1dab4df..80f9114 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -211,6 +211,43 @@ namespace OpenSim.Region.Framework.Scenes
211 }); 211 });
212 } 212 }
213 213
214 public void GetCoarseLocations(out List<Vector3> coarseLocations, out List<UUID> avatarUUIDs, uint maxLocations)
215 {
216 coarseLocations = new List<Vector3>();
217 avatarUUIDs = new List<UUID>();
218
219 List<ScenePresence> presences = GetScenePresences();
220 for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
221 {
222 ScenePresence sp = presences[i];
223 // If this presence is a child agent, we don't want its coarse locations
224 if (sp.IsChildAgent)
225 return;
226
227 if (sp.ParentID != 0)
228 {
229 // sitting avatar
230 SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
231 if (sop != null)
232 {
233 coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
234 avatarUUIDs.Add(sp.UUID);
235 }
236 else
237 {
238 // we can't find the parent.. ! arg!
239 coarseLocations.Add(sp.AbsolutePosition);
240 avatarUUIDs.Add(sp.UUID);
241 }
242 }
243 else
244 {
245 coarseLocations.Add(sp.AbsolutePosition);
246 avatarUUIDs.Add(sp.UUID);
247 }
248 }
249 }
250
214 #endregion 251 #endregion
215 252
216 #region Entity Methods 253 #region Entity Methods
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e3bbe8a..8cd3ac6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes
66 public ScriptControlled eventControls; 66 public ScriptControlled eventControls;
67 } 67 }
68 68
69 public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence); 69 public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
70 70
71 public class ScenePresence : EntityBase, ISceneEntity 71 public class ScenePresence : EntityBase, ISceneEntity
72 { 72 {
@@ -178,8 +178,6 @@ namespace OpenSim.Region.Framework.Scenes
178 178
179 public string JID = String.Empty; 179 public string JID = String.Empty;
180 180
181 // Agent moves with a PID controller causing a force to be exerted.
182 private bool m_newCoarseLocations = true;
183 private float m_health = 100f; 181 private float m_health = 100f;
184 182
185 // Default AV Height 183 // Default AV Height
@@ -2548,12 +2546,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2548 2546
2549 2547
2550 2548
2551 if (m_newCoarseLocations)
2552 {
2553 SendCoarseLocations();
2554 m_newCoarseLocations = false;
2555 }
2556
2557 if (m_isChildAgent == false) 2549 if (m_isChildAgent == false)
2558 { 2550 {
2559// PhysicsActor actor = m_physicsActor; 2551// PhysicsActor actor = m_physicsActor;
@@ -2630,12 +2622,12 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2630 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2622 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2631 } 2623 }
2632 2624
2633 public void SendCoarseLocations() 2625 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2634 { 2626 {
2635 SendCourseLocationsMethod d = m_sendCourseLocationsMethod; 2627 SendCourseLocationsMethod d = m_sendCourseLocationsMethod;
2636 if (d != null) 2628 if (d != null)
2637 { 2629 {
2638 d.Invoke(m_scene.RegionInfo.originRegionID, this); 2630 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
2639 } 2631 }
2640 } 2632 }
2641 2633
@@ -2645,50 +2637,13 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2645 m_sendCourseLocationsMethod = d; 2637 m_sendCourseLocationsMethod = d;
2646 } 2638 }
2647 2639
2648 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) 2640 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2649 { 2641 {
2650 m_perfMonMS = Util.EnvironmentTickCount(); 2642 m_perfMonMS = Util.EnvironmentTickCount();
2651 2643 m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2652 List<Vector3> CoarseLocations = new List<Vector3>();
2653 List<UUID> AvatarUUIDs = new List<UUID>();
2654 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
2655 {
2656 if (sp.IsChildAgent)
2657 return;
2658
2659 if (sp.ParentID != 0)
2660 {
2661 // sitting avatar
2662 SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID);
2663 if (sop != null)
2664 {
2665 CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos);
2666 AvatarUUIDs.Add(sp.UUID);
2667 }
2668 else
2669 {
2670 // we can't find the parent.. ! arg!
2671 CoarseLocations.Add(sp.m_pos);
2672 AvatarUUIDs.Add(sp.UUID);
2673 }
2674 }
2675 else
2676 {
2677 CoarseLocations.Add(sp.m_pos);
2678 AvatarUUIDs.Add(sp.UUID);
2679 }
2680 });
2681
2682 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2683
2684 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2644 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2685 } 2645 }
2686 2646
2687 public void CoarseLocationChange()
2688 {
2689 m_newCoarseLocations = true;
2690 }
2691
2692 /// <summary> 2647 /// <summary>
2693 /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) 2648 /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar)
2694 /// </summary> 2649 /// </summary>
@@ -2923,7 +2878,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2923 { 2878 {
2924 posLastSignificantMove = AbsolutePosition; 2879 posLastSignificantMove = AbsolutePosition;
2925 m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); 2880 m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
2926 m_scene.NotifyMyCoarseLocationChange();
2927 } 2881 }
2928 2882
2929 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m 2883 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m