mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-25 13:31:10 +00:00
commit
c623bf1399
3 changed files with 39 additions and 32 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
//#if __ANDROID__
|
//#if __ANDROID__
|
||||||
|
|
||||||
#include "../qcommon/q_shared.h"
|
|
||||||
#include "../qcommon/qcommon.h"
|
#include "../qcommon/qcommon.h"
|
||||||
#include "../client/keycodes.h"
|
#include "../client/keycodes.h"
|
||||||
#include "../client/client.h"
|
#include "../client/client.h"
|
||||||
|
@ -1329,37 +1328,6 @@ void IN_VRInputFrame( void )
|
||||||
//trigger frame tick for haptics
|
//trigger frame tick for haptics
|
||||||
VR_HapticEvent("frame_tick", 0, 0, 0, 0, 0);
|
VR_HapticEvent("frame_tick", 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
{
|
|
||||||
// We extract Yaw, Pitch, Roll instead of directly using the orientation
|
|
||||||
// to allow "additional" yaw manipulation with mouse/controller.
|
|
||||||
XrSpaceLocation loc = {};
|
|
||||||
loc.type = XR_TYPE_SPACE_LOCATION;
|
|
||||||
OXR(xrLocateSpace(VR_GetEngine()->appState.HeadSpace, VR_GetEngine()->appState.CurrentSpace, VR_GetEngine()->predictedDisplayTime, &loc));
|
|
||||||
XrPosef xfStageFromHead = loc.pose;
|
|
||||||
const XrQuaternionf quatHmd = xfStageFromHead.orientation;
|
|
||||||
const XrVector3f positionHmd = xfStageFromHead.position;
|
|
||||||
vec3_t rotation = {0, 0, 0};
|
|
||||||
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation);
|
|
||||||
VectorSet(vr.hmdposition, positionHmd.x, positionHmd.y + vr_heightAdjust->value, positionHmd.z);
|
|
||||||
|
|
||||||
//Position
|
|
||||||
VectorSubtract(vr.hmdposition_last, vr.hmdposition, vr.hmdposition_delta);
|
|
||||||
|
|
||||||
//Keep this for our records
|
|
||||||
VectorCopy(vr.hmdposition, vr.hmdposition_last);
|
|
||||||
|
|
||||||
//Orientation
|
|
||||||
VectorSubtract(vr.hmdorientation_last, vr.hmdorientation, vr.hmdorientation_delta);
|
|
||||||
|
|
||||||
//Keep this for our records
|
|
||||||
VectorCopy(vr.hmdorientation, vr.hmdorientation_last);
|
|
||||||
|
|
||||||
// View yaw delta
|
|
||||||
const float clientview_yaw = vr.clientviewangles[YAW] - vr.hmdorientation[YAW];
|
|
||||||
vr.clientview_yaw_delta = vr.clientview_yaw_last - clientview_yaw;
|
|
||||||
vr.clientview_yaw_last = clientview_yaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (leftControllerAimSpace == XR_NULL_HANDLE) {
|
if (leftControllerAimSpace == XR_NULL_HANDLE) {
|
||||||
leftControllerAimSpace = CreateActionSpace(aimPoseAction, leftHandPath);
|
leftControllerAimSpace = CreateActionSpace(aimPoseAction, leftHandPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#ifndef __VR_INPUT_H
|
#ifndef __VR_INPUT_H
|
||||||
#define __VR_INPUT_H
|
#define __VR_INPUT_H
|
||||||
|
|
||||||
|
#include "../qcommon/q_shared.h"
|
||||||
|
#include "vr_types.h"
|
||||||
|
|
||||||
#if __ANDROID__
|
#if __ANDROID__
|
||||||
|
|
||||||
void IN_VRInputFrame( void );
|
void IN_VRInputFrame( void );
|
||||||
void IN_VRInit( void );
|
void IN_VRInit( void );
|
||||||
|
|
||||||
|
void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../client/client.h"
|
#include "../client/client.h"
|
||||||
|
|
||||||
#include "vr_clientinfo.h"
|
#include "vr_clientinfo.h"
|
||||||
|
#include "vr_input.h"
|
||||||
#include "vr_types.h"
|
#include "vr_types.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern vr_clientinfo_t vr;
|
extern vr_clientinfo_t vr;
|
||||||
|
extern cvar_t *vr_heightAdjust;
|
||||||
|
|
||||||
XrView* projections;
|
XrView* projections;
|
||||||
|
|
||||||
|
@ -364,6 +366,38 @@ void VR_DrawFrame( engine_t* engine ) {
|
||||||
OXR(xrLocateSpace(
|
OXR(xrLocateSpace(
|
||||||
engine->appState.HeadSpace, engine->appState.LocalSpace, frameState.predictedDisplayTime, &loc));
|
engine->appState.HeadSpace, engine->appState.LocalSpace, frameState.predictedDisplayTime, &loc));
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
// We extract Yaw, Pitch, Roll instead of directly using the orientation
|
||||||
|
// to allow "additional" yaw manipulation with mouse/controller.
|
||||||
|
XrSpaceLocation loc = {};
|
||||||
|
loc.type = XR_TYPE_SPACE_LOCATION;
|
||||||
|
OXR(xrLocateSpace(engine->appState.HeadSpace, engine->appState.CurrentSpace, frameState.predictedDisplayTime, &loc));
|
||||||
|
XrPosef xfStageFromHead = loc.pose;
|
||||||
|
const XrQuaternionf quatHmd = xfStageFromHead.orientation;
|
||||||
|
const XrVector3f positionHmd = xfStageFromHead.position;
|
||||||
|
vec3_t rotation = {0, 0, 0};
|
||||||
|
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation);
|
||||||
|
VectorSet(vr.hmdposition, positionHmd.x, positionHmd.y + vr_heightAdjust->value, positionHmd.z);
|
||||||
|
|
||||||
|
//Position
|
||||||
|
VectorSubtract(vr.hmdposition_last, vr.hmdposition, vr.hmdposition_delta);
|
||||||
|
|
||||||
|
//Keep this for our records
|
||||||
|
VectorCopy(vr.hmdposition, vr.hmdposition_last);
|
||||||
|
|
||||||
|
//Orientation
|
||||||
|
VectorSubtract(vr.hmdorientation_last, vr.hmdorientation, vr.hmdorientation_delta);
|
||||||
|
|
||||||
|
//Keep this for our records
|
||||||
|
VectorCopy(vr.hmdorientation, vr.hmdorientation_last);
|
||||||
|
|
||||||
|
// View yaw delta
|
||||||
|
const float clientview_yaw = vr.clientviewangles[YAW] - vr.hmdorientation[YAW];
|
||||||
|
vr.clientview_yaw_delta = vr.clientview_yaw_last - clientview_yaw;
|
||||||
|
vr.clientview_yaw_last = clientview_yaw;
|
||||||
|
}
|
||||||
|
|
||||||
XrViewLocateInfo projectionInfo = {};
|
XrViewLocateInfo projectionInfo = {};
|
||||||
projectionInfo.type = XR_TYPE_VIEW_LOCATE_INFO;
|
projectionInfo.type = XR_TYPE_VIEW_LOCATE_INFO;
|
||||||
projectionInfo.viewConfigurationType = engine->appState.ViewportConfig.viewConfigurationType;
|
projectionInfo.viewConfigurationType = engine->appState.ViewportConfig.viewConfigurationType;
|
||||||
|
|
Loading…
Reference in a new issue