mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 15:44:13 +02:00
C++ cleanup for pointers / picking
This commit is contained in:
parent
d276adc3a9
commit
3f99e70af0
22 changed files with 454 additions and 484 deletions
|
@ -198,6 +198,7 @@ endif()
|
||||||
# link required hifi libraries
|
# link required hifi libraries
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
shared octree ktx gpu gl gpu-gl procedural model render
|
shared octree ktx gpu gl gpu-gl procedural model render
|
||||||
|
pointers
|
||||||
recording fbx networking model-networking entities avatars trackers
|
recording fbx networking model-networking entities avatars trackers
|
||||||
audio audio-client animation script-engine physics
|
audio audio-client animation script-engine physics
|
||||||
render-utils entities-renderer avatars-renderer ui auto-updater midi
|
render-utils entities-renderer avatars-renderer ui auto-updater midi
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
//
|
//
|
||||||
#include "JointRayPick.h"
|
#include "JointRayPick.h"
|
||||||
|
|
||||||
#include "DependencyManager.h"
|
|
||||||
#include "avatar/AvatarManager.h"
|
#include "avatar/AvatarManager.h"
|
||||||
|
|
||||||
JointRayPick::JointRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, const float maxDistance, const bool enabled) :
|
JointRayPick::JointRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, const float maxDistance, const bool enabled) :
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#ifndef hifi_JointRayPick_h
|
#ifndef hifi_JointRayPick_h
|
||||||
#define hifi_JointRayPick_h
|
#define hifi_JointRayPick_h
|
||||||
|
|
||||||
#include "RayPick.h"
|
#include <pointers/rays/RayPick.h>
|
||||||
|
|
||||||
class JointRayPick : public RayPick {
|
class JointRayPick : public RayPick {
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "LaserPointer.h"
|
#include "LaserPointer.h"
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "ui/overlays/Overlay.h"
|
|
||||||
#include "avatar/AvatarManager.h"
|
#include "avatar/AvatarManager.h"
|
||||||
|
#include "RayPickScriptingInterface.h"
|
||||||
|
|
||||||
LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates,
|
LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates,
|
||||||
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled) :
|
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled) :
|
||||||
|
@ -21,9 +21,10 @@ LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& rende
|
||||||
_defaultRenderStates(defaultRenderStates),
|
_defaultRenderStates(defaultRenderStates),
|
||||||
_faceAvatar(faceAvatar),
|
_faceAvatar(faceAvatar),
|
||||||
_centerEndY(centerEndY),
|
_centerEndY(centerEndY),
|
||||||
_lockEnd(lockEnd)
|
_lockEnd(lockEnd),
|
||||||
|
_rayPickUID(DependencyManager::get<RayPickScriptingInterface>()->createRayPick(rayProps))
|
||||||
{
|
{
|
||||||
_rayPickUID = DependencyManager::get<RayPickScriptingInterface>()->createRayPick(rayProps);
|
|
||||||
|
|
||||||
for (auto& state : _renderStates) {
|
for (auto& state : _renderStates) {
|
||||||
if (!enabled || state.first != _currentRenderState) {
|
if (!enabled || state.first != _currentRenderState) {
|
||||||
|
@ -38,7 +39,7 @@ LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& rende
|
||||||
}
|
}
|
||||||
|
|
||||||
LaserPointer::~LaserPointer() {
|
LaserPointer::~LaserPointer() {
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->removeRayPick(_rayPickUID);
|
qApp->getRayPickManager().removeRayPick(_rayPickUID);
|
||||||
|
|
||||||
for (auto& renderState : _renderStates) {
|
for (auto& renderState : _renderStates) {
|
||||||
renderState.second.deleteOverlays();
|
renderState.second.deleteOverlays();
|
||||||
|
@ -49,43 +50,47 @@ LaserPointer::~LaserPointer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::enable() {
|
void LaserPointer::enable() {
|
||||||
QWriteLocker lock(getLock());
|
qApp->getRayPickManager().enableRayPick(_rayPickUID);
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->enableRayPick(_rayPickUID);
|
withWriteLock([&] {
|
||||||
_renderingEnabled = true;
|
_renderingEnabled = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::disable() {
|
void LaserPointer::disable() {
|
||||||
QWriteLocker lock(getLock());
|
qApp->getRayPickManager().disableRayPick(_rayPickUID);
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->disableRayPick(_rayPickUID);
|
|
||||||
_renderingEnabled = false;
|
_renderingEnabled = false;
|
||||||
if (!_currentRenderState.empty()) {
|
withWriteLock([&] {
|
||||||
if (_renderStates.find(_currentRenderState) != _renderStates.end()) {
|
if (!_currentRenderState.empty()) {
|
||||||
disableRenderState(_renderStates[_currentRenderState]);
|
if (_renderStates.find(_currentRenderState) != _renderStates.end()) {
|
||||||
|
disableRenderState(_renderStates[_currentRenderState]);
|
||||||
|
}
|
||||||
|
if (_defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
||||||
|
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
});
|
||||||
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setRenderState(const std::string& state) {
|
void LaserPointer::setRenderState(const std::string& state) {
|
||||||
QWriteLocker lock(getLock());
|
withWriteLock([&] {
|
||||||
if (!_currentRenderState.empty() && state != _currentRenderState) {
|
if (!_currentRenderState.empty() && state != _currentRenderState) {
|
||||||
if (_renderStates.find(_currentRenderState) != _renderStates.end()) {
|
if (_renderStates.find(_currentRenderState) != _renderStates.end()) {
|
||||||
disableRenderState(_renderStates[_currentRenderState]);
|
disableRenderState(_renderStates[_currentRenderState]);
|
||||||
|
}
|
||||||
|
if (_defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
||||||
|
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
_currentRenderState = state;
|
||||||
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
_currentRenderState = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) {
|
void LaserPointer::editRenderState(const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) {
|
||||||
QWriteLocker lock(getLock());
|
withWriteLock([&] {
|
||||||
updateRenderStateOverlay(_renderStates[state].getStartID(), startProps);
|
updateRenderStateOverlay(_renderStates[state].getStartID(), startProps);
|
||||||
updateRenderStateOverlay(_renderStates[state].getPathID(), pathProps);
|
updateRenderStateOverlay(_renderStates[state].getPathID(), pathProps);
|
||||||
updateRenderStateOverlay(_renderStates[state].getEndID(), endProps);
|
updateRenderStateOverlay(_renderStates[state].getEndID(), endProps);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant& props) {
|
void LaserPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant& props) {
|
||||||
|
@ -97,7 +102,6 @@ void LaserPointer::updateRenderStateOverlay(const OverlayID& id, const QVariant&
|
||||||
}
|
}
|
||||||
|
|
||||||
const RayPickResult LaserPointer::getPrevRayPickResult() {
|
const RayPickResult LaserPointer::getPrevRayPickResult() {
|
||||||
QReadLocker lock(getLock());
|
|
||||||
return DependencyManager::get<RayPickScriptingInterface>()->getPrevRayPickResult(_rayPickUID);
|
return DependencyManager::get<RayPickScriptingInterface>()->getPrevRayPickResult(_rayPickUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,65 +197,41 @@ void LaserPointer::disableRenderState(const RenderState& renderState) {
|
||||||
|
|
||||||
void LaserPointer::update() {
|
void LaserPointer::update() {
|
||||||
// This only needs to be a read lock because update won't change any of the properties that can be modified from scripts
|
// This only needs to be a read lock because update won't change any of the properties that can be modified from scripts
|
||||||
QReadLocker lock(getLock());
|
withReadLock([&] {
|
||||||
RayPickResult prevRayPickResult = DependencyManager::get<RayPickScriptingInterface>()->getPrevRayPickResult(_rayPickUID);
|
RayPickResult prevRayPickResult = qApp->getRayPickManager().getPrevRayPickResult(_rayPickUID);
|
||||||
if (_renderingEnabled && !_currentRenderState.empty() && _renderStates.find(_currentRenderState) != _renderStates.end() &&
|
if (_renderingEnabled && !_currentRenderState.empty() && _renderStates.find(_currentRenderState) != _renderStates.end() &&
|
||||||
(prevRayPickResult.type != IntersectionType::NONE || _laserLength > 0.0f || !_objectLockEnd.first.isNull())) {
|
(prevRayPickResult.type != IntersectionType::NONE || _laserLength > 0.0f || !_objectLockEnd.first.isNull())) {
|
||||||
float distance = _laserLength > 0.0f ? _laserLength : prevRayPickResult.distance;
|
float distance = _laserLength > 0.0f ? _laserLength : prevRayPickResult.distance;
|
||||||
updateRenderState(_renderStates[_currentRenderState], prevRayPickResult.type, distance, prevRayPickResult.objectID, prevRayPickResult.searchRay, false);
|
updateRenderState(_renderStates[_currentRenderState], prevRayPickResult.type, distance, prevRayPickResult.objectID, prevRayPickResult.searchRay, false);
|
||||||
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
||||||
} else if (_renderingEnabled && !_currentRenderState.empty() && _defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
} else if (_renderingEnabled && !_currentRenderState.empty() && _defaultRenderStates.find(_currentRenderState) != _defaultRenderStates.end()) {
|
||||||
disableRenderState(_renderStates[_currentRenderState]);
|
disableRenderState(_renderStates[_currentRenderState]);
|
||||||
updateRenderState(_defaultRenderStates[_currentRenderState].second, IntersectionType::NONE, _defaultRenderStates[_currentRenderState].first, QUuid(), prevRayPickResult.searchRay, true);
|
updateRenderState(_defaultRenderStates[_currentRenderState].second, IntersectionType::NONE, _defaultRenderStates[_currentRenderState].first, QUuid(), prevRayPickResult.searchRay, true);
|
||||||
} else if (!_currentRenderState.empty()) {
|
} else if (!_currentRenderState.empty()) {
|
||||||
disableRenderState(_renderStates[_currentRenderState]);
|
disableRenderState(_renderStates[_currentRenderState]);
|
||||||
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
disableRenderState(_defaultRenderStates[_currentRenderState].second);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setPrecisionPicking(const bool precisionPicking) {
|
void LaserPointer::setPrecisionPicking(const bool precisionPicking) {
|
||||||
QWriteLocker lock(getLock());
|
qApp->getRayPickManager().setPrecisionPicking(_rayPickUID, precisionPicking);
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setPrecisionPicking(_rayPickUID, precisionPicking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setLaserLength(const float laserLength) {
|
void LaserPointer::setLaserLength(const float laserLength) {
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_laserLength = laserLength;
|
_laserLength = laserLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setLockEndUUID(QUuid objectID, const bool isOverlay) {
|
void LaserPointer::setLockEndUUID(QUuid objectID, const bool isOverlay) {
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_objectLockEnd = std::pair<QUuid, bool>(objectID, isOverlay);
|
_objectLockEnd = std::pair<QUuid, bool>(objectID, isOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setIgnoreEntities(const QScriptValue& ignoreEntities) {
|
void LaserPointer::setIgnoreItems(const QVector<QUuid>& ignoreItems) const {
|
||||||
QWriteLocker lock(getLock());
|
qApp->getRayPickManager().setIgnoreItems(_rayPickUID, ignoreItems);
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIgnoreEntities(_rayPickUID, ignoreEntities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointer::setIncludeEntities(const QScriptValue& includeEntities) {
|
void LaserPointer::setIncludeItems(const QVector<QUuid>& includeItems) const {
|
||||||
QWriteLocker lock(getLock());
|
qApp->getRayPickManager().setIncludeItems(_rayPickUID, includeItems);
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIncludeEntities(_rayPickUID, includeEntities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointer::setIgnoreOverlays(const QScriptValue& ignoreOverlays) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIgnoreOverlays(_rayPickUID, ignoreOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointer::setIncludeOverlays(const QScriptValue& includeOverlays) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIncludeOverlays(_rayPickUID, includeOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointer::setIgnoreAvatars(const QScriptValue& ignoreAvatars) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIgnoreAvatars(_rayPickUID, ignoreAvatars);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointer::setIncludeAvatars(const QScriptValue& includeAvatars) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
DependencyManager::get<RayPickScriptingInterface>()->setIncludeAvatars(_rayPickUID, includeAvatars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderState::RenderState(const OverlayID& startID, const OverlayID& pathID, const OverlayID& endID) :
|
RenderState::RenderState(const OverlayID& startID, const OverlayID& pathID, const OverlayID& endID) :
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
#define hifi_LaserPointer_h
|
#define hifi_LaserPointer_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "glm/glm.hpp"
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include "raypick/RayPickScriptingInterface.h"
|
#include <shared/ReadWriteLockable.h>
|
||||||
|
|
||||||
|
#include "ui/overlays/Overlay.h"
|
||||||
|
|
||||||
class RayPickResult;
|
class RayPickResult;
|
||||||
|
|
||||||
|
@ -44,9 +46,10 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LaserPointer {
|
class LaserPointer : public ReadWriteLockable {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Pointer = std::shared_ptr<LaserPointer>;
|
||||||
|
|
||||||
typedef std::unordered_map<std::string, RenderState> RenderStateMap;
|
typedef std::unordered_map<std::string, RenderState> RenderStateMap;
|
||||||
typedef std::unordered_map<std::string, std::pair<float, RenderState>> DefaultRenderStateMap;
|
typedef std::unordered_map<std::string, std::pair<float, RenderState>> DefaultRenderStateMap;
|
||||||
|
@ -68,14 +71,8 @@ public:
|
||||||
void setLaserLength(const float laserLength);
|
void setLaserLength(const float laserLength);
|
||||||
void setLockEndUUID(QUuid objectID, const bool isOverlay);
|
void setLockEndUUID(QUuid objectID, const bool isOverlay);
|
||||||
|
|
||||||
void setIgnoreEntities(const QScriptValue& ignoreEntities);
|
void setIgnoreItems(const QVector<QUuid>& ignoreItems) const;
|
||||||
void setIncludeEntities(const QScriptValue& includeEntities);
|
void setIncludeItems(const QVector<QUuid>& includeItems) const;
|
||||||
void setIgnoreOverlays(const QScriptValue& ignoreOverlays);
|
|
||||||
void setIncludeOverlays(const QScriptValue& includeOverlays);
|
|
||||||
void setIgnoreAvatars(const QScriptValue& ignoreAvatars);
|
|
||||||
void setIncludeAvatars(const QScriptValue& includeAvatars);
|
|
||||||
|
|
||||||
QReadWriteLock* getLock() { return &_lock; }
|
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
@ -90,8 +87,7 @@ private:
|
||||||
bool _lockEnd;
|
bool _lockEnd;
|
||||||
std::pair<QUuid, bool> _objectLockEnd { std::pair<QUuid, bool>(QUuid(), false)};
|
std::pair<QUuid, bool> _objectLockEnd { std::pair<QUuid, bool>(QUuid(), false)};
|
||||||
|
|
||||||
QUuid _rayPickUID;
|
const QUuid _rayPickUID;
|
||||||
QReadWriteLock _lock;
|
|
||||||
|
|
||||||
void updateRenderStateOverlay(const OverlayID& id, const QVariant& props);
|
void updateRenderStateOverlay(const OverlayID& id, const QVariant& props);
|
||||||
void updateRenderState(const RenderState& renderState, const IntersectionType type, const float distance, const QUuid& objectID, const PickRay& pickRay, const bool defaultState);
|
void updateRenderState(const RenderState& renderState, const IntersectionType type, const float distance, const QUuid& objectID, const PickRay& pickRay, const bool defaultState);
|
||||||
|
|
|
@ -12,138 +12,110 @@
|
||||||
|
|
||||||
QUuid LaserPointerManager::createLaserPointer(const QVariant& rayProps, const LaserPointer::RenderStateMap& renderStates, const LaserPointer::DefaultRenderStateMap& defaultRenderStates,
|
QUuid LaserPointerManager::createLaserPointer(const QVariant& rayProps, const LaserPointer::RenderStateMap& renderStates, const LaserPointer::DefaultRenderStateMap& defaultRenderStates,
|
||||||
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled) {
|
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled) {
|
||||||
|
QUuid result;
|
||||||
std::shared_ptr<LaserPointer> laserPointer = std::make_shared<LaserPointer>(rayProps, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, enabled);
|
std::shared_ptr<LaserPointer> laserPointer = std::make_shared<LaserPointer>(rayProps, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, enabled);
|
||||||
if (!laserPointer->getRayUID().isNull()) {
|
if (!laserPointer->getRayUID().isNull()) {
|
||||||
QWriteLocker containsLock(&_containsLock);
|
result = QUuid::createUuid();
|
||||||
QUuid id = QUuid::createUuid();
|
withWriteLock([&] { _laserPointers[result] = laserPointer; });
|
||||||
_laserPointers[id] = laserPointer;
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
return QUuid();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::removeLaserPointer(const QUuid uid) {
|
|
||||||
QWriteLocker lock(&_containsLock);
|
LaserPointer::Pointer LaserPointerManager::find(const QUuid& uid) const {
|
||||||
_laserPointers.remove(uid);
|
return resultWithReadLock<LaserPointer::Pointer>([&] {
|
||||||
|
auto itr = _laserPointers.find(uid);
|
||||||
|
if (itr != _laserPointers.end()) {
|
||||||
|
return *itr;
|
||||||
|
}
|
||||||
|
return LaserPointer::Pointer();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::enableLaserPointer(const QUuid uid) {
|
|
||||||
QReadLocker lock(&_containsLock);
|
void LaserPointerManager::removeLaserPointer(const QUuid& uid) {
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
withWriteLock([&] {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
_laserPointers.remove(uid);
|
||||||
laserPointer.value()->enable();
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void LaserPointerManager::enableLaserPointer(const QUuid& uid) const {
|
||||||
|
auto laserPointer = find(uid);
|
||||||
|
if (laserPointer) {
|
||||||
|
laserPointer->enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::disableLaserPointer(const QUuid uid) {
|
void LaserPointerManager::disableLaserPointer(const QUuid& uid) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->disable();
|
||||||
laserPointer.value()->disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setRenderState(QUuid uid, const std::string& renderState) {
|
void LaserPointerManager::setRenderState(const QUuid& uid, const std::string& renderState) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setRenderState(renderState);
|
||||||
laserPointer.value()->setRenderState(renderState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::editRenderState(QUuid uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) {
|
void LaserPointerManager::editRenderState(const QUuid& uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->editRenderState(state, startProps, pathProps, endProps);
|
||||||
laserPointer.value()->editRenderState(state, startProps, pathProps, endProps);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RayPickResult LaserPointerManager::getPrevRayPickResult(const QUuid uid) {
|
const RayPickResult LaserPointerManager::getPrevRayPickResult(const QUuid& uid) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
return laserPointer->getPrevRayPickResult();
|
||||||
return laserPointer.value()->getPrevRayPickResult();
|
|
||||||
}
|
}
|
||||||
return RayPickResult();
|
return RayPickResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::update() {
|
void LaserPointerManager::update() {
|
||||||
QReadLocker lock(&_containsLock);
|
auto cachedLaserPointers = resultWithReadLock<QList<std::shared_ptr<LaserPointer>>>([&] {
|
||||||
for (QUuid& uid : _laserPointers.keys()) {
|
return _laserPointers.values();
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
});
|
||||||
laserPointer.value()->update();
|
|
||||||
|
for (const auto& laserPointer : cachedLaserPointers) {
|
||||||
|
laserPointer->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setPrecisionPicking(QUuid uid, const bool precisionPicking) {
|
void LaserPointerManager::setPrecisionPicking(const QUuid& uid, const bool precisionPicking) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setPrecisionPicking(precisionPicking);
|
||||||
laserPointer.value()->setPrecisionPicking(precisionPicking);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setLaserLength(QUuid uid, const float laserLength) {
|
void LaserPointerManager::setLaserLength(const QUuid& uid, const float laserLength) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setLaserLength(laserLength);
|
||||||
laserPointer.value()->setLaserLength(laserLength);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities) {
|
void LaserPointerManager::setIgnoreItems(const QUuid& uid, const QVector<QUuid>& ignoreEntities) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setIgnoreItems(ignoreEntities);
|
||||||
laserPointer.value()->setIgnoreEntities(ignoreEntities);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setIncludeEntities(QUuid uid, const QScriptValue& includeEntities) {
|
void LaserPointerManager::setIncludeItems(const QUuid& uid, const QVector<QUuid>& includeEntities) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setIncludeItems(includeEntities);
|
||||||
laserPointer.value()->setIncludeEntities(includeEntities);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerManager::setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays) {
|
void LaserPointerManager::setLockEndUUID(const QUuid& uid, const QUuid& objectID, const bool isOverlay) const {
|
||||||
QReadLocker lock(&_containsLock);
|
auto laserPointer = find(uid);
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
if (laserPointer) {
|
||||||
if (laserPointer != _laserPointers.end()) {
|
laserPointer->setLockEndUUID(objectID, isOverlay);
|
||||||
laserPointer.value()->setIgnoreOverlays(ignoreOverlays);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointerManager::setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays) {
|
|
||||||
QReadLocker lock(&_containsLock);
|
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
|
||||||
if (laserPointer != _laserPointers.end()) {
|
|
||||||
laserPointer.value()->setIncludeOverlays(includeOverlays);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointerManager::setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars) {
|
|
||||||
QReadLocker lock(&_containsLock);
|
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
|
||||||
if (laserPointer != _laserPointers.end()) {
|
|
||||||
laserPointer.value()->setIgnoreAvatars(ignoreAvatars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointerManager::setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars) {
|
|
||||||
QReadLocker lock(&_containsLock);
|
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
|
||||||
if (laserPointer != _laserPointers.end()) {
|
|
||||||
laserPointer.value()->setIncludeAvatars(includeAvatars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LaserPointerManager::setLockEndUUID(QUuid uid, QUuid objectID, const bool isOverlay) {
|
|
||||||
QReadLocker lock(&_containsLock);
|
|
||||||
auto laserPointer = _laserPointers.find(uid);
|
|
||||||
if (laserPointer != _laserPointers.end()) {
|
|
||||||
laserPointer.value()->setLockEndUUID(objectID, isOverlay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,39 +14,37 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <shared/ReadWriteLockable.h>
|
||||||
|
|
||||||
#include "LaserPointer.h"
|
#include "LaserPointer.h"
|
||||||
|
|
||||||
class RayPickResult;
|
class RayPickResult;
|
||||||
|
|
||||||
class LaserPointerManager {
|
|
||||||
|
class LaserPointerManager : protected ReadWriteLockable {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QUuid createLaserPointer(const QVariant& rayProps, const LaserPointer::RenderStateMap& renderStates, const LaserPointer::DefaultRenderStateMap& defaultRenderStates,
|
QUuid createLaserPointer(const QVariant& rayProps, const LaserPointer::RenderStateMap& renderStates, const LaserPointer::DefaultRenderStateMap& defaultRenderStates,
|
||||||
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled);
|
const bool faceAvatar, const bool centerEndY, const bool lockEnd, const bool enabled);
|
||||||
void removeLaserPointer(const QUuid uid);
|
void removeLaserPointer(const QUuid& uid);
|
||||||
void enableLaserPointer(const QUuid uid);
|
void enableLaserPointer(const QUuid& uid) const;
|
||||||
void disableLaserPointer(const QUuid uid);
|
void disableLaserPointer(const QUuid& uid) const;
|
||||||
void setRenderState(QUuid uid, const std::string& renderState);
|
void setRenderState(const QUuid& uid, const std::string& renderState) const;
|
||||||
void editRenderState(QUuid uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps);
|
void editRenderState(const QUuid& uid, const std::string& state, const QVariant& startProps, const QVariant& pathProps, const QVariant& endProps) const;
|
||||||
const RayPickResult getPrevRayPickResult(const QUuid uid);
|
const RayPickResult getPrevRayPickResult(const QUuid& uid) const;
|
||||||
|
|
||||||
void setPrecisionPicking(QUuid uid, const bool precisionPicking);
|
void setPrecisionPicking(const QUuid& uid, const bool precisionPicking) const;
|
||||||
void setLaserLength(QUuid uid, const float laserLength);
|
void setLaserLength(const QUuid& uid, const float laserLength) const;
|
||||||
void setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities);
|
void setIgnoreItems(const QUuid& uid, const QVector<QUuid>& ignoreEntities) const;
|
||||||
void setIncludeEntities(QUuid uid, const QScriptValue& includeEntities);
|
void setIncludeItems(const QUuid& uid, const QVector<QUuid>& includeEntities) const;
|
||||||
void setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays);
|
|
||||||
void setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays);
|
|
||||||
void setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars);
|
|
||||||
void setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars);
|
|
||||||
|
|
||||||
void setLockEndUUID(QUuid uid, QUuid objectID, const bool isOverlay);
|
void setLockEndUUID(const QUuid& uid, const QUuid& objectID, const bool isOverlay) const;
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
LaserPointer::Pointer find(const QUuid& uid) const;
|
||||||
QHash<QUuid, std::shared_ptr<LaserPointer>> _laserPointers;
|
QHash<QUuid, std::shared_ptr<LaserPointer>> _laserPointers;
|
||||||
QReadWriteLock _containsLock;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_LaserPointerManager_h
|
#endif // hifi_LaserPointerManager_h
|
||||||
|
|
|
@ -11,10 +11,19 @@
|
||||||
|
|
||||||
#include "LaserPointerScriptingInterface.h"
|
#include "LaserPointerScriptingInterface.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include "GLMHelpers.h"
|
|
||||||
|
|
||||||
QUuid LaserPointerScriptingInterface::createLaserPointer(const QVariant& properties) {
|
#include <GLMHelpers.h>
|
||||||
|
#include <RegisteredMetaTypes.h>
|
||||||
|
|
||||||
|
void LaserPointerScriptingInterface::setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreItems) const {
|
||||||
|
qApp->getLaserPointerManager().setIgnoreItems(uid, qVectorQUuidFromScriptValue(ignoreItems));
|
||||||
|
}
|
||||||
|
void LaserPointerScriptingInterface::setIncludeItems(const QUuid& uid, const QScriptValue& includeItems) const {
|
||||||
|
qApp->getLaserPointerManager().setIncludeItems(uid, qVectorQUuidFromScriptValue(includeItems));
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid LaserPointerScriptingInterface::createLaserPointer(const QVariant& properties) const {
|
||||||
QVariantMap propertyMap = properties.toMap();
|
QVariantMap propertyMap = properties.toMap();
|
||||||
|
|
||||||
bool faceAvatar = false;
|
bool faceAvatar = false;
|
||||||
|
@ -69,7 +78,7 @@ QUuid LaserPointerScriptingInterface::createLaserPointer(const QVariant& propert
|
||||||
return qApp->getLaserPointerManager().createLaserPointer(properties, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, enabled);
|
return qApp->getLaserPointerManager().createLaserPointer(properties, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaserPointerScriptingInterface::editRenderState(QUuid uid, const QString& renderState, const QVariant& properties) {
|
void LaserPointerScriptingInterface::editRenderState(const QUuid& uid, const QString& renderState, const QVariant& properties) const {
|
||||||
QVariantMap propMap = properties.toMap();
|
QVariantMap propMap = properties.toMap();
|
||||||
|
|
||||||
QVariant startProps;
|
QVariant startProps;
|
||||||
|
@ -90,7 +99,7 @@ void LaserPointerScriptingInterface::editRenderState(QUuid uid, const QString& r
|
||||||
qApp->getLaserPointerManager().editRenderState(uid, renderState.toStdString(), startProps, pathProps, endProps);
|
qApp->getLaserPointerManager().editRenderState(uid, renderState.toStdString(), startProps, pathProps, endProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RenderState LaserPointerScriptingInterface::buildRenderState(const QVariantMap& propMap) {
|
RenderState LaserPointerScriptingInterface::buildRenderState(const QVariantMap& propMap) {
|
||||||
QUuid startID;
|
QUuid startID;
|
||||||
if (propMap["start"].isValid()) {
|
if (propMap["start"].isValid()) {
|
||||||
QVariantMap startMap = propMap["start"].toMap();
|
QVariantMap startMap = propMap["start"].toMap();
|
||||||
|
|
|
@ -22,27 +22,23 @@ class LaserPointerScriptingInterface : public QObject, public Dependency {
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_INVOKABLE QUuid createLaserPointer(const QVariant& properties);
|
Q_INVOKABLE QUuid createLaserPointer(const QVariant& properties) const;
|
||||||
Q_INVOKABLE void enableLaserPointer(QUuid uid) { qApp->getLaserPointerManager().enableLaserPointer(uid); }
|
Q_INVOKABLE void enableLaserPointer(const QUuid& uid) const { qApp->getLaserPointerManager().enableLaserPointer(uid); }
|
||||||
Q_INVOKABLE void disableLaserPointer(QUuid uid) { qApp->getLaserPointerManager().disableLaserPointer(uid); }
|
Q_INVOKABLE void disableLaserPointer(const QUuid& uid) const { qApp->getLaserPointerManager().disableLaserPointer(uid); }
|
||||||
Q_INVOKABLE void removeLaserPointer(QUuid uid) { qApp->getLaserPointerManager().removeLaserPointer(uid); }
|
Q_INVOKABLE void removeLaserPointer(const QUuid& uid) const { qApp->getLaserPointerManager().removeLaserPointer(uid); }
|
||||||
Q_INVOKABLE void editRenderState(QUuid uid, const QString& renderState, const QVariant& properties);
|
Q_INVOKABLE void editRenderState(const QUuid& uid, const QString& renderState, const QVariant& properties) const;
|
||||||
Q_INVOKABLE void setRenderState(QUuid uid, const QString& renderState) { qApp->getLaserPointerManager().setRenderState(uid, renderState.toStdString()); }
|
Q_INVOKABLE void setRenderState(const QUuid& uid, const QString& renderState) const { qApp->getLaserPointerManager().setRenderState(uid, renderState.toStdString()); }
|
||||||
Q_INVOKABLE RayPickResult getPrevRayPickResult(QUuid uid) { return qApp->getLaserPointerManager().getPrevRayPickResult(uid); }
|
Q_INVOKABLE RayPickResult getPrevRayPickResult(QUuid uid) const { return qApp->getLaserPointerManager().getPrevRayPickResult(uid); }
|
||||||
|
|
||||||
Q_INVOKABLE void setPrecisionPicking(QUuid uid, const bool precisionPicking) { qApp->getLaserPointerManager().setPrecisionPicking(uid, precisionPicking); }
|
Q_INVOKABLE void setPrecisionPicking(const QUuid& uid, bool precisionPicking) const { qApp->getLaserPointerManager().setPrecisionPicking(uid, precisionPicking); }
|
||||||
Q_INVOKABLE void setLaserLength(QUuid uid, const float laserLength) { qApp->getLaserPointerManager().setLaserLength(uid, laserLength); }
|
Q_INVOKABLE void setLaserLength(const QUuid& uid, float laserLength) const { qApp->getLaserPointerManager().setLaserLength(uid, laserLength); }
|
||||||
Q_INVOKABLE void setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities) { qApp->getLaserPointerManager().setIgnoreEntities(uid, ignoreEntities); }
|
Q_INVOKABLE void setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreEntities) const;
|
||||||
Q_INVOKABLE void setIncludeEntities(QUuid uid, const QScriptValue& includeEntities) { qApp->getLaserPointerManager().setIncludeEntities(uid, includeEntities); }
|
Q_INVOKABLE void setIncludeItems(const QUuid& uid, const QScriptValue& includeEntities) const;
|
||||||
Q_INVOKABLE void setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays) { qApp->getLaserPointerManager().setIgnoreOverlays(uid, ignoreOverlays); }
|
|
||||||
Q_INVOKABLE void setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays) { qApp->getLaserPointerManager().setIncludeOverlays(uid, includeOverlays); }
|
|
||||||
Q_INVOKABLE void setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars) { qApp->getLaserPointerManager().setIgnoreAvatars(uid, ignoreAvatars); }
|
|
||||||
Q_INVOKABLE void setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars) { qApp->getLaserPointerManager().setIncludeAvatars(uid, includeAvatars); }
|
|
||||||
|
|
||||||
Q_INVOKABLE void setLockEndUUID(QUuid uid, QUuid objectID, const bool isOverlay) { qApp->getLaserPointerManager().setLockEndUUID(uid, objectID, isOverlay); }
|
Q_INVOKABLE void setLockEndUUID(const QUuid& uid, const QUuid& objectID, bool isOverlay) const { qApp->getLaserPointerManager().setLockEndUUID(uid, objectID, isOverlay); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const RenderState buildRenderState(const QVariantMap& propMap);
|
static RenderState buildRenderState(const QVariantMap& propMap);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#ifndef hifi_MouseRayPick_h
|
#ifndef hifi_MouseRayPick_h
|
||||||
#define hifi_MouseRayPick_h
|
#define hifi_MouseRayPick_h
|
||||||
|
|
||||||
#include "RayPick.h"
|
#include <pointers/rays/RayPick.h>
|
||||||
|
|
||||||
class MouseRayPick : public RayPick {
|
class MouseRayPick : public RayPick {
|
||||||
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
//
|
|
||||||
// RayPick.cpp
|
|
||||||
// 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
|
|
||||||
//
|
|
||||||
#include "RayPick.h"
|
|
||||||
|
|
||||||
RayPick::RayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled) :
|
|
||||||
_filter(filter),
|
|
||||||
_maxDistance(maxDistance),
|
|
||||||
_enabled(enabled)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
void RayPick::enable() {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::disable() {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RayPickResult& RayPick::getPrevRayPickResult() {
|
|
||||||
QReadLocker lock(getLock());
|
|
||||||
return _prevResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIgnoreEntities(const QScriptValue& ignoreEntities) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_ignoreEntities = qVectorEntityItemIDFromScriptValue(ignoreEntities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIncludeEntities(const QScriptValue& includeEntities) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_includeEntities = qVectorEntityItemIDFromScriptValue(includeEntities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIgnoreOverlays(const QScriptValue& ignoreOverlays) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_ignoreOverlays = qVectorOverlayIDFromScriptValue(ignoreOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIncludeOverlays(const QScriptValue& includeOverlays) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_includeOverlays = qVectorOverlayIDFromScriptValue(includeOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIgnoreAvatars(const QScriptValue& ignoreAvatars) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_ignoreAvatars = qVectorEntityItemIDFromScriptValue(ignoreAvatars);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPick::setIncludeAvatars(const QScriptValue& includeAvatars) {
|
|
||||||
QWriteLocker lock(getLock());
|
|
||||||
_includeAvatars = qVectorEntityItemIDFromScriptValue(includeAvatars);
|
|
||||||
}
|
|
|
@ -10,6 +10,8 @@
|
||||||
//
|
//
|
||||||
#include "RayPickManager.h"
|
#include "RayPickManager.h"
|
||||||
|
|
||||||
|
#include <pointers/rays/StaticRayPick.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "EntityScriptingInterface.h"
|
#include "EntityScriptingInterface.h"
|
||||||
#include "ui/overlays/Overlays.h"
|
#include "ui/overlays/Overlays.h"
|
||||||
|
@ -18,7 +20,6 @@
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
|
|
||||||
#include "JointRayPick.h"
|
#include "JointRayPick.h"
|
||||||
#include "StaticRayPick.h"
|
|
||||||
#include "MouseRayPick.h"
|
#include "MouseRayPick.h"
|
||||||
|
|
||||||
bool RayPickManager::checkAndCompareCachedResults(QPair<glm::vec3, glm::vec3>& ray, RayPickCache& cache, RayPickResult& res, const RayPickFilter::Flags& mask) {
|
bool RayPickManager::checkAndCompareCachedResults(QPair<glm::vec3, glm::vec3>& ray, RayPickCache& cache, RayPickResult& res, const RayPickFilter::Flags& mask) {
|
||||||
|
@ -43,20 +44,26 @@ void RayPickManager::cacheResult(const bool intersects, const RayPickResult& res
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::update() {
|
void RayPickManager::update() {
|
||||||
QReadLocker lock(&_containsLock);
|
|
||||||
RayPickCache results;
|
RayPickCache results;
|
||||||
for (auto& uid : _rayPicks.keys()) {
|
QHash<QUuid, RayPick::Pointer> cachedRayPicks;
|
||||||
std::shared_ptr<RayPick> rayPick = _rayPicks[uid];
|
withReadLock([&] {
|
||||||
QWriteLocker lock(rayPick->getLock());
|
cachedRayPicks = _rayPicks;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const auto& uid : cachedRayPicks.keys()) {
|
||||||
|
std::shared_ptr<RayPick> rayPick = cachedRayPicks[uid];
|
||||||
if (!rayPick->isEnabled() || rayPick->getFilter().doesPickNothing() || rayPick->getMaxDistance() < 0.0f) {
|
if (!rayPick->isEnabled() || rayPick->getFilter().doesPickNothing() || rayPick->getMaxDistance() < 0.0f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid;
|
PickRay ray;
|
||||||
PickRay ray = rayPick->getPickRay(valid);
|
|
||||||
|
|
||||||
if (!valid) {
|
{
|
||||||
continue;
|
bool valid;
|
||||||
|
ray = rayPick->getPickRay(valid);
|
||||||
|
if (!valid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<glm::vec3, glm::vec3> rayKey = QPair<glm::vec3, glm::vec3>(ray.origin, ray.direction);
|
QPair<glm::vec3, glm::vec3> rayKey = QPair<glm::vec3, glm::vec3>(ray.origin, ray.direction);
|
||||||
|
@ -69,8 +76,8 @@ void RayPickManager::update() {
|
||||||
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
||||||
RayPickFilter::Flags entityMask = rayPick->getFilter().getEntityFlags();
|
RayPickFilter::Flags entityMask = rayPick->getFilter().getEntityFlags();
|
||||||
if (!checkAndCompareCachedResults(rayKey, results, res, entityMask)) {
|
if (!checkAndCompareCachedResults(rayKey, results, res, entityMask)) {
|
||||||
entityRes = DependencyManager::get<EntityScriptingInterface>()->findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCourse(),
|
entityRes = DependencyManager::get<EntityScriptingInterface>()->findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCoarse(),
|
||||||
rayPick->getIncludeEntites(), rayPick->getIgnoreEntites(), !invisible, !nonCollidable);
|
rayPick->getIncludeItemsAs<EntityItemID>(), rayPick->getIgnoreItemsAs<EntityItemID>(), !invisible, !nonCollidable);
|
||||||
fromCache = false;
|
fromCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +94,8 @@ void RayPickManager::update() {
|
||||||
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
||||||
RayPickFilter::Flags overlayMask = rayPick->getFilter().getOverlayFlags();
|
RayPickFilter::Flags overlayMask = rayPick->getFilter().getOverlayFlags();
|
||||||
if (!checkAndCompareCachedResults(rayKey, results, res, overlayMask)) {
|
if (!checkAndCompareCachedResults(rayKey, results, res, overlayMask)) {
|
||||||
overlayRes = qApp->getOverlays().findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCourse(),
|
overlayRes = qApp->getOverlays().findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCoarse(),
|
||||||
rayPick->getIncludeOverlays(), rayPick->getIgnoreOverlays(), !invisible, !nonCollidable);
|
rayPick->getIncludeItemsAs<OverlayID>(), rayPick->getIgnoreItemsAs<OverlayID>(), !invisible, !nonCollidable);
|
||||||
fromCache = false;
|
fromCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +108,8 @@ void RayPickManager::update() {
|
||||||
if (rayPick->getFilter().doesPickAvatars()) {
|
if (rayPick->getFilter().doesPickAvatars()) {
|
||||||
RayPickFilter::Flags avatarMask = rayPick->getFilter().getAvatarFlags();
|
RayPickFilter::Flags avatarMask = rayPick->getFilter().getAvatarFlags();
|
||||||
if (!checkAndCompareCachedResults(rayKey, results, res, avatarMask)) {
|
if (!checkAndCompareCachedResults(rayKey, results, res, avatarMask)) {
|
||||||
RayToAvatarIntersectionResult avatarRes = DependencyManager::get<AvatarManager>()->findRayIntersectionVector(ray, rayPick->getIncludeAvatars(), rayPick->getIgnoreAvatars());
|
RayToAvatarIntersectionResult avatarRes = DependencyManager::get<AvatarManager>()->findRayIntersectionVector(ray,
|
||||||
|
rayPick->getIncludeItemsAs<EntityItemID>(), rayPick->getIgnoreItemsAs<EntityItemID>());
|
||||||
cacheResult(avatarRes.intersects, RayPickResult(IntersectionType::AVATAR, avatarRes.avatarID, avatarRes.distance, avatarRes.intersection, ray), avatarMask, res, rayKey, results);
|
cacheResult(avatarRes.intersects, RayPickResult(IntersectionType::AVATAR, avatarRes.avatarID, avatarRes.distance, avatarRes.intersection, ray), avatarMask, res, rayKey, results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,109 +131,87 @@ void RayPickManager::update() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid RayPickManager::createRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, const float maxDistance, const bool enabled) {
|
QUuid RayPickManager::createRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, float maxDistance, bool enabled) {
|
||||||
QWriteLocker lock(&_containsLock);
|
auto newRayPick = std::make_shared<JointRayPick>(jointName, posOffset, dirOffset, filter, maxDistance, enabled);
|
||||||
QUuid id = QUuid::createUuid();
|
QUuid id = QUuid::createUuid();
|
||||||
_rayPicks[id] = std::make_shared<JointRayPick>(jointName, posOffset, dirOffset, filter, maxDistance, enabled);
|
withWriteLock([&] {
|
||||||
|
_rayPicks[id] = newRayPick;
|
||||||
|
});
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid RayPickManager::createRayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled) {
|
QUuid RayPickManager::createRayPick(const RayPickFilter& filter, float maxDistance, bool enabled) {
|
||||||
QWriteLocker lock(&_containsLock);
|
|
||||||
QUuid id = QUuid::createUuid();
|
QUuid id = QUuid::createUuid();
|
||||||
_rayPicks[id] = std::make_shared<MouseRayPick>(filter, maxDistance, enabled);
|
auto newRayPick = std::make_shared<MouseRayPick>(filter, maxDistance, enabled);
|
||||||
|
withWriteLock([&] {
|
||||||
|
_rayPicks[id] = newRayPick;
|
||||||
|
});
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid RayPickManager::createRayPick(const glm::vec3& position, const glm::vec3& direction, const RayPickFilter& filter, const float maxDistance, const bool enabled) {
|
QUuid RayPickManager::createRayPick(const glm::vec3& position, const glm::vec3& direction, const RayPickFilter& filter, float maxDistance, bool enabled) {
|
||||||
QWriteLocker lock(&_containsLock);
|
|
||||||
QUuid id = QUuid::createUuid();
|
QUuid id = QUuid::createUuid();
|
||||||
_rayPicks[id] = std::make_shared<StaticRayPick>(position, direction, filter, maxDistance, enabled);
|
auto newRayPick = std::make_shared<StaticRayPick>(position, direction, filter, maxDistance, enabled);
|
||||||
|
withWriteLock([&] {
|
||||||
|
_rayPicks[id] = newRayPick;
|
||||||
|
});
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::removeRayPick(const QUuid uid) {
|
void RayPickManager::removeRayPick(const QUuid& uid) {
|
||||||
QWriteLocker lock(&_containsLock);
|
withWriteLock([&] {
|
||||||
_rayPicks.remove(uid);
|
_rayPicks.remove(uid);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::enableRayPick(const QUuid uid) {
|
RayPick::Pointer RayPickManager::findRayPick(const QUuid& uid) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
return resultWithReadLock<RayPick::Pointer>([&] {
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (_rayPicks.contains(uid)) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
return _rayPicks[uid];
|
||||||
rayPick.value()->enable();
|
}
|
||||||
|
return RayPick::Pointer();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPickManager::enableRayPick(const QUuid& uid) const {
|
||||||
|
auto rayPick = findRayPick(uid);
|
||||||
|
if (rayPick) {
|
||||||
|
rayPick->enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::disableRayPick(const QUuid uid) {
|
void RayPickManager::disableRayPick(const QUuid& uid) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
auto rayPick = findRayPick(uid);
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (rayPick) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
rayPick->disable();
|
||||||
rayPick.value()->disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RayPickResult RayPickManager::getPrevRayPickResult(const QUuid uid) {
|
RayPickResult RayPickManager::getPrevRayPickResult(const QUuid& uid) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
auto rayPick = findRayPick(uid);
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (rayPick) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
return rayPick->getPrevRayPickResult();
|
||||||
return rayPick.value()->getPrevRayPickResult();
|
|
||||||
}
|
}
|
||||||
return RayPickResult();
|
return RayPickResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::setPrecisionPicking(QUuid uid, const bool precisionPicking) {
|
void RayPickManager::setPrecisionPicking(const QUuid& uid, bool precisionPicking) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
auto rayPick = findRayPick(uid);
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (rayPick) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
rayPick->setPrecisionPicking(precisionPicking);
|
||||||
rayPick.value()->setPrecisionPicking(precisionPicking);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities) {
|
void RayPickManager::setIgnoreItems(const QUuid& uid, const QVector<QUuid>& ignore) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
auto rayPick = findRayPick(uid);
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (rayPick) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
rayPick->setIgnoreItems(ignore);
|
||||||
rayPick.value()->setIgnoreEntities(ignoreEntities);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickManager::setIncludeEntities(QUuid uid, const QScriptValue& includeEntities) {
|
void RayPickManager::setIncludeItems(const QUuid& uid, const QVector<QUuid>& include) const {
|
||||||
QReadLocker containsLock(&_containsLock);
|
auto rayPick = findRayPick(uid);
|
||||||
auto rayPick = _rayPicks.find(uid);
|
if (rayPick) {
|
||||||
if (rayPick != _rayPicks.end()) {
|
rayPick->setIncludeItems(include);
|
||||||
rayPick.value()->setIncludeEntities(includeEntities);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickManager::setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays) {
|
|
||||||
QReadLocker containsLock(&_containsLock);
|
|
||||||
auto rayPick = _rayPicks.find(uid);
|
|
||||||
if (rayPick != _rayPicks.end()) {
|
|
||||||
rayPick.value()->setIgnoreOverlays(ignoreOverlays);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickManager::setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays) {
|
|
||||||
QReadLocker containsLock(&_containsLock);
|
|
||||||
auto rayPick = _rayPicks.find(uid);
|
|
||||||
if (rayPick != _rayPicks.end()) {
|
|
||||||
rayPick.value()->setIncludeOverlays(includeOverlays);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickManager::setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars) {
|
|
||||||
QReadLocker containsLock(&_containsLock);
|
|
||||||
auto rayPick = _rayPicks.find(uid);
|
|
||||||
if (rayPick != _rayPicks.end()) {
|
|
||||||
rayPick.value()->setIgnoreAvatars(ignoreAvatars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickManager::setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars) {
|
|
||||||
QReadLocker containsLock(&_containsLock);
|
|
||||||
auto rayPick = _rayPicks.find(uid);
|
|
||||||
if (rayPick != _rayPicks.end()) {
|
|
||||||
rayPick.value()->setIncludeAvatars(includeAvatars);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,19 +11,20 @@
|
||||||
#ifndef hifi_RayPickManager_h
|
#ifndef hifi_RayPickManager_h
|
||||||
#define hifi_RayPickManager_h
|
#define hifi_RayPickManager_h
|
||||||
|
|
||||||
#include "RayPick.h"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QtCore/QObject>
|
|
||||||
|
|
||||||
#include "RegisteredMetaTypes.h"
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
#include <RegisteredMetaTypes.h>
|
||||||
|
#include <pointers/rays/RayPick.h>
|
||||||
|
|
||||||
|
|
||||||
class RayPickResult;
|
class RayPickResult;
|
||||||
|
|
||||||
class RayPickManager {
|
class RayPickManager : protected ReadWriteLockable {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void update();
|
void update();
|
||||||
|
@ -31,22 +32,18 @@ public:
|
||||||
QUuid createRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
QUuid createRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
||||||
QUuid createRayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
QUuid createRayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
||||||
QUuid createRayPick(const glm::vec3& position, const glm::vec3& direction, const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
QUuid createRayPick(const glm::vec3& position, const glm::vec3& direction, const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
||||||
void removeRayPick(const QUuid uid);
|
void removeRayPick(const QUuid& uid);
|
||||||
void enableRayPick(const QUuid uid);
|
void enableRayPick(const QUuid& uid) const;
|
||||||
void disableRayPick(const QUuid uid);
|
void disableRayPick(const QUuid& uid) const;
|
||||||
const RayPickResult getPrevRayPickResult(const QUuid uid);
|
RayPickResult getPrevRayPickResult(const QUuid& uid) const;
|
||||||
|
|
||||||
void setPrecisionPicking(QUuid uid, const bool precisionPicking);
|
void setPrecisionPicking(const QUuid& uid, bool precisionPicking) const;
|
||||||
void setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities);
|
void setIgnoreItems(const QUuid& uid, const QVector<QUuid>& ignore) const;
|
||||||
void setIncludeEntities(QUuid uid, const QScriptValue& includeEntities);
|
void setIncludeItems(const QUuid& uid, const QVector<QUuid>& include) const;
|
||||||
void setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays);
|
|
||||||
void setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays);
|
|
||||||
void setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars);
|
|
||||||
void setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<QUuid, std::shared_ptr<RayPick>> _rayPicks;
|
RayPick::Pointer findRayPick(const QUuid& uid) const;
|
||||||
QReadWriteLock _containsLock;
|
QHash<QUuid, RayPick::Pointer> _rayPicks;
|
||||||
|
|
||||||
typedef QHash<QPair<glm::vec3, glm::vec3>, std::unordered_map<RayPickFilter::Flags, RayPickResult>> RayPickCache;
|
typedef QHash<QPair<glm::vec3, glm::vec3>, std::unordered_map<RayPickFilter::Flags, RayPickResult>> RayPickCache;
|
||||||
|
|
||||||
|
|
|
@ -66,46 +66,30 @@ QUuid RayPickScriptingInterface::createRayPick(const QVariant& properties) {
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::enableRayPick(QUuid uid) {
|
void RayPickScriptingInterface::enableRayPick(const QUuid& uid) {
|
||||||
qApp->getRayPickManager().enableRayPick(uid);
|
qApp->getRayPickManager().enableRayPick(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::disableRayPick(QUuid uid) {
|
void RayPickScriptingInterface::disableRayPick(const QUuid& uid) {
|
||||||
qApp->getRayPickManager().disableRayPick(uid);
|
qApp->getRayPickManager().disableRayPick(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::removeRayPick(QUuid uid) {
|
void RayPickScriptingInterface::removeRayPick(const QUuid& uid) {
|
||||||
qApp->getRayPickManager().removeRayPick(uid);
|
qApp->getRayPickManager().removeRayPick(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
RayPickResult RayPickScriptingInterface::getPrevRayPickResult(QUuid uid) {
|
RayPickResult RayPickScriptingInterface::getPrevRayPickResult(const QUuid& uid) {
|
||||||
return qApp->getRayPickManager().getPrevRayPickResult(uid);
|
return qApp->getRayPickManager().getPrevRayPickResult(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::setPrecisionPicking(QUuid uid, const bool precisionPicking) {
|
void RayPickScriptingInterface::setPrecisionPicking(const QUuid& uid, const bool precisionPicking) {
|
||||||
qApp->getRayPickManager().setPrecisionPicking(uid, precisionPicking);
|
qApp->getRayPickManager().setPrecisionPicking(uid, precisionPicking);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities) {
|
void RayPickScriptingInterface::setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreItems) {
|
||||||
qApp->getRayPickManager().setIgnoreEntities(uid, ignoreEntities);
|
qApp->getRayPickManager().setIgnoreItems(uid, qVectorQUuidFromScriptValue(ignoreItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIncludeEntities(QUuid uid, const QScriptValue& includeEntities) {
|
void RayPickScriptingInterface::setIncludeItems(const QUuid& uid, const QScriptValue& includeItems) {
|
||||||
qApp->getRayPickManager().setIncludeEntities(uid, includeEntities);
|
qApp->getRayPickManager().setIncludeItems(uid, qVectorQUuidFromScriptValue(includeItems));
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays) {
|
|
||||||
qApp->getRayPickManager().setIgnoreOverlays(uid, ignoreOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays) {
|
|
||||||
qApp->getRayPickManager().setIncludeOverlays(uid, includeOverlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars) {
|
|
||||||
qApp->getRayPickManager().setIgnoreAvatars(uid, ignoreAvatars);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RayPickScriptingInterface::setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars) {
|
|
||||||
qApp->getRayPickManager().setIncludeAvatars(uid, includeAvatars);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include "RegisteredMetaTypes.h"
|
#include <RegisteredMetaTypes.h>
|
||||||
#include "DependencyManager.h"
|
#include <DependencyManager.h>
|
||||||
|
#include <pointers/rays/RayPick.h>
|
||||||
#include "RayPick.h"
|
|
||||||
|
|
||||||
class RayPickScriptingInterface : public QObject, public Dependency {
|
class RayPickScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -38,25 +37,21 @@ class RayPickScriptingInterface : public QObject, public Dependency {
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_INVOKABLE QUuid createRayPick(const QVariant& properties);
|
Q_INVOKABLE QUuid createRayPick(const QVariant& properties);
|
||||||
Q_INVOKABLE void enableRayPick(QUuid uid);
|
Q_INVOKABLE void enableRayPick(const QUuid& uid);
|
||||||
Q_INVOKABLE void disableRayPick(QUuid uid);
|
Q_INVOKABLE void disableRayPick(const QUuid& uid);
|
||||||
Q_INVOKABLE void removeRayPick(QUuid uid);
|
Q_INVOKABLE void removeRayPick(const QUuid& uid);
|
||||||
Q_INVOKABLE RayPickResult getPrevRayPickResult(QUuid uid);
|
Q_INVOKABLE RayPickResult getPrevRayPickResult(const QUuid& uid);
|
||||||
|
|
||||||
Q_INVOKABLE void setPrecisionPicking(QUuid uid, const bool precisionPicking);
|
Q_INVOKABLE void setPrecisionPicking(const QUuid& uid, const bool precisionPicking);
|
||||||
Q_INVOKABLE void setIgnoreEntities(QUuid uid, const QScriptValue& ignoreEntities);
|
Q_INVOKABLE void setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreEntities);
|
||||||
Q_INVOKABLE void setIncludeEntities(QUuid uid, const QScriptValue& includeEntities);
|
Q_INVOKABLE void setIncludeItems(const QUuid& uid, const QScriptValue& includeEntities);
|
||||||
Q_INVOKABLE void setIgnoreOverlays(QUuid uid, const QScriptValue& ignoreOverlays);
|
|
||||||
Q_INVOKABLE void setIncludeOverlays(QUuid uid, const QScriptValue& includeOverlays);
|
|
||||||
Q_INVOKABLE void setIgnoreAvatars(QUuid uid, const QScriptValue& ignoreAvatars);
|
|
||||||
Q_INVOKABLE void setIncludeAvatars(QUuid uid, const QScriptValue& includeAvatars);
|
|
||||||
|
|
||||||
unsigned int PICK_NOTHING() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_NOTHING); }
|
unsigned int PICK_NOTHING() { return 0; }
|
||||||
unsigned int PICK_ENTITIES() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_ENTITIES); }
|
unsigned int PICK_ENTITIES() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_ENTITIES); }
|
||||||
unsigned int PICK_OVERLAYS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_OVERLAYS); }
|
unsigned int PICK_OVERLAYS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_OVERLAYS); }
|
||||||
unsigned int PICK_AVATARS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_AVATARS); }
|
unsigned int PICK_AVATARS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_AVATARS); }
|
||||||
unsigned int PICK_HUD() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_HUD); }
|
unsigned int PICK_HUD() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_HUD); }
|
||||||
unsigned int PICK_COURSE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_COURSE); }
|
unsigned int PICK_COARSE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_COARSE); }
|
||||||
unsigned int PICK_INCLUDE_INVISIBLE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_INCLUDE_INVISIBLE); }
|
unsigned int PICK_INCLUDE_INVISIBLE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_INCLUDE_INVISIBLE); }
|
||||||
unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_INCLUDE_NONCOLLIDABLE); }
|
unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_INCLUDE_NONCOLLIDABLE); }
|
||||||
unsigned int PICK_ALL_INTERSECTIONS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_ALL_INTERSECTIONS); }
|
unsigned int PICK_ALL_INTERSECTIONS() { return RayPickFilter::getBitMask(RayPickFilter::FlagBit::PICK_ALL_INTERSECTIONS); }
|
||||||
|
|
5
libraries/pointers/CMakeLists.txt
Normal file
5
libraries/pointers/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
set(TARGET_NAME pointers)
|
||||||
|
setup_hifi_library()
|
||||||
|
GroupSources(src)
|
||||||
|
link_hifi_libraries(shared)
|
||||||
|
|
1
libraries/pointers/src/pointers/PointerManager.cpp
Normal file
1
libraries/pointers/src/pointers/PointerManager.cpp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include "PointerManager.h"
|
29
libraries/pointers/src/pointers/PointerManager.h
Normal file
29
libraries/pointers/src/pointers/PointerManager.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2017/10/16
|
||||||
|
// Copyright 2013-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_pointers_PointerManager_h
|
||||||
|
#define hifi_pointers_PointerManager_h
|
||||||
|
|
||||||
|
#include <DependencyManager.h>
|
||||||
|
#include <PointerEvent.h>
|
||||||
|
|
||||||
|
class PointerManager : public QObject, public Dependency {
|
||||||
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY
|
||||||
|
public:
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void triggerBegin(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
void triggerContinue(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
void triggerEnd(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
|
||||||
|
void hoverEnter(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
void hoverOver(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
void hoverLeave(const QUuid& id, const PointerEvent& pointerEvent);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_RayPick_h
|
75
libraries/pointers/src/pointers/rays/RayPick.cpp
Normal file
75
libraries/pointers/src/pointers/rays/RayPick.cpp
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
#include "RayPick.h"
|
||||||
|
|
||||||
|
const RayPickFilter RayPickFilter::NOTHING;
|
||||||
|
|
||||||
|
RayPick::RayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled) :
|
||||||
|
_filter(filter),
|
||||||
|
_maxDistance(maxDistance),
|
||||||
|
_enabled(enabled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPick::enable(bool enabled) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_enabled = enabled;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
RayPickFilter RayPick::getFilter() const {
|
||||||
|
return resultWithReadLock<RayPickFilter>([&] {
|
||||||
|
return _filter;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
float RayPick::getMaxDistance() const {
|
||||||
|
return _maxDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RayPick::isEnabled() const {
|
||||||
|
return _enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPick::setPrecisionPicking(bool precisionPicking) {
|
||||||
|
withWriteLock([&]{
|
||||||
|
_filter.setFlag(RayPickFilter::PICK_COARSE, !precisionPicking);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPick::setRayPickResult(const RayPickResult& rayPickResult) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_prevResult = rayPickResult;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<QUuid> RayPick::getIgnoreItems() const {
|
||||||
|
return _ignoreItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<QUuid> RayPick::getIncludeItems() const {
|
||||||
|
return _includeItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
RayPickResult RayPick::getPrevRayPickResult() const {
|
||||||
|
return resultWithReadLock<RayPickResult>([&] {
|
||||||
|
return _prevResult;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPick::setIgnoreItems(const QVector<QUuid>& ignoreItems) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_ignoreItems = ignoreItems;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void RayPick::setIncludeItems(const QVector<QUuid>& includeItems) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_includeItems = includeItems;
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,7 +1,4 @@
|
||||||
//
|
//
|
||||||
// RayPick.h
|
|
||||||
// interface/src/raypick
|
|
||||||
//
|
|
||||||
// Created by Sam Gondelman 7/11/2017
|
// Created by Sam Gondelman 7/11/2017
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,22 +9,22 @@
|
||||||
#define hifi_RayPick_h
|
#define hifi_RayPick_h
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "RegisteredMetaTypes.h"
|
#include <bitset>
|
||||||
|
|
||||||
#include "EntityItemID.h"
|
#include <QtCore/QUuid>
|
||||||
#include "ui/overlays/Overlay.h"
|
|
||||||
#include <QReadWriteLock>
|
#include <RegisteredMetaTypes.h>
|
||||||
|
#include <shared/ReadWriteLockable.h>
|
||||||
|
|
||||||
class RayPickFilter {
|
class RayPickFilter {
|
||||||
public:
|
public:
|
||||||
enum FlagBit {
|
enum FlagBit {
|
||||||
PICK_NOTHING = 0,
|
PICK_ENTITIES = 0,
|
||||||
PICK_ENTITIES,
|
|
||||||
PICK_OVERLAYS,
|
PICK_OVERLAYS,
|
||||||
PICK_AVATARS,
|
PICK_AVATARS,
|
||||||
PICK_HUD,
|
PICK_HUD,
|
||||||
|
|
||||||
PICK_COURSE, // if not set, does precise intersection, otherwise, doesn't
|
PICK_COARSE, // if not set, does precise intersection, otherwise, doesn't
|
||||||
|
|
||||||
PICK_INCLUDE_INVISIBLE, // if not set, will not intersect invisible elements, otherwise, intersects both visible and invisible elements
|
PICK_INCLUDE_INVISIBLE, // if not set, will not intersect invisible elements, otherwise, intersects both visible and invisible elements
|
||||||
PICK_INCLUDE_NONCOLLIDABLE, // if not set, will not intersect noncollidable elements, otherwise, intersects both collidable and noncollidable elements
|
PICK_INCLUDE_NONCOLLIDABLE, // if not set, will not intersect noncollidable elements, otherwise, intersects both collidable and noncollidable elements
|
||||||
|
@ -42,7 +39,7 @@ public:
|
||||||
// The key is the Flags
|
// The key is the Flags
|
||||||
Flags _flags;
|
Flags _flags;
|
||||||
|
|
||||||
RayPickFilter() : _flags(getBitMask(PICK_NOTHING)) {}
|
RayPickFilter() {}
|
||||||
RayPickFilter(const Flags& flags) : _flags(flags) {}
|
RayPickFilter(const Flags& flags) : _flags(flags) {}
|
||||||
|
|
||||||
bool operator== (const RayPickFilter& rhs) const { return _flags == rhs._flags; }
|
bool operator== (const RayPickFilter& rhs) const { return _flags == rhs._flags; }
|
||||||
|
@ -50,13 +47,13 @@ public:
|
||||||
|
|
||||||
void setFlag(FlagBit flag, bool value) { _flags[flag] = value; }
|
void setFlag(FlagBit flag, bool value) { _flags[flag] = value; }
|
||||||
|
|
||||||
bool doesPickNothing() const { return _flags[PICK_NOTHING]; }
|
bool doesPickNothing() const { return _flags == NOTHING._flags; }
|
||||||
bool doesPickEntities() const { return _flags[PICK_ENTITIES]; }
|
bool doesPickEntities() const { return _flags[PICK_ENTITIES]; }
|
||||||
bool doesPickOverlays() const { return _flags[PICK_OVERLAYS]; }
|
bool doesPickOverlays() const { return _flags[PICK_OVERLAYS]; }
|
||||||
bool doesPickAvatars() const { return _flags[PICK_AVATARS]; }
|
bool doesPickAvatars() const { return _flags[PICK_AVATARS]; }
|
||||||
bool doesPickHUD() const { return _flags[PICK_HUD]; }
|
bool doesPickHUD() const { return _flags[PICK_HUD]; }
|
||||||
|
|
||||||
bool doesPickCourse() const { return _flags[PICK_COURSE]; }
|
bool doesPickCoarse() const { return _flags[PICK_COARSE]; }
|
||||||
bool doesPickInvisible() const { return _flags[PICK_INCLUDE_INVISIBLE]; }
|
bool doesPickInvisible() const { return _flags[PICK_INCLUDE_INVISIBLE]; }
|
||||||
bool doesPickNonCollidable() const { return _flags[PICK_INCLUDE_NONCOLLIDABLE]; }
|
bool doesPickNonCollidable() const { return _flags[PICK_INCLUDE_NONCOLLIDABLE]; }
|
||||||
|
|
||||||
|
@ -71,8 +68,8 @@ public:
|
||||||
if (doesPickNonCollidable()) {
|
if (doesPickNonCollidable()) {
|
||||||
toReturn |= getBitMask(PICK_INCLUDE_NONCOLLIDABLE);
|
toReturn |= getBitMask(PICK_INCLUDE_NONCOLLIDABLE);
|
||||||
}
|
}
|
||||||
if (doesPickCourse()) {
|
if (doesPickCoarse()) {
|
||||||
toReturn |= getBitMask(PICK_COURSE);
|
toReturn |= getBitMask(PICK_COARSE);
|
||||||
}
|
}
|
||||||
return Flags(toReturn);
|
return Flags(toReturn);
|
||||||
}
|
}
|
||||||
|
@ -84,66 +81,84 @@ public:
|
||||||
if (doesPickNonCollidable()) {
|
if (doesPickNonCollidable()) {
|
||||||
toReturn |= getBitMask(PICK_INCLUDE_NONCOLLIDABLE);
|
toReturn |= getBitMask(PICK_INCLUDE_NONCOLLIDABLE);
|
||||||
}
|
}
|
||||||
if (doesPickCourse()) {
|
if (doesPickCoarse()) {
|
||||||
toReturn |= getBitMask(PICK_COURSE);
|
toReturn |= getBitMask(PICK_COARSE);
|
||||||
}
|
}
|
||||||
return Flags(toReturn);
|
return Flags(toReturn);
|
||||||
}
|
}
|
||||||
Flags getAvatarFlags() const { return Flags(getBitMask(PICK_AVATARS)); }
|
Flags getAvatarFlags() const { return Flags(getBitMask(PICK_AVATARS)); }
|
||||||
Flags getHUDFlags() const { return Flags(getBitMask(PICK_HUD)); }
|
Flags getHUDFlags() const { return Flags(getBitMask(PICK_HUD)); }
|
||||||
|
|
||||||
static unsigned int getBitMask(FlagBit bit) { return 1 << bit; }
|
static constexpr unsigned int getBitMask(FlagBit bit) { return 1 << bit; }
|
||||||
|
|
||||||
|
static const RayPickFilter NOTHING;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RayPick {
|
class RayPick : protected ReadWriteLockable {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Pointer = std::shared_ptr<RayPick>;
|
||||||
|
|
||||||
RayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
RayPick(const RayPickFilter& filter, const float maxDistance, const bool enabled);
|
||||||
|
|
||||||
virtual const PickRay getPickRay(bool& valid) const = 0;
|
virtual const PickRay getPickRay(bool& valid) const = 0;
|
||||||
|
|
||||||
void enable();
|
void enable(bool enabled = true);
|
||||||
void disable();
|
void disable() { enable(false); }
|
||||||
|
|
||||||
const RayPickFilter& getFilter() { return _filter; }
|
RayPickFilter getFilter() const;
|
||||||
float getMaxDistance() { return _maxDistance; }
|
float getMaxDistance() const;
|
||||||
bool isEnabled() { return _enabled; }
|
bool isEnabled() const;
|
||||||
const RayPickResult& getPrevRayPickResult();
|
RayPickResult getPrevRayPickResult() const;
|
||||||
|
|
||||||
void setPrecisionPicking(bool precisionPicking) { _filter.setFlag(RayPickFilter::PICK_COURSE, !precisionPicking); }
|
void setPrecisionPicking(bool precisionPicking);
|
||||||
|
|
||||||
void setRayPickResult(const RayPickResult& rayPickResult) { _prevResult = rayPickResult; }
|
void setRayPickResult(const RayPickResult& rayPickResult);
|
||||||
|
|
||||||
const QVector<EntityItemID>& getIgnoreEntites() { return _ignoreEntities; }
|
QVector<QUuid> getIgnoreItems() const;
|
||||||
const QVector<EntityItemID>& getIncludeEntites() { return _includeEntities; }
|
QVector<QUuid> getIncludeItems() const;
|
||||||
const QVector<OverlayID>& getIgnoreOverlays() { return _ignoreOverlays; }
|
|
||||||
const QVector<OverlayID>& getIncludeOverlays() { return _includeOverlays; }
|
template <typename T>
|
||||||
const QVector<EntityItemID>& getIgnoreAvatars() { return _ignoreAvatars; }
|
QVector<T> getIgnoreItemsAs() const {
|
||||||
const QVector<EntityItemID>& getIncludeAvatars() { return _includeAvatars; }
|
QVector<T> result;
|
||||||
|
withReadLock([&] {
|
||||||
|
for (const auto& uid : _ignoreItems) {
|
||||||
|
result.push_back(uid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QVector<T> getIncludeItemsAs() const {
|
||||||
|
QVector<T> result;
|
||||||
|
withReadLock([&] {
|
||||||
|
for (const auto& uid : _includeItems) {
|
||||||
|
result.push_back(uid);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIgnoreItems(const QVector<QUuid>& items);
|
||||||
|
void setIncludeItems(const QVector<QUuid>& items);
|
||||||
|
#if 0
|
||||||
void setIgnoreEntities(const QScriptValue& ignoreEntities);
|
void setIgnoreEntities(const QScriptValue& ignoreEntities);
|
||||||
void setIncludeEntities(const QScriptValue& includeEntities);
|
void setIncludeEntities(const QScriptValue& includeEntities);
|
||||||
void setIgnoreOverlays(const QScriptValue& ignoreOverlays);
|
void setIgnoreOverlays(const QScriptValue& ignoreOverlays);
|
||||||
void setIncludeOverlays(const QScriptValue& includeOverlays);
|
void setIncludeOverlays(const QScriptValue& includeOverlays);
|
||||||
void setIgnoreAvatars(const QScriptValue& ignoreAvatars);
|
void setIgnoreAvatars(const QScriptValue& ignoreAvatars);
|
||||||
void setIncludeAvatars(const QScriptValue& includeAvatars);
|
void setIncludeAvatars(const QScriptValue& includeAvatars);
|
||||||
|
#endif
|
||||||
QReadWriteLock* getLock() { return &_lock; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RayPickFilter _filter;
|
RayPickFilter _filter;
|
||||||
float _maxDistance;
|
const float _maxDistance;
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
RayPickResult _prevResult;
|
RayPickResult _prevResult;
|
||||||
|
|
||||||
QVector<EntityItemID> _ignoreEntities;
|
QVector<QUuid> _ignoreItems;
|
||||||
QVector<EntityItemID> _includeEntities;
|
QVector<QUuid> _includeItems;
|
||||||
QVector<OverlayID> _ignoreOverlays;
|
|
||||||
QVector<OverlayID> _includeOverlays;
|
|
||||||
QVector<EntityItemID> _ignoreAvatars;
|
|
||||||
QVector<EntityItemID> _includeAvatars;
|
|
||||||
|
|
||||||
QReadWriteLock _lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RayPick_h
|
#endif // hifi_RayPick_h
|
|
@ -1,7 +1,4 @@
|
||||||
//
|
//
|
||||||
// StaticRayPick.cpp
|
|
||||||
// interface/src/raypick
|
|
||||||
//
|
|
||||||
// Created by Sam Gondelman 7/11/2017
|
// Created by Sam Gondelman 7/11/2017
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
|
@ -1,7 +1,4 @@
|
||||||
//
|
//
|
||||||
// StaticRayPick.h
|
|
||||||
// interface/src/raypick
|
|
||||||
//
|
|
||||||
// Created by Sam Gondelman 7/11/2017
|
// Created by Sam Gondelman 7/11/2017
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
Loading…
Reference in a new issue