|
@@ -2,8 +2,13 @@
|
|
|
|
|
|
#include <stdint.h>
|
|
|
#include <stdbool.h>
|
|
|
+#include <stdalign.h>
|
|
|
|
|
|
-#define JPC_API extern __declspec(dllexport)
|
|
|
+#ifdef _MSC_VER
|
|
|
+ #define JPC_API extern __declspec(dllexport)
|
|
|
+#else
|
|
|
+ #define JPC_API
|
|
|
+#endif
|
|
|
|
|
|
// C-compatible typedefs that match Jolt's internal primitive typedefs.
|
|
|
#define uint unsigned int
|
|
@@ -18,6 +23,61 @@ JPC_API void JPC_FactoryDelete();
|
|
|
JPC_API void JPC_RegisterTypes();
|
|
|
JPC_API void JPC_UnregisterTypes();
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////////////////
|
|
|
+// Primitive types
|
|
|
+
|
|
|
+typedef struct JPC_Vec3 {
|
|
|
+ alignas(16) float x;
|
|
|
+ float y;
|
|
|
+ float z;
|
|
|
+ float _w;
|
|
|
+} JPC_Vec3;
|
|
|
+
|
|
|
+ENSURE_SIZE_ALIGN(JPC_Vec3, JPH::Vec3);
|
|
|
+
|
|
|
+typedef struct JPC_DVec3 {
|
|
|
+ alignas(32) double x;
|
|
|
+ double y;
|
|
|
+ double z;
|
|
|
+ double _w;
|
|
|
+} JPC_DVec3;
|
|
|
+
|
|
|
+ENSURE_SIZE_ALIGN(JPC_DVec3, JPH::DVec3);
|
|
|
+
|
|
|
+typedef struct JPC_Quat {
|
|
|
+ alignas(16) float x;
|
|
|
+ float y;
|
|
|
+ float z;
|
|
|
+ float w;
|
|
|
+} JPC_Quat;
|
|
|
+
|
|
|
+ENSURE_SIZE_ALIGN(JPC_Quat, JPH::Quat);
|
|
|
+
|
|
|
+#ifdef JPC_DOUBLE_PRECISION
|
|
|
+ typedef JPC_DVec3 JPC_RVec3;
|
|
|
+#else
|
|
|
+ typedef JPC_Vec3 JPC_RVec3;
|
|
|
+#endif
|
|
|
+
|
|
|
+ENSURE_SIZE_ALIGN(JPC_RVec3, JPH::RVec3);
|
|
|
+
|
|
|
+typedef uint8_t JPC_BroadPhaseLayer;
|
|
|
+ENSURE_SIZE_ALIGN(JPC_BroadPhaseLayer, JPH::BroadPhaseLayer)
|
|
|
+
|
|
|
+#ifndef JPC_OBJECT_LAYER_BITS
|
|
|
+ #define JPC_OBJECT_LAYER_BITS 16
|
|
|
+#endif
|
|
|
+
|
|
|
+#if JPC_OBJECT_LAYER_BITS == 16
|
|
|
+ typedef uint16_t JPC_ObjectLayer;
|
|
|
+#elif JPC_OBJECT_LAYER_BITS == 32
|
|
|
+ typedef uint32_t JPC_ObjectLayer;
|
|
|
+#else
|
|
|
+ #error "JPC_OBJECT_LAYER_BITS must be 16 or 32"
|
|
|
+#endif
|
|
|
+
|
|
|
+ENSURE_SIZE_ALIGN(JPC_ObjectLayer, JPH::ObjectLayer)
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
// TempAllocatorImpl
|
|
|
|
|
@@ -44,12 +104,6 @@ JPC_API void JPC_JobSystemThreadPool_delete(JPC_JobSystemThreadPool* object);
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
// BroadPhaseLayerInterface
|
|
|
|
|
|
-typedef uint8_t JPC_BroadPhaseLayer;
|
|
|
-ENSURE_SIZE_ALIGN(JPC_BroadPhaseLayer, JPH::BroadPhaseLayer)
|
|
|
-
|
|
|
-typedef uint16_t JPC_ObjectLayer; // FIXME: Branch on JPH_OBJECT_LAYER_BITS?
|
|
|
-ENSURE_SIZE_ALIGN(JPC_ObjectLayer, JPH::ObjectLayer)
|
|
|
-
|
|
|
typedef struct JPC_BroadPhaseLayerInterfaceFns {
|
|
|
uint (*GetNumBroadPhaseLayers)(const void *self);
|
|
|
JPC_BroadPhaseLayer (*GetBroadPhaseLayer)(const void *self, JPC_ObjectLayer inLayer);
|