From 779f326452db93037d38de69072eff619e2ba088 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 24 Oct 2016 15:03:41 -0700 Subject: [PATCH] cleanup --- .../display-plugins/hmd/HmdDisplayPlugin.cpp | 36 +------------------ .../display-plugins/hmd/HmdDisplayPlugin.h | 7 ---- libraries/plugins/src/plugins/DisplayPlugin.h | 3 -- libraries/render-utils/src/GeometryCache.cpp | 1 - .../system/controllers/handControllerGrab.js | 3 -- .../controllers/handControllerPointer.js | 4 +-- scripts/system/libraries/controllers.js | 1 - 7 files changed, 3 insertions(+), 52 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index 27c5a9aa2e..5f8085fdda 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -364,9 +364,6 @@ void HmdDisplayPlugin::updateFrameData() { _presentExtraLaser = _extraLaser; _presentExtraLaserStart = _extraLaserStart; - - _presentExtraLaserPose = _extraLaserPose; - }); auto compositorHelper = DependencyManager::get(); @@ -436,24 +433,7 @@ void HmdDisplayPlugin::updateFrameData() { // compute the glow point interesections if (_presentExtraLaser.valid()) { - const auto& handLaser = _presentExtraLaser; - - const vec3& laserDirection = handLaser.direction; - - /* - mat4 model = _presentExtraLaserPose; - vec3 castStart = vec3(model[3]); - vec3 castDirection = glm::quat_cast(model) * laserDirection; - if (glm::abs(glm::length2(castDirection) - 1.0f) > EPSILON) { - castDirection = glm::normalize(castDirection); - castDirection = glm::inverse(_presentUiModelTransform.getRotation()) * castDirection; - } - - // FIXME - no offset - vec3 grabPointOffset {0}; - castStart += glm::quat_cast(model) * grabPointOffset; - */ - + const vec3& laserDirection = _presentExtraLaser.direction; vec3 castStart = _presentExtraLaserStart; vec3 castDirection = laserDirection; @@ -680,20 +660,6 @@ bool HmdDisplayPlugin::setHandLaser(uint32_t hands, HandLaserMode mode, const ve return true; } -bool HmdDisplayPlugin::setExtraLaser(mat4 extraLaserPose, HandLaserMode mode, const vec4& color, const vec3& direction) { - HandLaserInfo info; - info.mode = mode; - info.color = color; - info.direction = direction; - withNonPresentThreadLock([&] { - _extraLaser = info; - _extraLaserPose = extraLaserPose; - }); - // 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; -} - bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, const glm::vec3& sensorSpaceStart, const vec3& sensorSpaceDirection) { HandLaserInfo info; info.mode = mode; diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index 7e3cfbaacb..e50183dd90 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -38,8 +38,6 @@ public: virtual glm::mat4 getHeadPose() const override; bool setHandLaser(uint32_t hands, HandLaserMode mode, const vec4& color, const vec3& direction) override; - - bool setExtraLaser(mat4 extraLaserPose, HandLaserMode mode, const vec4& color, const vec3& direction) override; bool setExtraLaser(HandLaserMode mode, const vec4& color, const glm::vec3& sensorSpaceStart, const vec3& sensorSpaceDirection) override; bool wantVsync() const override { @@ -91,11 +89,6 @@ protected: vec3 _presentExtraLaserStart; std::pair _presentExtraLaserPoints; - // FIXME - kill these - mat4 _extraLaserPose; - mat4 _presentExtraLaserPose; - - std::array _eyeOffsets; std::array _eyeProjections; std::array _eyeInverseProjections; diff --git a/libraries/plugins/src/plugins/DisplayPlugin.h b/libraries/plugins/src/plugins/DisplayPlugin.h index 92abc1c4d3..c025b03075 100644 --- a/libraries/plugins/src/plugins/DisplayPlugin.h +++ b/libraries/plugins/src/plugins/DisplayPlugin.h @@ -115,9 +115,6 @@ public: return false; } - virtual bool setExtraLaser(mat4 extraLaserPose, HandLaserMode mode, const vec4& color, const vec3& direction) { - return false; - } virtual bool setExtraLaser(HandLaserMode mode, const vec4& color, const glm::vec3& sensorSpaceStart, const vec3& sensorSpaceDirection) { return false; } diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 18bb730ae8..dcd4961c32 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -1585,7 +1585,6 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm } -// FIXME -- there's a memory leak of GPU buffers in this method void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2, const glm::vec4& color, float glowIntensity, float glowWidth, int id) { diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index b9602aa512..1ffa993d01 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -894,9 +894,6 @@ function MyController(hand) { }; this.overlayLineOn = function(closePoint, farPoint, color) { - print("overlayLineOn()... closePoint:", closePoint.x +","+closePoint.y+","+closePoint.z, - "farPoint:", farPoint.x +","+farPoint.y+","+farPoint.z); - if (this.overlayLine === null) { var lineProperties = { glow: 1.0, diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index 4a6f563063..0b87672483 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -204,7 +204,7 @@ function overlayFromWorldPoint(point) { } function activeHudPoint2d(activeHand) { // if controller is valid, update reticle position and answer 2d point. Otherwise falsey. - var controllerPose = getControllerWorldLocation(activeHand, true); // note: this will use head pose of hand pose is invalid (third eye) + var controllerPose = getControllerWorldLocation(activeHand, true); // note: this will return head pose if hand pose is invalid (third eye) if (!controllerPose.valid) { return; // Controller is cradled. } @@ -500,7 +500,7 @@ function update() { return off(); } - if (true) { + if (!HMD.isHandControllerAvailable()) { var color = (activeTrigger.state === 'full') ? LASER_TRIGGER_COLOR_XYZW : LASER_SEARCH_COLOR_XYZW; var position = MyAvatar.getHeadPosition(); diff --git a/scripts/system/libraries/controllers.js b/scripts/system/libraries/controllers.js index 4b7b0a83d6..38febf2de4 100644 --- a/scripts/system/libraries/controllers.js +++ b/scripts/system/libraries/controllers.js @@ -43,7 +43,6 @@ getControllerWorldLocation = function (handController, doOffset) { position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, getGrabPointSphereOffset(handController))); } } else if (!HMD.isHandControllerAvailable()) { - //print("getControllerWorldLocation(), no hand controllers -- use head"); position = MyAvatar.getHeadPosition(); orientation = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 })); valid = true;