com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. * Author: Normen Hansen
  34. */
  35. #include "com_jme3_bullet_collision_shapes_SimplexCollisionShape.h"
  36. #include "jmeBulletUtil.h"
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /*
  41. * Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape
  42. * Method: createShape
  43. * Signature: (Lcom/jme3/math/Vector3f;)J
  44. */
  45. JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2
  46. (JNIEnv *env, jobject object, jobject vector1) {
  47. jmeClasses::initJavaClasses(env);
  48. btVector3 vec1 = btVector3();
  49. jmeBulletUtil::convert(env, vector1, &vec1);
  50. btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1);
  51. return (long) simplexShape;
  52. }
  53. /*
  54. * Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape
  55. * Method: createShape
  56. * Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J
  57. */
  58. JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2
  59. (JNIEnv *env, jobject object, jobject vector1, jobject vector2) {
  60. jmeClasses::initJavaClasses(env);
  61. btVector3 vec1 = btVector3();
  62. jmeBulletUtil::convert(env, vector1, &vec1);
  63. btVector3 vec2 = btVector3();
  64. jmeBulletUtil::convert(env, vector2, &vec2);
  65. btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2);
  66. return (long) simplexShape;
  67. }
  68. /*
  69. * Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape
  70. * Method: createShape
  71. * Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J
  72. */
  73. JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2
  74. (JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3) {
  75. jmeClasses::initJavaClasses(env);
  76. btVector3 vec1 = btVector3();
  77. jmeBulletUtil::convert(env, vector1, &vec1);
  78. btVector3 vec2 = btVector3();
  79. jmeBulletUtil::convert(env, vector2, &vec2);
  80. btVector3 vec3 = btVector3();
  81. jmeBulletUtil::convert(env, vector3, &vec3);
  82. btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3);
  83. return (long) simplexShape;
  84. }
  85. /*
  86. * Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape
  87. * Method: createShape
  88. * Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J
  89. */
  90. JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2
  91. (JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3, jobject vector4) {
  92. jmeClasses::initJavaClasses(env);
  93. btVector3 vec1 = btVector3();
  94. jmeBulletUtil::convert(env, vector1, &vec1);
  95. btVector3 vec2 = btVector3();
  96. jmeBulletUtil::convert(env, vector2, &vec2);
  97. btVector3 vec3 = btVector3();
  98. jmeBulletUtil::convert(env, vector3, &vec3);
  99. btVector3 vec4 = btVector3();
  100. jmeBulletUtil::convert(env, vector4, &vec4);
  101. btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3, vec4);
  102. return (long) simplexShape;
  103. }
  104. #ifdef __cplusplus
  105. }
  106. #endif