Several fixes

- HUD no longer has a slight weird transparency which made it a little hard to read in some scenarios
- HUD models draw correctly and clearly in the correct locations
- Vignette fix
- Railgun Scope fix
This commit is contained in:
Simon 2022-04-03 10:17:28 +01:00
parent 443a3657f2
commit c808c877f3
10 changed files with 68 additions and 37 deletions

View file

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.ioq3quest"
android:installLocation="preferExternal"
android:versionCode="40"
android:versionName="0.28.0">
android:versionCode="41"
android:versionName="0.29.2">
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
<uses-feature android:glEsVersion="0x00030001" />
<!-- <uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>-->

View file

@ -2647,10 +2647,10 @@ static void CG_DrawVignette( void )
/*
=================
CG_Draw2D
CG_DrawHUD2D - Draw 2D elements always intended for the in-world HUD
=================
*/
static void CG_Draw2D()
static void CG_DrawHUD2D()
{
#ifdef MISSIONPACK
if (cgs.orderPending && cg.time > cgs.orderTime) {
@ -2671,24 +2671,14 @@ static void CG_Draw2D()
return;
}
/*
if (cg.cameraMode) {
return;
}
*/
if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
CG_DrawSpectator();
// if(stereoFrame == STEREO_CENTER)
// CG_DrawCrosshair();
CG_DrawCrosshairNames();
} else {
// don't draw any status if dead or the scoreboard is being explicitly shown
if ( !cg.showScores && cg.snap->ps.stats[STAT_HEALTH] > 0 ) {
CG_DrawVignette();
// If weapon selector is active, check whether draw HUD
if (cg.weaponSelectorTime != 0 && trap_Cvar_VariableValue("vr_weaponSelectorWithHud") == 0) {
return;
@ -2709,10 +2699,6 @@ static void CG_Draw2D()
CG_DrawProxWarning();
#endif
if(vr->weapon_zoomed) {
CG_DrawWeapReticle();
}
CG_DrawCrosshairNames();
CG_DrawWeaponSelect();
@ -2760,6 +2746,37 @@ static void CG_Draw2D()
}
}
/*
=================
CG_DrawScreen2D - Draws 2D elements always intended for the screen
=================
*/
static void CG_DrawScreen2D()
{
// if we are taking a levelshot for the menu, don't draw anything
if ( cg.levelShot ) {
return;
}
if ( cg_draw2D.integer == 0 ) {
return;
}
if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {
return;
}
if ( cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR &&
!cg.showScores && cg.snap->ps.stats[STAT_HEALTH] > 0 ) {
CG_DrawVignette();
if(vr->weapon_zoomed) {
CG_DrawWeapReticle();
}
}
}
//
// HACK HACK HACK
@ -2897,7 +2914,7 @@ void CG_DrawActive( void ) {
memset(&ent, 0, sizeof(ent));
ent.reType = RT_SPRITE;
ent.renderfx = RF_DEPTHHACK;
ent.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON;
VectorCopy(endpos, ent.origin);
@ -2918,9 +2935,12 @@ void CG_DrawActive( void ) {
trap_R_HUDBufferStart();
// draw status bar and other floating elements
CG_Draw2D();
CG_DrawHUD2D();
trap_R_HUDBufferEnd();
//Now draw the screen 2D stuff
CG_DrawScreen2D();
}
CG_EmptySceneHackHackHack();

View file

@ -54,9 +54,9 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h )
*y *= cgs.screenYScale;
if (hudflags & HUD_FLAGS_DRAWMODEL)
{
*w *= (cgs.screenXScale * 2.0f);
*w *= (cgs.screenXScale * 4.0f);
*x -= (*w / 3);
*h *= (cgs.screenYScale * 2.0f);
*h *= (cgs.screenYScale * 4.0f);
*y -= (*h / 3);
}
else

View file

@ -1771,6 +1771,7 @@ const void* RB_HUDBuffer( const void* data ) {
if (cmd->start && tr.renderFbo->frameBuffer != tr.hudFbo->frameBuffer)
{
glState.isDrawingHUD = qtrue;
//keep record of current render fbo and switch to the hud buffer
tr.backupFrameBuffer = tr.renderFbo->frameBuffer;
tr.renderFbo->frameBuffer = tr.hudFbo->frameBuffer;
@ -1790,11 +1791,12 @@ const void* RB_HUDBuffer( const void* data ) {
ri.Error( "Error binding Framebuffer: %i\n", result );
}
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
qglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
qglClear( GL_COLOR_BUFFER_BIT );
}
else if (tr.renderFbo->frameBuffer == tr.hudFbo->frameBuffer)
{
glState.isDrawingHUD = qfalse;
//restore the true render fbo
tr.renderFbo->frameBuffer = tr.backupFrameBuffer;
GL_BindFramebuffer(GL_FRAMEBUFFER, tr.renderFbo->frameBuffer);

View file

@ -67,9 +67,9 @@ typedef struct uniformInfo_s
uniformInfo_t;
typedef enum {
// STEREO_ORTHO_PROJECTION, // An orthographic projection with slight stereo view matrix
HUD_ORTHO_PROJECTION, // Orthographic projection and no stereo view
VR_PROJECTION,
MONO_VR_PROJECTION,
PROJECTION_COUNT
} projection_t;
@ -185,7 +185,7 @@ glslPrintLog_t;
GLSL_ViewMatricesUniformBuffer
====================
*/
static void GLSL_ViewMatricesUniformBuffer(const float value[32]) {
static void GLSL_ViewMatricesUniformBuffer(const float eyeView[32], const float modelView[32]) {
for (int i = 0; i < PROJECTION_COUNT; ++i)
{
@ -211,9 +211,16 @@ static void GLSL_ViewMatricesUniformBuffer(const float value[32]) {
Mat4Identity( viewMatrices + 16 );
}
break;
default:
case VR_PROJECTION:
{
memcpy((char *) viewMatrices, value, 32 * sizeof(float));
Mat4Copy(eyeView, viewMatrices);
Mat4Copy(eyeView+16, viewMatrices+16);
}
break;
case MONO_VR_PROJECTION:
{
Mat4Copy(modelView, viewMatrices);
Mat4Copy(modelView, viewMatrices+16);
}
break;
}
@ -1667,18 +1674,17 @@ void GLSL_PrepareUniformBuffers(void)
Mat4Ortho(0, width, height, 0, 0, 1, orthoProjectionMatrix);
//ortho projection matrix
/* GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[STEREO_ORTHO_PROJECTION],
orthoProjectionMatrix);
*/
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[HUD_ORTHO_PROJECTION],
orthoProjectionMatrix);
//VR projection matrix
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[VR_PROJECTION],
tr.vrParms.projection);
GLSL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[MONO_VR_PROJECTION],
tr.vrParms.projection);
//Set up the buffers that won't change this frame
GLSL_ViewMatricesUniformBuffer(tr.viewParms.world.eyeViewMatrix);
//Set all view matrices
GLSL_ViewMatricesUniformBuffer(tr.viewParms.world.eyeViewMatrix, tr.viewParms.world.modelView);
}
void GLSL_BindProgram(shaderProgram_t * program)
@ -1697,8 +1703,10 @@ void GLSL_BindProgram(shaderProgram_t * program)
}
static GLuint GLSL_CalculateProjection() {
GLuint result = VR_PROJECTION;
GLuint result = glState.isDrawingHUD ? MONO_VR_PROJECTION : VR_PROJECTION;
//If we are using an orthographic projection, then we don't need the mono VR projection
//as we aren't drawing models to the HUD
if (Mat4Compare(&orthoProjectionMatrix, glState.projection))
{
result = HUD_ORTHO_PROJECTION;

View file

@ -1390,6 +1390,7 @@ typedef struct {
mat4_t modelMatrix;
mat4_t projection;
qboolean isDrawingHUD;
} glstate_t;
typedef enum {

View file

@ -1520,7 +1520,7 @@ static void R_AddEntitySurface (int entityNum)
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
//
// the weapon model must be handled special --
// the weapon model (and HUD sprite) must be handled special --
// we don't want the hacked weapon position showing in
// mirrors, because the true body position will already be drawn
//

View file

@ -8,6 +8,6 @@ sprites/vr/hud
cull disable
{
clampmap sprites/plasmaa.tga
blendfunc GL_ONE GL_ONE
blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
}

View file

@ -2,8 +2,8 @@
setlocal
set BUILD_TYPE=release
set VERSION=0.29.1-multiview
set BUILD_TYPE=debug
set VERSION=0.29.2-multiview
@REM Define the following environment variables to sign a release build
@REM set KEYSTORE=