aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/InnerScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs123
1 files changed, 67 insertions, 56 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 0ca3405..4233853 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using Axiom.Math; 31using Axiom.Math;
33using libsecondlife; 32using libsecondlife;
34using libsecondlife.Packets; 33using libsecondlife.Packets;
@@ -44,10 +43,13 @@ namespace OpenSim.Region.Environment.Scenes
44 public class InnerScene 43 public class InnerScene
45 { 44 {
46 #region Events 45 #region Events
46
47 public event PhysicsCrash UnRecoverableError; 47 public event PhysicsCrash UnRecoverableError;
48
48 #endregion 49 #endregion
49 50
50 #region Fields 51 #region Fields
52
51 public Dictionary<LLUUID, ScenePresence> ScenePresences; 53 public Dictionary<LLUUID, ScenePresence> ScenePresences;
52 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; 54 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
53 public Dictionary<LLUUID, EntityBase> Entities; 55 public Dictionary<LLUUID, EntityBase> Entities;
@@ -65,6 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
65 internal object m_syncRoot = new object(); 67 internal object m_syncRoot = new object();
66 68
67 public PhysicsScene _PhyScene; 69 public PhysicsScene _PhyScene;
70
68 #endregion 71 #endregion
69 72
70 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 73 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
@@ -79,28 +82,27 @@ namespace OpenSim.Region.Environment.Scenes
79 82
80 public PhysicsScene PhysicsScene 83 public PhysicsScene PhysicsScene
81 { 84 {
82 get 85 get { return _PhyScene; }
83 { return _PhyScene; }
84 set 86 set
85 { 87 {
86 // If we're not doing the initial set 88 // If we're not doing the initial set
87 // Then we've got to remove the previous 89 // Then we've got to remove the previous
88 // event handler 90 // event handler
89 try 91 try
90 { 92 {
91 _PhyScene.OnPhysicsCrash -= physicsBasedCrash; 93 _PhyScene.OnPhysicsCrash -= physicsBasedCrash;
92 } 94 }
93 catch (System.NullReferenceException) 95 catch (NullReferenceException)
94 { 96 {
95 // This occurs when storing to _PhyScene the first time. 97 // This occurs when storing to _PhyScene the first time.
96 // Is there a better way to check the event handler before 98 // Is there a better way to check the event handler before
97 // getting here 99 // getting here
98 // This can be safely ignored. We're setting the first inital 100 // This can be safely ignored. We're setting the first inital
99 // there are no event handler's registered. 101 // there are no event handler's registered.
100 } 102 }
101 103
102 _PhyScene = value; 104 _PhyScene = value;
103 105
104 _PhyScene.OnPhysicsCrash += physicsBasedCrash; 106 _PhyScene.OnPhysicsCrash += physicsBasedCrash;
105 } 107 }
106 } 108 }
@@ -113,6 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
113 } 115 }
114 116
115 #region Update Methods 117 #region Update Methods
118
116 internal void UpdatePreparePhysics() 119 internal void UpdatePreparePhysics()
117 { 120 {
118 // If we are using a threaded physics engine 121 // If we are using a threaded physics engine
@@ -141,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
141 { 144 {
142 lock (m_syncRoot) 145 lock (m_syncRoot)
143 { 146 {
144 return _PhyScene.Simulate((float)elapsed); 147 return _PhyScene.Simulate((float) elapsed);
145 } 148 }
146 } 149 }
147 150
@@ -151,12 +154,14 @@ namespace OpenSim.Region.Environment.Scenes
151 154
152 foreach (EntityBase entity in moveEntities) 155 foreach (EntityBase entity in moveEntities)
153 { 156 {
154 entity.UpdateMovement(); 157 entity.UpdateMovement();
155 } 158 }
156 } 159 }
160
157 #endregion 161 #endregion
158 162
159 #region Entity Methods 163 #region Entity Methods
164
160 public void AddEntityFromStorage(SceneObjectGroup sceneObject) 165 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
161 { 166 {
162 sceneObject.RegionHandle = m_regInfo.RegionHandle; 167 sceneObject.RegionHandle = m_regInfo.RegionHandle;
@@ -181,14 +186,17 @@ namespace OpenSim.Region.Environment.Scenes
181 m_numPrim++; 186 m_numPrim++;
182 } 187 }
183 } 188 }
189
184 public void AddPhysicalPrim(int number) 190 public void AddPhysicalPrim(int number)
185 { 191 {
186 m_physicalPrim++; 192 m_physicalPrim++;
187 } 193 }
194
188 public void RemovePhysicalPrim(int number) 195 public void RemovePhysicalPrim(int number)
189 { 196 {
190 m_physicalPrim--; 197 m_physicalPrim--;
191 } 198 }
199
192 public void RemovePrim(uint localID, LLUUID avatar_deleter) 200 public void RemovePrim(uint localID, LLUUID avatar_deleter)
193 { 201 {
194 List<EntityBase> EntityList = GetEntities(); 202 List<EntityBase> EntityList = GetEntities();
@@ -197,9 +205,9 @@ namespace OpenSim.Region.Environment.Scenes
197 { 205 {
198 if (obj is SceneObjectGroup) 206 if (obj is SceneObjectGroup)
199 { 207 {
200 if (((SceneObjectGroup)obj).LocalId == localID) 208 if (((SceneObjectGroup) obj).LocalId == localID)
201 { 209 {
202 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 210 m_parentScene.RemoveEntity((SceneObjectGroup) obj);
203 m_numPrim--; 211 m_numPrim--;
204 return; 212 return;
205 } 213 }
@@ -253,7 +261,8 @@ namespace OpenSim.Region.Environment.Scenes
253 261
254 return newAvatar; 262 return newAvatar;
255 } 263 }
256 public void SwapRootChildAgent(bool direction_RC_CR_T_F) 264
265 public void SwapRootChildAgent(bool direction_RC_CR_T_F)
257 { 266 {
258 if (direction_RC_CR_T_F) 267 if (direction_RC_CR_T_F)
259 { 268 {
@@ -266,25 +275,29 @@ namespace OpenSim.Region.Environment.Scenes
266 m_numRootAgents++; 275 m_numRootAgents++;
267 } 276 }
268 } 277 }
278
269 public void removeUserCount(bool TypeRCTF) 279 public void removeUserCount(bool TypeRCTF)
270 { 280 {
271 if (TypeRCTF) 281 if (TypeRCTF)
272 { 282 {
273 m_numRootAgents--; 283 m_numRootAgents--;
274 } 284 }
275 else 285 else
276 { 286 {
277 m_numChildAgents--; 287 m_numChildAgents--;
278 } 288 }
279 } 289 }
290
280 public void RemoveAPrimCount() 291 public void RemoveAPrimCount()
281 { 292 {
282 m_numPrim--; 293 m_numPrim--;
283 } 294 }
295
284 public void AddAPrimCount() 296 public void AddAPrimCount()
285 { 297 {
286 m_numPrim++; 298 m_numPrim++;
287 } 299 }
300
288 public int GetChildAgentCount() 301 public int GetChildAgentCount()
289 { 302 {
290 return m_numChildAgents; 303 return m_numChildAgents;
@@ -375,8 +388,8 @@ namespace OpenSim.Region.Environment.Scenes
375 { 388 {
376 if (ent is SceneObjectGroup) 389 if (ent is SceneObjectGroup)
377 { 390 {
378 if (((SceneObjectGroup)ent).HasChildPrim(localID)) 391 if (((SceneObjectGroup) ent).HasChildPrim(localID))
379 return (SceneObjectGroup)ent; 392 return (SceneObjectGroup) ent;
380 } 393 }
381 } 394 }
382 return null; 395 return null;
@@ -390,8 +403,8 @@ namespace OpenSim.Region.Environment.Scenes
390 { 403 {
391 if (ent is SceneObjectGroup) 404 if (ent is SceneObjectGroup)
392 { 405 {
393 if (((SceneObjectGroup)ent).HasChildPrim(fullID)) 406 if (((SceneObjectGroup) ent).HasChildPrim(fullID))
394 return (SceneObjectGroup)ent; 407 return (SceneObjectGroup) ent;
395 } 408 }
396 } 409 }
397 return null; 410 return null;
@@ -406,7 +419,7 @@ namespace OpenSim.Region.Environment.Scenes
406 { 419 {
407 if (ent is SceneObjectGroup) 420 if (ent is SceneObjectGroup)
408 { 421 {
409 SceneObjectGroup reportingG = (SceneObjectGroup)ent; 422 SceneObjectGroup reportingG = (SceneObjectGroup) ent;
410 EntityIntersection result = reportingG.TestIntersection(hray); 423 EntityIntersection result = reportingG.TestIntersection(hray);
411 if (result.HitTF) 424 if (result.HitTF)
412 { 425 {
@@ -417,7 +430,6 @@ namespace OpenSim.Region.Environment.Scenes
417 } 430 }
418 } 431 }
419 } 432 }
420
421 } 433 }
422 return returnResult; 434 return returnResult;
423 } 435 }
@@ -531,17 +543,16 @@ namespace OpenSim.Region.Environment.Scenes
531 //float distResult = Vector3Distance(avPosition, objPosition); 543 //float distResult = Vector3Distance(avPosition, objPosition);
532 //if (distResult > 512) 544 //if (distResult > 512)
533 //{ 545 //{
534 //int x = 0; 546 //int x = 0;
535 //} 547 //}
536 //if (distResult < presence.DrawDistance) 548 //if (distResult < presence.DrawDistance)
537 //{ 549 //{
538 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 550 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
539 //} 551 //}
540
541 } 552 }
542 else 553 else
543 { 554 {
544 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 555 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
545 } 556 }
546 } 557 }
547 } 558 }
@@ -554,9 +565,11 @@ namespace OpenSim.Region.Environment.Scenes
554 action(presence.ControllingClient); 565 action(presence.ControllingClient);
555 } 566 }
556 } 567 }
568
557 #endregion 569 #endregion
558 570
559 #region Client Event handlers 571 #region Client Event handlers
572
560 /// <summary> 573 /// <summary>
561 /// 574 ///
562 /// </summary> 575 /// </summary>
@@ -583,13 +596,12 @@ namespace OpenSim.Region.Environment.Scenes
583 /// <param name="AgentID"></param> 596 /// <param name="AgentID"></param>
584 /// <param name="RequestFlags"></param> 597 /// <param name="RequestFlags"></param>
585 /// <param name="ObjectID"></param> 598 /// <param name="ObjectID"></param>
586 public void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID ObjectID) 599 public void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags,
600 LLUUID ObjectID)
587 { 601 {
588 SceneObjectGroup group = GetGroupByPrim(ObjectID); 602 SceneObjectGroup group = GetGroupByPrim(ObjectID);
589 if (group != null) 603 if (group != null)
590 group.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); 604 group.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
591
592
593 } 605 }
594 606
595 /// <summary> 607 /// <summary>
@@ -708,10 +720,9 @@ namespace OpenSim.Region.Environment.Scenes
708 { 720 {
709 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 721 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
710 { 722 {
711 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); 723 group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes());
712 } 724 }
713 } 725 }
714
715 } 726 }
716 727
717 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 728 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
@@ -763,7 +774,7 @@ namespace OpenSim.Region.Environment.Scenes
763 public void UpdateExtraParam(LLUUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data) 774 public void UpdateExtraParam(LLUUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data)
764 { 775 {
765 SceneObjectGroup group = GetGroupByPrim(primLocalID); 776 SceneObjectGroup group = GetGroupByPrim(primLocalID);
766 777
767 if (group != null) 778 if (group != null)
768 { 779 {
769 if (PermissionsMngr.CanEditObject(agentID, group.UUID)) 780 if (PermissionsMngr.CanEditObject(agentID, group.UUID))
@@ -771,7 +782,6 @@ namespace OpenSim.Region.Environment.Scenes
771 group.UpdateExtraParam(primLocalID, type, inUse, data); 782 group.UpdateExtraParam(primLocalID, type, inUse, data);
772 } 783 }
773 } 784 }
774
775 } 785 }
776 786
777 /// <summary> 787 /// <summary>
@@ -786,7 +796,6 @@ namespace OpenSim.Region.Environment.Scenes
786 { 796 {
787 if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID))) 797 if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
788 { 798 {
789
790 group.UpdateShape(shapeBlock, primLocalID); 799 group.UpdateShape(shapeBlock, primLocalID);
791 } 800 }
792 } 801 }
@@ -806,9 +815,9 @@ namespace OpenSim.Region.Environment.Scenes
806 { 815 {
807 if (ent is SceneObjectGroup) 816 if (ent is SceneObjectGroup)
808 { 817 {
809 if (((SceneObjectGroup)ent).LocalId == parentPrim) 818 if (((SceneObjectGroup) ent).LocalId == parentPrim)
810 { 819 {
811 parenPrim = (SceneObjectGroup)ent; 820 parenPrim = (SceneObjectGroup) ent;
812 break; 821 break;
813 } 822 }
814 } 823 }
@@ -823,9 +832,9 @@ namespace OpenSim.Region.Environment.Scenes
823 { 832 {
824 if (ent is SceneObjectGroup) 833 if (ent is SceneObjectGroup)
825 { 834 {
826 if (((SceneObjectGroup)ent).LocalId == childPrims[i]) 835 if (((SceneObjectGroup) ent).LocalId == childPrims[i])
827 { 836 {
828 children.Add((SceneObjectGroup)ent); 837 children.Add((SceneObjectGroup) ent);
829 } 838 }
830 } 839 }
831 } 840 }
@@ -857,7 +866,7 @@ namespace OpenSim.Region.Environment.Scenes
857 { 866 {
858 if (ent is SceneObjectGroup) 867 if (ent is SceneObjectGroup)
859 { 868 {
860 SceneObjectGroup obj = (SceneObjectGroup)ent; 869 SceneObjectGroup obj = (SceneObjectGroup) ent;
861 sceneObjects.Add(obj.LocalId, obj); 870 sceneObjects.Add(obj.LocalId, obj);
862 } 871 }
863 } 872 }
@@ -882,9 +891,9 @@ namespace OpenSim.Region.Environment.Scenes
882 } 891 }
883 else 892 else
884 { 893 {
885 MainLog.Instance.Verbose("SCENE", 894 MainLog.Instance.Verbose("SCENE",
886 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", 895 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!",
887 primIds); 896 primIds);
888 } 897 }
889 } 898 }
890 899
@@ -903,9 +912,9 @@ namespace OpenSim.Region.Environment.Scenes
903 { 912 {
904 if (ent is SceneObjectGroup) 913 if (ent is SceneObjectGroup)
905 { 914 {
906 if (((SceneObjectGroup)ent).LocalId == originalPrim) 915 if (((SceneObjectGroup) ent).LocalId == originalPrim)
907 { 916 {
908 originPrim = (SceneObjectGroup)ent; 917 originPrim = (SceneObjectGroup) ent;
909 break; 918 break;
910 } 919 }
911 } 920 }
@@ -929,7 +938,6 @@ namespace OpenSim.Region.Environment.Scenes
929 { 938 {
930 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 939 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
931 } 940 }
932
933 } 941 }
934 942
935 /// <summary> 943 /// <summary>
@@ -943,8 +951,11 @@ namespace OpenSim.Region.Environment.Scenes
943 // We don't really need the double floating point precision... 951 // We don't really need the double floating point precision...
944 // so casting it to a single 952 // so casting it to a single
945 953
946 return (float)Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)); 954 return
955 (float)
956 Math.Sqrt((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + (v1.z - v2.z)*(v1.z - v2.z));
947 } 957 }
958
948 #endregion 959 #endregion
949 } 960 }
950} 961} \ No newline at end of file