allow 3d overlays to be ignored from ray intersection

This commit is contained in:
ZappoMan 2014-10-03 03:02:54 -07:00
parent 05f2263c9c
commit f59185c00b
3 changed files with 9 additions and 2 deletions

View file

@ -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,

View file

@ -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;
};

View file

@ -265,7 +265,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray)
i.previous();
unsigned int thisID = i.key();
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(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)) {