From: havoc Date: Mon, 28 Mar 2011 09:59:12 +0000 (+0000) Subject: better detection of active rtlights in bouncegrid code X-Git-Tag: xonotic-v0.5.0~352 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5194de3a19c46b98cfc110e1973387e16972eb78;p=xonotic%2Fdarkplaces.git better detection of active rtlights in bouncegrid code git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10974 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6c0fbc59c21af32d678179f7d24317ba36b2b25b --- diff --git a/r_shadow.c b/r_shadow.c index bef3f2c3..9d52e07e 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2387,39 +2387,20 @@ static void R_Shadow_UpdateBounceGridTexture(void) r_shadow_bouncegridintensity = r_shadow_bouncegrid_intensity.value; // see if there are really any lights to render... - if (enable) + if (enable && r_shadow_bouncegrid_static.integer) { enable = false; range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked - range1 = r_shadow_bouncegrid_static.integer ? 0 : r_refdef.scene.numlights; - range2 = range + range1; - for (lightindex = 0;lightindex < range2;lightindex++) + for (lightindex = 0;lightindex < range;lightindex++) { - if (r_shadow_bouncegrid_static.integer) - { - light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); - if (!light || !(light->flags & flag)) - continue; - rtlight = &light->rtlight; - // when static, we skip styled lights because they tend to change... - if (rtlight->style > 0) - continue; - VectorScale(rtlight->color, (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale) * (rtlight->style >= 0 ? r_refdef.scene.rtlightstylevalue[rtlight->style] : 1), lightcolor); - } - else - { - if (lightindex < range) - { - light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); - rtlight = &light->rtlight; - } - else - rtlight = r_refdef.scene.lights[lightindex - range]; - // draw only visible lights (major speedup) - if (!rtlight->draw) - continue; - VectorScale(rtlight->currentcolor, rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale, lightcolor); - } + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + if (!light || !(light->flags & flag)) + continue; + rtlight = &light->rtlight; + // when static, we skip styled lights because they tend to change... + if (rtlight->style > 0) + continue; + VectorScale(rtlight->color, (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale), lightcolor); if (!VectorLength2(lightcolor)) continue; enable = true;