From a8cfbbe963529728acbab4d9936cb89af380d1ac Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 20 Feb 2008 18:38:20 +0000 Subject: Minor cleanup. --- .../Region/Physics/BulletXPlugin/BulletXPlugin.cs | 7 ++--- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 2 +- OpenSim/Region/Physics/Meshing/HelperTypes.cs | 2 +- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 22 ++++----------- OpenSim/Region/Physics/Meshing/SimpleHull.cs | 10 +++---- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 33 +++++++--------------- 7 files changed, 25 insertions(+), 53 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 8482e4c..180e14c 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -13,7 +13,7 @@ * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY @@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin /// public class BulletXMaths { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Vector3 public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) @@ -313,10 +313,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin bool needsCollision = base.NeedsCollision(bodyA, bodyB); - //m_log.Debug("[BulletX]: A collision was detected between {0} and {1} --> {2}", nameA, nameB, + //m_log.DebugFormat("[BulletX]: A collision was detected between {0} and {1} --> {2}", nameA, nameB, //needsCollision); - return needsCollision; } } diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index 7dae4ac..928a628 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs @@ -13,7 +13,7 @@ * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index ac06614..bcc2c37 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs @@ -13,7 +13,7 @@ * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index ec13564..30fab39 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -13,7 +13,7 @@ * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY @@ -53,7 +53,7 @@ namespace OpenSim.Region.Physics.Meshing public class Meshmerizer : IMesher { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Setting baseDir to a path will enable the dumping of raw files // raw files can be imported by blender so a visual inspection of the results can be done @@ -530,12 +530,11 @@ namespace OpenSim.Region.Physics.Meshing } } - - Mesh result = extr.Extrude(m); result.DumpRaw(baseDir, primName, "Z extruded"); return result; } + private static Mesh CreateCyllinderMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) // Builds the z (+ and -) surfaces of a box shaped prim { @@ -601,7 +600,6 @@ namespace OpenSim.Region.Physics.Meshing Vertex Q1Q13 = new Vertex(-0.43f, -0.24f, 0.0f); Vertex Q1Q14 = new Vertex(-0.40f, -0.30f, 0.0f); - SimpleHull outerHull = new SimpleHull(); //Clockwise around the quadrants outerHull.AddVertex(Q1Q15); @@ -684,7 +682,7 @@ namespace OpenSim.Region.Physics.Meshing // Calculated separately to avoid errors cutHull.AddVertex(legEnd); - // m_log.DebugFormat("Starting cutting of the hollow shape from the prim {1}", 0, primName); + // m_log.DebugFormat("Starting cutting of the hollow shape from the prim {1}", 0, primName); SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull); outerHull = cuttedHull; @@ -693,7 +691,6 @@ namespace OpenSim.Region.Physics.Meshing // Deal with the hole here if (hollowFactor > 0) { - SimpleHull holeHull = BuildHoleHull(primShape, primShape.ProfileShape, primShape.HollowShape, hollowFactor); if (holeHull != null) { @@ -799,10 +796,8 @@ namespace OpenSim.Region.Physics.Meshing Mesh result = extr.Extrude(m); result.DumpRaw(baseDir, primName, "Z extruded"); return result; - } - private static Mesh CreatePrismMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) // Builds the z (+ and -) surfaces of a box shaped prim { @@ -837,7 +832,6 @@ namespace OpenSim.Region.Physics.Meshing outerHull.AddVertex(PM); outerHull.AddVertex(PP); - // Deal with cuts now if ((profileBegin != 0) || (profileEnd != 0)) { @@ -882,8 +876,6 @@ namespace OpenSim.Region.Physics.Meshing // Deal with the hole here if (hollowFactor > 0) { - - SimpleHull holeHull = BuildHoleHull(primShape, primShape.ProfileShape, primShape.HollowShape, hollowFactor); if (holeHull != null) { @@ -940,7 +932,6 @@ namespace OpenSim.Region.Physics.Meshing extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100); //m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString()); } - } if (taperY != 100) @@ -957,7 +948,6 @@ namespace OpenSim.Region.Physics.Meshing } } - if (pathShearX != 0) { if (pathShearX > 50) @@ -988,8 +978,6 @@ namespace OpenSim.Region.Physics.Meshing } } - - Mesh result = extr.Extrude(m); result.DumpRaw(baseDir, primName, "Z extruded"); return result; @@ -1090,4 +1078,4 @@ namespace OpenSim.Region.Physics.Meshing return mesh; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/Meshing/SimpleHull.cs b/OpenSim/Region/Physics/Meshing/SimpleHull.cs index 91df98f..58b9a0e 100644 --- a/OpenSim/Region/Physics/Meshing/SimpleHull.cs +++ b/OpenSim/Region/Physics/Meshing/SimpleHull.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Physics.Meshing // is defined by the hull lies inside or outside the simplex chain public class SimpleHull { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private List vertices = new List(); private List holeVertices = new List(); // Only used, when the hull is hollow @@ -228,8 +228,8 @@ namespace OpenSim.Region.Physics.Meshing distToV1 = distTemp; bestIntersectingSimplex = sTest; } - } // end if vTemp - } // end foreach + } + } Intersection = bestIntersection; if (bestIntersectingSimplex != null) @@ -308,7 +308,6 @@ namespace OpenSim.Region.Physics.Meshing //m_log.Debug("State after intersection detection for the base hull"); //m_log.DebugFormat("The otherHull is:\n{1}", 0, otherHullClone.ToString()); - bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone); if (!intersects && otherIsInBase) { @@ -317,7 +316,6 @@ namespace OpenSim.Region.Physics.Meshing return baseHullClone; } - SimpleHull result = new SimpleHull(); // Find a good starting Simplex from baseHull @@ -394,4 +392,4 @@ namespace OpenSim.Region.Physics.Meshing return result; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index c41f812..499422f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.OdePlugin } public class OdeCharacter : PhysicsActor { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private PhysicsVector _position; private d.Vector3 _zeroPosition; diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0cfb5ff..a8ee20d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// public class OdePlugin : IPhysicsPlugin { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private CollisionLocker ode; private OdeScene _mScene; @@ -75,8 +75,6 @@ namespace OpenSim.Region.Physics.OdePlugin public void Dispose() { - - } } @@ -324,7 +322,7 @@ namespace OpenSim.Region.Physics.OdePlugin //if (id == d.GeomClassId.TriMeshClass) //{ - // m_log.Info("near: A collision was detected between {1} and {2}", 0, name1, name2); + // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2); //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); //} @@ -357,7 +355,6 @@ namespace OpenSim.Region.Physics.OdePlugin IntPtr joint; // If we're colliding with terrain, use 'TerrainContact' instead of contact. // allows us to have different settings - if (!actor_name_map.TryGetValue(g1, out p1)) { @@ -371,7 +368,6 @@ namespace OpenSim.Region.Physics.OdePlugin // We only need to test p2 for 'jump crouch purposes' p2.IsColliding = true; - switch (p1.PhysicsActorType) { case (int)ActorTypes.Agent: @@ -395,12 +391,12 @@ namespace OpenSim.Region.Physics.OdePlugin if (contacts[i].depth >= 0.08f) { - //This is disabled at the moment only because it needs more tweaking - //It will eventually be uncommented + //This is disabled at the moment only because it needs more tweaking + //It will eventually be uncommented if (contacts[i].depth >= 1.00f) { - //m_log.Debug("[PHYSICS]: " +contacts[i].depth.ToString()); + //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); } //If you interpenetrate a prim with an agent @@ -769,7 +765,6 @@ namespace OpenSim.Region.Physics.OdePlugin // If the geometry is in the targetspace, remove it from the target space //m_log.Warn(prim.m_targetSpace); - //if (prim.m_targetSpace != (IntPtr)0) //{ if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) @@ -832,12 +827,10 @@ namespace OpenSim.Region.Physics.OdePlugin //} } - - ode.dunlock(world); - } } + /// /// Takes a space pointer and zeros out the array we're using to hold the spaces /// @@ -914,7 +907,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - //If there are no more geometries in the sub-space, we don't need it in the main space anymore if (d.SpaceGetNumGeoms(currentspace) == 0) { @@ -980,7 +972,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - // The routines in the Position and Size sections do the 'inserting' into the space, // so all we have to do is make sure that the space that we're putting the prim into // is in the 'main' space. @@ -1111,7 +1102,7 @@ namespace OpenSim.Region.Physics.OdePlugin name2 = "null"; } - m_log.Info("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); + m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); */ return 1; } @@ -1131,14 +1122,14 @@ namespace OpenSim.Region.Physics.OdePlugin name2 = "null"; } -// m_log.Info("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); +// m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); d.Vector3 v0 = new d.Vector3(); d.Vector3 v1 = new d.Vector3(); d.Vector3 v2 = new d.Vector3(); d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); -// 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); +// m_log.DebugFormat("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); return 1; } @@ -1282,10 +1273,8 @@ namespace OpenSim.Region.Physics.OdePlugin foreach (OdeCharacter actor in _characters) { actor.Move(timeStep); - } - collision_optimized(timeStep); d.WorldQuickStep(world, ODE_STEPSIZE); @@ -1299,9 +1288,6 @@ namespace OpenSim.Region.Physics.OdePlugin ode.dunlock(world); } - - - step_time -= ODE_STEPSIZE; i++; } @@ -1691,6 +1677,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override void DeleteTerrain() { } + public override void Dispose() { lock (OdeLock) -- cgit v1.1