History

updates based on austin's comments

SamGondelman committed 9 years ago

Commit 640ad511 parent 05f48835 files · +26 −27Browse files

Unified · Split

5 files
  1. interface/src/Application.cpp +2 −2
  2. interface/src/raypick/Pick.h +6 −6
  3. interface/src/raypick/PickManager.h +3 −3
  4. interface/src/raypick/RayPickScriptingInterface.h +14 −14
  5. libraries/shared/src/RegisteredMetaTypes.h +1 −2
interface/src/Application.cpp+2−2
@@ -1819,12 +1819,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1818 unmodified lines
18191819
18201820 // Setup the mouse ray pick and related operators
18211821 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()),
18231823 0.0f, true));
18241824 DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](QUuid rayPickID) {
18251825 RayToEntityIntersectionResult entityResult;
18261826 RayPickResult result = _rayPickManager.getPrevPickResult(rayPickID);
1827− entityResult.intersects = result.type != DependencyManager::get<RayPickScriptingInterface>()->INTERSECTED_NONE();
1827+ entityResult.intersects = result.type != RayPickScriptingInterface::INTERSECTED_NONE();
18281828 if (entityResult.intersects) {
18291829 entityResult.intersection = result.intersection;
18301830 entityResult.distance = result.distance;
interface/src/raypick/Pick.h+6−6
@@ -133,9 +133,9 @@ public: · 132 unmodified lines
133133 QVector<QUuid> getIgnoreItems() const;
134134 QVector<QUuid> getIncludeItems() const;
135135
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;
139139 withReadLock([&] {
140140 for (const auto& uid : _ignoreItems) {
141141 result.push_back(uid);
@@ -144,9 +144,9 @@ public: · 2 unmodified lines
144144 return result;
145145 }
146146
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;
150150 withReadLock([&] {
151151 for (const auto& uid : _includeItems) {
152152 result.push_back(uid);
interface/src/raypick/PickManager.h+3−3
@@ -130,7 +130,7 @@ void PickManager<T>::update() { · 129 unmodified lines
130130 PickCacheKey entityKey = { pick->getFilter().getEntityFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
131131 if (!checkAndCompareCachedResults(mathematicalPick, results, res, entityKey)) {
132132 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);
134134 fromCache = false;
135135 }
136136
@@ -148,7 +148,7 @@ void PickManager<T>::update() { · 11 unmodified lines
148148 PickCacheKey overlayKey = { pick->getFilter().getOverlayFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
149149 if (!checkAndCompareCachedResults(mathematicalPick, results, res, overlayKey)) {
150150 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);
152152 fromCache = false;
153153 }
154154
@@ -162,7 +162,7 @@ void PickManager<T>::update() { · 7 unmodified lines
162162 PickCacheKey avatarKey = { pick->getFilter().getAvatarFlags(), pick->getIncludeItems(), pick->getIgnoreItems() };
163163 if (!checkAndCompareCachedResults(mathematicalPick, results, res, avatarKey)) {
164164 RayToAvatarIntersectionResult avatarRes = pick->getAvatarIntersection(mathematicalPick,
165− pick->getIncludeItemsAs<EntityItemID>(), pick->getIgnoreItemsAs<EntityItemID>());
165+ pick->(template getIncludeItemsAs<EntityItemID>()), pick->(template getIgnoreItemsAs<EntityItemID>()));
166166 cacheResult(avatarRes.intersects, RayPickResult(IntersectionType::AVATAR, avatarRes.avatarID, avatarRes.distance, avatarRes.intersection, mathematicalPick), avatarKey, res, mathematicalPick, results);
167167 }
168168 }
interface/src/raypick/RayPickScriptingInterface.h+14−14
@@ -46,20 +46,20 @@ public slots: · 45 unmodified lines
4646 Q_INVOKABLE void setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreEntities);
4747 Q_INVOKABLE void setIncludeItems(const QUuid& uid, const QScriptValue& includeEntities);
4848
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; }
6363 };
6464
6565 #endif // hifi_RayPickScriptingInterface_h
libraries/shared/src/RegisteredMetaTypes.h+1−2
@@ -133,8 +133,7 @@ public: · 132 unmodified lines
133133 glm::vec3 direction;
134134
135135 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)));
138137 }
139138 bool operator==(const PickRay& other) const {
140139 return (origin == other.origin && direction == other.direction);