Small tweaks

- HUD models draw correctly now
- Increased the HUNK allocation limit so no more failues with Hunk_Alloc
- adjusted positional factor for adjusted worldscale
- scaled all weapons to 75% as that feels a bit better until such a time as better scaling/position is agreed
This commit is contained in:
Simon 2022-01-31 23:32:27 +00:00
parent 1b8dbcb6dc
commit 2e97da5dda
7 changed files with 49 additions and 25 deletions

View file

@ -270,6 +270,7 @@ CG_Draw3DModel
================
*/
extern int hudflags;
void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandle_t skin, vec3_t origin, vec3_t angles ) {
refdef_t refdef;
refEntity_t ent;
@ -278,7 +279,9 @@ void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandl
return;
}
hudflags = HUD_FLAGS_DRAWMODEL;
CG_AdjustFrom640( &x, &y, &w, &h );
hudflags = 0;
memset( &refdef, 0, sizeof( refdef ) );
@ -2678,7 +2681,9 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
cg.refdef.vieworg[2] -= PLAYER_HEIGHT;
cg.refdef.vieworg[2] += cgVR->hmdposition[1] * worldscale;
VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
if (!cgVR->fullscreen) {
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
}
// draw 3D view
trap_R_RenderScene( &cg.refdef );

View file

@ -22,9 +22,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// cg_drawtools.c -- helper functions called by cg_draw, cg_scoreboard, cg_info, etc
#include "cg_local.h"
#include "../vr/vr_clientinfo.h"
int hudflags = 0;
stereoFrame_t hudStereoView = STEREO_CENTER;
extern vr_clientinfo_t* cgVR;
/*
================
@ -35,7 +37,8 @@ Adjusted for resolution and screen aspect ratio
*/
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (hudflags & HUD_FLAGS_FULLSCREEN)
if (hudflags & HUD_FLAGS_FULLSCREEN ||
cgVR->fullscreen)
{
// scale for screen sizes
*x *= cgs.screenXScale;
@ -48,15 +51,25 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
float screenXScale = cgs.screenXScale / 2.75f;
float screenYScale = cgs.screenYScale / 2.75f;
int xoffset = -64;
int xoffset = -80;
if (hudStereoView == STEREO_LEFT) {
xoffset *= -1;
}
*x *= screenXScale;
*y *= screenYScale;
*w *= screenXScale;
*h *= screenYScale;
if (hudflags & HUD_FLAGS_DRAWMODEL)
{
*w *= cgs.screenXScale;
*x -= (*w / 4);
*h *= cgs.screenYScale;
*y -= (*h / 4);
}
else
{
*w *= screenXScale;
*h *= screenYScale;
}
*x += (cg.refdef.width - (640 * screenXScale)) / 2.0f + xoffset;
*y += (cg.refdef.height - (480 * screenYScale)) / 2.0f;

View file

@ -92,6 +92,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define DEFAULT_BLUETEAM_NAME "Pagans"
//VR HUD
#define HUD_FLAGS_FULLSCREEN 1
#define HUD_FLAGS_DRAWMODEL 2
typedef enum {
FOOTSTEP_NORMAL,

View file

@ -37,9 +37,9 @@ int demo_protocols[] =
#define MAX_NUM_ARGVS 50
#define MIN_DEDICATED_COMHUNKMEGS 1
#define MIN_COMHUNKMEGS 56
#define DEF_COMHUNKMEGS 128
#define DEF_COMZONEMEGS 24
#define MIN_COMHUNKMEGS 128
#define DEF_COMHUNKMEGS 256
#define DEF_COMZONEMEGS 48
#define DEF_COMHUNKMEGS_S XSTRING(DEF_COMHUNKMEGS)
#define DEF_COMZONEMEGS_S XSTRING(DEF_COMZONEMEGS)
@ -2741,7 +2741,7 @@ void Com_Init( char *commandLine ) {
// init commands and vars
//
com_altivec = Cvar_Get ("com_altivec", "1", CVAR_ARCHIVE);
com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE);
com_maxfps = Cvar_Get ("com_maxfps", "120", CVAR_ARCHIVE);
com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE);
com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );

View file

@ -38,6 +38,17 @@ engine_t* VR_Init( ovrJava java )
void VR_InitCvars( void )
{
vr_worldscale = Cvar_Get ("vr_worldscale", "32.0", CVAR_ARCHIVE);
// Values are: scale,right,up,forward,pitch,yaw,roll
Cvar_Get ("vr_weapon_adjustment_1", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_2", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_3", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_4", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_5", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_6", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_7", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_8", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_9", "0.75,0,0,0,0,0,0", CVAR_ARCHIVE);
}
void VR_Destroy( engine_t* engine )

View file

@ -4,16 +4,11 @@
#include "vr_base.h"
#define NUM_WEAPON_SAMPLES 10
#define WEAPON_RECOIL 15.0f;
typedef struct {
qboolean weapon_stabilised;
qboolean right_handed;
qboolean player_moving;
qboolean visible_hud;
qboolean dualwield;
int weaponid;
int lastweaponid;
qboolean fullscreen;
vec3_t hmdposition;
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!

View file

@ -188,10 +188,6 @@ void IN_VRInit( void )
vr_righthanded = Cvar_Get ("vr_righthanded", "1", CVAR_ARCHIVE);
vr_snapturn = Cvar_Get ("vr_snapturn", "1", CVAR_ARCHIVE);
vr_extralatencymode = Cvar_Get ("vr_extralatencymode", "1", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_1", "1.0,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_2", "1.0,0,0,0,0,0,0", CVAR_ARCHIVE);
Cvar_Get ("vr_weapon_adjustment_3", "1.0,0,0,0,0,0,0", CVAR_ARCHIVE);
}
static void IN_VRController( qboolean isRightController, ovrTracking remoteTracking )
@ -240,11 +236,11 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
lastframetime = newframetime;
vec2_t positional;
float factor = (refresh / 72.0F) * 12.0f; // adjust positional factor based on refresh rate
float factor = (refresh / 72.0F) * 10.0f; // adjust positional factor based on refresh rate
rotateAboutOrigin(-vr.hmdposition_delta[0] * factor * multiplier,
vr.hmdposition_delta[2] * factor * multiplier, - vr.hmdorientation[YAW], positional);
if (VR_useScreenLayer())
if (vr.fullscreen)
{
const float x = joystickX * 4.0;
const float y = joystickY * -4.0;
@ -345,15 +341,16 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qfalse, 0, NULL);
}
if ((buttons & ovrButton_X) && !(controller->buttons & ovrButton_B)) {
if ((buttons & ovrButton_X) && !(controller->buttons & ovrButton_X)) {
//sendButtonActionSimple("give all");
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qtrue, 0, NULL);
} else if (!(buttons & ovrButton_B) && (controller->buttons & ovrButton_B)) {
} else if (!(buttons & ovrButton_X) && (controller->buttons & ovrButton_X)) {
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_X, qfalse, 0, NULL);
}
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_B)) {
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qtrue, 0, NULL);
} else if (!(buttons & ovrButton_B) && (controller->buttons & ovrButton_B)) {
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
Com_QueueEvent(in_vrEventTime, SE_KEY, K_PAD0_Y, qfalse, 0, NULL);
}
@ -383,6 +380,8 @@ void IN_VRInputFrame( void )
result = vrapi_SetClockLevels(VR_GetEngine()->ovr, 4, 4);
assert(result == VRAPI_INITIALIZE_SUCCESS);
vr.fullscreen = VR_useScreenLayer();
{
// We extract Yaw, Pitch, Roll instead of directly using the orientation
// to allow "additional" yaw manipulation with mouse/controller.