From d056c41e251d6586f0f0d54e013d487daee2a025 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Mar 2016 13:55:24 -0800 Subject: [PATCH] Update to latest Oculus SDK, add input device support --- cmake/externals/LibOVR/CMakeLists.txt | 23 +- .../src/controllers/StandardControls.h | 3 + .../oculus/src/OculusBaseDisplayPlugin.cpp | 20 +- plugins/oculus/src/OculusBaseDisplayPlugin.h | 1 - .../oculus/src/OculusControllerManager.cpp | 218 ++++++++++++++++++ plugins/oculus/src/OculusControllerManager.h | 82 +++++++ plugins/oculus/src/OculusDisplayPlugin.cpp | 2 +- plugins/oculus/src/OculusHelpers.cpp | 39 +++- plugins/oculus/src/OculusHelpers.h | 4 +- plugins/oculus/src/OculusProvider.cpp | 4 +- 10 files changed, 354 insertions(+), 42 deletions(-) create mode 100644 plugins/oculus/src/OculusControllerManager.cpp create mode 100644 plugins/oculus/src/OculusControllerManager.h diff --git a/cmake/externals/LibOVR/CMakeLists.txt b/cmake/externals/LibOVR/CMakeLists.txt index a98745b404..5b8a689a9a 100644 --- a/cmake/externals/LibOVR/CMakeLists.txt +++ b/cmake/externals/LibOVR/CMakeLists.txt @@ -12,19 +12,16 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) # 0.5 public # URL http://static.oculus.com/sdk-downloads/ovr_sdk_win_0.5.0.1.zip # URL_MD5 d3fc4c02db9be5ff08af4ef4c97b32f9 -# 0.6 public -# URL http://static.oculus.com/sdk-downloads/0.6.0.1/Public/1435190862/ovr_sdk_win_0.6.0.1.zip -# URL_MD5 4b3ef825f9a1d6d3035c9f6820687da9 -# 0.8 public -# URL http://static.oculus.com/sdk-downloads/0.8.0.0/Public/1445451746/ovr_sdk_win_0.8.0.0.zip -# URL_MD5 54944b03b95149d6010f84eb701b9647 +# 1.3 public +# URL http://hifi-public.s3.amazonaws.com/dependencies/ovr_sdk_win_1.3.0_public.zip +# URL_MD5 4d26faba0c1f35ff80bf674c96ed9259 if (WIN32) ExternalProject_Add( ${EXTERNAL_NAME} - URL http://static.oculus.com/sdk-downloads/0.8.0.0/Public/1445451746/ovr_sdk_win_0.8.0.0.zip - URL_MD5 54944b03b95149d6010f84eb701b9647 + URL http://hifi-public.s3.amazonaws.com/dependencies/ovr_sdk_win_1.3.0_public.zip + URL_MD5 a2dcf695e0f03a70fdd1ed7480585e82 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" @@ -33,14 +30,16 @@ if (WIN32) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) - # FIXME need to account for different architectures - set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include CACHE TYPE INTERNAL) + set(LIBOVR_DIR ${SOURCE_DIR}/OculusSDK/LibOVR) if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/LibOVR/Lib/Windows/x64/Release/VS2013/LibOVR.lib CACHE TYPE INTERNAL) + set(LIBOVR_LIB_DIR ${LIBOVR_DIR}/Lib/Windows/x64/Release/VS2013 CACHE TYPE INTERNAL) else() - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/LibOVR/Lib/Windows/Win32/Release/VS2013/LibOVR.lib CACHE TYPE INTERNAL) + set(LIBOVR_LIB_DIR ${LIBOVR_DIR}/Lib/Windows/Win32/Release/VS2013 CACHE TYPE INTERNAL) endif() + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${LIBOVR_DIR}/Include CACHE TYPE INTERNAL) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${LIBOVR_LIB_DIR}/LibOVR.lib CACHE TYPE INTERNAL) + elseif(APPLE) ExternalProject_Add( diff --git a/libraries/controllers/src/controllers/StandardControls.h b/libraries/controllers/src/controllers/StandardControls.h index 2b0613321e..f101ba6c51 100644 --- a/libraries/controllers/src/controllers/StandardControls.h +++ b/libraries/controllers/src/controllers/StandardControls.h @@ -81,6 +81,9 @@ namespace controller { // Triggers LT, RT, + // Grips (Oculus touch squeeze) + LG, + RG, NUM_STANDARD_AXES, LZ = LT, RZ = RT diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index e23d8cade6..8f4e8d665d 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -12,7 +12,7 @@ #include "OculusHelpers.h" void OculusBaseDisplayPlugin::resetSensors() { - ovr_RecenterPose(_session); + ovr_RecenterTrackingOrigin(_session); } void OculusBaseDisplayPlugin::updateHeadPose(uint32_t frameIndex) { @@ -42,36 +42,30 @@ bool OculusBaseDisplayPlugin::internalActivate() { _hmdDesc = ovr_GetHmdDesc(_session); - _ipd = ovr_GetFloat(_session, OVR_KEY_IPD, _ipd); - glm::uvec2 eyeSizes[2]; _viewScaleDesc.HmdSpaceToWorldScaleInMeters = 1.0f; + _ipd = 0; ovr_for_each_eye([&](ovrEyeType eye) { _eyeFovs[eye] = _hmdDesc.DefaultEyeFov[eye]; ovrEyeRenderDesc& erd = _eyeRenderDescs[eye] = ovr_GetRenderDesc(_session, eye, _eyeFovs[eye]); ovrMatrix4f ovrPerspectiveProjection = - ovrMatrix4f_Projection(erd.Fov, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP, ovrProjection_RightHanded); + ovrMatrix4f_Projection(erd.Fov, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP, ovrProjection_ClipRangeOpenGL); _eyeProjections[eye] = toGlm(ovrPerspectiveProjection); - _eyeOffsets[eye] = glm::translate(mat4(), toGlm(erd.HmdToEyeViewOffset)); + _eyeOffsets[eye] = glm::translate(mat4(), toGlm(erd.HmdToEyeOffset)); eyeSizes[eye] = toGlm(ovr_GetFovTextureSize(_session, eye, erd.Fov, 1.0f)); - _viewScaleDesc.HmdToEyeViewOffset[eye] = erd.HmdToEyeViewOffset; + _viewScaleDesc.HmdToEyeOffset[eye] = erd.HmdToEyeOffset; + _ipd += glm::abs(glm::length(toGlm(erd.HmdToEyeOffset))); }); auto combinedFov = _eyeFovs[0]; combinedFov.LeftTan = combinedFov.RightTan = std::max(combinedFov.LeftTan, combinedFov.RightTan); - _cullingProjection = toGlm(ovrMatrix4f_Projection(combinedFov, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP, ovrProjection_RightHanded)); + _cullingProjection = toGlm(ovrMatrix4f_Projection(combinedFov, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP, ovrProjection_ClipRangeOpenGL)); _renderTargetSize = uvec2( eyeSizes[0].x + eyeSizes[1].x, std::max(eyeSizes[0].y, eyeSizes[1].y)); - if (!OVR_SUCCESS(ovr_ConfigureTracking(_session, - ovrTrackingCap_Orientation | ovrTrackingCap_Position | ovrTrackingCap_MagYawCorrection, 0))) { - logWarning("Failed to attach to sensor device"); - } - - // Parent class relies on our _session intialization, so it must come after that. memset(&_sceneLayer, 0, sizeof(ovrLayerEyeFov)); _sceneLayer.Header.Type = ovrLayerType_EyeFov; _sceneLayer.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft; diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.h b/plugins/oculus/src/OculusBaseDisplayPlugin.h index d21b0561bc..b5ec0769e0 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.h +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.h @@ -30,7 +30,6 @@ protected: protected: ovrSession _session; ovrGraphicsLuid _luid; - float _ipd{ OVR_DEFAULT_IPD }; ovrEyeRenderDesc _eyeRenderDescs[2]; ovrFovPort _eyeFovs[2]; ovrHmdDesc _hmdDesc; diff --git a/plugins/oculus/src/OculusControllerManager.cpp b/plugins/oculus/src/OculusControllerManager.cpp new file mode 100644 index 0000000000..0761dc1655 --- /dev/null +++ b/plugins/oculus/src/OculusControllerManager.cpp @@ -0,0 +1,218 @@ +// +// OculusControllerManager.cpp +// input-plugins/src/input-plugins +// +// Created by Bradley Austin Davis 2016/03/04. +// Copyright 2013-2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "OculusControllerManager.h" + +#include + +#include +#include +#include + +#include +#include + +#include "OculusHelpers.h" + +Q_DECLARE_LOGGING_CATEGORY(oculus) + + +static const QString MENU_PARENT = "Avatar"; +static const QString MENU_NAME = "Oculus Touch Controllers"; +static const QString MENU_PATH = MENU_PARENT + ">" + MENU_NAME; + +const QString OculusControllerManager::NAME = "Oculus"; + +bool OculusControllerManager::isSupported() const { + return oculusAvailable(); +} + +void OculusControllerManager::activate() { + InputPlugin::activate(); + if (!_session) { + _session = acquireOculusSession(); + } + Q_ASSERT(_session); + + // register with UserInputMapper + auto userInputMapper = DependencyManager::get(); + if (_remote) { + userInputMapper->registerDevice(_remote); + } + if (_touch) { + userInputMapper->registerDevice(_touch); + } +} + +void OculusControllerManager::deactivate() { + InputPlugin::deactivate(); + + if (_session) { + releaseOculusSession(); + _session = nullptr; + } + + // unregister with UserInputMapper + auto userInputMapper = DependencyManager::get(); + if (_touch) { + userInputMapper->removeDevice(_touch->getDeviceID()); + } + if (_remote) { + userInputMapper->removeDevice(_remote->getDeviceID()); + } +} + +void OculusControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, bool jointsCaptured) { + PerformanceTimer perfTimer("OculusControllerManager::TouchDevice::update"); + + if (!OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Touch, &_inputState))) { + qCWarning(oculus) << "Unable to read oculus input state"; + return; + } + + if (_touch) { + _touch->update(deltaTime, inputCalibrationData, jointsCaptured); + } + if (_remote) { + _remote->update(deltaTime, inputCalibrationData, jointsCaptured); + } +} + +void OculusControllerManager::pluginFocusOutEvent() { + if (_touch) { + _touch->focusOutEvent(); + } + if (_remote) { + _remote->focusOutEvent(); + } +} + +using namespace controller; + +static const std::vector> BUTTON_MAP { { + { ovrButton_X, X }, + { ovrButton_Y, Y }, + { ovrButton_A, A }, + { ovrButton_B, B }, + { ovrButton_LThumb, LS }, + { ovrButton_RThumb, RS }, + { ovrButton_LShoulder, LB }, + { ovrButton_RShoulder, RB }, +} }; + +static const std::vector> TOUCH_MAP { { + { ovrTouch_X, LEFT_SECONDARY_THUMB_TOUCH }, + { ovrTouch_Y, LEFT_SECONDARY_THUMB_TOUCH }, + { ovrTouch_A, RIGHT_SECONDARY_THUMB_TOUCH }, + { ovrTouch_B, RIGHT_SECONDARY_THUMB_TOUCH }, + { ovrTouch_LIndexTrigger, LEFT_PRIMARY_INDEX_TOUCH }, + { ovrTouch_RIndexTrigger, RIGHT_PRIMARY_INDEX_TOUCH }, + { ovrTouch_LThumb, LS_TOUCH }, + { ovrTouch_RThumb, RS_TOUCH }, + { ovrTouch_LThumbUp, LEFT_THUMB_UP }, + { ovrTouch_RThumbUp, RIGHT_THUMB_UP }, + { ovrTouch_LIndexPointing, LEFT_INDEX_POINT }, + { ovrTouch_RIndexPointing, RIGHT_INDEX_POINT }, +} }; + +void OculusControllerManager::TouchDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, bool jointsCaptured) { + _poseStateMap.clear(); + _buttonPressedMap.clear(); + + if (!jointsCaptured) { + int numTrackedControllers = 0; + static const auto REQUIRED_HAND_STATUS = ovrStatus_OrientationTracked & ovrStatus_PositionTracked; + auto tracking = ovr_GetTrackingState(_parent._session, 0, false); + ovr_for_each_hand([&](ovrHandType hand) { + ++numTrackedControllers; + if (REQUIRED_HAND_STATUS == (tracking.HandStatusFlags[hand] & REQUIRED_HAND_STATUS)) { + handlePose(deltaTime, inputCalibrationData, hand, tracking.HandPoses[hand]); + } + }); + } + using namespace controller; + // Axes + const auto& inputState = _parent._inputState; + _axisStateMap[LX] = inputState.Thumbstick[ovrHand_Left].x; + _axisStateMap[LY] = inputState.Thumbstick[ovrHand_Left].y; + _axisStateMap[LT] = inputState.IndexTrigger[ovrHand_Left]; + _axisStateMap[LG] = inputState.HandTrigger[ovrHand_Left]; + + _axisStateMap[RX] = inputState.Thumbstick[ovrHand_Right].x; + _axisStateMap[RY] = inputState.Thumbstick[ovrHand_Right].y; + _axisStateMap[RT] = inputState.IndexTrigger[ovrHand_Right]; + _axisStateMap[RG] = inputState.HandTrigger[ovrHand_Right]; + + // Buttons + for (const auto& pair : BUTTON_MAP) { + if (inputState.Buttons & pair.first) { + _buttonPressedMap.insert(pair.second); + } + } + // Touches + for (const auto& pair : TOUCH_MAP) { + if (inputState.Touches & pair.first) { + _buttonPressedMap.insert(pair.second); + } + } +} + +void OculusControllerManager::TouchDevice::focusOutEvent() { + _axisStateMap.clear(); + _buttonPressedMap.clear(); +}; + +void OculusControllerManager::TouchDevice::handlePose(float deltaTime, + const controller::InputCalibrationData& inputCalibrationData, ovrHandType hand, + const ovrPoseStatef& handPose) { + auto poseId = hand == ovrHand_Left ? controller::LEFT_HAND : controller::RIGHT_HAND; + auto& pose = _poseStateMap[poseId]; + pose.translation = toGlm(handPose.ThePose.Position); + pose.rotation = toGlm(handPose.ThePose.Orientation); + pose.angularVelocity = toGlm(handPose.AngularVelocity); + pose.velocity = toGlm(handPose.LinearVelocity); +} + +controller::Input::NamedVector OculusControllerManager::TouchDevice::getAvailableInputs() const { + using namespace controller; + QVector availableInputs{ + // Trackpad analogs + makePair(LX, "LX"), + makePair(LY, "LY"), + makePair(RX, "RX"), + makePair(RY, "RY"), + // trigger analogs + makePair(LT, "LT"), + makePair(RT, "RT"), + + makePair(LB, "LB"), + makePair(RB, "RB"), + + makePair(LS, "LS"), + makePair(RS, "RS"), + makePair(LEFT_HAND, "LeftHand"), + makePair(RIGHT_HAND, "RightHand"), + + makePair(LEFT_PRIMARY_THUMB, "LeftPrimaryThumb"), + makePair(LEFT_SECONDARY_THUMB, "LeftSecondaryThumb"), + makePair(RIGHT_PRIMARY_THUMB, "RightPrimaryThumb"), + makePair(RIGHT_SECONDARY_THUMB, "RightSecondaryThumb"), + }; + return availableInputs; +} + +QString OculusControllerManager::TouchDevice::getDefaultMappingConfig() const { + static const QString MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/touch.json"; + return MAPPING_JSON; +} + + + diff --git a/plugins/oculus/src/OculusControllerManager.h b/plugins/oculus/src/OculusControllerManager.h new file mode 100644 index 0000000000..7a30b19aa4 --- /dev/null +++ b/plugins/oculus/src/OculusControllerManager.h @@ -0,0 +1,82 @@ +// +// Created by Bradley Austin Davis on 2016/03/04 +// Copyright 2013-2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi__OculusControllerManager +#define hifi__OculusControllerManager + +#include +#include + +#include + +#include +#include + +#include + +class OculusControllerManager : public InputPlugin { + Q_OBJECT +public: + // Plugin functions + bool isSupported() const override; + bool isJointController() const override { return true; } + const QString& getName() const override { return NAME; } + + void activate() override; + void deactivate() override; + + void pluginFocusOutEvent() override; + void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, bool jointsCaptured) override; + +private: + class OculusInputDevice : public controller::InputDevice { + public: + OculusInputDevice(OculusControllerManager& parent, const QString& name) : controller::InputDevice(name), _parent(parent) {} + + OculusControllerManager& _parent; + friend class OculusControllerManager; + }; + + // Waiting on touch API + class RemoteDevice : public OculusInputDevice { + public: + using Pointer = std::shared_ptr; + RemoteDevice(OculusControllerManager& parent) : OculusInputDevice(parent, "Oculus Remote") {} + + controller::Input::NamedVector getAvailableInputs() const override; + QString getDefaultMappingConfig() const override; + void update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, bool jointsCaptured) override; + void focusOutEvent() override; + + friend class OculusControllerManager; + }; + + class TouchDevice : public OculusInputDevice { + public: + using Pointer = std::shared_ptr; + TouchDevice(OculusControllerManager& parent) : OculusInputDevice(parent, "Oculus Touch") {} + + controller::Input::NamedVector getAvailableInputs() const override; + QString getDefaultMappingConfig() const override; + void update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, bool jointsCaptured) override; + void focusOutEvent() override; + + private: + void handlePose(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, ovrHandType hand, const ovrPoseStatef& handPose); + int _trackedControllers { 0 }; + friend class OculusControllerManager; + }; + + ovrSession _session { nullptr }; + ovrInputState _inputState {}; + RemoteDevice::Pointer _remote; + TouchDevice::Pointer _touch; + static const QString NAME; +}; + +#endif // hifi__OculusControllerManager diff --git a/plugins/oculus/src/OculusDisplayPlugin.cpp b/plugins/oculus/src/OculusDisplayPlugin.cpp index 8c3a676c61..1a5a32ffb2 100644 --- a/plugins/oculus/src/OculusDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusDisplayPlugin.cpp @@ -70,5 +70,5 @@ void OculusDisplayPlugin::hmdPresent() { logWarning("Failed to present"); } } - _sceneFbo->Increment(); + _sceneFbo->Commit(); } diff --git a/plugins/oculus/src/OculusHelpers.cpp b/plugins/oculus/src/OculusHelpers.cpp index 170be05952..d38303919e 100644 --- a/plugins/oculus/src/OculusHelpers.cpp +++ b/plugins/oculus/src/OculusHelpers.cpp @@ -98,9 +98,8 @@ SwapFramebufferWrapper::~SwapFramebufferWrapper() { destroyColor(); } -void SwapFramebufferWrapper::Increment() { - ++color->CurrentIndex; - color->CurrentIndex %= color->TextureCount; +void SwapFramebufferWrapper::Commit() { + ovr_CommitTextureSwapChain(_session, color); } void SwapFramebufferWrapper::Resize(const uvec2 & size) { @@ -114,7 +113,7 @@ void SwapFramebufferWrapper::Resize(const uvec2 & size) { void SwapFramebufferWrapper::destroyColor() { if (color) { - ovr_DestroySwapTextureSet(_session, color); + ovr_DestroyTextureSwapChain(_session, color); color = nullptr; } } @@ -122,13 +121,30 @@ void SwapFramebufferWrapper::destroyColor() { void SwapFramebufferWrapper::initColor() { destroyColor(); - if (!OVR_SUCCESS(ovr_CreateSwapTextureSetGL(_session, GL_SRGB8_ALPHA8, size.x, size.y, &color))) { + ovrTextureSwapChainDesc desc = {}; + desc.Type = ovrTexture_2D; + desc.ArraySize = 1; + desc.Width = size.x; + desc.Height = size.y; + desc.MipLevels = 1; + desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; + desc.SampleCount = 1; + desc.StaticImage = ovrFalse; + + ovrResult result = ovr_CreateTextureSwapChainGL(_session, &desc, &color); + if (!OVR_SUCCESS(result)) { logFatal("Failed to create swap textures"); } - for (int i = 0; i < color->TextureCount; ++i) { - ovrGLTexture& ovrTex = (ovrGLTexture&)color->Textures[i]; - glBindTexture(GL_TEXTURE_2D, ovrTex.OGL.TexId); + int length = 0; + result = ovr_GetTextureSwapChainLength(_session, color, &length); + if (!OVR_SUCCESS(result) || !length) { + qFatal("Unable to count swap chain textures"); + } + for (int i = 0; i < length; ++i) { + GLuint chainTexId; + ovr_GetTextureSwapChainBufferGL(_session, color, i, &chainTexId); + glBindTexture(GL_TEXTURE_2D, chainTexId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -141,8 +157,11 @@ void SwapFramebufferWrapper::initDone() { } void SwapFramebufferWrapper::onBind(oglplus::Framebuffer::Target target) { - ovrGLTexture& tex = (ovrGLTexture&)(color->Textures[color->CurrentIndex]); - glFramebufferTexture2D(toEnum(target), GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex.OGL.TexId, 0); + int curIndex; + ovr_GetTextureSwapChainCurrentIndex(_session, color, &curIndex); + GLuint curTexId; + ovr_GetTextureSwapChainBufferGL(_session, color, curIndex, &curTexId); + glFramebufferTexture2D(toEnum(target), GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, curTexId, 0); } void SwapFramebufferWrapper::onUnbind(oglplus::Framebuffer::Target target) { diff --git a/plugins/oculus/src/OculusHelpers.h b/plugins/oculus/src/OculusHelpers.h index e10e058ad2..2f13c45466 100644 --- a/plugins/oculus/src/OculusHelpers.h +++ b/plugins/oculus/src/OculusHelpers.h @@ -111,10 +111,10 @@ inline ovrPosef ovrPoseFromGlm(const glm::mat4 & m) { // then submit it and increment to the next texture. // The Oculus SDK manages the creation and destruction of // the textures -struct SwapFramebufferWrapper : public FramebufferWrapper { +struct SwapFramebufferWrapper : public FramebufferWrapper { SwapFramebufferWrapper(const ovrSession& session); ~SwapFramebufferWrapper(); - void Increment(); + void Commit(); void Resize(const uvec2 & size); protected: void initColor() override final; diff --git a/plugins/oculus/src/OculusProvider.cpp b/plugins/oculus/src/OculusProvider.cpp index be708db932..e723fa839a 100644 --- a/plugins/oculus/src/OculusProvider.cpp +++ b/plugins/oculus/src/OculusProvider.cpp @@ -18,6 +18,7 @@ #include "OculusDisplayPlugin.h" #include "OculusDebugDisplayPlugin.h" +#include "OculusControllerManager.h" class OculusProvider : public QObject, public DisplayProvider, InputProvider { @@ -51,8 +52,6 @@ public: } virtual InputPluginList getInputPlugins() override { - // FIXME pending full oculus input API and hardware -#if 0 static std::once_flag once; std::call_once(once, [&] { InputPluginPointer plugin(new OculusControllerManager()); @@ -60,7 +59,6 @@ public: _inputPlugins.push_back(plugin); } }); -#endif return _inputPlugins; }