aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Region/Physics/OdePlugin
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs8
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs10
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs68
3 files changed, 42 insertions, 44 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index a21b7eb..98069a0 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -56,6 +56,8 @@ namespace OpenSim.Region.Physics.OdePlugin
56 } 56 }
57 public class OdeCharacter : PhysicsActor 57 public class OdeCharacter : PhysicsActor
58 { 58 {
59 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
60
59 private PhysicsVector _position; 61 private PhysicsVector _position;
60 private d.Vector3 _zeroPosition; 62 private d.Vector3 _zeroPosition;
61 private d.Matrix3 m_StandUpRotation; 63 private d.Matrix3 m_StandUpRotation;
@@ -357,7 +359,7 @@ namespace OpenSim.Region.Physics.OdePlugin
357 //capsuleradius = 0.2f; 359 //capsuleradius = 0.2f;
358 360
359 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size 361 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size
360 OpenSim.Framework.Console.MainLog.Instance.Verbose("SIZE", CAPSULE_LENGTH.ToString()); 362 m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
361 d.BodyDestroy(Body); 363 d.BodyDestroy(Body);
362 364
363 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 365 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
@@ -440,7 +442,7 @@ namespace OpenSim.Region.Physics.OdePlugin
440 //d.QfromR( 442 //d.QfromR(
441 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, 443 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
442 // 444 //
443 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICSAV", "Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 445 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
444 //standupStraight(); 446 //standupStraight();
445 447
446 448
@@ -479,7 +481,7 @@ namespace OpenSim.Region.Physics.OdePlugin
479 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 481 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
480 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 482 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
481 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); 483 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
482 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICSAV", "Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 484 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
483 } 485 }
484 486
485 public override PhysicsVector Force 487 public override PhysicsVector Force
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 93ba29e..690e9d3 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.OdePlugin
37{ 37{
38 public class OdePrim : PhysicsActor 38 public class OdePrim : PhysicsActor
39 { 39 {
40 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41
40 public PhysicsVector _position; 42 public PhysicsVector _position;
41 private PhysicsVector _velocity; 43 private PhysicsVector _velocity;
42 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); 44 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
@@ -530,7 +532,7 @@ namespace OpenSim.Region.Physics.OdePlugin
530 } 532 }
531 else 533 else
532 { 534 {
533 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size"); 535 m_log.Info("[PHYSICS]: Failed to load a sphere bad size");
534 _parent_scene.waitForSpaceUnlock(m_targetSpace); 536 _parent_scene.waitForSpaceUnlock(m_targetSpace);
535 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 537 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
536 } 538 }
@@ -683,7 +685,7 @@ namespace OpenSim.Region.Physics.OdePlugin
683 { 685 {
684 lock (m_forcelist) 686 lock (m_forcelist)
685 { 687 {
686 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "dequeing forcelist"); 688 //m_log.Info("[PHYSICS]: dequeing forcelist");
687 if (IsPhysical) 689 if (IsPhysical)
688 { 690 {
689 PhysicsVector iforce = new PhysicsVector(); 691 PhysicsVector iforce = new PhysicsVector();
@@ -747,7 +749,7 @@ namespace OpenSim.Region.Physics.OdePlugin
747 get { return _position; } 749 get { return _position; }
748 750
749 set { _position = value; 751 set { _position = value;
750 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", _position.ToString()); 752 //m_log.Info("[PHYSICS]: " + _position.ToString());
751 } 753 }
752 } 754 }
753 755
@@ -824,7 +826,7 @@ namespace OpenSim.Region.Physics.OdePlugin
824 { 826 {
825 m_forcelist.Add(force); 827 m_forcelist.Add(force);
826 m_taintforce = true; 828 m_taintforce = true;
827 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Added Force:" + force.ToString() + " to prim at " + Position.ToString()); 829 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
828 } 830 }
829 831
830 public override PhysicsVector RotationalVelocity 832 public override PhysicsVector RotationalVelocity
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index bff2c80..9cf6d50 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Region.Physics.OdePlugin
44 /// </summary> 44 /// </summary>
45 public class OdePlugin : IPhysicsPlugin 45 public class OdePlugin : IPhysicsPlugin
46 { 46 {
47 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
48
47 private OdeScene _mScene; 49 private OdeScene _mScene;
48 50
49 public OdePlugin() 51 public OdePlugin()
@@ -76,6 +78,8 @@ namespace OpenSim.Region.Physics.OdePlugin
76 78
77 public class OdeScene : PhysicsScene 79 public class OdeScene : PhysicsScene
78 { 80 {
81 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
82
79 // TODO: this should be hard-coded in some common place 83 // TODO: this should be hard-coded in some common place
80 private const uint m_regionWidth = 256; 84 private const uint m_regionWidth = 256;
81 private const uint m_regionHeight = 256; 85 private const uint m_regionHeight = 256;
@@ -284,7 +288,7 @@ namespace OpenSim.Region.Physics.OdePlugin
284 288
285 //if (id == d.GeomClassID.TriMeshClass) 289 //if (id == d.GeomClassID.TriMeshClass)
286 //{ 290 //{
287 // MainLog.Instance.Verbose("near: A collision was detected between {1} and {2}", 0, name1, name2); 291 // m_log.Info("near: A collision was detected between {1} and {2}", 0, name1, name2);
288 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); 292 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
289 //} 293 //}
290 294
@@ -296,8 +300,7 @@ namespace OpenSim.Region.Physics.OdePlugin
296 } 300 }
297 catch (SEHException) 301 catch (SEHException)
298 { 302 {
299 MainLog.Instance.Error("PHYSICS", 303 m_log.Error("[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
300 "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
301 base.TriggerPhysicsBasedRestart(); 304 base.TriggerPhysicsBasedRestart();
302 } 305 }
303 306
@@ -352,7 +355,7 @@ namespace OpenSim.Region.Physics.OdePlugin
352 355
353 if (contacts[i].depth >= 1.00f) 356 if (contacts[i].depth >= 1.00f)
354 { 357 {
355 //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); 358 //m_log.Debug("[PHYSICS]: " +contacts[i].depth.ToString());
356 } 359 }
357 360
358 //If you interpenetrate a prim with an agent 361 //If you interpenetrate a prim with an agent
@@ -405,7 +408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
405 } 408 }
406 if (contacts[i].depth >= 1.00f) 409 if (contacts[i].depth >= 1.00f)
407 { 410 {
408 //OpenSim.Framework.Console.MainLog.Instance.Verbose("P", contacts[i].depth.ToString()); 411 //m_log.Info("[P]: " + contacts[i].depth.ToString());
409 if ((p2.PhysicsActorType == (int) ActorTypes.Agent && 412 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
410 p1.PhysicsActorType == (int) ActorTypes.Unknown) || 413 p1.PhysicsActorType == (int) ActorTypes.Unknown) ||
411 (p1.PhysicsActorType == (int) ActorTypes.Agent && 414 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
@@ -654,9 +657,8 @@ namespace OpenSim.Region.Physics.OdePlugin
654 } 657 }
655 else 658 else
656 { 659 {
657 MainLog.Instance.Verbose("Physics", 660 m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
658 "Invalid Scene passed to 'removeprim from scene':" + 661 ((OdePrim) prim).m_targetSpace.ToString());
659 ((OdePrim) prim).m_targetSpace.ToString());
660 } 662 }
661 } 663 }
662 } 664 }
@@ -678,9 +680,8 @@ namespace OpenSim.Region.Physics.OdePlugin
678 } 680 }
679 else 681 else
680 { 682 {
681 MainLog.Instance.Verbose("Physics", 683 m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
682 "Invalid Scene passed to 'removeprim from scene':" + 684 ((OdePrim) prim).m_targetSpace.ToString());
683 ((OdePrim) prim).m_targetSpace.ToString());
684 } 685 }
685 } 686 }
686 } 687 }
@@ -742,9 +743,8 @@ namespace OpenSim.Region.Physics.OdePlugin
742 } 743 }
743 else 744 else
744 { 745 {
745 MainLog.Instance.Verbose("Physics", 746 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() +
746 "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + 747 " Geom:" + geom.ToString());
747 " Geom:" + geom.ToString());
748 } 748 }
749 } 749 }
750 else 750 else
@@ -761,9 +761,8 @@ namespace OpenSim.Region.Physics.OdePlugin
761 } 761 }
762 else 762 else
763 { 763 {
764 MainLog.Instance.Verbose("Physics", 764 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
765 "Invalid Scene passed to 'recalculatespace':" + 765 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
766 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
767 } 766 }
768 } 767 }
769 } 768 }
@@ -787,9 +786,8 @@ namespace OpenSim.Region.Physics.OdePlugin
787 } 786 }
788 else 787 else
789 { 788 {
790 MainLog.Instance.Verbose("Physics", 789 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
791 "Invalid Scene passed to 'recalculatespace':" + 790 currentspace.ToString() + " Geom:" + geom.ToString());
792 currentspace.ToString() + " Geom:" + geom.ToString());
793 } 791 }
794 } 792 }
795 } 793 }
@@ -807,9 +805,8 @@ namespace OpenSim.Region.Physics.OdePlugin
807 } 805 }
808 else 806 else
809 { 807 {
810 MainLog.Instance.Verbose("Physics", 808 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
811 "Invalid Scene passed to 'recalculatespace':" + 809 currentspace.ToString() + " Geom:" + geom.ToString());
812 currentspace.ToString() + " Geom:" + geom.ToString());
813 } 810 }
814 } 811 }
815 else 812 else
@@ -826,9 +823,8 @@ namespace OpenSim.Region.Physics.OdePlugin
826 } 823 }
827 else 824 else
828 { 825 {
829 MainLog.Instance.Verbose("Physics", 826 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
830 "Invalid Scene passed to 'recalculatespace':" + 827 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
831 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
832 } 828 }
833 } 829 }
834 } 830 }
@@ -876,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
876 IntPtr locationbasedspace =IntPtr.Zero; 872 IntPtr locationbasedspace =IntPtr.Zero;
877 873
878 int[] xyspace = calculateSpaceArrayItemFromPos(pos); 874 int[] xyspace = calculateSpaceArrayItemFromPos(pos);
879 //MainLog.Instance.Verbose("Physics", "Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); 875 //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
880 locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; 876 locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]];
881 877
882 //locationbasedspace = space; 878 //locationbasedspace = space;
@@ -970,7 +966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
970 name2 = "null"; 966 name2 = "null";
971 } 967 }
972 968
973 MainLog.Instance.Verbose("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); 969 m_log.Info("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2);
974*/ 970*/
975 return 1; 971 return 1;
976 } 972 }
@@ -984,19 +980,20 @@ namespace OpenSim.Region.Physics.OdePlugin
984 { 980 {
985 name1 = "null"; 981 name1 = "null";
986 } 982 }
983
987 if (!geom_name_map.TryGetValue(refObject, out name2)) 984 if (!geom_name_map.TryGetValue(refObject, out name2))
988 { 985 {
989 name2 = "null"; 986 name2 = "null";
990 } 987 }
991 988
992// MainLog.Instance.Verbose("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); 989// m_log.Info("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex);
993 990
994 d.Vector3 v0 = new d.Vector3(); 991 d.Vector3 v0 = new d.Vector3();
995 d.Vector3 v1 = new d.Vector3(); 992 d.Vector3 v1 = new d.Vector3();
996 d.Vector3 v2 = new d.Vector3(); 993 d.Vector3 v2 = new d.Vector3();
997 994
998 d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); 995 d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2);
999// MainLog.Instance.Debug("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); 996// m_log.Debug("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z);
1000 997
1001 return 1; 998 return 1;
1002 } 999 }
@@ -1105,19 +1102,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1105 } 1102 }
1106 catch (StackOverflowException) 1103 catch (StackOverflowException)
1107 { 1104 {
1108 MainLog.Instance.Error("PHYSICS", 1105 m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
1109 "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
1110 base.TriggerPhysicsBasedRestart(); 1106 base.TriggerPhysicsBasedRestart();
1111 } 1107 }
1112 1108
1113 int i = 0; 1109 int i = 0;
1114 1110
1115
1116 // Figure out the Frames Per Second we're going at. 1111 // Figure out the Frames Per Second we're going at.
1117 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size 1112 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
1118 fps = (step_time/ODE_STEPSIZE) * 1000; 1113 fps = (step_time/ODE_STEPSIZE) * 1000;
1119 1114
1120
1121 while (step_time > 0.0f) 1115 while (step_time > 0.0f)
1122 { 1116 {
1123 foreach (OdeCharacter actor in _characters) 1117 foreach (OdeCharacter actor in _characters)
@@ -1126,7 +1120,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1126 actor.collidelock = true; 1120 actor.collidelock = true;
1127 } 1121 }
1128 1122
1129
1130 collision_optimized(timeStep); 1123 collision_optimized(timeStep);
1131 d.WorldQuickStep(world, ODE_STEPSIZE); 1124 d.WorldQuickStep(world, ODE_STEPSIZE);
1132 d.JointGroupEmpty(contactgroup); 1125 d.JointGroupEmpty(contactgroup);
@@ -1178,8 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1178 1171
1179 public override bool IsThreaded 1172 public override bool IsThreaded
1180 { 1173 {
1181 get { return (false); // for now we won't be multithreaded 1174 // for now we won't be multithreaded
1182 } 1175 get { return (false); }
1183 } 1176 }
1184 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) 1177 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap)
1185 { 1178 {
@@ -1275,6 +1268,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1275 } 1268 }
1276 } 1269 }
1277 } 1270 }
1271
1278 //Flatten out the array 1272 //Flatten out the array
1279 int i = 0; 1273 int i = 0;
1280 for (int y = 0; y < 512; y++) 1274 for (int y = 0; y < 512; y++)