diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 0ffbc94..6800b96 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -35,9 +35,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin { | |||
35 | // Classes to allow some type checking for the API | 35 | // Classes to allow some type checking for the API |
36 | public struct BulletSim | 36 | public struct BulletSim |
37 | { | 37 | { |
38 | public BulletSim(uint id, IntPtr xx) { ID = id; Ptr = xx; } | 38 | public BulletSim(uint id, BSScene bss, IntPtr xx) { ID = id; scene = bss; Ptr = xx; } |
39 | public IntPtr Ptr; | ||
40 | public uint ID; | 39 | public uint ID; |
40 | // The scene is only in here so very low level routines have a handle to print debug/error messages | ||
41 | public BSScene scene; | ||
42 | public IntPtr Ptr; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | public struct BulletBody | 45 | public struct BulletBody |
@@ -158,6 +160,7 @@ public struct ConfigurationParameters | |||
158 | public float avatarContactProcessingThreshold; | 160 | public float avatarContactProcessingThreshold; |
159 | 161 | ||
160 | public float maxPersistantManifoldPoolSize; | 162 | public float maxPersistantManifoldPoolSize; |
163 | public float maxCollisionAlgorithmPoolSize; | ||
161 | public float shouldDisableContactPoolDynamicAllocation; | 164 | public float shouldDisableContactPoolDynamicAllocation; |
162 | public float shouldForceUpdateAllAabbs; | 165 | public float shouldForceUpdateAllAabbs; |
163 | public float shouldRandomizeSolverOrder; | 166 | public float shouldRandomizeSolverOrder; |
@@ -179,17 +182,18 @@ public struct ConfigurationParameters | |||
179 | // Values used by Bullet and BulletSim to control collisions | 182 | // Values used by Bullet and BulletSim to control collisions |
180 | public enum CollisionFlags : uint | 183 | public enum CollisionFlags : uint |
181 | { | 184 | { |
182 | STATIC_OBJECT = 1 << 0, | 185 | CF_STATIC_OBJECT = 1 << 0, |
183 | KINEMATIC_OBJECT = 1 << 1, | 186 | CF_KINEMATIC_OBJECT = 1 << 1, |
184 | NO_CONTACT_RESPONSE = 1 << 2, | 187 | CF_NO_CONTACT_RESPONSE = 1 << 2, |
185 | CUSTOM_MATERIAL_CALLBACK = 1 << 3, | 188 | CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3, |
186 | CHARACTER_OBJECT = 1 << 4, | 189 | CF_CHARACTER_OBJECT = 1 << 4, |
187 | DISABLE_VISUALIZE_OBJECT = 1 << 5, | 190 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, |
188 | DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | 191 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, |
189 | // Following used by BulletSim to control collisions | 192 | // Following used by BulletSim to control collisions |
190 | VOLUME_DETECT_OBJECT = 1 << 10, | 193 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, |
191 | PHANTOM_OBJECT = 1 << 11, | 194 | BS_VOLUME_DETECT_OBJECT = 1 << 11, |
192 | PHYSICAL_OBJECT = 1 << 12, | 195 | BS_PHANTOM_OBJECT = 1 << 12, |
196 | BS_PHYSICAL_OBJECT = 1 << 13, | ||
193 | }; | 197 | }; |
194 | 198 | ||
195 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | 199 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 |
@@ -361,7 +365,7 @@ public static extern IntPtr GetSimHandle2(uint worldID); | |||
361 | public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id); | 365 | public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id); |
362 | 366 | ||
363 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 367 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
364 | public static extern IntPtr GetBodyHandle2(IntPtr sim, uint id); | 368 | public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); |
365 | 369 | ||
366 | // =============================================================================== | 370 | // =============================================================================== |
367 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 371 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -370,40 +374,43 @@ public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | |||
370 | int maxUpdates, IntPtr updateArray); | 374 | int maxUpdates, IntPtr updateArray); |
371 | 375 | ||
372 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 376 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
373 | public static extern bool UpdateParameter2(IntPtr sim, uint localID, String parm, float value); | 377 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); |
374 | 378 | ||
375 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 379 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
376 | public static extern void SetHeightmap2(IntPtr sim, float[] heightmap); | 380 | public static extern void SetHeightmap2(IntPtr world, float[] heightmap); |
377 | 381 | ||
378 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 382 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
379 | public static extern void Shutdown2(IntPtr sim); | 383 | public static extern void Shutdown2(IntPtr sim); |
380 | 384 | ||
381 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 385 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
382 | public static extern int PhysicsStep2(IntPtr sim, float timeStep, int maxSubSteps, float fixedTimeStep, | 386 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, |
383 | out int updatedEntityCount, | 387 | out int updatedEntityCount, |
384 | out IntPtr updatedEntitiesPtr, | 388 | out IntPtr updatedEntitiesPtr, |
385 | out int collidersCount, | 389 | out int collidersCount, |
386 | out IntPtr collidersPtr); | 390 | out IntPtr collidersPtr); |
387 | 391 | ||
392 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
393 | public static extern bool PushUpdate2(IntPtr obj); | ||
394 | |||
388 | /* | 395 | /* |
389 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 396 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
390 | public static extern IntPtr CreateMesh2(IntPtr sim, int indicesCount, int* indices, int verticesCount, float* vertices ); | 397 | public static extern IntPtr CreateMesh2(IntPtr world, int indicesCount, int* indices, int verticesCount, float* vertices ); |
391 | 398 | ||
392 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 399 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
393 | public static extern bool BuildHull2(IntPtr sim, IntPtr mesh); | 400 | public static extern bool BuildHull2(IntPtr world, IntPtr mesh); |
394 | 401 | ||
395 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 402 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
396 | public static extern bool ReleaseHull2(IntPtr sim, IntPtr mesh); | 403 | public static extern bool ReleaseHull2(IntPtr world, IntPtr mesh); |
397 | 404 | ||
398 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 405 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
399 | public static extern bool DestroyMesh2(IntPtr sim, IntPtr mesh); | 406 | public static extern bool DestroyMesh2(IntPtr world, IntPtr mesh); |
400 | 407 | ||
401 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 408 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
402 | public static extern IntPtr CreateObject2(IntPtr sim, ShapeData shapeData); | 409 | public static extern IntPtr CreateObject2(IntPtr world, ShapeData shapeData); |
403 | */ | 410 | */ |
404 | 411 | ||
405 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 412 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
406 | public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2, | 413 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
407 | Vector3 frame1loc, Quaternion frame1rot, | 414 | Vector3 frame1loc, Quaternion frame1rot, |
408 | Vector3 frame2loc, Quaternion frame2rot, | 415 | Vector3 frame2loc, Quaternion frame2rot, |
409 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 416 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
@@ -427,7 +434,13 @@ public static extern bool CalculateTransforms2(IntPtr constrain); | |||
427 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | 434 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |
428 | 435 | ||
429 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 436 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
430 | public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain); | 437 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); |
438 | |||
439 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
440 | public static extern Vector3 AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
441 | |||
442 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
443 | public static extern Vector3 RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
431 | 444 | ||
432 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 445 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
433 | public static extern Vector3 GetPosition2(IntPtr obj); | 446 | public static extern Vector3 GetPosition2(IntPtr obj); |
@@ -448,6 +461,9 @@ public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocit | |||
448 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); | 461 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); |
449 | 462 | ||
450 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 463 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
464 | public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); | ||
465 | |||
466 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
451 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); | 467 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); |
452 | 468 | ||
453 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 469 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -478,13 +494,16 @@ public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); | |||
478 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); | 494 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); |
479 | 495 | ||
480 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 496 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
481 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, uint flags); | 497 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); |
498 | |||
499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
500 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
482 | 501 | ||
483 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 502 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
484 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, uint flags); | 503 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); |
485 | 504 | ||
486 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 505 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
487 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, uint flags); | 506 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); |
488 | 507 | ||
489 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 508 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
490 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | 509 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); |
@@ -505,12 +524,6 @@ public static extern bool SetMargin2(IntPtr obj, float val); | |||
505 | public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); | 524 | public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); |
506 | 525 | ||
507 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 526 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
508 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
509 | |||
510 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
511 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
512 | |||
513 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
514 | public static extern bool DestroyObject2(IntPtr world, uint id); | 527 | public static extern bool DestroyObject2(IntPtr world, uint id); |
515 | 528 | ||
516 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 529 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |