From 2f2812064001013a1c37a90d67e4e16a8ff7348a Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 11 Sep 2009 10:05:22 +0000 Subject: [PATCH] now generates animcaches for visible entities again like the original code, this gives a slight speed gain in Nexuiz git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9177 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 9413ad4f..e939610e 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2775,6 +2775,28 @@ qboolean R_AnimCache_GetEntity(entity_render_t *ent, qboolean wantnormals, qbool return true; } +void R_AnimCache_CacheVisibleEntities(void) +{ + int i; + qboolean wantnormals; + qboolean wanttangents; + + if (!r_animcachestate.maxindex) + return; + + wantnormals = !r_showsurfaces.integer; + wanttangents = !r_showsurfaces.integer && (r_glsl.integer || r_refdef.scene.rtworld || r_refdef.scene.rtdlight); + + // TODO: thread this? + + for (i = 0;i < r_refdef.scene.numentities;i++) + { + if (!r_refdef.viewcache.entityvisible[i]) + continue; + R_AnimCache_GetEntity(r_refdef.scene.entities[i], wantnormals, wanttangents); + } +} + //================================================================================== static void R_View_UpdateEntityLighting (void) @@ -4269,6 +4291,8 @@ void R_RenderScene(void) R_TimeReport("bmodelsky"); } + R_AnimCache_CacheVisibleEntities(); + if (r_depthfirst.integer >= 1 && cl.csqc_vidvars.drawworld && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->DrawDepth) { r_refdef.scene.worldmodel->DrawDepth(r_refdef.scene.worldentity); @@ -6921,7 +6945,7 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const // to a model, knowing that they are meaningless otherwise if (ent == r_refdef.scene.worldentity) RSurf_ActiveWorldEntity(); - else if ((ent->effects & EF_FULLBRIGHT) || (r_showsurfaces.integer && r_showsurfaces.integer != 3)) + else if (r_showsurfaces.integer && r_showsurfaces.integer != 3) RSurf_ActiveModelEntity(ent, false, false); else RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader); @@ -7484,7 +7508,7 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr // to a model, knowing that they are meaningless otherwise if (ent == r_refdef.scene.worldentity) RSurf_ActiveWorldEntity(); - else if ((ent->effects & EF_FULLBRIGHT) || (r_showsurfaces.integer && r_showsurfaces.integer != 3)) + else if (r_showsurfaces.integer && r_showsurfaces.integer != 3) RSurf_ActiveModelEntity(ent, false, false); else RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader && !depthonly); -- 2.39.2