mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
moved controllers to input-plugins, they work now
This commit is contained in:
parent
e54060d6bb
commit
0333adb95b
4 changed files with 17 additions and 16 deletions
|
@ -64,7 +64,6 @@
|
|||
#include <DeferredLightingEffect.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <display-plugins/DisplayPlugin.h>
|
||||
#include <display-plugins/openvr/ViveControllerManager.h>
|
||||
#include <EntityScriptingInterface.h>
|
||||
#include <ErrorDialog.h>
|
||||
#include <GlowEffect.h>
|
||||
|
@ -124,6 +123,7 @@
|
|||
#include "devices/RealSense.h"
|
||||
#include "devices/SDL2Manager.h"
|
||||
#include "devices/MIDIManager.h"
|
||||
#include <input-plugins/ViveControllerManager.h>
|
||||
#include "RenderDeferredTask.h"
|
||||
#include "scripting/AccountScriptingInterface.h"
|
||||
#include "scripting/AudioDeviceScriptingInterface.h"
|
||||
|
|
|
@ -29,10 +29,10 @@ const QString & OpenVrDisplayPlugin::getName() const {
|
|||
return NAME;
|
||||
}
|
||||
|
||||
static vr::IVRSystem *_hmd{ nullptr };
|
||||
vr::IVRSystem *_hmd{ nullptr };
|
||||
static vr::IVRCompositor* _compositor{ nullptr };
|
||||
static vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||
static mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount];
|
||||
vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||
mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount];
|
||||
static uvec2 _windowSize;
|
||||
static ivec2 _windowPosition;
|
||||
static uvec2 _renderTargetSize;
|
||||
|
@ -158,7 +158,9 @@ void OpenVrDisplayPlugin::finishFrame() {
|
|||
// swapBuffers();
|
||||
doneCurrent();
|
||||
_compositor->WaitGetPoses(_trackedDevicePose, vr::k_unMaxTrackedDeviceCount);
|
||||
_trackedDevicePoseMat4[0] = toGlm(_trackedDevicePose[0].mDeviceToAbsoluteTracking);
|
||||
for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) {
|
||||
_trackedDevicePoseMat4[i] = toGlm(_trackedDevicePose[i].mDeviceToAbsoluteTracking);
|
||||
}
|
||||
openvr_for_each_eye([&](vr::Hmd_Eye eye) {
|
||||
_eyesData[eye]._pose = _trackedDevicePoseMat4[0];
|
||||
});
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
|
||||
#include "ViveControllerManager.h"
|
||||
|
||||
#include <avatar/AvatarManager.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
#include "OpenVrDisplayPlugin.h"
|
||||
#include "OpenVrHelpers.h"
|
||||
//#include <display-plugins\openvr\OpenVrDisplayPlugin.h>
|
||||
#include <display-plugins\openvr\OpenVrHelpers.h>
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
extern vr::IVRSystem *_hmd;
|
||||
|
@ -74,14 +73,14 @@ void ViveControllerManager::update() {
|
|||
}
|
||||
|
||||
const mat4& mat = _trackedDevicePoseMat4[unTrackedDevice];
|
||||
|
||||
|
||||
handlePoseEvent(mat, trackedControllerCount - 1);
|
||||
|
||||
// handle inputs
|
||||
vr::VRControllerState_t* controllerState;
|
||||
if(_hmd->GetControllerState(unTrackedDevice, controllerState)) {
|
||||
|
||||
}
|
||||
//vr::VRControllerState_t* controllerState;
|
||||
//if(_hmd->GetControllerState(unTrackedDevice, controllerState)) {
|
||||
//
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
@ -130,7 +129,7 @@ void ViveControllerManager::handleButtonEvent(unsigned int buttons, int index) {
|
|||
void ViveControllerManager::handlePoseEvent(const mat4& mat, int index) {
|
||||
glm::vec3 position(mat[3][0], mat[3][1], mat[3][2]);
|
||||
glm::quat rotation = glm::quat_cast(mat);
|
||||
rotation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)) * rotation;
|
||||
//rotation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)) * rotation;
|
||||
_poseStateMap[makeInput(JointChannel(index)).getChannel()] = UserInputMapper::PoseValue(position, rotation);
|
||||
}
|
||||
|
||||
|
@ -141,7 +140,7 @@ void ViveControllerManager::registerToUserInputMapper(UserInputMapper& mapper) {
|
|||
auto proxy = UserInputMapper::DeviceProxy::Pointer(new UserInputMapper::DeviceProxy("SteamVR Controller"));
|
||||
proxy->getButton = [this] (const UserInputMapper::Input& input, int timestamp) -> bool { return this->getButton(input.getChannel()); };
|
||||
proxy->getAxis = [this] (const UserInputMapper::Input& input, int timestamp) -> float { return this->getAxis(input.getChannel()); };
|
||||
proxy->getPose = [this] (const UserInputMapper::Input& input, int timestamp) -> UserInputMapper::PoseValue { return this->getPose(input.getChannel()); }
|
||||
proxy->getPose = [this](const UserInputMapper::Input& input, int timestamp) -> UserInputMapper::PoseValue { return this->getPose(input.getChannel()); };
|
||||
proxy->getAvailabeInputs = [this] () -> QVector<UserInputMapper::InputPair> {
|
||||
QVector<UserInputMapper::InputPair> availableInputs;
|
||||
// availableInputs.append(UserInputMapper::InputPair(makeInput(BUTTON_0, 0), "Left Start"));
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <GLMHelpers.h>
|
||||
|
||||
#include <input-plugins/UserInputMapper.h>
|
||||
#include "UserInputMapper.h"
|
||||
|
||||
class ViveControllerManager : public QObject {
|
||||
Q_OBJECT
|
Loading…
Reference in a new issue