mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-23 04:52:07 +00:00
Add gunfov and farsee in ref_vk
This commit is contained in:
parent
17c5e04d8f
commit
59e5c4fca5
4 changed files with 27 additions and 9 deletions
|
@ -136,6 +136,8 @@ extern cvar_t *r_modulate;
|
|||
extern cvar_t *r_vsync;
|
||||
extern cvar_t *r_clear;
|
||||
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
|
||||
extern cvar_t *r_gunfov;
|
||||
extern cvar_t *r_farsee;
|
||||
|
||||
extern cvar_t *vk_overbrightbits;
|
||||
extern cvar_t *vk_validation;
|
||||
|
|
|
@ -687,13 +687,22 @@ void R_DrawAliasModel (entity_t *currententity, model_t *currentmodel)
|
|||
// draw all the triangles
|
||||
//
|
||||
if (currententity->flags & RF_DEPTHHACK || r_newrefdef.rdflags & RDF_NOWORLDMODEL) { // hack the depth range to prevent view model from poking into walls
|
||||
extern float r_proj_aspect, r_proj_fovy;
|
||||
float r_proj_aspect = (float)r_newrefdef.width / r_newrefdef.height;
|
||||
float r_proj_fovy = r_newrefdef.fov_y;
|
||||
float dist = (r_farsee->value == 0) ? 4096.0f : 8192.0f;
|
||||
// use different range for player setup screen so it doesn't collide with the viewmodel
|
||||
r_vulkan_correction_dh[10] = 0.3f - (r_newrefdef.rdflags & RDF_NOWORLDMODEL) * 0.1f;
|
||||
r_vulkan_correction_dh[14] = 0.3f - (r_newrefdef.rdflags & RDF_NOWORLDMODEL) * 0.1f;
|
||||
|
||||
memcpy(prev_viewproj, r_viewproj_matrix, sizeof(r_viewproj_matrix));
|
||||
Mat_Perspective(r_projection_matrix, r_vulkan_correction_dh, r_proj_fovy, r_proj_aspect, 4, 4096);
|
||||
if (currententity->flags & RF_WEAPONMODEL && r_gunfov->value < 0)
|
||||
{
|
||||
Mat_Perspective(r_projection_matrix, r_vulkan_correction_dh, r_proj_fovy, r_proj_aspect, 4, dist);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mat_Perspective(r_projection_matrix, r_vulkan_correction_dh, r_gunfov->value, r_proj_aspect, 4, dist);
|
||||
}
|
||||
Mat_Mul(r_view_matrix, r_projection_matrix, r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
}
|
||||
|
|
|
@ -61,9 +61,6 @@ vec3_t vright;
|
|||
vec3_t r_origin;
|
||||
|
||||
float r_projection_matrix[16];
|
||||
float r_proj_aspect;
|
||||
float r_proj_fovx;
|
||||
float r_proj_fovy;
|
||||
float r_view_matrix[16];
|
||||
float r_viewproj_matrix[16];
|
||||
// correction matrix for perspective in Vulkan
|
||||
|
@ -90,6 +87,8 @@ cvar_t *r_lerpmodels;
|
|||
cvar_t *r_lefthand;
|
||||
cvar_t *r_vsync;
|
||||
cvar_t *r_mode;
|
||||
cvar_t *r_gunfov;
|
||||
cvar_t *r_farsee;
|
||||
|
||||
cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
|
||||
|
||||
|
@ -847,7 +846,11 @@ R_SetupVulkan
|
|||
static void
|
||||
R_SetupVulkan (void)
|
||||
{
|
||||
float r_proj_aspect;
|
||||
float r_proj_fovx;
|
||||
float r_proj_fovy;
|
||||
int x, x2, y2, y, w, h;
|
||||
float dist = (r_farsee->value == 0) ? 4096.0f : 8192.0f;
|
||||
|
||||
//
|
||||
// set up viewport
|
||||
|
@ -874,7 +877,7 @@ R_SetupVulkan (void)
|
|||
r_proj_fovx = r_newrefdef.fov_x;
|
||||
r_proj_fovy = r_newrefdef.fov_y;
|
||||
r_proj_aspect = (float)r_newrefdef.width / r_newrefdef.height;
|
||||
Mat_Perspective(r_projection_matrix, r_vulkan_correction, r_proj_fovy, r_proj_aspect, 4, 4096);
|
||||
Mat_Perspective(r_projection_matrix, r_vulkan_correction, r_proj_fovy, r_proj_aspect, 4, dist);
|
||||
|
||||
R_SetFrustum(r_proj_fovx, r_proj_fovy);
|
||||
|
||||
|
@ -1134,6 +1137,8 @@ R_Register( void )
|
|||
r_lightlevel = ri.Cvar_Get("r_lightlevel", "0", 0);
|
||||
r_mode = ri.Cvar_Get("r_mode", "11", CVAR_ARCHIVE);
|
||||
r_vsync = ri.Cvar_Get("r_vsync", "0", CVAR_ARCHIVE);
|
||||
r_gunfov = ri.Cvar_Get("r_gunfov", "80", CVAR_ARCHIVE);
|
||||
r_farsee = ri.Cvar_Get("r_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE);
|
||||
|
||||
vk_overbrightbits = ri.Cvar_Get("vk_overbrightbits", "1.0", CVAR_ARCHIVE);
|
||||
vk_validation = ri.Cvar_Get("vk_validation", "0", CVAR_ARCHIVE);
|
||||
|
|
|
@ -540,9 +540,11 @@ static void MakeSkyVec (float s, float t, int axis, float *vertexData)
|
|||
vec3_t v, b;
|
||||
int j;
|
||||
|
||||
b[0] = s * 2300;
|
||||
b[1] = t * 2300;
|
||||
b[2] = 2300;
|
||||
float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f;
|
||||
|
||||
b[0] = s * dist;
|
||||
b[1] = t * dist;
|
||||
b[2] = dist;
|
||||
|
||||
for (j = 0; j<3; j++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue