mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Ensure projection works on Meta Quest
Also fixed emplaced guns exiting by gesture use
This commit is contained in:
parent
4b1e010ca0
commit
9bda989514
7 changed files with 27 additions and 12 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.jkquest"
|
||||
android:versionCode="31"
|
||||
android:versionName="0.5.0" android:installLocation="auto" >
|
||||
android:versionCode="32"
|
||||
android:versionName="0.5.1" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
|
|
@ -2109,7 +2109,7 @@ void VR_ClearFrameBuffer( int width, int height)
|
|||
glViewport( 0, 0, width, height );
|
||||
|
||||
//Black
|
||||
glClearColor( 1.0f, 0.0f, 0.0f, 1.0f );
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
glScissor( 0, 0, width, height );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
@ -2134,13 +2134,30 @@ bool JKVR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
|||
{
|
||||
if (!vr.cgzoommode)
|
||||
{
|
||||
#ifdef PICO_XR
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
gAppState.Projections[eye].fov, zNear, zFar);
|
||||
#endif
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrFovf fov = {};
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||
fov.angleLeft += gAppState.Projections[eye].fov.angleLeft / 2.0f;
|
||||
fov.angleRight += gAppState.Projections[eye].fov.angleRight / 2.0f;
|
||||
fov.angleUp += gAppState.Projections[eye].fov.angleUp / 2.0f;
|
||||
fov.angleDown += gAppState.Projections[eye].fov.angleDown / 2.0f;
|
||||
}
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
fov, zNear, zFar);
|
||||
#endif
|
||||
|
||||
memcpy(projection, gAppState.ProjectionMatrices[eye].m, 16 * sizeof(float));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ typedef struct {
|
|||
|
||||
bool misc_camera; // looking through a misc camera view entity
|
||||
bool remote_turret; // controlling a remote turret
|
||||
bool emplaced_gun; // controlling an emplaced gun
|
||||
bool remote_droid; // controlling a remote droid
|
||||
bool remote_npc; // controlling a remote NPC (will also be true when controlling a droid)
|
||||
|
||||
|
|
|
@ -836,19 +836,16 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
// Process "use" gesture
|
||||
if (vr_gesture_triggered_use->integer) {
|
||||
float distanceToBody;
|
||||
bool controllerTracked;
|
||||
if (vr_gesture_triggered_use->integer == 1) {
|
||||
// Gesture with off-hand
|
||||
distanceToBody = sqrt(vr.offhandoffset[0]*vr.offhandoffset[0] + vr.offhandoffset[2]*vr.offhandoffset[2]);
|
||||
controllerTracked = pOffTracking->Status & VRAPI_TRACKING_STATUS_POSITION_TRACKED;
|
||||
} else {
|
||||
// Gesture with dominant-hand
|
||||
distanceToBody = sqrt(vr.weaponoffset[0]*vr.weaponoffset[0] + vr.weaponoffset[2]*vr.weaponoffset[2]);
|
||||
controllerTracked = pDominantTracking->Status & VRAPI_TRACKING_STATUS_POSITION_TRACKED;
|
||||
}
|
||||
float boundary = vr_use_gesture_boundary->value;
|
||||
bool gestureUseAllowed = !vr.weapon_stabilised && !vr.cin_camera && !vr.misc_camera && !vr.remote_turret;
|
||||
if (gestureUseAllowed && controllerTracked && distanceToBody > boundary) {
|
||||
|
||||
bool gestureUseAllowed = !vr.weapon_stabilised && !vr.cin_camera && !vr.misc_camera && !vr.remote_turret && !vr.emplaced_gun;
|
||||
if (gestureUseAllowed && distanceToBody > vr_use_gesture_boundary->value) {
|
||||
if (!vr.useGestureActive) {
|
||||
vr.useGestureActive = true;
|
||||
sendButtonAction("+use", true);
|
||||
|
|
|
@ -2936,6 +2936,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
vr->remote_npc = !Q_stricmp( "NPC", g_entities[cg.snap->ps.viewEntity].classname );
|
||||
vr->remote_droid = false;
|
||||
vr->remote_turret = false;
|
||||
vr->emplaced_gun = ( cg_entities[cg.snap->ps.clientNum].currentState.eFlags & EF_LOCKED_TO_WEAPON );
|
||||
in_misccamera = false;
|
||||
|
||||
if (cg.snap->ps.viewEntity) {
|
||||
|
@ -2957,7 +2958,6 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
|| vr->remote_droid
|
||||
|| vr->remote_turret;
|
||||
}
|
||||
bool emplaced_gun = ( cg_entities[cg.snap->ps.clientNum].currentState.eFlags & EF_LOCKED_TO_WEAPON );
|
||||
|
||||
cg.refdef.worldscale = cg_worldScale.value;
|
||||
|
||||
|
@ -3008,7 +3008,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
}
|
||||
|
||||
//Immersive cinematic sequence 6DoF
|
||||
if ((in_camera && vr->immersive_cinematics) || emplaced_gun || cg.renderingThirdPerson)
|
||||
if ((in_camera && vr->immersive_cinematics) || vr->emplaced_gun || cg.renderingThirdPerson)
|
||||
{
|
||||
BG_ConvertFromVR(vr->hmdposition_offset, cg.refdef.vieworg, cg.refdef.vieworg);
|
||||
}
|
||||
|
@ -3027,7 +3027,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
cgi_R_LAGoggles();
|
||||
}
|
||||
|
||||
if (!emplaced_gun && !in_misccamera && !in_camera) {
|
||||
if (!vr->emplaced_gun && !in_misccamera && !in_camera) {
|
||||
//Vertical Positional Movement
|
||||
cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT;
|
||||
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue