From daf99f8c0ac874971c829b18a2372be1c4ee9541 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 22 Nov 2011 21:51:00 +0000
Subject: slightly simplify OdeScene.Simulate() by removing bool processtaints,
since we can inspect count of taint lists instead.
also groups OdeCharacter.CreateOdeStructures() and DestroyOdeStructures() together
---
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 34 +++++++++-------------------
1 file changed, 11 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs')
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index e219535..72e9ca0 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -2160,7 +2160,6 @@ namespace OpenSim.Region.Physics.OdePlugin
p.setPrimForRemoval();
AddPhysicsActorTaint(prim);
- //RemovePrimThreadLocked(p);
}
}
}
@@ -2607,15 +2606,17 @@ namespace OpenSim.Region.Physics.OdePlugin
///
/// Called after our prim properties are set Scale, position etc.
+ ///
+ ///
/// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex
/// This assures us that we have no race conditions
- ///
- ///
- public override void AddPhysicsActorTaint(PhysicsActor prim)
+ ///
+ ///
+ public override void AddPhysicsActorTaint(PhysicsActor actor)
{
- if (prim is OdePrim)
+ if (actor is OdePrim)
{
- OdePrim taintedprim = ((OdePrim) prim);
+ OdePrim taintedprim = ((OdePrim)actor);
lock (_taintedPrimLock)
{
if (!(_taintedPrimH.Contains(taintedprim)))
@@ -2627,11 +2628,10 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
_taintedPrimL.Add(taintedprim); // List for ordered readout
}
}
- return;
}
- else if (prim is OdeCharacter)
+ else if (actor is OdeCharacter)
{
- OdeCharacter taintedchar = ((OdeCharacter)prim);
+ OdeCharacter taintedchar = ((OdeCharacter)actor);
lock (_taintedActors)
{
if (!(_taintedActors.Contains(taintedchar)))
@@ -2734,29 +2734,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{
try
{
- // Insert, remove Characters
- bool processedtaints = false;
-
lock (_taintedActors)
{
if (_taintedActors.Count > 0)
{
foreach (OdeCharacter character in _taintedActors)
- {
character.ProcessTaints();
- processedtaints = true;
- //character.m_collisionscore = 0;
- }
-
- if (processedtaints)
+ if (_taintedActors.Count > 0)
_taintedActors.Clear();
}
}
- // Modify other objects in the scene.
- processedtaints = false;
-
lock (_taintedPrimLock)
{
foreach (OdePrim prim in _taintedPrimL)
@@ -2772,7 +2761,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
prim.ProcessTaints();
}
- processedtaints = true;
prim.m_collisionscore = 0;
// This loop can block up the Heartbeat for a very long time on large regions.
@@ -2785,7 +2773,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
if (SupportsNINJAJoints)
SimulatePendingNINJAJoints();
- if (processedtaints)
+ if (_taintedPrimL.Count > 0)
{
//Console.WriteLine("Simulate calls Clear of _taintedPrim list");
_taintedPrimH.Clear();
--
cgit v1.1