openmw-tes3coop/libs/openengine/bullet/BulletShapeLoader.h
2015-05-09 01:06:55 +02:00

59 lines
1.4 KiB
C++

#ifndef OPENMW_BULLET_SHAPE_LOADER_H_
#define OPENMW_BULLET_SHAPE_LOADER_H_
#include <OgreResource.h>
#include <OgreResourceManager.h>
#include <btBulletCollisionCommon.h>
#include <OgreVector3.h>
#include <osg/Vec3f>
#include <osg/Quat>
namespace OEngine {
namespace Physic
{
/**
*Define a new resource which describe a Shape usable by bullet.See BulletShapeManager for how to get/use them.
*/
class BulletShape : public Ogre::Resource
{
protected:
void loadImpl();
void unloadImpl();
size_t calculateSize() const;
void deleteShape(btCollisionShape* shape);
public:
BulletShape(Ogre::ResourceManager *creator, const Ogre::String &name,
Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual = false,
Ogre::ManualResourceLoader *loader = 0);
virtual ~BulletShape();
// Stores animated collision shapes. If any collision nodes in the NIF are animated, then mCollisionShape
// will be a btCompoundShape (which consists of one or more child shapes).
// In this map, for each animated collision shape,
// we store the node's record index mapped to the child index of the shape in the btCompoundShape.
std::map<int, int> mAnimatedShapes;
btCollisionShape* mCollisionShape;
// Does this .nif have an autogenerated collision mesh?
bool mAutogenerated;
osg::Vec3f mBoxTranslation;
osg::Quat mBoxRotation;
};
/**
*
*/
typedef Ogre::SharedPtr<BulletShape> BulletShapePtr;
}
}
#endif