diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 9f1e0905..fe4a0f36 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -511,6 +511,10 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` look a bit better (no flickering) by using the stencil buffer. Does not work when `gl1_stereo` is `3`, `4` or `5`. +* **gl1_waterwarp**: Intensity of the "squeeze/stretch" effect on the + FOV when diving underwater. Can be any floating point number, `0` + disables it (Vanilla Quake II look). Default `1.0`. + * **gl1_lightmapcopies**: When enabled (`1`), keep 3 copies of the same lightmap rotating, shifting to another one when drawing a new frame. Meant for mobile/embedded devices, where changing textures just shown diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index f4cbdfb4..c931f7e8 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -143,6 +143,7 @@ cvar_t *gl1_stereo_separation; cvar_t *gl1_stereo_anaglyph_colors; cvar_t *gl1_stereo_convergence; +static cvar_t *gl1_waterwarp; refimport_t ri; @@ -740,6 +741,13 @@ R_SetPerspective(GLdouble fovy) ymax = zNear * tan(fovy * M_PI / 360.0); xmax = ymax * aspectratio; + if ((r_newrefdef.rdflags & RDF_UNDERWATER) && gl1_waterwarp->value) + { + const GLdouble warp = sin(r_newrefdef.time * 1.5) * 0.03 * gl1_waterwarp->value; + ymax *= 1.0 - warp; + xmax *= 1.0 + warp; + } + ymin = -ymax; xmin = -xmax; @@ -1302,6 +1310,8 @@ R_Register(void) gl1_stereo_anaglyph_colors = ri.Cvar_Get( "gl1_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE ); gl1_stereo_convergence = ri.Cvar_Get( "gl1_stereo_convergence", "1", CVAR_ARCHIVE ); + gl1_waterwarp = ri.Cvar_Get( "gl1_waterwarp", "1.0", CVAR_ARCHIVE ); + ri.Cmd_AddCommand("imagelist", R_ImageList_f); ri.Cmd_AddCommand("screenshot", R_ScreenShot); ri.Cmd_AddCommand("modellist", Mod_Modellist_f);