1 /* 2 * Copyright (c) 2009-2010 jMonkeyEngine 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the name of 'jMonkeyEngine' nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 /** 34 * Author: Normen Hansen 35 */ 36 #include "com_jme3_bullet_joints_motors_TranslationalLimitMotor.h" 37 #include "jmeBulletUtil.h" 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /* 44 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 45 * Method: getLowerLimit 46 * Signature: (JLcom/jme3/math/Vector3f;)V 47 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLowerLimit(JNIEnv * env,jobject object,jlong motorId,jobject vector)48 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLowerLimit 49 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 50 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 51 if (motor == NULL) { 52 jclass newExc = env->FindClass("java/lang/NullPointerException"); 53 env->ThrowNew(newExc, "The native object does not exist."); 54 return; 55 } 56 jmeBulletUtil::convert(env, &motor->m_lowerLimit, vector); 57 } 58 59 /* 60 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 61 * Method: setLowerLimit 62 * Signature: (JLcom/jme3/math/Vector3f;)V 63 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLowerLimit(JNIEnv * env,jobject object,jlong motorId,jobject vector)64 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLowerLimit 65 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 66 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 67 if (motor == NULL) { 68 jclass newExc = env->FindClass("java/lang/NullPointerException"); 69 env->ThrowNew(newExc, "The native object does not exist."); 70 return; 71 } 72 jmeBulletUtil::convert(env, vector, &motor->m_lowerLimit); 73 } 74 75 /* 76 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 77 * Method: getUpperLimit 78 * Signature: (JLcom/jme3/math/Vector3f;)V 79 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getUpperLimit(JNIEnv * env,jobject object,jlong motorId,jobject vector)80 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getUpperLimit 81 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 82 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 83 if (motor == NULL) { 84 jclass newExc = env->FindClass("java/lang/NullPointerException"); 85 env->ThrowNew(newExc, "The native object does not exist."); 86 return; 87 } 88 jmeBulletUtil::convert(env, &motor->m_upperLimit, vector); 89 } 90 91 /* 92 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 93 * Method: setUpperLimit 94 * Signature: (JLcom/jme3/math/Vector3f;)V 95 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setUpperLimit(JNIEnv * env,jobject object,jlong motorId,jobject vector)96 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setUpperLimit 97 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 98 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 99 if (motor == NULL) { 100 jclass newExc = env->FindClass("java/lang/NullPointerException"); 101 env->ThrowNew(newExc, "The native object does not exist."); 102 return; 103 } 104 jmeBulletUtil::convert(env, vector, &motor->m_upperLimit); 105 } 106 107 /* 108 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 109 * Method: getAccumulatedImpulse 110 * Signature: (JLcom/jme3/math/Vector3f;)V 111 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getAccumulatedImpulse(JNIEnv * env,jobject object,jlong motorId,jobject vector)112 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getAccumulatedImpulse 113 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 114 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 115 if (motor == NULL) { 116 jclass newExc = env->FindClass("java/lang/NullPointerException"); 117 env->ThrowNew(newExc, "The native object does not exist."); 118 return; 119 } 120 jmeBulletUtil::convert(env, &motor->m_accumulatedImpulse, vector); 121 } 122 123 /* 124 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 125 * Method: setAccumulatedImpulse 126 * Signature: (JLcom/jme3/math/Vector3f;)V 127 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setAccumulatedImpulse(JNIEnv * env,jobject object,jlong motorId,jobject vector)128 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setAccumulatedImpulse 129 (JNIEnv *env, jobject object, jlong motorId, jobject vector) { 130 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 131 if (motor == NULL) { 132 jclass newExc = env->FindClass("java/lang/NullPointerException"); 133 env->ThrowNew(newExc, "The native object does not exist."); 134 return; 135 } 136 jmeBulletUtil::convert(env, vector, &motor->m_accumulatedImpulse); 137 } 138 139 /* 140 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 141 * Method: getLimitSoftness 142 * Signature: (J)F 143 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLetLimitSoftness(JNIEnv * env,jobject object,jlong motorId)144 JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLetLimitSoftness 145 (JNIEnv *env, jobject object, jlong motorId) { 146 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 147 if (motor == NULL) { 148 jclass newExc = env->FindClass("java/lang/NullPointerException"); 149 env->ThrowNew(newExc, "The native object does not exist."); 150 return 0; 151 } 152 return motor->m_limitSoftness; 153 } 154 155 /* 156 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 157 * Method: setLimitSoftness 158 * Signature: (JF)V 159 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLimitSoftness(JNIEnv * env,jobject object,jlong motorId,jfloat value)160 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLimitSoftness 161 (JNIEnv *env, jobject object, jlong motorId, jfloat value) { 162 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 163 if (motor == NULL) { 164 jclass newExc = env->FindClass("java/lang/NullPointerException"); 165 env->ThrowNew(newExc, "The native object does not exist."); 166 return; 167 } 168 motor->m_limitSoftness = value; 169 } 170 171 /* 172 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 173 * Method: getDamping 174 * Signature: (J)F 175 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getDamping(JNIEnv * env,jobject object,jlong motorId)176 JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getDamping 177 (JNIEnv *env, jobject object, jlong motorId) { 178 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 179 if (motor == NULL) { 180 jclass newExc = env->FindClass("java/lang/NullPointerException"); 181 env->ThrowNew(newExc, "The native object does not exist."); 182 return 0; 183 } 184 return motor->m_damping; 185 } 186 187 /* 188 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 189 * Method: setDamping 190 * Signature: (JF)V 191 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setDamping(JNIEnv * env,jobject object,jlong motorId,jfloat value)192 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setDamping 193 (JNIEnv *env, jobject object, jlong motorId, jfloat value) { 194 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 195 if (motor == NULL) { 196 jclass newExc = env->FindClass("java/lang/NullPointerException"); 197 env->ThrowNew(newExc, "The native object does not exist."); 198 return; 199 } 200 motor->m_damping = value; 201 } 202 203 /* 204 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 205 * Method: getRestitution 206 * Signature: (J)F 207 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getRestitution(JNIEnv * env,jobject object,jlong motorId)208 JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getRestitution 209 (JNIEnv *env, jobject object, jlong motorId) { 210 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 211 if (motor == NULL) { 212 jclass newExc = env->FindClass("java/lang/NullPointerException"); 213 env->ThrowNew(newExc, "The native object does not exist."); 214 return 0; 215 } 216 return motor->m_restitution; 217 } 218 219 /* 220 * Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor 221 * Method: setRestitution 222 * Signature: (JF)V 223 */ Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setRestitution(JNIEnv * env,jobject object,jlong motorId,jfloat value)224 JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setRestitution 225 (JNIEnv *env, jobject object, jlong motorId, jfloat value) { 226 btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); 227 if (motor == NULL) { 228 jclass newExc = env->FindClass("java/lang/NullPointerException"); 229 env->ThrowNew(newExc, "The native object does not exist."); 230 return; 231 } 232 motor->m_restitution = value; 233 } 234 235 #ifdef __cplusplus 236 } 237 #endif 238