Remove the unused CollisionLocker from ODE
Despite its name, this wasn't actually being used in any collision checking0.7.2-post-fixes
parent
614ea5a48a
commit
7c409eff53
|
@ -144,7 +144,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
internal UUID m_uuid { get; private set; }
|
||||
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();
|
||||
|
||||
|
|
|
@ -144,8 +144,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
public uint m_localID { get; private set; }
|
||||
|
||||
private CollisionLocker ode;
|
||||
|
||||
private bool m_taintforce = false;
|
||||
private bool m_taintaddangularforce = false;
|
||||
private Vector3 m_force;
|
||||
|
@ -203,13 +201,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
internal int m_material = (int)Material.Wood;
|
||||
|
||||
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
||||
public OdePrim(
|
||||
String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
|
||||
{
|
||||
Name = primName;
|
||||
m_vehicle = new ODEDynamics();
|
||||
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
|
||||
ode = dode;
|
||||
|
||||
if (!pos.IsFinite())
|
||||
{
|
||||
pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
|
||||
|
@ -1390,7 +1389,6 @@ Console.WriteLine("CreateGeom:");
|
|||
catch (AccessViolationException)
|
||||
{
|
||||
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
|
||||
ode.dunlock(_parent_scene.world);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1405,7 +1403,6 @@ Console.WriteLine("CreateGeom:");
|
|||
catch (AccessViolationException)
|
||||
{
|
||||
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
|
||||
ode.dunlock(_parent_scene.world);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1421,7 +1418,6 @@ Console.WriteLine("CreateGeom:");
|
|||
catch (AccessViolationException)
|
||||
{
|
||||
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
|
||||
ode.dunlock(_parent_scene.world);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1437,7 +1433,6 @@ Console.WriteLine("CreateGeom:");
|
|||
catch (AccessViolationException)
|
||||
{
|
||||
m_log.WarnFormat("[PHYSICS]: Unable to create physics proxy for object {0}", Name);
|
||||
ode.dunlock(_parent_scene.world);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 CollisionLocker m_ode;
|
||||
private OdeScene m_scene;
|
||||
|
||||
public OdePlugin()
|
||||
{
|
||||
m_ode = new CollisionLocker();
|
||||
}
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
return true;
|
||||
|
@ -69,7 +63,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// http://opensimulator.org/mantis/view.php?id=2750).
|
||||
d.InitODE();
|
||||
|
||||
m_scene = new OdeScene(m_ode, sceneIdentifier);
|
||||
m_scene = new OdeScene(sceneIdentifier);
|
||||
}
|
||||
return (m_scene);
|
||||
}
|
||||
|
|
|
@ -105,8 +105,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private readonly ILog m_log;
|
||||
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
|
||||
|
||||
CollisionLocker ode;
|
||||
|
||||
private Random fluidRandomizer = new Random(Environment.TickCount);
|
||||
|
||||
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
|
||||
/// These settings need to be tweaked 'exactly' right or weird stuff happens.
|
||||
/// </summary>
|
||||
public OdeScene(CollisionLocker dode, string sceneIdentifier)
|
||||
public OdeScene(string sceneIdentifier)
|
||||
{
|
||||
m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
|
||||
|
||||
OdeLock = new Object();
|
||||
ode = dode;
|
||||
nearCallback = near;
|
||||
triCallback = TriCallback;
|
||||
triArrayCallback = TriArrayCallback;
|
||||
|
@ -767,8 +764,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
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.");
|
||||
ode.drelease(world);
|
||||
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.");
|
||||
base.TriggerPhysicsBasedRestart();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1664,7 +1661,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
pos.X = position.X;
|
||||
pos.Y = position.Y;
|
||||
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.MinimumGroundFlightOffset = minimumGroundFlightOffset;
|
||||
|
||||
|
@ -1720,7 +1723,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
OdePrim newPrim;
|
||||
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)
|
||||
_prims.Add(newPrim);
|
||||
|
@ -2157,84 +2160,80 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
lock (prim)
|
||||
{
|
||||
RemoveCollisionEventReporting(prim);
|
||||
lock (ode)
|
||||
|
||||
if (prim.prim_geom != IntPtr.Zero)
|
||||
{
|
||||
if (prim.prim_geom != IntPtr.Zero)
|
||||
prim.ResetTaints();
|
||||
|
||||
if (prim.IsPhysical)
|
||||
{
|
||||
prim.ResetTaints();
|
||||
|
||||
if (prim.IsPhysical)
|
||||
prim.disableBody();
|
||||
if (prim.childPrim)
|
||||
{
|
||||
prim.disableBody();
|
||||
if (prim.childPrim)
|
||||
{
|
||||
prim.childPrim = false;
|
||||
prim.Body = IntPtr.Zero;
|
||||
prim.m_disabled = true;
|
||||
prim.IsPhysical = false;
|
||||
}
|
||||
|
||||
|
||||
prim.childPrim = false;
|
||||
prim.Body = IntPtr.Zero;
|
||||
prim.m_disabled = true;
|
||||
prim.IsPhysical = false;
|
||||
}
|
||||
// we don't want to remove the main space
|
||||
|
||||
// If the geometry is in the targetspace, remove it from the target space
|
||||
//m_log.Warn(prim.m_targetSpace);
|
||||
|
||||
//if (prim.m_targetSpace != IntPtr.Zero)
|
||||
//{
|
||||
//if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
|
||||
//{
|
||||
|
||||
//if (d.GeomIsSpace(prim.m_targetSpace))
|
||||
//{
|
||||
//waitForSpaceUnlock(prim.m_targetSpace);
|
||||
//d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
|
||||
prim.m_targetSpace = IntPtr.Zero;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
|
||||
//((OdePrim)prim).m_targetSpace.ToString());
|
||||
//}
|
||||
|
||||
//}
|
||||
//}
|
||||
//m_log.Warn(prim.prim_geom);
|
||||
|
||||
if (!prim.RemoveGeom())
|
||||
m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
|
||||
|
||||
lock (_prims)
|
||||
_prims.Remove(prim);
|
||||
|
||||
//If there are no more geometries in the sub-space, we don't need it in the main space anymore
|
||||
//if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
|
||||
//{
|
||||
//if (prim.m_targetSpace != null)
|
||||
//{
|
||||
//if (d.GeomIsSpace(prim.m_targetSpace))
|
||||
//{
|
||||
//waitForSpaceUnlock(prim.m_targetSpace);
|
||||
//d.SpaceRemove(space, prim.m_targetSpace);
|
||||
// free up memory used by the space.
|
||||
//d.SpaceDestroy(prim.m_targetSpace);
|
||||
//int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
|
||||
//resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
|
||||
//((OdePrim) prim).m_targetSpace.ToString());
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
{
|
||||
RemoveAllJointsConnectedToActorThreadLocked(prim);
|
||||
}
|
||||
}
|
||||
// we don't want to remove the main space
|
||||
|
||||
// If the geometry is in the targetspace, remove it from the target space
|
||||
//m_log.Warn(prim.m_targetSpace);
|
||||
|
||||
//if (prim.m_targetSpace != IntPtr.Zero)
|
||||
//{
|
||||
//if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
|
||||
//{
|
||||
|
||||
//if (d.GeomIsSpace(prim.m_targetSpace))
|
||||
//{
|
||||
//waitForSpaceUnlock(prim.m_targetSpace);
|
||||
//d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
|
||||
prim.m_targetSpace = IntPtr.Zero;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
|
||||
//((OdePrim)prim).m_targetSpace.ToString());
|
||||
//}
|
||||
|
||||
//}
|
||||
//}
|
||||
//m_log.Warn(prim.prim_geom);
|
||||
|
||||
if (!prim.RemoveGeom())
|
||||
m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
|
||||
|
||||
lock (_prims)
|
||||
_prims.Remove(prim);
|
||||
|
||||
//If there are no more geometries in the sub-space, we don't need it in the main space anymore
|
||||
//if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
|
||||
//{
|
||||
//if (prim.m_targetSpace != null)
|
||||
//{
|
||||
//if (d.GeomIsSpace(prim.m_targetSpace))
|
||||
//{
|
||||
//waitForSpaceUnlock(prim.m_targetSpace);
|
||||
//d.SpaceRemove(space, prim.m_targetSpace);
|
||||
// free up memory used by the space.
|
||||
//d.SpaceDestroy(prim.m_targetSpace);
|
||||
//int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
|
||||
//resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
|
||||
//((OdePrim) prim).m_targetSpace.ToString());
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
if (SupportsNINJAJoints)
|
||||
RemoveAllJointsConnectedToActorThreadLocked(prim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2824,7 +2823,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
|
||||
ode.dunlock(world);
|
||||
}
|
||||
|
||||
timeLeft -= ODE_STEPSIZE;
|
||||
|
|
Loading…
Reference in New Issue