Use separate r_scale8bittextures for image scale

Rename {sw,gl}_retexturing variables to r_retexturing in code.
This commit is contained in:
Denis Pauk 2021-10-17 11:11:05 +03:00
parent c280c408b1
commit 1e0d75857b
11 changed files with 31 additions and 21 deletions

View file

@ -281,7 +281,8 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* **r_retexturing**: If set to `1` (the default) and a retexturing pack
is installed, the high resolution textures are used.
If set to `2` and vulkan render is used, scale up all 8bit textures.
* **r_scale8bittextures**: If set to `1`, scale up all 8bit textures.
* **r_shadows**: Enables rendering of shadows. Quake IIs shadows are
very simple and are prone to render errors.

View file

@ -939,7 +939,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
if (bits == 8)
{
// resize 8bit images only when we forced such logic
if (gl_retexturing->value >= 2)
if (r_scale8bittextures->value)
{
byte *image_converted = malloc(width * height * 4);
scale2x(pic, image_converted, width, height);
@ -1173,7 +1173,7 @@ R_FindImage(char *name, imagetype_t type)
if (strcmp(ext, "pcx") == 0)
{
if (gl_retexturing->value)
if (r_retexturing->value)
{
GetPCXInfo(name, &realwidth, &realheight);
if(realwidth == 0)
@ -1220,7 +1220,7 @@ R_FindImage(char *name, imagetype_t type)
}
else if (strcmp(ext, "wal") == 0 || strcmp(ext, "m8") == 0)
{
if (gl_retexturing->value)
if (r_retexturing->value)
{
/* Get size of the original texture */
if (strcmp(ext, "m8") == 0)

View file

@ -100,7 +100,8 @@ cvar_t *r_fixsurfsky;
cvar_t *r_customwidth;
cvar_t *r_customheight;
cvar_t *gl_retexturing;
cvar_t *r_retexturing;
cvar_t *r_scale8bittextures;
cvar_t *gl_nolerp_list;
@ -1260,7 +1261,8 @@ R_Register(void)
r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE);
gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE );
gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE);
/* don't bilerp characters and crosshairs */
gl_nolerp_list = ri.Cvar_Get("r_nolerp_list", "pics/conchars.pcx pics/ch1.pcx pics/ch2.pcx pics/ch3.pcx", 0);

View file

@ -191,7 +191,8 @@ extern cvar_t *r_mode;
extern cvar_t *r_customwidth;
extern cvar_t *r_customheight;
extern cvar_t *gl_retexturing;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *gl_nolerp_list;

View file

@ -431,7 +431,7 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
if (bits == 8)
{
// resize 8bit images only when we forced such logic
if (gl_retexturing->value >= 2)
if (r_scale8bittextures->value)
{
byte *image_converted = malloc(width * height * 4);
scale2x(pic, image_converted, width, height);
@ -746,7 +746,7 @@ GL3_FindImage(char *name, imagetype_t type)
if (strcmp(ext, "pcx") == 0)
{
if (gl_retexturing->value)
if (r_retexturing->value)
{
GetPCXInfo(name, &realwidth, &realheight);
if(realwidth == 0)
@ -793,7 +793,7 @@ GL3_FindImage(char *name, imagetype_t type)
}
else if (strcmp(ext, "wal") == 0 || strcmp(ext, "m8") == 0)
{
if (gl_retexturing->value)
if (r_retexturing->value)
{
/* Get size of the original texture */
if (strcmp(ext, "m8") == 0)

View file

@ -79,7 +79,8 @@ const hmm_mat4 gl3_identityMat4 = {{
cvar_t *gl_msaa_samples;
cvar_t *r_vsync;
cvar_t *gl_retexturing;
cvar_t *r_retexturing;
cvar_t *r_scale8bittextures;
cvar_t *vid_fullscreen;
cvar_t *r_mode;
cvar_t *r_customwidth;
@ -197,7 +198,8 @@ GL3_Register(void)
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE);
gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE );
gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE);
gl3_debugcontext = ri.Cvar_Get("gl3_debugcontext", "0", 0);
r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE);
r_customwidth = ri.Cvar_Get("r_customwidth", "1024", CVAR_ARCHIVE);
@ -299,7 +301,7 @@ GL3_Register(void)
//r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE);
//gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE );
//gl_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
//r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE );

View file

@ -480,7 +480,8 @@ extern void GL3_UpdateUBOLights(void);
extern cvar_t *gl_msaa_samples;
extern cvar_t *r_vsync;
extern cvar_t *gl_retexturing;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *vid_fullscreen;
extern cvar_t *r_mode;
extern cvar_t *r_customwidth;

View file

@ -424,7 +424,8 @@ extern cvar_t *sw_stipplealpha;
extern cvar_t *sw_surfcacheoverride;
extern cvar_t *sw_waterwarp;
extern cvar_t *sw_gunzposition;
extern cvar_t *sw_retexturing;
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *r_fullbright;
extern cvar_t *r_lefthand;

View file

@ -339,7 +339,7 @@ RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
// we have only one image size
pic.mip_levels = 1;
if (sw_retexturing->value)
if (r_retexturing->value)
{
if (cols < (w / 3) || rows < (h / 3))
{
@ -373,7 +373,7 @@ RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
RE_Draw_StretchPicImplementation (x, y, w, h, &pic);
if (sw_retexturing->value)
if (r_retexturing->value)
{
free(image_scaled);
}

View file

@ -581,7 +581,7 @@ R_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type)
image_t *image = NULL;
// with retexturing and not skin
if (sw_retexturing->value)
if (r_retexturing->value)
{
image = R_LoadHiColorImage(name, namewe, ext, type);
}
@ -598,7 +598,7 @@ R_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type)
if (!pic)
return NULL;
if (sw_retexturing->value == 2 && type == it_pic)
if (r_scale8bittextures->value && type == it_pic)
{
byte *scaled = NULL;
int realwidth, realheight;

View file

@ -146,7 +146,8 @@ static cvar_t *sw_overbrightbits;
cvar_t *sw_custom_particles;
static cvar_t *sw_anisotropic;
cvar_t *sw_texture_filtering;
cvar_t *sw_retexturing;
cvar_t *r_retexturing;
cvar_t *r_scale8bittextures;
cvar_t *sw_gunzposition;
static cvar_t *sw_partialrefresh;
@ -375,7 +376,8 @@ R_RegisterVariables (void)
sw_custom_particles = ri.Cvar_Get("sw_custom_particles", "0", CVAR_ARCHIVE);
sw_texture_filtering = ri.Cvar_Get("sw_texture_filtering", "0", CVAR_ARCHIVE);
sw_anisotropic = ri.Cvar_Get("r_anisotropic", "0", CVAR_ARCHIVE);
sw_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE);
r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE);
sw_gunzposition = ri.Cvar_Get("sw_gunzposition", "8", CVAR_ARCHIVE);
// On MacOS texture is cleaned up after render and code have to copy a whole