From b243475cc99013311fae965b1ba4a70f5c505bc1 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 1 Sep 2017 15:32:23 -0700 Subject: [PATCH] New stuff for better rendering f ui --- interface/src/ui/overlays/Web3DOverlay.cpp | 1 + .../render-utils/src/AntialiasingEffect.cpp | 28 ++++++- .../render-utils/src/AntialiasingEffect.h | 6 +- libraries/render-utils/src/taa.slf | 2 +- libraries/render-utils/src/taa.slh | 2 +- .../lib/styles-uit/HifiConstants.qmlc | Bin 51304 -> 51304 bytes .../utilities/render/antialiasing.qml | 70 +++++++++++------- 7 files changed, 80 insertions(+), 29 deletions(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 104082dee4..cb25480a09 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -255,6 +255,7 @@ void Web3DOverlay::loadSourceURL() { _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance()); + _webSurface->getSurfaceContext()->setContextProperty("Render", AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get()); _webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../"); diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index a61b4172a0..8a19e9c5cb 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -389,6 +389,32 @@ void JitterSampleConfig::setIndex(int current) { emit dirty(); } +int JitterSampleConfig::cycleStopPauseRun() { + _state = (_state + 1) % 3; + switch (_state) { + case 0: { + stop = true; + freeze = false; + setIndex(-1); + break; + } + case 1: { + stop = false; + freeze = true; + setIndex(0); + break; + } + case 2: + default: { + stop = false; + freeze = false; + setIndex(0); + break; + } + } + return _state; +} + int JitterSampleConfig::pause() { freeze = true; emit dirty(); @@ -447,7 +473,7 @@ JitterSample::SampleSequence::SampleSequence(){ void JitterSample::configure(const Config& config) { _freeze = config.freeze; - if (_freeze) { + if (config.stop || _freeze) { auto pausedIndex = config.getIndex(); if (_jitterBuffer->currentIndex != pausedIndex) { _jitterBuffer.edit().currentIndex = pausedIndex; diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index b981704602..9e10673369 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -23,27 +23,31 @@ class JitterSampleConfig : public render::Job::Config { Q_OBJECT Q_PROPERTY(float scale MEMBER scale NOTIFY dirty) Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty) + Q_PROPERTY(bool stop MEMBER stop NOTIFY dirty) Q_PROPERTY(int index READ getIndex NOTIFY dirty) public: JitterSampleConfig() : render::Job::Config(true) {} float scale{ 0.5f }; + bool stop{ false }; bool freeze{ false }; void setIndex(int current); public slots: + int cycleStopPauseRun(); int pause(); int prev(); int next(); int play(); int getIndex() const { return _index; } - + int getState() const { return _state; } signals: void dirty(); private: + int _state{ 0 }; int _index{ 0 }; }; diff --git a/libraries/render-utils/src/taa.slf b/libraries/render-utils/src/taa.slf index 01c8942aee..be2a40ba3f 100644 --- a/libraries/render-utils/src/taa.slf +++ b/libraries/render-utils/src/taa.slf @@ -49,5 +49,5 @@ void main() { nextColor = taa_temporalReprojection(sourceColor, historyColor, fragUV, fragVel, nearFragUV.z, fragJitterPix); } - outFragColor = vec4(nextColor, 1.0); + outFragColor = vec4(taa_resolveColor(nextColor), 1.0); } diff --git a/libraries/render-utils/src/taa.slh b/libraries/render-utils/src/taa.slh index eee1aaed5f..cb2df97790 100644 --- a/libraries/render-utils/src/taa.slh +++ b/libraries/render-utils/src/taa.slh @@ -273,7 +273,7 @@ vec3 taa_temporalReprojection(vec3 sourceColor, vec3 historyColor, vec2 fragUV, // output vec3 nextColor = mix(texel1, texel0, k_feedback).xyz; - return taa_resolveColor(nextColor); + return nextColor; } <$declareColorWheel()$> diff --git a/scripts/developer/utilities/lib/styles-uit/HifiConstants.qmlc b/scripts/developer/utilities/lib/styles-uit/HifiConstants.qmlc index 369d4444878f60a092189d56d24fd586c7a0c747..a11d8cf029dcb2a16ad80b66aa3ac76475f0233e 100644 GIT binary patch delta 104 zcmaDcf%(M*W}U(^ljM}dl0-oU1_nk>R))Potmk4G85nG;85nAuW^T0qCvEb_ZFTsZ z_rd2k>inow4Q60qNMp!k$YDrjuwu{$!(=eaogtHR)%vaax!s@3=B5a3=DU@Bo!xd$^}mDUF9x# zN&L=6ogbB&p$rTRX$+YRISi=`Rt)-Jm<(olFl2&df*4X63K;Sydsek?zEU;C7XT#3 B9RmOW diff --git a/scripts/developer/utilities/render/antialiasing.qml b/scripts/developer/utilities/render/antialiasing.qml index b4b20d48bd..e6c0b0db79 100644 --- a/scripts/developer/utilities/render/antialiasing.qml +++ b/scripts/developer/utilities/render/antialiasing.qml @@ -13,7 +13,7 @@ import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 import "../lib/styles-uit" -//import "../../controls-uit" as HifiControls +import "../lib/controls-uit" as HifiControls import "configSlider" @@ -32,7 +32,7 @@ Rectangle { Column{ spacing: 10 - ConfigSlider { + HifiControls.ConfigSlider { label: qsTr("Source blend") integral: false config: Render.getConfig("RenderMainView.Antialiasing") @@ -48,45 +48,68 @@ Rectangle { max: 1.0 min: 0.0 } + Separator {} Row { spacing: 10 - CheckBox { - text: "Unjitter" - checked: Render.getConfig("RenderMainView.Antialiasing")["unjitter"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["unjitter"] = checked } + + HifiControls.Button { + text: { + var state = 2 - (Render.getConfig("RenderMainView.JitterCam").freeze * 1 - Render.getConfig("RenderMainView.JitterCam").stop * 2); + if (state === 2) { + return ">>" + } else if (state === 1) { + return "|" + Render.getConfig("RenderMainView.JitterCam").index + "|" + } else { + return "[]" + } + } + onClicked: { Render.getConfig("RenderMainView.JitterCam").cycleStopPauseRun(); } } - CheckBox { - text: "Freeze " - checked: Render.getConfig("RenderMainView.JitterCam")["freeze"] - onCheckedChanged: { Render.getConfig("RenderMainView.JitterCam")["freeze"] = checked } - } - Text { - text: Render.getConfig("RenderMainView.JitterCam").index - } - Button { + HifiControls.Button { text: "<" onClicked: { Render.getConfig("RenderMainView.JitterCam").prev(); } } - Button { + HifiControls.Button { text: ">" onClicked: { Render.getConfig("RenderMainView.JitterCam").next(); } } } Row { spacing: 10 - CheckBox { + HifiControls.CheckBox { + boxSize: 20 + text: "Unjitter" + checked: Render.getConfig("RenderMainView.Antialiasing")["unjitter"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["unjitter"] = checked } + } + HifiControls.CheckBox { + boxSize: 20 + text: "Show Sequence" + checked: Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] = checked } + } + } + Separator {} + Row { + spacing: 10 + HifiControls.CheckBox { + boxSize: 20 text: "Constrain color" checked: Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] = checked } } } Row { - CheckBox { + + spacing: 10 + HifiControls.CheckBox { + boxSize: 20 text: "Debug" checked: Render.getConfig("RenderMainView.Antialiasing")["debug"] onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked } } - CheckBox { + HifiControls.CheckBox { + boxSize: 20 text: "Show Debug Cursor" checked: Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] = checked } @@ -109,12 +132,9 @@ Rectangle { min: 0.0 } Row { - CheckBox { - text: "Jitter Sequence" - checked: Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] = checked } - } - CheckBox { + + HifiControls.CheckBox { + boxSize: 20 text: "Closest Fragment" checked: Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] = checked }