--- ray/src/rt/rview.c 1989/07/10 15:21:25 1.5 +++ ray/src/rt/rview.c 1990/03/09 14:00:06 1.11 @@ -20,7 +20,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include -VIEW ourview = STDVIEW(470); /* viewing parameters */ +VIEW ourview = STDVIEW; /* viewing parameters */ +int hresolu, vresolu; /* image resolution */ int psample = 8; /* pixel sample size */ double maxdiff = .15; /* max. sample difference */ @@ -44,7 +45,7 @@ char *amblist[128]; /* ambient include/exclude list int ambincl = -1; /* include == 1, exclude == 0 */ int greyscale = 0; /* map colors to brightness? */ -char *devname = "X"; /* output device name */ +char *devname = dev_default; /* output device name */ struct driver *dev = NULL; /* driver functions */ @@ -68,22 +69,21 @@ int code; devopen(dname) /* open device driver */ char *dname; { - extern char *progname; - char *devargv[3]; + extern char *progname, *octname; + char *id; register int i; + + id = octname!=NULL ? octname : progname; /* check device table */ for (i = 0; devtable[i].name; i++) if (!strcmp(dname, devtable[i].name)) - if ((dev = (*devtable[i].init)(progname)) == NULL) { + if ((dev = (*devtable[i].init)(dname, id)) == NULL) { sprintf(errmsg, "cannot initialize %s", dname); error(USER, errmsg); } else return; /* not there, try exec */ - devargv[0] = dname; - devargv[1] = progname; - devargv[2] = NULL; - if ((dev = comm_init(devargv)) == NULL) { + if ((dev = comm_init(dname, id)) == NULL) { sprintf(errmsg, "cannot start device \"%s\"", dname); error(USER, errmsg); } @@ -115,20 +115,19 @@ rview() /* do a view */ newimage(); /* set up image */ for ( ; ; ) { /* quit in command() */ - while (ourview.hresolu <= 1<comout)(buf); rsample(); } else { sprintf(buf, "%d refining...\n", 1<comout)(buf); - refine(&ptrunk, 0, 0, ourview.hresolu, - ourview.vresolu, pdepth+1); + refine(&ptrunk, 0, 0, hresolu, vresolu, pdepth+1); } if (dev->inpready) command(": "); @@ -146,8 +145,7 @@ char *prompt; char inpbuf[256]; char *args; again: - (*dev->comout)(prompt); /* get command + arguments */ - (*dev->comin)(inpbuf); + (*dev->comin)(inpbuf, prompt); /* get command + arguments */ for (args = inpbuf; *args && *args != ' '; args++) ; if (*args) *args++ = '\0'; @@ -199,9 +197,13 @@ again: goto commerr; getmove(args); break; - case 'r': /* rotate camera */ - if (badcom("rotate")) - goto commerr; + case 'r': /* rotate/repaint */ + if (badcom("rotate")) { + if (badcom("repaint")) + goto commerr; + getrepaint(args); + break; + } getrotate(args); break; case 'p': /* pivot view */ @@ -263,10 +265,8 @@ rsample() /* sample the image */ * difference, we subsample the super-pixels. The testing process * includes initialization of the next row. */ - xsiz = (((pframe.r-pframe.l)<>pdepth), + rl[x].r = hresolu; rl[x].u = vresolu; + pl[x] = findrect(pframe.l+((x*hresolu)>>pdepth), pframe.d, &ptrunk, rl+x, pdepth); } /* sample the image */ @@ -308,9 +308,9 @@ rsample() /* sample the image */ * Find super-pixel at this position in next row. */ r.l = r.d = 0; - r.r = ourview.hresolu; r.u = ourview.vresolu; - p = findrect(pframe.l+((x*ourview.hresolu)>>pdepth), - pframe.d+(((y+1)*ourview.vresolu)>>pdepth), + r.r = hresolu; r.u = vresolu; + p = findrect(pframe.l+((x*hresolu)>>pdepth), + pframe.d+(((y+1)*vresolu)>>pdepth), &ptrunk, &r, pdepth); /* * Test super-pixel in next row.