Hide the fix for sky surfaces missused for indoor lighting begind cvar.

All renderers had the fix, but it was only optional in the GL renderers.
And there it was missimplemented, cvars must be defined in the renderers
main() function. Otherwise they aren't available at startup.

Rename gl_fixsurfsky to r_fixsurfsky, implement it for all renderers and
enable it by default.
This commit is contained in:
Yamagi 2021-01-17 10:25:09 +01:00
parent 531cbdcdae
commit f01998896f
13 changed files with 32 additions and 17 deletions

View File

@ -209,6 +209,12 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
to `1` the limit is increased to 8192 units. This helps with some
custom maps and is problematic with other custom maps.
* **r_fixsurfsky**: Some maps misuse sky surfaces for interior
lightning. The original renderer had a bug that made such surfaces
mess up the lightning of entities near them. If set to `0` (the
default) the bug is there and maps look like their developers
intended. If set to `1` the bug is fixed and the lightning correct.
* **r_vsync**: Enables the vsync: frames are synchronized with
display refresh rate, should (but doesn't always) prevent tearing.
Set to `1` for normal vsync and `2` for adaptive vsync.
@ -247,12 +253,6 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
and `16`. Anisotropic filtering gives a huge improvement to texture
quality by a negligible performance impact.
* **gl_fixsurfsky**: Some maps misuse sky surfaces for interior
lightning. The original renderer had a bug that made such surfaces
mess up the lightning of entities near them. If set to `0` (the
default) the bug is there and maps look like their developers
intended. If set to `1` the bug is fixed and the lightning correct.
* **gl_msaa_samples**: Full scene anti aliasing samples. The number of
samples depends on the GPU driver, most drivers support at least `2`,
`4` and `8` samples. If an invalid value is set, the value is reverted

View File

@ -98,6 +98,7 @@ cvar_t *gl_lightmap;
cvar_t *gl_shadows;
cvar_t *gl1_stencilshadow;
cvar_t *r_mode;
cvar_t *r_fixsurfsky;
cvar_t *r_customwidth;
cvar_t *r_customheight;
@ -1239,6 +1240,7 @@ R_Register(void)
gl_cull = ri.Cvar_Get("gl_cull", "1", 0);
gl1_polyblend = ri.Cvar_Get("gl1_polyblend", "1", 0);
gl1_flashblend = ri.Cvar_Get("gl1_flashblend", "0", 0);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "1", CVAR_ARCHIVE);
gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE);
gl1_texturealphamode = ri.Cvar_Get("gl1_texturealphamode", "default", CVAR_ARCHIVE);

View File

@ -583,8 +583,6 @@ Mod_LoadFaces(lump_t *l)
int planenum, side;
int ti;
cvar_t* gl_fixsurfsky = ri.Cvar_Get("gl_fixsurfsky", "0", CVAR_ARCHIVE);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
@ -663,7 +661,7 @@ Mod_LoadFaces(lump_t *l)
R_SubdivideSurface(out); /* cut up polygon for warps */
}
if (gl_fixsurfsky->value)
if (r_fixsurfsky->value)
{
if (out->texinfo->flags & SURF_SKY)
{

View File

@ -173,6 +173,7 @@ extern cvar_t *r_speeds;
extern cvar_t *r_fullbright;
extern cvar_t *r_novis;
extern cvar_t *r_lerpmodels;
extern cvar_t *r_fixsurfsky;
extern cvar_t *r_lightlevel;
extern cvar_t *gl1_overbrightbits;

View File

@ -122,6 +122,7 @@ cvar_t *gl_lightmap;
cvar_t *gl_shadows;
cvar_t *gl3_debugcontext;
cvar_t *gl3_usebigvbo;
cvar_t *r_fixsurfsky;
// Yaw-Pitch-Roll
// equivalent to R_z * R_y * R_x where R_x is the trans matrix for rotating around X axis for aroundXdeg
@ -216,6 +217,7 @@ GL3_Register(void)
r_drawentities = ri.Cvar_Get("r_drawentities", "1", 0);
r_drawworld = ri.Cvar_Get("r_drawworld", "1", 0);
r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "1", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */
gl_nolerp_list = ri.Cvar_Get("gl_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);

View File

@ -469,8 +469,6 @@ Mod_LoadFaces(lump_t *l)
int planenum, side;
int ti;
cvar_t* gl_fixsurfsky = ri.Cvar_Get("gl_fixsurfsky", "0", CVAR_ARCHIVE);
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
@ -549,7 +547,7 @@ Mod_LoadFaces(lump_t *l)
GL3_SubdivideSurface(out, loadmodel); /* cut up polygon for warps */
}
if (gl_fixsurfsky->value)
if (r_fixsurfsky->value)
{
if (out->texinfo->flags & SURF_SKY)
{

View File

@ -516,6 +516,7 @@ extern cvar_t *gl3_particle_square;
extern cvar_t *r_modulate;
extern cvar_t *gl_lightmap;
extern cvar_t *gl_shadows;
extern cvar_t *r_fixsurfsky;
extern cvar_t *gl3_debugcontext;

View File

@ -428,6 +428,7 @@ extern cvar_t *r_drawworld;
extern cvar_t *r_lerpmodels;
extern cvar_t *r_lightlevel;
extern cvar_t *r_modulate;
extern cvar_t *r_fixsurfsky;
extern clipplane_t view_clipplanes[4];

View File

@ -164,6 +164,7 @@ static cvar_t *r_customheight;
static cvar_t *r_speeds;
cvar_t *r_lightlevel; //FIXME HACK
cvar_t *r_fixsurfsky;
static cvar_t *vid_fullscreen;
static cvar_t *vid_gamma;
@ -403,6 +404,7 @@ R_RegisterVariables (void)
r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE);
r_customwidth = ri.Cvar_Get("r_customwidth", "1024", CVAR_ARCHIVE);
r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "1", CVAR_ARCHIVE);
vid_fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", CVAR_ARCHIVE );
vid_gamma = ri.Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE );

View File

@ -661,10 +661,14 @@ Mod_LoadFaces (lump_t *l)
if (!out->texinfo->image)
continue;
if (out->texinfo->flags & SURF_SKY)
if (r_fixsurfsky->value)
{
out->flags |= SURF_DRAWSKY;
continue;
if (out->texinfo->flags & SURF_SKY)
{
out->flags |= SURF_DRAWSKY;
continue;
}
}
if (out->texinfo->flags & SURF_WARP)

View File

@ -165,6 +165,7 @@ 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 *r_fixsurfsky;
extern cvar_t *vid_fullscreen;
extern cvar_t *vid_gamma;

View File

@ -647,9 +647,12 @@ static void Mod_LoadFaces (model_t *loadmodel, byte *mod_base, lump_t *l)
Vk_SubdivideSurface(out, loadmodel); // cut up polygon for warps
}
if (out->texinfo->flags & SURF_SKY)
if (r_fixsurfsky->value)
{
out->flags |= SURF_DRAWSKY;
if (out->texinfo->flags & SURF_SKY)
{
out->flags |= SURF_DRAWSKY;
}
}
// create lightmaps and polygons

View File

@ -126,6 +126,7 @@ cvar_t *vk_device_idx;
cvar_t *vk_retexturing;
cvar_t *vk_underwater;
cvar_t *vk_nolerp_list;
cvar_t *r_fixsurfsky;
cvar_t *vid_fullscreen;
cvar_t *vid_gamma;
@ -1228,6 +1229,7 @@ R_Register( void )
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);
r_fixsurfsky = ri.Cvar_Get("r_fixsurfsky", "1", CVAR_ARCHIVE);
// clamp vk_msaa to accepted range so that video menu doesn't crash on us
if (vk_msaa->value < 0)