mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 01:22:10 +02:00
Adding controls of the regions
This commit is contained in:
parent
e2ac5353b1
commit
4a91ac11c9
6 changed files with 76 additions and 6 deletions
|
@ -142,12 +142,12 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
||||
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
||||
|
||||
|
||||
// Filter zones from the general metas bucket
|
||||
const auto zones = task.addJob<ZoneRendererTask>("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>("DrawLight", lights);
|
||||
|
||||
// Filter zones from the general metas bucket
|
||||
const auto zones = task.addJob<ZoneRendererTask>("ZoneRenderer", metas);
|
||||
|
||||
// Light Clustering
|
||||
// Create the cluster grid of lights, cpu job for now
|
||||
|
|
|
@ -38,11 +38,22 @@ Sphere View::evalRegionSphere(const View& view, float originRadius, float maxDis
|
|||
}
|
||||
|
||||
void View::updateRegions(View& view) {
|
||||
std::vector<float> 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;
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<View>;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue