mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
cleanup
This commit is contained in:
parent
d1747060f5
commit
61c7ccde6e
9 changed files with 31 additions and 35 deletions
|
@ -4961,7 +4961,7 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(app, "PointerManager");
|
PROFILE_RANGE(app, "PointerManager");
|
||||||
DependencyManager::get<PointerManager>()->update(deltaTime);
|
DependencyManager::get<PointerManager>()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
using namespace bilateral;
|
using namespace bilateral;
|
||||||
|
|
||||||
// TODO: make these configurable per pick
|
// TODO: make these configurable per pick
|
||||||
static Setting::Handle<double> USE_FINGER_AS_STYLUS("preferAvatarFingerOverStylus", false);
|
|
||||||
static const float WEB_STYLUS_LENGTH = 0.2f;
|
static const float WEB_STYLUS_LENGTH = 0.2f;
|
||||||
static const float WEB_TOUCH_Y_OFFSET = 0.105f; // how far forward (or back with a negative number) to slide stylus in hand
|
static const float WEB_TOUCH_Y_OFFSET = 0.105f; // how far forward (or back with a negative number) to slide stylus in hand
|
||||||
static const glm::vec3 TIP_OFFSET = glm::vec3(0.0f, WEB_STYLUS_LENGTH - WEB_TOUCH_Y_OFFSET, 0.0f);
|
static const glm::vec3 TIP_OFFSET = glm::vec3(0.0f, WEB_STYLUS_LENGTH - WEB_TOUCH_Y_OFFSET, 0.0f);
|
||||||
|
@ -130,7 +129,7 @@ static StylusTip getControllerWorldLocation(Side side) {
|
||||||
|
|
||||||
StylusTip StylusPick::getMathematicalPick() const {
|
StylusTip StylusPick::getMathematicalPick() const {
|
||||||
StylusTip result;
|
StylusTip result;
|
||||||
if (USE_FINGER_AS_STYLUS.get()) {
|
if (qApp->getPreferAvatarFingerOverStylus()) {
|
||||||
result = getFingerWorldLocation(_side);
|
result = getFingerWorldLocation(_side);
|
||||||
} else {
|
} else {
|
||||||
result = getControllerWorldLocation(_side);
|
result = getControllerWorldLocation(_side);
|
||||||
|
|
|
@ -61,7 +61,7 @@ OverlayID StylusPointer::buildStylusOverlay(const QVariantMap& properties) {
|
||||||
void StylusPointer::updateVisuals(const PickResultPointer& pickResult) {
|
void StylusPointer::updateVisuals(const PickResultPointer& pickResult) {
|
||||||
auto stylusPickResult = std::static_pointer_cast<const StylusPickResult>(pickResult);
|
auto stylusPickResult = std::static_pointer_cast<const StylusPickResult>(pickResult);
|
||||||
|
|
||||||
if (_enabled && _renderState != DISABLED && stylusPickResult) {
|
if (_enabled && !qApp->getPreferAvatarFingerOverStylus() && _renderState != DISABLED && stylusPickResult) {
|
||||||
StylusTip tip(stylusPickResult->pickVariant);
|
StylusTip tip(stylusPickResult->pickVariant);
|
||||||
if (tip.side != bilateral::Side::Invalid) {
|
if (tip.side != bilateral::Side::Invalid) {
|
||||||
show(tip);
|
show(tip);
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool Pointer::isMouse() const {
|
||||||
return DependencyManager::get<PickManager>()->isMouse(_pickUID);
|
return DependencyManager::get<PickManager>()->isMouse(_pickUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pointer::update(unsigned int pointerID, float deltaTime) {
|
void Pointer::update(unsigned int pointerID) {
|
||||||
// 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
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
auto pickResult = getPrevPickResult();
|
auto pickResult = getPrevPickResult();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
virtual void setLength(float length) {}
|
virtual void setLength(float length) {}
|
||||||
virtual void setLockEndUUID(const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) {}
|
virtual void setLockEndUUID(const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) {}
|
||||||
|
|
||||||
void update(unsigned int pointerID, float deltaTime);
|
void update(unsigned int pointerID);
|
||||||
virtual void updateVisuals(const PickResultPointer& pickResult) = 0;
|
virtual void updateVisuals(const PickResultPointer& pickResult) = 0;
|
||||||
void generatePointerEvents(unsigned int pointerID, const PickResultPointer& pickResult);
|
void generatePointerEvents(unsigned int pointerID, const PickResultPointer& pickResult);
|
||||||
|
|
||||||
|
|
|
@ -77,13 +77,13 @@ PickResultPointer PointerManager::getPrevPickResult(unsigned int uid) const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerManager::update(float deltaTime) {
|
void PointerManager::update() {
|
||||||
auto cachedPointers = resultWithReadLock<std::unordered_map<unsigned int, std::shared_ptr<Pointer>>>([&] {
|
auto cachedPointers = resultWithReadLock<std::unordered_map<unsigned int, std::shared_ptr<Pointer>>>([&] {
|
||||||
return _pointers;
|
return _pointers;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const auto& pointerPair : cachedPointers) {
|
for (const auto& pointerPair : cachedPointers) {
|
||||||
pointerPair.second->update(pointerPair.first, deltaTime);
|
pointerPair.second->update(pointerPair.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
void setLength(unsigned int uid, float length) const;
|
void setLength(unsigned int uid, float length) const;
|
||||||
void setLockEndUUID(unsigned int uid, const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) const;
|
void setLockEndUUID(unsigned int uid, const QUuid& objectID, bool isOverlay, const glm::mat4& offsetMat = glm::mat4()) const;
|
||||||
|
|
||||||
void update(float deltaTime);
|
void update();
|
||||||
|
|
||||||
bool isLeftHand(unsigned int uid);
|
bool isLeftHand(unsigned int uid);
|
||||||
bool isRightHand(unsigned int uid);
|
bool isRightHand(unsigned int uid);
|
||||||
|
|
|
@ -162,6 +162,9 @@ public:
|
||||||
return pickRay;
|
return pickRay;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Q_DECLARE_METATYPE(PickRay)
|
||||||
|
QScriptValue pickRayToScriptValue(QScriptEngine* engine, const PickRay& pickRay);
|
||||||
|
void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay);
|
||||||
|
|
||||||
class StylusTip : public MathPick {
|
class StylusTip : public MathPick {
|
||||||
public:
|
public:
|
||||||
|
@ -201,14 +204,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
inline void hash_combine(std::size_t& seed) { }
|
inline void hash_combine(std::size_t& seed) { }
|
||||||
|
|
||||||
template <typename T, typename... Rest>
|
template <typename T, typename... Rest>
|
||||||
inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) {
|
inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) {
|
||||||
std::hash<T> hasher;
|
std::hash<T> hasher;
|
||||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||||
hash_combine(seed, rest...);
|
hash_combine(seed, rest...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<bilateral::Side> {
|
struct hash<bilateral::Side> {
|
||||||
|
@ -217,34 +220,34 @@ namespace std {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<glm::vec3> {
|
struct hash<glm::vec3> {
|
||||||
size_t operator()(const glm::vec3& a) const {
|
size_t operator()(const glm::vec3& a) const {
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
hash_combine(result, a.x, a.y, a.z);
|
hash_combine(result, a.x, a.y, a.z);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<glm::quat> {
|
struct hash<glm::quat> {
|
||||||
size_t operator()(const glm::quat& a) const {
|
size_t operator()(const glm::quat& a) const {
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
hash_combine(result, a.x, a.y, a.z, a.w);
|
hash_combine(result, a.x, a.y, a.z, a.w);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<PickRay> {
|
struct hash<PickRay> {
|
||||||
size_t operator()(const PickRay& a) const {
|
size_t operator()(const PickRay& a) const {
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
hash_combine(result, a.origin, a.direction);
|
hash_combine(result, a.origin, a.direction);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<StylusTip> {
|
struct hash<StylusTip> {
|
||||||
size_t operator()(const StylusTip& a) const {
|
size_t operator()(const StylusTip& a) const {
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
|
@ -253,9 +256,6 @@ namespace std {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Q_DECLARE_METATYPE(PickRay)
|
|
||||||
QScriptValue pickRayToScriptValue(QScriptEngine* engine, const PickRay& pickRay);
|
|
||||||
void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay);
|
|
||||||
|
|
||||||
enum ContactEventType {
|
enum ContactEventType {
|
||||||
CONTACT_EVENT_TYPE_START,
|
CONTACT_EVENT_TYPE_START,
|
||||||
|
|
|
@ -27,7 +27,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
solid: true,
|
||||||
glow: 1.0,
|
glow: 1.0,
|
||||||
lineWidth: 5,
|
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true, // always ignore this
|
||||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||||
drawHUDLayer: hudLayer,
|
drawHUDLayer: hudLayer,
|
||||||
|
@ -51,7 +50,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
solid: true,
|
||||||
glow: 1.0,
|
glow: 1.0,
|
||||||
lineWidth: 5,
|
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true, // always ignore this
|
||||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||||
drawHUDLayer: hudLayer,
|
drawHUDLayer: hudLayer,
|
||||||
|
@ -75,7 +73,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
solid: true,
|
solid: true,
|
||||||
glow: 1.0,
|
glow: 1.0,
|
||||||
lineWidth: 5,
|
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true, // always ignore this
|
||||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||||
drawHUDLayer: hudLayer,
|
drawHUDLayer: hudLayer,
|
||||||
|
|
Loading…
Reference in a new issue