mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
Merge pull request #7595 from ZappoMan/depthReticleWork
Fix a random case of the depth reticle hiding when it shouldn't
This commit is contained in:
commit
dc4751a95b
4 changed files with 25 additions and 9 deletions
|
@ -98,10 +98,21 @@ function seekToLookAt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoHideReticle() {
|
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
|
// 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
|
// system overlay (like a window), then hide the reticle
|
||||||
if (Reticle.visible && !Reticle.pointingAtSystemOverlay) {
|
if (Reticle.visible && !Reticle.pointingAtSystemOverlay) {
|
||||||
var now = Date.now();
|
|
||||||
var timeSinceLastMouseMove = now - lastMouseMoveOrClick;
|
var timeSinceLastMouseMove = now - lastMouseMoveOrClick;
|
||||||
if (timeSinceLastMouseMove > HIDE_STATIC_MOUSE_AFTER) {
|
if (timeSinceLastMouseMove > HIDE_STATIC_MOUSE_AFTER) {
|
||||||
Reticle.visible = false;
|
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 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const glm::vec3& headPosition) const {
|
||||||
glm::mat4 result;
|
glm::mat4 result;
|
||||||
if (isHMD()) {
|
if (isHMD()) {
|
||||||
|
@ -487,7 +485,7 @@ glm::mat4 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const
|
||||||
pointerTransform[3] = vec4(cursorRay + headPosition, 1);
|
pointerTransform[3] = vec4(cursorRay + headPosition, 1);
|
||||||
// Scale up the cursor because of distance
|
// Scale up the cursor because of distance
|
||||||
reticleScale *= reticleDepth;
|
reticleScale *= reticleDepth;
|
||||||
}
|
}
|
||||||
glm::mat4 overlayXfm;
|
glm::mat4 overlayXfm;
|
||||||
_modelTransform.getMatrix(overlayXfm);
|
_modelTransform.getMatrix(overlayXfm);
|
||||||
pointerTransform = overlayXfm * pointerTransform;
|
pointerTransform = overlayXfm * pointerTransform;
|
||||||
|
@ -503,7 +501,7 @@ glm::mat4 CompositorHelper::getReticleTransform(const glm::mat4& eyePose, const
|
||||||
mousePosition.y *= -1.0f;
|
mousePosition.y *= -1.0f;
|
||||||
|
|
||||||
vec2 mouseSize = CURSOR_PIXEL_SIZE / canvasSize;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ private:
|
||||||
|
|
||||||
bool _reticleOverQml { false };
|
bool _reticleOverQml { false };
|
||||||
|
|
||||||
bool _allowMouseCapture { true };
|
std::atomic<bool> _allowMouseCapture { true };
|
||||||
|
|
||||||
bool _fakeMouseEvent { false };
|
bool _fakeMouseEvent { false };
|
||||||
|
|
||||||
|
|
|
@ -475,13 +475,20 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn
|
||||||
return result;
|
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> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
|
||||||
QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
|
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) {
|
||||||
|
|
||||||
|
qWarning() << "Entities.findRayIntersectionBlocking() is obsolete, use Entities.findRayIntersection() instead.";
|
||||||
const QVector<EntityItemID>& entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
|
const QVector<EntityItemID>& entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
|
||||||
const QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
|
const QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
|
||||||
return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard);
|
return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard);
|
||||||
|
|
Loading…
Reference in a new issue