Merge pull request #528 from riccardobl/bullet2.83.7
Update to Bullet 2.83.7
This commit is contained in:
commit
94c368aa42
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,6 +19,7 @@
|
|||||||
/jme3-*/build/
|
/jme3-*/build/
|
||||||
/jme3-bullet-native/bullet.zip
|
/jme3-bullet-native/bullet.zip
|
||||||
/jme3-bullet-native/bullet-2.82-r2704/
|
/jme3-bullet-native/bullet-2.82-r2704/
|
||||||
|
/jme3-bullet-native/bullet3-2.83.7/
|
||||||
/jme3-android-native/openal-soft/
|
/jme3-android-native/openal-soft/
|
||||||
/jme3-android-native/OpenALSoft.zip
|
/jme3-android-native/OpenALSoft.zip
|
||||||
/jme3-android-native/src/native/jme_decode/STBI/
|
/jme3-android-native/src/native/jme_decode/STBI/
|
||||||
|
@ -19,8 +19,8 @@ buildAndroidExamples = false
|
|||||||
ndkPath = /opt/android-ndk-r10c
|
ndkPath = /opt/android-ndk-r10c
|
||||||
|
|
||||||
# Path for downloading native Bullet
|
# Path for downloading native Bullet
|
||||||
bulletUrl = http://bullet.googlecode.com/files/bullet-2.82-r2704.zip
|
bulletUrl = https://github.com/bulletphysics/bullet3/archive/2.83.7.zip
|
||||||
bulletFolder = bullet-2.82-r2704
|
bulletFolder = bullet3-2.83.7
|
||||||
bulletZipFile = bullet.zip
|
bulletZipFile = bullet.zip
|
||||||
|
|
||||||
# Path for downloading NetBeans Base
|
# Path for downloading NetBeans Base
|
||||||
|
@ -27,12 +27,13 @@ model {
|
|||||||
source {
|
source {
|
||||||
srcDir 'src/native/cpp'
|
srcDir 'src/native/cpp'
|
||||||
srcDir bulletSrcPath
|
srcDir bulletSrcPath
|
||||||
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
|
exclude 'Bullet3OpenCL/**'
|
||||||
include '**/*.cpp'
|
include '**/*.cpp'
|
||||||
}
|
}
|
||||||
exportedHeaders {
|
exportedHeaders {
|
||||||
srcDir 'src/native/cpp'
|
srcDir 'src/native/cpp'
|
||||||
srcDir bulletSrcPath
|
srcDir bulletSrcPath
|
||||||
|
exclude 'Bullet3OpenCL/**'
|
||||||
include '**/*.h'
|
include '**/*.h'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,10 +85,14 @@ model {
|
|||||||
|
|
||||||
if (os == "osx") {
|
if (os == "osx") {
|
||||||
cppCompiler.args '-I', "$javaHome/include/darwin"
|
cppCompiler.args '-I', "$javaHome/include/darwin"
|
||||||
|
cppCompiler.args "-Ofast"
|
||||||
|
cppCompiler.args "-U_FORTIFY_SOURCE"
|
||||||
} else if (os == "linux") {
|
} else if (os == "linux") {
|
||||||
cppCompiler.args "-fvisibility=hidden"
|
cppCompiler.args "-fvisibility=hidden"
|
||||||
cppCompiler.args '-I', "$javaHome/include/linux"
|
cppCompiler.args '-I', "$javaHome/include/linux"
|
||||||
cppCompiler.args "-fPIC"
|
cppCompiler.args "-fPIC"
|
||||||
|
cppCompiler.args "-Ofast"
|
||||||
|
cppCompiler.args "-U_FORTIFY_SOURCE"
|
||||||
cppCompiler.args "-fpermissive"
|
cppCompiler.args "-fpermissive"
|
||||||
linker.args "-fvisibility=hidden"
|
linker.args "-fvisibility=hidden"
|
||||||
} else if (os == "windows") {
|
} else if (os == "windows") {
|
||||||
@ -99,6 +104,8 @@ model {
|
|||||||
}
|
}
|
||||||
cppCompiler.args "-fpermissive"
|
cppCompiler.args "-fpermissive"
|
||||||
cppCompiler.args "-static"
|
cppCompiler.args "-static"
|
||||||
|
cppCompiler.args "-Ofast"
|
||||||
|
cppCompiler.args "-U_FORTIFY_SOURCE"
|
||||||
linker.args "-static"
|
linker.args "-static"
|
||||||
linker.args "-Wl,--exclude-all-symbols"
|
linker.args "-Wl,--exclude-all-symbols"
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "jmePhysicsSpace.h"
|
#include "jmePhysicsSpace.h"
|
||||||
#include "jmeBulletUtil.h"
|
#include "jmeBulletUtil.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Normen Hansen
|
* Author: Normen Hansen
|
||||||
@ -66,49 +65,8 @@ void jmePhysicsSpace::stepSimulation(jfloat tpf, jint maxSteps, jfloat accuracy)
|
|||||||
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy);
|
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy);
|
||||||
}
|
}
|
||||||
|
|
||||||
btThreadSupportInterface* jmePhysicsSpace::createSolverThreadSupport(int maxNumThreads) {
|
void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphaseId, jboolean threading /*unused*/) {
|
||||||
#ifdef _WIN32
|
btCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||||
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 min = btVector3(minX, minY, minZ);
|
||||||
btVector3 max = btVector3(maxX, maxY, maxZ);
|
btVector3 max = btVector3(maxX, maxY, maxZ);
|
||||||
@ -129,50 +87,19 @@ void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ,
|
|||||||
case 3:
|
case 3:
|
||||||
broadphase = new btDbvtBroadphase();
|
broadphase = new btDbvtBroadphase();
|
||||||
break;
|
break;
|
||||||
case 4:
|
|
||||||
// broadphase = new btGpu3DGridBroadphase(
|
|
||||||
// min, max,
|
|
||||||
// 20, 20, 20,
|
|
||||||
// 10000, 1000, 25);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
btCollisionDispatcher* dispatcher;
|
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
|
||||||
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);
|
|
||||||
}
|
|
||||||
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
|
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
|
||||||
|
|
||||||
|
btConstraintSolver* solver = new btSequentialImpulseConstraintSolver();
|
||||||
// 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
|
//create dynamics world
|
||||||
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
||||||
dynamicsWorld = world;
|
dynamicsWorld = world;
|
||||||
dynamicsWorld->setWorldUserInfo(this);
|
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());
|
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
|
||||||
|
|
||||||
dynamicsWorld->setGravity(btVector3(0, -9.81f, 0));
|
dynamicsWorld->setGravity(btVector3(0, -9.81f, 0));
|
||||||
|
|
||||||
struct jmeFilterCallback : public btOverlapFilterCallback {
|
struct jmeFilterCallback : public btOverlapFilterCallback {
|
||||||
|
@ -36,15 +36,6 @@
|
|||||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||||
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
|
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
|
||||||
#include "BulletDynamics/Character/btKinematicCharacterController.h"
|
#include "BulletDynamics/Character/btKinematicCharacterController.h"
|
||||||
#ifdef _WIN32
|
|
||||||
#include "BulletMultiThreaded/Win32ThreadSupport.h"
|
|
||||||
#else
|
|
||||||
#include "BulletMultiThreaded/PosixThreadSupport.h"
|
|
||||||
#endif
|
|
||||||
#include "BulletMultiThreaded/btParallelConstraintSolver.h"
|
|
||||||
#include "BulletMultiThreaded/SpuGatheringCollisionDispatcher.h"
|
|
||||||
#include "BulletMultiThreaded/SpuCollisionTaskProcess.h"
|
|
||||||
#include "BulletMultiThreaded/SequentialThreadSupport.h"
|
|
||||||
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
|
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
|
||||||
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
|
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
|
||||||
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
|
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
|
||||||
@ -59,8 +50,6 @@ private:
|
|||||||
JavaVM* vm;
|
JavaVM* vm;
|
||||||
btDynamicsWorld* dynamicsWorld;
|
btDynamicsWorld* dynamicsWorld;
|
||||||
jobject javaPhysicsSpace;
|
jobject javaPhysicsSpace;
|
||||||
btThreadSupportInterface* createSolverThreadSupport(int);
|
|
||||||
btThreadSupportInterface* createDispatchThreadSupport(int);
|
|
||||||
void attachThread();
|
void attachThread();
|
||||||
public:
|
public:
|
||||||
jmePhysicsSpace(){};
|
jmePhysicsSpace(){};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user