]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
suppress shadow entities when preparing an rtlight with shadows
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 Nov 2013 06:06:41 +0000 (06:06 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 25 Nov 2013 19:38:20 +0000 (20:38 +0100)
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
::stable-branch::merge=7fbfb88e78f7ca977f68c9b61ba2a25d08ccc223

r_shadow.c

index c183be35e4de69a5f5229a6c440add86008aaf80..a5f34d5badc47948a843fee762c36383c737cf02 100644 (file)
@@ -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);