Explorar o código

Bring API up to Jolt v4.0.1, compiler errors persist

Lucien Greathouse hai 1 ano
pai
achega
b1156a5b75
Modificáronse 4 ficheiros con 31 adicións e 9 borrados
  1. 3 1
      CMakeLists.txt
  2. 5 5
      JoltC/JoltPhysicsC.cpp
  3. 22 2
      JoltC/JoltPhysicsC.h
  4. 1 1
      JoltPhysics

+ 3 - 1
CMakeLists.txt

@@ -13,4 +13,6 @@ add_library(joltc STATIC
 
 target_compile_features(joltc PUBLIC cxx_std_17)
 target_include_directories(joltc PUBLIC JoltPhysics)
-target_link_libraries(joltc PUBLIC JoltPhysics)
+target_link_libraries(joltc PUBLIC JoltPhysics)
+
+add_subdirectory(JoltPhysics/Build)

+ 5 - 5
JoltC/JoltPhysicsC.cpp

@@ -1000,9 +1000,9 @@ JPC_PhysicsSystem_GetNumBodies(const JPC_PhysicsSystem *in_physics_system)
 }
 //--------------------------------------------------------------------------------------------------
 JPC_API uint32_t
-JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system)
+JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system, JPC_BodyType body_type)
 {
-    return toJph(in_physics_system)->GetNumActiveBodies();
+    return toJph(in_physics_system)->GetNumActiveBodies(static_cast<JPH::EBodyType>(body_type));
 }
 //--------------------------------------------------------------------------------------------------
 JPC_API uint32_t
@@ -1072,7 +1072,6 @@ JPC_API JPC_PhysicsUpdateError
 JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system,
                          float in_delta_time,
                          int in_collision_steps,
-                         int in_integration_sub_steps,
                          JPC_TempAllocator *in_temp_allocator,
                          JPC_JobSystem *in_job_system)
 {
@@ -1080,7 +1079,6 @@ JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system,
     JPC_PhysicsUpdateError error = (JPC_PhysicsUpdateError)toJph(in_physics_system)->Update(
         in_delta_time,
         in_collision_steps,
-        in_integration_sub_steps,
         reinterpret_cast<JPH::TempAllocator *>(in_temp_allocator),
         reinterpret_cast<JPH::JobSystem *>(in_job_system));
     return error;
@@ -2710,9 +2708,11 @@ JPC_MotionProperties_SetGravityFactor(JPC_MotionProperties *in_properties,
 //--------------------------------------------------------------------------------------------------
 JPC_API void
 JPC_MotionProperties_SetMassProperties(JPC_MotionProperties *in_properties,
+                                       JPC_EAllowedDOFs allowed_dofs,
                                        const JPC_MassProperties *in_mass_properties)
 {
-    toJph(in_properties)->SetMassProperties(*toJph(in_mass_properties));
+    toJph(in_properties)->SetMassProperties(static_cast<JPH::EAllowedDOFs>(allowed_dofs),
+                                            *toJph(in_mass_properties));
 }
 //--------------------------------------------------------------------------------------------------
 JPC_API float

+ 22 - 2
JoltC/JoltPhysicsC.h

@@ -214,6 +214,26 @@ typedef enum JPC_EBackFaceMode
     JPC_BACK_FACE_COLLIDE = 1
 } JPC_EBackFaceMode;
 
+typedef uint8_t JPC_BodyType;
+typedef enum JPC_EBodyType
+{
+    JPC_BODY_TYPE_RIGID_BODY = 0,
+    JPC_BODY_TYPE_SOFT_BODY  = 1,
+} JPC_EBodyType;
+
+typedef uint8_t JPC_AllowedDOFs;
+typedef enum JPC_EAllowedDOFs {
+    JPC_ALLOWED_DOFS_NONE         = 0b000000,
+    JPC_ALLOWED_DOFS_ALL          = 0b111111,
+    JPC_ALLOWED_DOFS_TRANSLATIONX = 0b000001,
+    JPC_ALLOWED_DOFS_TRANSLATIONY = 0b000010,
+    JPC_ALLOWED_DOFS_TRANSLATIONZ = 0b000100,
+    JPC_ALLOWED_DOFS_ROTATIONX    = 0b001000,
+    JPC_ALLOWED_DOFS_ROTATIONY    = 0b010000,
+    JPC_ALLOWED_DOFS_ROTATIONZ    = 0b100000,
+    JPC_ALLOWED_DOFS_PLANE2D      = JPC_ALLOWED_DOFS_TRANSLATIONX | JPC_ALLOWED_DOFS_TRANSLATIONY | JPC_ALLOWED_DOFS_TRANSLATIONZ,
+} JPC_EAllowedDOFs;
+
 typedef uint32_t JPC_Features;
 typedef enum JPC_EFeatures {
     JPC_FEATURE_DOUBLE_PRECISION = (1 << 0),
@@ -1043,6 +1063,7 @@ JPC_MotionProperties_SetGravityFactor(JPC_MotionProperties *in_properties,
                                       float in_gravity_factor);
 JPC_API void
 JPC_MotionProperties_SetMassProperties(JPC_MotionProperties *in_properties,
+                                       JPC_EAllowedDOFs allowed_dofs,
                                        const JPC_MassProperties *in_mass_properties);
 JPC_API float
 JPC_MotionProperties_GetInverseMass(const JPC_MotionProperties *in_properties);
@@ -1140,7 +1161,7 @@ JPC_API uint32_t
 JPC_PhysicsSystem_GetNumBodies(const JPC_PhysicsSystem *in_physics_system);
 
 JPC_API uint32_t
-JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system);
+JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system, JPC_BodyType body_type);
 
 JPC_API uint32_t
 JPC_PhysicsSystem_GetMaxBodies(const JPC_PhysicsSystem *in_physics_system);
@@ -1176,7 +1197,6 @@ JPC_API JPC_PhysicsUpdateError
 JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system,
                          float in_delta_time,
                          int in_collision_steps,
-                         int in_integration_sub_steps,
                          JPC_TempAllocator *in_temp_allocator,
                          JPC_JobSystem *in_job_system);
 

+ 1 - 1
JoltPhysics

@@ -1 +1 @@
-Subproject commit f2d1175432f8225450dea252322ba2dbaa83a370
+Subproject commit f5ab4fd526fe1e03a408a5ead3ee396263d8a1d3