Pārlūkot izejas kodu

Raycast types, stub NarrowPhaseQuery

Lucien Greathouse 1 gadu atpakaļ
vecāks
revīzija
12d8bc8741
2 mainītis faili ar 31 papildinājumiem un 0 dzēšanām
  1. 17 0
      JoltC/Functions.h
  2. 14 0
      JoltC/JoltC.cpp

+ 17 - 0
JoltC/Functions.h

@@ -140,6 +140,16 @@ typedef struct JPC_IndexedTriangle {
 
 ENSURE_SIZE_ALIGN(JPC_IndexedTriangle, JPH::IndexedTriangle)
 
+typedef struct JPC_RayCast {
+	JPC_Vec3 Origin;
+	JPC_Vec3 Direction;
+} JPC_RayCast;
+
+typedef struct JPC_RRayCast {
+	JPC_RVec3 Origin;
+	JPC_Vec3 Direction;
+} JPC_RRayCast;
+
 ////////////////////////////////////////////////////////////////////////////////
 // VertexList == Array<Float3> == std::vector<Float3>
 
@@ -702,6 +712,11 @@ JPC_API void JPC_BodyInterface_SetUserData(const JPC_BodyInterface *self, JPC_Bo
 
 JPC_API void JPC_BodyInterface_InvalidateContactCache(JPC_BodyInterface *self, JPC_BodyID inBodyID);
 
+////////////////////////////////////////////////////////////////////////////////
+// NarrowPhaseQuery
+
+typedef struct JPC_NarrowPhaseQuery JPC_NarrowPhaseQuery;
+
 ////////////////////////////////////////////////////////////////////////////////
 // PhysicsSystem
 
@@ -730,6 +745,8 @@ JPC_API JPC_PhysicsUpdateError JPC_PhysicsSystem_Update(
 
 JPC_API JPC_BodyInterface* JPC_PhysicsSystem_GetBodyInterface(JPC_PhysicsSystem* self);
 
+JPC_API const JPC_NarrowPhaseQuery* JPC_PhysicsSystem_GetNarrowPhaseQuery(JPC_PhysicsSystem* self);
+
 JPC_API void JPC_PhysicsSystem_DrawBodies(
 	JPC_PhysicsSystem* self,
 	JPC_BodyManager_DrawSettings* inSettings,

+ 14 - 0
JoltC/JoltC.cpp

@@ -5,6 +5,7 @@
 #include <Jolt/Core/TempAllocator.h>
 #include <Jolt/Physics/Body/BodyActivationListener.h>
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
+#include <Jolt/Physics/Collision/RayCast.h>
 #include <Jolt/Physics/Collision/Shape/BoxShape.h>
 #include <Jolt/Physics/Collision/Shape/CapsuleShape.h>
 #include <Jolt/Physics/Collision/Shape/CompoundShape.h>
@@ -82,6 +83,7 @@ OPAQUE_WRAPPER(JPC_PhysicsSystem, JPH::PhysicsSystem)
 DESTRUCTOR(JPC_PhysicsSystem)
 
 OPAQUE_WRAPPER(JPC_BodyInterface, JPH::BodyInterface)
+OPAQUE_WRAPPER(JPC_NarrowPhaseQuery, JPH::NarrowPhaseQuery)
 
 OPAQUE_WRAPPER(JPC_TempAllocatorImpl, JPH::TempAllocatorImpl)
 DESTRUCTOR(JPC_TempAllocatorImpl)
@@ -156,6 +158,14 @@ static JPH::Color to_jph(JPC_Color in) {
 	return JPH::Color(in.r, in.g, in.b, in.a);
 }
 
+static JPH::RayCast to_jph(JPC_RayCast in) {
+	return JPH::RayCast(to_jph(in.Origin), to_jph(in.Direction));
+}
+
+static JPH::RRayCast to_jph(JPC_RRayCast in) {
+	return JPH::RRayCast(to_jph(in.Origin), to_jph(in.Direction));
+}
+
 // static JPC_BodyID to_jpc(JPH::BodyID in) {
 // 	return in.GetIndexAndSequenceNumber();
 // }
@@ -1352,6 +1362,10 @@ JPC_API JPC_BodyInterface* JPC_PhysicsSystem_GetBodyInterface(JPC_PhysicsSystem*
 	return to_jpc(&to_jph(self)->GetBodyInterface());
 }
 
+JPC_API const JPC_NarrowPhaseQuery* JPC_PhysicsSystem_GetNarrowPhaseQuery(JPC_PhysicsSystem* self) {
+	return to_jpc(&to_jph(self)->GetNarrowPhaseQuery());
+}
+
 JPC_API JPC_PhysicsUpdateError JPC_PhysicsSystem_Update(
 	JPC_PhysicsSystem* self,
 	float inDeltaTime,