Commit f0ecc092 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #1901 from paroj:ovisup

parents aaf46f1c ccd99930
...@@ -236,6 +236,8 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp ...@@ -236,6 +236,8 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
return ret; return ret;
} }
size_t numWindows() const { return mWindows.size(); }
void locateResources() CV_OVERRIDE void locateResources() CV_OVERRIDE
{ {
OgreBites::ApplicationContext::locateResources(); OgreBites::ApplicationContext::locateResources();
...@@ -277,9 +279,10 @@ class WindowSceneImpl : public WindowScene ...@@ -277,9 +279,10 @@ class WindowSceneImpl : public WindowScene
Ptr<Rectangle2D> bgplane; Ptr<Rectangle2D> bgplane;
Ogre::RenderTarget* depthRTT; Ogre::RenderTarget* depthRTT;
int flags;
public: public:
WindowSceneImpl(Ptr<Application> app, const String& _title, const Size& sz, int flags) WindowSceneImpl(Ptr<Application> app, const String& _title, const Size& sz, int _flags)
: title(_title), root(app->getRoot()), depthRTT(NULL) : title(_title), root(app->getRoot()), depthRTT(NULL), flags(_flags)
{ {
if (!app->sceneMgr) if (!app->sceneMgr)
{ {
...@@ -337,6 +340,25 @@ public: ...@@ -337,6 +340,25 @@ public:
rWin->addViewport(cam); rWin->addViewport(cam);
} }
~WindowSceneImpl()
{
if (flags & SCENE_SEPERATE)
{
MaterialManager::getSingleton().remove(bgplane->getMaterial());
bgplane.release();
String texName = sceneMgr->getName() + "_Background";
TextureManager::getSingleton().remove(texName, RESOURCEGROUP_NAME);
}
if(_app->sceneMgr == sceneMgr && (flags & SCENE_SEPERATE))
{
// this is the root window owning the context
CV_Assert(_app->numWindows() == 1 && "the first OVIS window must be deleted last");
_app->closeApp();
_app.release();
}
}
void setBackground(InputArray image) CV_OVERRIDE void setBackground(InputArray image) CV_OVERRIDE
{ {
CV_Assert(bgplane); CV_Assert(bgplane);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment