Change access levels from private to protected to facilitate

subclassing; also add new method signatures. Thanks tuco and mikkopa.
Fix Mantis #3072.
0.6.3-post-fixes
Mike Mazur 2009-02-03 08:31:08 +00:00
parent 52deb50884
commit 949ae6136e
7 changed files with 219 additions and 210 deletions

View File

@ -213,6 +213,9 @@ namespace OpenSim.Region.Physics.Manager
public abstract void SubscribeEvents(int ms); public abstract void SubscribeEvents(int ms);
public abstract void UnSubscribeEvents(); public abstract void UnSubscribeEvents();
public abstract bool SubscribedEvents(); public abstract bool SubscribedEvents();
public virtual void SetCollisionMesh(byte[] meshdata, string meshname, bool scalemesh) { }
public virtual void SetBoundsScaling(bool scalemesh) { }
} }
public class NullPhysicsActor : PhysicsActor public class NullPhysicsActor : PhysicsActor

View File

@ -152,6 +152,12 @@ namespace OpenSim.Region.Physics.Manager
public abstract bool IsThreaded { get; } public abstract bool IsThreaded { get; }
public virtual uint Raycast(PhysicsVector pos, PhysicsVector dir, float rayLength, uint ignoreId)
{ return 0; }
public virtual void SetMaxFlightHeight(float maxheight) { }
private class NullPhysicsScene : PhysicsScene private class NullPhysicsScene : PhysicsScene
{ {
private static int m_workIndicator; private static int m_workIndicator;

View File

@ -57,73 +57,73 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
public class OdeCharacter : PhysicsActor public class OdeCharacter : PhysicsActor
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private PhysicsVector _position; protected PhysicsVector _position;
private d.Vector3 _zeroPosition; protected d.Vector3 _zeroPosition;
// private d.Matrix3 m_StandUpRotation; // protected d.Matrix3 m_StandUpRotation;
private bool _zeroFlag = false; protected bool _zeroFlag = false;
private bool m_lastUpdateSent = false; protected bool m_lastUpdateSent = false;
private PhysicsVector _velocity; protected PhysicsVector _velocity;
private PhysicsVector _target_velocity; protected PhysicsVector _target_velocity;
private PhysicsVector _acceleration; protected PhysicsVector _acceleration;
private PhysicsVector m_rotationalVelocity; protected PhysicsVector m_rotationalVelocity;
private float m_mass = 80f; protected float m_mass = 80f;
public float m_density = 60f; public float m_density = 60f;
private bool m_pidControllerActive = true; protected bool m_pidControllerActive = true;
public float PID_D = 800.0f; public float PID_D = 800.0f;
public float PID_P = 900.0f; public float PID_P = 900.0f;
//private static float POSTURE_SERVO = 10000.0f; //protected static float POSTURE_SERVO = 10000.0f;
public float CAPSULE_RADIUS = 0.37f; public float CAPSULE_RADIUS = 0.37f;
public float CAPSULE_LENGTH = 2.140599f; public float CAPSULE_LENGTH = 2.140599f;
public float m_tensor = 3800000f; public float m_tensor = 3800000f;
public float heightFudgeFactor = 0.52f; public float heightFudgeFactor = 0.52f;
public float walkDivisor = 1.3f; public float walkDivisor = 1.3f;
public float runDivisor = 0.8f; public float runDivisor = 0.8f;
private bool flying = false; protected bool flying = false;
private bool m_iscolliding = false; protected bool m_iscolliding = false;
private bool m_iscollidingGround = false; protected bool m_iscollidingGround = false;
private bool m_wascolliding = false; protected bool m_wascolliding = false;
private bool m_wascollidingGround = false; protected bool m_wascollidingGround = false;
private bool m_iscollidingObj = false; protected bool m_iscollidingObj = false;
private bool m_alwaysRun = false; protected bool m_alwaysRun = false;
private bool m_hackSentFall = false; protected bool m_hackSentFall = false;
private bool m_hackSentFly = false; protected bool m_hackSentFly = false;
private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); protected PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0);
public uint m_localID = 0; public uint m_localID = 0;
public bool m_returnCollisions = false; public bool m_returnCollisions = false;
// taints and their non-tainted counterparts // taints and their non-tainted counterparts
public bool m_isPhysical = false; // the current physical status public bool m_isPhysical = false; // the current physical status
public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. protected float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
private float m_buoyancy = 0f; protected float m_buoyancy = 0f;
// private CollisionLocker ode; // protected CollisionLocker ode;
private string m_name = String.Empty; protected string m_name = String.Empty;
private bool[] m_colliderarr = new bool[11]; protected bool[] m_colliderarr = new bool[11];
private bool[] m_colliderGroundarr = new bool[11]; protected bool[] m_colliderGroundarr = new bool[11];
// Default we're a Character // Default we're a Character
private CollisionCategories m_collisionCategories = (CollisionCategories.Character); protected CollisionCategories m_collisionCategories = (CollisionCategories.Character);
// Default, Collide with Other Geometries, spaces, bodies and characters. // Default, Collide with Other Geometries, spaces, bodies and characters.
private CollisionCategories m_collisionFlags = (CollisionCategories.Geom protected CollisionCategories m_collisionFlags = (CollisionCategories.Geom
| CollisionCategories.Space | CollisionCategories.Space
| CollisionCategories.Body | CollisionCategories.Body
| CollisionCategories.Character | CollisionCategories.Character
| CollisionCategories.Land); | CollisionCategories.Land);
public IntPtr Body = IntPtr.Zero; public IntPtr Body = IntPtr.Zero;
private OdeScene _parent_scene; protected OdeScene _parent_scene;
public IntPtr Shell = IntPtr.Zero; public IntPtr Shell = IntPtr.Zero;
public IntPtr Amotor = IntPtr.Zero; public IntPtr Amotor = IntPtr.Zero;
public d.Mass ShellMass; public d.Mass ShellMass;
public bool collidelock = false; public bool collidelock = false;
public int m_eventsubscription = 0; public int m_eventsubscription = 0;
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); protected CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector 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, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
{ {
@ -421,7 +421,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access // WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
// to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only // to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
// place that is safe to call this routine AvatarGeomAndBodyCreation. // place that is safe to call this routine AvatarGeomAndBodyCreation.
private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor) protected void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor)
{ {
//CAPSULE_LENGTH = -5; //CAPSULE_LENGTH = -5;
//CAPSULE_RADIUS = -5; //CAPSULE_RADIUS = -5;
@ -535,7 +535,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// This code is very useful. Written by DanX0r. We're just not using it right now. // This code is very useful. Written by DanX0r. We're just not using it right now.
// Commented out to prevent a warning. // Commented out to prevent a warning.
// //
// private void standupStraight() // protected void standupStraight()
// { // {
// // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. // // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air.
// // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you // // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you
@ -714,7 +714,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// This is the avatar's movement control + PID Controller /// This is the avatar's movement control + PID Controller
/// </summary> /// </summary>
/// <param name="timeStep"></param> /// <param name="timeStep"></param>
public void Move(float timeStep) public virtual void Move(float timeStep)
{ {
// no lock; for now it's only called from within Simulate() // no lock; for now it's only called from within Simulate()

View File

@ -43,54 +43,54 @@ namespace OpenSim.Region.Physics.OdePlugin
public class OdePrim : PhysicsActor public class OdePrim : PhysicsActor
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private PhysicsVector _position; protected PhysicsVector _position;
private PhysicsVector _velocity; protected PhysicsVector _velocity;
private PhysicsVector _torque = new PhysicsVector(0,0,0); protected PhysicsVector _torque = new PhysicsVector(0,0,0);
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); protected PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); protected PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
private Quaternion m_lastorientation = new Quaternion(); protected Quaternion m_lastorientation = new Quaternion();
private PhysicsVector m_rotationalVelocity; protected PhysicsVector m_rotationalVelocity;
private PhysicsVector _size; protected PhysicsVector _size;
private PhysicsVector _acceleration; protected PhysicsVector _acceleration;
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); // protected d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
private Quaternion _orientation; protected Quaternion _orientation;
private PhysicsVector m_taintposition; protected PhysicsVector m_taintposition;
private PhysicsVector m_taintsize; protected PhysicsVector m_taintsize;
private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); protected PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); protected PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
private Quaternion m_taintrot; protected Quaternion m_taintrot;
private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); protected PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); protected PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
private IntPtr Amotor = IntPtr.Zero; protected IntPtr Amotor = IntPtr.Zero;
private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); protected PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
private float m_PIDTau = 0f; protected float m_PIDTau = 0f;
private float PID_D = 35f; protected float PID_D = 35f;
private float PID_G = 25f; protected float PID_G = 25f;
private float m_tensor = 5f; protected float m_tensor = 5f;
private int body_autodisable_frames = 20; protected int body_autodisable_frames = 20;
private IMesh primMesh = null; protected IMesh primMesh = null;
private bool m_usePID = false; protected bool m_usePID = false;
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom protected const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
| CollisionCategories.Space | CollisionCategories.Space
| CollisionCategories.Body | CollisionCategories.Body
| CollisionCategories.Character | CollisionCategories.Character
); );
private bool m_taintshape = false; protected bool m_taintshape = false;
private bool m_taintPhysics = false; protected bool m_taintPhysics = false;
private bool m_collidesLand = true; protected bool m_collidesLand = true;
private bool m_collidesWater = false; protected bool m_collidesWater = false;
public bool m_returnCollisions = false; public bool m_returnCollisions = false;
// Default we're a Geometry // Default we're a Geometry
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); protected CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
// Default, Collide with Other Geometries, spaces and Bodies // Default, Collide with Other Geometries, spaces and Bodies
private CollisionCategories m_collisionFlags = m_default_collisionFlags; protected CollisionCategories m_collisionFlags = m_default_collisionFlags;
public bool m_taintremove = false; public bool m_taintremove = false;
public bool m_taintdisable = false; public bool m_taintdisable = false;
@ -102,58 +102,58 @@ namespace OpenSim.Region.Physics.OdePlugin
public uint m_localID = 0; public uint m_localID = 0;
//public GCHandle gc; //public GCHandle gc;
private CollisionLocker ode; protected CollisionLocker ode;
private bool m_taintforce = false; protected bool m_taintforce = false;
private bool m_taintaddangularforce = false; protected bool m_taintaddangularforce = false;
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); protected PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); protected List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); protected List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
private IMesh _mesh; protected IMesh _mesh;
private PrimitiveBaseShape _pbs; protected PrimitiveBaseShape _pbs;
private OdeScene _parent_scene; protected OdeScene _parent_scene;
public IntPtr m_targetSpace = (IntPtr) 0; public IntPtr m_targetSpace = (IntPtr) 0;
public IntPtr prim_geom; public IntPtr prim_geom;
public IntPtr prev_geom; public IntPtr prev_geom;
public IntPtr _triMeshData; public IntPtr _triMeshData;
private IntPtr _linkJointGroup = (IntPtr)0; protected IntPtr _linkJointGroup = (IntPtr)0;
private PhysicsActor _parent = null; protected PhysicsActor _parent = null;
private PhysicsActor m_taintparent = null; protected PhysicsActor m_taintparent = null;
private List<OdePrim> childrenPrim = new List<OdePrim>(); protected List<OdePrim> childrenPrim = new List<OdePrim>();
private bool iscolliding = false; protected bool iscolliding = false;
private bool m_isphysical = false; protected bool m_isphysical = false;
private bool m_isSelected = false; protected bool m_isSelected = false;
internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively public bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
private bool m_throttleUpdates = false; protected bool m_throttleUpdates = false;
private int throttleCounter = 0; protected int throttleCounter = 0;
public int m_interpenetrationcount = 0; public int m_interpenetrationcount = 0;
public float m_collisionscore = 0; public float m_collisionscore = 0;
public int m_roundsUnderMotionThreshold = 0; public int m_roundsUnderMotionThreshold = 0;
private int m_crossingfailures = 0; protected int m_crossingfailures = 0;
public float m_buoyancy = 0f; public float m_buoyancy = 0f;
public bool outofBounds = false; public bool outofBounds = false;
private float m_density = 10.000006836f; // Aluminum g/cm3; protected float m_density = 10.000006836f; // Aluminum g/cm3;
public bool _zeroFlag = false; public bool _zeroFlag = false;
private bool m_lastUpdateSent = false; protected bool m_lastUpdateSent = false;
public IntPtr Body = (IntPtr) 0; public IntPtr Body = (IntPtr) 0;
private String m_primName; protected String m_primName;
private PhysicsVector _target_velocity; protected PhysicsVector _target_velocity;
public d.Mass pMass; public d.Mass pMass;
public int m_eventsubscription = 0; public int m_eventsubscription = 0;
private CollisionEventUpdate CollisionEventsThisFrame = null; protected CollisionEventUpdate CollisionEventsThisFrame = null;
private IntPtr m_linkJoint = (IntPtr)0; protected IntPtr m_linkJoint = (IntPtr)0;
public volatile bool childPrim = false; public volatile bool childPrim = false;
@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin
#region Mass Calculation #region Mass Calculation
private float CalculateMass() protected float CalculateMass()
{ {
float volume = 0; float volume = 0;
@ -815,7 +815,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// } // }
} }
public void ProcessTaints(float timestep) public virtual void ProcessTaints(float timestep)
{ {
if (m_taintadd) if (m_taintadd)
{ {
@ -875,7 +875,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
private void changeAngularLock(float timestep) protected void changeAngularLock(float timestep)
{ {
// do we have a Physical object? // do we have a Physical object?
if (Body != IntPtr.Zero) if (Body != IntPtr.Zero)
@ -904,7 +904,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
} }
private void changelink(float timestep) protected void changelink(float timestep)
{ {
// If the newly set parent is not null // If the newly set parent is not null
// create link // create link
@ -1095,7 +1095,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
private void ChildSetGeom(OdePrim odePrim) public void ChildSetGeom(OdePrim odePrim)
{ {
//if (m_isphysical && Body != IntPtr.Zero) //if (m_isphysical && Body != IntPtr.Zero)
lock (childrenPrim) lock (childrenPrim)
@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
private void ChildDelink(OdePrim odePrim) protected void ChildDelink(OdePrim odePrim)
{ {
// Okay, we have a delinked child.. need to rebuild the body. // Okay, we have a delinked child.. need to rebuild the body.
lock (childrenPrim) lock (childrenPrim)
@ -1173,7 +1173,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
private void changeSelectedStatus(float timestep) protected void changeSelectedStatus(float timestep)
{ {
if (m_taintselected) if (m_taintselected)
{ {
@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintrot = _orientation; m_taintrot = _orientation;
} }
private void resetCollisionAccounting() protected void resetCollisionAccounting()
{ {
m_collisionscore = 0; m_collisionscore = 0;
m_interpenetrationcount = 0; m_interpenetrationcount = 0;
@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintaddangularforce = false; m_taintaddangularforce = false;
} }
private void changevelocity(float timestep) protected void changevelocity(float timestep)
{ {
if (!m_isSelected) if (!m_isSelected)
{ {
@ -2622,7 +2622,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override bool PIDActive { set { m_usePID = value; } } public override bool PIDActive { set { m_usePID = value; } }
public override float PIDTau { set { m_PIDTau = value; } } public override float PIDTau { set { m_PIDTau = value; } }
private void createAMotor(PhysicsVector axis) protected void createAMotor(PhysicsVector axis)
{ {
if (Body == IntPtr.Zero) if (Body == IntPtr.Zero)
return; return;

View File

@ -37,9 +37,9 @@ namespace OpenSim.Region.Physics.OdePlugin
[TestFixture] [TestFixture]
public class ODETestClass public class ODETestClass
{ {
private OdePlugin cbt; protected OdePlugin cbt;
private PhysicsScene ps; protected PhysicsScene ps;
private IMeshingPlugin imp; protected IMeshingPlugin imp;
[SetUp] [SetUp]
public void Initialize() public void Initialize()

View File

@ -34,7 +34,7 @@ using OpenSim.Region.Physics.OdePlugin;
namespace OpenSim.Region.Physics.OdePlugin namespace OpenSim.Region.Physics.OdePlugin
{ {
class OdePhysicsJoint : PhysicsJoint public class OdePhysicsJoint : PhysicsJoint
{ {
public override bool IsInPhysicsEngine public override bool IsInPhysicsEngine
{ {

View File

@ -52,10 +52,10 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary> /// </summary>
public class OdePlugin : IPhysicsPlugin public class OdePlugin : IPhysicsPlugin
{ {
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //protected static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private CollisionLocker ode; protected CollisionLocker ode;
private OdeScene _mScene; protected OdeScene _mScene;
public OdePlugin() public OdePlugin()
{ {
@ -124,62 +124,62 @@ namespace OpenSim.Region.Physics.OdePlugin
public class OdeScene : PhysicsScene public class OdeScene : PhysicsScene
{ {
private ILog m_log; protected ILog m_log;
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); // protected Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
CollisionLocker ode; protected CollisionLocker ode;
protected Random fluidRandomizer = new Random(Environment.TickCount); protected Random fluidRandomizer = new Random(Environment.TickCount);
private const uint m_regionWidth = Constants.RegionSize; protected const uint m_regionWidth = Constants.RegionSize;
private const uint m_regionHeight = Constants.RegionSize; protected const uint m_regionHeight = Constants.RegionSize;
private float ODE_STEPSIZE = 0.020f; protected float ODE_STEPSIZE = 0.020f;
private float metersInSpace = 29.9f; protected float metersInSpace = 29.9f;
public float gravityx = 0f; public float gravityx = 0f;
public float gravityy = 0f; public float gravityy = 0f;
public float gravityz = -9.8f; public float gravityz = -9.8f;
private float contactsurfacelayer = 0.001f; protected float contactsurfacelayer = 0.001f;
private int worldHashspaceLow = -4; protected int worldHashspaceLow = -4;
private int worldHashspaceHigh = 128; protected int worldHashspaceHigh = 128;
private int smallHashspaceLow = -4; protected int smallHashspaceLow = -4;
private int smallHashspaceHigh = 66; protected int smallHashspaceHigh = 66;
private float waterlevel = 0f; protected float waterlevel = 0f;
private int framecount = 0; protected int framecount = 0;
//private int m_returncollisions = 10; //protected int m_returncollisions = 10;
private IntPtr contactgroup; protected IntPtr contactgroup;
private IntPtr LandGeom; protected IntPtr LandGeom;
private IntPtr WaterGeom; protected IntPtr WaterGeom;
private float nmTerrainContactFriction = 255.0f; protected float nmTerrainContactFriction = 255.0f;
private float nmTerrainContactBounce = 0.1f; protected float nmTerrainContactBounce = 0.1f;
private float nmTerrainContactERP = 0.1025f; protected float nmTerrainContactERP = 0.1025f;
private float mTerrainContactFriction = 75f; protected float mTerrainContactFriction = 75f;
private float mTerrainContactBounce = 0.1f; protected float mTerrainContactBounce = 0.1f;
private float mTerrainContactERP = 0.05025f; protected float mTerrainContactERP = 0.05025f;
private float nmAvatarObjectContactFriction = 250f; protected float nmAvatarObjectContactFriction = 250f;
private float nmAvatarObjectContactBounce = 0.1f; protected float nmAvatarObjectContactBounce = 0.1f;
private float mAvatarObjectContactFriction = 75f; protected float mAvatarObjectContactFriction = 75f;
private float mAvatarObjectContactBounce = 0.1f; protected float mAvatarObjectContactBounce = 0.1f;
private float avPIDD = 3200f; protected float avPIDD = 3200f;
private float avPIDP = 1400f; protected float avPIDP = 1400f;
private float avCapRadius = 0.37f; protected float avCapRadius = 0.37f;
private float avStandupTensor = 2000000f; protected float avStandupTensor = 2000000f;
private float avDensity = 80f; protected float avDensity = 80f;
private float avHeightFudgeFactor = 0.52f; protected float avHeightFudgeFactor = 0.52f;
private float avMovementDivisorWalk = 1.3f; protected float avMovementDivisorWalk = 1.3f;
private float avMovementDivisorRun = 0.8f; protected float avMovementDivisorRun = 0.8f;
public bool meshSculptedPrim = true; public bool meshSculptedPrim = true;
@ -200,66 +200,66 @@ namespace OpenSim.Region.Physics.OdePlugin
public int bodyFramesAutoDisable = 20; public int bodyFramesAutoDisable = 20;
private float[] _heightmap; protected float[] _heightmap;
private float[] _watermap; protected float[] _watermap;
private bool m_filterCollisions = true; protected bool m_filterCollisions = true;
// private float[] _origheightmap; // protected float[] _origheightmap;
private d.NearCallback nearCallback; protected d.NearCallback nearCallback;
public d.TriCallback triCallback; public d.TriCallback triCallback;
public d.TriArrayCallback triArrayCallback; public d.TriArrayCallback triArrayCallback;
private List<OdeCharacter> _characters = new List<OdeCharacter>(); protected List<OdeCharacter> _characters = new List<OdeCharacter>();
private List<OdePrim> _prims = new List<OdePrim>(); protected List<OdePrim> _prims = new List<OdePrim>();
private List<OdePrim> _activeprims = new List<OdePrim>(); protected List<OdePrim> _activeprims = new List<OdePrim>();
private List<OdePrim> _taintedPrim = new List<OdePrim>(); protected List<OdePrim> _taintedPrim = new List<OdePrim>();
private List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); protected List<OdeCharacter> _taintedActors = new List<OdeCharacter>();
private List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); protected List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); protected List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
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>();
private bool m_NINJA_physics_joints_enabled = false; protected bool m_NINJA_physics_joints_enabled = false;
//private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>(); //protected Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
private Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>(); protected Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
private d.ContactGeom[] contacts = new d.ContactGeom[80]; protected d.ContactGeom[] contacts = new d.ContactGeom[80];
private List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active protected List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active
private List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. protected List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
private List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. protected List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
private List<string> requestedJointsToBeDeleted = new List<string>(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active protected List<string> requestedJointsToBeDeleted = new List<string>(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active
private Object externalJointRequestsLock = new Object(); protected Object externalJointRequestsLock = new Object();
private Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>(); protected Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
private Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>(); protected Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
private d.Contact contact; protected d.Contact contact;
private d.Contact TerrainContact; protected d.Contact TerrainContact;
private d.Contact AvatarMovementprimContact; protected d.Contact AvatarMovementprimContact;
private d.Contact AvatarMovementTerrainContact; protected d.Contact AvatarMovementTerrainContact;
private d.Contact WaterContact; protected d.Contact WaterContact;
//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
//Ckrinke private int m_randomizeWater = 200; //Ckrinke protected int m_randomizeWater = 200;
private int m_physicsiterations = 10; protected int m_physicsiterations = 10;
private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag protected float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
private PhysicsActor PANull = new NullPhysicsActor(); protected PhysicsActor PANull = new NullPhysicsActor();
private float step_time = 0.0f; protected float step_time = 0.0f;
//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
//Ckrinke private int ms = 0; //Ckrinke protected int ms = 0;
public IntPtr world; public IntPtr world;
//private bool returncollisions = false; //protected bool returncollisions = false;
// private uint obj1LocalID = 0; // protected uint obj1LocalID = 0;
private uint obj2LocalID = 0; protected uint obj2LocalID = 0;
//private int ctype = 0; //protected int ctype = 0;
private OdeCharacter cc1; protected OdeCharacter cc1;
private OdePrim cp1; protected OdePrim cp1;
private OdeCharacter cc2; protected OdeCharacter cc2;
private OdePrim cp2; protected OdePrim cp2;
//private int cStartStop = 0; //protected int cStartStop = 0;
//private string cDictKey = ""; //protected string cDictKey = "";
public IntPtr space; public IntPtr space;
//private IntPtr tmpSpace; //protected IntPtr tmpSpace;
// split static geometry collision handling into spaces of 30 meters // split static geometry collision handling into spaces of 30 meters
public IntPtr[,] staticPrimspace; public IntPtr[,] staticPrimspace;
@ -267,7 +267,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public IMesher mesher; public IMesher mesher;
private IConfigSource m_config; protected IConfigSource m_config;
public bool physics_logging = false; public bool physics_logging = false;
public int physics_logging_interval = 0; public int physics_logging_interval = 0;
@ -493,7 +493,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
internal void waitForSpaceUnlock(IntPtr space) public void waitForSpaceUnlock(IntPtr space)
{ {
//if (space != IntPtr.Zero) //if (space != IntPtr.Zero)
//while (d.SpaceLockQuery(space)) { } // Wait and do nothing //while (d.SpaceLockQuery(space)) { } // Wait and do nothing
@ -517,7 +517,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param>
/// <param name="g1">a geometry or space</param> /// <param name="g1">a geometry or space</param>
/// <param name="g2">another geometry or space</param> /// <param name="g2">another geometry or space</param>
private void near(IntPtr space, IntPtr g1, IntPtr g2) protected void near(IntPtr space, IntPtr g1, IntPtr g2)
{ {
// no lock here! It's invoked from within Simulate(), which is thread-locked // no lock here! It's invoked from within Simulate(), which is thread-locked
@ -912,7 +912,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
private bool checkDupe(d.ContactGeom contactGeom, int atype) protected bool checkDupe(d.ContactGeom contactGeom, int atype)
{ {
bool result = false; bool result = false;
//return result; //return result;
@ -982,7 +982,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return result; return result;
} }
private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) protected void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth)
{ {
// obj1LocalID = 0; // obj1LocalID = 0;
//returncollisions = false; //returncollisions = false;
@ -1160,7 +1160,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// This is our collision testing routine in ODE /// This is our collision testing routine in ODE
/// </summary> /// </summary>
/// <param name="timeStep"></param> /// <param name="timeStep"></param>
private void collision_optimized(float timeStep) protected void collision_optimized(float timeStep)
{ {
_perloopContact.Clear(); _perloopContact.Clear();
@ -1249,7 +1249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
#endregion #endregion
// TODO: unused // TODO: unused
// private float GetTerrainHeightAtXY(float x, float y) // protected float GetTerrainHeightAtXY(float x, float y)
// { // {
// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; // return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
// } // }
@ -1295,7 +1295,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, protected PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
{ {
PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
@ -1370,28 +1370,28 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
// internal utility function: must be called within a lock (OdeLock) // internal utility function: must be called within a lock (OdeLock)
private void InternalAddActiveJoint(PhysicsJoint joint) protected void InternalAddActiveJoint(PhysicsJoint joint)
{ {
activeJoints.Add(joint); activeJoints.Add(joint);
SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
} }
// internal utility function: must be called within a lock (OdeLock) // internal utility function: must be called within a lock (OdeLock)
private void InternalAddPendingJoint(OdePhysicsJoint joint) protected void InternalAddPendingJoint(OdePhysicsJoint joint)
{ {
pendingJoints.Add(joint); pendingJoints.Add(joint);
SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
} }
// internal utility function: must be called within a lock (OdeLock) // internal utility function: must be called within a lock (OdeLock)
private void InternalRemovePendingJoint(PhysicsJoint joint) protected void InternalRemovePendingJoint(PhysicsJoint joint)
{ {
pendingJoints.Remove(joint); pendingJoints.Remove(joint);
SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
} }
// internal utility function: must be called within a lock (OdeLock) // internal utility function: must be called within a lock (OdeLock)
private void InternalRemoveActiveJoint(PhysicsJoint joint) protected void InternalRemoveActiveJoint(PhysicsJoint joint)
{ {
activeJoints.Remove(joint); activeJoints.Remove(joint);
SOPName_to_activeJoint.Remove(joint.ObjectNameInScene); SOPName_to_activeJoint.Remove(joint.ObjectNameInScene);
@ -1445,7 +1445,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
private void DeleteRequestedJoints() protected void DeleteRequestedJoints()
{ {
List<string> myRequestedJointsToBeDeleted; List<string> myRequestedJointsToBeDeleted;
lock (externalJointRequestsLock) lock (externalJointRequestsLock)
@ -1525,7 +1525,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// for pending joints we don't know if their associated bodies exist yet or not. // for pending joints we don't know if their associated bodies exist yet or not.
// the joint is actually created during processing of the taints // the joint is actually created during processing of the taints
private void CreateRequestedJoints() protected void CreateRequestedJoints()
{ {
List<PhysicsJoint> myRequestedJointsToBeCreated; List<PhysicsJoint> myRequestedJointsToBeCreated;
lock (externalJointRequestsLock) lock (externalJointRequestsLock)
@ -1611,7 +1611,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return joint; return joint;
} }
private void RemoveAllJointsConnectedToActor(PhysicsActor actor) protected void RemoveAllJointsConnectedToActor(PhysicsActor actor)
{ {
//m_log.Debug("RemoveAllJointsConnectedToActor: start"); //m_log.Debug("RemoveAllJointsConnectedToActor: start");
if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null) if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)