Switch to app for ambient occlusion debug script

This commit is contained in:
Olivier Prat 2018-11-14 11:55:11 +01:00
parent 45e0f65972
commit 85a3938cbe
2 changed files with 33 additions and 79 deletions

View file

@ -208,7 +208,7 @@ private:
void updateJitterSamples(); void updateJitterSamples();
int getDepthResolutionLevel() const; int getDepthResolutionLevel() const;
AOParametersBuffer _aoParametersBuffer; AOParametersBuffer _aoParametersBuffer;
FrameParametersBuffer _aoFrameParametersBuffer[SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT]; FrameParametersBuffer _aoFrameParametersBuffer[SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT];
BlurParametersBuffer _vblurParametersBuffer; BlurParametersBuffer _vblurParametersBuffer;
@ -216,13 +216,13 @@ private:
float _blurEdgeSharpness{ 0.0f }; float _blurEdgeSharpness{ 0.0f };
static const gpu::PipelinePointer& getOcclusionPipeline(); static const gpu::PipelinePointer& getOcclusionPipeline();
static const gpu::PipelinePointer& getBilateralBlurPipeline(); static const gpu::PipelinePointer& getBilateralBlurPipeline();
static const gpu::PipelinePointer& getMipCreationPipeline(); static const gpu::PipelinePointer& getMipCreationPipeline();
static const gpu::PipelinePointer& getGatherPipeline(); static const gpu::PipelinePointer& getGatherPipeline();
static const gpu::PipelinePointer& getBuildNormalsPipeline(); static const gpu::PipelinePointer& getBuildNormalsPipeline();
static gpu::PipelinePointer _occlusionPipeline; static gpu::PipelinePointer _occlusionPipeline;
static gpu::PipelinePointer _bilateralBlurPipeline; static gpu::PipelinePointer _bilateralBlurPipeline;
static gpu::PipelinePointer _mipCreationPipeline; static gpu::PipelinePointer _mipCreationPipeline;
static gpu::PipelinePointer _gatherPipeline; static gpu::PipelinePointer _gatherPipeline;
static gpu::PipelinePointer _buildNormalsPipeline; static gpu::PipelinePointer _buildNormalsPipeline;

View file

@ -12,88 +12,42 @@
// //
(function() { (function() {
var TABLET_BUTTON_NAME = "AO"; var AppUi = Script.require('appUi');
var QMLAPP_URL = Script.resolvePath("./ambientOcclusionPass.qml");
var onMousePressEvent = function (e) {
var onLuciScreen = false; };
Controller.mousePressEvent.connect(onMousePressEvent);
function onClicked() { var onMouseReleaseEvent = function () {
if (onLuciScreen) { };
tablet.gotoHomeScreen(); Controller.mouseReleaseEvent.connect(onMouseReleaseEvent);
} else {
tablet.loadQMLSource(QMLAPP_URL);
}
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var onMouseMoveEvent = function (e) {
var button = tablet.addButton({ };
text: TABLET_BUTTON_NAME, Controller.mouseMoveEvent.connect(onMouseMoveEvent);
sortOrder: 1
});
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) {
onLuciScreen = true;
} else {
onLuciScreen = false;
}
button.editProperties({isActive: onLuciScreen});
wireEventBridge(onLuciScreen);
}
function fromQml(message) { function fromQml(message) {
} }
button.clicked.connect(onClicked);
tablet.screenChanged.connect(onScreenChanged);
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); });
var ui;
function startup() {
ui = new AppUi({
buttonName: "AO",
home: Script.resolvePath("ambientOcclusionPass.qml"),
onMessage: fromQml,
//normalButton: Script.resolvePath("../../../system/assets/images/ao-i.svg"),
//activeButton: Script.resolvePath("../../../system/assets/images/ao-a.svg")
});
}
startup();
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (onLuciScreen) { Controller.mousePressEvent.disconnect(onMousePressEvent);
tablet.gotoHomeScreen(); Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent);
} Controller.mouseMoveEvent.disconnect(onMouseMoveEvent);
button.clicked.disconnect(onClicked); pages.clear();
tablet.screenChanged.disconnect(onScreenChanged); // killEngineInspectorView();
tablet.removeButton(button); // killCullInspectorView();
// killEngineLODWindow();
}); });
function setDebugCursor(x, y) {
nx = ((x + 0.5) / Window.innerWidth);
ny = 1.0 - ((y + 0.5) / (Window.innerHeight));
Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
}
}()); }());