From cb672b878caf608f125ac1e9c660e057feb3d0eb Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 17 Dec 2018 08:42:53 -0800 Subject: [PATCH 1/7] looking at vive user flag behaviour --- interface/src/Application.cpp | 2 +- interface/src/graphics/GraphicsEngine.cpp | 3 ++- libraries/animation/src/AnimClip.cpp | 2 +- libraries/fbx/src/FBXSerializer.cpp | 8 ++++++-- .../oculus/src/OculusBaseDisplayPlugin.cpp | 1 + plugins/openvr/src/OpenVrDisplayPlugin.cpp | 1 + plugins/openvr/src/OpenVrHelpers.cpp | 20 ++++++++++++++++++- 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e4bfd47ee4..de7a78bdcd 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8057,7 +8057,7 @@ void Application::windowMinimizedChanged(bool minimized) { getActiveDisplayPlugin()->activate(); } else if (minimized && getActiveDisplayPlugin()->isActive()) { getActiveDisplayPlugin()->deactivate(); - _minimizedWindowTimer.start(THROTTLED_SIM_FRAME_PERIOD_MS); + //_minimizedWindowTimer.start(THROTTLED_SIM_FRAME_PERIOD_MS); } } diff --git a/interface/src/graphics/GraphicsEngine.cpp b/interface/src/graphics/GraphicsEngine.cpp index c2137d3d97..6406d02ced 100644 --- a/interface/src/graphics/GraphicsEngine.cpp +++ b/interface/src/graphics/GraphicsEngine.cpp @@ -32,6 +32,7 @@ #include #include "ui/Stats.h" #include "Application.h" +#include "InterfaceLogging.h" GraphicsEngine::GraphicsEngine() { const QString SPLASH_SKYBOX { "{\"ProceduralEntity\":{ \"version\":2, \"shaderUrl\":\"qrc:///shaders/splashSkybox.frag\" } }" }; @@ -153,7 +154,7 @@ bool GraphicsEngine::shouldPaint() const { (static_cast(_renderEventHandler)->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) { return false; } - + // qCDebug(interfaceapp) << "we are now throttling!!!!!"; return true; } diff --git a/libraries/animation/src/AnimClip.cpp b/libraries/animation/src/AnimClip.cpp index 9dcf5822cd..be28fc93be 100644 --- a/libraries/animation/src/AnimClip.cpp +++ b/libraries/animation/src/AnimClip.cpp @@ -110,7 +110,7 @@ void AnimClip::copyFromNetworkAnim() { for (int i = 0; i < animJointCount; i++) { int skeletonJoint = _skeleton->nameToJointIndex(animSkeleton.getJointName(i)); if (skeletonJoint == -1) { - qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton"; + //qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton"; } jointMap.push_back(skeletonJoint); } diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index b425b6795d..7c0053223d 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -478,8 +478,8 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr std::map lights; QVariantHash joints = mapping.value("joint").toHash(); - QString jointEyeLeftName = "EyeLeft"; - QString jointEyeRightName = "EyeRight"; + QString jointEyeLeftName = "LeftEye"; + QString jointEyeRightName = "RightEye"; QString jointNeckName = "Neck"; QString jointRootName = "Hips"; QString jointLeanName = "Spine"; @@ -603,6 +603,7 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr } if (name == jointEyeLeftName || name == "EyeL" || name == "joint_Leye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeLeftName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeLeftName]))) { + qDebug(modelformat) << "made it to left eye get id " << name << " " << jointEyeLeftName; jointEyeLeftID = getID(object.properties); } else if (name == jointEyeRightName || name == "EyeR" || name == "joint_Reye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeRightName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeRightName]))) { @@ -1451,11 +1452,14 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr // find our special joints hfmModel.leftEyeJointIndex = modelIDs.indexOf(jointEyeLeftID); + qDebug(modelformat) << "jointlefteye" << hfmModel.leftEyeJointIndex << " " << jointEyeLeftID; hfmModel.rightEyeJointIndex = modelIDs.indexOf(jointEyeRightID); + qDebug(modelformat) << "jointrighteye" << hfmModel.rightEyeJointIndex << " " << jointEyeRightID; hfmModel.neckJointIndex = modelIDs.indexOf(jointNeckID); hfmModel.rootJointIndex = modelIDs.indexOf(jointRootID); hfmModel.leanJointIndex = modelIDs.indexOf(jointLeanID); hfmModel.headJointIndex = modelIDs.indexOf(jointHeadID); + qDebug(modelformat) << "head joint" << hfmModel.headJointIndex; hfmModel.leftHandJointIndex = modelIDs.indexOf(jointLeftHandID); hfmModel.rightHandJointIndex = modelIDs.indexOf(jointRightHandID); hfmModel.leftToeJointIndex = modelIDs.indexOf(jointLeftToeID); diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index f10aba7920..b3212b63f8 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -39,6 +39,7 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) { } if (ovr::hmdMounted(status) != _hmdMounted) { _hmdMounted = !_hmdMounted; + qCDebug(oculusLog) << "changed the hmd status" << _hmdMounted; emit hmdMountedChanged(); } if (ovr::isVisible(status) != _visible) { diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index 11ef222172..c44f0b27b5 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -686,6 +686,7 @@ void OpenVrDisplayPlugin::postPreview() { } if (isHmdMounted() != _hmdMounted) { + qDebug() << "changed hmd status " << isHmdMounted(); _hmdMounted = !_hmdMounted; emit hmdMountedChanged(); } diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 9a57413f95..7f46b8d2fc 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -120,7 +120,7 @@ vr::IVRSystem* acquireOpenVrSystem() { } if (activeHmd) { #if DEV_BUILD - qCDebug(displayplugins) << "OpenVR: incrementing refcount"; + //qCDebug(displayplugins) << "OpenVR: incrementing refcount"; #endif ++refCount; } @@ -268,6 +268,15 @@ void handleOpenVrEvents() { _keyboardShown = false; DependencyManager::get()->unfocusWindows(); break; + + case vr::VREvent_TrackedDeviceUserInteractionStarted: + qDebug() << "Put on the headset"; + //hmdMountedChanged(); + break; + + case vr::VREvent_TrackedDeviceUserInteractionEnded: + qDebug() << "Took off the headset"; + break; default: break; @@ -418,6 +427,15 @@ void showMinSpecWarning() { } break; + case vr::VREvent_TrackedDeviceUserInteractionStarted: + qDebug() << "Put on the headset2"; + //hmdMountedChanged(); + break; + + case vr::VREvent_TrackedDeviceUserInteractionEnded: + qDebug() << "Took off the headset2"; + break; + default: break; } From 893e9649be959d359c4b59788ddaaf9dca0646f4 Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 17 Dec 2018 15:30:49 -0800 Subject: [PATCH 2/7] removed eye joint debug statements --- libraries/fbx/src/FBXSerializer.cpp | 4 ---- plugins/openvr/src/OpenVrHelpers.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index 7c0053223d..3e68b90f75 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -603,7 +603,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr } if (name == jointEyeLeftName || name == "EyeL" || name == "joint_Leye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeLeftName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeLeftName]))) { - qDebug(modelformat) << "made it to left eye get id " << name << " " << jointEyeLeftName; jointEyeLeftID = getID(object.properties); } else if (name == jointEyeRightName || name == "EyeR" || name == "joint_Reye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeRightName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeRightName]))) { @@ -1452,14 +1451,11 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr // find our special joints hfmModel.leftEyeJointIndex = modelIDs.indexOf(jointEyeLeftID); - qDebug(modelformat) << "jointlefteye" << hfmModel.leftEyeJointIndex << " " << jointEyeLeftID; hfmModel.rightEyeJointIndex = modelIDs.indexOf(jointEyeRightID); - qDebug(modelformat) << "jointrighteye" << hfmModel.rightEyeJointIndex << " " << jointEyeRightID; hfmModel.neckJointIndex = modelIDs.indexOf(jointNeckID); hfmModel.rootJointIndex = modelIDs.indexOf(jointRootID); hfmModel.leanJointIndex = modelIDs.indexOf(jointLeanID); hfmModel.headJointIndex = modelIDs.indexOf(jointHeadID); - qDebug(modelformat) << "head joint" << hfmModel.headJointIndex; hfmModel.leftHandJointIndex = modelIDs.indexOf(jointLeftHandID); hfmModel.rightHandJointIndex = modelIDs.indexOf(jointRightHandID); hfmModel.leftToeJointIndex = modelIDs.indexOf(jointLeftToeID); diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 7f46b8d2fc..bffeb4f9ea 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -268,7 +268,7 @@ void handleOpenVrEvents() { _keyboardShown = false; DependencyManager::get()->unfocusWindows(); break; - + case vr::VREvent_TrackedDeviceUserInteractionStarted: qDebug() << "Put on the headset"; //hmdMountedChanged(); From ff9b0a1ac463dd85f9e02d3b120a7e8b1623a809 Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 17 Dec 2018 16:18:43 -0800 Subject: [PATCH 3/7] added debug for hmd events --- plugins/openvr/src/OpenVrDisplayPlugin.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index c44f0b27b5..b5b81a9a25 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -668,11 +668,22 @@ void OpenVrDisplayPlugin::hmdPresent() { void OpenVrDisplayPlugin::postPreview() { PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex) - PoseData nextRender, nextSim; + PoseData nextRender, nextSim; nextRender.frameIndex = presentCount(); _hmdActivityLevel = _system->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd); - + switch (_hmdActivityLevel) { + case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Unknown: qDebug() << "unkown hmd activity "; + break; + case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Idle: qDebug() << "no activity 10 secs "; + break; + case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction: qDebug() << "activity "; + break; + case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction_Timeout: qDebug() << "idle for 0.5 secs "; + break; + case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Standby: qDebug() << "idle for 5 secs "; + break; + } if (!_threadedSubmit) { vr::VRCompositor()->WaitGetPoses(nextRender.vrPoses, vr::k_unMaxTrackedDeviceCount, nextSim.vrPoses, vr::k_unMaxTrackedDeviceCount); From da05692e5d35bd5942e9fc598356529849fcfe96 Mon Sep 17 00:00:00 2001 From: amantley Date: Tue, 18 Dec 2018 18:53:48 -0800 Subject: [PATCH 4/7] added auto switch to vive, checking for the proximity button on vive, to do: make sure ik is off for the head when in desktop mode. --- interface/src/Application.cpp | 3 +++ .../display-plugins/hmd/HmdDisplayPlugin.cpp | 4 ++++ .../display-plugins/hmd/HmdDisplayPlugin.h | 2 +- plugins/openvr/src/OpenVrDisplayPlugin.cpp | 7 +++--- plugins/openvr/src/OpenVrDisplayPlugin.h | 1 + plugins/openvr/src/OpenVrHelpers.cpp | 22 +++++++++++++++++++ plugins/openvr/src/OpenVrHelpers.h | 1 + 7 files changed, 36 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d00e4f4a66..a8bab618a0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6611,6 +6611,8 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { bool Application::isHMDMode() const { + qDebug() << "the hmd is visible " << getActiveDisplayPlugin()->isDisplayVisible(); + qDebug() << "the hmd is active " << getActiveDisplayPlugin()->isHmd(); return getActiveDisplayPlugin()->isHmd(); } @@ -6690,6 +6692,7 @@ void Application::resetSensors(bool andReload) { } void Application::hmdVisibleChanged(bool visible) { + qDebug() << "hmd visible changed "; // TODO // calling start and stop will change audio input and ouput to default audio devices. // we need to add a pause/unpause functionality to AudioClient for this to work properly diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index 321bcc3fd2..115f3bcd3a 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -48,6 +48,10 @@ static const glm::mat4 IDENTITY_MATRIX; //#define LIVE_SHADER_RELOAD 1 extern glm::vec3 getPoint(float yaw, float pitch); +bool HmdDisplayPlugin::isHmd() const { + return true; +} + glm::uvec2 HmdDisplayPlugin::getRecommendedUiSize() const { return CompositorHelper::VIRTUAL_SCREEN_SIZE; } diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index a56daaad83..370d77b72e 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -25,7 +25,7 @@ class HmdDisplayPlugin : public OpenGLDisplayPlugin { using Parent = OpenGLDisplayPlugin; public: ~HmdDisplayPlugin(); - bool isHmd() const override final { return true; } + bool isHmd() const override final; float getIPD() const override final { return _ipd; } glm::mat4 getEyeToHeadTransform(Eye eye) const override final; glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override; diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index b5b81a9a25..633cb13441 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -677,8 +677,8 @@ void OpenVrDisplayPlugin::postPreview() { break; case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Idle: qDebug() << "no activity 10 secs "; break; - case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction: qDebug() << "activity "; - break; + //case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction: qDebug() << "activity "; + // break; case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction_Timeout: qDebug() << "idle for 0.5 secs "; break; case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Standby: qDebug() << "idle for 5 secs "; @@ -704,7 +704,8 @@ void OpenVrDisplayPlugin::postPreview() { } bool OpenVrDisplayPlugin::isHmdMounted() const { - return _hmdActivityLevel == vr::k_EDeviceActivityLevel_UserInteraction; + // return _hmdActivityLevel == vr::k_EDeviceActivityLevel_UserInteraction; + return isHeadInHeadset(); } void OpenVrDisplayPlugin::updatePresentPose() { diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.h b/plugins/openvr/src/OpenVrDisplayPlugin.h index 5585957031..1ec8716cb5 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.h +++ b/plugins/openvr/src/OpenVrDisplayPlugin.h @@ -37,6 +37,7 @@ class OpenVrDisplayPlugin : public HmdDisplayPlugin { public: bool isSupported() const override; const QString getName() const override; + bool getSupportsAutoSwitch() override final { return true; } glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override; glm::mat4 getCullingProjection(const glm::mat4& baseProjection) const override; diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index bffeb4f9ea..6ee78a6b45 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -37,6 +37,11 @@ static int refCount { 0 }; static Mutex mutex; static vr::IVRSystem* activeHmd { nullptr }; static bool _openVrQuitRequested { false }; +static bool _headInHeadset { false }; + +bool isHeadInHeadset() { + return _headInHeadset; +} bool openVrQuitRequested() { return _openVrQuitRequested; @@ -282,7 +287,24 @@ void handleOpenVrEvents() { break; } #if DEV_BUILD + if (event.data.controller.button == vr::k_EButton_ProximitySensor) { + qDebug() << "fired the proximity sensor!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "; + vr::VRControllerState_t controllerState = vr::VRControllerState_t(); + if (activeHmd->GetControllerState(vr::k_unTrackedDeviceIndex_Hmd, &controllerState, sizeof(vr::VRControllerState_t))) { + ulong prox = controllerState.ulButtonPressed & (1UL << ((int)vr::k_EButton_ProximitySensor)); + qDebug() << "prox is -----------------------------> " << (int)prox; + if (prox) { + qDebug() << "headset is on"; + _headInHeadset = true; + } else { + qDebug() << "headset is off"; + _headInHeadset = false; + } + } + + } else { qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; + } #endif } diff --git a/plugins/openvr/src/OpenVrHelpers.h b/plugins/openvr/src/OpenVrHelpers.h index 833e5ba65d..b0960a03eb 100644 --- a/plugins/openvr/src/OpenVrHelpers.h +++ b/plugins/openvr/src/OpenVrHelpers.h @@ -23,6 +23,7 @@ vr::IVRSystem* acquireOpenVrSystem(); void releaseOpenVrSystem(); void handleOpenVrEvents(); bool openVrQuitRequested(); +bool isHeadInHeadset(); void enableOpenVrKeyboard(PluginContainer* container); void disableOpenVrKeyboard(); bool isOpenVrKeyboardShown(); From b8c0d6d9f998bd7c209cae665faa88fa0ede1eee Mon Sep 17 00:00:00 2001 From: amantley Date: Wed, 19 Dec 2018 12:00:40 -0800 Subject: [PATCH 5/7] removed print statement in application.cpp and added check of button flag in openvrhelpers.cpp --- interface/src/Application.cpp | 4 ++-- plugins/openvr/src/OpenVrHelpers.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a8bab618a0..36100ea79f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6611,8 +6611,8 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { bool Application::isHMDMode() const { - qDebug() << "the hmd is visible " << getActiveDisplayPlugin()->isDisplayVisible(); - qDebug() << "the hmd is active " << getActiveDisplayPlugin()->isHmd(); + // qDebug() << "the hmd is visible " << getActiveDisplayPlugin()->isDisplayVisible(); + // qDebug() << "the hmd is active " << getActiveDisplayPlugin()->isHmd(); return getActiveDisplayPlugin()->isHmd(); } diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 6ee78a6b45..1475e63218 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -293,11 +293,15 @@ void handleOpenVrEvents() { if (activeHmd->GetControllerState(vr::k_unTrackedDeviceIndex_Hmd, &controllerState, sizeof(vr::VRControllerState_t))) { ulong prox = controllerState.ulButtonPressed & (1UL << ((int)vr::k_EButton_ProximitySensor)); qDebug() << "prox is -----------------------------> " << (int)prox; + bool test = false; + if (prox == (1UL << ((int)vr::k_EButton_ProximitySensor))) { + test = true; + } if (prox) { - qDebug() << "headset is on"; + qDebug() << "headset is on " << test; _headInHeadset = true; } else { - qDebug() << "headset is off"; + qDebug() << "headset is off " << test; _headInHeadset = false; } } From a7510cbfbeeca8f9afee01355361a8df0bca559e Mon Sep 17 00:00:00 2001 From: amantley Date: Wed, 19 Dec 2018 13:43:50 -0800 Subject: [PATCH 6/7] removed debug print statements --- interface/src/Application.cpp | 5 +---- interface/src/graphics/GraphicsEngine.cpp | 3 +-- libraries/animation/src/AnimClip.cpp | 2 +- .../display-plugins/hmd/HmdDisplayPlugin.cpp | 4 ---- .../display-plugins/hmd/HmdDisplayPlugin.h | 2 +- .../oculus/src/OculusBaseDisplayPlugin.cpp | 1 - plugins/openvr/src/OpenVrDisplayPlugin.cpp | 17 +--------------- plugins/openvr/src/OpenVrDisplayPlugin.h | 1 - plugins/openvr/src/OpenVrHelpers.cpp | 20 +------------------ 9 files changed, 6 insertions(+), 49 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 36100ea79f..4b0724a556 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6611,8 +6611,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { bool Application::isHMDMode() const { - // qDebug() << "the hmd is visible " << getActiveDisplayPlugin()->isDisplayVisible(); - // qDebug() << "the hmd is active " << getActiveDisplayPlugin()->isHmd(); return getActiveDisplayPlugin()->isHmd(); } @@ -6692,7 +6690,6 @@ void Application::resetSensors(bool andReload) { } void Application::hmdVisibleChanged(bool visible) { - qDebug() << "hmd visible changed "; // TODO // calling start and stop will change audio input and ouput to default audio devices. // we need to add a pause/unpause functionality to AudioClient for this to work properly @@ -8250,7 +8247,7 @@ void Application::windowMinimizedChanged(bool minimized) { getActiveDisplayPlugin()->activate(); } else if (minimized && getActiveDisplayPlugin()->isActive()) { getActiveDisplayPlugin()->deactivate(); - //_minimizedWindowTimer.start(THROTTLED_SIM_FRAME_PERIOD_MS); + _minimizedWindowTimer.start(THROTTLED_SIM_FRAME_PERIOD_MS); } } diff --git a/interface/src/graphics/GraphicsEngine.cpp b/interface/src/graphics/GraphicsEngine.cpp index 6406d02ced..c2137d3d97 100644 --- a/interface/src/graphics/GraphicsEngine.cpp +++ b/interface/src/graphics/GraphicsEngine.cpp @@ -32,7 +32,6 @@ #include #include "ui/Stats.h" #include "Application.h" -#include "InterfaceLogging.h" GraphicsEngine::GraphicsEngine() { const QString SPLASH_SKYBOX { "{\"ProceduralEntity\":{ \"version\":2, \"shaderUrl\":\"qrc:///shaders/splashSkybox.frag\" } }" }; @@ -154,7 +153,7 @@ bool GraphicsEngine::shouldPaint() const { (static_cast(_renderEventHandler)->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) { return false; } - // qCDebug(interfaceapp) << "we are now throttling!!!!!"; + return true; } diff --git a/libraries/animation/src/AnimClip.cpp b/libraries/animation/src/AnimClip.cpp index be28fc93be..9dcf5822cd 100644 --- a/libraries/animation/src/AnimClip.cpp +++ b/libraries/animation/src/AnimClip.cpp @@ -110,7 +110,7 @@ void AnimClip::copyFromNetworkAnim() { for (int i = 0; i < animJointCount; i++) { int skeletonJoint = _skeleton->nameToJointIndex(animSkeleton.getJointName(i)); if (skeletonJoint == -1) { - //qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton"; + qCWarning(animation) << "animation contains joint =" << animSkeleton.getJointName(i) << " which is not in the skeleton"; } jointMap.push_back(skeletonJoint); } diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index 115f3bcd3a..321bcc3fd2 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -48,10 +48,6 @@ static const glm::mat4 IDENTITY_MATRIX; //#define LIVE_SHADER_RELOAD 1 extern glm::vec3 getPoint(float yaw, float pitch); -bool HmdDisplayPlugin::isHmd() const { - return true; -} - glm::uvec2 HmdDisplayPlugin::getRecommendedUiSize() const { return CompositorHelper::VIRTUAL_SCREEN_SIZE; } diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index 370d77b72e..a56daaad83 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -25,7 +25,7 @@ class HmdDisplayPlugin : public OpenGLDisplayPlugin { using Parent = OpenGLDisplayPlugin; public: ~HmdDisplayPlugin(); - bool isHmd() const override final; + bool isHmd() const override final { return true; } float getIPD() const override final { return _ipd; } glm::mat4 getEyeToHeadTransform(Eye eye) const override final; glm::mat4 getEyeProjection(Eye eye, const glm::mat4& baseProjection) const override; diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index b3212b63f8..f10aba7920 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -39,7 +39,6 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) { } if (ovr::hmdMounted(status) != _hmdMounted) { _hmdMounted = !_hmdMounted; - qCDebug(oculusLog) << "changed the hmd status" << _hmdMounted; emit hmdMountedChanged(); } if (ovr::isVisible(status) != _visible) { diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index 633cb13441..11d941dcd0 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -668,22 +668,9 @@ void OpenVrDisplayPlugin::hmdPresent() { void OpenVrDisplayPlugin::postPreview() { PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex) - PoseData nextRender, nextSim; + PoseData nextRender, nextSim; nextRender.frameIndex = presentCount(); - _hmdActivityLevel = _system->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd); - switch (_hmdActivityLevel) { - case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Unknown: qDebug() << "unkown hmd activity "; - break; - case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Idle: qDebug() << "no activity 10 secs "; - break; - //case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction: qDebug() << "activity "; - // break; - case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_UserInteraction_Timeout: qDebug() << "idle for 0.5 secs "; - break; - case vr::EDeviceActivityLevel::k_EDeviceActivityLevel_Standby: qDebug() << "idle for 5 secs "; - break; - } if (!_threadedSubmit) { vr::VRCompositor()->WaitGetPoses(nextRender.vrPoses, vr::k_unMaxTrackedDeviceCount, nextSim.vrPoses, vr::k_unMaxTrackedDeviceCount); @@ -697,14 +684,12 @@ void OpenVrDisplayPlugin::postPreview() { } if (isHmdMounted() != _hmdMounted) { - qDebug() << "changed hmd status " << isHmdMounted(); _hmdMounted = !_hmdMounted; emit hmdMountedChanged(); } } bool OpenVrDisplayPlugin::isHmdMounted() const { - // return _hmdActivityLevel == vr::k_EDeviceActivityLevel_UserInteraction; return isHeadInHeadset(); } diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.h b/plugins/openvr/src/OpenVrDisplayPlugin.h index 1ec8716cb5..265f328920 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.h +++ b/plugins/openvr/src/OpenVrDisplayPlugin.h @@ -79,7 +79,6 @@ protected: private: vr::IVRSystem* _system { nullptr }; - std::atomic _hmdActivityLevel { vr::k_EDeviceActivityLevel_Unknown }; std::atomic _keyboardSupressionCount{ 0 }; vr::HmdMatrix34_t _lastGoodHMDPose; diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 1475e63218..3f0b54ad44 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -125,7 +125,7 @@ vr::IVRSystem* acquireOpenVrSystem() { } if (activeHmd) { #if DEV_BUILD - //qCDebug(displayplugins) << "OpenVR: incrementing refcount"; + qCDebug(displayplugins) << "OpenVR: incrementing refcount"; #endif ++refCount; } @@ -274,15 +274,6 @@ void handleOpenVrEvents() { DependencyManager::get()->unfocusWindows(); break; - case vr::VREvent_TrackedDeviceUserInteractionStarted: - qDebug() << "Put on the headset"; - //hmdMountedChanged(); - break; - - case vr::VREvent_TrackedDeviceUserInteractionEnded: - qDebug() << "Took off the headset"; - break; - default: break; } @@ -453,15 +444,6 @@ void showMinSpecWarning() { } break; - case vr::VREvent_TrackedDeviceUserInteractionStarted: - qDebug() << "Put on the headset2"; - //hmdMountedChanged(); - break; - - case vr::VREvent_TrackedDeviceUserInteractionEnded: - qDebug() << "Took off the headset2"; - break; - default: break; } From bc78ebe05d855f88ef11a2032814215a8e1f932c Mon Sep 17 00:00:00 2001 From: amantley Date: Wed, 19 Dec 2018 14:21:14 -0800 Subject: [PATCH 7/7] cleaned up the button event code for the proximity sensor button --- plugins/openvr/src/OpenVrHelpers.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 3f0b54ad44..108431a8ac 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -277,29 +277,17 @@ void handleOpenVrEvents() { default: break; } - #if DEV_BUILD if (event.data.controller.button == vr::k_EButton_ProximitySensor) { - qDebug() << "fired the proximity sensor!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "; vr::VRControllerState_t controllerState = vr::VRControllerState_t(); if (activeHmd->GetControllerState(vr::k_unTrackedDeviceIndex_Hmd, &controllerState, sizeof(vr::VRControllerState_t))) { - ulong prox = controllerState.ulButtonPressed & (1UL << ((int)vr::k_EButton_ProximitySensor)); - qDebug() << "prox is -----------------------------> " << (int)prox; - bool test = false; - if (prox == (1UL << ((int)vr::k_EButton_ProximitySensor))) { - test = true; - } - if (prox) { - qDebug() << "headset is on " << test; - _headInHeadset = true; - } else { - qDebug() << "headset is off " << test; - _headInHeadset = false; - } + ulong promitySensorFlag = (1UL << ((int)vr::k_EButton_ProximitySensor)); + _headInHeadset = (controllerState.ulButtonPressed & promitySensorFlag) == promitySensorFlag; } - } else { - qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; } + + #if DEV_BUILD + qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; #endif }