aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-03-09 17:50:24 +0000
committerTeravus Ovares2008-03-09 17:50:24 +0000
commit7cae577094ea166de6ed8b1aab7879aa157a1b6d (patch)
treeb2a098e35f0d1d16dae673d473e9be7f2afabe12 /OpenSim/Region
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-7cae577094ea166de6ed8b1aab7879aa157a1b6d.zip
opensim-SC_OLD-7cae577094ea166de6ed8b1aab7879aa157a1b6d.tar.gz
opensim-SC_OLD-7cae577094ea166de6ed8b1aab7879aa157a1b6d.tar.bz2
opensim-SC_OLD-7cae577094ea166de6ed8b1aab7879aa157a1b6d.tar.xz
ODE Plugin
* More cleanup * Less noise
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs129
2 files changed, 75 insertions, 56 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 3adf773..179160f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -739,7 +739,7 @@ namespace OpenSim.Region.Physics.OdePlugin
739 } 739 }
740 else 740 else
741 { 741 {
742 m_log.Error("[PHYISCS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil."); 742 m_log.Error("[PHYSICS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil.");
743 } 743 }
744 } 744 }
745 745
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index fc71802..df3555f 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Physics.OdePlugin
119 private List<OdePrim> _taintedPrim = new List<OdePrim>(); 119 private List<OdePrim> _taintedPrim = new List<OdePrim>();
120 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 120 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
121 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 121 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
122 private d.ContactGeom[] contacts = new d.ContactGeom[30]; 122 private d.ContactGeom[] contacts = new d.ContactGeom[80];
123 private d.Contact contact; 123 private d.Contact contact;
124 private d.Contact TerrainContact; 124 private d.Contact TerrainContact;
125 private d.Contact AvatarMovementprimContact; 125 private d.Contact AvatarMovementprimContact;
@@ -291,24 +291,14 @@ namespace OpenSim.Region.Physics.OdePlugin
291 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); 291 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback);
292 return; 292 return;
293 } 293 }
294 294
295 295
296 // Colliding Geom To Geom
297 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
298 if (g1 == (IntPtr)0 || g2 == (IntPtr)0) 296 if (g1 == (IntPtr)0 || g2 == (IntPtr)0)
299 return; 297 return;
300 298
301 IntPtr b1 = d.GeomGetBody(g1); 299 IntPtr b1 = d.GeomGetBody(g1);
302 IntPtr b2 = d.GeomGetBody(g2); 300 IntPtr b2 = d.GeomGetBody(g2);
303 301
304 if (g1 == g2)
305 return; // Can't collide with yourself
306
307 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
308 return;
309
310
311
312 d.GeomClassID id = d.GeomGetClass(g1); 302 d.GeomClassID id = d.GeomGetClass(g1);
313 303
314 String name1 = null; 304 String name1 = null;
@@ -334,7 +324,27 @@ namespace OpenSim.Region.Physics.OdePlugin
334 try 324 try
335 { 325 {
336 //m_log.Warn(g1.ToString() + "|" + g2.ToString()); 326 //m_log.Warn(g1.ToString() + "|" + g2.ToString());
337 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 327 // Colliding Geom To Geom
328 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
329
330
331
332
333 if (g1 == g2)
334 return; // Can't collide with yourself
335
336 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
337 return;
338
339 lock (contacts)
340 {
341 if (g1 == (IntPtr)0)
342 m_log.Info("g1=0");
343 if (g2 == (IntPtr)0)
344 m_log.Info("g2=0");
345
346 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
347 }
338 } 348 }
339 catch (SEHException) 349 catch (SEHException)
340 { 350 {
@@ -686,48 +696,56 @@ namespace OpenSim.Region.Physics.OdePlugin
686 // don't process collision for prim! 696 // don't process collision for prim!
687 if (timeStep < (m_SkipFramesAtms/3)) 697 if (timeStep < (m_SkipFramesAtms/3))
688 { 698 {
689 foreach (OdePrim chr in _activeprims) 699 lock (_activeprims)
690 { 700 {
691 // This if may not need to be there.. it might be skipped anyway. 701
692 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) 702 foreach (OdePrim chr in _activeprims)
693 { 703 {
694 try 704 // This if may not need to be there.. it might be skipped anyway.
705 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
695 { 706 {
696 707 try
697 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); 708 {
698 709 lock (chr)
710 {
711 if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
712 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
713 }
714
715 }
716 catch (AccessViolationException)
717 {
718 m_log.Warn("[PHYSICS]: Unable to space collide");
719 }
720 //calculateSpaceForGeom(chr.Position)
721 //foreach (OdePrim ch2 in _prims)
722 /// should be a separate space -- lots of avatars will be N**2 slow
723 //{
724 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
725 //{
726 // Only test prim that are 0.03 meters away in one direction.
727 // This should be Optimized!
728
729 //if ((Math.Abs(ch2.Position.X - chr.Position.X) < 0.03) || (Math.Abs(ch2.Position.Y - chr.Position.Y) < 0.03) || (Math.Abs(ch2.Position.X - chr.Position.X) < 0.03))
730 //{
731 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
732 //}
733 //}
734 //}
699 } 735 }
700 catch (AccessViolationException) 736 try
701 { 737 {
702 m_log.Warn("[PHYSICS]: Unable to space collide"); 738 lock (chr)
739 {
740 if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
741 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
742 }
703 } 743 }
704 //calculateSpaceForGeom(chr.Position) 744 catch (AccessViolationException)
705 //foreach (OdePrim ch2 in _prims)
706 /// should be a separate space -- lots of avatars will be N**2 slow
707 //{
708 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
709 //{
710 // Only test prim that are 0.03 meters away in one direction.
711 // This should be Optimized!
712
713 //if ((Math.Abs(ch2.Position.X - chr.Position.X) < 0.03) || (Math.Abs(ch2.Position.Y - chr.Position.Y) < 0.03) || (Math.Abs(ch2.Position.X - chr.Position.X) < 0.03))
714 //{
715 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
716 //}
717 //}
718 //}
719 }
720 try
721 {
722 lock (chr)
723 { 745 {
724 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); 746 m_log.Warn("[PHYSICS]: Unable to space collide");
725 } 747 }
726 } 748 }
727 catch (AccessViolationException)
728 {
729 m_log.Warn("[PHYSICS]: Unable to space collide");
730 }
731 } 749 }
732 } 750 }
733 else 751 else
@@ -1015,11 +1033,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1015 System.Threading.Thread.Sleep(20); 1033 System.Threading.Thread.Sleep(20);
1016 if (currentspace != space) 1034 if (currentspace != space)
1017 { 1035 {
1018 m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString()); 1036 //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString());
1019 if (currentspace == (IntPtr) 0) 1037 //if (currentspace == (IntPtr) 0)
1020 { 1038 //{
1021 int adfadf = 0; 1039 //int adfadf = 0;
1022 } 1040 //}
1023 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0) 1041 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0)
1024 { 1042 {
1025 if (d.GeomIsSpace(currentspace)) 1043 if (d.GeomIsSpace(currentspace))
@@ -1328,9 +1346,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1328 { 1346 {
1329 RemovePrimThreadLocked(prim); 1347 RemovePrimThreadLocked(prim);
1330 } 1348 }
1331 1349 else
1332 prim.ProcessTaints(timeStep); 1350 {
1333 1351 prim.ProcessTaints(timeStep);
1352 }
1334 processedtaints = true; 1353 processedtaints = true;
1335 prim.m_collisionscore = 0; 1354 prim.m_collisionscore = 0;
1336 } 1355 }