diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | 418 |
1 files changed, 302 insertions, 116 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index 9a8a2e8..6e68053 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -34,7 +34,7 @@ using OpenMetaverse; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BulletSPlugin | 35 | namespace OpenSim.Region.Physics.BulletSPlugin |
36 | { | 36 | { |
37 | public sealed class BSAPIUnman : BulletSimAPITemplate | 37 | public sealed class BSAPIUnman : BSAPITemplate |
38 | { | 38 | { |
39 | /* | 39 | /* |
40 | // Initialization and simulation | 40 | // Initialization and simulation |
@@ -55,8 +55,11 @@ public int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float | |||
55 | out int collidersCount, | 55 | out int collidersCount, |
56 | out IntPtr collidersPtr); | 56 | out IntPtr collidersPtr); |
57 | 57 | ||
58 | public bool PushUpdate(BulletBody obj); | ||
59 | */ | 58 | */ |
59 | public override bool PushUpdate(BulletBody obj) | ||
60 | { | ||
61 | return BSAPICPP.PushUpdate2(obj.ptr); | ||
62 | } | ||
60 | 63 | ||
61 | // ===================================================================================== | 64 | // ===================================================================================== |
62 | // Mesh, hull, shape and body creation helper routines | 65 | // Mesh, hull, shape and body creation helper routines |
@@ -569,146 +572,332 @@ public override void SetUserPointer(BulletBody obj, IntPtr val) | |||
569 | BSAPICPP.SetUserPointer2(obj.ptr, val); | 572 | BSAPICPP.SetUserPointer2(obj.ptr, val); |
570 | } | 573 | } |
571 | 574 | ||
572 | /* | ||
573 | // ===================================================================================== | 575 | // ===================================================================================== |
574 | // btRigidBody entries | 576 | // btRigidBody entries |
575 | public override void ApplyGravity(BulletBody obj); | 577 | public override void ApplyGravity(BulletBody obj) |
576 | 578 | { | |
577 | public override void SetGravity(BulletBody obj, Vector3 val); | 579 | BSAPICPP.ApplyGravity2(obj.ptr); |
580 | } | ||
578 | 581 | ||
579 | public override Vector3 GetGravity(BulletBody obj); | 582 | public override void SetGravity(BulletBody obj, Vector3 val) |
583 | { | ||
584 | BSAPICPP.SetGravity2(obj.ptr, val); | ||
585 | } | ||
580 | 586 | ||
581 | public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping); | 587 | public override Vector3 GetGravity(BulletBody obj) |
588 | { | ||
589 | return BSAPICPP.GetGravity2(obj.ptr); | ||
590 | } | ||
582 | 591 | ||
583 | public override void SetLinearDamping(BulletBody obj, float lin_damping); | 592 | public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping) |
593 | { | ||
594 | BSAPICPP.SetDamping2(obj.ptr, lin_damping, ang_damping); | ||
595 | } | ||
584 | 596 | ||
585 | public override void SetAngularDamping(BulletBody obj, float ang_damping); | 597 | public override void SetLinearDamping(BulletBody obj, float lin_damping) |
598 | { | ||
599 | BSAPICPP.SetLinearDamping2(obj.ptr, lin_damping); | ||
600 | } | ||
586 | 601 | ||
587 | public override float GetLinearDamping(BulletBody obj); | 602 | public override void SetAngularDamping(BulletBody obj, float ang_damping) |
603 | { | ||
604 | BSAPICPP.SetAngularDamping2(obj.ptr, ang_damping); | ||
605 | } | ||
588 | 606 | ||
589 | public override float GetAngularDamping(BulletBody obj); | 607 | public override float GetLinearDamping(BulletBody obj) |
608 | { | ||
609 | return BSAPICPP.GetLinearDamping2(obj.ptr); | ||
610 | } | ||
590 | 611 | ||
591 | public override float GetLinearSleepingThreshold(BulletBody obj); | 612 | public override float GetAngularDamping(BulletBody obj) |
613 | { | ||
614 | return BSAPICPP.GetAngularDamping2(obj.ptr); | ||
615 | } | ||
592 | 616 | ||
617 | public override float GetLinearSleepingThreshold(BulletBody obj) | ||
618 | { | ||
619 | return BSAPICPP.GetLinearSleepingThreshold2(obj.ptr); | ||
620 | } | ||
593 | 621 | ||
594 | public override void ApplyDamping(BulletBody obj, float timeStep); | 622 | public override void ApplyDamping(BulletBody obj, float timeStep) |
623 | { | ||
624 | BSAPICPP.ApplyDamping2(obj.ptr, timeStep); | ||
625 | } | ||
595 | 626 | ||
596 | public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia); | 627 | public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia) |
628 | { | ||
629 | BSAPICPP.SetMassProps2(obj.ptr, mass, inertia); | ||
630 | } | ||
597 | 631 | ||
598 | public override Vector3 GetLinearFactor(BulletBody obj); | 632 | public override Vector3 GetLinearFactor(BulletBody obj) |
633 | { | ||
634 | return BSAPICPP.GetLinearFactor2(obj.ptr); | ||
635 | } | ||
599 | 636 | ||
600 | public override void SetLinearFactor(BulletBody obj, Vector3 factor); | 637 | public override void SetLinearFactor(BulletBody obj, Vector3 factor) |
638 | { | ||
639 | BSAPICPP.SetLinearFactor2(obj.ptr, factor); | ||
640 | } | ||
601 | 641 | ||
602 | public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot); | 642 | public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot) |
643 | { | ||
644 | BSAPICPP.SetCenterOfMassByPosRot2(obj.ptr, pos, rot); | ||
645 | } | ||
603 | 646 | ||
604 | // Add a force to the object as if its mass is one. | 647 | // Add a force to the object as if its mass is one. |
605 | public override void ApplyCentralForce(BulletBody obj, Vector3 force); | 648 | public override void ApplyCentralForce(BulletBody obj, Vector3 force) |
649 | { | ||
650 | BSAPICPP.ApplyCentralForce2(obj.ptr, force); | ||
651 | } | ||
606 | 652 | ||
607 | // Set the force being applied to the object as if its mass is one. | 653 | // Set the force being applied to the object as if its mass is one. |
608 | public override void SetObjectForce(BulletBody obj, Vector3 force); | 654 | public override void SetObjectForce(BulletBody obj, Vector3 force) |
655 | { | ||
656 | BSAPICPP.SetObjectForce2(obj.ptr, force); | ||
657 | } | ||
609 | 658 | ||
610 | public override Vector3 GetTotalForce(BulletBody obj); | 659 | public override Vector3 GetTotalForce(BulletBody obj) |
660 | { | ||
661 | return BSAPICPP.GetTotalForce2(obj.ptr); | ||
662 | } | ||
611 | 663 | ||
612 | public override Vector3 GetTotalTorque(BulletBody obj); | 664 | public override Vector3 GetTotalTorque(BulletBody obj) |
665 | { | ||
666 | return BSAPICPP.GetTotalTorque2(obj.ptr); | ||
667 | } | ||
613 | 668 | ||
614 | public override Vector3 GetInvInertiaDiagLocal(BulletBody obj); | 669 | public override Vector3 GetInvInertiaDiagLocal(BulletBody obj) |
670 | { | ||
671 | return BSAPICPP.GetInvInertiaDiagLocal2(obj.ptr); | ||
672 | } | ||
615 | 673 | ||
616 | public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert); | 674 | public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert) |
675 | { | ||
676 | BSAPICPP.SetInvInertiaDiagLocal2(obj.ptr, inert); | ||
677 | } | ||
617 | 678 | ||
618 | public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold); | 679 | public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold) |
680 | { | ||
681 | BSAPICPP.SetSleepingThresholds2(obj.ptr, lin_threshold, ang_threshold); | ||
682 | } | ||
619 | 683 | ||
620 | public override void ApplyTorque(BulletBody obj, Vector3 torque); | 684 | public override void ApplyTorque(BulletBody obj, Vector3 torque) |
685 | { | ||
686 | BSAPICPP.ApplyTorque2(obj.ptr, torque); | ||
687 | } | ||
621 | 688 | ||
622 | // Apply force at the given point. Will add torque to the object. | 689 | // Apply force at the given point. Will add torque to the object. |
623 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos); | 690 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) |
691 | { | ||
692 | BSAPICPP.ApplyForce2(obj.ptr, force, pos); | ||
693 | } | ||
624 | 694 | ||
625 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | 695 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. |
626 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp); | 696 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) |
697 | { | ||
698 | BSAPICPP.ApplyCentralImpulse2(obj.ptr, imp); | ||
699 | } | ||
627 | 700 | ||
628 | // Apply impulse to the object's torque. Force is scaled by object's mass. | 701 | // Apply impulse to the object's torque. Force is scaled by object's mass. |
629 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp); | 702 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) |
703 | { | ||
704 | BSAPICPP.ApplyTorqueImpulse2(obj.ptr, imp); | ||
705 | } | ||
630 | 706 | ||
631 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | 707 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. |
632 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos); | 708 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) |
709 | { | ||
710 | BSAPICPP.ApplyImpulse2(obj.ptr, imp, pos); | ||
711 | } | ||
633 | 712 | ||
634 | public override void ClearForces(BulletBody obj); | 713 | public override void ClearForces(BulletBody obj) |
714 | { | ||
715 | BSAPICPP.ClearForces2(obj.ptr); | ||
716 | } | ||
635 | 717 | ||
636 | public override void ClearAllForces(BulletBody obj); | 718 | public override void ClearAllForces(BulletBody obj) |
719 | { | ||
720 | BSAPICPP.ClearAllForces2(obj.ptr); | ||
721 | } | ||
637 | 722 | ||
638 | public override void UpdateInertiaTensor(BulletBody obj); | 723 | public override void UpdateInertiaTensor(BulletBody obj) |
724 | { | ||
725 | BSAPICPP.UpdateInertiaTensor2(obj.ptr); | ||
726 | } | ||
639 | 727 | ||
640 | public override Vector3 GetLinearVelocity(BulletBody obj); | 728 | public override Vector3 GetLinearVelocity(BulletBody obj) |
729 | { | ||
730 | return BSAPICPP.GetLinearVelocity2(obj.ptr); | ||
731 | } | ||
641 | 732 | ||
642 | public override Vector3 GetAngularVelocity(BulletBody obj); | 733 | public override Vector3 GetAngularVelocity(BulletBody obj) |
734 | { | ||
735 | return BSAPICPP.GetAngularVelocity2(obj.ptr); | ||
736 | } | ||
643 | 737 | ||
644 | public override void SetLinearVelocity(BulletBody obj, Vector3 val); | 738 | public override void SetLinearVelocity(BulletBody obj, Vector3 vel) |
739 | { | ||
740 | BSAPICPP.SetLinearVelocity2(obj.ptr, vel); | ||
741 | } | ||
645 | 742 | ||
646 | public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity); | 743 | public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity) |
744 | { | ||
745 | BSAPICPP.SetAngularVelocity2(obj.ptr, angularVelocity); | ||
746 | } | ||
647 | 747 | ||
648 | public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos); | 748 | public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos) |
749 | { | ||
750 | return BSAPICPP.GetVelocityInLocalPoint2(obj.ptr, pos); | ||
751 | } | ||
649 | 752 | ||
650 | public override void Translate(BulletBody obj, Vector3 trans); | 753 | public override void Translate(BulletBody obj, Vector3 trans) |
754 | { | ||
755 | BSAPICPP.Translate2(obj.ptr, trans); | ||
756 | } | ||
651 | 757 | ||
652 | public override void UpdateDeactivation(BulletBody obj, float timeStep); | 758 | public override void UpdateDeactivation(BulletBody obj, float timeStep) |
759 | { | ||
760 | BSAPICPP.UpdateDeactivation2(obj.ptr, timeStep); | ||
761 | } | ||
653 | 762 | ||
654 | public override bool WantsSleeping(BulletBody obj); | 763 | public override bool WantsSleeping(BulletBody obj) |
764 | { | ||
765 | return BSAPICPP.WantsSleeping2(obj.ptr); | ||
766 | } | ||
655 | 767 | ||
656 | public override void SetAngularFactor(BulletBody obj, float factor); | 768 | public override void SetAngularFactor(BulletBody obj, float factor) |
769 | { | ||
770 | BSAPICPP.SetAngularFactor2(obj.ptr, factor); | ||
771 | } | ||
657 | 772 | ||
658 | public override void SetAngularFactorV(BulletBody obj, Vector3 factor); | 773 | public override void SetAngularFactorV(BulletBody obj, Vector3 factor) |
774 | { | ||
775 | BSAPICPP.SetAngularFactorV2(obj.ptr, factor); | ||
776 | } | ||
659 | 777 | ||
660 | public override Vector3 GetAngularFactor(BulletBody obj); | 778 | public override Vector3 GetAngularFactor(BulletBody obj) |
779 | { | ||
780 | return BSAPICPP.GetAngularFactor2(obj.ptr); | ||
781 | } | ||
661 | 782 | ||
662 | public override bool IsInWorld(BulletBody obj); | 783 | public override bool IsInWorld(BulletBody obj) |
784 | { | ||
785 | return BSAPICPP.IsInWorld2(obj.ptr); | ||
786 | } | ||
663 | 787 | ||
664 | public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain); | 788 | public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain) |
789 | { | ||
790 | BSAPICPP.AddConstraintRef2(obj.ptr, constrain.ptr); | ||
791 | } | ||
665 | 792 | ||
666 | public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain); | 793 | public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain) |
794 | { | ||
795 | BSAPICPP.RemoveConstraintRef2(obj.ptr, constrain.ptr); | ||
796 | } | ||
667 | 797 | ||
668 | public override BulletConstraint GetConstraintRef(BulletBody obj, int index); | 798 | public override BulletConstraint GetConstraintRef(BulletBody obj, int index) |
799 | { | ||
800 | return new BulletConstraint(BSAPICPP.GetConstraintRef2(obj.ptr, index)); | ||
801 | } | ||
669 | 802 | ||
670 | public override int GetNumConstraintRefs(BulletBody obj); | 803 | public override int GetNumConstraintRefs(BulletBody obj) |
804 | { | ||
805 | return BSAPICPP.GetNumConstraintRefs2(obj.ptr); | ||
806 | } | ||
671 | 807 | ||
672 | public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); | 808 | public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask) |
809 | { | ||
810 | return BSAPICPP.SetCollisionGroupMask2(body.ptr, filter, mask); | ||
811 | } | ||
673 | 812 | ||
674 | // ===================================================================================== | 813 | // ===================================================================================== |
675 | // btCollisionShape entries | 814 | // btCollisionShape entries |
676 | 815 | ||
677 | public override float GetAngularMotionDisc(BulletShape shape); | 816 | public override float GetAngularMotionDisc(BulletShape shape) |
817 | { | ||
818 | return BSAPICPP.GetAngularMotionDisc2(shape.ptr); | ||
819 | } | ||
678 | 820 | ||
679 | public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor); | 821 | public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor) |
822 | { | ||
823 | return BSAPICPP.GetContactBreakingThreshold2(shape.ptr, defaultFactor); | ||
824 | } | ||
680 | 825 | ||
681 | public override bool IsPolyhedral(BulletShape shape); | 826 | public override bool IsPolyhedral(BulletShape shape) |
827 | { | ||
828 | return BSAPICPP.IsPolyhedral2(shape.ptr); | ||
829 | } | ||
682 | 830 | ||
683 | public override bool IsConvex2d(BulletShape shape); | 831 | public override bool IsConvex2d(BulletShape shape) |
832 | { | ||
833 | return BSAPICPP.IsConvex2d2(shape.ptr); | ||
834 | } | ||
684 | 835 | ||
685 | public override bool IsConvex(BulletShape shape); | 836 | public override bool IsConvex(BulletShape shape) |
837 | { | ||
838 | return BSAPICPP.IsConvex2(shape.ptr); | ||
839 | } | ||
686 | 840 | ||
687 | public override bool IsNonMoving(BulletShape shape); | 841 | public override bool IsNonMoving(BulletShape shape) |
842 | { | ||
843 | return BSAPICPP.IsNonMoving2(shape.ptr); | ||
844 | } | ||
688 | 845 | ||
689 | public override bool IsConcave(BulletShape shape); | 846 | public override bool IsConcave(BulletShape shape) |
847 | { | ||
848 | return BSAPICPP.IsConcave2(shape.ptr); | ||
849 | } | ||
690 | 850 | ||
691 | public override bool IsCompound(BulletShape shape); | 851 | public override bool IsCompound(BulletShape shape) |
852 | { | ||
853 | return BSAPICPP.IsCompound2(shape.ptr); | ||
854 | } | ||
692 | 855 | ||
693 | public override bool IsSoftBody(BulletShape shape); | 856 | public override bool IsSoftBody(BulletShape shape) |
857 | { | ||
858 | return BSAPICPP.IsSoftBody2(shape.ptr); | ||
859 | } | ||
694 | 860 | ||
695 | public override bool IsInfinite(BulletShape shape); | 861 | public override bool IsInfinite(BulletShape shape) |
862 | { | ||
863 | return BSAPICPP.IsInfinite2(shape.ptr); | ||
864 | } | ||
696 | 865 | ||
697 | public override void SetLocalScaling(BulletShape shape, Vector3 scale); | 866 | public override void SetLocalScaling(BulletShape shape, Vector3 scale) |
867 | { | ||
868 | BSAPICPP.SetLocalScaling2(shape.ptr, scale); | ||
869 | } | ||
698 | 870 | ||
699 | public override Vector3 GetLocalScaling(BulletShape shape); | 871 | public override Vector3 GetLocalScaling(BulletShape shape) |
872 | { | ||
873 | return BSAPICPP.GetLocalScaling2(shape.ptr); | ||
874 | } | ||
700 | 875 | ||
701 | public override Vector3 CalculateLocalInertia(BulletShape shape, float mass); | 876 | public override Vector3 CalculateLocalInertia(BulletShape shape, float mass) |
877 | { | ||
878 | return BSAPICPP.CalculateLocalInertia2(shape.ptr, mass); | ||
879 | } | ||
702 | 880 | ||
703 | public override int GetShapeType(BulletShape shape); | 881 | public override int GetShapeType(BulletShape shape) |
882 | { | ||
883 | return BSAPICPP.GetShapeType2(shape.ptr); | ||
884 | } | ||
704 | 885 | ||
705 | public override void SetMargin(BulletShape shape, float val); | 886 | public override void SetMargin(BulletShape shape, float val) |
887 | { | ||
888 | BSAPICPP.SetMargin2(shape.ptr, val); | ||
889 | } | ||
706 | 890 | ||
707 | public override float GetMargin(BulletShape shape); | 891 | public override float GetMargin(BulletShape shape) |
708 | */ | 892 | { |
893 | return BSAPICPP.GetMargin2(shape.ptr); | ||
894 | } | ||
709 | 895 | ||
710 | static class BSAPICPP | 896 | static class BSAPICPP |
711 | { | 897 | { |
898 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
899 | public static extern bool PushUpdate2(IntPtr obj); | ||
900 | |||
712 | // ===================================================================================== | 901 | // ===================================================================================== |
713 | // Mesh, hull, shape and body creation helper routines | 902 | // Mesh, hull, shape and body creation helper routines |
714 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 903 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -1029,55 +1218,6 @@ public static extern IntPtr GetUserPointer2(IntPtr obj); | |||
1029 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1218 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1030 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | 1219 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); |
1031 | 1220 | ||
1032 | } | ||
1033 | } | ||
1034 | |||
1035 | // =============================================================================== | ||
1036 | // =============================================================================== | ||
1037 | // =============================================================================== | ||
1038 | // =============================================================================== | ||
1039 | // =============================================================================== | ||
1040 | // =============================================================================== | ||
1041 | // =============================================================================== | ||
1042 | // =============================================================================== | ||
1043 | // =============================================================================== | ||
1044 | // =============================================================================== | ||
1045 | // =============================================================================== | ||
1046 | // =============================================================================== | ||
1047 | // =============================================================================== | ||
1048 | static class BulletSimAPI { | ||
1049 | // =============================================================================== | ||
1050 | // Link back to the managed code for outputting log messages | ||
1051 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
1052 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
1053 | |||
1054 | // =============================================================================== | ||
1055 | // Initialization and simulation | ||
1056 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1057 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | ||
1058 | int maxCollisions, IntPtr collisionArray, | ||
1059 | int maxUpdates, IntPtr updateArray, | ||
1060 | DebugLogCallback logRoutine); | ||
1061 | |||
1062 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1063 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
1064 | |||
1065 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1066 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); | ||
1067 | |||
1068 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1069 | public static extern void Shutdown2(IntPtr sim); | ||
1070 | |||
1071 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1072 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
1073 | out int updatedEntityCount, | ||
1074 | out IntPtr updatedEntitiesPtr, | ||
1075 | out int collidersCount, | ||
1076 | out IntPtr collidersPtr); | ||
1077 | |||
1078 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1079 | public static extern bool PushUpdate2(IntPtr obj); | ||
1080 | |||
1081 | // ===================================================================================== | 1221 | // ===================================================================================== |
1082 | // btRigidBody entries | 1222 | // btRigidBody entries |
1083 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1223 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -1291,6 +1431,52 @@ public static extern void SetMargin2(IntPtr shape, float val); | |||
1291 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1431 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1292 | public static extern float GetMargin2(IntPtr shape); | 1432 | public static extern float GetMargin2(IntPtr shape); |
1293 | 1433 | ||
1434 | } | ||
1435 | } | ||
1436 | |||
1437 | // =============================================================================== | ||
1438 | // =============================================================================== | ||
1439 | // =============================================================================== | ||
1440 | // =============================================================================== | ||
1441 | // =============================================================================== | ||
1442 | // =============================================================================== | ||
1443 | // =============================================================================== | ||
1444 | // =============================================================================== | ||
1445 | // =============================================================================== | ||
1446 | // =============================================================================== | ||
1447 | // =============================================================================== | ||
1448 | // =============================================================================== | ||
1449 | // =============================================================================== | ||
1450 | static class BulletSimAPI { | ||
1451 | // =============================================================================== | ||
1452 | // Link back to the managed code for outputting log messages | ||
1453 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
1454 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
1455 | |||
1456 | // =============================================================================== | ||
1457 | // Initialization and simulation | ||
1458 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1459 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | ||
1460 | int maxCollisions, IntPtr collisionArray, | ||
1461 | int maxUpdates, IntPtr updateArray, | ||
1462 | DebugLogCallback logRoutine); | ||
1463 | |||
1464 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1465 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
1466 | |||
1467 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1468 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); | ||
1469 | |||
1470 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1471 | public static extern void Shutdown2(IntPtr sim); | ||
1472 | |||
1473 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1474 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
1475 | out int updatedEntityCount, | ||
1476 | out IntPtr updatedEntitiesPtr, | ||
1477 | out int collidersCount, | ||
1478 | out IntPtr collidersPtr); | ||
1479 | |||
1294 | // ===================================================================================== | 1480 | // ===================================================================================== |
1295 | // Debugging | 1481 | // Debugging |
1296 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1482 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |