mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
fix BulletShapeLoader namespace
This commit is contained in:
parent
2be60041f3
commit
00a2de432a
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ Makefile
|
||||
makefile
|
||||
data
|
||||
*.kdev4
|
||||
CMakeLists.txt.user
|
||||
|
@ -69,7 +69,7 @@ btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 &v)
|
||||
|
||||
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||
{
|
||||
cShape = static_cast<BulletShape *>(resource);
|
||||
cShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
||||
resourceName = cShape->getName();
|
||||
cShape->mCollide = false;
|
||||
mBoundingBox = NULL;
|
||||
@ -314,8 +314,8 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape *shape, int flags
|
||||
void ManualBulletShapeLoader::load(const std::string &name,const std::string &group)
|
||||
{
|
||||
// Check if the resource already exists
|
||||
Ogre::ResourcePtr ptr = BulletShapeManager::getSingleton().getByName(name, group);
|
||||
Ogre::ResourcePtr ptr = OEngine::Physic::BulletShapeManager::getSingleton().getByName(name, group);
|
||||
if (!ptr.isNull())
|
||||
return;
|
||||
BulletShapeManager::getSingleton().create(name,group,true,this);
|
||||
OEngine::Physic::BulletShapeManager::getSingleton().create(name,group,true,this);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace NifBullet
|
||||
/**
|
||||
*Load bulletShape from NIF files.
|
||||
*/
|
||||
class ManualBulletShapeLoader : public BulletShapeLoader
|
||||
class ManualBulletShapeLoader : public OEngine::Physic::BulletShapeLoader
|
||||
{
|
||||
public:
|
||||
|
||||
@ -104,7 +104,7 @@ private:
|
||||
|
||||
|
||||
|
||||
BulletShape* cShape;//current shape
|
||||
OEngine::Physic::BulletShape* cShape;//current shape
|
||||
btTriangleMesh *mTriMesh;
|
||||
btBoxShape *mBoundingBox;
|
||||
btBvhTriangleMeshShape* currentShape;//the shape curently under construction
|
||||
|
@ -1,6 +1,8 @@
|
||||
#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,
|
||||
@ -64,17 +66,18 @@ size_t BulletShape::calculateSize() const
|
||||
|
||||
|
||||
//=============================================================================================================
|
||||
template<> BulletShapeManager *Ogre::Singleton<BulletShapeManager>::msSingleton = 0;
|
||||
BulletShapeManager *BulletShapeManager::sThis = 0;
|
||||
|
||||
BulletShapeManager *BulletShapeManager::getSingletonPtr()
|
||||
{
|
||||
return msSingleton;
|
||||
assert(sThis);
|
||||
return sThis;
|
||||
}
|
||||
|
||||
BulletShapeManager &BulletShapeManager::getSingleton()
|
||||
{
|
||||
assert(msSingleton);
|
||||
return(*msSingleton);
|
||||
assert(sThis);
|
||||
return(*sThis);
|
||||
}
|
||||
|
||||
BulletShapeManager::BulletShapeManager()
|
||||
@ -124,3 +127,6 @@ void BulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||
|
||||
void BulletShapeLoader::load(const std::string &name,const std::string &group)
|
||||
{}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,10 @@
|
||||
#include <OgreResourceManager.h>
|
||||
#include <btBulletCollisionCommon.h>
|
||||
#include <OgreVector3.h>
|
||||
//For some reason, Ogre Singleton cannot be used in another namespace, that's why there is no namespace here.
|
||||
//But the risk of name collision seems pretty low here.
|
||||
|
||||
namespace OEngine {
|
||||
namespace Physic
|
||||
{
|
||||
|
||||
/**
|
||||
*Define a new resource which describe a Shape usable by bullet.See BulletShapeManager for how to get/use them.
|
||||
@ -107,7 +109,7 @@ public:
|
||||
*Important Note: i have no idea of what happen if you try to load two time the same resource without unloading.
|
||||
*It won't crash, but it might lead to memory leaks(I don't know how Ogre handle this). So don't do it!
|
||||
*/
|
||||
class BulletShapeManager : public Ogre::ResourceManager, public Ogre::Singleton<BulletShapeManager>
|
||||
class BulletShapeManager : public Ogre::ResourceManager
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -116,6 +118,8 @@ protected:
|
||||
const Ogre::String &group, bool isManual, Ogre::ManualResourceLoader *loader,
|
||||
const Ogre::NameValuePairList *createParams);
|
||||
|
||||
static BulletShapeManager *sThis;
|
||||
|
||||
public:
|
||||
|
||||
BulletShapeManager();
|
||||
@ -139,4 +143,7 @@ public:
|
||||
virtual void load(const std::string &name,const std::string &group);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user