mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Fix collision debug drawer (tcg)
This commit is contained in:
parent
627b866744
commit
5d403ebdd3
@ -186,6 +186,8 @@ namespace MWWorld
|
|||||||
|
|
||||||
mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine);
|
mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine);
|
||||||
|
|
||||||
|
mPhysEngine->setSceneManager(renderer.getScene());
|
||||||
|
|
||||||
mWeatherManager = new MWWorld::WeatherManager(mRendering);
|
mWeatherManager = new MWWorld::WeatherManager(mRendering);
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@ -892,6 +894,8 @@ namespace MWWorld
|
|||||||
Ogre::Vector3 vec = mPhysics->move(player->first, player->second, duration, !isSwimming(player->first));
|
Ogre::Vector3 vec = mPhysics->move(player->first, player->second, duration, !isSwimming(player->first));
|
||||||
moveObjectImp(player->first, vec.x, vec.y, vec.z);
|
moveObjectImp(player->first, vec.x, vec.y, vec.z);
|
||||||
}
|
}
|
||||||
|
// the only purpose this has currently is to update the debug drawer
|
||||||
|
mPhysEngine->stepSimulation (duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::toggleCollisionMode()
|
bool World::toggleCollisionMode()
|
||||||
|
@ -207,7 +207,7 @@ public:
|
|||||||
|
|
||||||
mLineDrawer->setMaterial("BtOgre/DebugLines");
|
mLineDrawer->setMaterial("BtOgre/DebugLines");
|
||||||
|
|
||||||
mLineDrawer->setVisibilityFlags (1024);
|
//mLineDrawer->setVisibilityFlags (1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
~DebugDrawer()
|
~DebugDrawer()
|
||||||
|
@ -191,10 +191,7 @@ namespace Physic
|
|||||||
{
|
{
|
||||||
if(!isDebugCreated)
|
if(!isDebugCreated)
|
||||||
{
|
{
|
||||||
Ogre::SceneManagerEnumerator::SceneManagerIterator iter = Ogre::Root::getSingleton().getSceneManagerIterator();
|
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
|
||||||
iter.begin();
|
|
||||||
Ogre::SceneManager* scn = iter.getNext();
|
|
||||||
Ogre::SceneNode* node = scn->getRootSceneNode()->createChildSceneNode();
|
|
||||||
node->pitch(Ogre::Degree(-90));
|
node->pitch(Ogre::Degree(-90));
|
||||||
mDebugDrawer = new BtOgre::DebugDrawer(node, dynamicsWorld);
|
mDebugDrawer = new BtOgre::DebugDrawer(node, dynamicsWorld);
|
||||||
dynamicsWorld->setDebugDrawer(mDebugDrawer);
|
dynamicsWorld->setDebugDrawer(mDebugDrawer);
|
||||||
@ -219,6 +216,11 @@ namespace Physic
|
|||||||
return mDebugActive;
|
return mDebugActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhysicEngine::setSceneManager(Ogre::SceneManager* sceneMgr)
|
||||||
|
{
|
||||||
|
mSceneMgr = sceneMgr;
|
||||||
|
}
|
||||||
|
|
||||||
PhysicEngine::~PhysicEngine()
|
PhysicEngine::~PhysicEngine()
|
||||||
{
|
{
|
||||||
HeightFieldContainer::iterator hf_it = mHeightFieldMap.begin();
|
HeightFieldContainer::iterator hf_it = mHeightFieldMap.begin();
|
||||||
@ -471,7 +473,8 @@ namespace Physic
|
|||||||
|
|
||||||
void PhysicEngine::stepSimulation(double deltaT)
|
void PhysicEngine::stepSimulation(double deltaT)
|
||||||
{
|
{
|
||||||
dynamicsWorld->stepSimulation(deltaT,10, 1/60.0);
|
// This isn't needed as there are no dynamic objects at this point
|
||||||
|
//dynamicsWorld->stepSimulation(deltaT,10, 1/60.0);
|
||||||
if(isDebugCreated)
|
if(isDebugCreated)
|
||||||
{
|
{
|
||||||
mDebugDrawer->step();
|
mDebugDrawer->step();
|
||||||
@ -494,7 +497,6 @@ namespace Physic
|
|||||||
|
|
||||||
void PhysicEngine::removeCharacter(const std::string &name)
|
void PhysicEngine::removeCharacter(const std::string &name)
|
||||||
{
|
{
|
||||||
//std::cout << "remove";
|
|
||||||
PhysicActorContainer::iterator it = PhysicActorMap.find(name);
|
PhysicActorContainer::iterator it = PhysicActorMap.find(name);
|
||||||
if (it != PhysicActorMap.end() )
|
if (it != PhysicActorMap.end() )
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,11 @@ namespace BtOgre
|
|||||||
class DebugDrawer;
|
class DebugDrawer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class SceneManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class World;
|
class World;
|
||||||
@ -269,6 +274,8 @@ namespace Physic
|
|||||||
|
|
||||||
void getObjectAABB(const std::string &mesh, float scale, btVector3 &min, btVector3 &max);
|
void getObjectAABB(const std::string &mesh, float scale, btVector3 &min, btVector3 &max);
|
||||||
|
|
||||||
|
void setSceneManager(Ogre::SceneManager* sceneMgr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the closest object hit by a ray. If there are no objects, it will return ("",-1).
|
* Return the closest object hit by a ray. If there are no objects, it will return ("",-1).
|
||||||
*/
|
*/
|
||||||
@ -305,6 +312,8 @@ namespace Physic
|
|||||||
typedef std::map<std::string, PhysicActor*> PhysicActorContainer;
|
typedef std::map<std::string, PhysicActor*> PhysicActorContainer;
|
||||||
PhysicActorContainer PhysicActorMap;
|
PhysicActorContainer PhysicActorMap;
|
||||||
|
|
||||||
|
Ogre::SceneManager* mSceneMgr;
|
||||||
|
|
||||||
//debug rendering
|
//debug rendering
|
||||||
BtOgre::DebugDrawer* mDebugDrawer;
|
BtOgre::DebugDrawer* mDebugDrawer;
|
||||||
bool isDebugCreated;
|
bool isDebugCreated;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user