mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 03:42:45 +02:00
Adressing warnings issue and implementing the independent intersection test per region spheres
This commit is contained in:
parent
7e96608699
commit
b6b7cb3394
6 changed files with 43 additions and 12 deletions
|
@ -180,7 +180,7 @@ public:
|
|||
const Varying getInput() const { return _concept->getInput(); }
|
||||
const Varying getOutput() const { return _concept->getOutput(); }
|
||||
|
||||
template <class I> void feedInput(const I& in) { _concept->editInput().edit<I>() = in; }
|
||||
template <class I> void feedInput(const I& in) { _concept->editInput().template edit<I>() = in; }
|
||||
|
||||
|
||||
QConfigPointer& getConfiguration() const { return _concept->getConfiguration(); }
|
||||
|
|
|
@ -20,16 +20,37 @@
|
|||
#include "ClassificationTracker.h"
|
||||
|
||||
namespace workload {
|
||||
class DebugCout {
|
||||
public:
|
||||
using Inputs = SortedChanges;
|
||||
using JobModel = workload::Job::ModelI<DebugCout, Inputs>;
|
||||
|
||||
DebugCout() {}
|
||||
|
||||
void run(const workload::WorkloadContextPointer& renderContext, const Inputs& inputs) {
|
||||
qDebug() << "Some message from " << inputs.size();
|
||||
int i = 0;
|
||||
for (auto& b: inputs) {
|
||||
qDebug() << " Bucket Number" << i << " size is " << b.size();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
WorkloadContext::WorkloadContext(const SpacePointer& space) : task::JobContext(trace_workload()), _space(space) {}
|
||||
|
||||
class EngineBuilder {
|
||||
public:
|
||||
using Input = Views;
|
||||
using JobModel = Task::ModelI<EngineBuilder, Input>;
|
||||
using Inputs = Views;
|
||||
using JobModel = Task::ModelI<EngineBuilder, Inputs>;
|
||||
void build(JobModel& model, const Varying& in, Varying& out) {
|
||||
model.addJob<SetupViews>("setupViews", in);
|
||||
auto classifications = model.addJob<ClassificationTracker>("classificationTracker");
|
||||
const auto classifications = model.addJob<ClassificationTracker>("classificationTracker");
|
||||
// model.addJob<DebugCout>("debug", classifications);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -73,11 +73,20 @@ void Space::categorizeAndGetChanges(std::vector<Space::Change>& changes) {
|
|||
for (uint32_t j = 0; j < numViews; ++j) {
|
||||
auto& view = _views[j];
|
||||
|
||||
float distance2 = glm::distance2(view.origin, glm::vec3(proxy.sphere));
|
||||
for (uint8_t c = 0; c < region; ++c) {
|
||||
float touchDistance = view.regions[c].w + proxy.sphere.w;
|
||||
if (distance2 < touchDistance * touchDistance) {
|
||||
region = c;
|
||||
glm::vec3 distance2(glm::distance2(proxy.sphere, view.regions[0]), glm::distance2(proxy.sphere, view.regions[1]), glm::distance2(proxy.sphere, view.regions[2]));
|
||||
glm::vec3 regionRadii2(view.regions[0].w + proxy.sphere.w, view.regions[1].w + proxy.sphere.w, view.regions[2].w + proxy.sphere.w);
|
||||
regionRadii2 *= regionRadii2;
|
||||
auto touchTests = glm::lessThanEqual(distance2, regionRadii2);
|
||||
|
||||
if (glm::any(touchTests)) {
|
||||
if (touchTests.x) {
|
||||
region = Region::R1;
|
||||
break;
|
||||
} else if (touchTests.y) {
|
||||
region = Region::R2;
|
||||
break;
|
||||
} else {
|
||||
region = Region::R3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ View View::evalFromFrustum(const ViewFrustum& frustum) {
|
|||
}
|
||||
|
||||
Sphere View::evalRegionSphere(const View& view, float originRadius, float maxDistance) {
|
||||
float radius = (maxDistance + originRadius) / 2.0;
|
||||
float radius = (maxDistance + originRadius) / 2.0f;
|
||||
float center = radius - originRadius;
|
||||
return Sphere(view.origin + view.direction * center, radius);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
float maxRadius{ FLT_MAX };
|
||||
|
||||
// Fov stores the half field of view angle, and tan/cos/sin ready to go, default is fov of 90deg
|
||||
glm::vec4 fov_halfAngle_tan_cos_sin { M_PI_4, 1.0f, M_SQRT2 * 0.5f, M_SQRT2 * 0.5f };
|
||||
glm::vec4 fov_halfAngle_tan_cos_sin { (float) M_PI_4, 1.0f, (float) (M_SQRT2 * 0.5), (float) (M_SQRT2 * 0.5) };
|
||||
|
||||
// Origin position
|
||||
glm::vec3 origin{ 0.0f };
|
||||
|
|
|
@ -21,6 +21,7 @@ Rectangle {
|
|||
anchors.margins: hifi.dimensions.contentMargin.x
|
||||
|
||||
color: hifi.colors.baseGray;
|
||||
property var setupViews: Workload.getConfig("setupViews")
|
||||
property var spaceToRender: Workload.getConfig("SpaceToRender")
|
||||
|
||||
Column {
|
||||
|
@ -37,7 +38,7 @@ Rectangle {
|
|||
boxSize: 20
|
||||
text: "Freeze Views"
|
||||
checked: workload.spaceToRender["freezeViews"]
|
||||
onCheckedChanged: { workload.spaceToRender["freezeViews"] = checked }
|
||||
onCheckedChanged: { workload.spaceToRender["freezeViews"] = checked, workload.setupViews.enabled = !checked; }
|
||||
}
|
||||
Separator {}
|
||||
HifiControls.Label {
|
||||
|
|
Loading…
Reference in a new issue