aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-07-23 10:37:52 -0700
committerRobert Adams2012-07-23 16:32:30 -0700
commit85c6eb7c500b708ab0a91965eca9da20b0b02e50 (patch)
treecf3f3725b5769c93958ec32acc24f6a0d5e5a4ec
parentBulletSim: improve linking to add each link individually rather than rebuildi... (diff)
downloadopensim-SC_OLD-85c6eb7c500b708ab0a91965eca9da20b0b02e50.zip
opensim-SC_OLD-85c6eb7c500b708ab0a91965eca9da20b0b02e50.tar.gz
opensim-SC_OLD-85c6eb7c500b708ab0a91965eca9da20b0b02e50.tar.bz2
opensim-SC_OLD-85c6eb7c500b708ab0a91965eca9da20b0b02e50.tar.xz
BulletSim: add all the new functions to BulletSimAPI.
Modify ZeroMotion() to not make tainting calls and to use new API calls.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs13
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs132
2 files changed, 139 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index a749a97..29ddddd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -324,11 +324,20 @@ public sealed class BSPrim : PhysicsActor
324 // Set motion values to zero. 324 // Set motion values to zero.
325 // Do it to the properties so the values get set in the physics engine. 325 // Do it to the properties so the values get set in the physics engine.
326 // Push the setting of the values to the viewer. 326 // Push the setting of the values to the viewer.
327 // Called at taint time!
327 private void ZeroMotion() 328 private void ZeroMotion()
328 { 329 {
329 Velocity = OMV.Vector3.Zero; 330 _velocity = OMV.Vector3.Zero;
330 _acceleration = OMV.Vector3.Zero; 331 _acceleration = OMV.Vector3.Zero;
331 RotationalVelocity = OMV.Vector3.Zero; 332 _rotationalVelocity = OMV.Vector3.Zero;
333
334 IntPtr obj = BulletSimAPI.GetBodyHandleWorldID2(_scene.WorldID, LocalID);
335 BulletSimAPI.SetVelocity2(obj, OMV.Vector3.Zero);
336 BulletSimAPI.SetAngularVelocity2(obj, OMV.Vector3.Zero);
337 BulletSimAPI.SetInterpolation2(obj, OMV.Vector3.Zero, OMV.Vector3.Zero);
338 BulletSimAPI.ClearForces2(obj);
339
340 // make sure this new information is pushed to the client
332 base.RequestPhysicsterseUpdate(); 341 base.RequestPhysicsterseUpdate();
333 } 342 }
334 343
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index babb707..54a8cfd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -291,13 +291,14 @@ public static extern void SetDebugLogCallback(DebugLogCallback callback);
291// =============================================================================== 291// ===============================================================================
292// =============================================================================== 292// ===============================================================================
293// =============================================================================== 293// ===============================================================================
294// A new version of the API that moves all the logic out of the C++ code and into 294// A new version of the API that enables moving all the logic out of the C++ code and into
295// the C# code. This will make modifications easier for the next person. 295// the C# code. This will make modifications easier for the next person.
296// This interface passes the actual pointers to the objects in the unmanaged 296// This interface passes the actual pointers to the objects in the unmanaged
297// address space. All the management (calls for creation/destruction/lookup) 297// address space. All the management (calls for creation/destruction/lookup)
298// is done in the C# code. 298// is done in the C# code.
299// The names have a 2 tacked on. This will be removed as the code gets rebuilt 299// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt
300// and the old code is removed from the C# code. 300// and the old code is removed.
301
301[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 302[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
302public static extern IntPtr GetSimHandle2(uint worldID); 303public static extern IntPtr GetSimHandle2(uint worldID);
303 304
@@ -307,8 +308,101 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id);
307[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 308[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
308public static extern IntPtr GetBodyHandle2(IntPtr sim, uint id); 309public static extern IntPtr GetBodyHandle2(IntPtr sim, uint id);
309 310
311// ===============================================================================
310[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 312[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
311public static extern IntPtr ClearForces2(IntPtr obj); 313public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
314 int maxCollisions, IntPtr collisionArray,
315 int maxUpdates, IntPtr updateArray);
316
317[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
318public static extern bool UpdateParameter2(IntPtr sim, uint localID, String parm, float value);
319
320[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
321public static extern void SetHeightmap2(IntPtr sim, float[] heightmap);
322
323[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
324public static extern void Shutdown2(IntPtr sim);
325
326[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
327public static extern int PhysicsStep2(IntPtr sim, float timeStep, int maxSubSteps, float fixedTimeStep,
328 out int updatedEntityCount,
329 out IntPtr updatedEntitiesPtr,
330 out int collidersCount,
331 out IntPtr collidersPtr);
332
333/*
334[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
335public static extern IntPtr CreateMesh2(IntPtr sim, int indicesCount, int* indices, int verticesCount, float* vertices );
336
337[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
338public static extern bool BuildHull2(IntPtr sim, IntPtr mesh);
339
340[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
341public static extern bool ReleaseHull2(IntPtr sim, IntPtr mesh);
342
343[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
344public static extern bool DestroyMesh2(IntPtr sim, IntPtr mesh);
345
346[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
347public static extern IntPtr CreateObject2(IntPtr sim, ShapeData shapeData);
348*/
349
350[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
351public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2,
352 Vector3 frame1loc, Quaternion frame1rot,
353 Vector3 frame2loc, Quaternion frame2rot,
354 Vector3 lowLinear, Vector3 hiLinear, Vector3 lowAngular, Vector3 hiAngular);
355
356[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
357public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain);
358
359[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
360public static extern Vector3 GetPosition2(IntPtr obj);
361
362[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
363public static extern Quaternion GetOrientation2(IntPtr obj);
364
365[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
366public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
367
368[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
369public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity);
370
371[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
372public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
373
374[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
375public static extern bool SetObjectForce2(IntPtr obj, Vector3 force);
376
377[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
378public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val);
379
380[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
381public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val);
382
383[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
384public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
385
386[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
387public static extern bool SetDeactivationTime2(IntPtr obj, float val);
388
389[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
390public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
391
392[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
393public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val);
394
395[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
396public static extern bool SetFriction2(IntPtr obj, float val);
397
398[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
399public static extern bool SetRestitution2(IntPtr obj, float val);
400
401[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
402public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val);
403
404[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
405public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang);
312 406
313[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 407[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
314public static extern IntPtr SetCollisionFlags2(IntPtr obj, uint flags); 408public static extern IntPtr SetCollisionFlags2(IntPtr obj, uint flags);
@@ -319,5 +413,35 @@ public static extern IntPtr AddToCollisionFlags2(IntPtr obj, uint flags);
319[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 413[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
320public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, uint flags); 414public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, uint flags);
321 415
416[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
417public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
418
419[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
420public static extern bool UpdateInertiaTensor2(IntPtr obj);
421
422[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
423public static extern bool SetGravity2(IntPtr obj, Vector3 val);
424
425[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
426public static extern IntPtr ClearForces2(IntPtr obj);
427
428[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
429public static extern bool SetMargin2(IntPtr obj, float val);
430
431[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
432public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj);
433
434[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
435public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
436
437[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
438public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
439
440[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
441public static extern bool DestroyObject2(IntPtr world, uint id);
442
443[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
444public static extern void DumpPhysicsStatistics2(IntPtr sim);
445
322} 446}
323} 447}