mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:36:45 +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 ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
||||||
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
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.
|
// 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);
|
task.addJob<DrawLight>("DrawLight", lights);
|
||||||
|
|
||||||
// Filter zones from the general metas bucket
|
|
||||||
const auto zones = task.addJob<ZoneRendererTask>("ZoneRenderer", metas);
|
|
||||||
|
|
||||||
// Light Clustering
|
// Light Clustering
|
||||||
// Create the cluster grid of lights, cpu job for now
|
// 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) {
|
void View::updateRegions(View& view) {
|
||||||
|
std::vector<float> config(Region::NUM_VIEW_REGIONS * 2, 0.0f);
|
||||||
|
|
||||||
float refFar = 10.0f;
|
float refFar = 10.0f;
|
||||||
float refClose = 2.0f;
|
float refClose = 2.0f;
|
||||||
for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) {
|
for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) {
|
||||||
float weight = i + 1.0f;
|
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;
|
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 Sphere evalRegionSphere(const View& view, float originRadius, float maxDistance);
|
||||||
|
|
||||||
static void updateRegions(View& view);
|
static void updateRegions(View& view);
|
||||||
|
|
||||||
|
static void updateRegions(View& view, const float* configDistances);
|
||||||
};
|
};
|
||||||
|
|
||||||
using Views = std::vector<View>;
|
using Views = std::vector<View>;
|
||||||
|
|
|
@ -14,13 +14,14 @@ using namespace workload;
|
||||||
|
|
||||||
|
|
||||||
void SetupViews::configure(const Config& config) {
|
void SetupViews::configure(const Config& config) {
|
||||||
|
data = config.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupViews::run(const WorkloadContextPointer& renderContext, const Input& inputs) {
|
void SetupViews::run(const WorkloadContextPointer& renderContext, const Input& inputs) {
|
||||||
|
|
||||||
Views views = inputs;
|
Views views = inputs;
|
||||||
for (auto& v : views) {
|
for (auto& v : views) {
|
||||||
View::updateRegions(v);
|
View::updateRegions(v, (float*) &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderContext->_space->setViews(views);
|
renderContext->_space->setViews(views);
|
||||||
|
|
|
@ -16,8 +16,43 @@
|
||||||
namespace workload {
|
namespace workload {
|
||||||
class SetupViewsConfig : public Job::Config{
|
class SetupViewsConfig : public Job::Config{
|
||||||
Q_OBJECT
|
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:
|
public:
|
||||||
SetupViewsConfig() : Job::Config(true) {}
|
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 {
|
class SetupViews {
|
||||||
|
@ -28,6 +63,9 @@ namespace workload {
|
||||||
|
|
||||||
void configure(const Config& config);
|
void configure(const Config& config);
|
||||||
void run(const workload::WorkloadContextPointer& renderContext, const Input& inputs);
|
void run(const workload::WorkloadContextPointer& renderContext, const Input& inputs);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Config::Data data;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace workload
|
} // namespace workload
|
||||||
|
|
|
@ -40,6 +40,24 @@ Rectangle {
|
||||||
checked: workload.spaceToRender["freezeViews"]
|
checked: workload.spaceToRender["freezeViews"]
|
||||||
onCheckedChanged: { workload.spaceToRender["freezeViews"] = checked, workload.setupViews.enabled = !checked; }
|
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 {}
|
Separator {}
|
||||||
HifiControls.Label {
|
HifiControls.Label {
|
||||||
text: "Display"
|
text: "Display"
|
||||||
|
|
Loading…
Reference in a new issue