From: havoc Date: Wed, 20 Nov 2013 06:06:41 +0000 (+0000) Subject: suppress shadow entities when preparing an rtlight with shadows X-Git-Tag: xonotic-v0.8.0~96^2~13 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7fbfb88e78f7ca977f68c9b61ba2a25d08ccc223;p=xonotic%2Fdarkplaces.git suppress shadow entities when preparing an rtlight with shadows disabled, this way we don't call R_AnimCache_GetEntity on each one git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12027 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/r_shadow.c b/r_shadow.c index c183be35..a5f34d5b 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3933,6 +3933,7 @@ static void R_Shadow_PrepareLight(rtlight_t *rtlight) static entity_render_t *shadowentities[MAX_EDICTS]; static entity_render_t *shadowentities_noselfshadow[MAX_EDICTS]; qboolean nolight; + qboolean castshadows; rtlight->draw = false; rtlight->cached_numlightentities = 0; @@ -4128,6 +4129,11 @@ static void R_Shadow_PrepareLight(rtlight_t *rtlight) // flag it as worth drawing later rtlight->draw = true; + // if we have shadows disabled, don't count the shadow entities, this way we don't do the R_AnimCache_GetEntity on each one + castshadows = numsurfaces + numshadowentities + numshadowentities_noselfshadow > 0 && rtlight->shadow && (rtlight->isstatic ? r_refdef.scene.rtworldshadows : r_refdef.scene.rtdlightshadows); + if (!castshadows) + numshadowentities = numshadowentities_noselfshadow = 0; + // cache all the animated entities that cast a shadow but are not visible for (i = 0;i < numshadowentities;i++) R_AnimCache_GetEntity(shadowentities[i], false, false);