mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 04:26:18 +02:00
DM users update
This commit is contained in:
parent
11a2ecab56
commit
b2dac6f53f
9 changed files with 19 additions and 18 deletions
|
@ -2051,7 +2051,7 @@ void Application::init() {
|
|||
DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
|
||||
|
||||
// initialize the GlowEffect with our widget
|
||||
DependencyManager::get<GlowEffect>()->init(glCanvas,
|
||||
DependencyManager::get<GlowEffect>()->init(glCanvas.data(),
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
|
||||
}
|
||||
|
||||
|
@ -4032,7 +4032,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>());
|
||||
scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
|
||||
scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance());
|
||||
scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
|
||||
|
|
|
@ -427,7 +427,7 @@ Menu::Menu() :
|
|||
appInstance,
|
||||
SLOT(setRenderVoxels(bool)));
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true,
|
||||
DependencyManager::get<GlowEffect>(), SLOT(toggleGlowEffect(bool)));
|
||||
DependencyManager::get<GlowEffect>().data(), SLOT(toggleGlowEffect(bool)));
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
||||
|
|
|
@ -24,8 +24,9 @@ class Animation;
|
|||
typedef QSharedPointer<Animation> AnimationPointer;
|
||||
|
||||
/// Scriptable interface for FBX animation loading.
|
||||
class AnimationCache : public ResourceCache, public DependencyManager::Dependency {
|
||||
class AnimationCache : public ResourceCache {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(AnimationCache)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); }
|
||||
|
@ -38,7 +39,6 @@ protected:
|
|||
private:
|
||||
AnimationCache(QObject* parent = NULL);
|
||||
virtual ~AnimationCache() { }
|
||||
friend class DependencyManager;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@ class ProgramObject;
|
|||
|
||||
/// A screen space ambient occlusion effect. See John Chapman's tutorial at
|
||||
/// http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html for reference.
|
||||
class AmbientOcclusionEffect: public DependencyManager::Dependency {
|
||||
class AmbientOcclusionEffect {
|
||||
SINGLETON_DEPENDENCY(AmbientOcclusionEffect)
|
||||
|
||||
public:
|
||||
|
||||
void init(ViewStateInterface* viewState);
|
||||
|
@ -29,7 +31,6 @@ public:
|
|||
private:
|
||||
AmbientOcclusionEffect() {}
|
||||
virtual ~AmbientOcclusionEffect() {}
|
||||
friend class DependencyManager;
|
||||
|
||||
ProgramObject* _occlusionProgram;
|
||||
int _nearLocation;
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
class PostLightingRenderable;
|
||||
|
||||
/// Handles deferred lighting for the bits that require it (voxels, metavoxels...)
|
||||
class DeferredLightingEffect: public DependencyManager::Dependency {
|
||||
class DeferredLightingEffect {
|
||||
SINGLETON_DEPENDENCY(DeferredLightingEffect)
|
||||
|
||||
public:
|
||||
|
||||
void init(ViewStateInterface* viewState);
|
||||
|
@ -73,7 +75,6 @@ public:
|
|||
private:
|
||||
DeferredLightingEffect() { }
|
||||
virtual ~DeferredLightingEffect() { }
|
||||
friend class DependencyManager;
|
||||
|
||||
class LightLocations {
|
||||
public:
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
// include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QWindow>
|
||||
|
||||
|
@ -157,7 +156,6 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
|
||||
QOpenGLFramebufferObject* destFBO = toTexture ?
|
||||
textureCache->getSecondaryFramebufferObject() : NULL;
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
if (!_enabled || _isEmpty) {
|
||||
// copy the primary to the screen
|
||||
if (destFBO && QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
|
||||
|
@ -165,7 +163,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
} else {
|
||||
maybeBind(destFBO);
|
||||
if (!destFBO) {
|
||||
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
|
||||
}
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
@ -212,8 +210,9 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
}
|
||||
maybeBind(destFBO);
|
||||
if (!destFBO) {
|
||||
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
_addSeparateProgram->bind();
|
||||
glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
|
||||
}
|
||||
_addSeparateProgram->bind();
|
||||
renderFullscreenQuad();
|
||||
_addSeparateProgram->release();
|
||||
maybeRelease(destFBO);
|
||||
|
|
|
@ -25,8 +25,9 @@ class QOpenGLFramebufferObject;
|
|||
class ProgramObject;
|
||||
|
||||
/// A generic full screen glow effect.
|
||||
class GlowEffect : public QObject, public DependencyManager::Dependency {
|
||||
class GlowEffect : public QObject {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(GlowEffect)
|
||||
|
||||
public:
|
||||
|
||||
|
@ -60,7 +61,6 @@ public slots:
|
|||
private:
|
||||
GlowEffect();
|
||||
virtual ~GlowEffect();
|
||||
friend class DependencyManager;
|
||||
|
||||
int getDeviceWidth() const;
|
||||
int getDeviceHeight() const;
|
||||
|
|
|
@ -255,7 +255,7 @@ void ScriptEngine::init() {
|
|||
registerGlobalObject("Quat", &_quatLibrary);
|
||||
registerGlobalObject("Vec3", &_vec3Library);
|
||||
registerGlobalObject("Uuid", &_uuidLibrary);
|
||||
registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>());
|
||||
registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
|
||||
|
||||
registerGlobalObject("Voxels", &_voxelsScriptingInterface);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ QSharedPointer<T> DependencyManager::get() {
|
|||
static T* instance = new T();
|
||||
|
||||
if (instance) {
|
||||
if (dynamic_cast<QObject*>(instance)) { // If this is a QOject, call deleteLater for destruction
|
||||
if (dynamic_cast<QObject*>(instance) != NULL) { // If this is a QOject, call deleteLater for destruction
|
||||
sharedPointer = QSharedPointer<T>(instance, &T::deleteLater);
|
||||
} else { // Otherwise use custom deleter to avoid issues between private destructor and QSharedPointer
|
||||
sharedPointer = QSharedPointer<T>(instance, &T::customDeleter);
|
||||
|
|
Loading…
Reference in a new issue