Unified · Split
| @@ -1819,12 +1819,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1818 unmodified lines | ||
| 1819 | 1819 | |
| 1820 | 1820 | // Setup the mouse ray pick and related operators |
| 1821 | 1821 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickID(_rayPickManager.createRayPick( |
| 1822 | − PickFilter(DependencyManager::get<RayPickScriptingInterface>()->PICK_ENTITIES() | DependencyManager::get<RayPickScriptingInterface>()->PICK_INCLUDE_NONCOLLIDABLE()), | |
| 1822 | + PickFilter(RayPickScriptingInterface::PICK_ENTITIES() | RayPickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), | |
| 1823 | 1823 | 0.0f, true)); |
| 1824 | 1824 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](QUuid rayPickID) { |
| 1825 | 1825 | RayToEntityIntersectionResult entityResult; |
| 1826 | 1826 | RayPickResult result = _rayPickManager.getPrevPickResult(rayPickID); |
| 1827 | − entityResult.intersects = result.type != DependencyManager::get<RayPickScriptingInterface>()->INTERSECTED_NONE(); | |
| 1827 | + entityResult.intersects = result.type != RayPickScriptingInterface::INTERSECTED_NONE(); | |
| 1828 | 1828 | if (entityResult.intersects) { |
| 1829 | 1829 | entityResult.intersection = result.intersection; |
| 1830 | 1830 | entityResult.distance = result.distance; |
| @@ -133,9 +133,9 @@ public: · 132 unmodified lines | ||
| 133 | 133 | QVector<QUuid> getIgnoreItems() const; |
| 134 | 134 | QVector<QUuid> getIncludeItems() const; |
| 135 | 135 | |
| 136 | − template <typename T> | |
| 137 | − QVector<T> getIgnoreItemsAs() const { | |
| 138 | − QVector<T> result; | |
| 136 | + template <typename S> | |
| 137 | + QVector<S> getIgnoreItemsAs() const { | |
| 138 | + QVector<S> result; | |
| 139 | 139 | withReadLock([&] { |
| 140 | 140 | for (const auto& uid : _ignoreItems) { |
| 141 | 141 | result.push_back(uid); |
| @@ -144,9 +144,9 @@ public: · 2 unmodified lines | ||
| 144 | 144 | return result; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | − template <typename T> | |
| 148 | − QVector<T> getIncludeItemsAs() const { | |
| 149 | − QVector<T> result; | |
| 147 | + template <typename S> | |
| 148 | + QVector<S> getIncludeItemsAs() const { | |
| 149 | + QVector<S> result; | |
| 150 | 150 | withReadLock([&] { |
| 151 | 151 | for (const auto& uid : _includeItems) { |
| 152 | 152 | result.push_back(uid); |
| @@ -130,7 +130,7 @@ void PickManager<T>::update() { · 129 unmodified lines | ||
| 130 | 130 | PickCacheKey entityKey = { pick->getFilter().getEntityFlags(), pick->getIncludeItems(), pick->getIgnoreItems() }; |
| 131 | 131 | if (!checkAndCompareCachedResults(mathematicalPick, results, res, entityKey)) { |
| 132 | 132 | entityRes = pick->getEntityIntersection(mathematicalPick, !pick->getFilter().doesPickCoarse(), |
| 133 | − pick->getIncludeItemsAs<EntityItemID>(), pick->getIgnoreItemsAs<EntityItemID>(), !invisible, !nonCollidable); | |
| 133 | + pick->(template getIncludeItemsAs<EntityItemID>()), (template pick->getIgnoreItemsAs<EntityItemID>()), !invisible, !nonCollidable); | |
| 134 | 134 | fromCache = false; |
| 135 | 135 | } |
| 136 | 136 | |
| @@ -148,7 +148,7 @@ void PickManager<T>::update() { · 11 unmodified lines | ||
| 148 | 148 | PickCacheKey overlayKey = { pick->getFilter().getOverlayFlags(), pick->getIncludeItems(), pick->getIgnoreItems() }; |
| 149 | 149 | if (!checkAndCompareCachedResults(mathematicalPick, results, res, overlayKey)) { |
| 150 | 150 | overlayRes = pick->getOverlayIntersection(mathematicalPick, !pick->getFilter().doesPickCoarse(), |
| 151 | − pick->getIncludeItemsAs<OverlayID>(), pick->getIgnoreItemsAs<OverlayID>(), !invisible, !nonCollidable); | |
| 151 | + pick->(template getIncludeItemsAs<OverlayID>()), pick->(template getIgnoreItemsAs<OverlayID>()), !invisible, !nonCollidable); | |
| 152 | 152 | fromCache = false; |
| 153 | 153 | } |
| 154 | 154 | |
| @@ -162,7 +162,7 @@ void PickManager<T>::update() { · 7 unmodified lines | ||
| 162 | 162 | PickCacheKey avatarKey = { pick->getFilter().getAvatarFlags(), pick->getIncludeItems(), pick->getIgnoreItems() }; |
| 163 | 163 | if (!checkAndCompareCachedResults(mathematicalPick, results, res, avatarKey)) { |
| 164 | 164 | RayToAvatarIntersectionResult avatarRes = pick->getAvatarIntersection(mathematicalPick, |
| 165 | − pick->getIncludeItemsAs<EntityItemID>(), pick->getIgnoreItemsAs<EntityItemID>()); | |
| 165 | + pick->(template getIncludeItemsAs<EntityItemID>()), pick->(template getIgnoreItemsAs<EntityItemID>())); | |
| 166 | 166 | cacheResult(avatarRes.intersects, RayPickResult(IntersectionType::AVATAR, avatarRes.avatarID, avatarRes.distance, avatarRes.intersection, mathematicalPick), avatarKey, res, mathematicalPick, results); |
| 167 | 167 | } |
| 168 | 168 | } |
| @@ -46,20 +46,20 @@ public slots: · 45 unmodified lines | ||
| 46 | 46 | Q_INVOKABLE void setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreEntities); |
| 47 | 47 | Q_INVOKABLE void setIncludeItems(const QUuid& uid, const QScriptValue& includeEntities); |
| 48 | 48 | |
| 49 | − unsigned int PICK_NOTHING() { return 0; } | |
| 50 | − unsigned int PICK_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ENTITIES); } | |
| 51 | − unsigned int PICK_OVERLAYS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_OVERLAYS); } | |
| 52 | − unsigned int PICK_AVATARS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_AVATARS); } | |
| 53 | − unsigned int PICK_HUD() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_HUD); } | |
| 54 | − unsigned int PICK_COARSE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_COARSE); } | |
| 55 | − unsigned int PICK_INCLUDE_INVISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_INCLUDE_INVISIBLE); } | |
| 56 | − unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_INCLUDE_NONCOLLIDABLE); } | |
| 57 | − unsigned int PICK_ALL_INTERSECTIONS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ALL_INTERSECTIONS); } | |
| 58 | − unsigned int INTERSECTED_NONE() { return IntersectionType::NONE; } | |
| 59 | − unsigned int INTERSECTED_ENTITY() { return IntersectionType::ENTITY; } | |
| 60 | − unsigned int INTERSECTED_OVERLAY() { return IntersectionType::OVERLAY; } | |
| 61 | − unsigned int INTERSECTED_AVATAR() { return IntersectionType::AVATAR; } | |
| 62 | − unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; } | |
| 49 | + static unsigned int PICK_NOTHING() { return 0; } | |
| 50 | + static unsigned int PICK_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ENTITIES); } | |
| 51 | + static unsigned int PICK_OVERLAYS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_OVERLAYS); } | |
| 52 | + static unsigned int PICK_AVATARS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_AVATARS); } | |
| 53 | + static unsigned int PICK_HUD() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_HUD); } | |
| 54 | + static unsigned int PICK_COARSE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_COARSE); } | |
| 55 | + static unsigned int PICK_INCLUDE_INVISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_INCLUDE_INVISIBLE); } | |
| 56 | + static unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_INCLUDE_NONCOLLIDABLE); } | |
| 57 | + static unsigned int PICK_ALL_INTERSECTIONS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ALL_INTERSECTIONS); } | |
| 58 | + static unsigned int INTERSECTED_NONE() { return IntersectionType::NONE; } | |
| 59 | + static unsigned int INTERSECTED_ENTITY() { return IntersectionType::ENTITY; } | |
| 60 | + static unsigned int INTERSECTED_OVERLAY() { return IntersectionType::OVERLAY; } | |
| 61 | + static unsigned int INTERSECTED_AVATAR() { return IntersectionType::AVATAR; } | |
| 62 | + static unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; } | |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | #endif // hifi_RayPickScriptingInterface_h |
| @@ -133,8 +133,7 @@ public: · 132 unmodified lines | ||
| 133 | 133 | glm::vec3 direction; |
| 134 | 134 | |
| 135 | 135 | operator bool() const { |
| 136 | − auto isNan = glm::isnan(origin) || glm::isnan(direction); | |
| 137 | − return !isNan.x && !isNan.y && !isNan.z; | |
| 136 | + return !(glm::any(glm::isnan(origin)) || glm::any(glm::isnan(direction))); | |
| 138 | 137 | } |
| 139 | 138 | bool operator==(const PickRay& other) const { |
| 140 | 139 | return (origin == other.origin && direction == other.direction); |