Files
funnygame/rapier/physics.h
2026-03-05 00:30:27 +02:00

89 lines
2.5 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 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 BallShape_t {
float m_fRadius;
} BallShape_t;
typedef struct CuboidShape_t {
float m_fExtentX;
float m_fExtentY;
float m_fExtentZ;
} CuboidShape_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);
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 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 RapierWorld_t *CRapierPhysics_CreateWorld(struct RapierPhysics_t *this_);
struct RapierPhysics_t *CRapierPhysics_New(void);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif /* RAPIER_H */