// // LaserPointer.h // interface/src/raypick // // Created by Sam Gondelman 7/11/2017 // Copyright 2017 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_LaserPointer_h #define hifi_LaserPointer_h #include #include "glm/glm.hpp" #include "ui/overlays/Overlay.h" #include #include "RayPickManager.h" class RayPickResult; class RenderState { public: RenderState() {} RenderState(const OverlayID& startID, const OverlayID& pathID, const OverlayID& endID); const OverlayID& getStartID() { return _startID; } const OverlayID& getPathID() { return _pathID; } const OverlayID& getEndID() { return _endID; } void setStartID(const OverlayID& startID) { _startID = startID; } void setPathID(const OverlayID& pathID) { _pathID = pathID; } void setEndID(const OverlayID& endID) { _endID = endID; } const bool& doesStartIgnoreRays() { return _startIgnoreRays; } const bool& doesPathIgnoreRays() { return _pathIgnoreRays; } const bool& doesEndIgnoreRays() { return _endIgnoreRays; } private: OverlayID _startID; OverlayID _pathID; OverlayID _endID; bool _startIgnoreRays; bool _pathIgnoreRays; bool _endIgnoreRays; }; class LaserPointer { public: LaserPointer::LaserPointer(const QVariantMap& rayProps, const QHash& renderStates, const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled); ~LaserPointer(); unsigned int getRayUID() { return _rayPickUID; } void enable(); void disable(); const RayPickResult getPrevRayPickResult() { return DependencyManager::get()->getPrevRayPickResult(_rayPickUID); } void setRenderState(const QString& state); void editRenderState(const QString& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps); void setIgnoreEntities(const QScriptValue& ignoreEntities) { DependencyManager::get()->setIgnoreEntities(_rayPickUID, ignoreEntities); } void setIncludeEntities(const QScriptValue& includeEntities) { DependencyManager::get()->setIncludeEntities(_rayPickUID, includeEntities); } void setIgnoreOverlays(const QScriptValue& ignoreOverlays) { DependencyManager::get()->setIgnoreOverlays(_rayPickUID, ignoreOverlays); } void setIncludeOverlays(const QScriptValue& includeOverlays) { DependencyManager::get()->setIncludeOverlays(_rayPickUID, includeOverlays); } void setIgnoreAvatars(const QScriptValue& ignoreAvatars) { DependencyManager::get()->setIgnoreAvatars(_rayPickUID, ignoreAvatars); } void setIncludeAvatars(const QScriptValue& includeAvatars) { DependencyManager::get()->setIncludeAvatars(_rayPickUID, includeAvatars); } void update(); private: bool _renderingEnabled; QString _currentRenderState { "" }; QHash _renderStates; bool _faceAvatar; bool _centerEndY; bool _lockEnd; unsigned int _rayPickUID; OverlayID updateRenderStateOverlay(const OverlayID& id, const QVariant& props); void disableRenderState(const QString& renderState); }; #endif // hifi_LaserPointer_h