mirror of https://github.com/bjornbytes/lovr.git
rm DEVICE_HAND;
If we expose both unhanded hands and handed hands, people need to deal with handling (haha) both cases in their apps. It's simpler to always deal with left and right hands, even though it is a bit less general. Still, this is congruent with the current state of OpenVR and OpenXR, and I think there are still open questions about the more uncommon cases where there are more than two hands.
This commit is contained in:
parent
fe559903e1
commit
af0678f9e9
|
@ -28,7 +28,6 @@ const char* HeadsetOrigins[] = {
|
|||
|
||||
const char* Devices[] = {
|
||||
[DEVICE_HEAD] = "head",
|
||||
[DEVICE_HAND] = "hand",
|
||||
[DEVICE_HAND_LEFT] = "hand/left",
|
||||
[DEVICE_HAND_RIGHT] = "hand/right",
|
||||
[DEVICE_EYE_LEFT] = "eye/left",
|
||||
|
@ -539,7 +538,6 @@ static int deviceIterator(lua_State* L) {
|
|||
}
|
||||
|
||||
static Device hands[] = {
|
||||
DEVICE_HAND,
|
||||
DEVICE_HAND_LEFT,
|
||||
DEVICE_HAND_RIGHT
|
||||
};
|
||||
|
|
|
@ -75,11 +75,11 @@ static const float* desktop_getBoundsGeometry(uint32_t* count) {
|
|||
}
|
||||
|
||||
static bool desktop_getPose(Device device, vec3 position, quat orientation) {
|
||||
if (device != DEVICE_HEAD && device != DEVICE_HAND) {
|
||||
if (device != DEVICE_HEAD && device != DEVICE_HAND_LEFT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vec3_set(position, 0.f, 0.f, device == DEVICE_HAND ? -.75f : 0.f);
|
||||
vec3_set(position, 0.f, 0.f, device == DEVICE_HAND_LEFT ? -.75f : 0.f);
|
||||
mat4_transform(state.transform, position);
|
||||
quat_fromMat4(orientation, state.transform);
|
||||
return true;
|
||||
|
@ -110,7 +110,7 @@ static bool desktop_getAcceleration(Device device, vec3 acceleration, vec3 angul
|
|||
}
|
||||
|
||||
static bool desktop_isDown(Device device, DeviceButton button, bool* down) {
|
||||
if (device != DEVICE_HAND || button != BUTTON_TRIGGER) {
|
||||
if (device != DEVICE_HAND_LEFT || button != BUTTON_TRIGGER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
DEVICE_HEAD,
|
||||
DEVICE_HAND,
|
||||
DEVICE_HAND_LEFT,
|
||||
DEVICE_HAND_RIGHT,
|
||||
DEVICE_EYE_LEFT,
|
||||
|
|
|
@ -438,8 +438,6 @@ void bridgeLovrUpdate(BridgeLovrUpdateData *updateData) {
|
|||
// Unpack update data
|
||||
bridgeLovrMobileData.updateData = *updateData;
|
||||
|
||||
// for(int c = 0; c < updateData->controllerCount; c++) lovrLog("%d: d %x t %x\n", c, (uint32_t)updateData->controllers[c].buttonDown, (uint32_t)updateData->controllers[c].buttonTouch);
|
||||
|
||||
if (pauseState == PAUSESTATE_BUG) { // Bad frame-- replace bad time with last known good oculus time
|
||||
bridgeLovrMobileData.updateData.displayTime = lastPauseAtRaw;
|
||||
pauseState = PAUSESTATE_RESUME;
|
||||
|
|
|
@ -94,7 +94,6 @@ static struct {
|
|||
static TrackedDeviceIndex_t getDeviceIndex(Device device) {
|
||||
switch (device) {
|
||||
case DEVICE_HEAD: return HEADSET;
|
||||
case DEVICE_HAND: return INVALID_DEVICE;
|
||||
case DEVICE_HAND_LEFT: return state.system->GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole_TrackedControllerRole_LeftHand);
|
||||
case DEVICE_HAND_RIGHT: return state.system->GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole_TrackedControllerRole_RightHand);
|
||||
case DEVICE_TRACKER_1:
|
||||
|
|
|
@ -10,15 +10,16 @@ var LibraryLOVR = {
|
|||
refreshGamepads: function(event) {
|
||||
if (event.gamepad.hand) {
|
||||
var device = ({
|
||||
'': C.DEVICE_HAND,
|
||||
'left': C.DEVICE_HAND_LEFT,
|
||||
'right': C.DEVICE_HAND_RIGHT
|
||||
})[event.gamepad.hand];
|
||||
|
||||
if (device) {
|
||||
webvr.gamepads[device] = event.gamepad;
|
||||
webvr.poses[device] = event.gamepad.pose;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
webvr_init: function(offset, msaa) {
|
||||
|
|
Loading…
Reference in New Issue