aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/InnerScene.cs
diff options
context:
space:
mode:
authorMW2007-11-04 22:22:53 +0000
committerMW2007-11-04 22:22:53 +0000
commitd56ed8fe9c6428a4ac3288190be303b5813b0b91 (patch)
tree06027d80d7cddda34f05b0d93bf16cb4983217c0 /OpenSim/Region/Environment/Scenes/InnerScene.cs
parentAdded forgotten ApplicationPlugins directory and moved the load region code o... (diff)
downloadopensim-SC-d56ed8fe9c6428a4ac3288190be303b5813b0b91.zip
opensim-SC-d56ed8fe9c6428a4ac3288190be303b5813b0b91.tar.gz
opensim-SC-d56ed8fe9c6428a4ac3288190be303b5813b0b91.tar.bz2
opensim-SC-d56ed8fe9c6428a4ac3288190be303b5813b0b91.tar.xz
Some more refactoring
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs123
1 files changed, 88 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 3195991..f775e22 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1,4 +1,4 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
@@ -12,6 +12,7 @@ namespace OpenSim.Region.Environment.Scenes
12{ 12{
13 public class InnerScene 13 public class InnerScene
14 { 14 {
15 #region Fields
15 public Dictionary<LLUUID, ScenePresence> ScenePresences; 16 public Dictionary<LLUUID, ScenePresence> ScenePresences;
16 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; 17 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
17 public Dictionary<LLUUID, EntityBase> Entities; 18 public Dictionary<LLUUID, EntityBase> Entities;
@@ -19,11 +20,13 @@ namespace OpenSim.Region.Environment.Scenes
19 public BasicQuadTreeNode QuadTree; 20 public BasicQuadTreeNode QuadTree;
20 21
21 protected RegionInfo m_regInfo; 22 protected RegionInfo m_regInfo;
22
23 protected Scene m_parentScene; 23 protected Scene m_parentScene;
24 public PhysicsScene PhyScene; 24 protected PermissionManager PermissionsMngr;
25
26 internal object m_syncRoot = new object();
25 27
26 private PermissionManager PermissionsMngr; 28 public PhysicsScene PhyScene;
29 #endregion
27 30
28 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 31 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
29 { 32 {
@@ -42,6 +45,51 @@ namespace OpenSim.Region.Environment.Scenes
42 Entities.Clear(); 45 Entities.Clear();
43 } 46 }
44 47
48 #region Update Methods
49 internal void UpdatePreparePhysics()
50 {
51 // If we are using a threaded physics engine
52 // grab the latest scene from the engine before
53 // trying to process it.
54
55 // PhysX does this (runs in the background).
56
57 if (PhyScene.IsThreaded)
58 {
59 PhyScene.GetResults();
60 }
61 }
62
63 internal void UpdateEntities()
64 {
65 List<EntityBase> updateEntities = new List<EntityBase>(Entities.Values);
66
67 foreach (EntityBase entity in updateEntities)
68 {
69 entity.Update();
70 }
71 }
72
73 internal void UpdatePhysics(double elapsed)
74 {
75 lock (m_syncRoot)
76 {
77 PhyScene.Simulate((float)elapsed);
78 }
79 }
80
81 internal void UpdateEntityMovement()
82 {
83 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
84
85 foreach (EntityBase entity in moveEntities)
86 {
87 entity.UpdateMovement();
88 }
89 }
90 #endregion
91
92 #region Entity Methods
45 public void AddEntityFromStorage(SceneObjectGroup sceneObject) 93 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
46 { 94 {
47 sceneObject.RegionHandle = m_regInfo.RegionHandle; 95 sceneObject.RegionHandle = m_regInfo.RegionHandle;
@@ -122,6 +170,9 @@ namespace OpenSim.Region.Environment.Scenes
122 170
123 return newAvatar; 171 return newAvatar;
124 } 172 }
173 #endregion
174
175 #region Get Methods
125 176
126 /// <summary> 177 /// <summary>
127 /// Request a List of all m_scenePresences in this World 178 /// Request a List of all m_scenePresences in this World
@@ -175,35 +226,6 @@ namespace OpenSim.Region.Environment.Scenes
175 return null; 226 return null;
176 } 227 }
177 228
178
179 public LLUUID ConvertLocalIDToFullID(uint localID)
180 {
181 bool hasPrim = false;
182 foreach (EntityBase ent in Entities.Values)
183 {
184 if (ent is SceneObjectGroup)
185 {
186 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
187 if (hasPrim != false)
188 {
189 return ((SceneObjectGroup)ent).GetPartsFullID(localID);
190 }
191 }
192 }
193 return LLUUID.Zero;
194 }
195
196 public void SendAllSceneObjectsToClient(ScenePresence presence)
197 {
198 foreach (EntityBase ent in Entities.Values)
199 {
200 if (ent is SceneObjectGroup)
201 {
202 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
203 }
204 }
205 }
206
207 public SceneObjectPart GetSceneObjectPart(uint localID) 229 public SceneObjectPart GetSceneObjectPart(uint localID)
208 { 230 {
209 bool hasPrim = false; 231 bool hasPrim = false;
@@ -274,6 +296,37 @@ namespace OpenSim.Region.Environment.Scenes
274 return false; 296 return false;
275 } 297 }
276 298
299 #endregion
300
301 #region Other Methods
302
303 public LLUUID ConvertLocalIDToFullID(uint localID)
304 {
305 bool hasPrim = false;
306 foreach (EntityBase ent in Entities.Values)
307 {
308 if (ent is SceneObjectGroup)
309 {
310 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
311 if (hasPrim != false)
312 {
313 return ((SceneObjectGroup)ent).GetPartsFullID(localID);
314 }
315 }
316 }
317 return LLUUID.Zero;
318 }
319
320 public void SendAllSceneObjectsToClient(ScenePresence presence)
321 {
322 foreach (EntityBase ent in Entities.Values)
323 {
324 if (ent is SceneObjectGroup)
325 {
326 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
327 }
328 }
329 }
277 330
278 internal void ForEachClient(Action<IClientAPI> action) 331 internal void ForEachClient(Action<IClientAPI> action)
279 { 332 {
@@ -282,6 +335,7 @@ namespace OpenSim.Region.Environment.Scenes
282 action(presence.ControllingClient); 335 action(presence.ControllingClient);
283 } 336 }
284 } 337 }
338 #endregion
285 339
286 #region Client Event handlers 340 #region Client Event handlers
287 /// <summary> 341 /// <summary>
@@ -307,7 +361,6 @@ namespace OpenSim.Region.Environment.Scenes
307 } 361 }
308 } 362 }
309 363
310
311 /// <summary> 364 /// <summary>
312 /// 365 ///
313 /// </summary> 366 /// </summary>
@@ -395,7 +448,6 @@ namespace OpenSim.Region.Environment.Scenes
395 } 448 }
396 } 449 }
397 450
398
399 /// <summary> 451 /// <summary>
400 /// 452 ///
401 /// </summary> 453 /// </summary>
@@ -653,3 +705,4 @@ namespace OpenSim.Region.Environment.Scenes
653 #endregion 705 #endregion
654 } 706 }
655} 707}
708