diff --git a/apps/opencs/view/world/physicsengine.cpp b/apps/opencs/view/world/physicsengine.cpp index cdfc818a5..7e7078a0f 100644 --- a/apps/opencs/view/world/physicsengine.cpp +++ b/apps/opencs/view/world/physicsengine.cpp @@ -11,6 +11,8 @@ #include #include +#include +#include // needs Ogre::SceneNode defined // PLEASE NOTE: // @@ -199,6 +201,17 @@ namespace CSVWorld { delete (*iter).second; mDebugDrawers.erase(iter); + + // BtOgre::DebugDrawer destroys the resources leading to crashes in some + // situations. Workaround by recreating them each time. + if (!Ogre::ResourceGroupManager::getSingleton().resourceGroupExists("BtOgre")) + Ogre::ResourceGroupManager::getSingleton().createResourceGroup("BtOgre"); + if (!Ogre::MaterialManager::getSingleton().resourceExists("BtOgre/DebugLines")) + { + Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BtOgre/DebugLines", "BtOgre"); + mat->setReceiveShadows(false); + mat->setSelfIllumination(1,1,1); + } } std::map::iterator it = diff --git a/apps/opencs/view/world/physicsengine.hpp b/apps/opencs/view/world/physicsengine.hpp index 9d60fe5f1..b14d35820 100644 --- a/apps/opencs/view/world/physicsengine.hpp +++ b/apps/opencs/view/world/physicsengine.hpp @@ -9,8 +9,6 @@ //#include //#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" //#include -#include -#include // needs Ogre::SceneNode defined //#include //#include