mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-01 04:20:20 +00:00
67 lines
1.5 KiB
C++
67 lines
1.5 KiB
C++
#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<btCompoundShape*>(shape);
|
|
int a = ms->getNumChildShapes();
|
|
for(int i=0; i <a;i++)
|
|
{
|
|
deleteShape(ms->getChildShape(i));
|
|
}
|
|
}
|
|
delete shape;
|
|
}
|
|
}
|
|
|
|
void BulletShape::unloadImpl()
|
|
{
|
|
deleteShape(mCollisionShape);
|
|
mCollisionShape = NULL;
|
|
}
|
|
|
|
//TODO:change this?
|
|
size_t BulletShape::calculateSize() const
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
}
|