From e3288a9004af5ce42d4538490ffd9fb7390426e8 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Thu, 27 Jul 2017 11:17:30 -0700 Subject: [PATCH] fix flicker, scissor warning, and handControllerGrab sphere size --- interface/src/raypick/LaserPointer.cpp | 14 +++++--------- .../src/display-plugins/OpenGLDisplayPlugin.cpp | 2 ++ scripts/system/controllers/handControllerGrab.js | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/interface/src/raypick/LaserPointer.cpp b/interface/src/raypick/LaserPointer.cpp index 23adf5b532..ce25df340d 100644 --- a/interface/src/raypick/LaserPointer.cpp +++ b/interface/src/raypick/LaserPointer.cpp @@ -81,7 +81,7 @@ void LaserPointer::disable() { } void LaserPointer::setRenderState(const QString& state) { - if (!_currentRenderState.isEmpty()) { + if (!_currentRenderState.isEmpty() && state != _currentRenderState) { if (_renderStates.contains(_currentRenderState)) { disableRenderState(_renderStates[_currentRenderState]); } @@ -125,15 +125,12 @@ void LaserPointer::updateRenderState(const RenderState& renderState, const Inter glm::vec3 endVec; if (defaultState || !_lockEnd || type == IntersectionType::HUD) { endVec = pickRay.origin + pickRay.direction * distance; - } - else { + } else { if (type == IntersectionType::ENTITY) { endVec = DependencyManager::get()->getEntityTransform(objectID)[3]; - } - else if (type == IntersectionType::OVERLAY) { + } else if (type == IntersectionType::OVERLAY) { endVec = vec3FromVariant(qApp->getOverlays().getProperty(objectID, "position").value); - } - else if (type == IntersectionType::AVATAR) { + } else if (type == IntersectionType::AVATAR) { endVec = DependencyManager::get()->getAvatar(objectID)->getPosition(); } } @@ -150,8 +147,7 @@ void LaserPointer::updateRenderState(const RenderState& renderState, const Inter QVariantMap endProps; if (_centerEndY) { endProps.insert("position", end); - } - else { + } else { glm::vec3 dim = vec3FromVariant(qApp->getOverlays().getProperty(renderState.getEndID(), "dimensions").value); endProps.insert("position", vec3toVariant(endVec + glm::vec3(0, 0.5f * dim.y, 0))); } diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 9b3fe10c55..4e8940fe59 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -628,6 +628,7 @@ void OpenGLDisplayPlugin::compositeLayers() { // Clear the depth framebuffer after drawing the scene so that the HUD elements can depth test against each other render([&](gpu::Batch& batch) { + batch.enableStereo(false); batch.setFramebuffer(_compositeFramebuffer); batch.clearDepthFramebuffer((float) UINT32_MAX); }); @@ -657,6 +658,7 @@ void OpenGLDisplayPlugin::compositeLayers() { // Clear the depth buffer again and draw the pointer last so it's on top of everything render([&](gpu::Batch& batch) { + batch.enableStereo(false); batch.setFramebuffer(_compositeFramebuffer); batch.clearDepthFramebuffer((float) UINT32_MAX); }); diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 79b00a3cae..7d76c2989f 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1410,7 +1410,8 @@ function MyController(hand) { this.updateLaserPointer = function() { var SEARCH_SPHERE_SIZE = 0.011; - var radius = 1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance; + var MIN_SPHERE_SIZE = 0.0005; + var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE); var dim = {x: radius, y: radius, z: radius}; var mode = "hold"; if (this.state !== STATE_DISTANCE_HOLDING && this.state !== STATE_DISTANCE_ROTATING) {