Implement `vk_underwater`, make the underwater warp effect optional.

This was requested in #505.
This commit is contained in:
Yamagi 2021-01-13 21:06:39 +01:00
parent 8a54e49f61
commit a9914efde7
3 changed files with 20 additions and 1 deletions

View File

@ -138,6 +138,7 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* **nextserver**: Used for looping the introduction demos.
## Audio
* **al_device**: OpenAL device to use. In most cases there's no need to
@ -324,6 +325,7 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* **gl3_particle_square**: If set to `1`, particles are rendered as
squares, like in the old software renderer or Quake 1. Default is `0`.
## Graphics (Software only)
* **sw_gunzposition**: Z offset for the gun. In the original code this
@ -331,6 +333,7 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
custom gun field of few is used. Defaults to `8`, which is more or
less optimal for the default gun field of view of 80.
## Graphics (Vulkan only)
* **vk_validation**: Toggle validation layers:
@ -438,6 +441,10 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* **vk_lmaptexturemode**: Same as `vk_texturemode` but applied to
lightmap textures.
* **vk_underwater**: Warp the scene if underwater. Set to `0` to disable
the effect. Defaults to `1`.
## cvar operations
cvar operations are special commands that allow the programmatic

View File

@ -163,6 +163,7 @@ extern cvar_t *vk_aniso;
extern cvar_t *vk_sampleshading;
extern cvar_t *vk_device_idx;
extern cvar_t *vk_retexturing;
extern cvar_t *vk_underwater;
extern cvar_t *vk_nolerp_list;
extern cvar_t *vid_fullscreen;

View File

@ -124,6 +124,7 @@ cvar_t *vk_mip_nearfilter;
cvar_t *vk_sampleshading;
cvar_t *vk_device_idx;
cvar_t *vk_retexturing;
cvar_t *vk_underwater;
cvar_t *vk_nolerp_list;
cvar_t *vid_fullscreen;
@ -1014,9 +1015,18 @@ qboolean RE_EndWorldRenderpass(void)
// * underwater view warp if the player is submerged in liquid
// * restore world view to the full screen size when vk_pixel_size is >1.0
QVk_BeginRenderpass(RP_WORLD_WARP);
float underwaterTime;
if (vk_underwater->value)
{
underwaterTime= r_newrefdef.rdflags & RDF_UNDERWATER ? r_newrefdef.time : 0.f;
}
else
{
underwaterTime = 0.f;
};
float pushConsts[] =
{
(r_newrefdef.rdflags & RDF_UNDERWATER) ? r_newrefdef.time : 0.f,
underwaterTime,
viewsize->value / 100.0f,
vid.width,
vid.height,
@ -1215,6 +1225,7 @@ R_Register( void )
vk_sampleshading = ri.Cvar_Get("vk_sampleshading", "1", CVAR_ARCHIVE);
vk_device_idx = ri.Cvar_Get("vk_device", "-1", CVAR_ARCHIVE);
vk_retexturing = ri.Cvar_Get("vk_retexturing", "1", CVAR_ARCHIVE);
vk_underwater = ri.Cvar_Get("vk_underwater", "1", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */
vk_nolerp_list = ri.Cvar_Get("vk_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);