Просмотр исходного кода

- commit possible fix for windows 64 pointer casting issues, see http://msdn.microsoft.com/en-us/library/aa384242(v=vs.85).aspx

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8487 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 лет назад
Родитель
Сommit
aa96a1caf8
26 измененных файлов с 41 добавлено и 33 удалено
  1. 1 1
      engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp
  2. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp
  3. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp
  4. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp
  5. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp
  6. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp
  7. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp
  8. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp
  9. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp
  10. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp
  11. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp
  12. 4 4
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp
  13. 1 1
      engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp
  14. 1 1
      engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp
  15. 1 1
      engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp
  16. 1 1
      engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp
  17. 3 3
      engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp
  18. 1 1
      engine/src/bullet/native/com_jme3_bullet_joints_SixDofSpringJoint.cpp
  19. 1 1
      engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp
  20. 2 2
      engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp
  21. 1 1
      engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp
  22. 2 2
      engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp
  23. 2 2
      engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp
  24. 1 1
      engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp
  25. 1 1
      engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp
  26. 8 0
      engine/src/bullet/native/jmeBulletUtil.h

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp

@@ -55,7 +55,7 @@ extern "C" {
             return 0;
         }
         space->createPhysicsSpace(minX, minY, minZ, maxX, maxY, maxZ, broadphase, threading);
-        return (long) space;
+        return (OBJ_PTR) space;
     }
 
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp

@@ -51,7 +51,7 @@ extern "C" {
         btVector3 extents =  btVector3();
         jmeBulletUtil::convert(env, halfExtents, &extents);
         btBoxShape* shape = new btBoxShape(extents);
-        return (long)shape;
+        return (OBJ_PTR)shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp

@@ -60,7 +60,7 @@ extern "C" {
                 shape = new btCapsuleShapeZ(radius, height);
                 break;
         }
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp

@@ -49,7 +49,7 @@ extern "C" {
     (JNIEnv *env, jobject object) {
         jmeClasses::initJavaClasses(env);
         btCompoundShape* shape = new btCompoundShape();
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp

@@ -60,7 +60,7 @@ extern "C" {
                 shape = new btConeShapeZ(radius, height);
                 break;
         }
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp

@@ -62,7 +62,7 @@ extern "C" {
                 shape = new btCylinderShapeZ(extents);
                 break;
         }
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp

@@ -51,7 +51,7 @@ extern "C" {
         jmeClasses::initJavaClasses(env);
         btTriangleIndexVertexArray* array = (btTriangleIndexVertexArray*) meshId;
         btGImpactMeshShape* shape = new btGImpactMeshShape(array);
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp

@@ -51,7 +51,7 @@ extern "C" {
         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;
+        return (OBJ_PTR)shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp

@@ -61,7 +61,7 @@ extern "C" {
             shape->addPoint(vect);
         }
 
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp

@@ -51,7 +51,7 @@ extern "C" {
         jmeClasses::initJavaClasses(env);
         btTriangleIndexVertexArray* array = (btTriangleIndexVertexArray*) arrayId;
         btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(array, true, true);
-        return (long) shape;
+        return (OBJ_PTR) shape;
     }
     
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp

@@ -52,7 +52,7 @@ extern "C" {
         btVector3 norm = btVector3();
         jmeBulletUtil::convert(env, normal, &norm);
         btStaticPlaneShape* shape = new btStaticPlaneShape(norm, constant);
-        return (long)shape;
+        return (OBJ_PTR)shape;
     }
 
 #ifdef __cplusplus

+ 4 - 4
engine/src/bullet/native/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp

@@ -51,7 +51,7 @@ extern "C" {
         btVector3 vec1 = btVector3();
         jmeBulletUtil::convert(env, vector1, &vec1);
         btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1);
-        return (long) simplexShape;
+        return (OBJ_PTR) simplexShape;
     }
 
     /*
@@ -67,7 +67,7 @@ extern "C" {
         btVector3 vec2 = btVector3();
         jmeBulletUtil::convert(env, vector2, &vec2);
         btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2);
-        return (long) simplexShape;
+        return (OBJ_PTR) simplexShape;
     }
     /*
      * Class:     com_jme3_bullet_collision_shapes_SimplexCollisionShape
@@ -84,7 +84,7 @@ extern "C" {
         btVector3 vec3 = btVector3();
         jmeBulletUtil::convert(env, vector3, &vec3);
         btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3);
-        return (long) simplexShape;
+        return (OBJ_PTR) simplexShape;
     }
     /*
      * Class:     com_jme3_bullet_collision_shapes_SimplexCollisionShape
@@ -103,7 +103,7 @@ extern "C" {
         btVector3 vec4 = btVector3();
         jmeBulletUtil::convert(env, vector4, &vec4);
         btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3, vec4);
-        return (long) simplexShape;
+        return (OBJ_PTR) simplexShape;
     }
 #ifdef __cplusplus
 }

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp

@@ -49,7 +49,7 @@ extern "C" {
     (JNIEnv *env, jobject object, jfloat radius) {
         jmeClasses::initJavaClasses(env);
         btSphereShape* shape=new btSphereShape(radius);
-        return (long)shape;
+        return (OBJ_PTR)shape;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_joints_ConeJoint.cpp

@@ -92,7 +92,7 @@ extern "C" {
         jmeBulletUtil::convert(env, pivotB, &transB.getOrigin());
         jmeBulletUtil::convert(env, rotB, &transB.getBasis());
         btConeTwistConstraint* joint = new btConeTwistConstraint(*bodyA, *bodyB, transA, transB);
-        return (long) joint;
+        return (OBJ_PTR) joint;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_joints_HingeJoint.cpp

@@ -219,7 +219,7 @@ extern "C" {
         jmeBulletUtil::convert(env, axisA, &vec3);
         jmeBulletUtil::convert(env, axisB, &vec4);
         btHingeConstraint* joint = new btHingeConstraint(*bodyA, *bodyB, vec1, vec2, vec3, vec4);
-        return (long) joint;
+        return (OBJ_PTR) joint;
     }
 #ifdef __cplusplus
 }

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_joints_Point2PointJoint.cpp

@@ -154,7 +154,7 @@ extern "C" {
         btTransform transB = btTransform(mtx2);
         jmeBulletUtil::convert(env, pivotB, &transB.getOrigin());
         btHingeConstraint* joint = new btHingeConstraint(*bodyA, *bodyB, transA, transB);
-        return (long) joint;
+        return (OBJ_PTR) joint;
     }
 
 #ifdef __cplusplus

+ 3 - 3
engine/src/bullet/native/com_jme3_bullet_joints_SixDofJoint.cpp

@@ -53,7 +53,7 @@ extern "C" {
             env->ThrowNew(newExc, "The native object does not exist.");
             return 0;
         }
-        return (long) joint->getRotationalLimitMotor(index);
+        return (OBJ_PTR) joint->getRotationalLimitMotor(index);
     }
 
     /*
@@ -69,7 +69,7 @@ extern "C" {
             env->ThrowNew(newExc, "The native object does not exist.");
             return 0;
         }
-        return (long) joint->getTranslationalLimitMotor();
+        return (OBJ_PTR) joint->getTranslationalLimitMotor();
     }
 
     /*
@@ -163,7 +163,7 @@ extern "C" {
         jmeBulletUtil::convert(env, pivotB, &transB.getOrigin());
         jmeBulletUtil::convert(env, rotB, &transB.getBasis());
         btGeneric6DofConstraint* joint = new btGeneric6DofConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA);
-        return (long) joint;
+        return (OBJ_PTR) joint;
     }
 #ifdef __cplusplus
 }

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_joints_SixDofSpringJoint.cpp

@@ -86,7 +86,7 @@ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_createJoin
         jmeBulletUtil::convert(env, rotB, &transB.getBasis());
 
         btGeneric6DofSpringConstraint* joint = new btGeneric6DofSpringConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA);
-        return (long)joint;
+        return (OBJ_PTR)joint;
     }
 
 #ifdef __cplusplus

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_joints_SliderJoint.cpp

@@ -955,7 +955,7 @@ extern "C" {
         jmeBulletUtil::convert(env, pivotB, &transB.getOrigin());
         jmeBulletUtil::convert(env, rotB, &transB.getBasis());
         btSliderConstraint* joint = new btSliderConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA);
-        return (long) joint;
+        return (OBJ_PTR) joint;
     }
 
 #ifdef __cplusplus

+ 2 - 2
engine/src/bullet/native/com_jme3_bullet_objects_PhysicsCharacter.cpp

@@ -52,7 +52,7 @@ extern "C" {
     (JNIEnv * env, jobject object) {
         jmeClasses::initJavaClasses(env);
         btPairCachingGhostObject* ghost = new btPairCachingGhostObject();
-        return (long) ghost;
+        return (OBJ_PTR) ghost;
     }
 
     /*
@@ -88,7 +88,7 @@ extern "C" {
         //TODO: check convexshape!
         btConvexShape* shape = (btConvexShape*) shapeId;
         btKinematicCharacterController* character = new btKinematicCharacterController(ghost, shape, stepHeight);
-        return (long) character;
+        return (OBJ_PTR) character;
     }
 
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp

@@ -54,7 +54,7 @@ extern "C" {
     (JNIEnv * env, jobject object) {
         jmeClasses::initJavaClasses(env);
         btPairCachingGhostObject* ghost = new btPairCachingGhostObject();
-        return (long) ghost;
+        return (OBJ_PTR) ghost;
     }
 
     /*

+ 2 - 2
engine/src/bullet/native/com_jme3_bullet_objects_PhysicsRigidBody.cpp

@@ -55,7 +55,7 @@ extern "C" {
         shape->calculateLocalInertia(mass, localInertia);
         btRigidBody* body = new btRigidBody(mass, motionState, shape, localInertia);
         body->setUserPointer(NULL);
-        return (long) body;
+        return (OBJ_PTR) body;
     }
 
     /*
@@ -336,7 +336,7 @@ extern "C" {
         btVector3 localInertia = btVector3();
         shape->calculateLocalInertia(mass, localInertia);
         body->setMassProps(mass, localInertia);
-        return (long) body;
+        return (OBJ_PTR) body;
     }
 
     /*

+ 2 - 2
engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp

@@ -75,7 +75,7 @@ extern "C" {
             return 0;
         }
         btDefaultVehicleRaycaster* caster = new btDefaultVehicleRaycaster(space->getDynamicsWorld());
-        return (long) caster;
+        return (OBJ_PTR) caster;
     }
 
     /*
@@ -101,7 +101,7 @@ extern "C" {
         }
         btRaycastVehicle::btVehicleTuning tuning;
         btRaycastVehicle* vehicle = new btRaycastVehicle(tuning, body, caster);
-        return (long) vehicle;
+        return (OBJ_PTR) vehicle;
 
     }
 

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp

@@ -50,7 +50,7 @@ extern "C" {
     (JNIEnv *env, jobject object) {
         jmeClasses::initJavaClasses(env);
         jmeMotionState* motionState = new jmeMotionState();
-        return (long) motionState;
+        return (OBJ_PTR) motionState;
     }
 
     /*

+ 1 - 1
engine/src/bullet/native/com_jme3_bullet_util_NativeMeshUtil.cpp

@@ -51,7 +51,7 @@ extern "C" {
         int* triangles = (int*) env->GetDirectBufferAddress(triangleIndexBase);
         float* vertices = (float*) env->GetDirectBufferAddress(vertexIndexBase);
         btTriangleIndexVertexArray* array = new btTriangleIndexVertexArray(numTriangles, triangles, triangleIndexStride, numVertices, vertices, vertexStride);
-        return (long) array;
+        return (OBJ_PTR) array;
     }
 
 #ifdef __cplusplus

+ 8 - 0
engine/src/bullet/native/jmeBulletUtil.h

@@ -34,6 +34,14 @@
 #include "btBulletCollisionCommon.h"
 #include "LinearMath/btVector3.h"
 
+#ifdef _WIN32
+typedef ULONG OBJ_PTR;
+#elif _WIN64
+typedef _int64 OBJ_PTR;
+#else
+typedef long OBJ_PTR;
+#endif
+
 /**
  * Author: Normen Hansen
  */