From ce0c7106ab28f380d916b1822ffbcb76ba6bd9c8 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 27 Feb 2010 21:12:40 +0000 Subject: [PATCH] fix a bug that prevented coronas from being rendered for lights with no diffuse or specular intensity git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10032 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index b4771114..67449fc6 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3485,19 +3485,19 @@ void R_Shadow_PrepareLight(rtlight_t *rtlight) static entity_render_t *lightentities_noselfshadow[MAX_EDICTS]; static entity_render_t *shadowentities[MAX_EDICTS]; static entity_render_t *shadowentities_noselfshadow[MAX_EDICTS]; + qboolean nolight; rtlight->draw = false; // skip lights that don't light because of ambientscale+diffusescale+specularscale being 0 (corona only lights) // skip lights that are basically invisible (color 0 0 0) - if (VectorLength2(rtlight->color) * (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale) < (1.0f / 1048576.0f)) - return; + nolight = VectorLength2(rtlight->color) * (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale) < (1.0f / 1048576.0f); // loading is done before visibility checks because loading should happen // all at once at the start of a level, not when it stalls gameplay. // (especially important to benchmarks) // compile light - if (rtlight->isstatic && (!rtlight->compiled || (rtlight->shadow && rtlight->shadowmode != (int)r_shadow_shadowmode)) && r_shadow_realtime_world_compile.integer) + if (rtlight->isstatic && !nolight && (!rtlight->compiled || (rtlight->shadow && rtlight->shadowmode != (int)r_shadow_shadowmode)) && r_shadow_realtime_world_compile.integer) { if (rtlight->compiled) R_RTLight_Uncompile(rtlight); @@ -3522,6 +3522,10 @@ void R_Shadow_PrepareLight(rtlight_t *rtlight) if (VectorLength2(rtlight->currentcolor) < (1.0f / 1048576.0f)) return; + // skip processing on corona-only lights + if (nolight) + return; + // if the light box is offscreen, skip it if (R_CullBox(rtlight->cullmins, rtlight->cullmaxs)) return; -- 2.39.2