Singleton wrapper for Ogre OverlaySystem.

loadfix
cc9cii 10 years ago
parent 57b337d368
commit 994420aa57

@ -0,0 +1,36 @@
#ifndef OPENCS_VIEW_OVERLAYSYSTEM_H
#define OPENCS_VIEW_OVERLAYSYSTEM_H
#include <OgreOverlaySystem.h>
namespace CSVRender
{
class OverlaySystem
{
Ogre::OverlaySystem *mOverlaySystem;
OverlaySystem() {
mOverlaySystem = new Ogre::OverlaySystem();
}
~OverlaySystem() {
delete mOverlaySystem;
}
OverlaySystem(OverlaySystem const&);
void operator=(OverlaySystem const&);
public:
static OverlaySystem &instance() {
static OverlaySystem mInstance;
return mInstance;
}
Ogre::OverlaySystem *get() {
return mOverlaySystem;
}
};
}
#endif // OPENCS_VIEW_OVERLAYSYSTEM_H

@ -11,18 +11,16 @@
#include <OgreCamera.h> #include <OgreCamera.h>
#include <OgreSceneNode.h> #include <OgreSceneNode.h>
#include <OgreViewport.h> #include <OgreViewport.h>
#include <OgreOverlaySystem.h>
#include "../widget/scenetoolmode.hpp" #include "../widget/scenetoolmode.hpp"
#include "../../model/settings/usersettings.hpp" #include "../../model/settings/usersettings.hpp"
#include "navigation.hpp" #include "navigation.hpp"
#include "lighting.hpp" #include "lighting.hpp"
#include "overlaysystem.hpp"
namespace CSVRender namespace CSVRender
{ {
Ogre::OverlaySystem *SceneWidget::mOverlaySystem = NULL;
SceneWidget::SceneWidget(QWidget *parent) SceneWidget::SceneWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, mCamera(NULL) , mCamera(NULL)
@ -62,8 +60,7 @@ namespace CSVRender
setLighting (&mLightingDay); setLighting (&mLightingDay);
if(!mOverlaySystem) mOverlaySystem = OverlaySystem::instance().get();
mOverlaySystem = new Ogre::OverlaySystem();
mSceneMgr->addRenderQueueListener(mOverlaySystem); mSceneMgr->addRenderQueueListener(mOverlaySystem);
QTimer *timer = new QTimer (this); QTimer *timer = new QTimer (this);

@ -97,7 +97,7 @@ namespace CSVRender
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow; Ogre::RenderWindow* mWindow;
Ogre::Viewport *mViewport; Ogre::Viewport *mViewport;
static Ogre::OverlaySystem *mOverlaySystem; Ogre::OverlaySystem *mOverlaySystem;
Navigation *mNavigation; Navigation *mNavigation;
Lighting *mLighting; Lighting *mLighting;

Loading…
Cancel
Save