From 1f00174c026901ac33f00a794d38fd9bb5da3f13 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 27 May 2015 23:09:38 +0200 Subject: [PATCH] Use a btCollisionWorld instead of btDiscreteDynamicsWorld Slightly improves performance, since we no longer need to stepSimulation(). We don't use any Dynamics (yet). --- apps/openmw/CMakeLists.txt | 1 - apps/openmw/mwphysics/actor.cpp | 12 +-- apps/openmw/mwphysics/actor.hpp | 6 +- apps/openmw/mwphysics/physicssystem.cpp | 95 +++++++++++------------- apps/openmw/mwphysics/physicssystem.hpp | 6 +- apps/openmw/mwphysics/trace.cpp | 6 +- apps/openmw/mwphysics/trace.h | 6 +- apps/openmw/mwrender/bulletdebugdraw.cpp | 4 +- apps/openmw/mwrender/bulletdebugdraw.hpp | 6 +- cmake/FindBullet.cmake | 6 +- 10 files changed, 70 insertions(+), 78 deletions(-) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index d45e76f25..b4ecdd956 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -152,7 +152,6 @@ if (ANDROID) MyGUIEngineStatic cpufeatures BulletCollision - BulletDynamics LinearMath ) endif (ANDROID) diff --git a/apps/openmw/mwphysics/actor.cpp b/apps/openmw/mwphysics/actor.cpp index c47ecd17c..94d93e7d7 100644 --- a/apps/openmw/mwphysics/actor.cpp +++ b/apps/openmw/mwphysics/actor.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include @@ -17,12 +17,12 @@ namespace MWPhysics { -Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btDynamicsWorld* world) +Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btCollisionWorld* world) : mCanWaterWalk(false), mWalkingOnWater(false) , mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(false) , mInternalCollisionMode(true) , mExternalCollisionMode(true) - , mDynamicsWorld(world) + , mCollisionWorld(world) { mPtr = ptr; @@ -55,7 +55,7 @@ Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptrremoveCollisionObject(mCollisionObject.get()); + mCollisionWorld->removeCollisionObject(mCollisionObject.get()); } void Actor::enableCollisionMode(bool collision) @@ -74,13 +74,13 @@ void Actor::enableCollisionBody(bool collision) void Actor::updateCollisionMask() { - mDynamicsWorld->removeCollisionObject(mCollisionObject.get()); + mCollisionWorld->removeCollisionObject(mCollisionObject.get()); int collisionMask = CollisionType_World | CollisionType_HeightMap; if (mExternalCollisionMode) collisionMask |= CollisionType_Actor | CollisionType_Projectile; if (mCanWaterWalk) collisionMask |= CollisionType_Water; - mDynamicsWorld->addCollisionObject(mCollisionObject.get(), CollisionType_Actor, collisionMask); + mCollisionWorld->addCollisionObject(mCollisionObject.get(), CollisionType_Actor, collisionMask); } void Actor::updatePosition() diff --git a/apps/openmw/mwphysics/actor.hpp b/apps/openmw/mwphysics/actor.hpp index 60de42151..7a12f549d 100644 --- a/apps/openmw/mwphysics/actor.hpp +++ b/apps/openmw/mwphysics/actor.hpp @@ -9,7 +9,7 @@ #include #include -class btDynamicsWorld; +class btCollisionWorld; class btCollisionShape; class btCollisionObject; @@ -43,7 +43,7 @@ namespace MWPhysics class Actor : public PtrHolder { public: - Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btDynamicsWorld* world); + Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btCollisionWorld* world); ~Actor(); /** @@ -125,7 +125,7 @@ namespace MWPhysics bool mInternalCollisionMode; bool mExternalCollisionMode; - btDynamicsWorld* mDynamicsWorld; + btCollisionWorld* mCollisionWorld; Actor(const Actor&); Actor& operator=(const Actor&); diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index b706912ed..2bd88e634 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -12,9 +12,9 @@ #include #include #include +#include #include -#include -#include +#include #include #include @@ -65,7 +65,7 @@ namespace MWPhysics } static bool stepMove(btCollisionObject *colobj, osg::Vec3f &position, - const osg::Vec3f &toMove, float &remainingTime, btDynamicsWorld* dynamicsWorld) + const osg::Vec3f &toMove, float &remainingTime, btCollisionWorld* collisionWorld) { /* * Slide up an incline or set of stairs. Should be called only after a @@ -113,7 +113,7 @@ namespace MWPhysics */ ActorTracer tracer, stepper; - stepper.doTrace(colobj, position, position+osg::Vec3f(0.0f,0.0f,sStepSizeUp), dynamicsWorld); + stepper.doTrace(colobj, position, position+osg::Vec3f(0.0f,0.0f,sStepSizeUp), collisionWorld); if(stepper.mFraction < std::numeric_limits::epsilon()) return false; // didn't even move the smallest representable amount // (TODO: shouldn't this be larger? Why bother with such a small amount?) @@ -131,7 +131,7 @@ namespace MWPhysics * +--+ * ============================================== */ - tracer.doTrace(colobj, stepper.mEndPos, stepper.mEndPos + toMove, dynamicsWorld); + tracer.doTrace(colobj, stepper.mEndPos, stepper.mEndPos + toMove, collisionWorld); if(tracer.mFraction < std::numeric_limits::epsilon()) return false; // didn't even move the smallest representable amount @@ -150,7 +150,7 @@ namespace MWPhysics * +--+ +--+ * ============================================== */ - stepper.doTrace(colobj, tracer.mEndPos, tracer.mEndPos-osg::Vec3f(0.0f,0.0f,sStepSizeDown), dynamicsWorld); + stepper.doTrace(colobj, tracer.mEndPos, tracer.mEndPos-osg::Vec3f(0.0f,0.0f,sStepSizeDown), collisionWorld); if(stepper.mFraction < 1.0f && getSlope(stepper.mPlaneNormal) <= sMaxSlope) { // don't allow stepping up other actors @@ -191,12 +191,12 @@ namespace MWPhysics public: - static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, Actor* actor, btDynamicsWorld* dynamicsWorld, float maxHeight) + static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight) { osg::Vec3f position(ptr.getRefData().getPosition().asVec3()); ActorTracer tracer; - tracer.findGround(actor, position, position-osg::Vec3f(0,0,maxHeight), dynamicsWorld); + tracer.findGround(actor, position, position-osg::Vec3f(0,0,maxHeight), collisionWorld); if(tracer.mFraction >= 1.0f) { actor->setOnGround(false); @@ -214,7 +214,7 @@ namespace MWPhysics resultCallback1.m_collisionFilterGroup = 0xff; resultCallback1.m_collisionFilterMask = CollisionType_World|CollisionType_HeightMap; - dynamicsWorld->rayTest(from, to, resultCallback1); + collisionWorld->rayTest(from, to, resultCallback1); if (resultCallback1.hasHit() && ( (toOsg(resultCallback1.m_hitPointWorld) - tracer.mEndPos).length() > 30 || getSlope(tracer.mPlaneNormal) > sMaxSlope)) @@ -230,7 +230,7 @@ namespace MWPhysics } static osg::Vec3f move(const MWWorld::Ptr &ptr, Actor* physicActor, const osg::Vec3f &movement, float time, - bool isFlying, float waterlevel, float slowFall, btDynamicsWorld* dynamicsWorld + bool isFlying, float waterlevel, float slowFall, btCollisionWorld* collisionWorld , std::map& collisionTracker , std::map& standingCollisionTracker) { @@ -323,7 +323,7 @@ namespace MWPhysics if((newPosition - nextpos).length2() > 0.0001) { // trace to where character would go if there were no obstructions - tracer.doTrace(colobj, newPosition, nextpos, dynamicsWorld); + tracer.doTrace(colobj, newPosition, nextpos, collisionWorld); // check for obstructions if(tracer.mFraction >= 1.0f) @@ -358,12 +358,12 @@ namespace MWPhysics osg::Vec3f oldPosition = newPosition; // We hit something. Try to step up onto it. (NOTE: stepMove does not allow stepping over) // NOTE: stepMove modifies newPosition if successful - bool result = stepMove(colobj, newPosition, velocity*remainingTime, remainingTime, dynamicsWorld); + bool result = stepMove(colobj, newPosition, velocity*remainingTime, remainingTime, collisionWorld); if (!result) // to make sure the maximum stepping distance isn't framerate-dependent or movement-speed dependent { osg::Vec3f normalizedVelocity = velocity; normalizedVelocity.normalize(); - result = stepMove(colobj, newPosition, normalizedVelocity*10.f, remainingTime, dynamicsWorld); + result = stepMove(colobj, newPosition, normalizedVelocity*10.f, remainingTime, collisionWorld); } if(result) { @@ -401,7 +401,7 @@ namespace MWPhysics osg::Vec3f from = newPosition; osg::Vec3f to = newPosition - (physicActor->getOnGround() ? osg::Vec3f(0,0,sStepSizeDown+2.f) : osg::Vec3f(0,0,2.f)); - tracer.doTrace(colobj, from, to, dynamicsWorld); + tracer.doTrace(colobj, from, to, collisionWorld); if(tracer.mFraction < 1.0f && getSlope(tracer.mPlaneNormal) <= sMaxSlope && tracer.mHitObject->getBroadphaseHandle()->m_collisionFilterGroup != CollisionType_Actor) { @@ -549,7 +549,7 @@ namespace MWPhysics return mCollisionObject.get(); } - void animateCollisionShapes(btDynamicsWorld* dynamicsWorld) + void animateCollisionShapes(btCollisionWorld* collisionWorld) { if (mShapeInstance->mAnimatedShapes.empty()) return; @@ -587,7 +587,7 @@ namespace MWPhysics compound->updateChildTransform(shapeIndex, transform); } - dynamicsWorld->updateSingleAabb(mCollisionObject.get()); + collisionWorld->updateSingleAabb(mCollisionObject.get()); } private: @@ -607,33 +607,29 @@ namespace MWPhysics { mCollisionConfiguration = new btDefaultCollisionConfiguration(); mDispatcher = new btCollisionDispatcher(mCollisionConfiguration); - mSolver = new btSequentialImpulseConstraintSolver; mBroadphase = new btDbvtBroadphase(); - // Note we don't use any Dynamics at the moment - a btCollisionWorld might be sufficient? - mDynamicsWorld = new btDiscreteDynamicsWorld(mDispatcher,mBroadphase,mSolver,mCollisionConfiguration); + mCollisionWorld = new btCollisionWorld(mDispatcher, mBroadphase, mCollisionConfiguration); // Don't update AABBs of all objects every frame. Most objects in MW are static, so we don't need this. // Should a "static" object ever be moved, we have to update its AABB manually using DynamicsWorld::updateSingleAabb. - mDynamicsWorld->setForceUpdateAllAabbs(false); - - mDynamicsWorld->setGravity(btVector3(0,0,-10)); + mCollisionWorld->setForceUpdateAllAabbs(false); } PhysicsSystem::~PhysicsSystem() { if (mWaterCollisionObject.get()) - mDynamicsWorld->removeCollisionObject(mWaterCollisionObject.get()); + mCollisionWorld->removeCollisionObject(mWaterCollisionObject.get()); for (HeightFieldMap::iterator it = mHeightFields.begin(); it != mHeightFields.end(); ++it) { - mDynamicsWorld->removeCollisionObject(it->second->getCollisionObject()); + mCollisionWorld->removeCollisionObject(it->second->getCollisionObject()); delete it->second; } for (ObjectMap::iterator it = mObjects.begin(); it != mObjects.end(); ++it) { - mDynamicsWorld->removeCollisionObject(it->second->getCollisionObject()); + mCollisionWorld->removeCollisionObject(it->second->getCollisionObject()); delete it->second; } @@ -642,8 +638,7 @@ namespace MWPhysics delete it->second; } - delete mDynamicsWorld; - delete mSolver; + delete mCollisionWorld; delete mCollisionConfiguration; delete mDispatcher; delete mBroadphase; @@ -655,8 +650,8 @@ namespace MWPhysics if (mDebugDrawEnabled && !mDebugDrawer.get()) { - mDebugDrawer.reset(new MWRender::DebugDrawer(mParentNode, mDynamicsWorld)); - mDynamicsWorld->setDebugDrawer(mDebugDrawer.get()); + mDebugDrawer.reset(new MWRender::DebugDrawer(mParentNode, mCollisionWorld)); + mCollisionWorld->setDebugDrawer(mDebugDrawer.get()); mDebugDrawer->setDebugMode(mDebugDrawEnabled); } else if (mDebugDrawer.get()) @@ -727,7 +722,7 @@ namespace MWPhysics DeepestNotMeContactTestResultCallback resultCallback(me, toBullet(origin)); resultCallback.m_collisionFilterGroup = CollisionType_Actor; resultCallback.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap | CollisionType_Actor; - mDynamicsWorld->contactTest(&object, resultCallback); + mCollisionWorld->contactTest(&object, resultCallback); if (resultCallback.mObject) { @@ -761,7 +756,7 @@ namespace MWPhysics resultCallback.m_collisionFilterGroup = 0xff; resultCallback.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap; - mDynamicsWorld->rayTest(btFrom, btTo, resultCallback); + mCollisionWorld->rayTest(btFrom, btTo, resultCallback); if (resultCallback.hasHit()) { return std::make_pair(true, toOsg(resultCallback.m_hitPointWorld)); @@ -798,7 +793,7 @@ namespace MWPhysics ContactTestResultCallback resultCallback; resultCallback.m_collisionFilterGroup = collisionGroup; resultCallback.m_collisionFilterMask = collisionMask; - mDynamicsWorld->contactTest(me, resultCallback); + mCollisionWorld->contactTest(me, resultCallback); return resultCallback.mResult; } @@ -808,7 +803,7 @@ namespace MWPhysics if (found == mActors.end()) return ptr.getRefData().getPosition().asVec3(); else - return MovementSolver::traceDown(ptr, found->second, mDynamicsWorld, maxHeight); + return MovementSolver::traceDown(ptr, found->second, mCollisionWorld, maxHeight); } void PhysicsSystem::addHeightField (float* heights, int x, int y, float triSize, float sqrtVerts) @@ -816,7 +811,7 @@ namespace MWPhysics HeightField *heightfield = new HeightField(heights, x, y, triSize, sqrtVerts); mHeightFields[std::make_pair(x,y)] = heightfield; - mDynamicsWorld->addCollisionObject(heightfield->getCollisionObject(), CollisionType_HeightMap, + mCollisionWorld->addCollisionObject(heightfield->getCollisionObject(), CollisionType_HeightMap, CollisionType_Actor|CollisionType_Projectile); } @@ -825,7 +820,7 @@ namespace MWPhysics HeightFieldMap::iterator heightfield = mHeightFields.find(std::make_pair(x,y)); if(heightfield != mHeightFields.end()) { - mDynamicsWorld->removeCollisionObject(heightfield->second->getCollisionObject()); + mCollisionWorld->removeCollisionObject(heightfield->second->getCollisionObject()); delete heightfield->second; mHeightFields.erase(heightfield); } @@ -840,7 +835,7 @@ namespace MWPhysics Object *obj = new Object(ptr, shapeInstance); mObjects.insert(std::make_pair(ptr, obj)); - mDynamicsWorld->addCollisionObject(obj->getCollisionObject(), CollisionType_World, + mCollisionWorld->addCollisionObject(obj->getCollisionObject(), CollisionType_World, CollisionType_Actor|CollisionType_HeightMap|CollisionType_Projectile); } @@ -849,7 +844,7 @@ namespace MWPhysics ObjectMap::iterator found = mObjects.find(ptr); if (found != mObjects.end()) { - mDynamicsWorld->removeCollisionObject(found->second->getCollisionObject()); + mCollisionWorld->removeCollisionObject(found->second->getCollisionObject()); delete found->second; mObjects.erase(found); } @@ -898,14 +893,14 @@ namespace MWPhysics if (found != mObjects.end()) { found->second->setScale(scale); - mDynamicsWorld->updateSingleAabb(found->second->getCollisionObject()); + mCollisionWorld->updateSingleAabb(found->second->getCollisionObject()); return; } ActorMap::iterator foundActor = mActors.find(ptr); if (foundActor != mActors.end()) { foundActor->second->updateScale(); - // no aabb update needed (DISABLE_DEACTIVATION) + mCollisionWorld->updateSingleAabb(foundActor->second->getCollisionObject()); return; } } @@ -916,14 +911,14 @@ namespace MWPhysics if (found != mObjects.end()) { found->second->setRotation(toBullet(ptr.getRefData().getBaseNode()->getAttitude())); - mDynamicsWorld->updateSingleAabb(found->second->getCollisionObject()); + mCollisionWorld->updateSingleAabb(found->second->getCollisionObject()); return; } ActorMap::iterator foundActor = mActors.find(ptr); if (foundActor != mActors.end()) { foundActor->second->updateRotation(); - // no aabb update needed (DISABLE_DEACTIVATION) + mCollisionWorld->updateSingleAabb(foundActor->second->getCollisionObject()); return; } } @@ -934,14 +929,14 @@ namespace MWPhysics if (found != mObjects.end()) { found->second->setOrigin(toBullet(ptr.getRefData().getPosition().asVec3())); - mDynamicsWorld->updateSingleAabb(found->second->getCollisionObject()); + mCollisionWorld->updateSingleAabb(found->second->getCollisionObject()); return; } ActorMap::iterator foundActor = mActors.find(ptr); if (foundActor != mActors.end()) { foundActor->second->updatePosition(); - // no aabb update needed (DISABLE_DEACTIVATION) + mCollisionWorld->updateSingleAabb(foundActor->second->getCollisionObject()); return; } } @@ -950,7 +945,7 @@ namespace MWPhysics { osg::ref_ptr shapeInstance = mShapeManager->createInstance(mesh); - Actor* actor = new Actor(ptr, shapeInstance, mDynamicsWorld); + Actor* actor = new Actor(ptr, shapeInstance, mCollisionWorld); mActors.insert(std::make_pair(ptr, actor)); } @@ -1032,7 +1027,7 @@ namespace MWPhysics osg::Vec3f newpos = MovementSolver::move(iter->first, physicActor, iter->second, mTimeAccum, world->isFlying(iter->first), - waterlevel, slowFall, mDynamicsWorld, mCollisions, mStandingCollisions); + waterlevel, slowFall, mCollisionWorld, mCollisions, mStandingCollisions); float heightDiff = newpos.z() - oldHeight; @@ -1052,10 +1047,10 @@ namespace MWPhysics void PhysicsSystem::stepSimulation(float dt) { for (ObjectMap::iterator it = mObjects.begin(); it != mObjects.end(); ++it) - it->second->animateCollisionShapes(mDynamicsWorld); + it->second->animateCollisionShapes(mCollisionWorld); - // We have nothing to simulate, but character controllers aren't working without this call. Might be related to updating AABBs. - mDynamicsWorld->stepSimulation(static_cast(dt), 1, 1 / 60.0f); + CProfileManager::Reset(); + CProfileManager::Increment_Frame_Counter(); if (mDebugDrawer.get()) mDebugDrawer->step(); @@ -1153,7 +1148,7 @@ namespace MWPhysics { if (mWaterCollisionObject.get()) { - mDynamicsWorld->removeCollisionObject(mWaterCollisionObject.get()); + mCollisionWorld->removeCollisionObject(mWaterCollisionObject.get()); } if (!mWaterEnabled) @@ -1162,7 +1157,7 @@ namespace MWPhysics mWaterCollisionObject.reset(new btCollisionObject()); mWaterCollisionShape.reset(new btStaticPlaneShape(btVector3(0,0,1), mWaterHeight)); mWaterCollisionObject->setCollisionShape(mWaterCollisionShape.get()); - mDynamicsWorld->addCollisionObject(mWaterCollisionObject.get(), CollisionType_Water, + mCollisionWorld->addCollisionObject(mWaterCollisionObject.get(), CollisionType_Water, CollisionType_Actor); } } diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 75666acd7..841085f47 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -31,8 +31,7 @@ namespace Resource class ResourceSystem; } -class btSequentialImpulseConstraintSolver; -class btDiscreteDynamicsWorld; +class btCollisionWorld; class btBroadphaseInterface; class btDefaultCollisionConfiguration; class btCollisionDispatcher; @@ -127,9 +126,8 @@ namespace MWPhysics btBroadphaseInterface* mBroadphase; btDefaultCollisionConfiguration* mCollisionConfiguration; - btSequentialImpulseConstraintSolver* mSolver; btCollisionDispatcher* mDispatcher; - btDiscreteDynamicsWorld* mDynamicsWorld; + btCollisionWorld* mCollisionWorld; std::auto_ptr mShapeManager; diff --git a/apps/openmw/mwphysics/trace.cpp b/apps/openmw/mwphysics/trace.cpp index 79d4de1a0..94434b856 100644 --- a/apps/openmw/mwphysics/trace.cpp +++ b/apps/openmw/mwphysics/trace.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include @@ -50,7 +50,7 @@ protected: }; -void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, btDynamicsWorld* world) +void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world) { const btVector3 btstart = toBullet(start); const btVector3 btend = toBullet(end); @@ -89,7 +89,7 @@ void ActorTracer::doTrace(btCollisionObject *actor, const osg::Vec3f& start, con } } -void ActorTracer::findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, btDynamicsWorld* world) +void ActorTracer::findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world) { const btVector3 btstart(start.x(), start.y(), start.z()+1.0f); const btVector3 btend(end.x(), end.y(), end.z()+1.0f); diff --git a/apps/openmw/mwphysics/trace.h b/apps/openmw/mwphysics/trace.h index 02f9ebdd1..ef1a24d44 100644 --- a/apps/openmw/mwphysics/trace.h +++ b/apps/openmw/mwphysics/trace.h @@ -4,7 +4,7 @@ #include class btCollisionObject; -class btDynamicsWorld; +class btCollisionWorld; namespace MWPhysics @@ -19,8 +19,8 @@ namespace MWPhysics float mFraction; - void doTrace(btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, btDynamicsWorld* world); - void findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, btDynamicsWorld* world); + void doTrace(btCollisionObject *actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world); + void findGround(const Actor* actor, const osg::Vec3f& start, const osg::Vec3f& end, btCollisionWorld* world); }; } diff --git a/apps/openmw/mwrender/bulletdebugdraw.cpp b/apps/openmw/mwrender/bulletdebugdraw.cpp index 8ac8e3121..c6d7935c5 100644 --- a/apps/openmw/mwrender/bulletdebugdraw.cpp +++ b/apps/openmw/mwrender/bulletdebugdraw.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include @@ -21,7 +21,7 @@ namespace namespace MWRender { -DebugDrawer::DebugDrawer(osg::ref_ptr parentNode, btDynamicsWorld *world) +DebugDrawer::DebugDrawer(osg::ref_ptr parentNode, btCollisionWorld *world) : mParentNode(parentNode), mWorld(world), mDebugOn(true) diff --git a/apps/openmw/mwrender/bulletdebugdraw.hpp b/apps/openmw/mwrender/bulletdebugdraw.hpp index 66af2f565..1bccc20bd 100644 --- a/apps/openmw/mwrender/bulletdebugdraw.hpp +++ b/apps/openmw/mwrender/bulletdebugdraw.hpp @@ -7,7 +7,7 @@ #include -class btDynamicsWorld; +class btCollisionWorld; namespace osg { @@ -23,7 +23,7 @@ class DebugDrawer : public btIDebugDraw { protected: osg::ref_ptr mParentNode; - btDynamicsWorld *mWorld; + btCollisionWorld *mWorld; osg::ref_ptr mGeode; osg::ref_ptr mGeometry; osg::ref_ptr mVertices; @@ -36,7 +36,7 @@ protected: public: - DebugDrawer(osg::ref_ptr parentNode, btDynamicsWorld *world); + DebugDrawer(osg::ref_ptr parentNode, btCollisionWorld *world); ~DebugDrawer(); void step(); diff --git a/cmake/FindBullet.cmake b/cmake/FindBullet.cmake index b75f3105a..5204c00ce 100644 --- a/cmake/FindBullet.cmake +++ b/cmake/FindBullet.cmake @@ -54,8 +54,8 @@ find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h # Find the libraries -_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics) -_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d) +#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics) +#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d) _FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision) _FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_Debug BulletCollision_d) _FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY BulletMath LinearMath) @@ -71,7 +71,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR}) if(BULLET_FOUND) - _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY) + #_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY) _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY) _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY) endif()