void zbuffer() { readshadow(); int i,j,k; for (i = -300;i <= 300;++i) for (j = -300;j <= 300;++j) { double z = 1e11; struct point p; struct colour c = black; p.x = i; p.y = j; for (k = 0;k < pla_num;++k) { if (proj_list[k].plan.z != 0) if (in_poly(&proj_list[k].proj,p)) { struct plane pl = proj_list[k].plan; double t = (pl.d-pl.x*i-pl.y*j)/(double)pl.z; if (t >=0 && t < z) { z = t; c = proj_list[k].c; } } } glColor3f(c.r,c.g,c.b); glVertex2i(i,j); } }
int main(int argc, char **argv) { const char optstr[] = ":admopstuxg:l:"; int i; #ifdef __GLIBC__ putenv("POSIXLY_CORRECT=1"); #endif progname = basename(argv[0]); while ((i = getopt(argc, argv, optstr)) != EOF) { switch (i) { case 'a': aflag = 1; break; case 'd': dflag = 1; break; case 'm': mflag = 1; break; case 'o': oflag = 1; break; case 'p': pflag = 1; break; case 's': sflag = 1; break; case 't': tflag = 1; break; case 'u': uflag = 1; break; case 'x': xflag = 1; break; case 'g': selectgrp(optarg); break; case 'l': selectuser(optarg); break; default: usage(); } } if (argv[optind]) usage(); if (sflag && uflag) sflag = uflag = 0; readpasswd(); readshadow(); readgroup(); userdel(); report(); return errcnt; }