From 408bb082d7e408a7af9c8501858e03c8d5beed26 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Wed, 22 Jul 2015 13:24:47 -0400 Subject: [PATCH] Merge fixes, OSX compile fixes --- interface/src/Application.cpp | 34 +++++++++++++------ interface/src/Application.h | 1 + .../ControllerScriptingInterface.cpp | 2 +- .../src/input-plugins/InputDevice.h | 2 +- .../src/input-plugins/SixenseManager.cpp | 6 ++-- .../input-plugins/ViveControllerManager.cpp | 17 ++++++++-- .../src/input-plugins/ViveControllerManager.h | 1 - libraries/render-utils/src/OglplusHelpers.cpp | 3 +- 8 files changed, 47 insertions(+), 19 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index cce51b3cec..bd857883e8 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -335,7 +335,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : _isThrottleFPSEnabled(false), _aboutToQuit(false), _notifiedPacketVersionMismatchThisDomain(false), - _glWidget(new GLCanvas()), _domainConnectionRefusals(QList()), _maxOctreePPS(maxOctreePacketsPerSecond.get()), _lastFaceTrackerUpdate(0), @@ -805,11 +804,6 @@ void Application::initializeGL() { } #endif - qCDebug(interfaceapp) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); - qCDebug(interfaceapp) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); - qCDebug(interfaceapp) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); - qCDebug(interfaceapp) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); - #ifdef WIN32 GLenum err = glewInit(); if (GLEW_OK != err) { @@ -824,6 +818,12 @@ void Application::initializeGL() { } #endif + + qCDebug(interfaceapp) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); + qCDebug(interfaceapp) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); + qCDebug(interfaceapp) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); + qCDebug(interfaceapp) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); + #if defined(Q_OS_LINUX) // TODO: Write the correct code for Linux... /* if (wglewGetExtension("WGL_EXT_swap_control")) { @@ -993,7 +993,6 @@ void Application::paintGL() { (_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); } - Q_ASSERT(_offscreenContext->getContext() == QOpenGLContext::currentContext()); // Update camera position if (!isHMDMode()) { @@ -1108,9 +1107,7 @@ void Application::paintGL() { GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); #endif _offscreenContext->doneCurrent(); - Q_ASSERT(!QOpenGLContext::currentContext()); displayPlugin->preDisplay(); - Q_ASSERT(QOpenGLContext::currentContext()); #ifdef Q_OS_MAC #else @@ -1129,7 +1126,6 @@ void Application::paintGL() { displayPlugin->finishFrame(); } - Q_ASSERT(!QOpenGLContext::currentContext()); _offscreenContext->makeCurrent(); _frameCount++; Stats::getInstance()->setRenderDetails(renderArgs._details); @@ -3146,6 +3142,24 @@ void Application::queryOctree(NodeType_t serverType, PacketType::Value packetTyp }); } +// loadViewFrustum() +// +// Description: this will load the view frustum bounds for EITHER the head +// or the "myCamera". +// +void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { + PROFILE_RANGE(__FUNCTION__); + // We will use these below, from either the camera or head vectors calculated above + viewFrustum.setProjection(camera.getProjection()); + + // Set the viewFrustum up with the correct position and orientation of the camera + viewFrustum.setPosition(camera.getPosition()); + viewFrustum.setOrientation(camera.getRotation()); + + // Ask the ViewFrustum class to calculate our corners + viewFrustum.calculate(); +} + bool Application::isHMDMode() const { return getActiveDisplayPlugin()->isHmd(); } diff --git a/interface/src/Application.h b/interface/src/Application.h index c370a27196..1241f1b573 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -477,6 +477,7 @@ private: void renderLookatIndicator(glm::vec3 pointOfInterest); void queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions); + void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum); glm::vec3 getSunDirection(); diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index bdfea67eac..6fec1a1002 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -19,7 +19,7 @@ #include "ControllerScriptingInterface.h" // TODO: this needs to be removed, as well as any related controller-specific information -#include +#include ControllerScriptingInterface::ControllerScriptingInterface() : diff --git a/libraries/input-plugins/src/input-plugins/InputDevice.h b/libraries/input-plugins/src/input-plugins/InputDevice.h index 7d36557ab9..4dbb141832 100644 --- a/libraries/input-plugins/src/input-plugins/InputDevice.h +++ b/libraries/input-plugins/src/input-plugins/InputDevice.h @@ -21,7 +21,7 @@ const unsigned int CONTROLLER_1_EVENT = 1501U; // instead of class Example : public InputDevice, public InputPlugin class InputDevice { public: - InputDevice::InputDevice(const QString& name) : _name(name) {} + InputDevice(const QString& name) : _name(name) {} typedef std::unordered_set ButtonPressedMap; typedef std::map AxisStateMap; diff --git a/libraries/input-plugins/src/input-plugins/SixenseManager.cpp b/libraries/input-plugins/src/input-plugins/SixenseManager.cpp index 664f6e3658..87a373d1e7 100644 --- a/libraries/input-plugins/src/input-plugins/SixenseManager.cpp +++ b/libraries/input-plugins/src/input-plugins/SixenseManager.cpp @@ -69,7 +69,7 @@ SixenseManager::SixenseManager() : bool SixenseManager::isSupported() const { #ifdef HAVE_SIXENSE - return true; + return false; #else return false; #endif @@ -98,9 +98,9 @@ void SixenseManager::activate(PluginContainer* container) { } if (_sixenseLibrary->load()){ - qCDebug(interfaceapp) << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName(); + qCDebug(inputplugins) << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName(); } else { - qCDebug(interfaceapp) << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load." + qCDebug(inputplugins) << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load." << "Continuing without hydra support."; return; } diff --git a/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp b/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp index 0804378317..463f79bfd9 100644 --- a/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp +++ b/libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp @@ -17,14 +17,16 @@ #include #include #include -#include +#include #include "NumericalConstants.h" #include "UserActivityLogger.h" +#ifndef Q_OS_MAC extern vr::IVRSystem* _hmd; extern int hmdRefCount; extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount]; extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount]; +#endif const unsigned int LEFT_MASK = 0U; const unsigned int RIGHT_MASK = 1U; @@ -55,10 +57,15 @@ ViveControllerManager::ViveControllerManager() : } bool ViveControllerManager::isSupported() const { +#ifndef Q_OS_MAC return vr::VR_IsHmdPresent(); +#else + return false; +#endif } void ViveControllerManager::activate(PluginContainer* container) { +#ifndef Q_OS_MAC hmdRefCount++; if (!_hmd) { vr::HmdError eError = vr::HmdError_None; @@ -112,9 +119,11 @@ void ViveControllerManager::activate(PluginContainer* container) { _modelLoaded = true; } +#endif } void ViveControllerManager::deactivate() { +#ifndef Q_OS_MAC hmdRefCount--; if (hmdRefCount == 0 && _hmd) { @@ -122,6 +131,7 @@ void ViveControllerManager::deactivate() { _hmd = nullptr; } _poseStateMap.clear(); +#endif } void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) { @@ -187,12 +197,14 @@ void ViveControllerManager::renderHand(UserInputMapper::PoseValue pose, gpu::Bat } void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { +#ifndef Q_OS_MAC _poseStateMap.clear(); // TODO: This shouldn't be necessary if (!_hmd) { return; } - + return; + _buttonPressedMap.clear(); PerformanceTimer perfTimer("ViveControllerManager::update"); @@ -252,6 +264,7 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { } _trackedControllers = numTrackedControllers; +#endif } void ViveControllerManager::focusOutEvent() { diff --git a/libraries/input-plugins/src/input-plugins/ViveControllerManager.h b/libraries/input-plugins/src/input-plugins/ViveControllerManager.h index 4b132e4961..859fc2ab84 100644 --- a/libraries/input-plugins/src/input-plugins/ViveControllerManager.h +++ b/libraries/input-plugins/src/input-plugins/ViveControllerManager.h @@ -92,5 +92,4 @@ private: static const QString NAME; }; - #endif // hifi__ViveControllerManager diff --git a/libraries/render-utils/src/OglplusHelpers.cpp b/libraries/render-utils/src/OglplusHelpers.cpp index fc1db968ff..798b2565fe 100644 --- a/libraries/render-utils/src/OglplusHelpers.cpp +++ b/libraries/render-utils/src/OglplusHelpers.cpp @@ -6,6 +6,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "OglplusHelpers.h" +#include using namespace oglplus; using namespace oglplus::shapes; @@ -49,7 +50,7 @@ ProgramPtr loadDefaultShader() { void compileProgram(ProgramPtr & result, const std::string& vs, const std::string& fs) { using namespace oglplus; try { - result = QSharedPointer::create(); + result = std::make_shared(); // attach the shaders to the program result->AttachShader( VertexShader()