don't bother locking OdeScene._perloopContact in single threaded code

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-11-21 20:17:36 +00:00
parent 61848ebe0d
commit 4b2b0d4a05
1 changed files with 45 additions and 50 deletions

View File

@ -1244,69 +1244,64 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool checkDupe(d.ContactGeom contactGeom, int atype) private bool checkDupe(d.ContactGeom contactGeom, int atype)
{ {
bool result = false;
//return result;
if (!m_filterCollisions) if (!m_filterCollisions)
return false; return false;
bool result = false;
ActorTypes at = (ActorTypes)atype; ActorTypes at = (ActorTypes)atype;
lock (_perloopContact)
foreach (d.ContactGeom contact in _perloopContact)
{ {
foreach (d.ContactGeom contact in _perloopContact) //if ((contact.g1 == contactGeom.g1 && contact.g2 == contactGeom.g2))
//{
// || (contact.g2 == contactGeom.g1 && contact.g1 == contactGeom.g2)
if (at == ActorTypes.Agent)
{ {
//if ((contact.g1 == contactGeom.g1 && contact.g2 == contactGeom.g2)) if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom)
//{ {
// || (contact.g2 == contactGeom.g1 && contact.g1 == contactGeom.g2)
if (at == ActorTypes.Agent) if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f)
{
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom)
{ {
//contactGeom.depth *= .00005f;
if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
{ // m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
//contactGeom.depth *= .00005f; result = true;
//m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); break;
// m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
result = true;
break;
}
else
{
//m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
}
} }
else else
{ {
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
//int i = 0;
}
}
else if (at == ActorTypes.Prim)
{
//d.AABB aabb1 = new d.AABB();
//d.AABB aabb2 = new d.AABB();
//d.GeomGetAABB(contactGeom.g2, out aabb2);
//d.GeomGetAABB(contactGeom.g1, out aabb1);
//aabb1.
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom)
{
if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
{
if (Math.Abs(contact.depth - contactGeom.depth) < 0.272f)
{
result = true;
break;
}
}
//m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
} }
}
} else
{
//} //m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
//int i = 0;
}
}
else if (at == ActorTypes.Prim)
{
//d.AABB aabb1 = new d.AABB();
//d.AABB aabb2 = new d.AABB();
//d.GeomGetAABB(contactGeom.g2, out aabb2);
//d.GeomGetAABB(contactGeom.g1, out aabb1);
//aabb1.
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom)
{
if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
{
if (Math.Abs(contact.depth - contactGeom.depth) < 0.272f)
{
result = true;
break;
}
}
//m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
}
} }
} }