Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 7 files). Show all
Unified · Split
| @@ -17,8 +17,9 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <gpu/Batch.h> |
| 18 | 18 | #include <gpu/Context.h> |
| 19 | 19 | #include <DeferredLightingEffect.h> |
| 20 | −#include <display-plugins\openvr\OpenVrHelpers.h> | |
| 20 | +#include <display-plugins/openvr/OpenVrHelpers.h> | |
| 21 | 21 | #include "NumericalConstants.h" |
| 22 | +#include <plugins/PluginContainer.h> | |
| 22 | 23 | #include "UserActivityLogger.h" |
| 23 | 24 | |
| 24 | 25 | extern vr::IVRSystem* _hmd; |
| @@ -44,12 +45,18 @@ const QString CONTROLLER_MODEL_STRING = "vr_controller_05_wireless_b"; · 19 unmodified lines | ||
| 44 | 45 | |
| 45 | 46 | const QString ViveControllerManager::NAME = "OpenVR"; |
| 46 | 47 | |
| 48 | +const QString MENU_PARENT = "Avatar"; | |
| 49 | +const QString MENU_NAME = "Vive Controllers"; | |
| 50 | +const QString MENU_PATH = MENU_PARENT + ">" + MENU_NAME; | |
| 51 | +const QString RENDER_CONTROLLERS = "Render Hand Controllers"; | |
| 52 | + | |
| 47 | 53 | ViveControllerManager::ViveControllerManager() : |
| 48 | 54 | InputDevice("SteamVR Controller"), |
| 49 | 55 | _trackedControllers(0), |
| 50 | 56 | _modelLoaded(false), |
| 51 | 57 | _leftHandRenderID(0), |
| 52 | − _rightHandRenderID(0) | |
| 58 | + _rightHandRenderID(0), | |
| 59 | + _renderControllers(false) | |
| 53 | 60 | { |
| 54 | 61 | |
| 55 | 62 | } |
| @@ -59,6 +66,11 @@ bool ViveControllerManager::isSupported() const { · 3 unmodified lines | ||
| 59 | 66 | } |
| 60 | 67 | |
| 61 | 68 | void ViveControllerManager::activate(PluginContainer* container) { |
| 69 | + container->addMenu(MENU_PATH); | |
| 70 | + container->addMenuItem(MENU_PATH, RENDER_CONTROLLERS, | |
| 71 | + [this, &container] (bool clicked) { this->setRenderControllers(clicked); }, | |
| 72 | + true, true); | |
| 73 | + | |
| 62 | 74 | hmdRefCount++; |
| 63 | 75 | if (!_hmd) { |
| 64 | 76 | vr::HmdError eError = vr::HmdError_None; |
| @@ -111,10 +123,14 @@ void ViveControllerManager::activate(PluginContainer* container) { · 46 unmodified lines | ||
| 111 | 123 | _texture->autoGenerateMips(-1); |
| 112 | 124 | |
| 113 | 125 | _modelLoaded = true; |
| 126 | + _renderControllers = true; | |
| 114 | 127 | } |
| 115 | 128 | } |
| 116 | 129 | |
| 117 | 130 | void ViveControllerManager::deactivate(PluginContainer* container) { |
| 131 | + container->removeMenuItem(MENU_NAME, RENDER_CONTROLLERS); | |
| 132 | + container->removeMenu(MENU_PATH); | |
| 133 | + | |
| 118 | 134 | hmdRefCount--; |
| 119 | 135 | |
| 120 | 136 | if (hmdRefCount == 0 && _hmd) { |