From 949ae6136e24aee1cb8d06491fed75970cab38d2 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Tue, 3 Feb 2009 08:31:08 +0000 Subject: Change access levels from private to protected to facilitate subclassing; also add new method signatures. Thanks tuco and mikkopa. Fix Mantis #3072. --- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 3 + OpenSim/Region/Physics/Manager/PhysicsScene.cs | 6 + OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 74 ++++---- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 150 ++++++++-------- OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | 6 +- .../Region/Physics/OdePlugin/OdePhysicsJoint.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 200 ++++++++++----------- 7 files changed, 225 insertions(+), 216 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 0f75c46..94f3d85 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -213,6 +213,9 @@ namespace OpenSim.Region.Physics.Manager public abstract void SubscribeEvents(int ms); public abstract void UnSubscribeEvents(); public abstract bool SubscribedEvents(); + + public virtual void SetCollisionMesh(byte[] meshdata, string meshname, bool scalemesh) { } + public virtual void SetBoundsScaling(bool scalemesh) { } } public class NullPhysicsActor : PhysicsActor diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 2cf4d5a..3d0015f 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -152,6 +152,12 @@ namespace OpenSim.Region.Physics.Manager 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 static int m_workIndicator; diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 2cdc988..73b7612 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -57,73 +57,73 @@ namespace OpenSim.Region.Physics.OdePlugin } public class OdeCharacter : PhysicsActor { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private PhysicsVector _position; - private d.Vector3 _zeroPosition; - // private d.Matrix3 m_StandUpRotation; - private bool _zeroFlag = false; - private bool m_lastUpdateSent = false; - private PhysicsVector _velocity; - private PhysicsVector _target_velocity; - private PhysicsVector _acceleration; - private PhysicsVector m_rotationalVelocity; - private float m_mass = 80f; + protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected PhysicsVector _position; + protected d.Vector3 _zeroPosition; + // protected d.Matrix3 m_StandUpRotation; + protected bool _zeroFlag = false; + protected bool m_lastUpdateSent = false; + protected PhysicsVector _velocity; + protected PhysicsVector _target_velocity; + protected PhysicsVector _acceleration; + protected PhysicsVector m_rotationalVelocity; + protected float m_mass = 80f; public float m_density = 60f; - private bool m_pidControllerActive = true; + protected bool m_pidControllerActive = true; public float PID_D = 800.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_LENGTH = 2.140599f; public float m_tensor = 3800000f; public float heightFudgeFactor = 0.52f; public float walkDivisor = 1.3f; public float runDivisor = 0.8f; - private bool flying = false; - private bool m_iscolliding = false; - private bool m_iscollidingGround = false; - private bool m_wascolliding = false; - private bool m_wascollidingGround = false; - private bool m_iscollidingObj = false; - private bool m_alwaysRun = false; - private bool m_hackSentFall = false; - private bool m_hackSentFly = false; - private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); + protected bool flying = false; + protected bool m_iscolliding = false; + protected bool m_iscollidingGround = false; + protected bool m_wascolliding = false; + protected bool m_wascollidingGround = false; + protected bool m_iscollidingObj = false; + protected bool m_alwaysRun = false; + protected bool m_hackSentFall = false; + protected bool m_hackSentFly = false; + protected PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); public uint m_localID = 0; public bool m_returnCollisions = false; // taints and their non-tainted counterparts 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) - 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]; - private bool[] m_colliderGroundarr = new bool[11]; + protected bool[] m_colliderarr = new bool[11]; + protected bool[] m_colliderGroundarr = new bool[11]; // 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. - private CollisionCategories m_collisionFlags = (CollisionCategories.Geom + protected CollisionCategories m_collisionFlags = (CollisionCategories.Geom | CollisionCategories.Space | CollisionCategories.Body | CollisionCategories.Character | CollisionCategories.Land); public IntPtr Body = IntPtr.Zero; - private OdeScene _parent_scene; + protected OdeScene _parent_scene; public IntPtr Shell = IntPtr.Zero; public IntPtr Amotor = IntPtr.Zero; public d.Mass ShellMass; public bool collidelock = false; 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) { @@ -421,7 +421,7 @@ namespace OpenSim.Region.Physics.OdePlugin // 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 // 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_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. // 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 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 /// /// - public void Move(float timeStep) + public virtual void Move(float timeStep) { // no lock; for now it's only called from within Simulate() diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index bfb9b1a..54edbdc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -43,54 +43,54 @@ namespace OpenSim.Region.Physics.OdePlugin public class OdePrim : PhysicsActor { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _torque = new PhysicsVector(0,0,0); - private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); - private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); - private Quaternion m_lastorientation = new Quaternion(); - private PhysicsVector m_rotationalVelocity; - private PhysicsVector _size; - private PhysicsVector _acceleration; - // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); - private Quaternion _orientation; - private PhysicsVector m_taintposition; - private PhysicsVector m_taintsize; - private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); - private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); - private Quaternion m_taintrot; - private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); - private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); - private IntPtr Amotor = IntPtr.Zero; - - private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); - private float m_PIDTau = 0f; - private float PID_D = 35f; - private float PID_G = 25f; - private float m_tensor = 5f; - private int body_autodisable_frames = 20; - private IMesh primMesh = null; - - private bool m_usePID = false; - - private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom + protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected PhysicsVector _position; + protected PhysicsVector _velocity; + protected PhysicsVector _torque = new PhysicsVector(0,0,0); + protected PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); + protected PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); + protected Quaternion m_lastorientation = new Quaternion(); + protected PhysicsVector m_rotationalVelocity; + protected PhysicsVector _size; + protected PhysicsVector _acceleration; + // protected d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); + protected Quaternion _orientation; + protected PhysicsVector m_taintposition; + protected PhysicsVector m_taintsize; + protected PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); + protected PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); + protected Quaternion m_taintrot; + protected PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); + protected PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); + protected IntPtr Amotor = IntPtr.Zero; + + protected PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); + protected float m_PIDTau = 0f; + protected float PID_D = 35f; + protected float PID_G = 25f; + protected float m_tensor = 5f; + protected int body_autodisable_frames = 20; + protected IMesh primMesh = null; + + protected bool m_usePID = false; + + protected const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | CollisionCategories.Space | CollisionCategories.Body | CollisionCategories.Character ); - private bool m_taintshape = false; - private bool m_taintPhysics = false; - private bool m_collidesLand = true; - private bool m_collidesWater = false; + protected bool m_taintshape = false; + protected bool m_taintPhysics = false; + protected bool m_collidesLand = true; + protected bool m_collidesWater = false; public bool m_returnCollisions = false; // 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 - private CollisionCategories m_collisionFlags = m_default_collisionFlags; + protected CollisionCategories m_collisionFlags = m_default_collisionFlags; public bool m_taintremove = false; public bool m_taintdisable = false; @@ -102,58 +102,58 @@ namespace OpenSim.Region.Physics.OdePlugin public uint m_localID = 0; //public GCHandle gc; - private CollisionLocker ode; + protected CollisionLocker ode; - private bool m_taintforce = false; - private bool m_taintaddangularforce = false; - private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); - private List m_forcelist = new List(); - private List m_angularforcelist = new List(); + protected bool m_taintforce = false; + protected bool m_taintaddangularforce = false; + protected PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); + protected List m_forcelist = new List(); + protected List m_angularforcelist = new List(); - private IMesh _mesh; - private PrimitiveBaseShape _pbs; - private OdeScene _parent_scene; + protected IMesh _mesh; + protected PrimitiveBaseShape _pbs; + protected OdeScene _parent_scene; public IntPtr m_targetSpace = (IntPtr) 0; public IntPtr prim_geom; public IntPtr prev_geom; public IntPtr _triMeshData; - private IntPtr _linkJointGroup = (IntPtr)0; - private PhysicsActor _parent = null; - private PhysicsActor m_taintparent = null; + protected IntPtr _linkJointGroup = (IntPtr)0; + protected PhysicsActor _parent = null; + protected PhysicsActor m_taintparent = null; - private List childrenPrim = new List(); + protected List childrenPrim = new List(); - private bool iscolliding = false; - private bool m_isphysical = false; - private bool m_isSelected = false; + protected bool iscolliding = false; + protected bool m_isphysical = 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; - private int throttleCounter = 0; + protected bool m_throttleUpdates = false; + protected int throttleCounter = 0; public int m_interpenetrationcount = 0; public float m_collisionscore = 0; public int m_roundsUnderMotionThreshold = 0; - private int m_crossingfailures = 0; + protected int m_crossingfailures = 0; public float m_buoyancy = 0f; 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; - private bool m_lastUpdateSent = false; + protected bool m_lastUpdateSent = false; public IntPtr Body = (IntPtr) 0; - private String m_primName; - private PhysicsVector _target_velocity; + protected String m_primName; + protected PhysicsVector _target_velocity; public d.Mass pMass; 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; @@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin #region Mass Calculation - private float CalculateMass() + protected float CalculateMass() { 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) { @@ -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? 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); } - private void changelink(float timestep) + protected void changelink(float timestep) { // If the newly set parent is not null // 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) 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. lock (childrenPrim) @@ -1173,7 +1173,7 @@ namespace OpenSim.Region.Physics.OdePlugin } - private void changeSelectedStatus(float timestep) + protected void changeSelectedStatus(float timestep) { if (m_taintselected) { @@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_taintrot = _orientation; } - private void resetCollisionAccounting() + protected void resetCollisionAccounting() { m_collisionscore = 0; m_interpenetrationcount = 0; @@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_taintaddangularforce = false; } - private void changevelocity(float timestep) + protected void changevelocity(float timestep) { if (!m_isSelected) { @@ -2622,7 +2622,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool PIDActive { set { m_usePID = value; } } public override float PIDTau { set { m_PIDTau = value; } } - private void createAMotor(PhysicsVector axis) + protected void createAMotor(PhysicsVector axis) { if (Body == IntPtr.Zero) return; diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs index c913639..b955e4b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs @@ -37,9 +37,9 @@ namespace OpenSim.Region.Physics.OdePlugin [TestFixture] public class ODETestClass { - private OdePlugin cbt; - private PhysicsScene ps; - private IMeshingPlugin imp; + protected OdePlugin cbt; + protected PhysicsScene ps; + protected IMeshingPlugin imp; [SetUp] public void Initialize() diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs index 8180497..b7b39a4 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs @@ -34,7 +34,7 @@ using OpenSim.Region.Physics.OdePlugin; namespace OpenSim.Region.Physics.OdePlugin { - class OdePhysicsJoint : PhysicsJoint + public class OdePhysicsJoint : PhysicsJoint { public override bool IsInPhysicsEngine { diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 3adabcf..9a1645d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -52,10 +52,10 @@ namespace OpenSim.Region.Physics.OdePlugin /// 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; - private OdeScene _mScene; + protected CollisionLocker ode; + protected OdeScene _mScene; public OdePlugin() { @@ -124,62 +124,62 @@ namespace OpenSim.Region.Physics.OdePlugin public class OdeScene : PhysicsScene { - private ILog m_log; - // private Dictionary m_storedCollisions = new Dictionary(); + protected ILog m_log; + // protected Dictionary m_storedCollisions = new Dictionary(); - CollisionLocker ode; + protected CollisionLocker ode; protected Random fluidRandomizer = new Random(Environment.TickCount); - private const uint m_regionWidth = Constants.RegionSize; - private const uint m_regionHeight = Constants.RegionSize; + protected const uint m_regionWidth = Constants.RegionSize; + protected const uint m_regionHeight = Constants.RegionSize; - private float ODE_STEPSIZE = 0.020f; - private float metersInSpace = 29.9f; + protected float ODE_STEPSIZE = 0.020f; + protected float metersInSpace = 29.9f; public float gravityx = 0f; public float gravityy = 0f; public float gravityz = -9.8f; - private float contactsurfacelayer = 0.001f; + protected float contactsurfacelayer = 0.001f; - private int worldHashspaceLow = -4; - private int worldHashspaceHigh = 128; + protected int worldHashspaceLow = -4; + protected int worldHashspaceHigh = 128; - private int smallHashspaceLow = -4; - private int smallHashspaceHigh = 66; + protected int smallHashspaceLow = -4; + protected int smallHashspaceHigh = 66; - private float waterlevel = 0f; - private int framecount = 0; - //private int m_returncollisions = 10; + protected float waterlevel = 0f; + protected int framecount = 0; + //protected int m_returncollisions = 10; - private IntPtr contactgroup; - private IntPtr LandGeom; + protected IntPtr contactgroup; + protected IntPtr LandGeom; - private IntPtr WaterGeom; + protected IntPtr WaterGeom; - private float nmTerrainContactFriction = 255.0f; - private float nmTerrainContactBounce = 0.1f; - private float nmTerrainContactERP = 0.1025f; + protected float nmTerrainContactFriction = 255.0f; + protected float nmTerrainContactBounce = 0.1f; + protected float nmTerrainContactERP = 0.1025f; - private float mTerrainContactFriction = 75f; - private float mTerrainContactBounce = 0.1f; - private float mTerrainContactERP = 0.05025f; + protected float mTerrainContactFriction = 75f; + protected float mTerrainContactBounce = 0.1f; + protected float mTerrainContactERP = 0.05025f; - private float nmAvatarObjectContactFriction = 250f; - private float nmAvatarObjectContactBounce = 0.1f; + protected float nmAvatarObjectContactFriction = 250f; + protected float nmAvatarObjectContactBounce = 0.1f; - private float mAvatarObjectContactFriction = 75f; - private float mAvatarObjectContactBounce = 0.1f; + protected float mAvatarObjectContactFriction = 75f; + protected float mAvatarObjectContactBounce = 0.1f; - private float avPIDD = 3200f; - private float avPIDP = 1400f; - private float avCapRadius = 0.37f; - private float avStandupTensor = 2000000f; - private float avDensity = 80f; - private float avHeightFudgeFactor = 0.52f; - private float avMovementDivisorWalk = 1.3f; - private float avMovementDivisorRun = 0.8f; + protected float avPIDD = 3200f; + protected float avPIDP = 1400f; + protected float avCapRadius = 0.37f; + protected float avStandupTensor = 2000000f; + protected float avDensity = 80f; + protected float avHeightFudgeFactor = 0.52f; + protected float avMovementDivisorWalk = 1.3f; + protected float avMovementDivisorRun = 0.8f; public bool meshSculptedPrim = true; @@ -200,66 +200,66 @@ namespace OpenSim.Region.Physics.OdePlugin public int bodyFramesAutoDisable = 20; - private float[] _heightmap; + protected float[] _heightmap; - private float[] _watermap; - private bool m_filterCollisions = true; + protected float[] _watermap; + 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.TriArrayCallback triArrayCallback; - private List _characters = new List(); - private List _prims = new List(); - private List _activeprims = new List(); - private List _taintedPrim = new List(); - private List _taintedActors = new List(); - private List _perloopContact = new List(); - private List _collisionEventPrim = new List(); + protected List _characters = new List(); + protected List _prims = new List(); + protected List _activeprims = new List(); + protected List _taintedPrim = new List(); + protected List _taintedActors = new List(); + protected List _perloopContact = new List(); + protected List _collisionEventPrim = new List(); public Dictionary geom_name_map = new Dictionary(); public Dictionary actor_name_map = new Dictionary(); - private bool m_NINJA_physics_joints_enabled = false; - //private Dictionary jointpart_name_map = new Dictionary(); - private Dictionary> joints_connecting_actor = new Dictionary>(); - private d.ContactGeom[] contacts = new d.ContactGeom[80]; - private List requestedJointsToBeCreated = new List(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active - private List pendingJoints = new List(); // can lock for longer. accessed only by OdeScene. - private List activeJoints = new List(); // can lock for longer. accessed only by OdeScene. - private List requestedJointsToBeDeleted = new List(); // 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(); - private Dictionary SOPName_to_activeJoint = new Dictionary(); - private Dictionary SOPName_to_pendingJoint = new Dictionary(); - - private d.Contact contact; - private d.Contact TerrainContact; - private d.Contact AvatarMovementprimContact; - private d.Contact AvatarMovementTerrainContact; - private d.Contact WaterContact; + protected bool m_NINJA_physics_joints_enabled = false; + //protected Dictionary jointpart_name_map = new Dictionary(); + protected Dictionary> joints_connecting_actor = new Dictionary>(); + protected d.ContactGeom[] contacts = new d.ContactGeom[80]; + protected List requestedJointsToBeCreated = new List(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active + protected List pendingJoints = new List(); // can lock for longer. accessed only by OdeScene. + protected List activeJoints = new List(); // can lock for longer. accessed only by OdeScene. + protected List requestedJointsToBeDeleted = new List(); // 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 Object externalJointRequestsLock = new Object(); + protected Dictionary SOPName_to_activeJoint = new Dictionary(); + protected Dictionary SOPName_to_pendingJoint = new Dictionary(); + + protected d.Contact contact; + protected d.Contact TerrainContact; + protected d.Contact AvatarMovementprimContact; + protected d.Contact AvatarMovementTerrainContact; + protected d.Contact WaterContact; //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it -//Ckrinke private int m_randomizeWater = 200; - private int m_physicsiterations = 10; - private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag - private PhysicsActor PANull = new NullPhysicsActor(); - private float step_time = 0.0f; +//Ckrinke protected int m_randomizeWater = 200; + protected int m_physicsiterations = 10; + protected float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag + protected PhysicsActor PANull = new NullPhysicsActor(); + protected float step_time = 0.0f; //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; - //private bool returncollisions = false; - // private uint obj1LocalID = 0; - private uint obj2LocalID = 0; - //private int ctype = 0; - private OdeCharacter cc1; - private OdePrim cp1; - private OdeCharacter cc2; - private OdePrim cp2; - //private int cStartStop = 0; - //private string cDictKey = ""; + //protected bool returncollisions = false; + // protected uint obj1LocalID = 0; + protected uint obj2LocalID = 0; + //protected int ctype = 0; + protected OdeCharacter cc1; + protected OdePrim cp1; + protected OdeCharacter cc2; + protected OdePrim cp2; + //protected int cStartStop = 0; + //protected string cDictKey = ""; public IntPtr space; - //private IntPtr tmpSpace; + //protected IntPtr tmpSpace; // split static geometry collision handling into spaces of 30 meters public IntPtr[,] staticPrimspace; @@ -267,7 +267,7 @@ namespace OpenSim.Region.Physics.OdePlugin public IMesher mesher; - private IConfigSource m_config; + protected IConfigSource m_config; public bool physics_logging = false; 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) //while (d.SpaceLockQuery(space)) { } // Wait and do nothing @@ -517,7 +517,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// The space that contains the geoms. Remember, spaces are also geoms /// a geometry or space /// another geometry or space - 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 @@ -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; //return result; @@ -982,7 +982,7 @@ namespace OpenSim.Region.Physics.OdePlugin 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; //returncollisions = false; @@ -1160,7 +1160,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// This is our collision testing routine in ODE /// /// - private void collision_optimized(float timeStep) + protected void collision_optimized(float timeStep) { _perloopContact.Clear(); @@ -1249,7 +1249,7 @@ namespace OpenSim.Region.Physics.OdePlugin #endregion // 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]; // } @@ -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) { 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) - private void InternalAddActiveJoint(PhysicsJoint joint) + protected void InternalAddActiveJoint(PhysicsJoint joint) { activeJoints.Add(joint); SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); } // internal utility function: must be called within a lock (OdeLock) - private void InternalAddPendingJoint(OdePhysicsJoint joint) + protected void InternalAddPendingJoint(OdePhysicsJoint joint) { pendingJoints.Add(joint); SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); } // internal utility function: must be called within a lock (OdeLock) - private void InternalRemovePendingJoint(PhysicsJoint joint) + protected void InternalRemovePendingJoint(PhysicsJoint joint) { pendingJoints.Remove(joint); SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); } // internal utility function: must be called within a lock (OdeLock) - private void InternalRemoveActiveJoint(PhysicsJoint joint) + protected void InternalRemoveActiveJoint(PhysicsJoint joint) { activeJoints.Remove(joint); SOPName_to_activeJoint.Remove(joint.ObjectNameInScene); @@ -1445,7 +1445,7 @@ namespace OpenSim.Region.Physics.OdePlugin } } - private void DeleteRequestedJoints() + protected void DeleteRequestedJoints() { List myRequestedJointsToBeDeleted; 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. // the joint is actually created during processing of the taints - private void CreateRequestedJoints() + protected void CreateRequestedJoints() { List myRequestedJointsToBeCreated; lock (externalJointRequestsLock) @@ -1611,7 +1611,7 @@ namespace OpenSim.Region.Physics.OdePlugin return joint; } - private void RemoveAllJointsConnectedToActor(PhysicsActor actor) + protected void RemoveAllJointsConnectedToActor(PhysicsActor actor) { //m_log.Debug("RemoveAllJointsConnectedToActor: start"); if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null) -- cgit v1.1