aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorlbsa712007-09-21 04:58:40 +0000
committerlbsa712007-09-21 04:58:40 +0000
commitb9808f831428876ec9ede8ce87a159566b97a850 (patch)
tree749ef670d6c4e6051a844d4c9c12073bebfe1e59 /OpenSim/Region/Environment/Scenes
parent* Continuing refactoring of presence (diff)
downloadopensim-SC-b9808f831428876ec9ede8ce87a159566b97a850.zip
opensim-SC-b9808f831428876ec9ede8ce87a159566b97a850.tar.gz
opensim-SC-b9808f831428876ec9ede8ce87a159566b97a850.tar.bz2
opensim-SC-b9808f831428876ec9ede8ce87a159566b97a850.tar.xz
* First example of moving stuff to a Region layer
* Also, changed RegionPresence to 'RegionSubscription' - let's just see where we land with this...
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs34
4 files changed, 24 insertions, 46 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 55d760e..62e7941 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -49,6 +49,7 @@ using OpenSim.Region.Environment.Types;
49using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
50using OpenSim.Region.Terrain; 50using OpenSim.Region.Terrain;
51using Timer = System.Timers.Timer; 51using Timer = System.Timers.Timer;
52using OpenSim.Region.Environment.Regions;
52 53
53namespace OpenSim.Region.Environment.Scenes 54namespace OpenSim.Region.Environment.Scenes
54{ 55{
@@ -63,6 +64,8 @@ namespace OpenSim.Region.Environment.Scenes
63 /// publicized so it can be accessed from SceneObjectGroup. 64 /// publicized so it can be accessed from SceneObjectGroup.
64 protected float timeStep = 0.1f; 65 protected float timeStep = 0.1f;
65 66
67 private Regions.Region m_region;
68
66 private Random Rand = new Random(); 69 private Random Rand = new Random();
67 private uint _primCount = 702000; 70 private uint _primCount = 702000;
68 private readonly Mutex _primAllocateMutex = new Mutex(false); 71 private readonly Mutex _primAllocateMutex = new Mutex(false);
@@ -159,6 +162,8 @@ namespace OpenSim.Region.Environment.Scenes
159 { 162 {
160 updateLock = new Mutex(false); 163 updateLock = new Mutex(false);
161 164
165 m_region = new Regions.Region(this);
166
162 m_moduleLoader = moduleLoader; 167 m_moduleLoader = moduleLoader;
163 authenticateHandler = authen; 168 authenticateHandler = authen;
164 commsManager = commsMan; 169 commsManager = commsMan;
@@ -302,7 +307,7 @@ namespace OpenSim.Region.Environment.Scenes
302 307
303 float[] terData = Terrain.GetHeights1D(); 308 float[] terData = Terrain.GetHeights1D();
304 309
305 ForEachScenePresence(delegate(ScenePresence presence) 310 Broadcast( delegate( IClientAPI client )
306 { 311 {
307 for (int x = 0; x < 16; x++) 312 for (int x = 0; x < 16; x++)
308 { 313 {
@@ -310,8 +315,7 @@ namespace OpenSim.Region.Environment.Scenes
310 { 315 {
311 if (Terrain.Tainted(x * 16, y * 16)) 316 if (Terrain.Tainted(x * 16, y * 16))
312 { 317 {
313 SendLayerData(x, y, presence.ControllingClient, 318 client.SendLayerData(x, y, terData);
314 terData);
315 } 319 }
316 } 320 }
317 } 321 }
@@ -366,6 +370,10 @@ namespace OpenSim.Region.Environment.Scenes
366 updateLock.ReleaseMutex(); 370 updateLock.ReleaseMutex();
367 } 371 }
368 372
373 internal void Broadcast(Action<IClientAPI> whatToDo)
374 {
375 m_region.Broadcast( whatToDo );
376 }
369 /// <summary> 377 /// <summary>
370 /// 378 ///
371 /// </summary> 379 /// </summary>
@@ -396,7 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
396 404
397 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 405 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
398 406
399 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); }); 407 Broadcast(delegate(IClientAPI client ) { SendLayerData( client ); });
400 408
401 foreach (LLUUID UUID in Entities.Keys) 409 foreach (LLUUID UUID in Entities.Keys)
402 { 410 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 7b2e17f..fc81d5f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -88,17 +88,6 @@ namespace OpenSim.Region.Environment.Scenes
88 RemoteClient.SendLayerData(Terrain.GetHeights1D()); 88 RemoteClient.SendLayerData(Terrain.GetHeights1D());
89 } 89 }
90 90
91 /// <summary>
92 /// Sends a specified patch to a client
93 /// </summary>
94 /// <param name="px">Patch coordinate (x) 0..16</param>
95 /// <param name="py">Patch coordinate (y) 0..16</param>
96 /// <param name="RemoteClient">The client to send to</param>
97 public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient, float[] terrain)
98 {
99 RemoteClient.SendLayerData(px, py, terrain);
100 }
101
102 #endregion 91 #endregion
103 92
104 #region Add/Remove Agent/Avatar 93 #region Add/Remove Agent/Avatar
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 468def0..406db9b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -777,10 +777,6 @@ namespace OpenSim.Region.Environment.Scenes
777 m_parentGroup.SendPartTerseUpdate(remoteClient, this); 777 m_parentGroup.SendPartTerseUpdate(remoteClient, this);
778 } 778 }
779 779
780 /// <summary>
781 ///
782 /// </summary>
783 /// <param name="RemoteClient"></param>
784 public void SendTerseUpdateToClient(IClientAPI remoteClient) 780 public void SendTerseUpdateToClient(IClientAPI remoteClient)
785 { 781 {
786 LLVector3 lPos; 782 LLVector3 lPos;
@@ -789,11 +785,6 @@ namespace OpenSim.Region.Environment.Scenes
789 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 785 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
790 } 786 }
791 787
792 /// <summary>
793 ///
794 /// </summary>
795 /// <param name="remoteClient"></param>
796 /// <param name="lPos"></param>
797 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 788 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
798 { 789 {
799 LLQuaternion mRot = RotationOffset; 790 LLQuaternion mRot = RotationOffset;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 23e1035..41e555a 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -69,8 +69,6 @@ namespace OpenSim.Region.Environment.Scenes
69 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 69 private readonly Vector3[] Dir_Vectors = new Vector3[6];
70 private LLVector3 lastPhysPos = new LLVector3(); 70 private LLVector3 lastPhysPos = new LLVector3();
71 71
72 private RegionPresence m_regionPresence;
73
74 private enum Dir_ControlFlags 72 private enum Dir_ControlFlags
75 { 73 {
76 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, 74 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
@@ -216,6 +214,13 @@ namespace OpenSim.Region.Environment.Scenes
216 set { m_isChildAgent = value; } 214 set { m_isChildAgent = value; }
217 } 215 }
218 216
217 private RegionSubscription m_regionSubscription;
218
219 public RegionSubscription RegionSubscription
220 {
221 get { return m_regionSubscription; }
222 }
223
219 #endregion 224 #endregion
220 225
221 #region Constructor(s) 226 #region Constructor(s)
@@ -229,7 +234,7 @@ namespace OpenSim.Region.Environment.Scenes
229 /// <param name="regionDat"></param> 234 /// <param name="regionDat"></param>
230 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) 235 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo)
231 { 236 {
232 m_regionPresence = new RegionPresence( client ); 237 m_regionSubscription = new RegionSubscription( client );
233 238
234 m_scene = world; 239 m_scene = world;
235 m_uuid = client.AgentId; 240 m_uuid = client.AgentId;
@@ -331,21 +336,6 @@ namespace OpenSim.Region.Environment.Scenes
331 336
332 #region Status Methods 337 #region Status Methods
333 338
334 /// <summary>
335 /// Not Used, most likely can be deleted
336 /// </summary>
337 /// <param name="status"></param>
338 public void ChildStatusChange(bool status)
339 {
340 m_isChildAgent = status;
341
342 if (m_isChildAgent == true)
343 {
344 Velocity = new LLVector3(0, 0, 0);
345 AbsolutePosition = new LLVector3(128, 128, 70);
346 }
347 }
348
349 public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) 339 public void MakeAvatarPhysical(LLVector3 pos, bool isFlying)
350 { 340 {
351 newAvatar = true; 341 newAvatar = true;
@@ -425,7 +415,9 @@ namespace OpenSim.Region.Environment.Scenes
425 { 415 {
426 look = new LLVector3(0.99f, 0.042f, 0); 416 look = new LLVector3(0.99f, 0.042f, 0);
427 } 417 }
418
428 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 419 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
420
429 if (m_isChildAgent) 421 if (m_isChildAgent)
430 { 422 {
431 m_isChildAgent = false; 423 m_isChildAgent = false;
@@ -434,10 +426,6 @@ namespace OpenSim.Region.Environment.Scenes
434 } 426 }
435 } 427 }
436 428
437 /// <summary>
438 ///
439 /// </summary>
440 /// <param name="pack"></param>
441 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 429 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
442 { 430 {
443 if (m_isChildAgent) 431 if (m_isChildAgent)
@@ -445,6 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
445 Console.WriteLine("DEBUG: HandleAgentUpdate: child agent"); 433 Console.WriteLine("DEBUG: HandleAgentUpdate: child agent");
446 return; 434 return;
447 } 435 }
436
448 if(PhysicsActor==null) { 437 if(PhysicsActor==null) {
449 Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 438 Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
450 return; 439 return;
@@ -526,6 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
526 Console.WriteLine("DEBUG: AddNewMovement: child agent"); 515 Console.WriteLine("DEBUG: AddNewMovement: child agent");
527 return; 516 return;
528 } 517 }
518
529 NewForce newVelocity = new NewForce(); 519 NewForce newVelocity = new NewForce();
530 Vector3 direc = rotation*vec; 520 Vector3 direc = rotation*vec;
531 direc.Normalize(); 521 direc.Normalize();