add thread allocation calls for new ode.dll (old ode)

LSLKeyTest
UbitUmarov 2015-11-21 02:53:35 +00:00
parent 0b36d4ea2f
commit 11342314e1
2 changed files with 25 additions and 16 deletions

View File

@ -2664,6 +2664,9 @@ Console.WriteLine(" JointCreateFixed");
m_log.Warn("[PHYSICS]: Too many crossing failures for: " + Name); m_log.Warn("[PHYSICS]: Too many crossing failures for: " + Name);
} }
*/ */
d.AllocateODEDataForThread(0U);
_position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
_position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
_position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f); _position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f);

View File

@ -1408,22 +1408,10 @@ namespace OpenSim.Region.PhysicsModule.ODE
{ {
if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f)
{ {
//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
// {
// //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) else if (at == ActorTypes.Prim)
{ {
@ -1716,6 +1704,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
{ {
d.AllocateODEDataForThread(0);
OdeCharacter newAv OdeCharacter newAv
= new OdeCharacter( = new OdeCharacter(
avName, this, position, velocity, size, avPIDD, avPIDP, avName, this, position, velocity, size, avPIDD, avPIDP,
@ -1735,7 +1725,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}", // "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}",
// actor.Name, actor.LocalID, Name); // actor.Name, actor.LocalID, Name);
((OdeCharacter) actor).Destroy(); lock (OdeLock)
{
d.AllocateODEDataForThread(0);
((OdeCharacter) actor).Destroy();
}
} }
internal void AddCharacter(OdeCharacter chr) internal void AddCharacter(OdeCharacter chr)
@ -1785,9 +1780,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
Vector3 siz = size; Vector3 siz = size;
Quaternion rot = rotation; Quaternion rot = rotation;
OdePrim newPrim; OdePrim newPrim;
lock (OdeLock) lock (OdeLock)
{ {
d.AllocateODEDataForThread(0);
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical); newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical);
lock (_prims) lock (_prims)
@ -2633,9 +2630,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
int donechanges = 0; int donechanges = 0;
if (_taintedPrims.Count > 0) if (_taintedPrims.Count > 0)
{ {
m_log.InfoFormat("[Ode] start processing pending actor operations"); m_log.InfoFormat("[Ode] start processing pending actor operations");
int tstart = Util.EnvironmentTickCount(); int tstart = Util.EnvironmentTickCount();
d.AllocateODEDataForThread(0);
lock (_taintedPrims) lock (_taintedPrims)
{ {
foreach (OdePrim prim in _taintedPrims) foreach (OdePrim prim in _taintedPrims)
@ -2716,6 +2716,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
lock (OdeLock) lock (OdeLock)
{ {
d.AllocateODEDataForThread(~0U);
while (step_time > HalfOdeStep) while (step_time > HalfOdeStep)
{ {
try try
@ -3293,6 +3295,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
lock (OdeLock) lock (OdeLock)
{ {
d.AllocateODEDataForThread(~0U);
IntPtr GroundGeom = IntPtr.Zero; IntPtr GroundGeom = IntPtr.Zero;
if (RegionTerrain.TryGetValue(pOffset, out GroundGeom)) if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
{ {
@ -3380,6 +3384,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
_worldInitialized = false; _worldInitialized = false;
d.AllocateODEDataForThread(~0U);
if (m_rayCastManager != null) if (m_rayCastManager != null)
{ {
m_rayCastManager.Dispose(); m_rayCastManager.Dispose();