Remove the unused CollisionLocker from ODE

Despite its name, this wasn't actually being used in any collision checking
0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-18 17:35:58 +01:00
parent 614ea5a48a
commit 7c409eff53
4 changed files with 87 additions and 97 deletions

View File

@ -144,7 +144,10 @@ namespace OpenSim.Region.Physics.OdePlugin
internal UUID m_uuid { get; private set; } internal UUID m_uuid { get; private set; }
internal bool bad = false; internal bool bad = false;
public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) public OdeCharacter(
String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
float capsule_radius, float tensor, float density, float height_fudge_factor,
float walk_divisor, float rundivisor)
{ {
m_uuid = UUID.Random(); m_uuid = UUID.Random();

View File

@ -144,8 +144,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public uint m_localID { get; private set; } public uint m_localID { get; private set; }
private CollisionLocker ode;
private bool m_taintforce = false; private bool m_taintforce = false;
private bool m_taintaddangularforce = false; private bool m_taintaddangularforce = false;
private Vector3 m_force; private Vector3 m_force;
@ -203,13 +201,14 @@ namespace OpenSim.Region.Physics.OdePlugin
internal int m_material = (int)Material.Wood; internal int m_material = (int)Material.Wood;
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, public OdePrim(
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
{ {
Name = primName; Name = primName;
m_vehicle = new ODEDynamics(); m_vehicle = new ODEDynamics();
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
ode = dode;
if (!pos.IsFinite()) if (!pos.IsFinite())
{ {
pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
@ -1390,7 +1389,6 @@ Console.WriteLine("CreateGeom:");
catch (AccessViolationException) catch (AccessViolationException)
{ {
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name); m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
ode.dunlock(_parent_scene.world);
return; return;
} }
} }
@ -1405,7 +1403,6 @@ Console.WriteLine("CreateGeom:");
catch (AccessViolationException) catch (AccessViolationException)
{ {
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name); m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
ode.dunlock(_parent_scene.world);
return; return;
} }
} }
@ -1421,7 +1418,6 @@ Console.WriteLine("CreateGeom:");
catch (AccessViolationException) catch (AccessViolationException)
{ {
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name); m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
ode.dunlock(_parent_scene.world);
return; return;
} }
} }
@ -1437,7 +1433,6 @@ Console.WriteLine("CreateGeom:");
catch (AccessViolationException) catch (AccessViolationException)
{ {
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name); m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
ode.dunlock(_parent_scene.world);
return; return;
} }
} }

View File

@ -48,14 +48,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
//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 m_ode;
private OdeScene m_scene; private OdeScene m_scene;
public OdePlugin()
{
m_ode = new CollisionLocker();
}
public bool Init() public bool Init()
{ {
return true; return true;
@ -69,7 +63,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// http://opensimulator.org/mantis/view.php?id=2750). // http://opensimulator.org/mantis/view.php?id=2750).
d.InitODE(); d.InitODE();
m_scene = new OdeScene(m_ode, sceneIdentifier); m_scene = new OdeScene(sceneIdentifier);
} }
return (m_scene); return (m_scene);
} }

View File

@ -105,8 +105,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private readonly ILog m_log; private readonly ILog m_log;
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
CollisionLocker ode;
private Random fluidRandomizer = new Random(Environment.TickCount); private Random fluidRandomizer = new Random(Environment.TickCount);
private const uint m_regionWidth = Constants.RegionSize; private const uint m_regionWidth = Constants.RegionSize;
@ -312,13 +310,12 @@ namespace OpenSim.Region.Physics.OdePlugin
/// Sets many properties that ODE requires to be stable /// Sets many properties that ODE requires to be stable
/// These settings need to be tweaked 'exactly' right or weird stuff happens. /// These settings need to be tweaked 'exactly' right or weird stuff happens.
/// </summary> /// </summary>
public OdeScene(CollisionLocker dode, string sceneIdentifier) public OdeScene(string sceneIdentifier)
{ {
m_log m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
OdeLock = new Object(); OdeLock = new Object();
ode = dode;
nearCallback = near; nearCallback = near;
triCallback = TriCallback; triCallback = TriCallback;
triArrayCallback = TriArrayCallback; triArrayCallback = TriArrayCallback;
@ -767,8 +764,8 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
catch (SEHException) catch (SEHException)
{ {
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."); m_log.Error(
ode.drelease(world); "[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.");
base.TriggerPhysicsBasedRestart(); base.TriggerPhysicsBasedRestart();
} }
catch (Exception e) catch (Exception e)
@ -1664,7 +1661,13 @@ namespace OpenSim.Region.Physics.OdePlugin
pos.X = position.X; pos.X = position.X;
pos.Y = position.Y; pos.Y = position.Y;
pos.Z = position.Z; pos.Z = position.Z;
OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun);
OdeCharacter newAv
= new OdeCharacter(
avName, this, pos, size, avPIDD, avPIDP,
avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor,
avMovementDivisorWalk, avMovementDivisorRun);
newAv.Flying = isFlying; newAv.Flying = isFlying;
newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset;
@ -1720,7 +1723,7 @@ namespace OpenSim.Region.Physics.OdePlugin
OdePrim newPrim; OdePrim newPrim;
lock (OdeLock) lock (OdeLock)
{ {
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical, ode); newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical);
lock (_prims) lock (_prims)
_prims.Add(newPrim); _prims.Add(newPrim);
@ -2157,8 +2160,7 @@ namespace OpenSim.Region.Physics.OdePlugin
lock (prim) lock (prim)
{ {
RemoveCollisionEventReporting(prim); RemoveCollisionEventReporting(prim);
lock (ode)
{
if (prim.prim_geom != IntPtr.Zero) if (prim.prim_geom != IntPtr.Zero)
{ {
prim.ResetTaints(); prim.ResetTaints();
@ -2231,13 +2233,10 @@ namespace OpenSim.Region.Physics.OdePlugin
//} //}
if (SupportsNINJAJoints) if (SupportsNINJAJoints)
{
RemoveAllJointsConnectedToActorThreadLocked(prim); RemoveAllJointsConnectedToActorThreadLocked(prim);
} }
} }
} }
}
}
#endregion #endregion
@ -2824,7 +2823,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e); m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
ode.dunlock(world);
} }
timeLeft -= ODE_STEPSIZE; timeLeft -= ODE_STEPSIZE;