Couple of changes..

- Vignette Mask (though it doesn't seem to be using alpha correctly)
- Corrected the drawing of the HUD, icons no longer squashed
This commit is contained in:
Simon 2019-11-24 23:02:08 +00:00
parent fca2dff39b
commit ac910f7ce0
13 changed files with 120 additions and 51 deletions

View file

@ -595,35 +595,53 @@ void ovrFramebuffer_Advance( ovrFramebuffer * frameBuffer )
void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer )
{
LOAD_GLES2(glEnable);
LOAD_GLES2(glDisable);
LOAD_GLES2(glViewport);
LOAD_GLES2(glScissor);
LOAD_GLES2(glClearColor);
LOAD_GLES2(glClear);
LOAD_GLES2(glEnable);
LOAD_GLES2(glDisable);
LOAD_GLES2(glViewport);
LOAD_GLES2(glScissor);
LOAD_GLES2(glClearColor);
LOAD_GLES2(glClear);
GL( gles_glEnable( GL_SCISSOR_TEST ) );
GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
GL( gles_glEnable( GL_SCISSOR_TEST ) );
GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
// Explicitly clear the border texels to black because OpenGL-ES does not support GL_CLAMP_TO_BORDER.
// Clear to fully opaque black.
GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
// Explicitly clear the border texels to black because OpenGL-ES does not support GL_CLAMP_TO_BORDER.
// Clear to fully opaque black.
GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
// bottom
GL( gles_glScissor( 0, 0, frameBuffer->Width, 1 ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// top
GL( gles_glScissor( 0, frameBuffer->Height - 1, frameBuffer->Width, 1 ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// left
GL( gles_glScissor( 0, 0, 1, frameBuffer->Height ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// right
GL( gles_glScissor( frameBuffer->Width - 1, 0, 1, frameBuffer->Height ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
//Glide comfort mask in and out
static float currentVLevel = 0.0f;
if (player_moving)
{
if (currentVLevel < vr_comfort_mask->value)
currentVLevel += vr_comfort_mask->value * 0.05;
} else{
if (currentVLevel > 0.0f)
currentVLevel -= vr_comfort_mask->value * 0.05;
}
GL( gles_glScissor( 0, 0, 0, 0 ) );
GL( gles_glDisable( GL_SCISSOR_TEST ) );
bool useMask = (currentVLevel > 0.0f && currentVLevel <= 1.0f);
float width = useMask ? (frameBuffer->Width / 2.0f) * currentVLevel : 1;
float height = useMask ? (frameBuffer->Height / 2.0f) * currentVLevel : 1;
// bottom
GL( gles_glScissor( 0, 0, frameBuffer->Width, width ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// top
GL( gles_glScissor( 0, frameBuffer->Height - height, frameBuffer->Width, height ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// left
GL( gles_glScissor( 0, 0, width, frameBuffer->Height ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
// right
GL( gles_glScissor( frameBuffer->Width - width, 0, width, frameBuffer->Height ) );
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
GL( gles_glScissor( 0, 0, 0, 0 ) );
GL( gles_glDisable( GL_SCISSOR_TEST ) );
}
@ -1348,6 +1366,7 @@ void VR_Init()
vr_weaponscale = Cvar_Get( "vr_weaponscale", "0.56", CVAR_ARCHIVE);
vr_weapon_stabilised = Cvar_Get( "vr_weapon_stabilised", "0.0", CVAR_LATCH);
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_LATCH);
vr_comfort_mask = Cvar_Get( "vr_comfort_mask", "0.0", CVAR_ARCHIVE);
//The Engine (which is a derivative of Quake) uses a very specific unit size:
//Wolfenstein 3D, DOOM and QUAKE use the same coordinate/unit system:

View file

@ -52,6 +52,9 @@ vec3_t flashlightoffset;
#define DUCK_CROUCHED 2
int ducked;
bool player_moving;
float radians(float deg);
float degrees(float rad);
qboolean isMultiplayer();

View file

@ -11,3 +11,4 @@ cvar_t *vr_height_adjust;
cvar_t *vr_worldscale;
cvar_t *vr_weaponscale;
cvar_t *vr_weapon_stabilised;
cvar_t *vr_comfort_mask;

View file

@ -293,6 +293,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
float x = nlf * pOffTrackedRemoteNew->Joystick.x;
float y = nlf * pOffTrackedRemoteNew->Joystick.y;
player_moving = (fabs(x) + fabs(y)) > 0.05f;
//Adjust to be off-hand controller oriented
vec2_t v;
rotateAboutOrigin(x, y, controllerYawHeading, v);

View file

@ -67,7 +67,7 @@ CL_DrawInventory
*/
#define DISPLAY_ITEMS 17
void CL_DrawInventory (void)
void CL_DrawInventory (float separation)
{
int i, j;
int num, selected_num, item;
@ -81,6 +81,7 @@ void CL_DrawInventory (void)
selected = cl.frame.playerstate.stats[STAT_SELECTED_ITEM];
int offset_stereo= (separation>0) ? -25 : 25;
num = 0;
selected_num = 0;
for (i=0 ; i<MAX_ITEMS ; i++)
@ -107,9 +108,9 @@ void CL_DrawInventory (void)
// repaint everything next frame
SCR_DirtyScreen ();
re.DrawPic (x, y+8, "inventory");
re.DrawPic (x+offset_stereo, y+8, "inventory");
x = (viddef.width-256);
x = (viddef.width-256)/2;
y += 24;
x += 24;
//Inv_DrawString (x, y, "hotkey ### item");
@ -139,10 +140,10 @@ void CL_DrawInventory (void)
#ifdef QMAX
re.DrawChar (x-8, y, 15, 256);
#else
re.DrawChar (x-8, y, 15);
re.DrawChar (x+offset_stereo-8, y, 15);
#endif
}
Inv_DrawString (x, y, string);
Inv_DrawString (x+offset_stereo, y, string);
y += 8;
}
}

View file

@ -32,7 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdbool.h>
#include "client.h"
#include "../../../Quake2VR/VrCvars.h"
#define REDBLUE
@ -484,6 +486,42 @@ void SCR_DrawPause (void)
re.DrawPic ((viddef.width-w)/2, viddef.height/2 + 8, "pause");
}
/*
==============
SCR_DrawVignette
==============
*/
extern bool player_moving;
void SCR_DrawVignette (void)
{
if (vr_comfort_mask->value <= 0.0f ||
vr_comfort_mask->value > 1.0f)
{
return;
}
static float currentVLevel = 0.0f;
if (player_moving)
{
if (currentVLevel < vr_comfort_mask->value)
currentVLevel += vr_comfort_mask->value * 0.05;
} else{
if (currentVLevel > 0.0f)
currentVLevel -= vr_comfort_mask->value * 0.05;
}
if (currentVLevel > 0.0f &&
currentVLevel < 1.0f)
{
int x = (int)((viddef.width / 2) * currentVLevel);
int y = (int)((viddef.height / 2) * currentVLevel);
re.DrawStretchPic(x, y, viddef.width - (2 * x), viddef.height - (2 * y), "/vignette.tga");
}
}
/*
==============
SCR_DrawLoading
@ -1406,7 +1444,7 @@ void SCR_UpdateScreen (void)
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 1)
SCR_DrawLayout (separation[i]);
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 2)
CL_DrawInventory ();
CL_DrawInventory (separation[i]);
SCR_DrawNet ();
SCR_CheckDrawCenterString ();
@ -1542,11 +1580,13 @@ void SCR_UpdateForEye (int eye)
V_RenderView ( separation );
SCR_DrawVignette();
SCR_DrawStats (separation );
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 1)
SCR_DrawLayout (separation);
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 2)
CL_DrawInventory ();
CL_DrawInventory (separation);
SCR_DrawNet ();
SCR_CheckDrawCenterString ();

View file

@ -662,7 +662,7 @@ void M_AddToServerList (netadr_t adr, char *info);
//
void CL_ParseInventory (void);
void CL_KeyInventory (int key);
void CL_DrawInventory (void);
void CL_DrawInventory (float stereo_separation );
//
// cl_pred.c

View file

@ -651,30 +651,30 @@ char *single_statusbar =
"yb -24 "
// health
"xv 0 "
"xh 0 "
"hnum "
"xv 50 "
"xh 50 "
"pic 0 "
// ammo
"if 2 "
" xv 100 "
" xh 100 "
" anum "
" xv 150 "
" xh 150 "
" pic 2 "
"endif "
// armor
"if 4 "
" xv 200 "
" xh 200 "
" rnum "
" xv 250 "
" xh 250 "
" pic 4 "
"endif "
// selected item
"if 6 "
" xv 296 "
" xh 296 "
" pic 6 "
"endif "
@ -692,7 +692,7 @@ char *single_statusbar =
// timer
"if 9 "
" xv 262 "
" xh 262 "
" num 2 10 "
" xh 296 "
" pic 9 "
@ -700,7 +700,7 @@ char *single_statusbar =
// help / weapon icon
"if 11 "
" xv 148 "
" xh 148 "
" pic 11 "
"endif "
;

View file

@ -227,7 +227,7 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
if (tag)
{
Com_sprintf (entry, sizeof(entry),
"xv %i yv %i picn %s ",x+32, y, tag);
"xh %i yv %i picn %s ",x+32, y, tag);
j = strlen(entry);
if (stringlength + j > 1024)
break;
@ -316,12 +316,12 @@ void HelpComputer (edict_t *ent)
// send the layout
Com_sprintf (string, sizeof(string),
"xh 32 yv 8 picn help " // background
"xv 202 yv 12 string2 \"%s\" " // skill
"xv 0 yv 24 cstring2 \"%s\" " // level name
"xv 0 yv 54 cstring2 \"%s\" " // help 1
"xv 0 yv 110 cstring2 \"%s\" " // help 2
"xv 50 yv 164 string2 \" kills goals secrets\" "
"xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ",
"xh 202 yv 12 string2 \"%s\" " // skill
"xh 0 yv 24 cstring2 \"%s\" " // level name
"xh 0 yv 54 cstring2 \"%s\" " // help 1
"xh 0 yv 110 cstring2 \"%s\" " // help 2
"xh 50 yv 164 string2 \" kills goals secrets\" "
"xh 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ",
sk,
level.level_name,
game.helpmessage1,

View file

@ -148,6 +148,8 @@ void Draw_StretchPic (int x, int y, int w, int h, char *pic)
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( gl_config.renderer & GL_RENDERER_RENDITION ) ) && !gl->has_alpha)
qglDisable (GL_ALPHA_TEST);
else
qglEnable (GL_ALPHA_TEST); // make sure alpha is enabled
GL_Bind (gl->texnum);
qglBegin (GL_QUADS);

View file

@ -934,10 +934,10 @@ void R_RenderView (refdef_t *fd)
void R_SetGL2D (void)
{
// set 2D virtual screen size
qglViewport (0,0, vid.width*2, vid.height);
qglViewport (0,0, vid.width, vid.height);
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
qglOrtho (0, vid.width*2, vid.height, 0, -99999, 99999);
qglOrtho (0, vid.width, vid.height, 0, -99999, 99999);
qglMatrixMode(GL_MODELVIEW);
qglLoadIdentity ();
qglDisable (GL_DEPTH_TEST);

BIN
assets/vignette.tga Normal file

Binary file not shown.

View file

@ -143,6 +143,7 @@ import android.support.v4.content.ContextCompat;
copy_asset("/sdcard/baseq2", "config.cfg");
copy_asset("/sdcard/baseq2", "autoexec.cfg");
copy_asset("/sdcard/baseq2", "commandline.txt");
copy_asset("/sdcard/baseq2", "vignette.tga");
//GLES3JNILib.setCallbackObjects(null, this);