From 4d192dbaa2ce64ddb0f1fd687c44e79ea152a6af Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 4 Feb 2019 15:09:01 +0000 Subject: [PATCH] Remove code for r_equalize_entities*. r_fullbright_directed and slapping EF_FULLBRIGHT on these entities works a lot better. I believe other than Xonotic nobody uses this, and Xonotic used it only to make some fullbright stuff prettier and that's been removed for a few months now. After this change, older Xonotic versions will complain about nonexisting flag at startup, but I bet no player will even notice the difference - all it changes is that EF_FULLBRIGHT entities will appear less directionally, and r_fullbright_directed 1 will fix this in a better way (already set in current Xonotic). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12474 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 59 ----------------------------------------------------- clvm_cmds.c | 3 --- csprogs.c | 3 --- gl_rmain.c | 10 --------- protocol.h | 1 - 5 files changed, 76 deletions(-) diff --git a/cl_main.c b/cl_main.c index 4fad1003..a15db142 100644 --- a/cl_main.c +++ b/cl_main.c @@ -93,8 +93,6 @@ cvar_t cl_deathnoviewmodel = {0, "cl_deathnoviewmodel", "1", "hides gun model wh cvar_t cl_locs_enable = {CVAR_SAVE, "locs_enable", "1", "enables replacement of certain % codes in chat messages: %l (location), %d (last death location), %h (health), %a (armor), %x (rockets), %c (cells), %r (rocket launcher status), %p (powerup status), %w (weapon status), %t (current time in level)"}; cvar_t cl_locs_show = {0, "locs_show", "0", "shows defined locations for editing purposes"}; -extern cvar_t r_equalize_entities_fullbright; - client_static_t cls; client_state_t cl; @@ -1166,8 +1164,6 @@ static void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean int { if (!(e->render.effects & EF_FULLBRIGHT)) e->render.flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - e->render.flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // hide player shadow during intermission or nehahra movie if (!(e->render.effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) @@ -1607,8 +1603,6 @@ static void CL_RelinkStaticEntities(void) { if (!(e->render.effects & EF_FULLBRIGHT)) e->render.flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - e->render.flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // hide player shadow during intermission or nehahra movie if (!(e->render.effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) && (e->render.alpha >= 1)) @@ -2469,9 +2463,6 @@ extern cvar_t r_fullbright_directed_pitch; extern cvar_t r_fullbright_directed_ambient; extern cvar_t r_fullbright_directed_diffuse; extern cvar_t r_fullbright_directed; -extern cvar_t r_equalize_entities_minambient; -extern cvar_t r_equalize_entities_to; -extern cvar_t r_equalize_entities_by; extern cvar_t r_hdr_glowintensity; static void CL_UpdateEntityShading_GetDirectedFullbright(vec3_t ambient, vec3_t diffuse, vec3_t worldspacenormal) @@ -2589,56 +2580,6 @@ static void CL_UpdateEntityShading_Entity(entity_render_t *ent) CL_UpdateEntityShading_GetDirectedFullbright(a, c, dir); else R_CompleteLightPoint(a, c, dir, shadingorigin, LP_LIGHTMAP, r_refdef.scene.lightmapintensity, r_refdef.scene.ambientintensity); - - if (ent->flags & RENDER_EQUALIZE) - { - // first fix up ambient lighting... - if (r_equalize_entities_minambient.value > 0) - { - fd = 0.299f * ent->render_modellight_diffuse[0] + 0.587f * ent->render_modellight_diffuse[1] + 0.114f * ent->render_modellight_diffuse[2]; - if (fd > 0) - { - fa = (0.299f * ent->render_modellight_ambient[0] + 0.587f * ent->render_modellight_ambient[1] + 0.114f * ent->render_modellight_ambient[2]); - if (fa < r_equalize_entities_minambient.value * fd) - { - // solve: - // fa'/fd' = minambient - // fa'+0.25*fd' = fa+0.25*fd - // ... - // fa' = fd' * minambient - // fd'*(0.25+minambient) = fa+0.25*fd - // ... - // fd' = (fa+0.25*fd) * 1 / (0.25+minambient) - // fa' = (fa+0.25*fd) * minambient / (0.25+minambient) - // ... - fdd = (fa + 0.25f * fd) / (0.25f + r_equalize_entities_minambient.value); - f = fdd / fd; // f>0 because all this is additive; f<1 because fdd 0 && r_equalize_entities_by.value != 0) - { - fa = 0.299f * a[0] + 0.587f * a[1] + 0.114f * a[2]; - fd = 0.299f * c[0] + 0.587f * c[1] + 0.114f * c[2]; - f = fa + 0.25 * fd; - if (f > 0) - { - // adjust brightness and saturation to target - float l2 = r_equalize_entities_by.value, l1 = 1 - l2; - for (q = 0; q < 3; q++) - { - a[q] = l1 * a[q] + l2 * (fa / f); - c[q] = l1 * c[q] + l2 * (fd / f); - } - } - } - } } for (q = 0; q < 3; q++) diff --git a/clvm_cmds.c b/clvm_cmds.c index 51f64b50..e0ac5e74 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -21,7 +21,6 @@ //4 feature darkplaces csqc: add builtins to clientside qc for gl calls extern cvar_t v_flipped; -extern cvar_t r_equalize_entities_fullbright; r_refdef_view_t csqc_original_r_refdef_view; r_refdef_view_t csqc_main_r_refdef_view; @@ -1811,8 +1810,6 @@ static void VM_CL_makestatic (prvm_prog_t *prog) { if (!(staticent->render.effects & EF_FULLBRIGHT)) staticent->render.flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - staticent->render.flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // turn off shadows from transparent objects if (!(staticent->render.effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) && (staticent->render.alpha >= 1)) diff --git a/csprogs.c b/csprogs.c index 68dbd839..88c12418 100644 --- a/csprogs.c +++ b/csprogs.c @@ -286,7 +286,6 @@ void CSQC_Think (prvm_edict_t *ed) } extern cvar_t cl_noplayershadow; -extern cvar_t r_equalize_entities_fullbright; qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) { prvm_prog_t *prog = CLVM_prog; @@ -396,8 +395,6 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) { if (!(entrender->effects & EF_FULLBRIGHT) && !(renderflags & RF_FULLBRIGHT)) entrender->flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - entrender->flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // hide player shadow during intermission or nehahra movie if (!(entrender->effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) diff --git a/gl_rmain.c b/gl_rmain.c index d6ea4baf..bb323206 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -69,12 +69,6 @@ cvar_t r_motionblur_mousefactor = {CVAR_SAVE, "r_motionblur_mousefactor", "2", " cvar_t r_motionblur_mousefactor_minspeed = {CVAR_SAVE, "r_motionblur_mousefactor_minspeed", "0", "lower value of mouse acceleration when it starts to factor into blur equation"}; cvar_t r_motionblur_mousefactor_maxspeed = {CVAR_SAVE, "r_motionblur_mousefactor_maxspeed", "50", "upper value of mouse acceleration when it reaches the peak factor into blur equation"}; -// TODO do we want a r_equalize_entities cvar that works on all ents, or would that be a cheat? -cvar_t r_equalize_entities_fullbright = {CVAR_SAVE, "r_equalize_entities_fullbright", "0", "render fullbright entities by equalizing their lightness, not by not rendering light (DEPRECATED)"}; -cvar_t r_equalize_entities_minambient = {CVAR_SAVE, "r_equalize_entities_minambient", "0.5", "light equalizing: ensure at least this ambient/diffuse ratio (DEPRECATED)"}; -cvar_t r_equalize_entities_by = {CVAR_SAVE, "r_equalize_entities_by", "0.7", "light equalizing: exponent of dynamics compression (0 = no compression, 1 = full compression) (DEPRECATED)"}; -cvar_t r_equalize_entities_to = {CVAR_SAVE, "r_equalize_entities_to", "0.8", "light equalizing: target light level (DEPRECATED)"}; - cvar_t r_depthfirst = {CVAR_SAVE, "r_depthfirst", "0", "renders a depth-only version of the scene before normal rendering begins to eliminate overdraw, values: 0 = off, 1 = world depth, 2 = world and model depth"}; cvar_t r_useinfinitefarclip = {CVAR_SAVE, "r_useinfinitefarclip", "1", "enables use of a special kind of projection matrix that has an extremely large farclip"}; cvar_t r_farclip_base = {0, "r_farclip_base", "65536", "farclip (furthest visible distance) for rendering when r_useinfinitefarclip is 0"}; @@ -3202,10 +3196,6 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_motionblur_mousefactor); Cvar_RegisterVariable(&r_motionblur_mousefactor_minspeed); Cvar_RegisterVariable(&r_motionblur_mousefactor_maxspeed); - Cvar_RegisterVariable(&r_equalize_entities_fullbright); - Cvar_RegisterVariable(&r_equalize_entities_minambient); - Cvar_RegisterVariable(&r_equalize_entities_by); - Cvar_RegisterVariable(&r_equalize_entities_to); Cvar_RegisterVariable(&r_depthfirst); Cvar_RegisterVariable(&r_useinfinitefarclip); Cvar_RegisterVariable(&r_farclip_base); diff --git a/protocol.h b/protocol.h index a3a26777..8a83cbaf 100644 --- a/protocol.h +++ b/protocol.h @@ -340,7 +340,6 @@ void Protocol_Names(char *buffer, size_t buffersize); #define RENDER_LIGHT 131072 // receive light #define RENDER_NOSELFSHADOW 262144 // render lighting on this entity before its own shadow is added to the scene // (note: all RENDER_NOSELFSHADOW entities are grouped together and rendered in a batch before their shadows are rendered, so they can not shadow eachother either) -#define RENDER_EQUALIZE 524288 // (subflag of RENDER_LIGHT) equalize the light from the light grid hitting this ent (less invasive EF_FULLBRIGHT implementation) #define RENDER_NODEPTHTEST 1048576 #define RENDER_ADDITIVE 2097152 #define RENDER_DOUBLESIDED 4194304 -- 2.39.2