From 070ddd23f0ff1a0fba60979ad67aa1d544d743c1 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 9 May 2011 16:15:34 +0000 Subject: [PATCH] Bullet Native: - avoid use of pointers for math primitives globally git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7474 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/bullet/native/bullet-native-build.txt | 2 +- .../native/com_jme3_bullet_PhysicsSpace.cpp | 6 +- ...let_collision_shapes_BoxCollisionShape.cpp | 6 +- ...bullet_collision_shapes_CollisionShape.cpp | 6 +- ...ollision_shapes_CompoundCollisionShape.cpp | 10 +-- ...ollision_shapes_CylinderCollisionShape.cpp | 10 +-- ...t_collision_shapes_PlaneCollisionShape.cpp | 6 +- ...collision_shapes_SimplexCollisionShape.cpp | 48 ++++++------ .../com_jme3_bullet_joints_SixDofJoint.cpp | 24 +++--- ...m_jme3_bullet_objects_PhysicsCharacter.cpp | 12 +-- ...jme3_bullet_objects_PhysicsGhostObject.cpp | 12 --- ...m_jme3_bullet_objects_PhysicsRigidBody.cpp | 78 +++++++++---------- ...com_jme3_bullet_objects_PhysicsVehicle.cpp | 14 ++-- 13 files changed, 111 insertions(+), 123 deletions(-) diff --git a/engine/src/bullet/native/bullet-native-build.txt b/engine/src/bullet/native/bullet-native-build.txt index c89946cce..e9e4bcd84 100644 --- a/engine/src/bullet/native/bullet-native-build.txt +++ b/engine/src/bullet/native/bullet-native-build.txt @@ -160,7 +160,7 @@ of the old one. Netbeans Project ----------------------------------- The project also includes a Netbeans project to edit and build -the source in the Netbeans IDE. +the source in the Netbeans IDE in the /src/bullet/ subfolder. To have correct syntax highlighting in .cpp/.h files: diff --git a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp index a450c1ccd..8d33c1901 100644 --- a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp @@ -351,9 +351,9 @@ extern "C" { env->ThrowNew(newExc, "The physics space does not exist."); return; } - btVector3* gravity = &btVector3(); - jmeBulletUtil::convert(env, vector, gravity); - space->getDynamicsWorld()->setGravity(*gravity); + btVector3 gravity = btVector3(); + jmeBulletUtil::convert(env, vector, &gravity); + space->getDynamicsWorld()->setGravity(gravity); } /* 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 3c9ad56a6..1c34c0a91 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 @@ -48,9 +48,9 @@ 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); + btVector3 extents = btVector3(); + jmeBulletUtil::convert(env, halfExtents, &extents); + btBoxShape* shape = new btBoxShape(extents); return (long)shape; } diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CollisionShape.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CollisionShape.cpp index bdf594b46..3d5618ed4 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CollisionShape.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_shapes_CollisionShape.cpp @@ -59,9 +59,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_setLocalScaling (JNIEnv * env, jobject object, jlong shapeId, jobject scale) { btCollisionShape* shape = (btCollisionShape*) shapeId; - btVector3* scl = &btVector3(); - jmeBulletUtil::convert(env, scale, scl); - shape->setLocalScaling(*scl); + btVector3 scl = btVector3(); + jmeBulletUtil::convert(env, scale, &scl); + shape->setLocalScaling(scl); } /* 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 7cbdf03c6..5db7f5186 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 @@ -61,11 +61,11 @@ extern "C" { (JNIEnv *env, jobject object, jlong compoundId, jlong childId, jobject childLocation, jobject childRotation) { btCompoundShape* shape = (btCompoundShape*) compoundId; btCollisionShape* child = (btCollisionShape*) childId; - btMatrix3x3* mtx = &btMatrix3x3(); - btTransform* trans = &btTransform(*mtx); - jmeBulletUtil::convert(env, childLocation, &trans->getOrigin()); - jmeBulletUtil::convert(env, childRotation, &trans->getBasis()); - shape->addChildShape(*trans, child); + btMatrix3x3 mtx = btMatrix3x3(); + btTransform trans = btTransform(mtx); + jmeBulletUtil::convert(env, childLocation, &trans.getOrigin()); + jmeBulletUtil::convert(env, childRotation, &trans.getBasis()); + shape->addChildShape(trans, child); return 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 36fc98baf..4fdaab694 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 @@ -48,18 +48,18 @@ 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); + btVector3 extents = btVector3(); + jmeBulletUtil::convert(env, halfExtents, &extents); btCollisionShape* shape; switch (axis) { case 0: - shape = new btCylinderShapeX(*extents); + shape = new btCylinderShapeX(extents); break; case 1: - shape = new btCylinderShape(*extents); + shape = new btCylinderShape(extents); break; case 2: - shape = new btCylinderShapeZ(*extents); + shape = new btCylinderShapeZ(extents); break; } 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 7714bdfe7..ad25da2cc 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 @@ -49,9 +49,9 @@ 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); + btVector3 norm = btVector3(); + jmeBulletUtil::convert(env, normal, &norm); + btStaticPlaneShape* shape = new btStaticPlaneShape(norm, constant); return (long)shape; } 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 0a4798294..368cf5870 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 @@ -48,9 +48,9 @@ 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); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, vector1, &vec1); + btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1); return (long) simplexShape; } @@ -62,11 +62,11 @@ 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(); - jmeBulletUtil::convert(env, vector2, vec2); - btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(*vec1, *vec2); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, vector1, &vec1); + btVector3 vec2 = btVector3(); + jmeBulletUtil::convert(env, vector2, &vec2); + btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2); return (long) simplexShape; } /* @@ -77,13 +77,13 @@ 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(); - jmeBulletUtil::convert(env, vector2, vec2); - btVector3* vec3 = &btVector3(); - jmeBulletUtil::convert(env, vector3, vec3); - btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(*vec1, *vec2, *vec3); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, vector1, &vec1); + btVector3 vec2 = btVector3(); + jmeBulletUtil::convert(env, vector2, &vec2); + btVector3 vec3 = btVector3(); + jmeBulletUtil::convert(env, vector3, &vec3); + btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3); return (long) simplexShape; } /* @@ -94,15 +94,15 @@ 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(); - jmeBulletUtil::convert(env, vector2, vec2); - btVector3* vec3 = &btVector3(); - jmeBulletUtil::convert(env, vector3, vec3); - btVector3* vec4 = &btVector3(); - jmeBulletUtil::convert(env, vector4, vec4); - btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(*vec1, *vec2, *vec3, *vec4); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, vector1, &vec1); + btVector3 vec2 = btVector3(); + jmeBulletUtil::convert(env, vector2, &vec2); + btVector3 vec3 = btVector3(); + jmeBulletUtil::convert(env, vector3, &vec3); + btVector3 vec4 = btVector3(); + jmeBulletUtil::convert(env, vector4, &vec4); + btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3, vec4); return (long) simplexShape; } #ifdef __cplusplus 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 cb201561d..59fbb2e64 100644 --- a/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp @@ -70,9 +70,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearUpperLimit (JNIEnv * env, jobject object, jlong jointId, jobject vector) { btGeneric6DofConstraint* joint = (btGeneric6DofConstraint*) jointId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - joint->setLinearUpperLimit(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + joint->setLinearUpperLimit(vec); } /* @@ -83,9 +83,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearLowerLimit (JNIEnv * env, jobject object, jlong jointId, jobject vector) { btGeneric6DofConstraint* joint = (btGeneric6DofConstraint*) jointId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - joint->setLinearLowerLimit(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + joint->setLinearLowerLimit(vec); } /* @@ -96,9 +96,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularUpperLimit (JNIEnv * env, jobject object, jlong jointId, jobject vector) { btGeneric6DofConstraint* joint = (btGeneric6DofConstraint*) jointId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - joint->setAngularUpperLimit(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + joint->setAngularUpperLimit(vec); } /* @@ -109,9 +109,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularLowerLimit (JNIEnv * env, jobject object, jlong jointId, jobject vector) { btGeneric6DofConstraint* joint = (btGeneric6DofConstraint*) jointId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - joint->setAngularLowerLimit(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + joint->setAngularLowerLimit(vec); } /* 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 fe91b435a..a98da9bb3 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp @@ -89,9 +89,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_warp (JNIEnv *env, jobject object, jlong objectId, jobject vector) { btKinematicCharacterController* character = (btKinematicCharacterController*) objectId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - character->warp(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + character->warp(vec); } /* @@ -102,9 +102,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setWalkDirection (JNIEnv *env, jobject object, jlong objectId, jobject vector) { btKinematicCharacterController* character = (btKinematicCharacterController*) objectId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, vector, vec); - character->setWalkDirection(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, vector, &vec); + character->setWalkDirection(vec); } /* 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 9db3338e7..4bac1bee6 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp @@ -74,10 +74,6 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsLocation (JNIEnv *env, jobject object, jlong objectId, jobject value){ btPairCachingGhostObject* ghost = (btPairCachingGhostObject*)objectId; -// btVector3* vec = new btVector3(); -// jmeBulletUtil::convert(value, vec); -// ghost->getWorldTransform().setOrigin(vec); -// delete(vec); jmeBulletUtil::convert(env, value, &ghost->getWorldTransform().getOrigin()); } @@ -89,10 +85,6 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Matrix3f_2 (JNIEnv *env, jobject object, jlong objectId, jobject value){ btPairCachingGhostObject* ghost = (btPairCachingGhostObject*)objectId; -// btVector3* vec = new btVector3(); -// jmeBulletUtil::convert(value, vec); -// ghost->getWorldTransform().setOrigin(vec); -// delete(vec); jmeBulletUtil::convert(env, value, &ghost->getWorldTransform().getBasis()); } @@ -104,10 +96,6 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Quaternion_2 (JNIEnv *env, jobject object, jlong objectId, jobject value){ btPairCachingGhostObject* ghost = (btPairCachingGhostObject*)objectId; -// btVector3* vec = new btVector3(); -// jmeBulletUtil::convert(value, vec); -// ghost->getWorldTransform().setOrigin(vec); -// delete(vec); jmeBulletUtil::convertQuat(env, value, &ghost->getWorldTransform().getBasis()); } 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 72a37f723..0533fa108 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp @@ -51,9 +51,9 @@ extern "C" { jmeClasses::initJavaClasses(env); btMotionState* motionState = (btMotionState*) motionstatId; btCollisionShape* shape = (btCollisionShape*) shapeId; - btVector3* localInertia = &btVector3(); - shape->calculateLocalInertia(mass, *localInertia); - btRigidBody* body = new btRigidBody(mass, motionState, shape, *localInertia); + btVector3 localInertia = btVector3(); + shape->calculateLocalInertia(mass, localInertia); + btRigidBody* body = new btRigidBody(mass, motionState, shape, localInertia); return (long) body; } @@ -257,9 +257,9 @@ extern "C" { (JNIEnv *env, jobject object, jlong bodyId, jlong shapeId, jfloat mass) { btRigidBody* body = (btRigidBody*) bodyId; btCollisionShape* shape = (btCollisionShape*) shapeId; - btVector3* localInertia = &btVector3(); - shape->calculateLocalInertia(mass, *localInertia); - body->setMassProps(mass, *localInertia); + btVector3 localInertia = btVector3(); + shape->calculateLocalInertia(mass, localInertia); + body->setMassProps(mass, localInertia); return (long) body; } @@ -282,9 +282,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setGravity (JNIEnv *env, jobject object, jlong bodyId, jobject value) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, value, vec); - body->setGravity(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, value, &vec); + body->setGravity(vec); } /* @@ -394,9 +394,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularVelocity (JNIEnv *env, jobject object, jlong bodyId, jobject value) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, value, vec); - body->setAngularVelocity(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, value,&vec); + body->setAngularVelocity(vec); } /* @@ -418,9 +418,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setLinearVelocity (JNIEnv *env, jobject object, jlong bodyId, jobject value) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec = &btVector3(); - jmeBulletUtil::convert(env, value, vec); - body->setLinearVelocity(*vec); + btVector3 vec = btVector3(); + jmeBulletUtil::convert(env, value, &vec); + body->setLinearVelocity(vec); } /* @@ -431,11 +431,11 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyForce (JNIEnv *env, jobject object, jlong bodyId, jobject force, jobject location) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - btVector3* vec2 = &btVector3(); - jmeBulletUtil::convert(env, force, vec1); - jmeBulletUtil::convert(env, location, vec2); - body->applyForce(*vec1, *vec2); + btVector3 vec1 = btVector3(); + btVector3 vec2 = btVector3(); + jmeBulletUtil::convert(env, force, &vec1); + jmeBulletUtil::convert(env, location, &vec2); + body->applyForce(vec1, vec2); } /* @@ -446,9 +446,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyCentralForce (JNIEnv *env, jobject object, jlong bodyId, jobject force) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - jmeBulletUtil::convert(env, force, vec1); - body->applyCentralForce(*vec1); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, force, &vec1); + body->applyCentralForce(vec1); } /* @@ -459,9 +459,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorque (JNIEnv *env, jobject object, jlong bodyId, jobject force) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - jmeBulletUtil::convert(env, force, vec1); - body->applyTorque(*vec1); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, force, &vec1); + body->applyTorque(vec1); } /* @@ -472,11 +472,11 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyImpulse (JNIEnv *env, jobject object, jlong bodyId, jobject force, jobject location) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - btVector3* vec2 = &btVector3(); - jmeBulletUtil::convert(env, force, vec1); - jmeBulletUtil::convert(env, location, vec2); - body->applyImpulse(*vec1, *vec2); + btVector3 vec1 = btVector3(); + btVector3 vec2 = btVector3(); + jmeBulletUtil::convert(env, force, &vec1); + jmeBulletUtil::convert(env, location, &vec2); + body->applyImpulse(vec1, vec2); } /* @@ -487,9 +487,9 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorqueImpulse (JNIEnv *env, jobject object, jlong bodyId, jobject force) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - jmeBulletUtil::convert(env, force, vec1); - body->applyTorqueImpulse(*vec1); + btVector3 vec1 = btVector3(); + jmeBulletUtil::convert(env, force, &vec1); + body->applyTorqueImpulse(vec1); } /* @@ -611,11 +611,11 @@ extern "C" { JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularFactor (JNIEnv *env, jobject object, jlong bodyId, jfloat value) { btRigidBody* body = (btRigidBody*) bodyId; - btVector3* vec1 = &btVector3(); - vec1->setX(value); - vec1->setY(value); - vec1->setZ(value); - body->setAngularFactor(*vec1); + btVector3 vec1 = btVector3(); + vec1.setX(value); + vec1.setY(value); + vec1.setZ(value); + body->setAngularFactor(vec1); } #ifdef __cplusplus diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp index 59e8b1c7d..dae400ae5 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp @@ -101,14 +101,14 @@ extern "C" { JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel (JNIEnv *env, jobject object, jlong vehicleId, jobject location, jobject direction, jobject axle, jfloat restLength, jfloat radius, jobject tuning, jboolean frontWheel) { btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId; - btVector3* vec1 = &btVector3(); - btVector3* vec2 = &btVector3(); - btVector3* vec3 = &btVector3(); - jmeBulletUtil::convert(env, location, vec1); - jmeBulletUtil::convert(env, direction, vec2); - jmeBulletUtil::convert(env, axle, vec3); + btVector3 vec1 = btVector3(); + btVector3 vec2 = btVector3(); + btVector3 vec3 = btVector3(); + jmeBulletUtil::convert(env, location, &vec1); + jmeBulletUtil::convert(env, direction, &vec2); + jmeBulletUtil::convert(env, axle, &vec3); btRaycastVehicle::btVehicleTuning tune; - btWheelInfo* info = &vehicle->addWheel(*vec1, *vec2, *vec3, restLength, radius, tune, frontWheel); + btWheelInfo* info = &vehicle->addWheel(vec1, vec2, vec3, restLength, radius, tune, frontWheel); return (long) info; }