From f4ec09a48b935ebbef05c66d90d5c57276dd781a Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 23 Jul 2015 10:42:22 -0700 Subject: [PATCH 1/3] move renderLaserPointers() into a draw item --- interface/src/Application.cpp | 4 ---- interface/src/avatar/MyAvatar.cpp | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8f825a2768..2ea923db2d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3295,10 +3295,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se sceneInterface->setEngineFeedOverlay3DItems(engineRC->_numFeedOverlay3DItems); sceneInterface->setEngineDrawnOverlay3DItems(engineRC->_numDrawnOverlay3DItems); } - //Render the sixense lasers - if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { - _myAvatar->renderLaserPointers(*renderArgs->_batch); - } if (!selfAvatarOnly) { // give external parties a change to hook in diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index ac0cb3feda..2a5e92014c 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -345,6 +345,11 @@ void MyAvatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) { renderArgs && renderArgs->_batch) { _skeletonModel.renderIKConstraints(*renderArgs->_batch); } + + //Render the sixense lasers + if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { + renderLaserPointers(*renderArgs->_batch); + } } const glm::vec3 HAND_TO_PALM_OFFSET(0.0f, 0.12f, 0.08f); From 720f6ec529d7b9f023569599651cfd2d30742b36 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 23 Jul 2015 11:17:22 -0700 Subject: [PATCH 2/3] completely remove six sense lasers --- interface/src/Menu.cpp | 1 - interface/src/Menu.h | 1 - interface/src/avatar/MyAvatar.cpp | 5 ----- interface/src/devices/SixenseManager.cpp | 3 +-- interface/src/ui/ApplicationCompositor.cpp | 24 ++++++++-------------- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 25f993d77e..ddc76663f4 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -478,7 +478,6 @@ Menu::Menu() { qApp, SLOT(setLowVelocityFilter(bool))); addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseMouseInput, 0, true); - addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseLasers, 0, false); MenuWrapper* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion"); addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index b6c2e47329..bf0f89abb5 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -272,7 +272,6 @@ namespace MenuOption { const QString SimpleShadows = "Simple"; const QString SixenseEnabled = "Enable Hydra Support"; const QString SixenseMouseInput = "Enable Sixense Mouse Input"; - const QString SixenseLasers = "Enable Sixense UI Lasers"; const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations"; const QString Stars = "Stars"; const QString Stats = "Stats"; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 2a5e92014c..ac0cb3feda 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -345,11 +345,6 @@ void MyAvatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) { renderArgs && renderArgs->_batch) { _skeletonModel.renderIKConstraints(*renderArgs->_batch); } - - //Render the sixense lasers - if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { - renderLaserPointers(*renderArgs->_batch); - } } const glm::vec3 HAND_TO_PALM_OFFSET(0.0f, 0.12f, 0.08f); diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 5ead0c4409..45fb2fa1ed 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -520,8 +520,7 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) { triggerButton = Qt::LeftButton; } - if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers) - || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) { + if (Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) { pos = qApp->getApplicationCompositor().getPalmClickLocation(palm); } else { // Get directon relative to avatar orientation diff --git a/interface/src/ui/ApplicationCompositor.cpp b/interface/src/ui/ApplicationCompositor.cpp index afdeb7b94e..de65817620 100644 --- a/interface/src/ui/ApplicationCompositor.cpp +++ b/interface/src/ui/ApplicationCompositor.cpp @@ -491,24 +491,18 @@ void ApplicationCompositor::renderControllerPointers(gpu::Batch& batch) { auto canvasSize = qApp->getCanvasSize(); int mouseX, mouseY; - if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { - QPoint res = getPalmClickLocation(palmData); - mouseX = res.x(); - mouseY = res.y(); - } else { - // Get directon relative to avatar orientation - glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * palmData->getFingerDirection(); + // Get directon relative to avatar orientation + glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * palmData->getFingerDirection(); - // Get the angles, scaled between (-0.5,0.5) - float xAngle = (atan2(direction.z, direction.x) + PI_OVER_TWO); - float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)PI_OVER_TWO)); + // Get the angles, scaled between (-0.5,0.5) + float xAngle = (atan2(direction.z, direction.x) + PI_OVER_TWO); + float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)PI_OVER_TWO)); - // Get the pixel range over which the xAngle and yAngle are scaled - float cursorRange = canvasSize.x * SixenseManager::getInstance().getCursorPixelRangeMult(); + // Get the pixel range over which the xAngle and yAngle are scaled + float cursorRange = canvasSize.x * SixenseManager::getInstance().getCursorPixelRangeMult(); - mouseX = (canvasSize.x / 2.0f + cursorRange * xAngle); - mouseY = (canvasSize.y / 2.0f + cursorRange * yAngle); - } + mouseX = (canvasSize.x / 2.0f + cursorRange * xAngle); + mouseY = (canvasSize.y / 2.0f + cursorRange * yAngle); //If the cursor is out of the screen then don't render it if (mouseX < 0 || mouseX >= (int)canvasSize.x || mouseY < 0 || mouseY >= (int)canvasSize.y) { From 71557a1846b63652a564ef3e7b7e741cd507ba5e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 24 Jul 2015 09:36:27 -0700 Subject: [PATCH 3/3] only output no listener for type message one time --- libraries/networking/src/PacketReceiver.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/networking/src/PacketReceiver.cpp b/libraries/networking/src/PacketReceiver.cpp index f59be35dc5..5fc327673d 100644 --- a/libraries/networking/src/PacketReceiver.cpp +++ b/libraries/networking/src/PacketReceiver.cpp @@ -280,7 +280,7 @@ void PacketReceiver::processDatagrams() { auto it = _packetListenerMap.find(packet->getType()); - if (it != _packetListenerMap.end()) { + if (it != _packetListenerMap.end() && it->second.isValid()) { auto listener = it.value(); @@ -367,10 +367,12 @@ void PacketReceiver::processDatagrams() { } } else { - qWarning() << "No listener found for packet type " << nameForPacketType(packet->getType()); - - // insert a dummy listener so we don't print this again - _packetListenerMap.insert(packet->getType(), { nullptr, QMetaMethod() }); + if (it == _packetListenerMap.end()) { + qWarning() << "No listener found for packet type " << nameForPacketType(packet->getType()); + + // insert a dummy listener so we don't print this again + _packetListenerMap.insert(packet->getType(), { nullptr, QMetaMethod() }); + } } _packetListenerLock.unlock();