mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 12:32:36 +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
|
makefile
|
||||||
data
|
data
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
CMakeLists.txt.user
|
||||||
|
@ -69,7 +69,7 @@ btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 &v)
|
|||||||
|
|
||||||
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
{
|
{
|
||||||
cShape = static_cast<BulletShape *>(resource);
|
cShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
||||||
resourceName = cShape->getName();
|
resourceName = cShape->getName();
|
||||||
cShape->mCollide = false;
|
cShape->mCollide = false;
|
||||||
mBoundingBox = NULL;
|
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)
|
void ManualBulletShapeLoader::load(const std::string &name,const std::string &group)
|
||||||
{
|
{
|
||||||
// Check if the resource already exists
|
// 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())
|
if (!ptr.isNull())
|
||||||
return;
|
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.
|
*Load bulletShape from NIF files.
|
||||||
*/
|
*/
|
||||||
class ManualBulletShapeLoader : public BulletShapeLoader
|
class ManualBulletShapeLoader : public OEngine::Physic::BulletShapeLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
BulletShape* cShape;//current shape
|
OEngine::Physic::BulletShape* cShape;//current shape
|
||||||
btTriangleMesh *mTriMesh;
|
btTriangleMesh *mTriMesh;
|
||||||
btBoxShape *mBoundingBox;
|
btBoxShape *mBoundingBox;
|
||||||
btBvhTriangleMeshShape* currentShape;//the shape curently under construction
|
btBvhTriangleMeshShape* currentShape;//the shape curently under construction
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "BulletShapeLoader.h"
|
#include "BulletShapeLoader.h"
|
||||||
|
|
||||||
|
namespace OEngine {
|
||||||
|
namespace Physic
|
||||||
|
{
|
||||||
|
|
||||||
BulletShape::BulletShape(Ogre::ResourceManager* creator, const Ogre::String &name,
|
BulletShape::BulletShape(Ogre::ResourceManager* creator, const Ogre::String &name,
|
||||||
Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual,
|
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()
|
BulletShapeManager *BulletShapeManager::getSingletonPtr()
|
||||||
{
|
{
|
||||||
return msSingleton;
|
assert(sThis);
|
||||||
|
return sThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
BulletShapeManager &BulletShapeManager::getSingleton()
|
BulletShapeManager &BulletShapeManager::getSingleton()
|
||||||
{
|
{
|
||||||
assert(msSingleton);
|
assert(sThis);
|
||||||
return(*msSingleton);
|
return(*sThis);
|
||||||
}
|
}
|
||||||
|
|
||||||
BulletShapeManager::BulletShapeManager()
|
BulletShapeManager::BulletShapeManager()
|
||||||
@ -124,3 +127,6 @@ void BulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
|
|
||||||
void BulletShapeLoader::load(const std::string &name,const std::string &group)
|
void BulletShapeLoader::load(const std::string &name,const std::string &group)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
#include <OgreResourceManager.h>
|
#include <OgreResourceManager.h>
|
||||||
#include <btBulletCollisionCommon.h>
|
#include <btBulletCollisionCommon.h>
|
||||||
#include <OgreVector3.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.
|
*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.
|
*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!
|
*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:
|
protected:
|
||||||
|
|
||||||
@ -116,6 +118,8 @@ protected:
|
|||||||
const Ogre::String &group, bool isManual, Ogre::ManualResourceLoader *loader,
|
const Ogre::String &group, bool isManual, Ogre::ManualResourceLoader *loader,
|
||||||
const Ogre::NameValuePairList *createParams);
|
const Ogre::NameValuePairList *createParams);
|
||||||
|
|
||||||
|
static BulletShapeManager *sThis;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BulletShapeManager();
|
BulletShapeManager();
|
||||||
@ -139,4 +143,7 @@ public:
|
|||||||
virtual void load(const std::string &name,const std::string &group);
|
virtual void load(const std::string &name,const std::string &group);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user