From 7b97cc1355eb9c7e509ea2838f44b77479d565e3 Mon Sep 17 00:00:00 2001 From: echon Date: Sun, 6 Sep 2009 16:20:53 +0000 Subject: [PATCH] Don't generate tangent vectors when GLSL is off, small improvement to anim caching.. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9166 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 8ce6667e..3cc4e746 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2718,6 +2718,8 @@ void R_RunAnimCache(void) int entIdx, cacheIdx; entity_render_t *ent; dp_model_t *model; + qboolean bWantNormals; + qboolean bWantTangents; // Only proceed if desired if (!r_animcache.integer || !r_drawentities.integer) @@ -2756,12 +2758,15 @@ void R_RunAnimCache(void) R_ResizeAnimCache(cacheIdx, model->surfmesh.num_vertices); // FIXME: Some stable way of determining if normals/tangets aren't going to be needed would be good for optimizing this + // Need to consider deformvertexes and tcgens that need normals and/or tangents (otherwise they'll slow-path generate them later), as well as some rendering settings + bWantNormals = true; + bWantTangents = bWantNormals && (r_glsl.integer && gl_support_fragment_shader); model->AnimateVertices( model, ent->frameblend, r_animCache[cacheIdx].vertexes, - r_animCache[cacheIdx].normals, - r_animCache[cacheIdx].sVectors, - r_animCache[cacheIdx].tVectors + bWantNormals ? r_animCache[cacheIdx].normals : NULL, + bWantTangents ? r_animCache[cacheIdx].sVectors : NULL, + bWantTangents ? r_animCache[cacheIdx].tVectors : NULL ); cacheIdx++; -- 2.39.2