- add build process for android bullet native (thanks to @iwgeric)

- add bullet native libraries for android

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8803 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 7cb582676c
commit a5d2fe07bc
  1. 1
      engine/build.xml
  2. BIN
      engine/lib/bullet/android/armeabi-v7a/libbulletjme.so
  3. BIN
      engine/lib/bullet/android/armeabi/libbulletjme.so
  4. BIN
      engine/lib/bullet/android/x86/libbulletjme.so
  5. BIN
      engine/lib/bullet/jME3-bullet-android-natives.jar
  6. BIN
      engine/lib/bullet/jME3-bullet-natives.jar
  7. BIN
      engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib
  8. 259
      engine/src/bullet/native/android/Android.mk
  9. 2
      engine/src/bullet/native/android/Application.mk
  10. 273
      engine/src/bullet/native/android/jmePhysicsSpace.cpp
  11. 63
      engine/src/bullet/native/build.xml
  12. 5
      engine/src/bullet/native/bullet.properties

@ -201,6 +201,7 @@
<include name="**/jME3-jbullet.jar"/> <include name="**/jME3-jbullet.jar"/>
<include name="**/jME3-bullet.jar"/> <include name="**/jME3-bullet.jar"/>
<include name="**/jME3-bullet-natives.jar"/> <include name="**/jME3-bullet-natives.jar"/>
<include name="**/jME3-bullet-natives-android.jar"/>
</fileset> </fileset>
<!--clear old files--> <!--clear old files-->

@ -0,0 +1,259 @@
# /*
# Bullet Continuous Collision Detection and Physics Library for Android NDK
# Copyright (c) 2006-2009 Noritsuna Imamura <a href="http://www.siprop.org/" rel="nofollow">http://www.siprop.org/</a>
#
# This software is provided 'as-is', without any express or implied warranty.
# In no event will the authors be held liable for any damages arising from the use of this software.
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it freely,
# subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
# */
LOCAL_PATH:= $(call my-dir)
JME3_PATH:=
BULLET_PATH:=
include $(CLEAR_VARS)
LOCAL_MODULE := bulletjme
LOCAL_C_INCLUDES := $(BULLET_PATH)/\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision\
$(BULLET_PATH)/BulletCollision/CollisionDispatch\
$(BULLET_PATH)/BulletCollision/CollisionShapes\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver\
$(BULLET_PATH)/BulletDynamics/Dynamics\
$(BULLET_PATH)/BulletDynamics/Vehicle\
$(BULLET_PATH)/LinearMath\
$(BULLET_PATH)/BulletCollision\
$(BULLET_PATH)/BulletDynamics\
$(BULLET_PATH)/BulletMultiThreaded\
$(BULLET_PATH)/BulletSoftBody\
$(BULLET_PATH)/ibmsdk\
$(BULLET_PATH)/LinearMath\
$(BULLET_PATH)/MiniCL\
$(BULLET_PATH)/vectormath\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision\
$(BULLET_PATH)/BulletCollision/CollisionDispatch\
$(BULLET_PATH)/BulletCollision/CollisionShapes\
$(BULLET_PATH)/BulletCollision/Gimpact\
$(BULLET_PATH)/BulletCollision/ibmsdk\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision\
$(BULLET_PATH)/BulletDynamics/Character\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver\
$(BULLET_PATH)/BulletDynamics/Dynamics\
$(BULLET_PATH)/BulletDynamics/ibmsdk\
$(BULLET_PATH)/BulletDynamics/Vehicle\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers\
$(BULLET_PATH)/BulletMultiThreaded/out\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask\
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTask\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/CPU\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/DX11\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10\
$(BULLET_PATH)/LinearMath/ibmsdk\
$(BULLET_PATH)/MiniCL/MiniCLTask\
$(BULLET_PATH)/vectormath/scalar\
$(BULLET_PATH)/vectormath/sse
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -lm -llog
LOCAL_SRC_FILES := $(JME3_PATH)/com_jme3_bullet_collision_PhysicsCollisionEvent.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_PhysicsCollisionObject.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_ConeJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_HingeJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_motors_RotationalLimitMotor.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_motors_TranslationalLimitMotor.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_PhysicsJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_Point2PointJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_SixDofJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_SixDofSpringJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_joints_SliderJoint.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsCharacter.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsGhostObject.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsRigidBody.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsVehicle.cpp\
$(JME3_PATH)/com_jme3_bullet_objects_VehicleWheel.cpp\
$(JME3_PATH)/com_jme3_bullet_PhysicsSpace.cpp\
$(JME3_PATH)/com_jme3_bullet_util_DebugShapeFactory.cpp\
$(JME3_PATH)/com_jme3_bullet_util_NativeMeshUtil.cpp\
$(JME3_PATH)/jmeBulletUtil.cpp\
$(JME3_PATH)/jmeClasses.cpp\
$(JME3_PATH)/jmeMotionState.cpp\
$(JME3_PATH)/jmePhysicsSpace.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDbvt.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDispatcher.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp\
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionObject.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionWorld.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btGhostObject.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btManifoldResult.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btUnionFind.cpp\
$(BULLET_PATH)/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBox2dShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBoxShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCapsuleShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCollisionShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCompoundShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConcaveShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConeShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvex2dShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexHullShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexInternalShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCylinderShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btEmptyShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMultiSphereShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btOptimizedBvh.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btShapeHull.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btSphereShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTetrahedronShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleBuffer.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleCallback.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleMesh.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp\
$(BULLET_PATH)/BulletCollision/CollisionShapes/btUniformScalingShape.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btContactProcessing.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btGenericPoolAllocator.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactBvh.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactShape.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/btTriangleShapeEx.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/gim_box_set.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/gim_contact.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/gim_memory.cpp\
$(BULLET_PATH)/BulletCollision/Gimpact/gim_tri_collision.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btConvexCast.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp\
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp\
$(BULLET_PATH)/BulletDynamics/Character/btKinematicCharacterController.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btContactConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp\
$(BULLET_PATH)/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp\
$(BULLET_PATH)/BulletDynamics/Dynamics/btRigidBody.cpp\
$(BULLET_PATH)/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp\
$(BULLET_PATH)/BulletDynamics/Dynamics/Bullet-C-API.cpp\
$(BULLET_PATH)/BulletDynamics/Vehicle/btRaycastVehicle.cpp\
$(BULLET_PATH)/BulletDynamics/Vehicle/btWheelInfo.cpp\
$(BULLET_PATH)/BulletMultiThreaded/btGpu3DGridBroadphase.cpp\
$(BULLET_PATH)/BulletMultiThreaded/btParallelConstraintSolver.cpp\
$(BULLET_PATH)/BulletMultiThreaded/btThreadSupportInterface.cpp\
$(BULLET_PATH)/BulletMultiThreaded/PosixThreadSupport.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SequentialThreadSupport.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuCollisionObjectWrapper.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuCollisionTaskProcess.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuFakeDma.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuLibspe2Support.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTaskProcess.cpp\
$(BULLET_PATH)/BulletMultiThreaded/Win32ThreadSupport.cpp\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/CPU/btSoftBodySolver_CPU.cpp\
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/MiniCLTaskWrap.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/boxBoxDistance.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp\
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTask/SpuSampleTask.cpp\
$(BULLET_PATH)/BulletSoftBody/btDefaultSoftBodySolver.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftBody.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftBodyHelpers.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftRigidDynamicsWorld.cpp\
$(BULLET_PATH)/BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp\
$(BULLET_PATH)/LinearMath/btAlignedAllocator.cpp\
$(BULLET_PATH)/LinearMath/btConvexHull.cpp\
$(BULLET_PATH)/LinearMath/btConvexHullComputer.cpp\
$(BULLET_PATH)/LinearMath/btGeometryUtil.cpp\
$(BULLET_PATH)/LinearMath/btQuickprof.cpp\
$(BULLET_PATH)/LinearMath/btSerializer.cpp\
$(BULLET_PATH)/MiniCL/MiniCL.cpp\
$(BULLET_PATH)/MiniCL/MiniCLTaskScheduler.cpp\
$(BULLET_PATH)/MiniCL/MiniCLTask/MiniCLTask.cpp
include $(BUILD_SHARED_LIBRARY)

@ -0,0 +1,2 @@
APP_MODULES := bulletjme
APP_ABI := all

@ -0,0 +1,273 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "jmePhysicsSpace.h"
#include "jmeBulletUtil.h"
#include <stdio.h>
/**
* Author: Normen Hansen
*/
jmePhysicsSpace::jmePhysicsSpace(JNIEnv* env, jobject javaSpace) {
//TODO: global ref? maybe not -> cleaning, rather callback class?
this->javaPhysicsSpace = env->NewWeakGlobalRef(javaSpace);
this->env = env;
env->GetJavaVM(&vm);
if (env->ExceptionCheck()) {
env->Throw(env->ExceptionOccurred());
return;
}
}
void jmePhysicsSpace::attachThread() {
#ifdef JNI_VERSION_1_2
vm->AttachCurrentThread((JNIEnv**) &env, NULL);
#else
vm->AttachCurrentThread(&env, NULL);
#endif
}
JNIEnv* jmePhysicsSpace::getEnv() {
attachThread();
return this->env;
}
void jmePhysicsSpace::stepSimulation(jfloat tpf, jint maxSteps, jfloat accuracy) {
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy);
}
btThreadSupportInterface* jmePhysicsSpace::createSolverThreadSupport(int maxNumThreads) {
#ifdef _WIN32
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", SolverThreadFunc, SolverlsMemoryFunc, maxNumThreads);
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
threadSupport->startSPU();
#elif defined (USE_PTHREADS)
PosixThreadSupport::ThreadConstructionInfo constructionInfo("collision", SolverThreadFunc,
SolverlsMemoryFunc, maxNumThreads);
PosixThreadSupport* threadSupport = new PosixThreadSupport(constructionInfo);
threadSupport->startSPU();
#else
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", SolverThreadFunc, SolverlsMemoryFunc);
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
threadSupport->startSPU();
#endif
return threadSupport;
}
btThreadSupportInterface* jmePhysicsSpace::createDispatchThreadSupport(int maxNumThreads) {
#ifdef _WIN32
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", processCollisionTask, createCollisionLocalStoreMemory, maxNumThreads);
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
threadSupport->startSPU();
#elif defined (USE_PTHREADS)
PosixThreadSupport::ThreadConstructionInfo solverConstructionInfo("solver", processCollisionTask,
createCollisionLocalStoreMemory, maxNumThreads);
PosixThreadSupport* threadSupport = new PosixThreadSupport(solverConstructionInfo);
threadSupport->startSPU();
#else
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", processCollisionTask, createCollisionLocalStoreMemory);
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
threadSupport->startSPU();
#endif
return threadSupport;
}
void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphaseId, jboolean threading) {
// collision configuration contains default setup for memory, collision setup
btDefaultCollisionConstructionInfo cci;
// if(threading){
// cci.m_defaultMaxPersistentManifoldPoolSize = 32768;
// }
btCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration(cci);
btVector3 min = btVector3(minX, minY, minZ);
btVector3 max = btVector3(maxX, maxY, maxZ);
btBroadphaseInterface* broadphase;
switch (broadphaseId) {
case 0:
broadphase = new btSimpleBroadphase();
break;
case 1:
broadphase = new btAxisSweep3(min, max);
break;
case 2:
//TODO: 32bit!
broadphase = new btAxisSweep3(min, max);
break;
case 3:
broadphase = new btDbvtBroadphase();
break;
case 4:
// broadphase = new btGpu3DGridBroadphase(
// min, max,
// 20, 20, 20,
// 10000, 1000, 25);
break;
}
btCollisionDispatcher* dispatcher;
btConstraintSolver* solver;
// use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
if (threading) {
btThreadSupportInterface* dispatchThreads = createDispatchThreadSupport(4);
dispatcher = new SpuGatheringCollisionDispatcher(dispatchThreads, 4, collisionConfiguration);
dispatcher->setDispatcherFlags(btCollisionDispatcher::CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION);
} else {
dispatcher = new btCollisionDispatcher(collisionConfiguration);
}
// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
if (threading) {
btThreadSupportInterface* solverThreads = createSolverThreadSupport(4);
solver = new btParallelConstraintSolver(solverThreads);
} else {
solver = new btSequentialImpulseConstraintSolver;
}
//create dynamics world
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
dynamicsWorld = world;
dynamicsWorld->setWorldUserInfo(this);
//parallel solver requires the contacts to be in a contiguous pool, so avoid dynamic allocation
if (threading) {
world->getSimulationIslandManager()->setSplitIslands(false);
world->getSolverInfo().m_numIterations = 4;
world->getSolverInfo().m_solverMode = SOLVER_SIMD + SOLVER_USE_WARMSTARTING; //+SOLVER_RANDMIZE_ORDER;
world->getDispatchInfo().m_enableSPU = true;
}
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
dynamicsWorld->setGravity(btVector3(0, -9.81f, 0));
struct jmeFilterCallback : public btOverlapFilterCallback {
// return true when pairs need collision
virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0, btBroadphaseProxy * proxy1) const {
// bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
// collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
if (collides) {
btCollisionObject* co0 = (btCollisionObject*) proxy0->m_clientObject;
btCollisionObject* co1 = (btCollisionObject*) proxy1->m_clientObject;
jmeUserPointer *up0 = (jmeUserPointer*) co0 -> getUserPointer();
jmeUserPointer *up1 = (jmeUserPointer*) co1 -> getUserPointer();
if (up0 != NULL && up1 != NULL) {
collides = (up0->group & up1->groups) != 0;
collides = collides && (up1->group & up0->groups);
//add some additional logic here that modified 'collides'
return collides;
}
return false;
}
return collides;
}
};
dynamicsWorld->getPairCache()->setOverlapFilterCallback(new jmeFilterCallback());
dynamicsWorld->setInternalTickCallback(&jmePhysicsSpace::preTickCallback, static_cast<void *> (this), true);
dynamicsWorld->setInternalTickCallback(&jmePhysicsSpace::postTickCallback, static_cast<void *> (this));
if (gContactProcessedCallback == NULL) {
gContactProcessedCallback = &jmePhysicsSpace::contactProcessedCallback;
}
}
void jmePhysicsSpace::preTickCallback(btDynamicsWorld *world, btScalar timeStep) {
jmePhysicsSpace* dynamicsWorld = (jmePhysicsSpace*) world->getWorldUserInfo();
JNIEnv* env = dynamicsWorld->getEnv();
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace());
if (javaPhysicsSpace != NULL) {
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_preTick, timeStep);
env->DeleteLocalRef(javaPhysicsSpace);
if (env->ExceptionCheck()) {
env->Throw(env->ExceptionOccurred());
return;
}
}
}
void jmePhysicsSpace::postTickCallback(btDynamicsWorld *world, btScalar timeStep) {
jmePhysicsSpace* dynamicsWorld = (jmePhysicsSpace*) world->getWorldUserInfo();
JNIEnv* env = dynamicsWorld->getEnv();
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace());
if (javaPhysicsSpace != NULL) {
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_postTick, timeStep);
env->DeleteLocalRef(javaPhysicsSpace);
if (env->ExceptionCheck()) {
env->Throw(env->ExceptionOccurred());
return;
}
}
}
bool jmePhysicsSpace::contactProcessedCallback(btManifoldPoint &cp, void *body0, void *body1) {
// printf("contactProcessedCallback %d %dn", body0, body1);
btCollisionObject* co0 = (btCollisionObject*) body0;
jmeUserPointer *up0 = (jmeUserPointer*) co0 -> getUserPointer();
btCollisionObject* co1 = (btCollisionObject*) body1;
jmeUserPointer *up1 = (jmeUserPointer*) co1 -> getUserPointer();
if (up0 != NULL) {
jmePhysicsSpace *dynamicsWorld = (jmePhysicsSpace *)up0->space;
if (dynamicsWorld != NULL) {
JNIEnv* env = dynamicsWorld->getEnv();
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace());
if (javaPhysicsSpace != NULL) {
jobject javaCollisionObject0 = env->NewLocalRef(up0->javaCollisionObject);
jobject javaCollisionObject1 = env->NewLocalRef(up1->javaCollisionObject);
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_addCollisionEvent, javaCollisionObject0, javaCollisionObject1, (jlong) & cp);
env->DeleteLocalRef(javaPhysicsSpace);
env->DeleteLocalRef(javaCollisionObject0);
env->DeleteLocalRef(javaCollisionObject1);
if (env->ExceptionCheck()) {
env->Throw(env->ExceptionOccurred());
return true;
}
}
}
}
return true;
}
btDynamicsWorld* jmePhysicsSpace::getDynamicsWorld() {
return dynamicsWorld;
}
jobject jmePhysicsSpace::getJavaPhysicsSpace() {
return javaPhysicsSpace;
}
jmePhysicsSpace::~jmePhysicsSpace() {
delete(dynamicsWorld);
}

@ -35,6 +35,10 @@
<os arch="x86_64" /> <os arch="x86_64" />
</condition> </condition>
<condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build">
<os family="windows" />
</condition>
<fileset id="lib.jars" dir="${bullet.lib.dir}"> <fileset id="lib.jars" dir="${bullet.lib.dir}">
<include name="**/*.jar"/> <include name="**/*.jar"/>
</fileset> </fileset>
@ -47,10 +51,12 @@
<fileset refid="lib.jme.jars"/> <fileset refid="lib.jme.jars"/>
</pathconvert> </pathconvert>
<target name="build-bullet-natives" description="builds the native bullet library for the platform being run on" depends="-create-folders, create-native-headers, -nativelib-osx, -nativelib-windows, -nativelib-linux, -nativelib-solaris"> <target name="build-bullet-natives" description="builds the native bullet library for the platform being run on" depends="">
<echo message="Updating native jME3-bullet-natives.jar"/> <echo message="Updating native jME3-bullet-natives.jar"/>
<zip basedir="${bullet.output.base}/jarcontent" file="${bullet.output.base}/jME3-bullet-natives.jar" compress="true"/> <zip basedir="${bullet.output.base}/jarcontent" file="${bullet.output.base}/jME3-bullet-natives.jar" compress="true"/>
<zip basedir="${bullet.output.base}/android" file="${bullet.output.base}/jME3-bullet-android-natives.jar" compress="true"/>
<copy file="${bullet.output.base}/jME3-bullet-natives.jar" todir="dist/opt/native-bullet/lib/"/> <copy file="${bullet.output.base}/jME3-bullet-natives.jar" todir="dist/opt/native-bullet/lib/"/>
<copy file="${bullet.output.base}/jME3-bullet-android-natives.jar" todir="dist/opt/native-bullet/lib/"/>
</target> </target>
<target name="create-native-headers" description="creates the native headers"> <target name="create-native-headers" description="creates the native headers">
@ -245,4 +251,59 @@
</cc> </cc>
<delete file="${bullet.output.dir}/windows/history.xml"/> <delete file="${bullet.output.dir}/windows/history.xml"/>
</target> </target>
<target name="-nativelib-android" depends="-check-android-ndk" if="haveAndoidNdk">
<!-- delete previous android jni, libs, and obj subdirectories for a clean start -->
<delete dir="build/bullet-android/jni" failonerror="false"/>
<delete dir="build/bullet-android/libs" failonerror="false"/>
<delete dir="build/bullet-android/obj" failonerror="false"/>
<!-- create the android subdirectory in jarcontent for the libbulletjme.so shared library -->
<mkdir dir="${bullet.output.dir}/../../android"/>
<!-- create the jni subdirectory -->
<mkdir dir="build/bullet-android/jni" />
<!-- copy Android.mk and Application.mk files into jni directory -->
<copy file="${bullet.source.dir}/android/Android.mk" todir="build/bullet-android/jni" verbose="true"/>
<copy file="${bullet.source.dir}/android/Application.mk" todir="build/bullet-android/jni" verbose="true"/>
<!-- copy edited version of jmePhysicsSpace to remove NDK compile error -->
<copy file="${bullet.source.dir}/android/jmePhysicsSpace.cpp" todir="build/bullet-android/jni" verbose="true"/>
<!-- copy jME3 Native Bullet files into jni directory -->
<copy todir="build/bullet-android/jni" verbose="true" flatten="false">
<fileset dir="${bullet.source.dir}">
<include name="*.cpp" />
<include name="*.h" />
<!-- skip jmePhysicsSpace (use edited one) to remove NDK compile error -->
<exclude name="jmePhysicsSpace.cpp" />
</fileset>
</copy>
<!-- copy Bullet-2.79 files into jni directory -->
<copy todir="build/bullet-android/jni" verbose="true" flatten="false">
<fileset dir="${bullet.bullet.include}">
<include name="**/*.cpp"/>
<include name="**/*.h"/>
<include name="**/*.cl"/>
</fileset>
</copy>
<exec executable="${ndk.dir}/${ndk-build-name}" failonerror="true" >
<arg line="-C build/bullet-android/"/>
</exec>
<!-- copy resulting library directories to jarcontent directory -->
<copy todir="${bullet.output.dir}/../../android" verbose="true" flatten="false">
<fileset dir="build/bullet-android/libs">
<include name="**/*.*"/>
<include name="**/*.*"/>
<!--exclude name="**/x86/*.*"/-->
</fileset>
</copy>
</target>
<target name="-check-android-ndk">
<available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/>
</target>
</project> </project>

@ -12,7 +12,7 @@ bullet.compile.debug=false
# native library compilation options # native library compilation options
bullet.osx.compiler=g++ bullet.osx.compiler=g++
bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.5u.sdk bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.6.sdk
# change this to msvc for MS Visual Studio compiler # change this to msvc for MS Visual Studio compiler
bullet.windows.compiler=g++ bullet.windows.compiler=g++
bullet.linux.compiler=g++ bullet.linux.compiler=g++
@ -22,6 +22,9 @@ bullet.java.include=${java.home}/../include
# OSX has no JRE, only JDK # OSX has no JRE, only JDK
bullet.osx.java.include=/System/Library/Frameworks/JavaVM.framework/Headers bullet.osx.java.include=/System/Library/Frameworks/JavaVM.framework/Headers
# location of Android NDK
ndk.dir=/opt/android-ndk-r7
# dont change these.. # dont change these..
bullet.bullet.include=${bullet.folder}/src bullet.bullet.include=${bullet.folder}/src
bullet.build.dir=build/bullet/ bullet.build.dir=build/bullet/

Loading…
Cancel
Save