--- ray/src/px/xshowtrace.c 1990/09/22 10:53:57 1.1 +++ ray/src/px/xshowtrace.c 1990/12/21 17:24:45 1.4 @@ -15,7 +15,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define MAXDEPTH 32 /* ridiculous ray tree depth */ char rtcom[] = "rtrace -h -otp -fa -x 1"; -char xicom[] = "x11image"; +char xicom[] = "x11image -f"; VIEW ourview = STDVIEW; /* view for picture */ int xres, yres; @@ -34,18 +34,24 @@ struct node { /* ray tree node */ #define newnode() (struct node *)calloc(1, sizeof(struct node)) +int slow = 0; /* slow trace? */ + main(argc, argv) /* takes both the octree and the image */ int argc; char *argv[]; { int i; char combuf[256]; - Cursor curs; progname = argv[0]; - if (argc < 3) { - fprintf(stderr, "Usage: %s [rtrace args] octree picture\n", + for (i = 1; i < argc-2; i++) + if (!strcmp(argv[i], "-s")) + slow++; + else + break; + if (i > argc-2) { + fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n", argv[0]); exit(1); } @@ -65,7 +71,7 @@ char *argv[]; } /* build input command */ sprintf(combuf, "%s %s | %s", xicom, argv[argc-1], rtcom); - for (i = 1; i < argc-1; i++) { + for ( ; i < argc-1; i++) { strcat(combuf, " "); strcat(combuf, argv[i]); } @@ -109,9 +115,10 @@ mainloop() /* get and process input */ if (i == 0) { setvec(sis[0]->ipt); tracerays(sis[0]); - XFlush(theDisplay); freetree(sis[0]); sis[0] = NULL; + if (!slow) + XFlush(theDisplay); } } } @@ -134,8 +141,8 @@ struct node *tp; register struct node *kid; for (kid = tp->daughter; kid != NULL; kid = kid->sister) { - tracerays(kid); vector(tp->ipt, kid->ipt); + tracerays(kid); } } @@ -167,7 +174,9 @@ double ipt[2]; XWindowAttributes wa; XColor xc; XGCValues gcv; - int pm, rx, ry, wx, wy, rw, cw; + int rx, ry, wx, wy; + Window rw, cw; + unsigned int pm; /* compute pointer location */ if (gwind == 0) { XQueryPointer(theDisplay, rwind, &rw, &gwind, @@ -199,4 +208,8 @@ double ip1[2], ip2[2]; XDrawLine(theDisplay, gwind, vecGC, (int)(ip1[0]*xres)+xoff, (int)((1.-ip1[1])*yres)+yoff, (int)(ip2[0]*xres)+xoff, (int)((1.-ip2[1])*yres)+yoff); + if (slow) { + XFlush(theDisplay); + sleep(1); + } }