Răsfoiți Sursa

TriangleShapeSettings

Lucien Greathouse 1 an în urmă
părinte
comite
4d5dfc3168
2 a modificat fișierele cu 32 adăugiri și 7 ștergeri
  1. 8 0
      JoltC/Functions.h
  2. 24 7
      JoltC/JoltC.cpp

+ 8 - 0
JoltC/Functions.h

@@ -305,6 +305,14 @@ typedef struct JPC_ConvexShapeSettings JPC_ConvexShapeSettings;
 JPC_API float JPC_ConvexShapeSettings_GetDensity(JPC_ConvexShapeSettings* self);
 JPC_API void JPC_ConvexShapeSettings_SetDensity(JPC_ConvexShapeSettings* self, float inDensity);
 
+////////////////////////////////////////////////////////////////////////////////
+// TriangleShapeSettings
+
+typedef struct JPC_TriangleShapeSettings JPC_TriangleShapeSettings;
+
+JPC_API JPC_TriangleShapeSettings* JPC_TriangleShapeSettings_new(JPC_Vec3 inV1, JPC_Vec3 inV2, JPC_Vec3 inV3);
+JPC_API void JPC_TriangleShapeSettings_delete(JPC_TriangleShapeSettings* object);
+
 ////////////////////////////////////////////////////////////////////////////////
 // BoxShapeSettings
 

+ 24 - 7
JoltC/JoltC.cpp

@@ -1,17 +1,18 @@
 #include <Jolt/Jolt.h>
 
-#include <Jolt/RegisterTypes.h>
 #include <Jolt/Core/Factory.h>
-#include <Jolt/Core/TempAllocator.h>
 #include <Jolt/Core/JobSystemThreadPool.h>
-#include <Jolt/Physics/PhysicsSettings.h>
-#include <Jolt/Physics/PhysicsSystem.h>
+#include <Jolt/Core/TempAllocator.h>
+#include <Jolt/Physics/Body/BodyActivationListener.h>
+#include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Jolt/Physics/Collision/Shape/BoxShape.h>
-#include <Jolt/Physics/Collision/Shape/SphereShape.h>
 #include <Jolt/Physics/Collision/Shape/CapsuleShape.h>
 #include <Jolt/Physics/Collision/Shape/CylinderShape.h>
-#include <Jolt/Physics/Body/BodyCreationSettings.h>
-#include <Jolt/Physics/Body/BodyActivationListener.h>
+#include <Jolt/Physics/Collision/Shape/SphereShape.h>
+#include <Jolt/Physics/Collision/Shape/TriangleShape.h>
+#include <Jolt/Physics/PhysicsSettings.h>
+#include <Jolt/Physics/PhysicsSystem.h>
+#include <Jolt/RegisterTypes.h>
 
 #include <Jolt/Renderer/DebugRendererSimple.h>
 
@@ -98,6 +99,9 @@ DESTRUCTOR(JPC_IndexedTriangleList)
 OPAQUE_WRAPPER(JPC_String, JPH::String)
 DESTRUCTOR(JPC_String)
 
+OPAQUE_WRAPPER(JPC_TriangleShapeSettings, JPH::TriangleShapeSettings)
+DESTRUCTOR(JPC_TriangleShapeSettings)
+
 OPAQUE_WRAPPER(JPC_BoxShapeSettings, JPH::BoxShapeSettings)
 DESTRUCTOR(JPC_BoxShapeSettings)
 
@@ -410,6 +414,19 @@ JPC_API void JPC_ConvexShapeSettings_SetDensity(JPC_ConvexShapeSettings* self, f
 	to_jph(self)->SetDensity(inDensity);
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// TriangleShapeSettings
+
+JPC_API JPC_TriangleShapeSettings* JPC_TriangleShapeSettings_new(JPC_Vec3 inV1, JPC_Vec3 inV2, JPC_Vec3 inV3) {
+	auto settings = new JPH::TriangleShapeSettings{
+		to_jph(inV1),
+		to_jph(inV2),
+		to_jph(inV3),
+	};
+
+	return to_jpc(settings);
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // BoxShapeSettings