]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
slight optimization to 2D rendering - if triangle wslope is 0, don't
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Apr 2011 16:55:32 +0000 (16:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Apr 2011 16:55:32 +0000 (16:55 +0000)
bother doing any math, just fill the zf array

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11013 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c

index 29585470c3c1ca3363cd331ed36e1c98823e234a..13865e084ae5db5dee9e11bbb2f6aebca6c8dbf9 100644 (file)
@@ -1989,6 +1989,13 @@ void DPSOFTRAST_Draw_Span_Begin(DPSOFTRAST_State_Thread *thread, const DPSOFTRAS
        float wslope = triangle->w[0];
        float w = triangle->w[2] + span->x*wslope + span->y*triangle->w[1];
        float endz = 1.0f / (w + wslope * startx);
+       if (triangle->w[0] == 0)
+       {
+               // LordHavoc: fast flat polygons (HUD/menu)
+               for (x = startx;x < endx;x++)
+                       zf[x] = endz;
+               return;
+       }
        for (x = startx;x < endx;)
        {
                int nextsub = x + DPSOFTRAST_DRAW_MAXSUBSPAN, endsub = nextsub - 1;