Further fixes for OpenXR
This commit is contained in:
parent
a474b820e2
commit
77c3cf4e10
7 changed files with 61 additions and 25 deletions
|
@ -131,6 +131,9 @@ void
|
|||
CSQC_RenderScene(void)
|
||||
{
|
||||
renderscene();
|
||||
|
||||
if (XR_Available(pSeat->m_ePlayer))
|
||||
renderscene(); /* render it twice, for the normal window */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -211,8 +211,8 @@ View_DrawViewModel(void)
|
|||
m_eViewModel.origin = pl.m_xrInputRight.GetOrigin();
|
||||
|
||||
if (XR_Available(pl)) {
|
||||
m_eViewModel.angles = pl.m_xrInputLeft.GetAngles();
|
||||
m_eViewModelL.angles = pl.m_xrInputRight.GetAngles();
|
||||
m_eViewModel.angles = pl.m_xrInputRight.GetAngles();
|
||||
m_eViewModelL.angles = pl.m_xrInputLeft.GetAngles();
|
||||
} else {
|
||||
/* we only calculate bob on the right model, to avoid double speed bobbing */
|
||||
Viewmodel_CalcBob();
|
||||
|
|
|
@ -204,7 +204,7 @@ base_player::ClientInputFrame(void)
|
|||
/* some input overrides for XR */
|
||||
if (XR_Available(this)) {
|
||||
if (pSeat->m_bMoveForward) {
|
||||
input_movevalues[0] = cvar("cl_forwardspeed");
|
||||
input_movevalues[0] = 100;
|
||||
}
|
||||
|
||||
if (pSeat->m_iInputAttack) {
|
||||
|
|
|
@ -350,8 +350,12 @@ base_player::Physics_Run(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
m_xrSpace.SetOrigin(origin + view_ofs);
|
||||
m_xrSpace.SetAngles(angles);
|
||||
if (XR_Available(this)) {
|
||||
m_xrSpace.SetOrigin(origin);
|
||||
m_xrSpace.SetAngles(input_angles);
|
||||
} else {
|
||||
m_xrSpace.SetOrigin(origin + view_ofs);
|
||||
m_xrSpace.SetAngles(input_angles);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@ NSXRInput::GetAngles(void)
|
|||
return [0,0,0];
|
||||
}
|
||||
|
||||
return m_xrSpace.RoomToWorldAngles(m_vecAngles);
|
||||
if (m_inputType != XR_INPUT_HEAD)
|
||||
return m_xrSpace.RoomToWorldAngles(m_vecAngles);
|
||||
|
||||
/* head only cares about reporting yaw right now */
|
||||
return m_xrSpace.RoomToWorldAngles([0, m_vecAngles[1], 0]);
|
||||
}
|
||||
|
||||
vector
|
||||
|
@ -71,27 +75,40 @@ NSXRInput::InputFrame(void)
|
|||
{
|
||||
switch (m_inputType) {
|
||||
case XR_INPUT_HEAD:
|
||||
m_vecOrigin = input_head_origin;
|
||||
m_vecAngles = input_head_angles;
|
||||
m_vecVelocity = input_head_velocity;
|
||||
m_vecAVelocity = input_head_avelocity;
|
||||
m_iStatus = input_head_status;
|
||||
|
||||
if (m_iStatus & XR_STATUS_ORG)
|
||||
m_vecOrigin = input_head_origin;
|
||||
if (m_iStatus & XR_STATUS_ANG)
|
||||
m_vecAngles = input_head_angles;
|
||||
if (m_iStatus & XR_STATUS_VEL)
|
||||
m_vecVelocity = input_head_velocity;
|
||||
if (m_iStatus & XR_STATUS_AVEL)
|
||||
m_vecAVelocity = input_head_avelocity;
|
||||
m_iWeapon = input_head_weapon;
|
||||
break;
|
||||
case XR_INPUT_LEFT:
|
||||
m_vecOrigin = input_left_origin;
|
||||
m_vecAngles = input_left_angles;
|
||||
m_vecVelocity = input_left_velocity;
|
||||
m_vecAVelocity = input_left_avelocity;
|
||||
m_iStatus = input_left_status;
|
||||
if (m_iStatus & XR_STATUS_ORG)
|
||||
m_vecOrigin = input_left_origin;
|
||||
if (m_iStatus & XR_STATUS_ANG)
|
||||
m_vecAngles = input_left_angles;
|
||||
if (m_iStatus & XR_STATUS_VEL)
|
||||
m_vecVelocity = input_left_velocity;
|
||||
if (m_iStatus & XR_STATUS_AVEL)
|
||||
m_vecAVelocity = input_left_avelocity;
|
||||
m_iWeapon = input_left_weapon;
|
||||
break;
|
||||
case XR_INPUT_RIGHT:
|
||||
m_vecOrigin = input_right_origin;
|
||||
m_vecAngles = input_right_angles;
|
||||
m_vecVelocity = input_right_velocity;
|
||||
m_vecAVelocity = input_right_avelocity;
|
||||
m_iStatus = input_right_status;
|
||||
if (m_iStatus & XR_STATUS_ORG)
|
||||
m_vecOrigin = input_right_origin;
|
||||
if (m_iStatus & XR_STATUS_ANG)
|
||||
m_vecAngles = input_right_angles;
|
||||
if (m_iStatus & XR_STATUS_VEL)
|
||||
m_vecVelocity = input_right_velocity;
|
||||
if (m_iStatus & XR_STATUS_AVEL)
|
||||
m_vecAVelocity = input_right_avelocity;
|
||||
m_iWeapon = input_right_weapon;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -21,4 +21,7 @@ void XR_InputFrame(entity);
|
|||
|
||||
#ifdef CLIENT
|
||||
void XR_UpdateView(entity);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
var float autocvar_xr_roomscale = 1.0f;
|
||||
var float autocvar_xr_viewheight = -48.0f;
|
19
src/xr/xr.qc
19
src/xr/xr.qc
|
@ -68,12 +68,20 @@ XR_UpdateView(entity ePlayer)
|
|||
return;
|
||||
|
||||
/* update our space */
|
||||
pl.m_xrSpace.SetOrigin(pSeat->m_vecPredictedOrigin + pSeat->m_ePlayer.view_ofs);
|
||||
pl.m_xrSpace.SetAngles(input_angles);
|
||||
if (XR_Available(ePlayer)) {
|
||||
pl.m_xrSpace.SetOrigin(pSeat->m_vecPredictedOrigin);
|
||||
pl.m_xrSpace.SetAngles(view_angles);
|
||||
|
||||
/* now we get the HMD's org/ang and send that off to the renderer */
|
||||
setviewprop(VF_ANGLES, pl.m_xrInputHead.GetAngles());
|
||||
setviewprop(VF_ORIGIN, pl.m_xrInputHead.GetOrigin());
|
||||
/* now we get the HMD's org/ang and send that off to the renderer */
|
||||
setviewprop(VF_ANGLES, pl.m_xrInputHead.GetAngles());
|
||||
setviewprop(VF_ORIGIN, pl.m_xrInputHead.GetOrigin() + [0,0,autocvar_xr_viewheight]);
|
||||
} else {
|
||||
pl.m_xrSpace.SetOrigin(pSeat->m_vecPredictedOrigin + pSeat->m_ePlayer.view_ofs);
|
||||
pl.m_xrSpace.SetAngles(input_angles);
|
||||
|
||||
setviewprop(VF_ANGLES, pl.m_xrInputHead.GetAngles());
|
||||
setviewprop(VF_ORIGIN, pl.m_xrInputHead.GetOrigin());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -104,6 +112,7 @@ XR_InputFrame(entity ePlayer)
|
|||
pl.m_xrInputHead.InputFrame();
|
||||
pl.m_xrInputLeft.InputFrame();
|
||||
pl.m_xrInputRight.InputFrame();
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue