small fixes

- 6DoF movement in follow mode seems right now
- Prevent surfaces being culled in follow modes (annoyingly I've not figured out what is culling models yet, so other players still vanish)
This commit is contained in:
Simon 2022-03-17 23:30:43 +00:00
parent b3beeeef00
commit 9aef5b5d68
12 changed files with 65 additions and 31 deletions

View file

@ -261,7 +261,7 @@ static void CG_OffsetVRThirdPersonView( void ) {
vec3_t angles, forward, right, up;
VectorCopy(vr->offhandangles, angles);
float deltaYaw = SHORT2ANGLE(cg.predictedPlayerState.delta_angles[YAW]);
angles[YAW] += deltaYaw + (vr->clientviewangles[YAW] - vr->hmdorientation[YAW]);
angles[YAW] += (vr->clientviewangles[YAW] - vr->hmdorientation[YAW]);
AngleVectors(angles, forward, right, up);
VectorMA(cg.vr_vieworigin, vr->thumbstick_location[THUMB_LEFT][1] * 5.0f, forward, cg.vr_vieworigin);
VectorMA(cg.vr_vieworigin, vr->thumbstick_location[THUMB_LEFT][0] * 5.0f, right, cg.vr_vieworigin);
@ -673,7 +673,7 @@ static int CG_CalcViewValues( ) {
//HACK!! - should change this to a renderer function call
//Indicate to renderer whether we are in deathcam mode, We don't want sky in death cam mode
trap_Cvar_Set( "vr_noSkybox", (((ps->stats[STAT_HEALTH] <= 0) &&
trap_Cvar_Set( "vr_thirdPersonSpectator", (((ps->stats[STAT_HEALTH] <= 0) &&
( ps->pm_type != PM_INTERMISSION )) ||
cg.demoPlayback ||
CG_IsThirdPersonFollowMode() ? "1" : "0" ));

View file

@ -135,7 +135,7 @@ Special Thanks to the whole discord!
y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "Additional Quake3Quest coding", UI_CENTER|UI_SMALLFONT, color_red );
y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawString( 320, y, "Baggyg, MuadDiB, Lubos, Sparkie", UI_CENTER|UI_SMALLFONT, color_white );
UI_DrawString( 320, y, "Sparkie, MuadDiB, Lubos, Baggyg", UI_CENTER|UI_SMALLFONT, color_white );
y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "Additional Contributions", UI_CENTER|UI_SMALLFONT, color_red );

View file

@ -47,6 +47,11 @@ static int R_MDRCullModel( mdrHeader_t *header, trRefEntity_t *ent ) {
mdrFrame_t *oldFrame, *newFrame;
int i, frameSize;
if (vr_thirdPersonSpectator->integer)
{
return CULL_IN;
}
frameSize = (size_t)( &((mdrFrame_t *)0)->bones[ header->numBones ] );
// compute frame pointers

View file

@ -74,7 +74,7 @@ cvar_t *r_measureOverdraw;
cvar_t *r_inGameVideo;
cvar_t *r_fastsky;
cvar_t *vr_noSkybox;
cvar_t *vr_thirdPersonSpectator;
cvar_t *r_drawSun;
cvar_t *r_dynamiclight;
cvar_t *r_dlightBacks;
@ -1312,7 +1312,7 @@ void R_Register( void )
r_useFlush = ri.Cvar_Get( "r_useFlush", "1", CVAR_ARCHIVE );
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE );
vr_noSkybox = ri.Cvar_Get( "vr_noSkybox", "0", CVAR_TEMP );
vr_thirdPersonSpectator = ri.Cvar_Get( "vr_thirdPersonSpectator", "0", CVAR_TEMP );
r_inGameVideo = ri.Cvar_Get( "r_inGameVideo", "1", CVAR_ARCHIVE );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE );
r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "0", CVAR_ARCHIVE );

View file

@ -1701,7 +1701,7 @@ extern cvar_t *r_lodscale;
extern cvar_t *r_inGameVideo; // controls whether in game video should be draw
extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *vr_noSkybox; //
extern cvar_t *vr_thirdPersonSpectator; //
extern cvar_t *r_drawSun; // controls drawing of sun quad
extern cvar_t *r_dynamiclight; // dynamic lights enabled/disabled
extern cvar_t *r_dlightBacks; // dlight non-facing surfaces for continuity

View file

@ -294,6 +294,11 @@ int R_CullBox(vec3_t worldBounds[2]) {
qboolean anyClip;
int r, numPlanes;
if (vr_thirdPersonSpectator->integer)
{
return CULL_IN;
}
numPlanes = (tr.viewParms.flags & VPF_FARPLANEFRUSTUM) ? 5 : 4;
// check against frustum planes
@ -1942,10 +1947,13 @@ void R_RenderPshadowMaps(const refdef_t *fd)
if (!radius)
continue;
// Cull entities that are behind the viewer by more than lightRadius
VectorSubtract(ent->e.origin, fd->vieworg, diff);
if (DotProduct(diff, fd->viewaxis[0]) < -r_pshadowDist->value)
continue;
if (!vr_thirdPersonSpectator->integer)
{
// Cull entities that are behind the viewer by more than lightRadius
VectorSubtract(ent->e.origin, fd->vieworg, diff);
if (DotProduct(diff, fd->viewaxis[0]) < -r_pshadowDist->value)
continue;
}
memset(&shadow, 0, sizeof(shadow));

View file

@ -133,13 +133,17 @@ R_BoxSurfaces_r
*/
void R_BoxSurfaces_r(mnode_t *node, vec3_t mins, vec3_t maxs, surfaceType_t **list, int listsize, int *listlength, vec3_t dir) {
int s, c;
int s=0, c;
msurface_t *surf;
int *mark;
// do the tail recursion in a loop
while ( node->contents == -1 ) {
s = BoxOnPlaneSide( mins, maxs, node->plane );
if (!vr_thirdPersonSpectator->integer)
s = BoxOnPlaneSide( mins, maxs, node->plane );
else
s = 0;
if (s == 1) {
node = node->children[0];
} else if (s == 2) {
@ -168,7 +172,11 @@ void R_BoxSurfaces_r(mnode_t *node, vec3_t mins, vec3_t maxs, surfaceType_t **li
// extra check for surfaces to avoid list overflows
else if (*(surf->data) == SF_FACE) {
// the face plane should go through the box
s = BoxOnPlaneSide( mins, maxs, &surf->cullinfo.plane );
if (!vr_thirdPersonSpectator->integer)
s = BoxOnPlaneSide( mins, maxs, &surf->cullinfo.plane );
else
s = 0;
if (s == 1 || s == 2) {
*surfViewCount = tr.viewCount;
} else if (DotProduct(surf->cullinfo.plane.normal, dir) > -0.5) {

View file

@ -80,7 +80,12 @@ static int R_CullModel( mdvModel_t *model, trRefEntity_t *ent ) {
mdvFrame_t *oldFrame, *newFrame;
int i;
// compute frame pointers
if (vr_thirdPersonSpectator->integer)
{
return CULL_IN;
}
// compute frame pointers
newFrame = model->frames + ent->e.frame;
oldFrame = model->frames + ent->e.oldframe;
@ -324,13 +329,17 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
model = tr.currentModel->mdv[lod];
//
// cull the entire model if merged bounding box of both frames
// is outside the view frustum.
//
cull = R_CullModel ( model, ent );
if ( cull == CULL_OUT ) {
return;
if (!vr_thirdPersonSpectator->integer)
{
//
// cull the entire model if merged bounding box of both frames
// is outside the view frustum.
//
cull = R_CullModel(model, ent);
if (cull == CULL_OUT)
{
return;
}
}
//

View file

@ -1263,13 +1263,17 @@ void R_AddIQMSurfaces( trRefEntity_t *ent ) {
ent->e.oldframe = 0;
}
//
// cull the entire model if merged bounding box of both frames
// is outside the view frustum.
//
cull = R_CullIQM ( data, ent );
if ( cull == CULL_OUT ) {
return;
if (!vr_thirdPersonSpectator->integer)
{
//
// cull the entire model if merged bounding box of both frames
// is outside the view frustum.
//
cull = R_CullIQM(data, ent);
if (cull == CULL_OUT)
{
return;
}
}
//

View file

@ -843,7 +843,7 @@ Other things could be stuck in here, like birds in the sky, etc
================
*/
void RB_StageIteratorSky( void ) {
if ( r_fastsky->integer || vr_noSkybox->integer ) {
if ( r_fastsky->integer || vr_thirdPersonSpectator->integer ) {
return;
}

View file

@ -407,7 +407,7 @@ static void R_RecursiveWorldNode( mnode_t *node, uint32_t planeBits, uint32_t dl
// if the node wasn't marked as potentially visible, exit
// pvs is skipped for depth shadows
if (!(tr.viewParms.flags & VPF_DEPTHSHADOW) && node->visCounts[tr.visIndex] != tr.visCounts[tr.visIndex]) {
if (!r_nocull->integer && !(tr.viewParms.flags & VPF_DEPTHSHADOW) && node->visCounts[tr.visIndex] != tr.visCounts[tr.visIndex]) {
return;
}

View file

@ -214,7 +214,7 @@ void VR_ClearFrameBuffer( GLuint frameBuffer, int width, int height)
glEnable( GL_SCISSOR_TEST );
glViewport( 0, 0, width, height );
if (Cvar_VariableIntegerValue("vr_noSkybox"))
if (Cvar_VariableIntegerValue("vr_thirdPersonSpectator"))
{
//Blood red.. ish
glClearColor( 0.12f, 0.0f, 0.05f, 1.0f );