Bullet include cleanup

c++11
scrawl 10 years ago
parent 723beb1cac
commit fe439e53ff

@ -2,12 +2,14 @@
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include <btBulletCollisionCommon.h> #include <BulletCollision/CollisionShapes/btCylinderShape.h>
#include <BulletCollision/CollisionShapes/btBoxShape.h>
#include "../mwworld/class.hpp" #include <BulletDynamics/Dynamics/btDynamicsWorld.h>
#include <components/nifbullet/bulletnifloader.hpp> #include <components/nifbullet/bulletnifloader.hpp>
#include "../mwworld/class.hpp"
#include "convert.hpp" #include "convert.hpp"
#include "collisiontype.hpp" #include "collisiontype.hpp"

@ -6,6 +6,15 @@
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h> #include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
#include <BulletCollision/CollisionShapes/btConeShape.h>
#include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
#include <BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h>
#include <BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
#include <BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
#include <components/nifbullet/bulletshapemanager.hpp> #include <components/nifbullet/bulletshapemanager.hpp>
#include <components/nifbullet/bulletnifloader.hpp> #include <components/nifbullet/bulletnifloader.hpp>
@ -600,6 +609,8 @@ namespace MWPhysics
mDispatcher = new btCollisionDispatcher(mCollisionConfiguration); mDispatcher = new btCollisionDispatcher(mCollisionConfiguration);
mSolver = new btSequentialImpulseConstraintSolver; mSolver = new btSequentialImpulseConstraintSolver;
mBroadphase = new btDbvtBroadphase(); 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); mDynamicsWorld = new btDiscreteDynamicsWorld(mDispatcher,mBroadphase,mSolver,mCollisionConfiguration);
// Don't update AABBs of all objects every frame. Most objects in MW are static, so we don't need this. // Don't update AABBs of all objects every frame. Most objects in MW are static, so we don't need this.

@ -5,8 +5,6 @@
#include <OgreVector3.h> #include <OgreVector3.h>
#include <btBulletCollisionCommon.h>
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
@ -35,6 +33,11 @@ namespace Resource
class btSequentialImpulseConstraintSolver; class btSequentialImpulseConstraintSolver;
class btDiscreteDynamicsWorld; class btDiscreteDynamicsWorld;
class btBroadphaseInterface;
class btDefaultCollisionConfiguration;
class btCollisionDispatcher;
class btCollisionObject;
class btCollisionShape;
namespace MWPhysics namespace MWPhysics
{ {

@ -2,8 +2,9 @@
#include <map> #include <map>
#include <btBulletDynamicsCommon.h> #include <BulletDynamics/Dynamics/btDynamicsWorld.h>
#include <btBulletCollisionCommon.h> #include <BulletCollision/CollisionShapes/btConvexShape.h>
#include <BulletCollision/CollisionShapes/btCylinderShape.h>
#include "collisiontype.hpp" #include "collisiontype.hpp"
#include "actor.hpp" #include "actor.hpp"

@ -2,6 +2,8 @@
#include <iostream> #include <iostream>
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
#include <osg/Geode> #include <osg/Geode>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Group> #include <osg/Group>

@ -1,12 +1,14 @@
#ifndef OPENMW_MWRENDER_BULLETDEBUGDRAW_H #ifndef OPENMW_MWRENDER_BULLETDEBUGDRAW_H
#define OPENMW_MWRENDER_BULLETDEBUGDRAW_H #define OPENMW_MWRENDER_BULLETDEBUGDRAW_H
#include "btBulletDynamicsCommon.h"
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Array> #include <osg/Array>
#include <osg/PrimitiveSet> #include <osg/PrimitiveSet>
#include <LinearMath/btIDebugDraw.h>
class btDynamicsWorld;
namespace osg namespace osg
{ {
class Group; class Group;

@ -6,6 +6,11 @@
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>
#include <BulletCollision/CollisionShapes/btBoxShape.h>
#include <BulletCollision/CollisionShapes/btTriangleMesh.h>
#include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include "../nif/niffile.hpp" #include "../nif/niffile.hpp"
@ -36,6 +41,21 @@ btVector3 getbtVector(const osg::Vec3f &v)
namespace NifBullet namespace NifBullet
{ {
// Subclass btBhvTriangleMeshShape to auto-delete the meshInterface
struct TriangleMeshShape : public btBvhTriangleMeshShape
{
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression)
: btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression)
{
}
virtual ~TriangleMeshShape()
{
delete getTriangleInfoMap();
delete m_meshInterface;
}
};
BulletNifLoader::BulletNifLoader() BulletNifLoader::BulletNifLoader()
: mCompoundShape(NULL) : mCompoundShape(NULL)
, mStaticMesh(NULL) , mStaticMesh(NULL)

@ -6,10 +6,6 @@
#include <set> #include <set>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h>
#include <BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h>
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
#include <btBulletDynamicsCommon.h>
#include <osg/Matrixf> #include <osg/Matrixf>
#include <osg/BoundingBox> #include <osg/BoundingBox>
@ -18,6 +14,10 @@
#include <components/nif/niffile.hpp> #include <components/nif/niffile.hpp>
class btTriangleMesh;
class btCompoundShape;
class btCollisionShape;
namespace Nif namespace Nif
{ {
class Node; class Node;
@ -70,22 +70,6 @@ private:
osg::ref_ptr<BulletShape> mSource; osg::ref_ptr<BulletShape> mSource;
}; };
// Subclass btBhvTriangleMeshShape to auto-delete the meshInterface
struct TriangleMeshShape : public btBvhTriangleMeshShape
{
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression)
: btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression)
{
}
virtual ~TriangleMeshShape()
{
delete getTriangleInfoMap();
delete m_meshInterface;
}
};
/** /**
*Load bulletShape from NIF files. *Load bulletShape from NIF files.
*/ */

Loading…
Cancel
Save