From 83a9a164bcba46a32c3f5dfc4e408e9b2bf2c323 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 15 Feb 2016 00:27:39 +0100 Subject: [PATCH] Raise the required bullet version to 2.83 2.82 appears to have a bug that causes the player to be able to phase through certain objects (bug #1587). --- apps/openmw/mwphysics/physicssystem.cpp | 16 ---------------- components/resource/bulletshape.cpp | 14 -------------- components/resource/bulletshapemanager.hpp | 6 ++++++ 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 8d4c2c590..784910d51 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -765,18 +765,11 @@ namespace MWPhysics mLeastDistSqr(std::numeric_limits::max()) { } -#if BT_BULLET_VERSION >= 281 virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* col0Wrap,int partId0,int index0, const btCollisionObjectWrapper* col1Wrap,int partId1,int index1) { const btCollisionObject* collisionObject = col1Wrap->m_collisionObject; -#else - virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* col0, int partId0, int index0, - const btCollisionObject* col1, int partId1, int index1) - { - const btCollisionObject* collisionObject = col1; -#endif if (collisionObject != mMe) { btScalar distsqr = mOrigin.distance2(cp.getPositionWorldOnA()); @@ -1026,7 +1019,6 @@ namespace MWPhysics std::vector mResult; -#if BT_BULLET_VERSION >= 281 virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* col0Wrap,int partId0,int index0, const btCollisionObjectWrapper* col1Wrap,int partId1,int index1) @@ -1034,14 +1026,6 @@ namespace MWPhysics const btCollisionObject* collisionObject = col0Wrap->m_collisionObject; if (collisionObject == mTestedAgainst) collisionObject = col1Wrap->m_collisionObject; -#else - virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* col0, int partId0, int index0, - const btCollisionObject* col1, int partId1, int index1) - { - const btCollisionObject* collisionObject = col0; - if (collisionObject == mTestedAgainst) - collisionObject = col1; -#endif PtrHolder* holder = static_cast(collisionObject->getUserPointer()); if (holder) mResult.push_back(holder->getPtr()); diff --git a/components/resource/bulletshape.cpp b/components/resource/bulletshape.cpp index 6855429c3..dbdbf0c6e 100644 --- a/components/resource/bulletshape.cpp +++ b/components/resource/bulletshape.cpp @@ -65,21 +65,7 @@ btCollisionShape* BulletShape::duplicateCollisionShape(const btCollisionShape *s if(const btBvhTriangleMeshShape* trishape = dynamic_cast(shape)) { -#if BT_BULLET_VERSION >= 283 btScaledBvhTriangleMeshShape* newShape = new btScaledBvhTriangleMeshShape(const_cast(trishape), btVector3(1.f, 1.f, 1.f)); -#else - // work around btScaledBvhTriangleMeshShape bug ( https://code.google.com/p/bullet/issues/detail?id=371 ) in older bullet versions - const btTriangleMesh* oldMesh = static_cast(trishape->getMeshInterface()); - btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh); - - // Do not build a new bvh (not needed, since it's the same as the original shape's bvh) - btOptimizedBvh* bvh = const_cast(trishape)->getOptimizedBvh(); - TriangleMeshShape* newShape = new TriangleMeshShape(newMesh, true, bvh == NULL); - // Set original shape's bvh via pointer - // The pointer is safe because the BulletShapeInstance keeps a ref_ptr to the original BulletShape - if (bvh) - newShape->setOptimizedBvh(bvh); -#endif return newShape; } diff --git a/components/resource/bulletshapemanager.hpp b/components/resource/bulletshapemanager.hpp index 14b26962b..3fe351f90 100644 --- a/components/resource/bulletshapemanager.hpp +++ b/components/resource/bulletshapemanager.hpp @@ -6,9 +6,15 @@ #include +#include + #include "bulletshape.hpp" #include "resourcemanager.hpp" +#if BT_BULLET_VERSION < 283 +#error "OpenMW requires Bullet version 2.83 or later" +#endif + namespace Resource { class SceneManager;