From 0ea8f691e05ea968bb8940942197fa627966ff99 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 4 Feb 2019 15:08:59 +0000 Subject: [PATCH] Remove code for r_fakelight. We have r_fullbright_directed now, which uses no shader permutation bit and has a very similar effect. Yay, less shaders! git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12473 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 59 +++------------------------------------------------ render.h | 1 - shader_glsl.h | 7 +----- 3 files changed, 4 insertions(+), 63 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index e96bbba8..d6ea4baf 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -117,10 +117,6 @@ cvar_t r_sortentities = {0, "r_sortentities", "0", "sort entities before drawing cvar_t r_speeds = {0, "r_speeds","0", "displays rendering statistics and per-subsystem timings"}; cvar_t r_fullbright = {0, "r_fullbright","0", "makes map very bright and renders faster"}; -cvar_t r_fakelight = {0, "r_fakelight","0", "render 'fake' lighting instead of real lightmaps (DEPRECATED)"}; -cvar_t r_fakelight_intensity = {0, "r_fakelight_intensity","0.75", "fakelight intensity modifier (DEPRECATED)"}; -#define FAKELIGHT_ENABLED (r_fakelight.integer >= 2 || (r_fakelight.integer && r_refdef.scene.worldmodel && !r_refdef.scene.worldmodel->lit)) - cvar_t r_fullbright_directed = {0, "r_fullbright_directed", "0", "render fullbright things (unlit worldmodel and EF_FULLBRIGHT entities, but not fullbright shaders) using a constant light direction instead to add more depth while keeping uniform brightness"}; cvar_t r_fullbright_directed_ambient = {0, "r_fullbright_directed_ambient", "0.5", "ambient light multiplier for directed fullbright"}; cvar_t r_fullbright_directed_diffuse = {0, "r_fullbright_directed_diffuse", "0.75", "diffuse light multiplier for directed fullbright"}; @@ -698,7 +694,6 @@ shadermodeinfo_t shadermodeinfo[SHADERLANGUAGE_COUNT][SHADERMODE_COUNT] = {"combined", "glsl", builtinshaderstrings, "#define MODE_FLATCOLOR\n", " flatcolor"}, {"combined", "glsl", builtinshaderstrings, "#define MODE_VERTEXCOLOR\n", " vertexcolor"}, {"combined", "glsl", builtinshaderstrings, "#define MODE_LIGHTMAP\n", " lightmap"}, - {"combined", "glsl", builtinshaderstrings, "#define MODE_FAKELIGHT\n", " fakelight"}, {"combined", "glsl", builtinshaderstrings, "#define MODE_LIGHTDIRECTIONMAP_MODELSPACE\n", " lightdirectionmap_modelspace"}, {"combined", "glsl", builtinshaderstrings, "#define MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n", " lightdirectionmap_tangentspace"}, {"combined", "glsl", builtinshaderstrings, "#define MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP\n", " lightdirectionmap_forced_lightmap"}, @@ -1797,15 +1792,7 @@ void R_SetupShader_Surface(const float rtlightambient[3], const float rtlightdif permutation |= SHADERPERMUTATION_DEFERREDLIGHTMAP; if (t->reflectmasktexture) permutation |= SHADERPERMUTATION_REFLECTCUBE; - if (FAKELIGHT_ENABLED) - { - // fake lightmapping (q1bsp, q3bsp, fullbright map) - mode = SHADERMODE_FAKELIGHT; - permutation |= SHADERPERMUTATION_DIFFUSE; - if (VectorLength2(t->render_lightmap_specular) > 0) - permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE; - } - else if (r_glsl_deluxemapping.integer >= 1 && rsurface.uselightmaptexture && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brushq3.deluxemapping) + if (r_glsl_deluxemapping.integer >= 1 && rsurface.uselightmaptexture && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brushq3.deluxemapping) { // deluxemapping (light direction texture) if (rsurface.uselightmaptexture && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brushq3.deluxemapping && r_refdef.scene.worldmodel->brushq3.deluxemapping_modelspace) @@ -3262,8 +3249,6 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_fullbrights); Cvar_RegisterVariable(&r_wateralpha); Cvar_RegisterVariable(&r_dynamic); - Cvar_RegisterVariable(&r_fakelight); - Cvar_RegisterVariable(&r_fakelight_intensity); Cvar_RegisterVariable(&r_fullbright_directed); Cvar_RegisterVariable(&r_fullbright_directed_ambient); Cvar_RegisterVariable(&r_fullbright_directed_diffuse); @@ -5510,11 +5495,7 @@ void R_UpdateVariables(void) r_refdef.scene.rtdlight = r_shadow_realtime_dlight.integer != 0 && !gl_flashblend.integer && r_dynamic.integer; r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && vid.stencil; r_refdef.scene.lightmapintensity = r_refdef.scene.rtworld ? r_shadow_realtime_world_lightmaps.value : 1; - if (FAKELIGHT_ENABLED) - { - r_refdef.scene.lightmapintensity *= r_fakelight_intensity.value; - } - else if (r_refdef.scene.worldmodel) + if (r_refdef.scene.worldmodel) { r_refdef.scene.lightmapintensity *= r_refdef.scene.worldmodel->lightmapscale; } @@ -6713,24 +6694,6 @@ texture_t *R_GetCurrentTexture(texture_t *t) t->render_rtlight_specular[q] = 0; } } - else if (FAKELIGHT_ENABLED) - { - // no modellight if using fakelight for the map - t->currentmaterialflags = (t->currentmaterialflags | MATERIALFLAG_NORTLIGHT) & ~(MATERIALFLAG_MODELLIGHT); - for (q = 0; q < 3; q++) - { - t->render_glowmod[q] = rsurface.entity->render_glowmod[q] * r_refdef.view.colorscale; - t->render_modellight_lightdir[q] = rsurface.entity->render_modellight_lightdir[q]; - t->render_modellight_ambient[q] = rsurface.entity->render_modellight_ambient[q] * r_refdef.view.colorscale; - t->render_modellight_diffuse[q] = rsurface.entity->render_modellight_diffuse[q] * r_refdef.view.colorscale; - t->render_modellight_specular[q] = rsurface.entity->render_modellight_specular[q] * r_refdef.view.colorscale; - t->render_lightmap_ambient[q] = 0; - t->render_lightmap_diffuse[q] = 0; - t->render_lightmap_specular[q] = 0; - t->render_rtlight_diffuse[q] = 0; - t->render_rtlight_specular[q] = 0; - } - } else if ((rsurface.ent_flags & (RENDER_DYNAMICMODELLIGHT | RENDER_CUSTOMIZEDMODELLIGHT)) || rsurface.modeltexcoordlightmap2f == NULL) { // ambient + single direction light (modellight) @@ -8944,21 +8907,6 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const endsurface = min(i + MESHQUEUE_TRANSPARENT_BATCHSIZE, numsurfaces); texturenumsurfaces = 0; texturesurfacelist[texturenumsurfaces++] = surface; - if(FAKELIGHT_ENABLED) - { - rsurface.lightmaptexture = NULL; - rsurface.deluxemaptexture = NULL; - rsurface.uselightmaptexture = false; - for (;j < endsurface;j++) - { - surface = rsurface.modelsurfaces + surfacelist[j]; - if (texture != surface->texture) - break; - texturesurfacelist[texturenumsurfaces++] = surface; - } - } - else - { rsurface.lightmaptexture = surface->lightmaptexture; rsurface.deluxemaptexture = surface->deluxemaptexture; rsurface.uselightmaptexture = surface->lightmaptexture != NULL; @@ -8969,7 +8917,6 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const break; texturesurfacelist[texturenumsurfaces++] = surface; } - } // render the range of surfaces R_DrawModelTextureSurfaceList(texturenumsurfaces, texturesurfacelist, false, false); } @@ -9077,7 +9024,7 @@ static void R_QueueModelSurfaceList(entity_render_t *ent, int numsurfaces, const ; continue; } - if(FAKELIGHT_ENABLED || depthonly || prepass) + if(depthonly || prepass) { rsurface.lightmaptexture = NULL; rsurface.deluxemaptexture = NULL; diff --git a/render.h b/render.h index 62330792..a9869dc6 100644 --- a/render.h +++ b/render.h @@ -54,7 +54,6 @@ typedef enum shadermode_e SHADERMODE_FLATCOLOR, ///< (lightmap) modulate texture by uniform color (q1bsp, q3bsp) SHADERMODE_VERTEXCOLOR, ///< (lightmap) modulate texture by vertex colors (q3bsp) SHADERMODE_LIGHTMAP, ///< (lightmap) modulate texture by lightmap texture (q1bsp, q3bsp) - SHADERMODE_FAKELIGHT, ///< (fakelight) modulate texture by "fake" lighting (no lightmaps, no nothing) SHADERMODE_LIGHTDIRECTIONMAP_MODELSPACE, ///< (lightmap) use directional pixel shading from texture containing modelspace light directions (q3bsp deluxemap) SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE, ///< (lightmap) use directional pixel shading from texture containing tangentspace light directions (q1bsp deluxemap) SHADERMODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP, // forced deluxemapping for lightmapped surfaces diff --git a/shader_glsl.h b/shader_glsl.h index 36542c53..aef2bb92 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -119,7 +119,7 @@ "#if defined(MODE_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_MODELSPACE) || defined(MODE_LIGHTDIRECTIONMAP_TANGENTSPACE) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP)\n", "# define USELIGHTMAP\n", "#endif\n", -"#if defined(USESPECULAR) || defined(USEOFFSETMAPPING) || defined(USEREFLECTCUBE) || defined(MODE_FAKELIGHT) || defined(USEFOG)\n", +"#if defined(USESPECULAR) || defined(USEOFFSETMAPPING) || defined(USEREFLECTCUBE) || defined(USEFOG)\n", "# define USEEYEVECTOR\n", "#endif\n", "\n", @@ -1579,11 +1579,6 @@ " myhalf3 lightcolor = cast_myhalf3(VertexColor.rgb);\n", " #endif\n", "#endif\n", -"#ifdef MODE_FAKELIGHT\n", -" #define SHADING\n", -" myhalf3 lightnormal = cast_myhalf3(normalize(EyeVectorFogDepth.xyz));\n", -" #define lightcolor 1\n", -"#endif // MODE_FAKELIGHT\n", "\n", "\n", "\n", -- 2.39.2