If there is only one normal, don't transform it multiple times.
authorKeith Whitwell <keith@tungstengraphics.com>
Wed, 5 Jan 2005 11:10:05 +0000 (11:10 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Wed, 5 Jan 2005 11:10:05 +0000 (11:10 +0000)
src/mesa/tnl/t_vb_normals.c

index 732e7c6f4ecaef5d3d13829d77b76f2439d19b09..d82008821f294eb4517afd879fd871404fc4ed06 100644 (file)
@@ -68,11 +68,23 @@ static GLboolean run_normal_stage( GLcontext *ctx,
       else
          lengths = VB->NormalLengthPtr;
 
+      /* If there is only one normal, don't transform it multiple times:
+       */
+      if (VB->NormalPtr->stride == 0)
+        VB->NormalPtr->count = 1;
+
       store->NormalTransform( ctx->ModelviewMatrixStack.Top,
                              ctx->_ModelViewInvScale,
                              VB->NormalPtr,  /* input normals */
                              lengths,
                              &store->normal ); /* resulting normals */
+
+      if (VB->NormalPtr->stride == 0) {
+        VB->NormalPtr->count = VB->Count;
+        store->normal.stride = 0;
+      }
+      else
+        store->normal.stride = 16;     
    }
 
    VB->NormalPtr = &store->normal;