diff --git a/JoltC/Functions.h b/JoltC/Functions.h index 500106d..2090ac0 100644 --- a/JoltC/Functions.h +++ b/JoltC/Functions.h @@ -1159,6 +1159,23 @@ typedef struct JPC_CylinderShapeSettings { JPC_API void JPC_CylinderShapeSettings_default(JPC_CylinderShapeSettings* object); JPC_API bool JPC_CylinderShapeSettings_Create(const JPC_CylinderShapeSettings* self, JPC_Shape** outShape, JPC_String** outError); +//////////////////////////////////////////////////////////////////////////////// +// PlaneShapeSettings -> ShapeSettings + +typedef struct JPC_PlaneShapeSettings { + // ShapeSettings + uint64_t UserData; + + // PlaneShapeSettings + // TODO: Material + JPC_Vec3 Normal; + float Constant; + float HalfExtent; +} JPC_PlaneShapeSettings; + +JPC_API void JPC_PlaneShapeSettings_default(JPC_PlaneShapeSettings* object); +JPC_API bool JPC_PlaneShapeSettings_Create(const JPC_PlaneShapeSettings* self, JPC_Shape** outShape, JPC_String** outError); + //////////////////////////////////////////////////////////////////////////////// // ConvexHullShapeSettings -> ConvexShapeSettings -> ShapeSettings diff --git a/JoltCImpl/JoltC.cpp b/JoltCImpl/JoltC.cpp index e5be33a..025bcc5 100644 --- a/JoltCImpl/JoltC.cpp +++ b/JoltCImpl/JoltC.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1907,6 +1908,33 @@ JPC_API bool JPC_CylinderShapeSettings_Create(const JPC_CylinderShapeSettings* s return HandleShapeResult(settings.Create(), outShape, outError); } +//////////////////////////////////////////////////////////////////////////////// +// PlaneShapeSettings + +static void to_jph(const JPC_PlaneShapeSettings* input, JPH::PlaneShapeSettings* output) { + output->mUserData = input->UserData; + + // TODO: Material + output->mPlane = JPH::Plane(to_jph(input->Normal), input->Constant); + output->mHalfExtent = input->HalfExtent; +} + +JPC_API void JPC_PlaneShapeSettings_default(JPC_PlaneShapeSettings* object) { + object->UserData = 0; + + // TODO: Material + object->Normal = JPC_Vec3{0, 1, 0, 1}; + object->Constant = 0.0; + object->HalfExtent = JPH::PlaneShapeSettings::cDefaultHalfExtent; +} + +JPC_API bool JPC_PlaneShapeSettings_Create(const JPC_PlaneShapeSettings* self, JPC_Shape** outShape, JPC_String** outError) { + JPH::PlaneShapeSettings settings; + to_jph(self, &settings); + + return HandleShapeResult(settings.Create(), outShape, outError); +} + //////////////////////////////////////////////////////////////////////////////// // ConvexHullShapeSettings