瀏覽代碼

Bind FixedConstraint API and fix constness of TwoBodyConstraint API

Lucien Greathouse 5 月之前
父節點
當前提交
3f1af74191
共有 2 個文件被更改,包括 29 次插入8 次删除
  1. 12 4
      JoltC/Functions.h
  2. 17 4
      JoltCImpl/JoltC.cpp

+ 12 - 4
JoltC/Functions.h

@@ -613,11 +613,19 @@ JPC_API void JPC_Constraint_NotifyShapeChanged(JPC_Constraint* self, JPC_BodyID
 
 typedef struct JPC_TwoBodyConstraint JPC_TwoBodyConstraint;
 
-JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody1(JPC_TwoBodyConstraint* self);
-JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody2(JPC_TwoBodyConstraint* self);
+JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody1(const JPC_TwoBodyConstraint* self);
+JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody2(const JPC_TwoBodyConstraint* self);
 
-JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(JPC_TwoBodyConstraint* self);
-JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(JPC_TwoBodyConstraint* self);
+JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(const JPC_TwoBodyConstraint* self);
+JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(const JPC_TwoBodyConstraint* self);
+
+////////////////////////////////////////////////////////////////////////////////
+// FixedConstraint -> TwoBodyConstraint -> Constraint -> RefTarget<Constraint>
+
+typedef struct JPC_FixedConstraint JPC_FixedContraint;
+
+JPC_API JPC_Vec3 JPC_FixedConstraint_GetTotalLambdaPosition(const JPC_FixedConstraint* self);
+JPC_API JPC_Vec3 JPC_FixedConstraint_GetTotalLambdaRotation(const JPC_FixedConstraint* self);
 
 ////////////////////////////////////////////////////////////////////////////////
 // ConstraintSettings

+ 17 - 4
JoltCImpl/JoltC.cpp

@@ -864,22 +864,35 @@ JPC_API void JPC_Constraint_NotifyShapeChanged(JPC_Constraint* self, JPC_BodyID
 
 OPAQUE_WRAPPER(JPC_TwoBodyConstraint, JPH::TwoBodyConstraint);
 
-JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody1(JPC_TwoBodyConstraint* self) {
+JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody1(const JPC_TwoBodyConstraint* self) {
 	return to_jpc(to_jph(self)->GetBody1());
 }
 
-JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody2(JPC_TwoBodyConstraint* self) {
+JPC_API JPC_Body* JPC_TwoBodyConstraint_GetBody2(const JPC_TwoBodyConstraint* self) {
 	return to_jpc(to_jph(self)->GetBody2());
 }
 
-JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(JPC_TwoBodyConstraint* self) {
+JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(const JPC_TwoBodyConstraint* self) {
 	return to_jpc(to_jph(self)->GetConstraintToBody1Matrix());
 }
 
-JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(JPC_TwoBodyConstraint* self) {
+JPC_API JPC_Mat44 JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(const JPC_TwoBodyConstraint* self) {
 	return to_jpc(to_jph(self)->GetConstraintToBody2Matrix());
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// FixedConstraint -> TwoBodyConstraint -> Constraint -> RefTarget<Constraint>
+
+OPAQUE_WRAPPER(JPC_FixedConstraint, JPH::FixedConstraint);
+
+JPC_API JPC_Vec3 JPC_FixedConstraint_GetTotalLambdaPosition(const JPC_FixedConstraint* self) {
+	return to_jpc(to_jph(self)->GetTotalLambdaPosition());
+}
+
+JPC_API JPC_Vec3 JPC_FixedConstraint_GetTotalLambdaRotation(const JPC_FixedConstraint* self) {
+	return to_jpc(to_jph(self)->GetTotalLambdaRotation());
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // ConstraintSettings