Disable r_dynamic when r_shadow_realtime_dlight is active (both at the same time is a waste of processing time). Also treat the rerelease's world lights as dlights instead of just world lights, which should give behaviour closer to what's expected.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6190 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-02-19 20:48:59 +00:00
parent c5daf67332
commit bd64ae2d17
5 changed files with 21 additions and 22 deletions

View file

@ -2972,6 +2972,8 @@ void Surf_DrawWorld (void)
currentmodel = cl.worldmodel; currentmodel = cl.worldmodel;
currententity = &r_worldentity; currententity = &r_worldentity;
r_dynamic.ival = r_dynamic.value;
{ {
#ifdef THREADEDWORLD #ifdef THREADEDWORLD
int sc = r_temporalscenecache.ival; int sc = r_temporalscenecache.ival;
@ -3010,9 +3012,7 @@ void Surf_DrawWorld (void)
} }
if (!r_temporalscenecache.ival) if (!r_temporalscenecache.ival)
{ ;
r_dynamic.ival = r_dynamic.value;
}
else if (!r_refdef.recurse && currentmodel->type == mod_brush) else if (!r_refdef.recurse && currentmodel->type == mod_brush)
{ {
struct webostate_s *webostate, *best = NULL, *kill, **link; struct webostate_s *webostate, *best = NULL, *kill, **link;
@ -3214,6 +3214,8 @@ void Surf_DrawWorld (void)
} }
#endif #endif
if (r_shadow_realtime_dlight.ival || currentmodel->type != mod_brush || !(currentmodel->fromgame == fg_quake || currentmodel->fromgame == fg_halflife) || !currentmodel->funcs.MarkLights)
r_dynamic.ival = -1;
Surf_PushChains(currentmodel->batches); Surf_PushChains(currentmodel->batches);

View file

@ -442,7 +442,7 @@ cvar_t gl_texture_anisotropic_filtering = CVARAFCD("gl_texture_anisotropy", "4"
Image_TextureMode_Callback, "Allows for higher quality textures on surfaces that slope away from the camera (like the floor). Set to 16 or something. Only supported with trilinear filtering."); Image_TextureMode_Callback, "Allows for higher quality textures on surfaces that slope away from the camera (like the floor). Set to 16 or something. Only supported with trilinear filtering.");
cvar_t gl_texturemode = CVARFCD("gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR", cvar_t gl_texturemode = CVARFCD("gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK | CVAR_SAVE, Image_TextureMode_Callback, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK | CVAR_SAVE, Image_TextureMode_Callback,
"Specifies how world/model textures appear. Typically 3 letters eg lln.\nFirst letter can be l(inear) or n(earest) and says how to sample from the mip (when downsampling).\nThe middle letter can . to disable mipmaps, or l or n to describe whether to blend between mipmaps.\nThe third letter says what to do when the texture is too low resolution and is thus the most noticable with low resolution textures, a n will make it look like lego, while an l will keep it smooth."); "Specifies how world/model textures appear. Typically 3 letters eg "S_COLOR_GREEN"nll"S_COLOR_WHITE" or "S_COLOR_GREEN"lll"S_COLOR_WHITE".\nFirst letter can be l(inear) or n(earest) and says how to upscale low-res textures (n for the classic look - often favoured for embedded textures, l for blurry - best for high-res textures).\nThe middle letter can be set to '.' to disable mipmaps, or n for ugly banding with distance, or l for smooth mipmap transitions.\nThe third letter says what to do when the texture is too high resolution, and should generally be set to 'l' to reduce sparkles including when aiming for the classic lego look.");
cvar_t gl_texture_lodbias = CVARAFCD("d_lodbias", "0", "gl_texture_lodbias", cvar_t gl_texture_lodbias = CVARAFCD("d_lodbias", "0", "gl_texture_lodbias",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
Image_TextureMode_Callback, "Biases choice of mipmap levels. Positive values will give more blury textures, while negative values will give crisper images (but will also give some mid-surface aliasing artifacts)."); Image_TextureMode_Callback, "Biases choice of mipmap levels. Positive values will give more blury textures, while negative values will give crisper images (but will also give some mid-surface aliasing artifacts).");

View file

@ -748,8 +748,9 @@ static void GL_Texturemode_Apply(GLenum targ, unsigned int flags)
qglTexParameteri(targ, GL_TEXTURE_MAG_FILTER, mag); qglTexParameteri(targ, GL_TEXTURE_MAG_FILTER, mag);
if (gl_anisotropy_factor) //0 means driver doesn't support if (gl_anisotropy_factor) //0 means driver doesn't support
{ {
//only use anisotrophy when using linear any linear, because of drivers that forces linear sampling when anis is active (annoyingly this is allowed by the spec). //only use anisotrophy when using linear any linear, because of drivers that forces linear sampling when anis is active (annoyingly this is allowed by the spec - even for the mag filter).
//(also protects r_softwarebanding) //WARNING: older intel drivers can be expected to glitch with anisotropic lego mode.
// Note that we do not check mag filters here - 'gl_texturemode nll' will have crunch anistrophy, unfortunately swbanding requires nnn right now (and should be picking mips based on surface distance rather than pixel coverage instead).
if (min == GL_LINEAR_MIPMAP_LINEAR || min == GL_LINEAR_MIPMAP_NEAREST) if (min == GL_LINEAR_MIPMAP_LINEAR || min == GL_LINEAR_MIPMAP_NEAREST)
qglTexParameterf(targ, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_anisotropy_factor); qglTexParameterf(targ, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_anisotropy_factor);
else else

View file

@ -1191,7 +1191,10 @@ qboolean R_ImportRTLights(const char *entlump, int importmode)
} }
if (rerelease) if (rerelease)
r_shadow_realtime_world_lightmaps_force = 1; {
if (r_shadow_realtime_world_lightmaps_force < 0)
r_shadow_realtime_world_lightmaps_force = 1;
}
else if (radius < 50) //some mappers insist on many tiny lights. such lights can usually get away with no shadows.. else if (radius < 50) //some mappers insist on many tiny lights. such lights can usually get away with no shadows..
pflags |= PFLAGS_NOSHADOW; pflags |= PFLAGS_NOSHADOW;
@ -1209,7 +1212,7 @@ qboolean R_ImportRTLights(const char *entlump, int importmode)
dl->radius = radius; dl->radius = radius;
VectorCopy(color, dl->color); VectorCopy(color, dl->color);
dl->flags = 0; dl->flags = 0;
dl->flags |= LFLAG_REALTIMEMODE; dl->flags |= rerelease?LFLAG_REALTIMEMODE|LFLAG_NORMALMODE:LFLAG_REALTIMEMODE;
dl->flags |= (pflags & PFLAGS_CORONA)?LFLAG_FLASHBLEND:0; dl->flags |= (pflags & PFLAGS_CORONA)?LFLAG_FLASHBLEND:0;
dl->flags |= (pflags & PFLAGS_NOSHADOW)?LFLAG_NOSHADOWS:0; dl->flags |= (pflags & PFLAGS_NOSHADOW)?LFLAG_NOSHADOWS:0;
dl->style = style; dl->style = style;

View file

@ -3994,14 +3994,6 @@ void Sh_CheckSettings(void)
//both shadow methods available. //both shadow methods available.
} }
r_dynamic.ival = r_dynamic.value;
if (canshadowless && r_dynamic.value && !r_shadow_realtime_dlight.ival && (r_temporalscenecache.ival))// || (cl.worldmodel && cl.worldmodel->fromgame == fg_quake3)))
{
r_shadow_realtime_dlight.ival = 1;
r_shadow_realtime_dlight_shadows.ival = 0;
r_dynamic.ival = 0;
}
cansmap = cansmap && (r_shadows.ival==2); cansmap = cansmap && (r_shadows.ival==2);
if (r_fakeshadows != cansmap) if (r_fakeshadows != cansmap)
{ {
@ -4097,13 +4089,12 @@ void Sh_DrawLights(qbyte *vis)
if (r_lightprepass) if (r_lightprepass)
return; return;
if (!r_shadow_realtime_world.ival && !r_shadow_realtime_dlight.ival)
{
return;
}
ignoreflags = (r_shadow_realtime_world.ival?LFLAG_REALTIMEMODE:0) ignoreflags = (r_shadow_realtime_world.ival?LFLAG_REALTIMEMODE:0)
| (r_shadow_realtime_dlight.ival?LFLAG_NORMALMODE:0); | (r_shadow_realtime_dlight.ival?LFLAG_NORMALMODE:0);
if (r_dynamic.ival == -1 && r_dynamic.value > 0)
ignoreflags |= LFLAG_LIGHTMAP; //if we're using scenecache then we cannot use lightmap hacks for dlights, so draw them via rtlight code instead.
if (!ignoreflags)
return;
// if (r_refdef.recurse) // if (r_refdef.recurse)
for (dl = cl_dlights+rtlights_first, i=rtlights_first; i<rtlights_max; i++, dl++) for (dl = cl_dlights+rtlights_first, i=rtlights_first; i<rtlights_max; i++, dl++)
@ -4227,7 +4218,9 @@ void Sh_DrawLights(qbyte *vis)
} }
else if (dl->flags & LFLAG_CREPUSCULAR) else if (dl->flags & LFLAG_CREPUSCULAR)
Sh_DrawCrepuscularLight(dl, colour); Sh_DrawCrepuscularLight(dl, colour);
else if (((i >= RTL_FIRST)?!r_shadow_realtime_world_shadows.ival:!r_shadow_realtime_dlight_shadows.ival) || dl->flags & LFLAG_NOSHADOWS) else if (dl->flags & LFLAG_NOSHADOWS ||
((i >= RTL_FIRST)?!r_shadow_realtime_world_shadows.ival:!r_shadow_realtime_dlight_shadows.ival) || //force shadowless when configured that way...
ignoreflags==LFLAG_LIGHTMAP) //scenecache fallback...
{ {
Sh_DrawShadowlessLight(dl, colour, axis, vis); Sh_DrawShadowlessLight(dl, colour, axis, vis);
} }