aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs2
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs150
3 files changed, 96 insertions, 62 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 1b690ba..9377564 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -90,6 +90,8 @@ namespace OpenSim.Region.Framework.Interfaces
90 void AgentArrivedAtDestination(UUID agent); 90 void AgentArrivedAtDestination(UUID agent);
91 91
92 void EnableChildAgents(ScenePresence agent); 92 void EnableChildAgents(ScenePresence agent);
93 void CheckChildAgents(ScenePresence agent);
94 void CloseOldChildAgents(ScenePresence agent);
93 95
94 void EnableChildAgent(ScenePresence agent, GridRegion region); 96 void EnableChildAgent(ScenePresence agent, GridRegion region);
95 97
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7d312e9..e130bd7 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1286,7 +1286,6 @@ namespace OpenSim.Region.Framework.Scenes
1286 { 1286 {
1287 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 1287 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
1288 { 1288 {
1289
1290 if (isNeighborRegion(otherRegion)) 1289 if (isNeighborRegion(otherRegion))
1291 { 1290 {
1292 // Let the grid service module know, so this can be cached 1291 // Let the grid service module know, so this can be cached
@@ -1296,9 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes
1296 { 1295 {
1297 ForEachRootScenePresence(delegate(ScenePresence agent) 1296 ForEachRootScenePresence(delegate(ScenePresence agent)
1298 { 1297 {
1299 //agent.ControllingClient.new
1300 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
1301
1302 List<ulong> old = new List<ulong>(); 1298 List<ulong> old = new List<ulong>();
1303 old.Add(otherRegion.RegionHandle); 1299 old.Add(otherRegion.RegionHandle);
1304 agent.DropOldNeighbours(old); 1300 agent.DropOldNeighbours(old);
@@ -1324,7 +1320,7 @@ namespace OpenSim.Region.Framework.Scenes
1324 1320
1325 public bool isNeighborRegion(GridRegion otherRegion) 1321 public bool isNeighborRegion(GridRegion otherRegion)
1326 { 1322 {
1327 int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ; 1323 int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX;
1328 1324
1329 if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) 1325 if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX)
1330 return false; 1326 return false;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index be593ad..fbf9b4a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -165,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes
165 public static readonly float MOVEMENT = .25f; 165 public static readonly float MOVEMENT = .25f;
166 public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; 166 public static readonly float SIGNIFICANT_MOVEMENT = 16.0f;
167 public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; 167 public static readonly float CHILDUPDATES_MOVEMENT = 100.0f;
168 public static readonly float CHILDAGENTSCHECK_MOVEMENT = 1024f; // 32m
168 public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) 169 public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms)
169 170
170 private UUID m_previusParcelUUID = UUID.Zero; 171 private UUID m_previusParcelUUID = UUID.Zero;
@@ -342,7 +343,8 @@ namespace OpenSim.Region.Framework.Scenes
342 private int m_lastChildAgentUpdateGodLevel; 343 private int m_lastChildAgentUpdateGodLevel;
343 private float m_lastChildAgentUpdateDrawDistance; 344 private float m_lastChildAgentUpdateDrawDistance;
344 private Vector3 m_lastChildAgentUpdatePosition; 345 private Vector3 m_lastChildAgentUpdatePosition;
345// private Vector3 m_lastChildAgentUpdateCamPosition; 346 private Vector3 m_lastChildAgentCheckPosition;
347 // private Vector3 m_lastChildAgentUpdateCamPosition;
346 348
347 private Vector3 m_lastCameraRayCastCam; 349 private Vector3 m_lastCameraRayCastCam;
348 private Vector3 m_lastCameraRayCastPos; 350 private Vector3 m_lastCameraRayCastPos;
@@ -627,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes
627 { 629 {
628 get 630 get
629 { 631 {
630 return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); 632 return Util.Clamp(m_drawDistance + 64f, 64f, m_scene.MaxRegionViewDistance);
631 } 633 }
632 } 634 }
633 635
@@ -2321,6 +2323,7 @@ namespace OpenSim.Region.Framework.Scenes
2321 2323
2322 m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; 2324 m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
2323 m_lastChildAgentUpdatePosition = AbsolutePosition; 2325 m_lastChildAgentUpdatePosition = AbsolutePosition;
2326 m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition;
2324 m_lastChildAgentUpdateDrawDistance = DrawDistance; 2327 m_lastChildAgentUpdateDrawDistance = DrawDistance;
2325 2328
2326 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; 2329 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
@@ -4049,20 +4052,11 @@ namespace OpenSim.Region.Framework.Scenes
4049 //NeedInitialData = 4; 4052 //NeedInitialData = 4;
4050 //return; 4053 //return;
4051 } 4054 }
4052
4053 // Create child agents in neighbouring regions
4054 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 4055 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
4055 if (m_agentTransfer != null) 4056 if (m_agentTransfer != null)
4056 { 4057 {
4057 m_agentTransfer.EnableChildAgents(this); 4058 m_agentTransfer.CloseOldChildAgents(this);
4058 } 4059 }
4059
4060 m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
4061 m_lastChildAgentUpdatePosition = AbsolutePosition;
4062 m_lastChildAgentUpdateDrawDistance = DrawDistance;
4063
4064 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
4065 m_childUpdatesBusy = false; // allow them
4066 } 4060 }
4067 4061
4068 m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); 4062 m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID);
@@ -4126,6 +4120,24 @@ namespace OpenSim.Region.Framework.Scenes
4126 4120
4127 m_reprioritizationBusy = false; 4121 m_reprioritizationBusy = false;
4128 } 4122 }
4123
4124 if (!IsChildAgent)
4125 {
4126 // Create child agents in neighbouring regions
4127 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
4128 if (m_agentTransfer != null)
4129 {
4130 m_agentTransfer.EnableChildAgents(this);
4131 }
4132
4133 m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
4134 m_lastChildAgentUpdatePosition = AbsolutePosition;
4135 m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition;
4136 m_lastChildAgentUpdateDrawDistance = DrawDistance;
4137
4138 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
4139 m_childUpdatesBusy = false; // allow them
4140 }
4129 }); 4141 });
4130 4142
4131 } 4143 }
@@ -4399,56 +4411,80 @@ namespace OpenSim.Region.Framework.Scenes
4399 if(m_childUpdatesBusy) 4411 if(m_childUpdatesBusy)
4400 return; 4412 return;
4401 4413
4402 //possible KnownRegionHandles always contains current region and this check is not needed 4414 int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime);
4403 int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; 4415 if (tdiff < CHILDUPDATES_TIME)
4404 if(KnownRegionHandles.Count > minhandles) 4416 return;
4405 {
4406 int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime);
4407 if(tdiff < CHILDUPDATES_TIME)
4408 return;
4409 4417
4410 bool doUpdate = false; 4418 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
4411 if(m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) 4419 float dx = pos.X - m_lastChildAgentCheckPosition.Y;
4412 doUpdate = true; 4420 float dy = pos.Y - m_lastChildAgentCheckPosition.Y;
4413 4421 if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT))
4414 if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) 4422 {
4415 doUpdate = true; 4423 m_childUpdatesBusy = true;
4424 m_lastChildAgentCheckPosition = pos;
4425 m_lastChildAgentUpdatePosition = pos;
4426 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
4427 m_lastChildAgentUpdateDrawDistance = DrawDistance;
4428 // m_lastChildAgentUpdateCamPosition = CameraPosition;
4416 4429
4417 if(!doUpdate) 4430 Util.FireAndForget(
4431 o =>
4432 {
4433 m_agentTransfer.EnableChildAgents(this);
4434 m_lastChildUpdatesTime = Util.EnvironmentTickCount();
4435 m_childUpdatesBusy = false;
4436 }, null, "ScenePresence.CheckChildAgents");
4437 }
4438 else
4439 {
4440 //possible KnownRegionHandles always contains current region and this check is not needed
4441 int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0;
4442 if(KnownRegionHandles.Count > minhandles)
4418 { 4443 {
4419 diff = pos - m_lastChildAgentUpdatePosition; 4444 bool doUpdate = false;
4420 if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) 4445 if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel)
4421 doUpdate = true; 4446 doUpdate = true;
4422 }
4423 4447
4424 if(doUpdate) 4448 bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f;
4425 { 4449 if (!viewchanged)
4426 m_childUpdatesBusy = true; 4450 doUpdate = true;
4427 m_lastChildAgentUpdatePosition = pos; 4451
4428 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; 4452 if(!doUpdate)
4429 m_lastChildAgentUpdateDrawDistance = DrawDistance; 4453 {
4430// m_lastChildAgentUpdateCamPosition = CameraPosition; 4454 diff = pos - m_lastChildAgentUpdatePosition;
4431 4455 if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT)
4432 AgentPosition agentpos = new AgentPosition(); 4456 doUpdate = true;
4433 agentpos.AgentID = new UUID(UUID.Guid); 4457 }
4434 agentpos.SessionID = ControllingClient.SessionId; 4458
4435 agentpos.Size = Appearance.AvatarSize; 4459 if (doUpdate)
4436 agentpos.Center = CameraPosition; 4460 {
4437 agentpos.Far = DrawDistance; 4461 m_childUpdatesBusy = true;
4438 agentpos.Position = AbsolutePosition; 4462 m_lastChildAgentUpdatePosition = pos;
4439 agentpos.Velocity = Velocity; 4463 m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel;
4440 agentpos.RegionHandle = RegionHandle; 4464 m_lastChildAgentUpdateDrawDistance = DrawDistance;
4441 agentpos.GodData = GodController.State(); 4465 // m_lastChildAgentUpdateCamPosition = CameraPosition;
4442 agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); 4466
4443 4467 AgentPosition agentpos = new AgentPosition();
4444 // Let's get this out of the update loop 4468 agentpos.AgentID = new UUID(UUID.Guid);
4445 Util.FireAndForget( 4469 agentpos.SessionID = ControllingClient.SessionId;
4446 o => 4470 agentpos.Size = Appearance.AvatarSize;
4447 { 4471 agentpos.Center = CameraPosition;
4448 m_scene.SendOutChildAgentUpdates(agentpos, this); 4472 agentpos.Far = DrawDistance;
4449 m_lastChildUpdatesTime = Util.EnvironmentTickCount(); 4473 agentpos.Position = AbsolutePosition;
4450 m_childUpdatesBusy = false; 4474 agentpos.Velocity = Velocity;
4451 }, null, "ScenePresence.SendOutChildAgentUpdates"); 4475 agentpos.RegionHandle = RegionHandle;
4476 agentpos.GodData = GodController.State();
4477 agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);
4478
4479 // Let's get this out of the update loop
4480 Util.FireAndForget(
4481 o =>
4482 {
4483 m_scene.SendOutChildAgentUpdates(agentpos, this);
4484 m_lastChildUpdatesTime = Util.EnvironmentTickCount();
4485 m_childUpdatesBusy = false;
4486 }, null, "ScenePresence.SendOutChildAgentUpdates");
4487 }
4452 } 4488 }
4453 } 4489 }
4454 } 4490 }