diff options
author | MW | 2007-07-01 17:26:33 +0000 |
---|---|---|
committer | MW | 2007-07-01 17:26:33 +0000 |
commit | 9800c05c1b3c7804466d6f3a9c38a739156625fd (patch) | |
tree | d4776d600e2ca547214ac3dcf2f4a0407e28ac5e /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * now saves ExternalHostName in config (diff) | |
download | opensim-SC-9800c05c1b3c7804466d6f3a9c38a739156625fd.zip opensim-SC-9800c05c1b3c7804466d6f3a9c38a739156625fd.tar.gz opensim-SC-9800c05c1b3c7804466d6f3a9c38a739156625fd.tar.bz2 opensim-SC-9800c05c1b3c7804466d6f3a9c38a739156625fd.tar.xz |
Started change to having SceneObject and then that having child Primitives which in turn have a Shape object (currently PrimitiveBaseShape). The plan is only for the SceneObject to interface with the physics engines. As a physics Entity should be able to have mulitple shapes connected to it.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 131 |
1 files changed, 45 insertions, 86 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dbf385d..2ff3976 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -63,12 +63,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
63 | private uint _primCount = 702000; | 63 | private uint _primCount = 702000; |
64 | private int storageCount; | 64 | private int storageCount; |
65 | private Mutex updateLock; | 65 | private Mutex updateLock; |
66 | 66 | ||
67 | protected AuthenticateSessionsBase authenticateHandler; | 67 | protected AuthenticateSessionsBase authenticateHandler; |
68 | protected RegionCommsListener regionCommsHost; | 68 | protected RegionCommsListener regionCommsHost; |
69 | protected CommunicationsManager commsManager; | 69 | protected CommunicationsManager commsManager; |
70 | 70 | ||
71 | protected Dictionary<LLUUID,Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); | 71 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); |
72 | protected BaseHttpServer httpListener; | 72 | protected BaseHttpServer httpListener; |
73 | 73 | ||
74 | public ParcelManager parcelManager; | 74 | public ParcelManager parcelManager; |
@@ -121,21 +121,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
121 | scriptManager = new ScriptManager(this); | 121 | scriptManager = new ScriptManager(this); |
122 | eventManager = new EventManager(); | 122 | eventManager = new EventManager(); |
123 | 123 | ||
124 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); | 124 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); |
125 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | 125 | Entities = new Dictionary<libsecondlife.LLUUID, EntityBase>(); |
126 | Avatars = new Dictionary<LLUUID, ScenePresence>(); | 126 | Avatars = new Dictionary<LLUUID, ScenePresence>(); |
127 | Prims = new Dictionary<LLUUID, Primitive>(); | 127 | Prims = new Dictionary<LLUUID, Primitive>(); |
128 | 128 | ||
129 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); | 129 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); |
130 | Terrain = new TerrainEngine(); | 130 | Terrain = new TerrainEngine(); |
131 | 131 | ||
132 | ScenePresence.LoadAnims(); | 132 | ScenePresence.LoadAnims(); |
133 | this.httpListener = httpServer; | 133 | this.httpListener = httpServer; |
134 | 134 | ||
135 | } | 135 | } |
136 | catch (Exception e) | 136 | catch (Exception e) |
137 | { | 137 | { |
138 | OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); | 138 | OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | #endregion | 141 | #endregion |
@@ -218,49 +218,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | /// <returns></returns> | 218 | /// <returns></returns> |
219 | public bool Backup() | 219 | public bool Backup() |
220 | { | 220 | { |
221 | /* | 221 | |
222 | try | ||
223 | { | ||
224 | // Terrain backup routines | ||
225 | if (Terrain.tainted > 0) | ||
226 | { | ||
227 | Terrain.tainted = 0; | ||
228 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); | ||
229 | localStorage.SaveMap(Terrain.getHeights1D()); | ||
230 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); | ||
231 | lock (this.m_syncRoot) | ||
232 | { | ||
233 | phyScene.SetTerrain(Terrain.getHeights1D()); | ||
234 | } | ||
235 | } | ||
236 | |||
237 | // Primitive backup routines | ||
238 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); | ||
239 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
240 | { | ||
241 | Entities[UUID].BackUp(); | ||
242 | } | ||
243 | |||
244 | //Parcel backup routines | ||
245 | ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; | ||
246 | int i = 0; | ||
247 | foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) | ||
248 | { | ||
249 | parcels[i] = parcel.parcelData; | ||
250 | i++; | ||
251 | } | ||
252 | localStorage.SaveParcels(parcels); | ||
253 | |||
254 | // Backup successful | ||
255 | return true; | ||
256 | } | ||
257 | catch (Exception e) | ||
258 | { | ||
259 | // Backup failed | ||
260 | OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); | ||
261 | return false; | ||
262 | } | ||
263 | */ | ||
264 | return true; | 222 | return true; |
265 | } | 223 | } |
266 | #endregion | 224 | #endregion |
@@ -432,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
432 | { | 390 | { |
433 | try | 391 | try |
434 | { | 392 | { |
435 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); | 393 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); |
436 | this.localStorage.LoadPrimitives(this); | 394 | this.localStorage.LoadPrimitives(this); |
437 | } | 395 | } |
438 | catch (Exception e) | 396 | catch (Exception e) |
@@ -469,13 +427,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
469 | { | 427 | { |
470 | try | 428 | try |
471 | { | 429 | { |
472 | Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); | 430 | SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); |
473 | 431 | this.Entities.Add(sceneOb.rootUUID, sceneOb); | |
474 | this.Entities.Add(prim.uuid, prim); | ||
475 | this._primCount++; | 432 | this._primCount++; |
476 | 433 | ||
477 | // Trigger event for listeners | 434 | // Trigger event for listeners |
478 | eventManager.TriggerOnNewPrimitive(prim); | 435 | // eventManager.TriggerOnNewPrimitive(prim); |
479 | } | 436 | } |
480 | catch (Exception e) | 437 | catch (Exception e) |
481 | { | 438 | { |
@@ -500,11 +457,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
500 | client.OnChatFromViewer += this.SimChat; | 457 | client.OnChatFromViewer += this.SimChat; |
501 | client.OnRequestWearables += this.InformClientOfNeighbours; | 458 | client.OnRequestWearables += this.InformClientOfNeighbours; |
502 | client.OnAddPrim += this.AddNewPrim; | 459 | client.OnAddPrim += this.AddNewPrim; |
503 | client.OnUpdatePrimPosition += this.UpdatePrimPosition; | 460 | //client.OnUpdatePrimPosition += this.UpdatePrimPosition; |
504 | client.OnRequestMapBlocks += this.RequestMapBlocks; | 461 | client.OnRequestMapBlocks += this.RequestMapBlocks; |
505 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; | 462 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; |
506 | //remoteClient.OnObjectSelect += this.SelectPrim; | 463 | client.OnObjectSelect += this.SelectPrim; |
507 | client.OnGrapUpdate += this.MoveObject; | 464 | // client.OnGrapUpdate += this.MoveObject; |
508 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; | 465 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; |
509 | 466 | ||
510 | /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); | 467 | /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); |
@@ -523,39 +480,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
523 | { | 480 | { |
524 | ScenePresence newAvatar = null; | 481 | ScenePresence newAvatar = null; |
525 | 482 | ||
526 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | 483 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); |
527 | newAvatar = new ScenePresence(client, this, this.m_regInfo); | 484 | newAvatar = new ScenePresence(client, this, this.m_regInfo); |
528 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); | 485 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); |
529 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); | 486 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); |
530 | 487 | ||
531 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); | 488 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); |
532 | lock (this.m_syncRoot) | 489 | lock (this.m_syncRoot) |
490 | { | ||
491 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | ||
492 | } | ||
493 | |||
494 | lock (Entities) | ||
495 | { | ||
496 | if (!Entities.ContainsKey(client.AgentId)) | ||
533 | { | 497 | { |
534 | newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | 498 | this.Entities.Add(client.AgentId, newAvatar); |
535 | } | 499 | } |
536 | 500 | else | |
537 | lock (Entities) | ||
538 | { | 501 | { |
539 | if (!Entities.ContainsKey(client.AgentId)) | 502 | Entities[client.AgentId] = newAvatar; |
540 | { | ||
541 | this.Entities.Add(client.AgentId, newAvatar); | ||
542 | } | ||
543 | else | ||
544 | { | ||
545 | Entities[client.AgentId] = newAvatar; | ||
546 | } | ||
547 | } | 503 | } |
548 | lock (Avatars) | 504 | } |
505 | lock (Avatars) | ||
506 | { | ||
507 | if (Avatars.ContainsKey(client.AgentId)) | ||
549 | { | 508 | { |
550 | if (Avatars.ContainsKey(client.AgentId)) | 509 | Avatars[client.AgentId] = newAvatar; |
551 | { | ||
552 | Avatars[client.AgentId] = newAvatar; | ||
553 | } | ||
554 | else | ||
555 | { | ||
556 | this.Avatars.Add(client.AgentId, newAvatar); | ||
557 | } | ||
558 | } | 510 | } |
511 | else | ||
512 | { | ||
513 | this.Avatars.Add(client.AgentId, newAvatar); | ||
514 | } | ||
515 | } | ||
559 | } | 516 | } |
560 | 517 | ||
561 | 518 | ||
@@ -634,7 +591,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
634 | public void RegisterRegionWithComms() | 591 | public void RegisterRegionWithComms() |
635 | { | 592 | { |
636 | GridInfo gridSettings = new GridInfo(); | 593 | GridInfo gridSettings = new GridInfo(); |
637 | this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); | 594 | this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); |
638 | if (this.regionCommsHost != null) | 595 | if (this.regionCommsHost != null) |
639 | { | 596 | { |
640 | this.regionCommsHost.OnExpectUser += this.NewUserConnection; | 597 | this.regionCommsHost.OnExpectUser += this.NewUserConnection; |
@@ -757,7 +714,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
757 | agent.child = true; | 714 | agent.child = true; |
758 | this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 715 | this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
759 | this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); | 716 | this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); |
717 | |||
760 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); | 718 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); |
719 | |||
761 | } | 720 | } |
762 | //remoteClient.SendTeleportCancel(); | 721 | //remoteClient.SendTeleportCancel(); |
763 | } | 722 | } |
@@ -771,7 +730,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
771 | /// <param name="position"></param> | 730 | /// <param name="position"></param> |
772 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) | 731 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) |
773 | { | 732 | { |
774 | return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); | 733 | return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); |
775 | } | 734 | } |
776 | 735 | ||
777 | #endregion | 736 | #endregion |