Updated ambient occlusion debug script to be a tablet app

This commit is contained in:
Olivier Prat 2018-04-19 18:02:31 +02:00
parent 5e9355235c
commit 3497c93e9a
2 changed files with 32 additions and 56 deletions

View file

@ -19,16 +19,16 @@ import "../lib/plotperf"
Rectangle {
HifiConstants { id: hifi;}
id: render;
id: root;
anchors.margins: hifi.dimensions.contentMargin.x
color: hifi.colors.baseGray;
Column {
id: surfaceGeometry
spacing: 10
spacing: 8
anchors.left: parent.left
anchors.right: parent.right
anchors.right: parent.right
anchors.margins: hifi.dimensions.contentMargin.x
Repeater {
@ -48,19 +48,13 @@ Rectangle {
property: modelData.split(":")[1]
max: modelData.split(":")[2]
min: 0.0
width: 280
height:38
}
}
Row{
Row {
spacing: 10
anchors.left: parent.left
anchors.right: parent.right
Column {
spacing: 10
Repeater {
model: [
"resolutionLevel:resolutionLevel",
@ -76,10 +70,7 @@ Rectangle {
}
}
}
Column {
spacing: 10
Repeater {
model: [
"debugEnabled:showCursorPixel"
@ -95,8 +86,6 @@ Rectangle {
}
PlotPerf {
anchors.left: parent.left
anchors.right: parent.right
title: "Timing"
height: 50
object: Render.getConfig("RenderMainView.AmbientOcclusion")

View file

@ -1,30 +1,25 @@
"use strict";
//
// debugAmbientOcclusionPass.js
// developer/utilities/render
// tablet-sample-app
//
// Olivier Prat, created on 11/04/2018.
// Copyright 2017 High Fidelity, Inc.
// Created by Olivier Prat on April 19 2018.
// Copyright 2018 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
//
(function() {
"use strict";
var TABLET_BUTTON_NAME = "SSAO";
var TABLET_BUTTON_NAME = "AO";
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");
Script.include([
Script.resolvePath("../../../system/libraries/stringHelpers.js"),
]);
var onScreen = false;
var onLuciScreen = false;
function onClicked() {
if (onScreen) {
if (onLuciScreen) {
tablet.gotoHomeScreen();
} else {
tablet.loadQMLSource(QMLAPP_URL);
@ -33,9 +28,8 @@
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: TABLET_BUTTON_NAME,
icon: ICON_URL,
activeIcon: ACTIVE_ICON_URL
text: TABLET_BUTTON_NAME,
sortOrder: 1
});
var hasEventBridge = false;
@ -60,13 +54,13 @@
function onScreenChanged(type, url) {
if (url === QMLAPP_URL) {
onScreen = true;
onLuciScreen = true;
} else {
onScreen = false;
onLuciScreen = false;
}
button.editProperties({isActive: onScreen});
wireEventBridge(onScreen);
button.editProperties({isActive: onLuciScreen});
wireEventBridge(onLuciScreen);
}
function fromQml(message) {
@ -74,18 +68,7 @@
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) {
@ -97,16 +80,20 @@
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
Script.scriptEnding.connect(function () {
if (onLuciScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
tablet.removeButton(button);
});
function setDebugCursor(x, y) {
nx = (x / Window.innerWidth);
ny = 1.0 - ((y) / (Window.innerHeight - 32));
nx = ((x + 0.5) / Window.innerWidth);
ny = 1.0 - ((y + 0.5) / (Window.innerHeight));
Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
}
*/
function cleanup() {
}
Script.scriptEnding.connect(cleanup);
}());