Home | History | Annotate | Download | only in bullet-native
      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_RotationalLimitMotor.h"
     37 #include "jmeBulletUtil.h"
     38 
     39 #ifdef __cplusplus
     40 extern "C" {
     41 #endif
     42 
     43     /*
     44      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
     45      * Method:    getLoLimit
     46      * Signature: (J)F
     47      */
     48     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLoLimit
     49     (JNIEnv *env, jobject object, jlong motorId) {
     50         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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 0;
     55         }
     56         return motor->m_loLimit;
     57     }
     58 
     59     /*
     60      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
     61      * Method:    setLoLimit
     62      * Signature: (JF)V
     63      */
     64     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLoLimit
     65     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
     66         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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         motor->m_loLimit = value;
     73     }
     74 
     75     /*
     76      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
     77      * Method:    getHiLimit
     78      * Signature: (J)F
     79      */
     80     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getHiLimit
     81     (JNIEnv *env, jobject object, jlong motorId) {
     82         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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 0;
     87         }
     88         return motor->m_hiLimit;
     89     }
     90 
     91     /*
     92      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
     93      * Method:    setHiLimit
     94      * Signature: (JF)V
     95      */
     96     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setHiLimit
     97     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
     98         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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         motor->m_hiLimit = value;
    105     }
    106 
    107     /*
    108      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    109      * Method:    getTargetVelocity
    110      * Signature: (J)F
    111      */
    112     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getTargetVelocity
    113     (JNIEnv *env, jobject object, jlong motorId) {
    114         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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 0;
    119         }
    120         return motor->m_targetVelocity;
    121     }
    122 
    123     /*
    124      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    125      * Method:    setTargetVelocity
    126      * Signature: (JF)V
    127      */
    128     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setTargetVelocity
    129     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    130         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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         motor->m_targetVelocity = value;
    137     }
    138 
    139     /*
    140      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    141      * Method:    getMaxMotorForce
    142      * Signature: (J)F
    143      */
    144     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxMotorForce
    145     (JNIEnv *env, jobject object, jlong motorId) {
    146         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_maxMotorForce;
    153     }
    154 
    155     /*
    156      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    157      * Method:    setMaxMotorForce
    158      * Signature: (JF)V
    159      */
    160     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxMotorForce
    161     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    162         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_maxMotorForce = value;
    169     }
    170 
    171     /*
    172      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    173      * Method:    getMaxLimitForce
    174      * Signature: (J)F
    175      */
    176     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxLimitForce
    177     (JNIEnv *env, jobject object, jlong motorId) {
    178         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_maxLimitForce;
    185     }
    186 
    187     /*
    188      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    189      * Method:    setMaxLimitForce
    190      * Signature: (JF)V
    191      */
    192     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxLimitForce
    193     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    194         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_maxLimitForce = value;
    201     }
    202 
    203     /*
    204      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    205      * Method:    getDamping
    206      * Signature: (J)F
    207      */
    208     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getDamping
    209     (JNIEnv *env, jobject object, jlong motorId) {
    210         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_damping;
    217     }
    218 
    219     /*
    220      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    221      * Method:    setDamping
    222      * Signature: (JF)V
    223      */
    224     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setDamping
    225     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    226         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(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_damping = value;
    233     }
    234 
    235     /*
    236      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    237      * Method:    getLimitSoftness
    238      * Signature: (J)F
    239      */
    240     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLimitSoftness
    241     (JNIEnv *env, jobject object, jlong motorId) {
    242         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    243         if (motor == NULL) {
    244             jclass newExc = env->FindClass("java/lang/NullPointerException");
    245             env->ThrowNew(newExc, "The native object does not exist.");
    246             return 0;
    247         }
    248         return motor->m_limitSoftness;
    249     }
    250 
    251     /*
    252      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    253      * Method:    setLimitSoftness
    254      * Signature: (JF)V
    255      */
    256     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLimitSoftness
    257     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    258         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    259         if (motor == NULL) {
    260             jclass newExc = env->FindClass("java/lang/NullPointerException");
    261             env->ThrowNew(newExc, "The native object does not exist.");
    262             return;
    263         }
    264         motor->m_limitSoftness = value;
    265     }
    266 
    267     /*
    268      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    269      * Method:    getERP
    270      * Signature: (J)F
    271      */
    272     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getERP
    273     (JNIEnv *env, jobject object, jlong motorId) {
    274         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    275         if (motor == NULL) {
    276             jclass newExc = env->FindClass("java/lang/NullPointerException");
    277             env->ThrowNew(newExc, "The native object does not exist.");
    278             return 0;
    279         }
    280         return motor->m_stopERP;
    281     }
    282 
    283     /*
    284      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    285      * Method:    setERP
    286      * Signature: (JF)V
    287      */
    288     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setERP
    289     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    290         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    291         if (motor == NULL) {
    292             jclass newExc = env->FindClass("java/lang/NullPointerException");
    293             env->ThrowNew(newExc, "The native object does not exist.");
    294             return;
    295         }
    296         motor->m_stopERP = value;
    297     }
    298 
    299     /*
    300      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    301      * Method:    getBounce
    302      * Signature: (J)F
    303      */
    304     JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getBounce
    305     (JNIEnv *env, jobject object, jlong motorId) {
    306         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    307         if (motor == NULL) {
    308             jclass newExc = env->FindClass("java/lang/NullPointerException");
    309             env->ThrowNew(newExc, "The native object does not exist.");
    310             return 0;
    311         }
    312         return motor->m_bounce;
    313     }
    314 
    315     /*
    316      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    317      * Method:    setBounce
    318      * Signature: (JF)V
    319      */
    320     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setBounce
    321     (JNIEnv *env, jobject object, jlong motorId, jfloat value) {
    322         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    323         if (motor == NULL) {
    324             jclass newExc = env->FindClass("java/lang/NullPointerException");
    325             env->ThrowNew(newExc, "The native object does not exist.");
    326             return;
    327         }
    328         motor->m_bounce = value;
    329     }
    330 
    331     /*
    332      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    333      * Method:    isEnableMotor
    334      * Signature: (J)Z
    335      */
    336     JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_isEnableMotor
    337     (JNIEnv *env, jobject object, jlong motorId) {
    338         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    339         if (motor == NULL) {
    340             jclass newExc = env->FindClass("java/lang/NullPointerException");
    341             env->ThrowNew(newExc, "The native object does not exist.");
    342             return false;
    343         }
    344         return motor->m_enableMotor;
    345     }
    346 
    347     /*
    348      * Class:     com_jme3_bullet_joints_motors_RotationalLimitMotor
    349      * Method:    setEnableMotor
    350      * Signature: (JZ)V
    351      */
    352     JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setEnableMotor
    353     (JNIEnv *env, jobject object, jlong motorId, jboolean value) {
    354         btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId);
    355         if (motor == NULL) {
    356             jclass newExc = env->FindClass("java/lang/NullPointerException");
    357             env->ThrowNew(newExc, "The native object does not exist.");
    358             return;
    359         }
    360         motor->m_enableMotor = value;
    361     }
    362 
    363 #ifdef __cplusplus
    364 }
    365 #endif
    366