126 lines
4.0 KiB
C
126 lines
4.0 KiB
C
#ifndef RAPIER_H
|
|
#define RAPIER_H
|
|
|
|
|
|
|
|
typedef enum EPhysicsBodyType {
|
|
k_EPhysics_Static,
|
|
k_EPhysics_Dynamic,
|
|
k_EPhysics_KinematicPositionBased,
|
|
k_EPhysics_KinematicVelocityBased,
|
|
} EPhysicsBodyType;
|
|
|
|
typedef struct Option_checkCastFn Option_checkCastFn;
|
|
|
|
typedef struct RapierCollider_t RapierCollider_t;
|
|
|
|
typedef struct RapierPhysicsBody_t RapierPhysicsBody_t;
|
|
|
|
typedef struct RapierPhysics_t RapierPhysics_t;
|
|
|
|
typedef struct RapierShape_t RapierShape_t;
|
|
|
|
typedef struct RapierWorld_t RapierWorld_t;
|
|
|
|
typedef struct Vector {
|
|
float x;
|
|
float y;
|
|
float z;
|
|
} Vector;
|
|
|
|
typedef struct Quat {
|
|
float x;
|
|
float y;
|
|
float z;
|
|
float w;
|
|
} Quat;
|
|
|
|
typedef struct CastResult_t {
|
|
bool m_bIsHit;
|
|
const struct RapierCollider_t *m_hCollider;
|
|
struct Vector m_vCollisionPoint;
|
|
float m_fTime;
|
|
float m_fDistance;
|
|
struct Vector m_vNormal;
|
|
} CastResult_t;
|
|
|
|
typedef struct BallShape_t {
|
|
float m_fRadius;
|
|
} BallShape_t;
|
|
|
|
typedef struct CuboidShape_t {
|
|
float m_fExtentX;
|
|
float m_fExtentY;
|
|
float m_fExtentZ;
|
|
} CuboidShape_t;
|
|
|
|
typedef struct TriangleMeshShape_t {
|
|
const float *m_pfPositions;
|
|
uint32_t m_nPositionCount;
|
|
const float *m_puIndicies;
|
|
uint32_t m_nIndiciesCount;
|
|
} TriangleMeshShape_t;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif // __cplusplus
|
|
|
|
struct Vector CRapierPhysicsBody_GetPosition(struct RapierPhysicsBody_t *this_);
|
|
|
|
struct Quat CRapierPhysicsBody_GetRotation(struct RapierPhysicsBody_t *this_);
|
|
|
|
void CRapierPhysicsBody_SetPosition(struct RapierPhysicsBody_t *this_,
|
|
float fX,
|
|
float fY,
|
|
float fZ);
|
|
|
|
void CRapierPhysicsBody_SetRotation(struct RapierPhysicsBody_t *this_,
|
|
float fX,
|
|
float fY,
|
|
float fZ,
|
|
float fW);
|
|
|
|
void CRapierPhysicsBody_SetType(struct RapierPhysicsBody_t *this_, enum EPhysicsBodyType eType);
|
|
|
|
struct RapierPhysicsBody_t *CRapierPhysicsWorld_CreateRigidBody(struct RapierWorld_t *this_,
|
|
struct RapierCollider_t *pCollider,
|
|
enum EPhysicsBodyType eType);
|
|
|
|
void CRapierPhysicsWorld_Frame(struct RapierWorld_t *this_, float fDelta);
|
|
|
|
struct CastResult_t CRapierPhysicsWorld_RayCast(struct RapierWorld_t *this_,
|
|
struct Vector vBegin,
|
|
struct Vector vEnd,
|
|
struct Option_checkCastFn checkCast);
|
|
|
|
struct CastResult_t CRapierPhysicsWorld_ShapeCast(struct RapierWorld_t *this_,
|
|
struct RapierShape_t *pShape,
|
|
struct Quat vOrientation,
|
|
struct Vector vBegin,
|
|
struct Vector vEnd,
|
|
struct Option_checkCastFn checkCast);
|
|
|
|
struct RapierShape_t *CRapierPhysics_CreateBall(struct RapierPhysics_t *this_,
|
|
struct BallShape_t ball);
|
|
|
|
struct RapierCollider_t *CRapierPhysics_CreateCollider(struct RapierPhysics_t *this_,
|
|
struct RapierShape_t *pShape);
|
|
|
|
struct RapierShape_t *CRapierPhysics_CreateCube(struct RapierPhysics_t *this_,
|
|
struct CuboidShape_t cuboid);
|
|
|
|
struct RapierShape_t *CRapierPhysics_CreateTriangleMesh(struct RapierPhysics_t *this_,
|
|
struct TriangleMeshShape_t triangle);
|
|
|
|
struct RapierWorld_t *CRapierPhysics_CreateWorld(struct RapierPhysics_t *this_);
|
|
|
|
void CRapierPhysics_DestroyShape(struct RapierPhysics_t *this_, struct RapierShape_t *shape);
|
|
|
|
struct RapierPhysics_t *CRapierPhysics_New(void);
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif // __cplusplus
|
|
|
|
#endif /* RAPIER_H */
|