aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-24 20:18:06 -0800
committerRobert Adams2012-12-24 20:18:06 -0800
commitbbc5a5089f79a4c5543f4a3f1cd4ffaf1de8c07e (patch)
tree508491dfb64055fde104f5f4459feeaee7a8526c /OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
parentBulletSim: Default avatar density changed to 3.5 which is WAY closer (diff)
downloadopensim-SC-bbc5a5089f79a4c5543f4a3f1cd4ffaf1de8c07e.zip
opensim-SC-bbc5a5089f79a4c5543f4a3f1cd4ffaf1de8c07e.tar.gz
opensim-SC-bbc5a5089f79a4c5543f4a3f1cd4ffaf1de8c07e.tar.bz2
opensim-SC-bbc5a5089f79a4c5543f4a3f1cd4ffaf1de8c07e.tar.xz
BulletSim: Rename some of the interface structures (BulletWorld, ...)
to get ready for... Start creation of BulletAPITemplate. This defines the abstract interface functions. Following commits will move over to the new interface. This will enable switching between the managed and unmanaged version of Bullet.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs392
1 files changed, 392 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 7857eaa..afe5bca 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -288,6 +288,398 @@ public enum ConstraintParamAxis : int
288 AXIS_ALL 288 AXIS_ALL
289}; 289};
290 290
291public abstract class BulletSimAPITemplate
292{
293// Initialization and simulation
294public abstract BulletWorld Initialize2(Vector3 maxPosition, IntPtr parms,
295 int maxCollisions, IntPtr collisionArray,
296 int maxUpdates, IntPtr updateArray
297 );
298
299public abstract bool UpdateParameter2(BulletWorld world, uint localID, String parm, float value);
300
301public abstract void SetHeightMap2(BulletWorld world, float[] heightmap);
302
303public abstract void Shutdown2(BulletWorld sim);
304
305public abstract int PhysicsStep2(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
306 out int updatedEntityCount,
307 out IntPtr updatedEntitiesPtr,
308 out int collidersCount,
309 out IntPtr collidersPtr);
310
311public abstract bool PushUpdate2(BulletBody obj);
312
313// =====================================================================================
314// Mesh, hull, shape and body creation helper routines
315public abstract BulletShape CreateMeshShape2(BulletWorld world,
316 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
317 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
318
319public abstract BulletShape CreateHullShape2(BulletWorld world,
320 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
321
322public abstract BulletShape BuildHullShapeFromMesh2(BulletWorld world, BulletShape meshShape);
323
324public abstract BulletShape BuildNativeShape2(BulletWorld world, ShapeData shapeData);
325
326public abstract bool IsNativeShape2(BulletShape shape);
327
328public abstract void SetShapeCollisionMargin(BulletShape shape, float margin);
329
330public abstract BulletShape BuildCapsuleShape2(BulletWorld world, float radius, float height, Vector3 scale);
331
332public abstract BulletShape CreateCompoundShape2(BulletWorld sim, bool enableDynamicAabbTree);
333
334public abstract int GetNumberOfCompoundChildren2(BulletShape cShape);
335
336public abstract void AddChildShapeToCompoundShape2(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot);
337
338public abstract BulletShape GetChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
339
340public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
341
342public abstract void RemoveChildShapeFromCompoundShape2(BulletShape cShape, BulletShape removeShape);
343
344public abstract void RecalculateCompoundShapeLocalAabb2(BulletShape cShape);
345
346public abstract BulletShape DuplicateCollisionShape2(BulletWorld sim, BulletShape srcShape, uint id);
347
348public abstract BulletBody CreateBodyFromShapeAndInfo2(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo);
349
350public abstract bool DeleteCollisionShape2(BulletWorld world, BulletShape shape);
351
352public abstract int GetBodyType2(BulletBody obj);
353
354public abstract BulletBody CreateBodyFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
355
356public abstract BulletBody CreateBodyWithDefaultMotionState2(BulletShape shape, uint id, Vector3 pos, Quaternion rot);
357
358public abstract BulletBody CreateGhostFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
359
360public abstract IntPtr AllocateBodyInfo2(BulletBody obj);
361
362public abstract void ReleaseBodyInfo2(IntPtr obj);
363
364public abstract void DestroyObject2(BulletWorld sim, BulletBody obj);
365
366// =====================================================================================
367// Terrain creation and helper routines
368public abstract IntPtr CreateHeightMapInfo2(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
369 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
370
371public abstract IntPtr FillHeightMapInfo2(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
372 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
373
374public abstract bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
375
376public abstract BulletBody CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
377
378public abstract BulletBody CreateTerrainShape2(IntPtr mapInfo);
379
380// =====================================================================================
381// Constraint creation and helper routines
382public abstract BulletConstraint Create6DofConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
383 Vector3 frame1loc, Quaternion frame1rot,
384 Vector3 frame2loc, Quaternion frame2rot,
385 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
386
387public abstract BulletConstraint Create6DofConstraintToPoint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
388 Vector3 joinPoint,
389 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
390
391public abstract BulletConstraint CreateHingeConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
392 Vector3 pivotinA, Vector3 pivotinB,
393 Vector3 axisInA, Vector3 axisInB,
394 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
395
396public abstract void SetConstraintEnable2(BulletConstraint constrain, float numericTrueFalse);
397
398public abstract void SetConstraintNumSolverIterations2(BulletConstraint constrain, float iterations);
399
400public abstract bool SetFrames2(BulletConstraint constrain,
401 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
402
403public abstract bool SetLinearLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
404
405public abstract bool SetAngularLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
406
407public abstract bool UseFrameOffset2(BulletConstraint constrain, float enable);
408
409public abstract bool TranslationalLimitMotor2(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
410
411public abstract bool SetBreakingImpulseThreshold2(BulletConstraint constrain, float threshold);
412
413public abstract bool CalculateTransforms2(BulletConstraint constrain);
414
415public abstract bool SetConstraintParam2(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
416
417public abstract bool DestroyConstraint2(BulletWorld world, BulletConstraint constrain);
418
419// =====================================================================================
420// btCollisionWorld entries
421public abstract void UpdateSingleAabb2(BulletWorld world, BulletBody obj);
422
423public abstract void UpdateAabbs2(BulletWorld world);
424
425public abstract bool GetForceUpdateAllAabbs2(BulletWorld world);
426
427public abstract void SetForceUpdateAllAabbs2(BulletWorld world, bool force);
428
429// =====================================================================================
430// btDynamicsWorld entries
431public abstract bool AddObjectToWorld2(BulletWorld world, BulletBody obj);
432
433public abstract bool RemoveObjectFromWorld2(BulletWorld world, BulletBody obj);
434
435public abstract bool AddConstraintToWorld2(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
436
437public abstract bool RemoveConstraintFromWorld2(BulletWorld world, BulletConstraint constrain);
438// =====================================================================================
439// btCollisionObject entries
440public abstract Vector3 GetAnisotripicFriction2(BulletConstraint constrain);
441
442public abstract Vector3 SetAnisotripicFriction2(BulletConstraint constrain, Vector3 frict);
443
444public abstract bool HasAnisotripicFriction2(BulletConstraint constrain);
445
446public abstract void SetContactProcessingThreshold2(BulletBody obj, float val);
447
448public abstract float GetContactProcessingThreshold2(BulletBody obj);
449
450public abstract bool IsStaticObject2(BulletBody obj);
451
452public abstract bool IsKinematicObject2(BulletBody obj);
453
454public abstract bool IsStaticOrKinematicObject2(BulletBody obj);
455
456public abstract bool HasContactResponse2(BulletBody obj);
457
458public abstract void SetCollisionShape2(BulletWorld sim, BulletBody obj, BulletBody shape);
459
460public abstract BulletShape GetCollisionShape2(BulletBody obj);
461
462public abstract int GetActivationState2(BulletBody obj);
463
464public abstract void SetActivationState2(BulletBody obj, int state);
465
466public abstract void SetDeactivationTime2(BulletBody obj, float dtime);
467
468public abstract float GetDeactivationTime2(BulletBody obj);
469
470public abstract void ForceActivationState2(BulletBody obj, ActivationState state);
471
472public abstract void Activate2(BulletBody obj, bool forceActivation);
473
474public abstract bool IsActive2(BulletBody obj);
475
476public abstract void SetRestitution2(BulletBody obj, float val);
477
478public abstract float GetRestitution2(BulletBody obj);
479
480public abstract void SetFriction2(BulletBody obj, float val);
481
482public abstract float GetFriction2(BulletBody obj);
483
484 /* Haven't defined the type 'Transform'
485public abstract Transform GetWorldTransform2(BulletBody obj);
486
487public abstract void setWorldTransform2(BulletBody obj, Transform trans);
488 */
489
490public abstract Vector3 GetPosition2(BulletBody obj);
491
492public abstract Quaternion GetOrientation2(BulletBody obj);
493
494public abstract void SetTranslation2(BulletBody obj, Vector3 position, Quaternion rotation);
495
496public abstract IntPtr GetBroadphaseHandle2(BulletBody obj);
497
498public abstract void SetBroadphaseHandle2(BulletBody obj, IntPtr handle);
499
500 /*
501public abstract Transform GetInterpolationWorldTransform2(IntPtr obj);
502
503public abstract void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
504 */
505
506public abstract void SetInterpolationLinearVelocity2(BulletBody obj, Vector3 vel);
507
508public abstract void SetInterpolationAngularVelocity2(BulletBody obj, Vector3 vel);
509
510public abstract void SetInterpolationVelocity2(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
511
512public abstract float GetHitFraction2(BulletBody obj);
513
514public abstract void SetHitFraction2(BulletBody obj, float val);
515
516public abstract CollisionFlags GetCollisionFlags2(BulletBody obj);
517
518public abstract CollisionFlags SetCollisionFlags2(BulletBody obj, CollisionFlags flags);
519
520public abstract CollisionFlags AddToCollisionFlags2(BulletBody obj, CollisionFlags flags);
521
522public abstract CollisionFlags RemoveFromCollisionFlags2(BulletBody obj, CollisionFlags flags);
523
524public abstract float GetCcdMotionThreshold2(BulletBody obj);
525
526public abstract void SetCcdMotionThreshold2(BulletBody obj, float val);
527
528public abstract float GetCcdSweptSphereRadius2(BulletBody obj);
529
530public abstract void SetCcdSweptSphereRadius2(BulletBody obj, float val);
531
532public abstract IntPtr GetUserPointer2(BulletBody obj);
533
534public abstract void SetUserPointer2(BulletBody obj, IntPtr val);
535
536// =====================================================================================
537// btRigidBody entries
538public abstract void ApplyGravity2(BulletBody obj);
539
540public abstract void SetGravity2(BulletBody obj, Vector3 val);
541
542public abstract Vector3 GetGravity2(BulletBody obj);
543
544public abstract void SetDamping2(BulletBody obj, float lin_damping, float ang_damping);
545
546public abstract void SetLinearDamping2(BulletBody obj, float lin_damping);
547
548public abstract void SetAngularDamping2(BulletBody obj, float ang_damping);
549
550public abstract float GetLinearDamping2(BulletBody obj);
551
552public abstract float GetAngularDamping2(BulletBody obj);
553
554public abstract float GetLinearSleepingThreshold2(BulletBody obj);
555
556
557public abstract void ApplyDamping2(BulletBody obj, float timeStep);
558
559public abstract void SetMassProps2(BulletBody obj, float mass, Vector3 inertia);
560
561public abstract Vector3 GetLinearFactor2(BulletBody obj);
562
563public abstract void SetLinearFactor2(BulletBody obj, Vector3 factor);
564
565 /*
566public abstract void SetCenterOfMassTransform2(BulletBody obj, Transform trans);
567 */
568
569public abstract void SetCenterOfMassByPosRot2(BulletBody obj, Vector3 pos, Quaternion rot);
570
571// Add a force to the object as if its mass is one.
572public abstract void ApplyCentralForce2(BulletBody obj, Vector3 force);
573
574// Set the force being applied to the object as if its mass is one.
575public abstract void SetObjectForce2(BulletBody obj, Vector3 force);
576
577public abstract Vector3 GetTotalForce2(BulletBody obj);
578
579public abstract Vector3 GetTotalTorque2(BulletBody obj);
580
581public abstract Vector3 GetInvInertiaDiagLocal2(BulletBody obj);
582
583public abstract void SetInvInertiaDiagLocal2(BulletBody obj, Vector3 inert);
584
585public abstract void SetSleepingThresholds2(BulletBody obj, float lin_threshold, float ang_threshold);
586
587public abstract void ApplyTorque2(BulletBody obj, Vector3 torque);
588
589// Apply force at the given point. Will add torque to the object.
590public abstract void ApplyForce2(BulletBody obj, Vector3 force, Vector3 pos);
591
592// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
593public abstract void ApplyCentralImpulse2(BulletBody obj, Vector3 imp);
594
595// Apply impulse to the object's torque. Force is scaled by object's mass.
596public abstract void ApplyTorqueImpulse2(BulletBody obj, Vector3 imp);
597
598// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
599public abstract void ApplyImpulse2(BulletBody obj, Vector3 imp, Vector3 pos);
600
601public abstract void ClearForces2(BulletBody obj);
602
603public abstract void ClearAllForces2(BulletBody obj);
604
605public abstract void UpdateInertiaTensor2(BulletBody obj);
606
607
608 /*
609public abstract Transform GetCenterOfMassTransform2(BulletBody obj);
610 */
611
612public abstract Vector3 GetLinearVelocity2(BulletBody obj);
613
614public abstract Vector3 GetAngularVelocity2(BulletBody obj);
615
616public abstract void SetLinearVelocity2(BulletBody obj, Vector3 val);
617
618public abstract void SetAngularVelocity2(BulletBody obj, Vector3 angularVelocity);
619
620public abstract Vector3 GetVelocityInLocalPoint2(BulletBody obj, Vector3 pos);
621
622public abstract void Translate2(BulletBody obj, Vector3 trans);
623
624public abstract void UpdateDeactivation2(BulletBody obj, float timeStep);
625
626public abstract bool WantsSleeping2(BulletBody obj);
627
628public abstract void SetAngularFactor2(BulletBody obj, float factor);
629
630public abstract void SetAngularFactorV2(BulletBody obj, Vector3 factor);
631
632public abstract Vector3 GetAngularFactor2(BulletBody obj);
633
634public abstract bool IsInWorld2(BulletBody obj);
635
636public abstract void AddConstraintRef2(BulletBody obj, BulletConstraint constrain);
637
638public abstract void RemoveConstraintRef2(BulletBody obj, BulletConstraint constrain);
639
640public abstract BulletConstraint GetConstraintRef2(BulletBody obj, int index);
641
642public abstract int GetNumConstraintRefs2(BulletBody obj);
643
644public abstract bool SetCollisionGroupMask2(BulletBody body, uint filter, uint mask);
645
646// =====================================================================================
647// btCollisionShape entries
648
649public abstract float GetAngularMotionDisc2(BulletShape shape);
650
651public abstract float GetContactBreakingThreshold2(BulletShape shape, float defaultFactor);
652
653public abstract bool IsPolyhedral2(BulletShape shape);
654
655public abstract bool IsConvex2d2(BulletShape shape);
656
657public abstract bool IsConvex2(BulletShape shape);
658
659public abstract bool IsNonMoving2(BulletShape shape);
660
661public abstract bool IsConcave2(BulletShape shape);
662
663public abstract bool IsCompound2(BulletShape shape);
664
665public abstract bool IsSoftBody2(BulletShape shape);
666
667public abstract bool IsInfinite2(BulletShape shape);
668
669public abstract void SetLocalScaling2(BulletShape shape, Vector3 scale);
670
671public abstract Vector3 GetLocalScaling2(BulletShape shape);
672
673public abstract Vector3 CalculateLocalInertia2(BulletShape shape, float mass);
674
675public abstract int GetShapeType2(BulletShape shape);
676
677public abstract void SetMargin2(BulletShape shape, float val);
678
679public abstract float GetMargin2(BulletShape shape);
680
681};
682
291// =============================================================================== 683// ===============================================================================
292static class BulletSimAPI { 684static class BulletSimAPI {
293// =============================================================================== 685// ===============================================================================