From 891fb65daaa25e28c6d7f4b87aaf68a338666aaa Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 1 Apr 2021 18:30:12 -0700 Subject: [PATCH] added a slider to debug dynamic scaling issues This is a big hackish, but is intended to help us debug scaling issues, this adds a couple of sliders under [Debug] to control dynamic scaling manually. --- samples/gltf_viewer.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/samples/gltf_viewer.cpp b/samples/gltf_viewer.cpp index 6d48bae093..d70c99848f 100644 --- a/samples/gltf_viewer.cpp +++ b/samples/gltf_viewer.cpp @@ -341,6 +341,9 @@ static LinearColor inverseTonemapSRGB(sRGBColor x) { return (x * -0.155) / (x - 1.019); } +static float sGlobalScale = 1.0f; +static float sGlobalScaleAnamorphism = 0.0f; + int main(int argc, char** argv) { App app; @@ -567,6 +570,8 @@ int main(int argc, char** argv) { debug.getPropertyAddress("d.renderer.doFrameCapture"); *captureFrame = true; } + ImGui::SliderFloat("scale", &sGlobalScale, 0.25f, 1.0f); + ImGui::SliderFloat("anamorphism", &sGlobalScaleAnamorphism, -1.0f, 1.0f); } if (ImGui::BeginPopupModal("MessageBox", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { @@ -679,6 +684,22 @@ int main(int argc, char** argv) { } else { view->setColorGrading(nullptr); } + + view->setDynamicResolutionOptions({ + .minScale = { + lerp(sGlobalScale, 1.0f, + sGlobalScaleAnamorphism >= 0.0f ? sGlobalScaleAnamorphism : 0.0f), + lerp(sGlobalScale, 1.0f, + sGlobalScaleAnamorphism <= 0.0f ? -sGlobalScaleAnamorphism : 0.0f), + }, + .maxScale = { + lerp(sGlobalScale, 1.0f, + sGlobalScaleAnamorphism >= 0.0f ? sGlobalScaleAnamorphism : 0.0f), + lerp(sGlobalScale, 1.0f, + sGlobalScaleAnamorphism <= 0.0f ? -sGlobalScaleAnamorphism : 0.0f), + }, + .enabled = sGlobalScale != 1.0f, + }); }; auto postRender = [&app](Engine* engine, View* view, Scene* scene, Renderer* renderer) {