aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-30 07:09:58 +0000
committerTeravus Ovares2008-01-30 07:09:58 +0000
commitfc9b3ec5a8c65f9b97e81f0e41abe4a9f45d4b3a (patch)
tree7117d76c491ecdb8cf4d4b302ee51aa3fac17502 /OpenSim/Region
parent* Fixed a crash if the server is unable to connect to the UserServer when a u... (diff)
downloadopensim-SC-fc9b3ec5a8c65f9b97e81f0e41abe4a9f45d4b3a.zip
opensim-SC-fc9b3ec5a8c65f9b97e81f0e41abe4a9f45d4b3a.tar.gz
opensim-SC-fc9b3ec5a8c65f9b97e81f0e41abe4a9f45d4b3a.tar.bz2
opensim-SC-fc9b3ec5a8c65f9b97e81f0e41abe4a9f45d4b3a.tar.xz
* Experimental ODE Update to make ODE more stable
* WARNING: This update will break *nix support. Will be restored in the next revision
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs28
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs20
3 files changed, 50 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 3f63477..a21b7eb 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -359,6 +359,9 @@ namespace OpenSim.Region.Physics.OdePlugin
359 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size 359 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size
360 OpenSim.Framework.Console.MainLog.Instance.Verbose("SIZE", CAPSULE_LENGTH.ToString()); 360 OpenSim.Framework.Console.MainLog.Instance.Verbose("SIZE", CAPSULE_LENGTH.ToString());
361 d.BodyDestroy(Body); 361 d.BodyDestroy(Body);
362
363 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
364
362 d.GeomDestroy(Shell); 365 d.GeomDestroy(Shell);
363 AvatarGeomAndBodyCreation(_position.X, _position.Y, 366 AvatarGeomAndBodyCreation(_position.X, _position.Y,
364 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); 367 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
@@ -389,6 +392,7 @@ namespace OpenSim.Region.Physics.OdePlugin
389 } 392 }
390 393
391 int dAMotorEuler = 1; 394 int dAMotorEuler = 1;
395 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
392 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 396 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
393 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); 397 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
394 Body = d.BodyCreate(_parent_scene.world); 398 Body = d.BodyCreate(_parent_scene.world);
@@ -781,6 +785,8 @@ namespace OpenSim.Region.Physics.OdePlugin
781 d.JointDestroy(Amotor); 785 d.JointDestroy(Amotor);
782 786
783 //kill the Geometry 787 //kill the Geometry
788 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
789
784 d.GeomDestroy(Shell); 790 d.GeomDestroy(Shell);
785 _parent_scene.geom_name_map.Remove(Shell); 791 _parent_scene.geom_name_map.Remove(Shell);
786 792
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index d70819e..93ba29e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -140,15 +140,20 @@ namespace OpenSim.Region.Physics.OdePlugin
140 { 140 {
141 if (((_size.X / 2f) > 0f)) 141 if (((_size.X / 2f) > 0f))
142 { 142 {
143
144
145 _parent_scene.waitForSpaceUnlock(m_targetSpace);
143 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 146 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
144 } 147 }
145 else 148 else
146 { 149 {
150 _parent_scene.waitForSpaceUnlock(m_targetSpace);
147 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 151 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
148 } 152 }
149 } 153 }
150 else 154 else
151 { 155 {
156 _parent_scene.waitForSpaceUnlock(m_targetSpace);
152 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 157 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
153 } 158 }
154 } 159 }
@@ -166,7 +171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
166 //} 171 //}
167 else 172 else
168 { 173 {
169 174 _parent_scene.waitForSpaceUnlock(m_targetSpace);
170 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 175 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
171 } 176 }
172 } 177 }
@@ -190,6 +195,12 @@ namespace OpenSim.Region.Physics.OdePlugin
190 } 195 }
191 } 196 }
192 197
198 /// <summary>
199 /// Nasty, however without this you get
200 /// 'invalid operation for locked space' when things are really loaded down
201 /// </summary>
202 /// <param name="space"></param>
203
193 public override int PhysicsActorType 204 public override int PhysicsActorType
194 { 205 {
195 get { return (int) ActorTypes.Prim; } 206 get { return (int) ActorTypes.Prim; }
@@ -375,6 +386,7 @@ namespace OpenSim.Region.Physics.OdePlugin
375 3*sizeof (int)); 386 3*sizeof (int));
376 d.GeomTriMeshDataPreprocess(_triMeshData); 387 d.GeomTriMeshDataPreprocess(_triMeshData);
377 388
389 _parent_scene.waitForSpaceUnlock(m_targetSpace);
378 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null); 390 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null);
379 391
380 if (IsPhysical && Body == (IntPtr) 0) 392 if (IsPhysical && Body == (IntPtr) 0)
@@ -427,6 +439,8 @@ namespace OpenSim.Region.Physics.OdePlugin
427 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 439 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
428 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); 440 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
429 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 441 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
442
443 _parent_scene.waitForSpaceUnlock(m_targetSpace);
430 d.SpaceAdd(m_targetSpace, prim_geom); 444 d.SpaceAdd(m_targetSpace, prim_geom);
431 } 445 }
432 446
@@ -486,6 +500,7 @@ namespace OpenSim.Region.Physics.OdePlugin
486 } 500 }
487 if (d.SpaceQuery(m_targetSpace, prim_geom)) 501 if (d.SpaceQuery(m_targetSpace, prim_geom))
488 { 502 {
503 _parent_scene.waitForSpaceUnlock(m_targetSpace);
489 d.SpaceRemove(m_targetSpace, prim_geom); 504 d.SpaceRemove(m_targetSpace, prim_geom);
490 } 505 }
491 d.GeomDestroy(prim_geom); 506 d.GeomDestroy(prim_geom);
@@ -510,17 +525,20 @@ namespace OpenSim.Region.Physics.OdePlugin
510 { 525 {
511 if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000)) 526 if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000))
512 { 527 {
528 _parent_scene.waitForSpaceUnlock(m_targetSpace);
513 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 529 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
514 } 530 }
515 else 531 else
516 { 532 {
517 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size"); 533 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size");
534 _parent_scene.waitForSpaceUnlock(m_targetSpace);
518 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 535 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
519 } 536 }
520 537
521 } 538 }
522 else 539 else
523 { 540 {
541 _parent_scene.waitForSpaceUnlock(m_targetSpace);
524 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 542 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
525 } 543 }
526 } 544 }
@@ -538,7 +556,7 @@ namespace OpenSim.Region.Physics.OdePlugin
538 //} 556 //}
539 else 557 else
540 { 558 {
541 559 _parent_scene.waitForSpaceUnlock(m_targetSpace);
542 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 560 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
543 } 561 }
544 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 562 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
@@ -557,10 +575,12 @@ namespace OpenSim.Region.Physics.OdePlugin
557 { 575 {
558 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) 576 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
559 { 577 {
578 _parent_scene.waitForSpaceUnlock(m_targetSpace);
560 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 579 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
561 } 580 }
562 else 581 else
563 { 582 {
583 _parent_scene.waitForSpaceUnlock(m_targetSpace);
564 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 584 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
565 } 585 }
566 } 586 }
@@ -578,7 +598,7 @@ namespace OpenSim.Region.Physics.OdePlugin
578 //} 598 //}
579 else 599 else
580 { 600 {
581 601 _parent_scene.waitForSpaceUnlock(m_targetSpace);
582 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 602 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
583 } 603 }
584 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 604 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
@@ -630,11 +650,13 @@ namespace OpenSim.Region.Physics.OdePlugin
630 } 650 }
631 else 651 else
632 { 652 {
653 _parent_scene.waitForSpaceUnlock(m_targetSpace);
633 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 654 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
634 } 655 }
635 } 656 }
636 else 657 else
637 { 658 {
659 _parent_scene.waitForSpaceUnlock(m_targetSpace);
638 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 660 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
639 } 661 }
640 if (IsPhysical && Body == (IntPtr) 0) 662 if (IsPhysical && Body == (IntPtr) 0)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 4175978..4c3dcd3 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -206,6 +206,13 @@ namespace OpenSim.Region.Physics.OdePlugin
206 mesher = meshmerizer; 206 mesher = meshmerizer;
207 } 207 }
208 208
209 internal void waitForSpaceUnlock(IntPtr space)
210 {
211 while (d.SpaceLockQuery(space))
212 {
213
214 }
215 }
209 /// <summary> 216 /// <summary>
210 /// Debug space message for printing the space that a prim/avatar is in. 217 /// Debug space message for printing the space that a prim/avatar is in.
211 /// </summary> 218 /// </summary>
@@ -635,8 +642,10 @@ namespace OpenSim.Region.Physics.OdePlugin
635 { 642 {
636 if (!(prim.m_targetSpace.Equals(null))) 643 if (!(prim.m_targetSpace.Equals(null)))
637 { 644 {
645
638 if (d.GeomIsSpace(prim.m_targetSpace)) 646 if (d.GeomIsSpace(prim.m_targetSpace))
639 { 647 {
648 waitForSpaceUnlock(prim.m_targetSpace);
640 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); 649 d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
641 } 650 }
642 else 651 else
@@ -656,6 +665,7 @@ namespace OpenSim.Region.Physics.OdePlugin
656 { 665 {
657 if (d.GeomIsSpace(prim.m_targetSpace)) 666 if (d.GeomIsSpace(prim.m_targetSpace))
658 { 667 {
668 waitForSpaceUnlock(prim.m_targetSpace);
659 d.SpaceRemove(space, prim.m_targetSpace); 669 d.SpaceRemove(space, prim.m_targetSpace);
660 // free up memory used by the space. 670 // free up memory used by the space.
661 d.SpaceDestroy(prim.m_targetSpace); 671 d.SpaceDestroy(prim.m_targetSpace);
@@ -723,6 +733,7 @@ namespace OpenSim.Region.Physics.OdePlugin
723 { 733 {
724 if (d.GeomIsSpace(currentspace)) 734 if (d.GeomIsSpace(currentspace))
725 { 735 {
736 waitForSpaceUnlock(currentspace);
726 d.SpaceRemove(currentspace, geom); 737 d.SpaceRemove(currentspace, geom);
727 } 738 }
728 else 739 else
@@ -741,6 +752,7 @@ namespace OpenSim.Region.Physics.OdePlugin
741 { 752 {
742 if (d.GeomIsSpace(currentspace)) 753 if (d.GeomIsSpace(currentspace))
743 { 754 {
755 waitForSpaceUnlock(sGeomIsIn);
744 d.SpaceRemove(sGeomIsIn, geom); 756 d.SpaceRemove(sGeomIsIn, geom);
745 } 757 }
746 else 758 else
@@ -761,8 +773,11 @@ namespace OpenSim.Region.Physics.OdePlugin
761 { 773 {
762 if (d.GeomIsSpace(currentspace)) 774 if (d.GeomIsSpace(currentspace))
763 { 775 {
776 waitForSpaceUnlock(currentspace);
777 waitForSpaceUnlock(space);
764 d.SpaceRemove(space, currentspace); 778 d.SpaceRemove(space, currentspace);
765 // free up memory used by the space. 779 // free up memory used by the space.
780
766 d.SpaceDestroy(currentspace); 781 d.SpaceDestroy(currentspace);
767 resetSpaceArrayItemToZero(currentspace); 782 resetSpaceArrayItemToZero(currentspace);
768 } 783 }
@@ -783,6 +798,7 @@ namespace OpenSim.Region.Physics.OdePlugin
783 if (currentspace != (IntPtr) 0) 798 if (currentspace != (IntPtr) 0)
784 if (d.GeomIsSpace(currentspace)) 799 if (d.GeomIsSpace(currentspace))
785 { 800 {
801 waitForSpaceUnlock(currentspace);
786 d.SpaceRemove(currentspace, geom); 802 d.SpaceRemove(currentspace, geom);
787 } 803 }
788 else 804 else
@@ -801,6 +817,7 @@ namespace OpenSim.Region.Physics.OdePlugin
801 { 817 {
802 if (d.GeomIsSpace(sGeomIsIn)) 818 if (d.GeomIsSpace(sGeomIsIn))
803 { 819 {
820 waitForSpaceUnlock(sGeomIsIn);
804 d.SpaceRemove(sGeomIsIn, geom); 821 d.SpaceRemove(sGeomIsIn, geom);
805 } 822 }
806 else 823 else
@@ -840,6 +857,7 @@ namespace OpenSim.Region.Physics.OdePlugin
840 { 857 {
841 // creating a new space for prim and inserting it into main space. 858 // creating a new space for prim and inserting it into main space.
842 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); 859 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
860 waitForSpaceUnlock(space);
843 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); 861 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
844 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; 862 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
845 } 863 }