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