]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Remove code for r_equalize_entities*.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Feb 2019 15:09:01 +0000 (15:09 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Feb 2019 15:09:01 +0000 (15:09 +0000)
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
clvm_cmds.c
csprogs.c
gl_rmain.c
protocol.h

index 4fad1003ec56325bb0092db482fc11e62dab20a4..a15db14280d9b655bd5da9a395d92e24eb6747a7 100644 (file)
--- 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<fd because this follows from fa < r_equalize_entities_minambient.value * fd
-                                               for (q = 0; q < 3; q++)
-                                               {
-                                                       a[q] = (1 - f)*0.25f * c[q];
-                                                       c[q] *= f;
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (r_equalize_entities_to.value > 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++)
index 51f64b5073ff01a1d77a8f30805aad2fdb859c08..e0ac5e74679b4ad1c0a3bcac1ce761e7a40f77c5 100644 (file)
@@ -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))
index 68dbd8394cabd71119ad0dcf2df71ed339b1efa1..88c1241820b75d4d20bb999bb09b4239f967f3f3 100644 (file)
--- 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))
index d6ea4baf56561ff29fee0d6fb6142aae31d9cd09..bb323206fe27870d744c0aa9be6ddf0502d7b8e7 100644 (file)
@@ -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);
index a3a267774ecfd1ce120068f1e00bc53166af1637..8a83cbaf8cf7c2dbb1d2b0b2179dcd2f1e52567a 100644 (file)
@@ -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