mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 23:46:29 +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");
|
||||
DependencyManager::get<PointerManager>()->update(deltaTime);
|
||||
DependencyManager::get<PointerManager>()->update();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
using namespace bilateral;
|
||||
|
||||
// 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_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);
|
||||
|
@ -130,7 +129,7 @@ static StylusTip getControllerWorldLocation(Side side) {
|
|||
|
||||
StylusTip StylusPick::getMathematicalPick() const {
|
||||
StylusTip result;
|
||||
if (USE_FINGER_AS_STYLUS.get()) {
|
||||
if (qApp->getPreferAvatarFingerOverStylus()) {
|
||||
result = getFingerWorldLocation(_side);
|
||||
} else {
|
||||
result = getControllerWorldLocation(_side);
|
||||
|
|
|
@ -61,7 +61,7 @@ OverlayID StylusPointer::buildStylusOverlay(const QVariantMap& properties) {
|
|||
void StylusPointer::updateVisuals(const PickResultPointer& 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);
|
||||
if (tip.side != bilateral::Side::Invalid) {
|
||||
show(tip);
|
||||
|
|
|
@ -58,7 +58,7 @@ bool Pointer::isMouse() const {
|
|||
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
|
||||
withReadLock([&] {
|
||||
auto pickResult = getPrevPickResult();
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
virtual void setLength(float length) {}
|
||||
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;
|
||||
void generatePointerEvents(unsigned int pointerID, const PickResultPointer& pickResult);
|
||||
|
||||
|
|
|
@ -77,13 +77,13 @@ PickResultPointer PointerManager::getPrevPickResult(unsigned int uid) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void PointerManager::update(float deltaTime) {
|
||||
void PointerManager::update() {
|
||||
auto cachedPointers = resultWithReadLock<std::unordered_map<unsigned int, std::shared_ptr<Pointer>>>([&] {
|
||||
return _pointers;
|
||||
});
|
||||
|
||||
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 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 isRightHand(unsigned int uid);
|
||||
|
|
|
@ -162,6 +162,9 @@ public:
|
|||
return pickRay;
|
||||
}
|
||||
};
|
||||
Q_DECLARE_METATYPE(PickRay)
|
||||
QScriptValue pickRayToScriptValue(QScriptEngine* engine, const PickRay& pickRay);
|
||||
void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay);
|
||||
|
||||
class StylusTip : public MathPick {
|
||||
public:
|
||||
|
@ -201,14 +204,14 @@ public:
|
|||
|
||||
|
||||
namespace std {
|
||||
inline void hash_combine(std::size_t& seed) { }
|
||||
inline void hash_combine(std::size_t& seed) { }
|
||||
|
||||
template <typename T, typename... Rest>
|
||||
inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) {
|
||||
std::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
hash_combine(seed, rest...);
|
||||
}
|
||||
template <typename T, typename... Rest>
|
||||
inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) {
|
||||
std::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
hash_combine(seed, rest...);
|
||||
}
|
||||
|
||||
template <>
|
||||
struct hash<bilateral::Side> {
|
||||
|
@ -217,34 +220,34 @@ namespace std {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template <>
|
||||
struct hash<glm::vec3> {
|
||||
size_t operator()(const glm::vec3& a) const {
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.x, a.y, a.z);
|
||||
return result;
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.x, a.y, a.z);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template <>
|
||||
struct hash<glm::quat> {
|
||||
size_t operator()(const glm::quat& a) const {
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.x, a.y, a.z, a.w);
|
||||
return result;
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.x, a.y, a.z, a.w);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template <>
|
||||
struct hash<PickRay> {
|
||||
size_t operator()(const PickRay& a) const {
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.origin, a.direction);
|
||||
return result;
|
||||
size_t result = 0;
|
||||
hash_combine(result, a.origin, a.direction);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template <>
|
||||
struct hash<StylusTip> {
|
||||
size_t operator()(const StylusTip& a) const {
|
||||
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 {
|
||||
CONTACT_EVENT_TYPE_START,
|
||||
|
|
|
@ -27,7 +27,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
alpha: 1,
|
||||
solid: true,
|
||||
glow: 1.0,
|
||||
lineWidth: 5,
|
||||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
|
@ -51,7 +50,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
alpha: 1,
|
||||
solid: true,
|
||||
glow: 1.0,
|
||||
lineWidth: 5,
|
||||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
|
@ -75,7 +73,6 @@ Pointer = function(hudLayer, pickType, pointerData) {
|
|||
alpha: 1,
|
||||
solid: true,
|
||||
glow: 1.0,
|
||||
lineWidth: 5,
|
||||
ignoreRayIntersection: true, // always ignore this
|
||||
drawInFront: !hudLayer, // Even when burried inside of something, show it.
|
||||
drawHUDLayer: hudLayer,
|
||||
|
|
Loading…
Reference in a new issue