From: havoc Date: Thu, 13 Jan 2005 18:26:26 +0000 (+0000) Subject: now skips entire rtlight rendering process if light is too dark or does not emit... X-Git-Tag: xonotic-v0.1.0preview~5217 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f55c4a9648c260b8855a8fa8e166de101d521df4;p=xonotic%2Fdarkplaces.git now skips entire rtlight rendering process if light is too dark or does not emit any surface light - another 30% speed gain git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4932 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/r_shadow.c b/r_shadow.c index 780159ed..fde1b98e 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2331,6 +2331,22 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes) shadowmesh_t *mesh; rmeshstate_t m; + // skip lights that don't light (corona only lights) + if (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale < 0.01) + return; + + f = (rtlight->style >= 0 ? d_lightstylevalue[rtlight->style] : 128) * (1.0f / 256.0f); + VectorScale(rtlight->color, f, lightcolor); + if (VectorLength2(lightcolor) < 0.01) + return; + /* + if (rtlight->selected) + { + f = 2 + sin(realtime * M_PI * 4.0); + VectorScale(lightcolor, f, lightcolor); + } + */ + // 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) @@ -2394,16 +2410,6 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes) if (R_Shadow_ScissorForBBox(cullmins, cullmaxs)) return; - f = (rtlight->style >= 0 ? d_lightstylevalue[rtlight->style] : 128) * (1.0f / 256.0f); - VectorScale(rtlight->color, f, lightcolor); - /* - if (rtlight->selected) - { - f = 2 + sin(realtime * M_PI * 4.0); - VectorScale(lightcolor, f, lightcolor); - } - */ - shadow = rtlight->shadow && (rtlight->isstatic ? r_rtworldshadows : r_rtdlightshadows); if (shadow && (gl_stencil || visiblevolumes))