diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 68 |
1 files changed, 31 insertions, 37 deletions
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++) |