]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Don't generate tangent vectors when GLSL is off, small improvement to anim caching..
authorechon <echon@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Sep 2009 16:20:53 +0000 (16:20 +0000)
committerechon <echon@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Sep 2009 16:20:53 +0000 (16:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9166 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 8ce6667e9a6a5eecd6244c4e46da15180ca2530b..3cc4e746ff6754e44eb67f3cdccca486f65bc3a1 100644 (file)
@@ -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++;