minor: Add method doc to collision subscription methods. Change method case to reflect OpenSim standards.

bulletsim
Justin Clark-Casey (justincc) 2011-07-30 03:11:36 +01:00
parent 310a685220
commit d917010433
4 changed files with 26 additions and 8 deletions

View File

@ -4821,7 +4821,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysActor.OnCollisionUpdate += PhysicsCollision; PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000); PhysActor.SubscribeEvents(1000);
} }
} }
else else

View File

@ -1220,14 +1220,16 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
m_requestedUpdateFrequency = ms; m_requestedUpdateFrequency = ms;
m_eventsubscription = ms; m_eventsubscription = ms;
_parent_scene.addCollisionEventReporting(this); _parent_scene.AddCollisionEventReporting(this);
} }
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
_parent_scene.remCollisionEventReporting(this); _parent_scene.RemoveCollisionEventReporting(this);
m_requestedUpdateFrequency = 0; m_requestedUpdateFrequency = 0;
m_eventsubscription = 0; m_eventsubscription = 0;
} }
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
{ {
if (m_eventsubscription > 0) if (m_eventsubscription > 0)
@ -1248,6 +1250,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_eventsubscription = 0; m_eventsubscription = 0;
} }
} }
public override bool SubscribedEvents() public override bool SubscribedEvents()
{ {
if (m_eventsubscription > 0) if (m_eventsubscription > 0)

View File

@ -2986,12 +2986,12 @@ Console.WriteLine("changeshape not need meshing");
public override void SubscribeEvents(int ms) public override void SubscribeEvents(int ms)
{ {
m_eventsubscription = ms; m_eventsubscription = ms;
_parent_scene.addCollisionEventReporting(this); _parent_scene.AddCollisionEventReporting(this);
} }
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
_parent_scene.remCollisionEventReporting(this); _parent_scene.RemoveCollisionEventReporting(this);
m_eventsubscription = 0; m_eventsubscription = 0;
} }

View File

@ -198,7 +198,12 @@ namespace OpenSim.Region.Physics.OdePlugin
private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>();
private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
/// <summary>
/// A list of actors that should receive collision events.
/// </summary>
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
@ -1604,7 +1609,11 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
// End recovered. Kitto Flora // End recovered. Kitto Flora
public void addCollisionEventReporting(PhysicsActor obj) /// <summary>
/// Add actor to the list that should receive collision events in the simulate loop.
/// </summary>
/// <param name="obj"></param>
public void AddCollisionEventReporting(PhysicsActor obj)
{ {
lock (_collisionEventPrim) lock (_collisionEventPrim)
{ {
@ -1613,7 +1622,11 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
public void remCollisionEventReporting(PhysicsActor obj) /// <summary>
/// Remove actor from the list that should receive collision events in the simulate loop.
/// </summary>
/// <param name="obj"></param>
public void RemoveCollisionEventReporting(PhysicsActor obj)
{ {
lock (_collisionEventPrim) lock (_collisionEventPrim)
{ {
@ -2132,7 +2145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
lock (prim) lock (prim)
{ {
remCollisionEventReporting(prim); RemoveCollisionEventReporting(prim);
lock (ode) lock (ode)
{ {
if (prim.prim_geom != IntPtr.Zero) if (prim.prim_geom != IntPtr.Zero)
@ -2792,6 +2805,8 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
if (obj == null) if (obj == null)
continue; continue;
// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName);
switch ((ActorTypes)obj.PhysicsActorType) switch ((ActorTypes)obj.PhysicsActorType)
{ {
case ActorTypes.Agent: case ActorTypes.Agent:
@ -2799,6 +2814,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
cobj.AddCollisionFrameTime(100); cobj.AddCollisionFrameTime(100);
cobj.SendCollisions(); cobj.SendCollisions();
break; break;
case ActorTypes.Prim: case ActorTypes.Prim:
OdePrim pobj = (OdePrim)obj; OdePrim pobj = (OdePrim)obj;
pobj.SendCollisions(); pobj.SendCollisions();