Bullet include cleanup

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

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

@ -6,6 +6,15 @@
#include <osg/PositionAttitudeTransform>
#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/bulletnifloader.hpp>
@ -600,6 +609,8 @@ namespace MWPhysics
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);
// 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 <btBulletCollisionCommon.h>
#include <osg/ref_ptr>
#include "../mwworld/ptr.hpp"
@ -35,6 +33,11 @@ namespace Resource
class btSequentialImpulseConstraintSolver;
class btDiscreteDynamicsWorld;
class btBroadphaseInterface;
class btDefaultCollisionConfiguration;
class btCollisionDispatcher;
class btCollisionObject;
class btCollisionShape;
namespace MWPhysics
{

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

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

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

@ -6,6 +6,11 @@
#include <iostream>
#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 "../nif/niffile.hpp"
@ -36,6 +41,21 @@ btVector3 getbtVector(const osg::Vec3f &v)
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()
: mCompoundShape(NULL)
, mStaticMesh(NULL)

@ -6,10 +6,6 @@
#include <set>
#include <iostream>
#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/BoundingBox>
@ -18,6 +14,10 @@
#include <components/nif/niffile.hpp>
class btTriangleMesh;
class btCompoundShape;
class btCollisionShape;
namespace Nif
{
class Node;
@ -70,22 +70,6 @@ private:
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.
*/

Loading…
Cancel
Save