1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 09:36:37 +00:00

Fix crash when multiple scenewidgets were closed. BtOgre was destroying resources each time.

This commit is contained in:
cc9cii 2014-11-04 21:46:35 +11:00
parent 70b5d6857a
commit 37a050873c
2 changed files with 13 additions and 2 deletions

View File

@ -11,6 +11,8 @@
#include <components/nifbullet/bulletnifloader.hpp>
#include <openengine/bullet/BulletShapeLoader.h>
#include <OgreSceneNode.h>
#include <openengine/bullet/BtOgreExtras.h> // 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<Ogre::SceneManager *, Ogre::SceneNode *>::iterator it =

View File

@ -9,8 +9,6 @@
//#include <string>
//#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
//#include <boost/shared_ptr.hpp>
#include <OgreSceneNode.h>
#include <openengine/bullet/BtOgreExtras.h> // needs Ogre::SceneNode defined
//#include <OgreVector3.h>
//#include <OgreQuaternion.h>