From 7fbfb88e78f7ca977f68c9b61ba2a25d08ccc223 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 20 Nov 2013 06:06:41 +0000 Subject: [PATCH] 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 --- r_shadow.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.39.2