mirror of
https://github.com/lubosz/overte.git
synced 2025-08-27 20:46:32 +02:00
Replace RenderScriptingInterface with dynamic Task::Config
This commit is contained in:
parent
adc9d2ea07
commit
9064438bf0
3 changed files with 5 additions and 211 deletions
|
@ -102,7 +102,6 @@
|
|||
#include <RenderShadowTask.h>
|
||||
#include <RenderDeferredTask.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <RenderScriptingInterface.h>
|
||||
#include <SceneScriptingInterface.h>
|
||||
#include <RecordingScriptingInterface.h>
|
||||
#include <ScriptCache.h>
|
||||
|
@ -363,7 +362,6 @@ bool setupEssentials(int& argc, char** argv) {
|
|||
#endif
|
||||
DependencyManager::set<DiscoverabilityManager>();
|
||||
DependencyManager::set<SceneScriptingInterface>();
|
||||
DependencyManager::set<RenderScriptingInterface>();
|
||||
DependencyManager::set<OffscreenUi>();
|
||||
DependencyManager::set<AutoUpdater>();
|
||||
DependencyManager::set<PathUtils>();
|
||||
|
@ -1250,8 +1248,7 @@ void Application::initializeUi() {
|
|||
rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data());
|
||||
rootContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||
rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||
rootContext->setContextProperty("Render", DependencyManager::get<RenderScriptingInterface>().data());
|
||||
// TODO: Expose Engine here
|
||||
rootContext->setContextProperty("Render", _renderEngine->getConfiguration().get());
|
||||
|
||||
_glWidget->installEventFilter(offscreenUi.data());
|
||||
offscreenUi->setMouseTranslator([=](const QPointF& pt) {
|
||||
|
@ -3769,19 +3766,14 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
{
|
||||
PerformanceTimer perfTimer("EngineRun");
|
||||
|
||||
auto renderInterface = DependencyManager::get<RenderScriptingInterface>();
|
||||
auto renderContext = renderInterface->getRenderContext();
|
||||
|
||||
renderArgs->_viewFrustum = getDisplayViewFrustum();
|
||||
renderContext.setArgs(renderArgs);
|
||||
auto renderContext = _renderEngine->getRenderContext();
|
||||
renderContext->setArgs(renderArgs);
|
||||
|
||||
bool occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion);
|
||||
bool shadowStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugShadows);
|
||||
bool antialiasingStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing);
|
||||
bool showOwnedStatus = Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned);
|
||||
renderContext.setOptions(occlusionStatus, antialiasingStatus, showOwnedStatus, shadowStatus);
|
||||
|
||||
_renderEngine->setRenderContext(renderContext);
|
||||
|
||||
// Before the deferred pass, let's try to use the render engine
|
||||
myAvatar->startRenderRun();
|
||||
|
@ -3789,8 +3781,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
myAvatar->endRenderRun();
|
||||
|
||||
auto engineContext = _renderEngine->getRenderContext();
|
||||
renderInterface->setItemCounts(engineContext->getItemsConfig());
|
||||
renderInterface->setJobGPUTimes(engineContext->getAmbientOcclusion().gpuTime);
|
||||
//zzmp renderInterface->setJobGPUTimes(engineContext->getAmbientOcclusion().gpuTime);
|
||||
|
||||
}
|
||||
|
||||
|
@ -4200,8 +4191,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0);
|
||||
|
||||
scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||
scriptEngine->registerGlobalObject("Render", DependencyManager::get<RenderScriptingInterface>().data());
|
||||
scriptEngine->registerGlobalObject("Engine", _renderEngine->getConfiguration().get());
|
||||
scriptEngine->registerGlobalObject("Render", _renderEngine->getConfiguration().get());
|
||||
|
||||
scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
//
|
||||
// RenderScriptingInterface.cpp
|
||||
// libraries/render-utils
|
||||
//
|
||||
// Created by Zach Pomerantz on 12/16/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "RenderScriptingInterface.h"
|
||||
|
||||
RenderScriptingInterface::RenderScriptingInterface() {};
|
||||
|
||||
void RenderScripting::Tone::setCurve(const QString& curve) {
|
||||
if (curve == QString("None")) {
|
||||
toneCurve = 0;
|
||||
} else if (curve == QString("Gamma22")) {
|
||||
toneCurve = 1;
|
||||
} else if (curve == QString("Reinhard")) {
|
||||
toneCurve = 2;
|
||||
} else if (curve == QString("Filmic")) {
|
||||
toneCurve = 3;
|
||||
}
|
||||
}
|
||||
|
||||
QString RenderScripting::Tone::getCurve() const {
|
||||
switch (toneCurve) {
|
||||
case 0:
|
||||
return QString("None");
|
||||
case 1:
|
||||
return QString("Gamma22");
|
||||
case 2:
|
||||
return QString("Reinhard");
|
||||
case 3:
|
||||
return QString("Filmic");
|
||||
default:
|
||||
return QString("Filmic");
|
||||
};
|
||||
}
|
||||
|
||||
render::RenderContext RenderScriptingInterface::getRenderContext() {
|
||||
render::RenderContext::ItemsConfig items{ *_opaque, *_transparent, *_overlay3D };
|
||||
return render::RenderContext{ items, *_tone, *_ambientOcclusion, _drawStatus, _drawHitEffect, _deferredDebugSize, _deferredDebugMode };
|
||||
}
|
||||
|
||||
void RenderScriptingInterface::setItemCounts(const render::RenderContext::ItemsConfig& items) {
|
||||
_opaque->setCounts(items.opaque);
|
||||
_transparent->setCounts(items.transparent);
|
||||
_overlay3D->setCounts(items.overlay3D);
|
||||
}
|
||||
|
||||
void RenderScriptingInterface::setJobGPUTimes(double aoTime) {
|
||||
_ambientOcclusion->gpuTime = aoTime;
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
//
|
||||
// RenderScriptingInterface.h
|
||||
// libraries/render-utils
|
||||
//
|
||||
// Created by Zach Pomerantz on 12/16/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_RenderScriptingInterface_h
|
||||
#define hifi_RenderScriptingInterface_h
|
||||
|
||||
#include <qscriptengine.h> // QObject
|
||||
#include <DependencyManager.h> // Dependency
|
||||
|
||||
#include "render/Engine.h"
|
||||
|
||||
namespace RenderScripting {
|
||||
using State = render::RenderContext::ItemsConfig::State;
|
||||
using Counter = render::RenderContext::ItemsConfig::Counter;
|
||||
|
||||
class ItemCounter : public QObject, public Counter {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(int numFeed READ getNumFeed)
|
||||
Q_PROPERTY(int numDrawn READ getNumDrawn)
|
||||
Q_PROPERTY(int maxDrawn MEMBER maxDrawn)
|
||||
|
||||
protected:
|
||||
int getNumFeed() const { return numFeed; }
|
||||
int getNumDrawn() const { return numDrawn; }
|
||||
};
|
||||
using ItemCounterPointer = std::unique_ptr<ItemCounter>;
|
||||
|
||||
class ItemState : public QObject, public State {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(bool render MEMBER render)
|
||||
Q_PROPERTY(bool cull MEMBER cull)
|
||||
Q_PROPERTY(bool sort MEMBER sort)
|
||||
|
||||
Q_PROPERTY(int numFeed READ getNumFeed)
|
||||
Q_PROPERTY(int numDrawn READ getNumDrawn)
|
||||
Q_PROPERTY(int maxDrawn MEMBER maxDrawn)
|
||||
|
||||
protected:
|
||||
int getNumFeed() const { return numFeed; }
|
||||
int getNumDrawn() const { return numDrawn; }
|
||||
};
|
||||
using ItemStatePointer = std::unique_ptr<ItemState>;
|
||||
|
||||
class Tone : public QObject, public render::RenderContext::Tone {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(float exposure MEMBER exposure)
|
||||
Q_PROPERTY(QString curve READ getCurve WRITE setCurve)
|
||||
|
||||
QString getCurve() const;
|
||||
int getCurveValue() const { return toneCurve; }
|
||||
void setCurve(const QString& curve);
|
||||
};
|
||||
using TonePointer = std::unique_ptr<Tone>;
|
||||
|
||||
class AmbientOcclusion : public QObject, public render::RenderContext::AmbientOcclusion {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(int resolutionLevel MEMBER resolutionLevel)
|
||||
Q_PROPERTY(float radius MEMBER radius)
|
||||
Q_PROPERTY(float level MEMBER level)
|
||||
Q_PROPERTY(int numSamples MEMBER numSamples)
|
||||
Q_PROPERTY(float numSpiralTurns MEMBER numSpiralTurns)
|
||||
Q_PROPERTY(bool ditheringEnabled MEMBER ditheringEnabled)
|
||||
Q_PROPERTY(float falloffBias MEMBER falloffBias)
|
||||
Q_PROPERTY(float edgeSharpness MEMBER edgeSharpness)
|
||||
Q_PROPERTY(int blurRadius MEMBER blurRadius)
|
||||
Q_PROPERTY(float blurDeviation MEMBER blurDeviation)
|
||||
Q_PROPERTY(double gpuTime MEMBER gpuTime)
|
||||
};
|
||||
using AmbientOcclusionPointer = std::unique_ptr<AmbientOcclusion>;
|
||||
};
|
||||
|
||||
class RenderScriptingInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
Q_PROPERTY(RenderScripting::ItemState* opaque READ getOpaque)
|
||||
Q_PROPERTY(RenderScripting::ItemState* transparent READ getTransparent)
|
||||
Q_PROPERTY(RenderScripting::ItemCounter* overlay3D READ getOverlay3D)
|
||||
|
||||
Q_PROPERTY(RenderScripting::Tone* tone READ getTone)
|
||||
Q_PROPERTY(RenderScripting::AmbientOcclusion* ambientOcclusion READ getAmbientOcclusion)
|
||||
|
||||
Q_PROPERTY(int displayItemStatus MEMBER _drawStatus)
|
||||
Q_PROPERTY(bool displayHitEffect MEMBER _drawHitEffect)
|
||||
|
||||
Q_PROPERTY(int deferredDebugMode MEMBER _deferredDebugMode)
|
||||
Q_PROPERTY(glm::vec4 deferredDebugSize MEMBER _deferredDebugSize)
|
||||
|
||||
render::RenderContext getRenderContext();
|
||||
void setItemCounts(const render::RenderContext::ItemsConfig& items);
|
||||
|
||||
// FIXME: It is ugly, we need a cleaner solution
|
||||
void setJobGPUTimes(double aoTime);
|
||||
|
||||
protected:
|
||||
RenderScriptingInterface();
|
||||
~RenderScriptingInterface() {};
|
||||
|
||||
RenderScripting::ItemState* getOpaque() const { return _opaque.get(); }
|
||||
RenderScripting::ItemState* getTransparent() const { return _transparent.get(); }
|
||||
RenderScripting::ItemCounter* getOverlay3D() const { return _overlay3D.get(); }
|
||||
|
||||
RenderScripting::Tone* getTone() const { return _tone.get(); }
|
||||
RenderScripting::AmbientOcclusion* getAmbientOcclusion() const { return _ambientOcclusion.get(); }
|
||||
|
||||
RenderScripting::ItemStatePointer _opaque = RenderScripting::ItemStatePointer{new RenderScripting::ItemState{}};
|
||||
RenderScripting::ItemStatePointer _transparent = RenderScripting::ItemStatePointer{new RenderScripting::ItemState{}};
|
||||
RenderScripting::ItemCounterPointer _overlay3D = RenderScripting::ItemCounterPointer{new RenderScripting::ItemCounter{}};
|
||||
|
||||
RenderScripting::TonePointer _tone = RenderScripting::TonePointer{ new RenderScripting::Tone{} };
|
||||
|
||||
RenderScripting::AmbientOcclusionPointer _ambientOcclusion = RenderScripting::AmbientOcclusionPointer{ new RenderScripting::AmbientOcclusion{} };
|
||||
|
||||
// Options
|
||||
int _drawStatus = 0;
|
||||
bool _drawHitEffect = false;
|
||||
|
||||
// Debugging
|
||||
int _deferredDebugMode = -1;
|
||||
glm::vec4 _deferredDebugSize { 0.0f, -1.0f, 1.0f, 1.0f };
|
||||
};
|
||||
|
||||
#endif // hifi_RenderScriptingInterface_h
|
Loading…
Reference in a new issue