mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:57:26 +02:00
PR feedback
This commit is contained in:
parent
7c433f47c0
commit
bf70ae4724
7 changed files with 38 additions and 15 deletions
11
libraries/display-plugins/src/display-plugins/Logging.cpp
Normal file
11
libraries/display-plugins/src/display-plugins/Logging.cpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis 2015/10/11
|
||||||
|
// Copyright 2015 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 "Logging.h"
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(displayPlugins, "hifi.plugins.display")
|
16
libraries/display-plugins/src/display-plugins/Logging.h
Normal file
16
libraries/display-plugins/src/display-plugins/Logging.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis 2015/10/11
|
||||||
|
// Copyright 2015 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_DisplayPlugins_Logging_h
|
||||||
|
#define hifi_DisplayPlugins_Logging_h
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(displayPlugins)
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,6 +14,8 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include "../Logging.h"
|
||||||
|
|
||||||
using Mutex = std::mutex;
|
using Mutex = std::mutex;
|
||||||
using Lock = std::unique_lock<Mutex>;
|
using Lock = std::unique_lock<Mutex>;
|
||||||
|
|
||||||
|
@ -28,13 +30,13 @@ vr::IVRSystem* acquireOpenVrSystem() {
|
||||||
if (hmdPresent) {
|
if (hmdPresent) {
|
||||||
Lock lock(mutex);
|
Lock lock(mutex);
|
||||||
if (!activeHmd) {
|
if (!activeHmd) {
|
||||||
qDebug() << "openvr: No vr::IVRSystem instance active, building";
|
qCDebug(displayPlugins) << "openvr: No vr::IVRSystem instance active, building";
|
||||||
vr::HmdError eError = vr::HmdError_None;
|
vr::HmdError eError = vr::HmdError_None;
|
||||||
activeHmd = vr::VR_Init(&eError);
|
activeHmd = vr::VR_Init(&eError);
|
||||||
qDebug() << "openvr display: HMD is " << activeHmd << " error is " << eError;
|
qCDebug(displayPlugins) << "openvr display: HMD is " << activeHmd << " error is " << eError;
|
||||||
}
|
}
|
||||||
if (activeHmd) {
|
if (activeHmd) {
|
||||||
qDebug() << "openvr: incrementing refcount";
|
qCDebug(displayPlugins) << "openvr: incrementing refcount";
|
||||||
++refCount;
|
++refCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,12 +64,6 @@ public:
|
||||||
TOUCH_BUTTON_PRESS = TOUCH_AXIS_Y_NEG + 1,
|
TOUCH_BUTTON_PRESS = TOUCH_AXIS_Y_NEG + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyboardMouseDevice() {}
|
|
||||||
|
|
||||||
virtual ~KeyboardMouseDevice() {}
|
|
||||||
|
|
||||||
controller::InputDevice::Pointer getInputDevice() { return _inputDevice; }
|
|
||||||
|
|
||||||
// Plugin functions
|
// Plugin functions
|
||||||
virtual bool isSupported() const override { return true; }
|
virtual bool isSupported() const override { return true; }
|
||||||
virtual bool isJointController() const override { return false; }
|
virtual bool isJointController() const override { return false; }
|
||||||
|
@ -116,6 +110,10 @@ protected:
|
||||||
friend class KeyboardMouseDevice;
|
friend class KeyboardMouseDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
const std::shared_ptr<InputDevice>& getInputDevice() const { return _inputDevice; }
|
||||||
|
|
||||||
|
protected:
|
||||||
QPoint _lastCursor;
|
QPoint _lastCursor;
|
||||||
QPoint _mousePressAt;
|
QPoint _mousePressAt;
|
||||||
glm::vec2 _lastTouch;
|
glm::vec2 _lastTouch;
|
||||||
|
|
|
@ -47,8 +47,6 @@ const bool DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS = false;
|
||||||
class SixenseManager : public InputPlugin {
|
class SixenseManager : public InputPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SixenseManager() {}
|
|
||||||
virtual ~SixenseManager() {}
|
|
||||||
|
|
||||||
// Plugin functions
|
// Plugin functions
|
||||||
virtual bool isSupported() const override;
|
virtual bool isSupported() const override;
|
||||||
|
|
|
@ -31,8 +31,6 @@ namespace vr {
|
||||||
class ViveControllerManager : public InputPlugin {
|
class ViveControllerManager : public InputPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ViveControllerManager() {}
|
|
||||||
virtual ~ViveControllerManager() {}
|
|
||||||
|
|
||||||
// Plugin functions
|
// Plugin functions
|
||||||
virtual bool isSupported() const override;
|
virtual bool isSupported() const override;
|
||||||
|
|
|
@ -132,7 +132,7 @@ int main(int argc, char** argv) {
|
||||||
inputPlugin->activate();
|
inputPlugin->activate();
|
||||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||||
if (name == KeyboardMouseDevice::NAME) {
|
if (name == KeyboardMouseDevice::NAME) {
|
||||||
userInputMapper->registerDevice(dynamic_cast<KeyboardMouseDevice*>(inputPlugin.get())->getInputDevice());
|
userInputMapper->registerDevice(std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin)->getInputDevice());
|
||||||
}
|
}
|
||||||
inputPlugin->pluginUpdate(0, false);
|
inputPlugin->pluginUpdate(0, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue