mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-22 04:01:33 +00:00
some hacking to try to make immersive cutscenes better
not great so far
This commit is contained in:
parent
2538e8df30
commit
93f18988d4
4 changed files with 57 additions and 24 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="33"
|
||||
android:versionName="0.5.2" android:installLocation="auto" >
|
||||
android:versionCode="34"
|
||||
android:versionName="0.5.3" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
|
|
@ -173,13 +173,16 @@ void VR_SetHMDPosition(float x, float y, float z )
|
|||
|
||||
VectorSet(vr.hmdposition, x, y, z);
|
||||
|
||||
if (s_useScreen != VR_UseScreenLayer())
|
||||
//Can be set elsewhere
|
||||
vr.take_snap |= s_useScreen != VR_UseScreenLayer();
|
||||
if (vr.take_snap)
|
||||
{
|
||||
s_useScreen = VR_UseScreenLayer();
|
||||
|
||||
//Record player position on transition
|
||||
VectorSet(vr.hmdposition_snap, x, y, z);
|
||||
VectorCopy(vr.hmdorientation, vr.hmdorientation_snap);
|
||||
vr.take_snap = false;
|
||||
}
|
||||
|
||||
VectorSubtract(vr.hmdposition, vr.hmdposition_snap, vr.hmdposition_offset);
|
||||
|
@ -360,6 +363,12 @@ void VR_FrameSetup()
|
|||
|
||||
bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
||||
{
|
||||
//Don't use our projection if playing a cinematic and we are not immersive
|
||||
if (vr.cin_camera && !vr.immersive_cinematics)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vr.cgzoommode)
|
||||
{
|
||||
#ifdef PICO_XR
|
||||
|
@ -385,7 +394,6 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ typedef struct {
|
|||
vec3_t hmdposition_snap; // The position the HMD was in last time the menu was up (snapshot position)
|
||||
vec3_t hmdposition_offset; // offset from the position the HMD was in last time the menu was up
|
||||
|
||||
bool take_snap;
|
||||
|
||||
vec3_t hmdorientation;
|
||||
vec3_t hmdorientation_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdorientation_delta;
|
||||
|
|
|
@ -562,6 +562,7 @@ void CGCam_Track( const char *trackName, float speed, float initLerp )
|
|||
else
|
||||
{
|
||||
client_camera.trackInitLerp = qfalse;
|
||||
vr->take_snap = true;
|
||||
}
|
||||
/*
|
||||
if ( client_camera.info_state & CAMERA_FOLLOWING )
|
||||
|
@ -801,6 +802,12 @@ void CGCam_FollowUpdate ( void )
|
|||
//So tracker doesn't move right away thinking the first angle change
|
||||
//is the subject moving... FIXME: shouldn't set this until lerp done OR snapped?
|
||||
client_camera.subjectSpeed = 0;
|
||||
|
||||
//Store initial point, let player do the follow from here themselves
|
||||
if (vr->immersive_cinematics)
|
||||
{
|
||||
vr->take_snap = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Point camera to lerp angles
|
||||
|
@ -1078,7 +1085,8 @@ void CGCam_Update( void )
|
|||
{
|
||||
actualFOV_X = client_camera.FOV + (( ( client_camera.FOV2 - client_camera.FOV ) ) / client_camera.FOV_duration ) * ( cg.time - client_camera.FOV_time );
|
||||
}
|
||||
CG_CalcFOVFromX( actualFOV_X );
|
||||
float fov = vr && vr->immersive_cinematics ? vr->fov_x : actualFOV_X;
|
||||
CG_CalcFOVFromX( fov );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1089,31 +1097,45 @@ void CGCam_Update( void )
|
|||
//Check for roffing angles
|
||||
if ( (client_camera.info_state & CAMERA_ROFFING) && !(client_camera.info_state & CAMERA_FOLLOWING) )
|
||||
{
|
||||
for ( i = 0; i < 3; i++ )
|
||||
if (!vr->immersive_cinematics)
|
||||
{
|
||||
cg.refdefViewAngles[i] = client_camera.angles[i] + ( client_camera.angles2[i] / client_camera.pan_duration ) * ( cg.time - client_camera.pan_time );
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
cg.refdefViewAngles[i] = client_camera.angles[i] + ( client_camera.angles2[i] / client_camera.pan_duration ) * ( cg.time - client_camera.pan_time );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy(client_camera.angles, cg.refdefViewAngles);
|
||||
}
|
||||
}
|
||||
else if ( client_camera.info_state & CAMERA_PANNING )
|
||||
{
|
||||
//Note: does not actually change the camera's angles until the pan time is done!
|
||||
if ( client_camera.pan_time + client_camera.pan_duration < cg.time )
|
||||
{//finished panning
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
client_camera.angles[i] = AngleNormalize360( ( client_camera.angles[i] + client_camera.angles2[i] ) );
|
||||
}
|
||||
if (!vr->immersive_cinematics)
|
||||
{
|
||||
//Note: does not actually change the camera's angles until the pan time is done!
|
||||
if ( client_camera.pan_time + client_camera.pan_duration < cg.time )
|
||||
{//finished panning
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
client_camera.angles[i] = AngleNormalize360( ( client_camera.angles[i] + client_camera.angles2[i] ) );
|
||||
}
|
||||
|
||||
client_camera.info_state &= ~CAMERA_PANNING;
|
||||
VectorCopy(client_camera.angles, cg.refdefViewAngles );
|
||||
client_camera.info_state &= ~CAMERA_PANNING;
|
||||
VectorCopy(client_camera.angles, cg.refdefViewAngles );
|
||||
}
|
||||
else
|
||||
{//still panning
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
//NOTE: does not store the resultant angle in client_camera.angles until pan is done
|
||||
cg.refdefViewAngles[i] = client_camera.angles[i] + ( client_camera.angles2[i] / client_camera.pan_duration ) * ( cg.time - client_camera.pan_time );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{//still panning
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
//NOTE: does not store the resultant angle in client_camera.angles until pan is done
|
||||
cg.refdefViewAngles[i] = client_camera.angles[i] + ( client_camera.angles2[i] / client_camera.pan_duration ) * ( cg.time - client_camera.pan_time );
|
||||
}
|
||||
{
|
||||
VectorCopy(client_camera.angles, cg.refdefViewAngles);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1148,7 +1170,8 @@ void CGCam_Update( void )
|
|||
|
||||
if ( checkFollow )
|
||||
{
|
||||
if ( client_camera.info_state & CAMERA_FOLLOWING )
|
||||
//Don't follow if immersive
|
||||
if (( client_camera.info_state & CAMERA_FOLLOWING ) && !vr->immersive_cinematics )
|
||||
{//This needs to be done after camera movement
|
||||
CGCam_FollowUpdate();
|
||||
}
|
||||
|
@ -1176,7 +1199,7 @@ void CGCam_Update( void )
|
|||
|
||||
if (vr->immersive_cinematics)
|
||||
{
|
||||
float yaw = cg.refdefViewAngles[YAW] + vr->hmdorientation[YAW];
|
||||
float yaw = cg.refdefViewAngles[YAW] + (vr->hmdorientation[YAW] - vr->hmdorientation_snap[YAW]) + vr->snapTurn;
|
||||
VectorCopy(vr->hmdorientation, cg.refdefViewAngles);
|
||||
cg.refdefViewAngles[YAW] = yaw;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue