From a25d50387e513d1232706152f6df3ef689b385ff Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 24 Oct 2016 14:47:10 -0700 Subject: [PATCH] gak --- .../src/scripting/HMDScriptingInterface.cpp | 7 +---- .../display-plugins/hmd/HmdDisplayPlugin.cpp | 26 ++----------------- .../controllers/handControllerPointer.js | 11 ++------ 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/interface/src/scripting/HMDScriptingInterface.cpp b/interface/src/scripting/HMDScriptingInterface.cpp index c75a6f2939..fb1440ebdf 100644 --- a/interface/src/scripting/HMDScriptingInterface.cpp +++ b/interface/src/scripting/HMDScriptingInterface.cpp @@ -155,12 +155,7 @@ bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enab auto sensorToWorld = myAvatar->getSensorToWorldMatrix(); auto worldToSensor = glm::inverse(sensorToWorld); auto sensorStart = ::transformPoint(worldToSensor, worldStart); - auto sensorDirection = ::transformVectorFast(worldToSensor, direction); // wrong - - qDebug() << __FUNCTION__ << "worldStart:" << worldStart << "sensorStart:" << sensorStart; - qDebug() << __FUNCTION__ << "direction:" << direction << "sensorDirection:" << sensorDirection; - qDebug() << __FUNCTION__ << "enabled:" << enabled; - + auto sensorDirection = ::transformVectorFast(worldToSensor, direction); return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, color, sensorStart, sensorDirection); diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index 16b7da863a..27c5a9aa2e 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -352,11 +352,6 @@ void HmdDisplayPlugin::updateFrameData() { if (_currentFrame) { auto batchPose = _currentFrame->pose; - - // HACK o RAMA - //_handPoses[0] = _currentFrame->pose; - //_handPoses[1] = _currentFrame->pose; - auto currentPose = _currentPresentFrameInfo.presentPose; auto correction = glm::inverse(batchPose) * currentPose; getGLBackend()->setCameraCorrection(correction); @@ -474,9 +469,6 @@ void HmdDisplayPlugin::updateFrameData() { _presentExtraLaserPoints.first = castStart; _presentExtraLaserPoints.second = _presentExtraLaserPoints.first + (castDirection * distance); - qDebug() << __FUNCTION__ << "_presentExtraLaserPoints.first:" << _presentExtraLaserPoints.first; - qDebug() << __FUNCTION__ << "_presentExtraLaserPoints.second:" << _presentExtraLaserPoints.second; - vec3 intersectionPosition = castStart + (castDirection * distance) - _presentUiModelTransform.getTranslation(); intersectionPosition = glm::inverse(_presentUiModelTransform.getRotation()) * intersectionPosition; @@ -494,8 +486,6 @@ void HmdDisplayPlugin::updateFrameData() { yawPitch /= CompositorHelper::VIRTUAL_UI_TARGET_FOV; yawPitch += 0.5f; extraGlowPoint = yawPitch; - } else { - qDebug() << "no extraGlowPoint..."; } } } @@ -508,8 +498,6 @@ void HmdDisplayPlugin::updateFrameData() { // Setup the uniforms { - qDebug() << __FUNCTION__ << "extraGlowPoint:" << extraGlowPoint; - auto& uniforms = _overlayRenderer.uniforms; uniforms.alpha = _compositeOverlayAlpha; uniforms.glowPoints = vec4(handGlowPoints[0], handGlowPoints[1]); @@ -716,7 +704,6 @@ bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, cons _extraLaserStart = sensorSpaceStart; }); - qDebug() << __FUNCTION__ << "info.mode:" << (int)info.mode; // FIXME defer to a child class plugin to determine if hand lasers are actually // available based on the presence or absence of hand controllers return true; @@ -725,11 +712,11 @@ bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, cons void HmdDisplayPlugin::compositeExtra() { // If neither hand laser is activated, exit - if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid()) { + if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid() && !_presentExtraLaser.valid()) { return; } - if (_presentHandPoses[0] == IDENTITY_MATRIX && _presentHandPoses[1] == IDENTITY_MATRIX) { + if (_presentHandPoses[0] == IDENTITY_MATRIX && _presentHandPoses[1] == IDENTITY_MATRIX && !_presentExtraLaser.valid()) { return; } @@ -752,17 +739,8 @@ void HmdDisplayPlugin::compositeExtra() { if (_presentExtraLaser.valid()) { const auto& points = _presentExtraLaserPoints; - qDebug() << __FUNCTION__ << "_presentExtraLaserPoints... points.first:" << points.first; - geometryCache->renderGlowLine(batch, points.first, points.second, _presentExtraLaser.color, _extraLaserID); - } else { - qDebug() << __FUNCTION__ << "INVALID LASER --- mode != HandLaserMode::None - " << (_presentExtraLaser.mode != HandLaserMode::None) - << "mode:" << (int)_presentExtraLaser.mode - << "color.a > 0.0f - " << (_presentExtraLaser.color.a > 0.0f) << "direction:" << _presentExtraLaser.direction; - } - - }); } diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index 7f90f8c666..4a6f563063 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -457,11 +457,7 @@ function setColoredLaser() { // answer trigger state if lasers supported, else f if (!HMD.isHandControllerAvailable()){ var position = MyAvatar.getHeadPosition(); - //var direction = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 })); - var direction = { x: 1, y: -1, z: 0 }; - - Vec3.print("Calling HMD.setExtraLaser() position:", position); - Vec3.print("Calling HMD.setExtraLaser() direction:", direction); + var direction = Quat.getUp(Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }))); return HMD.setExtraLaser(position,true, color, direction); } @@ -508,10 +504,7 @@ function update() { var color = (activeTrigger.state === 'full') ? LASER_TRIGGER_COLOR_XYZW : LASER_SEARCH_COLOR_XYZW; var position = MyAvatar.getHeadPosition(); - //var direction = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 })); - var direction = { x: 1, y: -1, z: 0 }; - Vec3.print("update().... Calling HMD.setExtraLaser() position:", position); - Vec3.print("update().... Calling HMD.setExtraLaser() direction:", direction); + var direction = Quat.getUp(Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }))); HMD.setExtraLaser(position,true, color, direction); }