mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:50:43 +02:00
Updated ambient occlusion debug script to be a tablet app
This commit is contained in:
parent
5e9355235c
commit
3497c93e9a
2 changed files with 32 additions and 56 deletions
|
@ -19,14 +19,14 @@ import "../lib/plotperf"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
HifiConstants { id: hifi;}
|
HifiConstants { id: hifi;}
|
||||||
id: render;
|
id: root;
|
||||||
anchors.margins: hifi.dimensions.contentMargin.x
|
anchors.margins: hifi.dimensions.contentMargin.x
|
||||||
|
|
||||||
color: hifi.colors.baseGray;
|
color: hifi.colors.baseGray;
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: surfaceGeometry
|
id: surfaceGeometry
|
||||||
spacing: 10
|
spacing: 8
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: hifi.dimensions.contentMargin.x
|
anchors.margins: hifi.dimensions.contentMargin.x
|
||||||
|
@ -48,19 +48,13 @@ Rectangle {
|
||||||
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
|
height:38
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row{
|
Row {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: [
|
model: [
|
||||||
"resolutionLevel:resolutionLevel",
|
"resolutionLevel:resolutionLevel",
|
||||||
|
@ -76,10 +70,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: [
|
model: [
|
||||||
"debugEnabled:showCursorPixel"
|
"debugEnabled:showCursorPixel"
|
||||||
|
@ -95,8 +86,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
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")
|
||||||
|
|
|
@ -1,30 +1,25 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
//
|
//
|
||||||
// debugAmbientOcclusionPass.js
|
// debugAmbientOcclusionPass.js
|
||||||
// developer/utilities/render
|
// tablet-sample-app
|
||||||
//
|
//
|
||||||
// Olivier Prat, created on 11/04/2018.
|
// Created by Olivier Prat on April 19 2018.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2018 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 http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
"use strict";
|
var TABLET_BUTTON_NAME = "AO";
|
||||||
|
|
||||||
var TABLET_BUTTON_NAME = "SSAO";
|
|
||||||
var QMLAPP_URL = Script.resolvePath("./ambientOcclusionPass.qml");
|
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() {
|
function onClicked() {
|
||||||
if (onScreen) {
|
if (onLuciScreen) {
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
} else {
|
} else {
|
||||||
tablet.loadQMLSource(QMLAPP_URL);
|
tablet.loadQMLSource(QMLAPP_URL);
|
||||||
|
@ -34,8 +29,7 @@
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
text: TABLET_BUTTON_NAME,
|
text: TABLET_BUTTON_NAME,
|
||||||
icon: ICON_URL,
|
sortOrder: 1
|
||||||
activeIcon: ACTIVE_ICON_URL
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var hasEventBridge = false;
|
var hasEventBridge = false;
|
||||||
|
@ -60,13 +54,13 @@
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
if (url === QMLAPP_URL) {
|
if (url === QMLAPP_URL) {
|
||||||
onScreen = true;
|
onLuciScreen = true;
|
||||||
} else {
|
} else {
|
||||||
onScreen = false;
|
onLuciScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.editProperties({isActive: onScreen});
|
button.editProperties({isActive: onLuciScreen});
|
||||||
wireEventBridge(onScreen);
|
wireEventBridge(onLuciScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fromQml(message) {
|
function fromQml(message) {
|
||||||
|
@ -75,17 +69,6 @@
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
tablet.screenChanged.connect(onScreenChanged);
|
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;
|
var moveDebugCursor = false;
|
||||||
Controller.mousePressEvent.connect(function (e) {
|
Controller.mousePressEvent.connect(function (e) {
|
||||||
if (e.isMiddleButton) {
|
if (e.isMiddleButton) {
|
||||||
|
@ -97,16 +80,20 @@
|
||||||
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
|
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) {
|
function setDebugCursor(x, y) {
|
||||||
nx = (x / Window.innerWidth);
|
nx = ((x + 0.5) / Window.innerWidth);
|
||||||
ny = 1.0 - ((y) / (Window.innerHeight - 32));
|
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);
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue