]> Some of my projects - openlase.git/commitdiff
Totally ignore trivially offscreen objects
authorHector Martin <hector@marcansoft.com>
Sat, 18 Dec 2010 20:22:20 +0000 (21:22 +0100)
committerHector Martin <hector@marcansoft.com>
Sat, 18 Dec 2010 20:22:20 +0000 (21:22 +0100)
libol/libol.c

index 7144f91df61297e6a411dbb346b63df10aade746..dec5a2d3fd8a7c49e2e1349354143e286aee0a0e 100644 (file)
@@ -571,7 +571,24 @@ void olEnd(void)
                }
        }
 
-       wframe.objcnt++;
+       int nl=0,nr=0,nu=0,nd=0;
+       for (i=0; i<dstate.curobj->pointcnt; i++) {
+               if (!dstate.curobj->points[i].color)
+                       continue;
+               if (dstate.curobj->points[i].x > -1)
+                       nl = 1;
+               if (dstate.curobj->points[i].x < 1)
+                       nr = 1;
+               if (dstate.curobj->points[i].y > -1)
+                       nd = 1;
+               if (dstate.curobj->points[i].y < 1)
+                       nu = 1;
+
+               if (nl && nr && nu && nd)
+                       break;
+       }
+       if (nl && nr && nu && nd)
+               wframe.objcnt++;
        dstate.curobj = NULL;
 }