mirror of
https://github.com/overte-org/overte.git
synced 2025-07-28 05:39:38 +02:00
Bad merge fix, PR feedback
This commit is contained in:
parent
2ecc4f8a5c
commit
07be03dc7e
2 changed files with 10 additions and 21 deletions
|
@ -147,14 +147,14 @@ void SixenseManager::InputDevice::update(float deltaTime, bool jointsCaptured) {
|
||||||
int maxControllers = sixenseGetMaxControllers();
|
int maxControllers = sixenseGetMaxControllers();
|
||||||
|
|
||||||
// we only support two controllers
|
// we only support two controllers
|
||||||
sixenseControllerData controllers[2];
|
SixenseControllerData controllers[2];
|
||||||
|
|
||||||
int numActiveControllers = 0;
|
int numActiveControllers = 0;
|
||||||
for (int i = 0; i < maxControllers && numActiveControllers < 2; i++) {
|
for (int i = 0; i < maxControllers && numActiveControllers < 2; i++) {
|
||||||
if (!sixenseIsControllerEnabled(i)) {
|
if (!sixenseIsControllerEnabled(i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sixenseControllerData* data = controllers + numActiveControllers;
|
SixenseControllerData* data = controllers + numActiveControllers;
|
||||||
++numActiveControllers;
|
++numActiveControllers;
|
||||||
sixenseGetNewestData(i, data);
|
sixenseGetNewestData(i, data);
|
||||||
|
|
||||||
|
@ -215,21 +215,21 @@ static const float MINIMUM_ARM_REACH = 0.3f; // meters
|
||||||
static const float MAXIMUM_NOISE_LEVEL = 0.05f; // meters
|
static const float MAXIMUM_NOISE_LEVEL = 0.05f; // meters
|
||||||
static const quint64 LOCK_DURATION = USECS_PER_SECOND / 4; // time for lock to be acquired
|
static const quint64 LOCK_DURATION = USECS_PER_SECOND / 4; // time for lock to be acquired
|
||||||
|
|
||||||
static bool calibrationRequested(sixenseControllerData* controllers) {
|
static bool calibrationRequested(SixenseControllerData* controllers) {
|
||||||
return (controllers[0].buttons == BUTTON_FWD && controllers[1].buttons == BUTTON_FWD);
|
return (controllers[0].buttons == BUTTON_FWD && controllers[1].buttons == BUTTON_FWD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SixenseManager::InputDevice::updateCalibration(sixenseControllerData* controllers) {
|
void SixenseManager::InputDevice::updateCalibration(SixenseControllerData* controllers) {
|
||||||
const sixenseControllerData* dataLeft = controllers;
|
const SixenseControllerData* dataLeft = controllers;
|
||||||
const sixenseControllerData* dataRight = controllers + 1;
|
const SixenseControllerData* dataRight = controllers + 1;
|
||||||
|
|
||||||
// Calibration buttons aren't set, so check the state, and request a reset if necessary.
|
// Calibration buttons aren't set, so check the state, and request a reset if necessary.
|
||||||
if (!calibrationRequested(controllers)) {
|
if (!calibrationRequested(controllers)) {
|
||||||
switch (_calibrationState) {
|
switch (_calibrationState) {
|
||||||
case CALIBRATION_STATE_IDLE:
|
case CALIBRATION_STATE_IDLE:
|
||||||
return;
|
return;
|
||||||
case CALIBRATION_STATE_COMPLETE:
|
|
||||||
{
|
case CALIBRATION_STATE_COMPLETE: {
|
||||||
// compute calibration results
|
// compute calibration results
|
||||||
_avatarPosition = -0.5f * (_reachLeft + _reachRight); // neck is midway between right and left hands
|
_avatarPosition = -0.5f * (_reachLeft + _reachRight); // neck is midway between right and left hands
|
||||||
glm::vec3 xAxis = glm::normalize(_reachRight - _reachLeft);
|
glm::vec3 xAxis = glm::normalize(_reachRight - _reachLeft);
|
||||||
|
|
|
@ -19,19 +19,8 @@
|
||||||
|
|
||||||
#include "InputPlugin.h"
|
#include "InputPlugin.h"
|
||||||
|
|
||||||
class QLibrary;
|
|
||||||
|
|
||||||
const unsigned int BUTTON_0 = 1U << 0; // the skinny button between 1 and 2
|
|
||||||
const unsigned int BUTTON_1 = 1U << 5;
|
|
||||||
const unsigned int BUTTON_2 = 1U << 6;
|
|
||||||
const unsigned int BUTTON_3 = 1U << 3;
|
|
||||||
const unsigned int BUTTON_4 = 1U << 4;
|
|
||||||
const unsigned int BUTTON_FWD = 1U << 7;
|
|
||||||
const unsigned int BUTTON_TRIGGER = 1U << 8;
|
|
||||||
|
|
||||||
const bool DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS = false;
|
|
||||||
|
|
||||||
struct _sixenseControllerData;
|
struct _sixenseControllerData;
|
||||||
|
using SixenseControllerData = _sixenseControllerData;
|
||||||
|
|
||||||
// Handles interaction with the Sixense SDK (e.g., Razer Hydra).
|
// Handles interaction with the Sixense SDK (e.g., Razer Hydra).
|
||||||
class SixenseManager : public InputPlugin {
|
class SixenseManager : public InputPlugin {
|
||||||
|
@ -80,7 +69,7 @@ private:
|
||||||
|
|
||||||
void handleButtonEvent(unsigned int buttons, bool left);
|
void handleButtonEvent(unsigned int buttons, bool left);
|
||||||
void handlePoseEvent(float deltaTime, glm::vec3 position, glm::quat rotation, bool left);
|
void handlePoseEvent(float deltaTime, glm::vec3 position, glm::quat rotation, bool left);
|
||||||
void updateCalibration(_sixenseControllerData* controllers);
|
void updateCalibration(SixenseControllerData* controllers);
|
||||||
|
|
||||||
friend class SixenseManager;
|
friend class SixenseManager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue