From 4a91ac11c99800b941fc9b9d071fa6c44dea0b4d Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 6 Mar 2018 18:19:02 -0800 Subject: [PATCH] Adding controls of the regions --- .../render-utils/src/RenderDeferredTask.cpp | 6 +-- libraries/workload/src/workload/View.cpp | 15 +++++++- libraries/workload/src/workload/View.h | 2 + libraries/workload/src/workload/ViewTask.cpp | 3 +- libraries/workload/src/workload/ViewTask.h | 38 +++++++++++++++++++ .../developer/utilities/workload/workload.qml | 18 +++++++++ 6 files changed, 76 insertions(+), 6 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index f262307944..af85d9af5d 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -142,12 +142,12 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN(0); const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN(1); - + // Filter zones from the general metas bucket + const auto zones = task.addJob("ZoneRenderer", metas); + // Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now. task.addJob("DrawLight", lights); - // Filter zones from the general metas bucket - const auto zones = task.addJob("ZoneRenderer", metas); // Light Clustering // Create the cluster grid of lights, cpu job for now diff --git a/libraries/workload/src/workload/View.cpp b/libraries/workload/src/workload/View.cpp index f68e7a8436..684b231245 100644 --- a/libraries/workload/src/workload/View.cpp +++ b/libraries/workload/src/workload/View.cpp @@ -38,11 +38,22 @@ Sphere View::evalRegionSphere(const View& view, float originRadius, float maxDis } void View::updateRegions(View& view) { + std::vector config(Region::NUM_VIEW_REGIONS * 2, 0.0f); + float refFar = 10.0f; float refClose = 2.0f; for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) { float weight = i + 1.0f; - view.regions[i] = evalRegionSphere(view, refClose * weight, refFar * weight); + config[i * 2] = refClose; + config[i * 2 + 1] = refFar * weight; refFar *= 2.0f; } -} \ No newline at end of file + + updateRegions(view, config.data()); +} + +void View::updateRegions(View& view, const float* configDistances) { + for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) { + view.regions[i] = evalRegionSphere(view, configDistances[i * 2], configDistances[i * 2 + 1]); + } +} diff --git a/libraries/workload/src/workload/View.h b/libraries/workload/src/workload/View.h index a237615a7a..aea66ef605 100644 --- a/libraries/workload/src/workload/View.h +++ b/libraries/workload/src/workload/View.h @@ -57,6 +57,8 @@ public: static Sphere evalRegionSphere(const View& view, float originRadius, float maxDistance); static void updateRegions(View& view); + + static void updateRegions(View& view, const float* configDistances); }; using Views = std::vector; diff --git a/libraries/workload/src/workload/ViewTask.cpp b/libraries/workload/src/workload/ViewTask.cpp index 451f3c820f..3f7a9b740d 100644 --- a/libraries/workload/src/workload/ViewTask.cpp +++ b/libraries/workload/src/workload/ViewTask.cpp @@ -14,13 +14,14 @@ using namespace workload; void SetupViews::configure(const Config& config) { + data = config.data; } void SetupViews::run(const WorkloadContextPointer& renderContext, const Input& inputs) { Views views = inputs; for (auto& v : views) { - View::updateRegions(v); + View::updateRegions(v, (float*) &data); } renderContext->_space->setViews(views); diff --git a/libraries/workload/src/workload/ViewTask.h b/libraries/workload/src/workload/ViewTask.h index 50e8d99bc4..560efef331 100644 --- a/libraries/workload/src/workload/ViewTask.h +++ b/libraries/workload/src/workload/ViewTask.h @@ -16,8 +16,43 @@ namespace workload { class SetupViewsConfig : public Job::Config{ Q_OBJECT + Q_PROPERTY(float r1Front READ getR1Front WRITE setR1Front NOTIFY dirty) + Q_PROPERTY(float r1Back READ getR1Back WRITE setR1Back NOTIFY dirty) + Q_PROPERTY(float r2Front READ getR2Front WRITE setR2Front NOTIFY dirty) + Q_PROPERTY(float r2Back READ getR2Back WRITE setR2Back NOTIFY dirty) + Q_PROPERTY(float r3Front READ getR3Front WRITE setR3Front NOTIFY dirty) + Q_PROPERTY(float r3Back READ getR3Back WRITE setR3Back NOTIFY dirty) public: SetupViewsConfig() : Job::Config(true) {} + + + float getR1Front() const { return data.r1Front; } + float getR1Back() const { return data.r1Back; } + float getR2Front() const { return data.r2Front; } + float getR2Back() const { return data.r2Back; } + float getR3Front() const { return data.r3Front; } + float getR3Back() const { return data.r3Back; } + + void setR1Front(float d) { data.r1Front = d; emit dirty(); } + void setR1Back(float d) { data.r1Back = d; emit dirty(); } + void setR2Front(float d) { data.r2Front = d; emit dirty(); } + void setR2Back(float d) { data.r2Back = d; emit dirty(); } + void setR3Front(float d) { data.r3Front = d; emit dirty(); } + void setR3Back(float d) { data.r3Back = d; emit dirty(); } + + struct Data { + float r1Front { 10.0f }; + float r1Back { 2.0f }; + + float r2Front{ 30.0f }; + float r2Back{ 5.0f }; + + float r3Front{ 100.0f }; + float r3Back{ 10.0f }; + } data; + + signals: + void dirty(); }; class SetupViews { @@ -28,6 +63,9 @@ namespace workload { void configure(const Config& config); void run(const workload::WorkloadContextPointer& renderContext, const Input& inputs); + + protected: + Config::Data data; }; } // namespace workload diff --git a/scripts/developer/utilities/workload/workload.qml b/scripts/developer/utilities/workload/workload.qml index 3b7ca09496..80061f5ad9 100644 --- a/scripts/developer/utilities/workload/workload.qml +++ b/scripts/developer/utilities/workload/workload.qml @@ -40,6 +40,24 @@ Rectangle { checked: workload.spaceToRender["freezeViews"] onCheckedChanged: { workload.spaceToRender["freezeViews"] = checked, workload.setupViews.enabled = !checked; } } + Repeater { + model: [ + "R1 Front:r1Front:300:1.0", "R1 Back:r1Back:50.0:0.0", + "R2 Front:r2Front:300:1.0", "R2 Back:r2Back:50.0:0.0", + "R3 Front:r3Front:300:1.0", "R3 Back:r3Back:50.0:0.0" + ] + ConfigSlider { + label: qsTr(modelData.split(":")[0]) + integral: false + config: workload.setupViews + property: modelData.split(":")[1] + max: modelData.split(":")[2] + min: modelData.split(":")[3] + + anchors.left: parent.left + anchors.right: parent.right + } + } Separator {} HifiControls.Label { text: "Display"