Updated debugAmbientOcclussionPass script to tablet app

This commit is contained in:
Olivier Prat 2018-04-11 17:21:44 +02:00
parent d8f0cfa89a
commit 5978158358
2 changed files with 151 additions and 50 deletions

View file

@ -7,40 +7,60 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
// //
import QtQuick 2.5 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
import "configSlider" import "configSlider"
import "../lib/plotperf" import "../lib/plotperf"
Column { Rectangle {
spacing: 8 HifiConstants { id: hifi;}
id: render;
anchors.margins: hifi.dimensions.contentMargin.x
color: hifi.colors.baseGray;
Column { Column {
id: surfaceGeometry id: surfaceGeometry
spacing: 10 spacing: 10
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: hifi.dimensions.contentMargin.x
Column{ Repeater {
Repeater { model: [
model: [ "Radius:radius:2.0:false",
"Radius:radius:2.0:false", "Level:obscuranceLevel:1.0:false",
"Level:obscuranceLevel:1.0:false", "Num Taps:numSamples:32:true",
"Num Taps:numSamples:32:true", "Taps Spiral:numSpiralTurns:10.0:false",
"Taps Spiral:numSpiralTurns:10.0:false", "Falloff Bias:falloffBias:0.2:false",
"Falloff Bias:falloffBias:0.2:false", "Edge Sharpness:edgeSharpness:1.0:false",
"Edge Sharpness:edgeSharpness:1.0:false", "Blur Radius:blurRadius:10.0:false",
"Blur Radius:blurRadius:10.0:false", ]
] ConfigSlider {
ConfigSlider { label: qsTr(modelData.split(":")[0])
label: qsTr(modelData.split(":")[0]) integral: (modelData.split(":")[3] == 'true')
integral: (modelData.split(":")[3] == 'true') config: Render.getConfig("RenderMainView.AmbientOcclusion")
config: Render.getConfig("RenderMainView.AmbientOcclusion") property: modelData.split(":")[1]
property: modelData.split(":")[1] max: modelData.split(":")[2]
max: modelData.split(":")[2] min: 0.0
min: 0.0 width: 280
} height:38
} }
} }
Row{ Row{
spacing: 10
anchors.left: parent.left
anchors.right: parent.right
Column { Column {
spacing: 10
Repeater { Repeater {
model: [ model: [
"resolutionLevel:resolutionLevel", "resolutionLevel:resolutionLevel",
@ -48,19 +68,24 @@ Column {
"fetchMipsEnabled:fetchMipsEnabled", "fetchMipsEnabled:fetchMipsEnabled",
"borderingEnabled:borderingEnabled" "borderingEnabled:borderingEnabled"
] ]
CheckBox { HifiControls.CheckBox {
boxSize: 20
text: qsTr(modelData.split(":")[0]) text: qsTr(modelData.split(":")[0])
checked: Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]] checked: Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]] = checked } onCheckedChanged: { Render.getConfig("RenderMainView.AmbientOcclusion")[modelData.split(":")[1]] = checked }
} }
} }
} }
Column { Column {
spacing: 10
Repeater { Repeater {
model: [ model: [
"debugEnabled:showCursorPixel" "debugEnabled:showCursorPixel"
] ]
CheckBox { HifiControls.CheckBox {
boxSize: 20
text: qsTr(modelData.split(":")[0]) text: qsTr(modelData.split(":")[0])
checked: Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]] checked: Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]] = checked } onCheckedChanged: { Render.getConfig("RenderMainView.DebugAmbientOcclusion")[modelData.split(":")[1]] = checked }
@ -70,6 +95,8 @@ Column {
} }
PlotPerf { PlotPerf {
anchors.left: parent.left
anchors.right: parent.right
title: "Timing" title: "Timing"
height: 50 height: 50
object: Render.getConfig("RenderMainView.AmbientOcclusion") object: Render.getConfig("RenderMainView.AmbientOcclusion")

View file

@ -1,38 +1,112 @@
// //
// debugSurfaceGeometryPass.js // debugAmbientOcclusionPass.js
// developer/utilities/render
// //
// Created by Sam Gateau on 6/6/2016 // Olivier Prat, created on 11/04/2018.
// Copyright 2016 High Fidelity, Inc. // Copyright 2017 High Fidelity, Inc.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
// Set up the qml ui (function() {
var qml = Script.resolvePath('ambientOcclusionPass.qml'); "use strict";
var window = new OverlayWindow({
title: 'Ambient Occlusion Pass',
source: qml,
width: 400, height: 300,
});
window.setPosition(Window.innerWidth - 420, 50 + 550 + 50);
window.closed.connect(function() { Script.stop(); });
var TABLET_BUTTON_NAME = "SSAO";
var QMLAPP_URL = Script.resolvePath("./ambientOcclusionPass.qml");
var ICON_URL = Script.resolvePath("../../../system/assets/images/ssao-i.svg");
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/ssao-a.svg");
var moveDebugCursor = false; Script.include([
Controller.mousePressEvent.connect(function (e) { Script.resolvePath("../../../system/libraries/stringHelpers.js"),
if (e.isMiddleButton) { ]);
moveDebugCursor = true;
setDebugCursor(e.x, e.y); var onScreen = false;
function onClicked() {
if (onScreen) {
tablet.gotoHomeScreen();
} else {
tablet.loadQMLSource(QMLAPP_URL);
}
} }
});
Controller.mouseReleaseEvent.connect(function() { moveDebugCursor = false; }); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); }); var button = tablet.addButton({
text: TABLET_BUTTON_NAME,
icon: ICON_URL,
activeIcon: ACTIVE_ICON_URL
});
var hasEventBridge = false;
function wireEventBridge(on) {
if (!tablet) {
print("Warning in wireEventBridge(): 'tablet' undefined!");
return;
}
if (on) {
if (!hasEventBridge) {
tablet.fromQml.connect(fromQml);
hasEventBridge = true;
}
} else {
if (hasEventBridge) {
tablet.fromQml.disconnect(fromQml);
hasEventBridge = false;
}
}
}
function onScreenChanged(type, url) {
if (url === QMLAPP_URL) {
onScreen = true;
} else {
onScreen = false;
}
button.editProperties({isActive: onScreen});
wireEventBridge(onScreen);
}
function fromQml(message) {
}
button.clicked.connect(onClicked);
tablet.screenChanged.connect(onScreenChanged);
Script.scriptEnding.connect(function () {
if (onScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
tablet.removeButton(button);
});
/*
var moveDebugCursor = false;
Controller.mousePressEvent.connect(function (e) {
if (e.isMiddleButton) {
moveDebugCursor = true;
setDebugCursor(e.x, e.y);
}
});
Controller.mouseReleaseEvent.connect(function() { moveDebugCursor = false; });
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
function setDebugCursor(x, y) { function setDebugCursor(x, y) {
nx = (x / Window.innerWidth); nx = (x / Window.innerWidth);
ny = 1.0 - ((y) / (Window.innerHeight - 32)); ny = 1.0 - ((y) / (Window.innerHeight - 32));
Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
}
*/
function cleanup() {
}
Script.scriptEnding.connect(cleanup);
}());
Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
}