mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 10:23:30 +02:00
Arg get me the feedback working!!!!
This commit is contained in:
parent
d6b6645630
commit
52a4224442
7 changed files with 60 additions and 17 deletions
|
@ -14,13 +14,39 @@
|
||||||
#include <workload/SpaceClassifier.h>
|
#include <workload/SpaceClassifier.h>
|
||||||
|
|
||||||
#include "PhysicsBoundary.h"
|
#include "PhysicsBoundary.h"
|
||||||
|
#pragma optimize( "[optimization-list]", off )
|
||||||
|
float wtf_adjust(float current, float timing) {
|
||||||
|
float error = (timing * 0.001f) - 2.0f;
|
||||||
|
if (error < 0.0f) {
|
||||||
|
current += 0.2f * (error) / 16.0f;
|
||||||
|
} else {
|
||||||
|
current += 0.1f * (error) / 16.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void ControlViews::run(const workload::WorkloadContextPointer& renderContext, const Input& inputs, Output& outputs) {
|
if (current > 100.0f) {
|
||||||
const auto& inViews = inputs.getN<0>();
|
current = 100.0f;
|
||||||
const auto& inTimings = inputs[1];
|
} else if (current < 5.0f) {
|
||||||
|
current = 5.0f;
|
||||||
outputs = inViews;
|
}
|
||||||
|
return current;
|
||||||
}
|
}
|
||||||
|
void ControlViews::run(const workload::WorkloadContextPointer& runContext, const Input& inputs, Output& outputs) {
|
||||||
|
const auto& inViews = inputs.get0();
|
||||||
|
const auto& inTimings = inputs.get1();
|
||||||
|
auto& outViews = outputs;
|
||||||
|
outViews.clear();
|
||||||
|
outViews = inViews;
|
||||||
|
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (auto& outView : outViews) {
|
||||||
|
auto& current = regionBackFronts[workload::Region::R2].y;
|
||||||
|
current = wtf_adjust(current, inTimings[0]);
|
||||||
|
outView.regions[workload::Region::R2].y = current;
|
||||||
|
workload::View::updateRegionsFromBackFronts(outView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma optimize( "[optimization-list]", on )
|
||||||
|
|
||||||
class WorkloadEngineBuilder {
|
class WorkloadEngineBuilder {
|
||||||
public:
|
public:
|
||||||
|
@ -35,9 +61,7 @@ public:
|
||||||
|
|
||||||
const auto usedViews = model.addJob<workload::SetupViews>("setupViews", inViews);
|
const auto usedViews = model.addJob<workload::SetupViews>("setupViews", inViews);
|
||||||
|
|
||||||
ControlViews::Input controlViewsIn;
|
const auto controlViewsIn = ControlViews::Input(usedViews, inTimings).asVarying();
|
||||||
controlViewsIn[0] = usedViews;
|
|
||||||
controlViewsIn[1] = inTimings;
|
|
||||||
const auto fixedViews = model.addJob<ControlViews>("controlViews", controlViewsIn);
|
const auto fixedViews = model.addJob<ControlViews>("controlViews", controlViewsIn);
|
||||||
|
|
||||||
const auto regionTrackerOut = model.addJob<workload::SpaceClassifierTask>("spaceClassifier", fixedViews);
|
const auto regionTrackerOut = model.addJob<workload::SpaceClassifierTask>("spaceClassifier", fixedViews);
|
||||||
|
|
|
@ -58,8 +58,12 @@ public:
|
||||||
using Output = workload::Views;
|
using Output = workload::Views;
|
||||||
using JobModel = workload::Job::ModelIO<ControlViews, Input, Output, Config>;
|
using JobModel = workload::Job::ModelIO<ControlViews, Input, Output, Config>;
|
||||||
|
|
||||||
|
ControlViews() = default;
|
||||||
|
|
||||||
void configure(const Config& config) {}
|
void configure(const Config& config) {}
|
||||||
void run(const workload::WorkloadContextPointer& renderContext, const Input& inputs, Output& outputs);
|
void run(const workload::WorkloadContextPointer& runContext, const Input& inputs, Output& outputs);
|
||||||
|
glm::vec2 regionBackFronts[workload::Region::NUM_VIEW_REGIONS + 1];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_GameWorkload_h
|
#endif // hifi_GameWorkload_h
|
||||||
|
|
|
@ -88,4 +88,8 @@ void main(void) {
|
||||||
region = (0x000000FF & region);
|
region = (0x000000FF & region);
|
||||||
|
|
||||||
varColor = vec4(colorWheel(float(region) / 4.0), proxy.sphere.w);
|
varColor = vec4(colorWheel(float(region) / 4.0), proxy.sphere.w);
|
||||||
|
|
||||||
|
if (region == 4) {
|
||||||
|
gl_Position = vec4(0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct WorkloadView {
|
||||||
vec4 direction_far;
|
vec4 direction_far;
|
||||||
vec4 fov;
|
vec4 fov;
|
||||||
vec4 origin;
|
vec4 origin;
|
||||||
|
vec4 backFront[2];
|
||||||
vec4 regions[3];
|
vec4 regions[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ Sphere View::evalRegionSphere(const View& view, float originRadius, float maxDis
|
||||||
return Sphere(view.origin + view.direction * center, radius);
|
return Sphere(view.origin + view.direction * center, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::updateRegions(View& view) {
|
void View::updateRegionsDefault(View& view) {
|
||||||
std::vector<float> config(Region::NUM_VIEW_REGIONS * 2, 0.0f);
|
std::vector<float> config(Region::NUM_VIEW_REGIONS * 2, 0.0f);
|
||||||
|
|
||||||
float refFar = 10.0f;
|
float refFar = 10.0f;
|
||||||
|
@ -52,11 +52,18 @@ void View::updateRegions(View& view) {
|
||||||
config[i * 2 + 1] = refFar * weight;
|
config[i * 2 + 1] = refFar * weight;
|
||||||
refFar *= 2.0f;
|
refFar *= 2.0f;
|
||||||
}
|
}
|
||||||
updateRegions(view, config.data());
|
updateRegionsFromBackFrontDistances(view, config.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::updateRegions(View& view, const float* configDistances) {
|
void View::updateRegionsFromBackFronts(View& view) {
|
||||||
for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) {
|
for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) {
|
||||||
view.regions[i] = evalRegionSphere(view, configDistances[i * 2], configDistances[i * 2 + 1]);
|
view.regions[i] = evalRegionSphere(view, view.regionBackFronts[i].x, view.regionBackFronts[i].y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::updateRegionsFromBackFrontDistances(View& view, const float* configDistances) {
|
||||||
|
for (int i = 0; i < Region::NUM_VIEW_REGIONS; i++) {
|
||||||
|
view.regionBackFronts[i] = glm::vec2(configDistances[i * 2], configDistances[i * 2 + 1]);
|
||||||
|
}
|
||||||
|
updateRegionsFromBackFronts(view);
|
||||||
|
}
|
||||||
|
|
|
@ -47,6 +47,9 @@ public:
|
||||||
// Origin radius
|
// Origin radius
|
||||||
float originRadius{ 0.5f };
|
float originRadius{ 0.5f };
|
||||||
|
|
||||||
|
// N regions distances
|
||||||
|
glm::vec2 regionBackFronts[Region::NUM_VIEW_REGIONS + 1];
|
||||||
|
|
||||||
// N regions spheres
|
// N regions spheres
|
||||||
Sphere regions[Region::NUM_VIEW_REGIONS];
|
Sphere regions[Region::NUM_VIEW_REGIONS];
|
||||||
|
|
||||||
|
@ -59,9 +62,9 @@ public:
|
||||||
static View evalFromFrustum(const ViewFrustum& frustum, const glm::vec3& offset = glm::vec3());
|
static View evalFromFrustum(const ViewFrustum& frustum, const glm::vec3& offset = glm::vec3());
|
||||||
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 updateRegionsDefault(View& view);
|
||||||
|
static void updateRegionsFromBackFronts(View& view);
|
||||||
static void updateRegions(View& view, const float* configDistances);
|
static void updateRegionsFromBackFrontDistances(View& view, const float* configDistances);
|
||||||
};
|
};
|
||||||
|
|
||||||
using Views = std::vector<View>;
|
using Views = std::vector<View>;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void SetupViews::run(const WorkloadContextPointer& renderContext, const Input& i
|
||||||
|
|
||||||
// Update regions based on the current config
|
// Update regions based on the current config
|
||||||
for (auto& v : outViews) {
|
for (auto& v : outViews) {
|
||||||
View::updateRegions(v, (float*) &data);
|
View::updateRegionsFromBackFrontDistances(v, (float*) &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// outViews is ready to be used
|
// outViews is ready to be used
|
||||||
|
|
Loading…
Reference in a new issue