From 74ac58eb5add08f0989b9fae783d4d4b5bd3af66 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Tue, 9 Jan 2018 14:51:59 +0100 Subject: [PATCH] Rename gl_stereo* to gl1_stereo*. --- src/client/cl_main.c | 12 ++++----- src/client/cl_screen.c | 6 ++--- src/client/cl_view.c | 2 +- src/client/header/client.h | 6 ++--- src/client/refresh/gl/header/local.h | 2 +- src/client/refresh/gl/r_main.c | 40 ++++++++++++++-------------- src/client/refresh/gl/r_mesh.c | 4 +-- src/client/refresh/gl3/gl3_main.c | 29 +++++++++----------- src/common/cvar.c | 7 ++++- stuff/cvarlist.md | 2 +- 10 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/client/cl_main.c b/src/client/cl_main.c index a39ea40f..73e9b69a 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -79,9 +79,9 @@ cvar_t *hand; cvar_t *gender; cvar_t *gender_auto; -cvar_t *gl_stereo; -cvar_t *gl_stereo_separation; -cvar_t *gl_stereo_convergence; +cvar_t *gl1_stereo; +cvar_t *gl1_stereo_separation; +cvar_t *gl1_stereo_convergence; cvar_t *cl_vwep; @@ -508,9 +508,9 @@ CL_InitLocal(void) cl_timeout = Cvar_Get("cl_timeout", "120", 0); cl_paused = Cvar_Get("paused", "0", 0); - gl_stereo = Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE ); - gl_stereo_separation = Cvar_Get( "gl_stereo_separation", "1", CVAR_ARCHIVE ); - gl_stereo_convergence = Cvar_Get( "gl_stereo_convergence", "1.4", CVAR_ARCHIVE ); + gl1_stereo = Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); + gl1_stereo_separation = Cvar_Get( "gl1_stereo_separation", "1", CVAR_ARCHIVE ); + gl1_stereo_convergence = Cvar_Get( "gl1_stereo_convergence", "1.4", CVAR_ARCHIVE ); rcon_client_password = Cvar_Get("rcon_password", "", 0); rcon_address = Cvar_Get("rcon_address", "", 0); diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index 82d59aef..116450ae 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -1518,11 +1518,11 @@ SCR_UpdateScreen(void) return; /* not initialized yet */ } - if ( gl_stereo->value ) + if ( gl1_stereo->value ) { numframes = 2; - separation[0] = -gl_stereo_separation->value / 2; - separation[1] = +gl_stereo_separation->value / 2; + separation[0] = -gl1_stereo_separation->value / 2; + separation[1] = +gl1_stereo_separation->value / 2; } else { diff --git a/src/client/cl_view.c b/src/client/cl_view.c index e2e07d6e..404e341c 100644 --- a/src/client/cl_view.c +++ b/src/client/cl_view.c @@ -584,7 +584,7 @@ V_RenderView(float stereo_separation) qsort(cl.refdef.entities, cl.refdef.num_entities, sizeof(cl.refdef.entities[0]), (int (*)(const void *, const void *)) entitycmpfnc); - } else if (cl.frame.valid && cl_paused->value && gl_stereo->value) { + } else if (cl.frame.valid && cl_paused->value && gl1_stereo->value) { // We need to adjust the refdef in stereo mode when paused. vec3_t tmp; CL_CalcViewValues(); diff --git a/src/client/header/client.h b/src/client/header/client.h index 9c58b0eb..0f1104c7 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -255,9 +255,9 @@ extern client_static_t cls; extern int num_power_sounds; /* cvars */ -extern cvar_t *gl_stereo_separation; -extern cvar_t *gl_stereo_convergence; -extern cvar_t *gl_stereo; +extern cvar_t *gl1_stereo_separation; +extern cvar_t *gl1_stereo_convergence; +extern cvar_t *gl1_stereo; extern cvar_t *cl_gun; extern cvar_t *cl_add_blend; extern cvar_t *cl_add_lights; diff --git a/src/client/refresh/gl/header/local.h b/src/client/refresh/gl/header/local.h index edbb0b11..dfb9139c 100644 --- a/src/client/refresh/gl/header/local.h +++ b/src/client/refresh/gl/header/local.h @@ -197,7 +197,7 @@ extern cvar_t *gl_nolerp_list; extern cvar_t *gl_lightmap; extern cvar_t *gl_shadows; -extern cvar_t *gl_stencilshadow; +extern cvar_t *gl1_stencilshadow; extern cvar_t *gl1_dynamic; extern cvar_t *gl_nobind; extern cvar_t *gl1_round_down; diff --git a/src/client/refresh/gl/r_main.c b/src/client/refresh/gl/r_main.c index 15d1c894..84491305 100644 --- a/src/client/refresh/gl/r_main.c +++ b/src/client/refresh/gl/r_main.c @@ -95,7 +95,7 @@ cvar_t *gl1_pointparameters; cvar_t *gl_drawbuffer; cvar_t *gl_lightmap; cvar_t *gl_shadows; -cvar_t *gl_stencilshadow; +cvar_t *gl1_stencilshadow; cvar_t *r_mode; cvar_t *r_customwidth; @@ -131,10 +131,10 @@ cvar_t *gl_msaa_samples; cvar_t *vid_fullscreen; cvar_t *vid_gamma; -cvar_t *gl_stereo; -cvar_t *gl_stereo_separation; -cvar_t *gl_stereo_anaglyph_colors; -cvar_t *gl_stereo_convergence; +cvar_t *gl1_stereo; +cvar_t *gl1_stereo_separation; +cvar_t *gl1_stereo_anaglyph_colors; +cvar_t *gl1_stereo_convergence; refimport_t ri; @@ -750,8 +750,8 @@ R_MYgluPerspective(GLdouble fovy, GLdouble aspect, xmin = ymin * aspect; xmax = ymax * aspect; - xmin += - gl_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; - xmax += - gl_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; + xmin += - gl1_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; + xmax += - gl1_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; glFrustum(xmin, xmax, ymin, ymax, zNear, zFar); } @@ -897,7 +897,7 @@ R_Clear(void) } /* stencilbuffer shadows */ - if (gl_shadows->value && have_stencil && gl_stencilshadow->value) + if (gl_shadows->value && have_stencil && gl1_stencilshadow->value) { glClearStencil(1); glClear(GL_STENCIL_BUFFER_BIT); @@ -963,12 +963,12 @@ R_RenderView(refdef_t *fd) // Work out the colour for each eye. int anaglyph_colours[] = { 0x4, 0x3 }; // Left = red, right = cyan. - if (strlen(gl_stereo_anaglyph_colors->string) == 2) { + if (strlen(gl1_stereo_anaglyph_colors->string) == 2) { int eye, colour, missing_bits; // Decode the colour name from its character. for (eye = 0; eye < 2; ++eye) { colour = 0; - switch (toupper(gl_stereo_anaglyph_colors->string[eye])) { + switch (toupper(gl1_stereo_anaglyph_colors->string[eye])) { case 'B': ++colour; // 001 Blue case 'G': ++colour; // 010 Green case 'C': ++colour; // 011 Cyan @@ -1222,7 +1222,7 @@ R_Register(void) r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE); gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE); - gl_stencilshadow = ri.Cvar_Get("gl_stencilshadow", "0", CVAR_ARCHIVE); + gl1_stencilshadow = ri.Cvar_Get("gl1_stencilshadow", "0", CVAR_ARCHIVE); gl1_dynamic = ri.Cvar_Get("gl1_dynamic", "1", 0); gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); gl1_round_down = ri.Cvar_Get("gl1_round_down", "1", 0); @@ -1263,10 +1263,10 @@ R_Register(void) /* 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); - gl_stereo = ri.Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE ); - gl_stereo_separation = ri.Cvar_Get( "gl_stereo_separation", "-0.4", CVAR_ARCHIVE ); - gl_stereo_anaglyph_colors = ri.Cvar_Get( "gl_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE ); - gl_stereo_convergence = ri.Cvar_Get( "gl_stereo_convergence", "1", CVAR_ARCHIVE ); + gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); + gl1_stereo_separation = ri.Cvar_Get( "gl1_stereo_separation", "-0.4", CVAR_ARCHIVE ); + 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 ); ri.Cmd_AddCommand("imagelist", R_ImageList_f); ri.Cmd_AddCommand("screenshot", R_ScreenShot); @@ -1419,7 +1419,7 @@ RI_Init() /* set our "safe" mode */ gl_state.prev_mode = 4; - gl_state.stereo_mode = gl_stereo->value; + gl_state.stereo_mode = gl1_stereo->value; /* create the window and set up the context */ if (!R_SetMode()) @@ -1605,11 +1605,11 @@ RI_BeginFrame(float camera_separation) vid_fullscreen->modified = true; } - // force a vid_restart if gl_stereo has been modified. - if ( gl_state.stereo_mode != gl_stereo->value ) { + // force a vid_restart if gl1_stereo has been modified. + if ( gl_state.stereo_mode != gl1_stereo->value ) { // If we've gone from one mode to another with the same special buffer requirements there's no need to restart. - if ( GL_GetSpecialBufferModeForStereoMode( gl_state.stereo_mode ) == GL_GetSpecialBufferModeForStereoMode( gl_stereo->value ) ) { - gl_state.stereo_mode = gl_stereo->value; + if ( GL_GetSpecialBufferModeForStereoMode( gl_state.stereo_mode ) == GL_GetSpecialBufferModeForStereoMode( gl1_stereo->value ) ) { + gl_state.stereo_mode = gl1_stereo->value; } else { diff --git a/src/client/refresh/gl/r_mesh.c b/src/client/refresh/gl/r_mesh.c index df385dae..9caf0e68 100644 --- a/src/client/refresh/gl/r_mesh.c +++ b/src/client/refresh/gl/r_mesh.c @@ -266,7 +266,7 @@ R_DrawAliasShadow(dmdl_t *paliashdr, int posenum) height = -lheight + 0.1f; /* stencilbuffer shadows */ - if (have_stencil && gl_stencilshadow->value) + if (have_stencil && gl1_stencilshadow->value) { glEnable(GL_STENCIL_TEST); glStencilFunc(GL_EQUAL, 1, 2); @@ -324,7 +324,7 @@ R_DrawAliasShadow(dmdl_t *paliashdr, int posenum) } /* stencilbuffer shadows */ - if (have_stencil && gl_stencilshadow->value) + if (have_stencil && gl1_stencilshadow->value) { glDisable(GL_STENCIL_TEST); } diff --git a/src/client/refresh/gl3/gl3_main.c b/src/client/refresh/gl3/gl3_main.c index a3bc58a9..b893883c 100644 --- a/src/client/refresh/gl3/gl3_main.c +++ b/src/client/refresh/gl3/gl3_main.c @@ -122,8 +122,6 @@ cvar_t *r_fullbright; cvar_t *r_modulate; cvar_t *gl_lightmap; cvar_t *gl_shadows; -// no gl_stencilshadows, always use stencil (if available) - cvar_t *gl3_debugcontext; // Yaw-Pitch-Roll @@ -266,7 +264,6 @@ GL3_Register(void) //r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE); //gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); //gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE); - //gl_stencilshadow = ri.Cvar_Get("gl_stencilshadow", "0", CVAR_ARCHIVE); //gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0); gl_showbbox = Cvar_Get("gl_showbbox", "0", 0); @@ -300,10 +297,10 @@ GL3_Register(void) //gl_retexturing = ri.Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE); - gl_stereo = ri.Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE ); - gl_stereo_separation = ri.Cvar_Get( "gl_stereo_separation", "-0.4", CVAR_ARCHIVE ); - gl_stereo_anaglyph_colors = ri.Cvar_Get( "gl_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE ); - gl_stereo_convergence = ri.Cvar_Get( "gl_stereo_convergence", "1", CVAR_ARCHIVE ); + gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); + gl1_stereo_separation = ri.Cvar_Get( "gl1_stereo_separation", "-0.4", CVAR_ARCHIVE ); + 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 ); #endif // 0 ri.Cmd_AddCommand("imagelist", GL3_ImageList_f); @@ -467,7 +464,7 @@ GL3_Init(void) /* set our "safe" mode */ gl3state.prev_mode = 4; - //gl_state.stereo_mode = gl_stereo->value; + //gl_state.stereo_mode = gl1_stereo->value; /* create the window and set up the context */ if (!GL3_SetMode()) @@ -1183,8 +1180,8 @@ GL3_MYgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zF right = top * aspect; // TODO: stereo stuff - // left += - gl_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; - // right += - gl_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; + // left += - gl1_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; + // right += - gl1_stereo_convergence->value * (2 * gl_state.camera_separation) / zNear; // the following emulates glFrustum(left, right, bottom, top, zNear, zFar) // see https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml @@ -1306,12 +1303,12 @@ GL3_RenderView(refdef_t *fd) // Work out the colour for each eye. int anaglyph_colours[] = { 0x4, 0x3 }; // Left = red, right = cyan. - if (strlen(gl_stereo_anaglyph_colors->string) == 2) { + if (strlen(gl1_stereo_anaglyph_colors->string) == 2) { int eye, colour, missing_bits; // Decode the colour name from its character. for (eye = 0; eye < 2; ++eye) { colour = 0; - switch (toupper(gl_stereo_anaglyph_colors->string[eye])) { + switch (toupper(gl1_stereo_anaglyph_colors->string[eye])) { case 'B': ++colour; // 001 Blue case 'G': ++colour; // 010 Green case 'C': ++colour; // 011 Cyan @@ -1611,11 +1608,11 @@ GL3_BeginFrame(float camera_separation) #if 0 // TODO: stereo stuff gl_state.camera_separation = camera_separation; - // force a vid_restart if gl_stereo has been modified. - if ( gl_state.stereo_mode != gl_stereo->value ) { + // force a vid_restart if gl1_stereo has been modified. + if ( gl_state.stereo_mode != gl1_stereo->value ) { // If we've gone from one mode to another with the same special buffer requirements there's no need to restart. - if ( GL_GetSpecialBufferModeForStereoMode( gl_state.stereo_mode ) == GL_GetSpecialBufferModeForStereoMode( gl_stereo->value ) ) { - gl_state.stereo_mode = gl_stereo->value; + if ( GL_GetSpecialBufferModeForStereoMode( gl_state.stereo_mode ) == GL_GetSpecialBufferModeForStereoMode( gl1_stereo->value ) ) { + gl_state.stereo_mode = gl1_stereo->value; } else { diff --git a/src/common/cvar.c b/src/common/cvar.c index 2eac16ae..9bfaeae4 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -71,7 +71,12 @@ replacement_t replacements[] = { {"gl_pointparameters", "gl1_pointparameters"}, {"gl_polyblend", "gl1_polyblend"}, {"gl_round_down", "gl1_round_down"}, - {"gl_saturatelightning", "gl1_saturatelightning"} + {"gl_saturatelightning", "gl1_saturatelightning"}, + {"gl_stencilshadows", "gl1_stencilshadows"}, + {"gl_stereo", "gl1_stereo"}, + {"gl_stereo_separation", "gl1_stereo_separation"}, + {"gl_stereo_anaglyph_colors", "gl1_stereo_anaglyph_colors"}, + {"gl_stereo_convergence", "gl1_stereo_convergence"} }; diff --git a/stuff/cvarlist.md b/stuff/cvarlist.md index f657e267..0d58d679 100644 --- a/stuff/cvarlist.md +++ b/stuff/cvarlist.md @@ -163,7 +163,7 @@ Graphics (GL1 only): for water), `2` (scale by factor 2) and `3` (scale by factor 3). Applied in realtime, does not need `vid_restart`. -* **gl_stencilshadow**: If `gl_shadows` is set to `1`, this makes them +* **gl1_stencilshadow**: If `gl_shadows` is set to `1`, this makes them look a bit better (no flickering) by using the stencil buffer. (This is always done in GL3, so not configurable there)