From f59185c00b6900899f6fefffdfaaf0b5a310a140 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 3 Oct 2014 03:02:54 -0700 Subject: [PATCH] allow 3d overlays to be ignored from ray intersection --- interface/src/ui/overlays/Base3DOverlay.cpp | 6 +++++- interface/src/ui/overlays/Base3DOverlay.h | 3 +++ interface/src/ui/overlays/Overlays.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/overlays/Base3DOverlay.cpp b/interface/src/ui/overlays/Base3DOverlay.cpp index 0e68347eca..f58dc8e29e 100644 --- a/interface/src/ui/overlays/Base3DOverlay.cpp +++ b/interface/src/ui/overlays/Base3DOverlay.cpp @@ -26,7 +26,8 @@ Base3DOverlay::Base3DOverlay() : _lineWidth(DEFAULT_LINE_WIDTH), _isSolid(DEFAULT_IS_SOLID), _rotation(), - _isDashedLine(DEFAULT_IS_DASHED_LINE) + _isDashedLine(DEFAULT_IS_DASHED_LINE), + _ignoreRayIntersection(false) { } @@ -112,6 +113,9 @@ void Base3DOverlay::setProperties(const QScriptValue& properties) { if (properties.property("dashed").isValid()) { setIsDashedLine(properties.property("dashed").toVariant().toBool()); } + if (properties.property("ignoreRayIntersection").isValid()) { + setIgnoreRayIntersection(properties.property("ignoreRayIntersection").toVariant().toBool()); + } } bool Base3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, diff --git a/interface/src/ui/overlays/Base3DOverlay.h b/interface/src/ui/overlays/Base3DOverlay.h index 62d6826ed0..e293bae5a9 100644 --- a/interface/src/ui/overlays/Base3DOverlay.h +++ b/interface/src/ui/overlays/Base3DOverlay.h @@ -33,6 +33,7 @@ public: bool getIsDashedLine() const { return _isDashedLine; } bool getIsSolidLine() const { return !_isDashedLine; } const glm::quat& getRotation() const { return _rotation; } + bool getIgnoreRayIntersection() const { return _ignoreRayIntersection; } // setters void setPosition(const glm::vec3& position) { _position = position; } @@ -40,6 +41,7 @@ public: void setIsSolid(bool isSolid) { _isSolid = isSolid; } void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; } void setRotation(const glm::quat& value) { _rotation = value; } + void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; } virtual void setProperties(const QScriptValue& properties); @@ -53,6 +55,7 @@ protected: glm::quat _rotation; bool _isSolid; bool _isDashedLine; + bool _ignoreRayIntersection; }; diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 8511d79aca..3ba3f66f1a 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -265,7 +265,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray) i.previous(); unsigned int thisID = i.key(); Base3DOverlay* thisOverlay = static_cast(i.value()); - if (thisOverlay->getVisible() && thisOverlay->isLoaded()) { + if (thisOverlay->getVisible() && !thisOverlay->getIgnoreRayIntersection() && thisOverlay->isLoaded()) { float thisDistance; BoxFace thisFace; if (thisOverlay->findRayIntersection(ray.origin, ray.direction, thisDistance, thisFace)) {