1 
2 /**
3  * Author: Normen Hansen
4  */
5 #include "com_jme3_bullet_joints_SixDofSpringJoint.h"
6 #include "jmeBulletUtil.h"
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /*
13  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
14  * Method:    enableString
15  * Signature: (JIZ)V
16  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_enableSpring(JNIEnv * env,jobject object,jlong jointId,jint index,jboolean onOff)17 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_enableSpring
18   (JNIEnv *env, jobject object, jlong jointId, jint index, jboolean onOff) {
19     btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId);
20     joint -> enableSpring(index, onOff);
21 }
22 
23 
24 /*
25  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
26  * Method:    setStiffness
27  * Signature: (JIF)V
28  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_setStiffness(JNIEnv * env,jobject object,jlong jointId,jint index,jfloat stiffness)29 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setStiffness
30   (JNIEnv *env, jobject object, jlong jointId, jint index, jfloat stiffness) {
31     btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId);
32     joint -> setStiffness(index, stiffness);
33 }
34 
35 /*
36  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
37  * Method:    setDamping
38  * Signature: (JIF)V
39  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_setDamping(JNIEnv * env,jobject object,jlong jointId,jint index,jfloat damping)40 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setDamping
41   (JNIEnv *env, jobject object, jlong jointId, jint index, jfloat damping) {
42     btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId);
43     joint -> setDamping(index, damping);
44 }
45 
46 /*
47  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
48  * Method:    setEquilibriumPoint
49  * Signature: (JIF)V
50  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__J(JNIEnv * env,jobject object,jlong jointId)51 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__J
52   (JNIEnv *env, jobject object, jlong jointId) {
53     btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId);
54     joint -> setEquilibriumPoint();
55 }
56 
57 /*
58  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
59  * Method:    setEquilibriumPoint
60  * Signature: (JI)V
61  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__JI(JNIEnv * env,jobject object,jlong jointId,jint index)62 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__JI
63   (JNIEnv *env, jobject object, jlong jointId, jint index) {
64     btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId);
65     joint -> setEquilibriumPoint(index);
66 }
67 
68 
69 
70 
71 /*
72  * Class:     com_jme3_bullet_joints_SixDofSpringJoint
73  * Method:    createJoint
74  * Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J
75  */
Java_com_jme3_bullet_joints_SixDofSpringJoint_createJoint(JNIEnv * env,jobject object,jlong bodyIdA,jlong bodyIdB,jobject pivotA,jobject rotA,jobject pivotB,jobject rotB,jboolean useLinearReferenceFrameA)76 JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_createJoint
77     (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) {
78         jmeClasses::initJavaClasses(env);
79         btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA);
80         btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB);
81         btTransform transA;
82         jmeBulletUtil::convert(env, pivotA, &transA.getOrigin());
83         jmeBulletUtil::convert(env, rotA, &transA.getBasis());
84         btTransform transB;
85         jmeBulletUtil::convert(env, pivotB, &transB.getOrigin());
86         jmeBulletUtil::convert(env, rotB, &transB.getBasis());
87 
88         btGeneric6DofSpringConstraint* joint = new btGeneric6DofSpringConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA);
89         return reinterpret_cast<jlong>(joint);
90     }
91 
92 #ifdef __cplusplus
93 }
94 #endif
95