00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef BULLET_C_API_H
00024 #define BULLET_C_API_H
00025
00026 #define PL_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
00027
00028 #ifdef BT_USE_DOUBLE_PRECISION
00029 typedef double plReal;
00030 #else
00031 typedef float plReal;
00032 #endif
00033
00034 typedef plReal plVector3[3];
00035 typedef plReal plQuaternion[4];
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00042 PL_DECLARE_HANDLE(plPhysicsSdkHandle);
00043
00045 PL_DECLARE_HANDLE(plDynamicsWorldHandle);
00046
00048 PL_DECLARE_HANDLE(plRigidBodyHandle);
00049
00051 PL_DECLARE_HANDLE(plCollisionShapeHandle);
00052
00054 PL_DECLARE_HANDLE(plConstraintHandle);
00055
00057 PL_DECLARE_HANDLE(plMeshInterfaceHandle);
00058
00060 PL_DECLARE_HANDLE(plCollisionBroadphaseHandle);
00061 PL_DECLARE_HANDLE(plBroadphaseProxyHandle);
00062 PL_DECLARE_HANDLE(plCollisionWorldHandle);
00063
00068 extern plPhysicsSdkHandle plNewBulletSdk(void);
00069 extern void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk);
00070
00073 typedef void(*btBroadphaseCallback)(void* clientData, void* object1,void* object2);
00074
00075 extern plCollisionBroadphaseHandle plCreateSapBroadphase(btBroadphaseCallback beginCallback,btBroadphaseCallback endCallback);
00076
00077 extern void plDestroyBroadphase(plCollisionBroadphaseHandle bp);
00078
00079 extern plBroadphaseProxyHandle plCreateProxy(plCollisionBroadphaseHandle bp, void* clientData, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
00080
00081 extern void plDestroyProxy(plCollisionBroadphaseHandle bp, plBroadphaseProxyHandle proxyHandle);
00082
00083 extern void plSetBoundingBox(plBroadphaseProxyHandle proxyHandle, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
00084
00085
00086
00087 extern plCollisionWorldHandle plCreateCollisionWorld(plPhysicsSdkHandle physicsSdk);
00088
00089
00090
00091
00092
00093
00094 extern plDynamicsWorldHandle plCreateDynamicsWorld(plPhysicsSdkHandle physicsSdk);
00095
00096 extern void plDeleteDynamicsWorld(plDynamicsWorldHandle world);
00097
00098 extern void plStepSimulation(plDynamicsWorldHandle, plReal timeStep);
00099
00100 extern void plAddRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
00101
00102 extern void plRemoveRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
00103
00104
00105
00106
00107 extern plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionShapeHandle cshape );
00108
00109 extern void plDeleteRigidBody(plRigidBodyHandle body);
00110
00111
00112
00113
00114 extern plCollisionShapeHandle plNewSphereShape(plReal radius);
00115 extern plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plReal z);
00116 extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height);
00117 extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal height);
00118 extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height);
00119 extern plCollisionShapeHandle plNewCompoundShape(void);
00120 extern void plAddChildShape(plCollisionShapeHandle compoundShape,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOrn);
00121
00122 extern void plDeleteShape(plCollisionShapeHandle shape);
00123
00124
00125 extern plCollisionShapeHandle plNewConvexHullShape(void);
00126 extern void plAddVertex(plCollisionShapeHandle convexHull, plReal x,plReal y,plReal z);
00127
00128 extern plMeshInterfaceHandle plNewMeshInterface(void);
00129 extern void plAddTriangle(plMeshInterfaceHandle meshHandle, plVector3 v0,plVector3 v1,plVector3 v2);
00130 extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshInterfaceHandle);
00131
00132 extern void plSetScaling(plCollisionShapeHandle shape, plVector3 scaling);
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 extern void plGetOpenGLMatrix(plRigidBodyHandle object, plReal* matrix);
00143 extern void plGetPosition(plRigidBodyHandle object,plVector3 position);
00144 extern void plGetOrientation(plRigidBodyHandle object,plQuaternion orientation);
00145
00146
00147 extern void plSetPosition(plRigidBodyHandle object, const plVector3 position);
00148 extern void plSetOrientation(plRigidBodyHandle object, const plQuaternion orientation);
00149 extern void plSetEuler(plReal yaw,plReal pitch,plReal roll, plQuaternion orient);
00150 extern void plSetOpenGLMatrix(plRigidBodyHandle object, plReal* matrix);
00151
00152 typedef struct plRayCastResult {
00153 plRigidBodyHandle m_body;
00154 plCollisionShapeHandle m_shape;
00155 plVector3 m_positionWorld;
00156 plVector3 m_normalWorld;
00157 } plRayCastResult;
00158
00159 extern int plRayCast(plDynamicsWorldHandle world, const plVector3 rayStart, const plVector3 rayEnd, plRayCastResult res);
00160
00161
00162
00163
00164
00165
00166
00167
00168 double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
00169
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173
00174
00175 #endif //BULLET_C_API_H
00176