aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorMike Mazur2009-02-03 08:31:08 +0000
committerMike Mazur2009-02-03 08:31:08 +0000
commit949ae6136e24aee1cb8d06491fed75970cab38d2 (patch)
tree23d1f735e7997ab911b4de639cc5d5bca390477b /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
parentEmbed OpenSim.Data.addin.xml as a resource into OpenSim.Data.dll. (diff)
downloadopensim-SC_OLD-949ae6136e24aee1cb8d06491fed75970cab38d2.zip
opensim-SC_OLD-949ae6136e24aee1cb8d06491fed75970cab38d2.tar.gz
opensim-SC_OLD-949ae6136e24aee1cb8d06491fed75970cab38d2.tar.bz2
opensim-SC_OLD-949ae6136e24aee1cb8d06491fed75970cab38d2.tar.xz
Change access levels from private to protected to facilitate
subclassing; also add new method signatures. Thanks tuco and mikkopa. Fix Mantis #3072.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs200
1 files changed, 100 insertions, 100 deletions
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
52 /// </summary> 52 /// </summary>
53 public class OdePlugin : IPhysicsPlugin 53 public class OdePlugin : IPhysicsPlugin
54 { 54 {
55 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 55 //protected static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
56 56
57 private CollisionLocker ode; 57 protected CollisionLocker ode;
58 private OdeScene _mScene; 58 protected OdeScene _mScene;
59 59
60 public OdePlugin() 60 public OdePlugin()
61 { 61 {
@@ -124,62 +124,62 @@ namespace OpenSim.Region.Physics.OdePlugin
124 124
125 public class OdeScene : PhysicsScene 125 public class OdeScene : PhysicsScene
126 { 126 {
127 private ILog m_log; 127 protected ILog m_log;
128 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); 128 // protected Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
129 129
130 CollisionLocker ode; 130 protected CollisionLocker ode;
131 131
132 protected Random fluidRandomizer = new Random(Environment.TickCount); 132 protected Random fluidRandomizer = new Random(Environment.TickCount);
133 133
134 private const uint m_regionWidth = Constants.RegionSize; 134 protected const uint m_regionWidth = Constants.RegionSize;
135 private const uint m_regionHeight = Constants.RegionSize; 135 protected const uint m_regionHeight = Constants.RegionSize;
136 136
137 private float ODE_STEPSIZE = 0.020f; 137 protected float ODE_STEPSIZE = 0.020f;
138 private float metersInSpace = 29.9f; 138 protected float metersInSpace = 29.9f;
139 139
140 public float gravityx = 0f; 140 public float gravityx = 0f;
141 public float gravityy = 0f; 141 public float gravityy = 0f;
142 public float gravityz = -9.8f; 142 public float gravityz = -9.8f;
143 143
144 private float contactsurfacelayer = 0.001f; 144 protected float contactsurfacelayer = 0.001f;
145 145
146 private int worldHashspaceLow = -4; 146 protected int worldHashspaceLow = -4;
147 private int worldHashspaceHigh = 128; 147 protected int worldHashspaceHigh = 128;
148 148
149 private int smallHashspaceLow = -4; 149 protected int smallHashspaceLow = -4;
150 private int smallHashspaceHigh = 66; 150 protected int smallHashspaceHigh = 66;
151 151
152 private float waterlevel = 0f; 152 protected float waterlevel = 0f;
153 private int framecount = 0; 153 protected int framecount = 0;
154 //private int m_returncollisions = 10; 154 //protected int m_returncollisions = 10;
155 155
156 private IntPtr contactgroup; 156 protected IntPtr contactgroup;
157 private IntPtr LandGeom; 157 protected IntPtr LandGeom;
158 158
159 private IntPtr WaterGeom; 159 protected IntPtr WaterGeom;
160 160
161 private float nmTerrainContactFriction = 255.0f; 161 protected float nmTerrainContactFriction = 255.0f;
162 private float nmTerrainContactBounce = 0.1f; 162 protected float nmTerrainContactBounce = 0.1f;
163 private float nmTerrainContactERP = 0.1025f; 163 protected float nmTerrainContactERP = 0.1025f;
164 164
165 private float mTerrainContactFriction = 75f; 165 protected float mTerrainContactFriction = 75f;
166 private float mTerrainContactBounce = 0.1f; 166 protected float mTerrainContactBounce = 0.1f;
167 private float mTerrainContactERP = 0.05025f; 167 protected float mTerrainContactERP = 0.05025f;
168 168
169 private float nmAvatarObjectContactFriction = 250f; 169 protected float nmAvatarObjectContactFriction = 250f;
170 private float nmAvatarObjectContactBounce = 0.1f; 170 protected float nmAvatarObjectContactBounce = 0.1f;
171 171
172 private float mAvatarObjectContactFriction = 75f; 172 protected float mAvatarObjectContactFriction = 75f;
173 private float mAvatarObjectContactBounce = 0.1f; 173 protected float mAvatarObjectContactBounce = 0.1f;
174 174
175 private float avPIDD = 3200f; 175 protected float avPIDD = 3200f;
176 private float avPIDP = 1400f; 176 protected float avPIDP = 1400f;
177 private float avCapRadius = 0.37f; 177 protected float avCapRadius = 0.37f;
178 private float avStandupTensor = 2000000f; 178 protected float avStandupTensor = 2000000f;
179 private float avDensity = 80f; 179 protected float avDensity = 80f;
180 private float avHeightFudgeFactor = 0.52f; 180 protected float avHeightFudgeFactor = 0.52f;
181 private float avMovementDivisorWalk = 1.3f; 181 protected float avMovementDivisorWalk = 1.3f;
182 private float avMovementDivisorRun = 0.8f; 182 protected float avMovementDivisorRun = 0.8f;
183 183
184 public bool meshSculptedPrim = true; 184 public bool meshSculptedPrim = true;
185 185
@@ -200,66 +200,66 @@ namespace OpenSim.Region.Physics.OdePlugin
200 200
201 public int bodyFramesAutoDisable = 20; 201 public int bodyFramesAutoDisable = 20;
202 202
203 private float[] _heightmap; 203 protected float[] _heightmap;
204 204
205 private float[] _watermap; 205 protected float[] _watermap;
206 private bool m_filterCollisions = true; 206 protected bool m_filterCollisions = true;
207 207
208 // private float[] _origheightmap; 208 // protected float[] _origheightmap;
209 209
210 private d.NearCallback nearCallback; 210 protected d.NearCallback nearCallback;
211 public d.TriCallback triCallback; 211 public d.TriCallback triCallback;
212 public d.TriArrayCallback triArrayCallback; 212 public d.TriArrayCallback triArrayCallback;
213 private List<OdeCharacter> _characters = new List<OdeCharacter>(); 213 protected List<OdeCharacter> _characters = new List<OdeCharacter>();
214 private List<OdePrim> _prims = new List<OdePrim>(); 214 protected List<OdePrim> _prims = new List<OdePrim>();
215 private List<OdePrim> _activeprims = new List<OdePrim>(); 215 protected List<OdePrim> _activeprims = new List<OdePrim>();
216 private List<OdePrim> _taintedPrim = new List<OdePrim>(); 216 protected List<OdePrim> _taintedPrim = new List<OdePrim>();
217 private List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); 217 protected List<OdeCharacter> _taintedActors = new List<OdeCharacter>();
218 private List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); 218 protected List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
219 private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); 219 protected List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
220 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 220 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
221 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 221 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
222 private bool m_NINJA_physics_joints_enabled = false; 222 protected bool m_NINJA_physics_joints_enabled = false;
223 //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>(); 223 //protected Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
224 private Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>(); 224 protected Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
225 private d.ContactGeom[] contacts = new d.ContactGeom[80]; 225 protected d.ContactGeom[] contacts = new d.ContactGeom[80];
226 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 226 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
227 private List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. 227 protected List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
228 private List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. 228 protected List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
229 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 229 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
230 private Object externalJointRequestsLock = new Object(); 230 protected Object externalJointRequestsLock = new Object();
231 private Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>(); 231 protected Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
232 private Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>(); 232 protected Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
233 233
234 private d.Contact contact; 234 protected d.Contact contact;
235 private d.Contact TerrainContact; 235 protected d.Contact TerrainContact;
236 private d.Contact AvatarMovementprimContact; 236 protected d.Contact AvatarMovementprimContact;
237 private d.Contact AvatarMovementTerrainContact; 237 protected d.Contact AvatarMovementTerrainContact;
238 private d.Contact WaterContact; 238 protected d.Contact WaterContact;
239 239
240//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 240//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
241//Ckrinke private int m_randomizeWater = 200; 241//Ckrinke protected int m_randomizeWater = 200;
242 private int m_physicsiterations = 10; 242 protected int m_physicsiterations = 10;
243 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 243 protected float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
244 private PhysicsActor PANull = new NullPhysicsActor(); 244 protected PhysicsActor PANull = new NullPhysicsActor();
245 private float step_time = 0.0f; 245 protected float step_time = 0.0f;
246//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 246//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
247//Ckrinke private int ms = 0; 247//Ckrinke protected int ms = 0;
248 public IntPtr world; 248 public IntPtr world;
249 //private bool returncollisions = false; 249 //protected bool returncollisions = false;
250 // private uint obj1LocalID = 0; 250 // protected uint obj1LocalID = 0;
251 private uint obj2LocalID = 0; 251 protected uint obj2LocalID = 0;
252 //private int ctype = 0; 252 //protected int ctype = 0;
253 private OdeCharacter cc1; 253 protected OdeCharacter cc1;
254 private OdePrim cp1; 254 protected OdePrim cp1;
255 private OdeCharacter cc2; 255 protected OdeCharacter cc2;
256 private OdePrim cp2; 256 protected OdePrim cp2;
257 //private int cStartStop = 0; 257 //protected int cStartStop = 0;
258 //private string cDictKey = ""; 258 //protected string cDictKey = "";
259 259
260 public IntPtr space; 260 public IntPtr space;
261 261
262 //private IntPtr tmpSpace; 262 //protected IntPtr tmpSpace;
263 // split static geometry collision handling into spaces of 30 meters 263 // split static geometry collision handling into spaces of 30 meters
264 public IntPtr[,] staticPrimspace; 264 public IntPtr[,] staticPrimspace;
265 265
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Physics.OdePlugin
267 267
268 public IMesher mesher; 268 public IMesher mesher;
269 269
270 private IConfigSource m_config; 270 protected IConfigSource m_config;
271 271
272 public bool physics_logging = false; 272 public bool physics_logging = false;
273 public int physics_logging_interval = 0; 273 public int physics_logging_interval = 0;
@@ -493,7 +493,7 @@ namespace OpenSim.Region.Physics.OdePlugin
493 } 493 }
494 } 494 }
495 495
496 internal void waitForSpaceUnlock(IntPtr space) 496 public void waitForSpaceUnlock(IntPtr space)
497 { 497 {
498 //if (space != IntPtr.Zero) 498 //if (space != IntPtr.Zero)
499 //while (d.SpaceLockQuery(space)) { } // Wait and do nothing 499 //while (d.SpaceLockQuery(space)) { } // Wait and do nothing
@@ -517,7 +517,7 @@ namespace OpenSim.Region.Physics.OdePlugin
517 /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> 517 /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param>
518 /// <param name="g1">a geometry or space</param> 518 /// <param name="g1">a geometry or space</param>
519 /// <param name="g2">another geometry or space</param> 519 /// <param name="g2">another geometry or space</param>
520 private void near(IntPtr space, IntPtr g1, IntPtr g2) 520 protected void near(IntPtr space, IntPtr g1, IntPtr g2)
521 { 521 {
522 // no lock here! It's invoked from within Simulate(), which is thread-locked 522 // no lock here! It's invoked from within Simulate(), which is thread-locked
523 523
@@ -912,7 +912,7 @@ namespace OpenSim.Region.Physics.OdePlugin
912 } 912 }
913 } 913 }
914 914
915 private bool checkDupe(d.ContactGeom contactGeom, int atype) 915 protected bool checkDupe(d.ContactGeom contactGeom, int atype)
916 { 916 {
917 bool result = false; 917 bool result = false;
918 //return result; 918 //return result;
@@ -982,7 +982,7 @@ namespace OpenSim.Region.Physics.OdePlugin
982 return result; 982 return result;
983 } 983 }
984 984
985 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) 985 protected void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth)
986 { 986 {
987 // obj1LocalID = 0; 987 // obj1LocalID = 0;
988 //returncollisions = false; 988 //returncollisions = false;
@@ -1160,7 +1160,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1160 /// This is our collision testing routine in ODE 1160 /// This is our collision testing routine in ODE
1161 /// </summary> 1161 /// </summary>
1162 /// <param name="timeStep"></param> 1162 /// <param name="timeStep"></param>
1163 private void collision_optimized(float timeStep) 1163 protected void collision_optimized(float timeStep)
1164 { 1164 {
1165 _perloopContact.Clear(); 1165 _perloopContact.Clear();
1166 1166
@@ -1249,7 +1249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1249 #endregion 1249 #endregion
1250 1250
1251// TODO: unused 1251// TODO: unused
1252// private float GetTerrainHeightAtXY(float x, float y) 1252// protected float GetTerrainHeightAtXY(float x, float y)
1253// { 1253// {
1254// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 1254// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
1255// } 1255// }
@@ -1295,7 +1295,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 1298 protected PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
1299 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 1299 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
1300 { 1300 {
1301 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); 1301 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
@@ -1370,28 +1370,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1370 } 1370 }
1371 1371
1372 // internal utility function: must be called within a lock (OdeLock) 1372 // internal utility function: must be called within a lock (OdeLock)
1373 private void InternalAddActiveJoint(PhysicsJoint joint) 1373 protected void InternalAddActiveJoint(PhysicsJoint joint)
1374 { 1374 {
1375 activeJoints.Add(joint); 1375 activeJoints.Add(joint);
1376 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); 1376 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
1377 } 1377 }
1378 1378
1379 // internal utility function: must be called within a lock (OdeLock) 1379 // internal utility function: must be called within a lock (OdeLock)
1380 private void InternalAddPendingJoint(OdePhysicsJoint joint) 1380 protected void InternalAddPendingJoint(OdePhysicsJoint joint)
1381 { 1381 {
1382 pendingJoints.Add(joint); 1382 pendingJoints.Add(joint);
1383 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); 1383 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
1384 } 1384 }
1385 1385
1386 // internal utility function: must be called within a lock (OdeLock) 1386 // internal utility function: must be called within a lock (OdeLock)
1387 private void InternalRemovePendingJoint(PhysicsJoint joint) 1387 protected void InternalRemovePendingJoint(PhysicsJoint joint)
1388 { 1388 {
1389 pendingJoints.Remove(joint); 1389 pendingJoints.Remove(joint);
1390 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); 1390 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
1391 } 1391 }
1392 1392
1393 // internal utility function: must be called within a lock (OdeLock) 1393 // internal utility function: must be called within a lock (OdeLock)
1394 private void InternalRemoveActiveJoint(PhysicsJoint joint) 1394 protected void InternalRemoveActiveJoint(PhysicsJoint joint)
1395 { 1395 {
1396 activeJoints.Remove(joint); 1396 activeJoints.Remove(joint);
1397 SOPName_to_activeJoint.Remove(joint.ObjectNameInScene); 1397 SOPName_to_activeJoint.Remove(joint.ObjectNameInScene);
@@ -1445,7 +1445,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1445 } 1445 }
1446 } 1446 }
1447 1447
1448 private void DeleteRequestedJoints() 1448 protected void DeleteRequestedJoints()
1449 { 1449 {
1450 List<string> myRequestedJointsToBeDeleted; 1450 List<string> myRequestedJointsToBeDeleted;
1451 lock (externalJointRequestsLock) 1451 lock (externalJointRequestsLock)
@@ -1525,7 +1525,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1525 1525
1526 // for pending joints we don't know if their associated bodies exist yet or not. 1526 // for pending joints we don't know if their associated bodies exist yet or not.
1527 // the joint is actually created during processing of the taints 1527 // the joint is actually created during processing of the taints
1528 private void CreateRequestedJoints() 1528 protected void CreateRequestedJoints()
1529 { 1529 {
1530 List<PhysicsJoint> myRequestedJointsToBeCreated; 1530 List<PhysicsJoint> myRequestedJointsToBeCreated;
1531 lock (externalJointRequestsLock) 1531 lock (externalJointRequestsLock)
@@ -1611,7 +1611,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1611 return joint; 1611 return joint;
1612 } 1612 }
1613 1613
1614 private void RemoveAllJointsConnectedToActor(PhysicsActor actor) 1614 protected void RemoveAllJointsConnectedToActor(PhysicsActor actor)
1615 { 1615 {
1616 //m_log.Debug("RemoveAllJointsConnectedToActor: start"); 1616 //m_log.Debug("RemoveAllJointsConnectedToActor: start");
1617 if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null) 1617 if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)