mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 21:18:06 +02:00
fix auto-hide logic in depthReticle
This commit is contained in:
parent
7c6c75c484
commit
8c15116190
4 changed files with 25 additions and 9 deletions
|
@ -98,10 +98,21 @@ function seekToLookAt() {
|
|||
}
|
||||
|
||||
function autoHideReticle() {
|
||||
var now = Date.now();
|
||||
|
||||
// sometimes we don't actually get mouse move messages (for example, if the focus has been set
|
||||
// to an overlay or web page 'overlay') in but the mouse can still be moving, and we don't want
|
||||
// to autohide in these cases, so we will take this opportunity to also check if the reticle
|
||||
// position has changed.
|
||||
if (lastMouseX != Reticle.position.x || lastMouseY != Reticle.position.y) {
|
||||
lastMouseMoveOrClick = now;
|
||||
lastMouseX = Reticle.position.x;
|
||||
lastMouseY = Reticle.position.y;
|
||||
}
|
||||
|
||||
// if we haven't moved in a long period of time, and we're not pointing at some
|
||||
// system overlay (like a window), then hide the reticle
|
||||
if (Reticle.visible && !Reticle.pointingAtSystemOverlay) {
|
||||
var now = Date.now();
|
||||
var timeSinceLastMouseMove = now - lastMouseMoveOrClick;
|
||||
if (timeSinceLastMouseMove > HIDE_STATIC_MOUSE_AFTER) {
|
||||
Reticle.visible = false;
|
||||
|
|
|
@ -467,8 +467,6 @@ void CompositorHelper::toggle() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
glm::mat4 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const glm::vec3& headPosition) const {
|
||||
glm::mat4 result;
|
||||
if (isHMD()) {
|
||||
|
@ -487,7 +485,7 @@ glm::mat4 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const
|
|||
pointerTransform[3] = vec4(cursorRay + headPosition, 1);
|
||||
// Scale up the cursor because of distance
|
||||
reticleScale *= reticleDepth;
|
||||
}
|
||||
}
|
||||
glm::mat4 overlayXfm;
|
||||
_modelTransform.getMatrix(overlayXfm);
|
||||
pointerTransform = overlayXfm * pointerTransform;
|
||||
|
@ -503,7 +501,7 @@ glm::mat4 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const
|
|||
mousePosition.y *= -1.0f;
|
||||
|
||||
vec2 mouseSize = CURSOR_PIXEL_SIZE / canvasSize;
|
||||
return glm::scale(glm::translate(glm::mat4(), vec3(mousePosition, 0.0f)), vec3(mouseSize, 1.0f));
|
||||
result = glm::scale(glm::translate(glm::mat4(), vec3(mousePosition, 0.0f)), vec3(mouseSize, 1.0f));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ private:
|
|||
|
||||
bool _reticleOverQml { false };
|
||||
|
||||
bool _allowMouseCapture { true };
|
||||
std::atomic<bool> _allowMouseCapture { true };
|
||||
|
||||
bool _fakeMouseEvent { false };
|
||||
|
||||
|
|
|
@ -475,13 +475,20 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn
|
|||
return result;
|
||||
}
|
||||
|
||||
RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) {
|
||||
RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking,
|
||||
const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) {
|
||||
|
||||
QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
|
||||
QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
|
||||
return findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking, entitiesToInclude, entitiesToDiscard);
|
||||
return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard);
|
||||
}
|
||||
|
||||
RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking, const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) {
|
||||
// FIXME - we should remove this API and encourage all users to use findRayIntersection() instead. We've changed
|
||||
// findRayIntersection() to be blocking because it never makes sense for a script to get back a non-answer
|
||||
RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionBlocking(const PickRay& ray, bool precisionPicking,
|
||||
const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard) {
|
||||
|
||||
qDebug() << "Entities.findRayIntersectionBlocking() is obsolete, use Entities.findRayIntersection() instead.";
|
||||
const QVector<EntityItemID>& entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
|
||||
const QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
|
||||
return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard);
|
||||
|
|
Loading…
Reference in a new issue