diff --git a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java index c8efbeb66..732f862fd 100644 --- a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java @@ -142,7 +142,6 @@ public class PhysicsSpace { this.worldMax.set(worldMax); this.broadphaseType = broadphaseType; create(); - initNativePhysics(); } /** @@ -150,7 +149,6 @@ public class PhysicsSpace { */ public void create() { //TODO: boroadphase! - initNativePhysics(); physicsSpaceId = createPhysicsSpace(worldMin.x, worldMin.y, worldMin.z, worldMax.x, worldMax.y, worldMax.z, 3, false); pQueueTL.set(pQueue); physicsSpaceTL.set(this); diff --git a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp index 21f0abc83..a450c1ccd 100644 --- a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_PhysicsSpace_createPhysicsSpace (JNIEnv * env, jobject object, jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphase, jboolean threading) { + jmeClasses::initJavaClasses(env); jmePhysicsSpace* space = new jmePhysicsSpace(env, object); if (space == NULL) { jclass newExc = env->FindClass("java/lang/IllegalStateException"); diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp index a415e6a5d..3c9ad56a6 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_BoxCollisionShape_createShape (JNIEnv *env, jobject object, jobject halfExtents) { + jmeClasses::initJavaClasses(env); btVector3* extents = &btVector3(); jmeBulletUtil::convert(env, halfExtents, extents); btBoxShape* shape = new btBoxShape(*extents); diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp index 7f7d70b05..7d963dfc3 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CapsuleCollisionShape_createShape (JNIEnv * env, jobject object, jint axis, jfloat radius, jfloat height) { + jmeClasses::initJavaClasses(env); btCollisionShape* shape; switch(axis){ case 0: diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp index b3383789f..7cbdf03c6 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_createShape (JNIEnv *env, jobject object) { + jmeClasses::initJavaClasses(env); btCompoundShape* shape = new btCompoundShape(); return (long) shape; } diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp index 3a2b9dad0..a3bf7c254 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_ConeCollisionShape_createShape (JNIEnv * env, jobject object, jint axis, jfloat radius, jfloat height) { + jmeClasses::initJavaClasses(env); btCollisionShape* shape; switch (axis) { case 0: diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp index a7c52fdc0..36fc98baf 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CylinderCollisionShape_createShape (JNIEnv * env, jobject object, jint axis, jobject halfExtents) { + jmeClasses::initJavaClasses(env); btVector3* extents = &btVector3(); jmeBulletUtil::convert(env, halfExtents, extents); btCollisionShape* shape; diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp index 68c7ff532..6322a42b9 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_createShape (JNIEnv * env, jobject object, jlong meshId) { + jmeClasses::initJavaClasses(env); btTriangleIndexVertexArray* array = (btTriangleIndexVertexArray*) meshId; btGImpactMeshShape* shape = new btGImpactMeshShape(array); return (long) shape; diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp index 3946195ce..6dad6f9ba 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape_createShape (JNIEnv * env, jobject object, jint heightStickWidth, jint heightStickLength, jobject heightfieldData, jfloat heightScale, jfloat minHeight, jfloat maxHeight, jint upAxis, jboolean flipQuadEdges) { + jmeClasses::initJavaClasses(env); void* data = env->GetDirectBufferAddress(heightfieldData); btHeightfieldTerrainShape* shape=new btHeightfieldTerrainShape(heightStickWidth, heightStickLength, data, heightScale, minHeight, maxHeight, upAxis, PHY_FLOAT, flipQuadEdges); return (long)shape; diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp index f2ea8b01d..797662a8b 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HullCollisionShape_createShape (JNIEnv *env, jobject object, jobject array) { + jmeClasses::initJavaClasses(env); float* data = (float*) env->GetDirectBufferAddress(array); //TODO: capacity will not always be length! int length = env->GetDirectBufferCapacity(array)/4; diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp index 3534a1589..624effc22 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_createShape (JNIEnv * env, jobject object, jlong arrayId) { + jmeClasses::initJavaClasses(env); btTriangleIndexVertexArray* array = (btTriangleIndexVertexArray*) arrayId; btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(array, true, true); return (long) shape; diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp index 08b9dcf33..7714bdfe7 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_PlaneCollisionShape_createShape (JNIEnv * env, jobject object, jobject normal, jfloat constant) { + jmeClasses::initJavaClasses(env); btVector3* norm = &btVector3(); jmeBulletUtil::convert(env, normal, norm); btStaticPlaneShape* shape = new btStaticPlaneShape(*norm, constant); diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp index 30fe8233d..0a4798294 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2 (JNIEnv *env, jobject object, jobject vector1) { + jmeClasses::initJavaClasses(env); btVector3* vec1 = &btVector3(); jmeBulletUtil::convert(env, vector1, vec1); btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(*vec1); @@ -60,6 +61,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 (JNIEnv *env, jobject object, jobject vector1, jobject vector2) { + jmeClasses::initJavaClasses(env); btVector3* vec1 = &btVector3(); jmeBulletUtil::convert(env, vector1, vec1); btVector3* vec2 = &btVector3(); @@ -74,6 +76,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 (JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3) { + jmeClasses::initJavaClasses(env); btVector3* vec1 = &btVector3(); jmeBulletUtil::convert(env, vector1, vec1); btVector3* vec2 = &btVector3(); @@ -90,6 +93,7 @@ extern "C" { */ 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 (JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3, jobject vector4) { + jmeClasses::initJavaClasses(env); btVector3* vec1 = &btVector3(); jmeBulletUtil::convert(env, vector1, vec1); btVector3* vec2 = &btVector3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp index c896cda3a..d1805d632 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SphereCollisionShape_createShape (JNIEnv *env, jobject object, jfloat radius) { + jmeClasses::initJavaClasses(env); btSphereShape* shape=new btSphereShape(radius); return (long)shape; } diff --git a/engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp b/engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp index a7755fac9..286a696be 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp @@ -70,6 +70,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_ConeJoint_createJoint (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB) { + jmeClasses::initJavaClasses(env); btRigidBody* bodyA = (btRigidBody*) bodyIdA; btRigidBody* bodyB = (btRigidBody*) bodyIdB; btMatrix3x3* mtx1 = &btMatrix3x3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp b/engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp index 7dd5d426a..812133a1b 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp @@ -157,6 +157,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_HingeJoint_createJoint (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject axisA, jobject pivotB, jobject axisB) { + jmeClasses::initJavaClasses(env); btRigidBody* bodyA = (btRigidBody*) bodyIdA; btRigidBody* bodyB = (btRigidBody*) bodyIdB; btVector3* vec1 = &btVector3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp b/engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp index 80869a851..2be2ec7db 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp @@ -113,6 +113,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_createJoint (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject pivotB) { + jmeClasses::initJavaClasses(env); btRigidBody* bodyA = (btRigidBody*) bodyIdA; btRigidBody* bodyB = (btRigidBody*) bodyIdB; //TODO: matrix not needed? diff --git a/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp b/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp index b9bc20b3e..ad936ae8b 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp @@ -121,6 +121,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_createJoint (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) { + jmeClasses::initJavaClasses(env); btRigidBody* bodyA = (btRigidBody*) bodyIdA; btRigidBody* bodyB = (btRigidBody*) bodyIdB; btMatrix3x3* mtx1 = &btMatrix3x3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp b/engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp index 3a4e894c6..899079143 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp @@ -663,6 +663,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SliderJoint_createJoint (JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) { + jmeClasses::initJavaClasses(env); btRigidBody* bodyA = (btRigidBody*) bodyIdA; btRigidBody* bodyB = (btRigidBody*) bodyIdB; btMatrix3x3* mtx1=&btMatrix3x3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp index 840d21e28..fe91b435a 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp @@ -50,6 +50,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_createGhostObject (JNIEnv * env, jobject object) { + jmeClasses::initJavaClasses(env); btPairCachingGhostObject* ghost = new btPairCachingGhostObject(); return (long) ghost; } diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp index 5aaa727dd..9db3338e7 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp @@ -50,6 +50,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_createGhostObject (JNIEnv * env, jobject object) { + jmeClasses::initJavaClasses(env); btPairCachingGhostObject* ghost = new btPairCachingGhostObject(); return (long) ghost; } diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp index d4aa8160f..72a37f723 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_createRigidBody (JNIEnv *env, jobject object, jfloat mass, jlong motionstatId, jlong shapeId) { + jmeClasses::initJavaClasses(env); btMotionState* motionState = (btMotionState*) motionstatId; btCollisionShape* shape = (btCollisionShape*) shapeId; btVector3* localInertia = &btVector3(); diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp index ff9849043..2e31b2fc2 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp @@ -48,6 +48,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_createMotionState (JNIEnv *env, jobject object) { + jmeClasses::initJavaClasses(env); jmeMotionState* motionState = new jmeMotionState(); return (long) motionState; } diff --git a/engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp b/engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp index c58e363f7..46311422c 100644 --- a/engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp @@ -47,6 +47,7 @@ extern "C" { */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_util_NativeMeshUtil_createTriangleIndexVertexArray (JNIEnv * env, jclass cls, jobject triangleIndexBase, jobject vertexIndexBase, jint numTriangles, jint numVertices, jint vertexStride, jint triangleIndexStride) { + jmeClasses::initJavaClasses(env); int* triangles = (int*) env->GetDirectBufferAddress(triangleIndexBase); float* vertices = (float*) env->GetDirectBufferAddress(vertexIndexBase); btTriangleIndexVertexArray* array = new btTriangleIndexVertexArray(numTriangles, triangles, triangleIndexStride, numVertices, vertices, vertexStride);