#include "BulletShapeLoader.h" namespace OEngine { namespace Physic { BulletShape::BulletShape(Ogre::ResourceManager* creator, const Ogre::String &name, Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual, Ogre::ManualResourceLoader *loader) : Ogre::Resource(creator, name, handle, group, isManual, loader) { /* If you were storing a pointer to an object, then you would set that pointer to NULL here. */ /* For consistency with StringInterface, but we don't add any parameters here That's because the Resource implementation of StringInterface is to list all the options that need to be set before loading, of which we have none as such. Full details can be set through scripts. */ mCollisionShape = NULL; mAutogenerated = true; createParamDictionary("BulletShape"); } BulletShape::~BulletShape() { deleteShape(mCollisionShape); } // farm out to BulletShapeLoader void BulletShape::loadImpl() { mLoader->loadResource(this); } void BulletShape::deleteShape(btCollisionShape* shape) { if(shape!=NULL) { if(shape->isCompound()) { btCompoundShape* ms = static_cast(shape); int a = ms->getNumChildShapes(); for(int i=0; i getChildShape(i)); } } delete shape; } } void BulletShape::unloadImpl() { deleteShape(mCollisionShape); mCollisionShape = NULL; } //TODO:change this? size_t BulletShape::calculateSize() const { return 1; } } }