浏览代码

Expose RefTarget interface for Constraint as well

Lucien Greathouse 5 月之前
父节点
当前提交
d994291a3c
共有 2 个文件被更改,包括 25 次插入5 次删除
  1. 7 3
      JoltC/Functions.h
  2. 18 2
      JoltCImpl/JoltC.cpp

+ 7 - 3
JoltC/Functions.h

@@ -197,7 +197,7 @@ JPC_API JPC_IndexedTriangleList* JPC_IndexedTriangleList_new(const JPC_IndexedTr
 JPC_API void JPC_IndexedTriangleList_delete(JPC_IndexedTriangleList* object);
 
 ////////////////////////////////////////////////////////////////////////////////
-// Shape -> RefTarget
+// Shape -> RefTarget<Shape>
 
 typedef struct JPC_Shape JPC_Shape;
 
@@ -214,7 +214,7 @@ JPC_API JPC_ShapeSubType JPC_Shape_GetSubType(const JPC_Shape* self);
 JPC_API JPC_Vec3 JPC_Shape_GetCenterOfMass(const JPC_Shape* self);
 
 ////////////////////////////////////////////////////////////////////////////////
-// CompoundShape -> Shape -> RefTarget
+// CompoundShape -> Shape -> RefTarget<Shape>
 
 typedef struct JPC_CompoundShape JPC_CompoundShape;
 
@@ -555,10 +555,14 @@ JPC_API void JPC_String_delete(JPC_String* self);
 JPC_API const char* JPC_String_c_str(JPC_String* self);
 
 ////////////////////////////////////////////////////////////////////////////////
-// Constraint
+// Constraint -> RefTarget<Constraint>
 
 typedef struct JPC_Constraint JPC_Constraint;
 
+JPC_API uint32_t JPC_Shape_GetRefCount(const JPC_Shape* self);
+JPC_API void JPC_Shape_AddRef(const JPC_Shape* self);
+JPC_API void JPC_Shape_Release(const JPC_Shape* self);
+
 JPC_API void JPC_Constraint_delete(JPC_Constraint* self);
 
 ////////////////////////////////////////////////////////////////////////////////

+ 18 - 2
JoltCImpl/JoltC.cpp

@@ -739,10 +739,24 @@ JPC_API const char* JPC_String_c_str(JPC_String* self) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// Constraint
+// Constraint -> RefTarget<Constraint>
 
 OPAQUE_WRAPPER(JPC_Constraint, JPH::Constraint);
 
+// RefTarget<Constraint>
+JPC_API uint32_t JPC_Constraint_GetRefCount(const JPC_Constraint* self) {
+	return to_jph(self)->GetRefCount();
+}
+
+JPC_API void JPC_Constraint_AddRef(const JPC_Constraint* self) {
+	to_jph(self)->AddRef();
+}
+
+JPC_API void JPC_Constraint_Release(const JPC_Constraint* self) {
+	to_jph(self)->Release();
+}
+
+// Constraint
 JPC_API void JPC_Constraint_delete(JPC_Constraint* self) {
 	delete to_jph(self);
 }
@@ -831,8 +845,9 @@ JPC_API JPC_Constraint* JPC_FixedConstraintSettings_Create(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// Shape
+// Shape -> RefTarget<Shape>
 
+// RefTarget<Shape>
 JPC_API uint32_t JPC_Shape_GetRefCount(const JPC_Shape* self) {
 	return to_jph(self)->GetRefCount();
 }
@@ -845,6 +860,7 @@ JPC_API void JPC_Shape_Release(const JPC_Shape* self) {
 	to_jph(self)->Release();
 }
 
+// Shape
 JPC_API uint64_t JPC_Shape_GetUserData(const JPC_Shape* self) {
 	return to_jph(self)->GetUserData();
 }