ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rview.c
(Generate patch)

Comparing ray/src/rt/rview.c (file contents):
Revision 1.4 by greg, Tue Jun 13 10:57:49 1989 UTC vs.
Revision 1.11 by greg, Fri Mar 9 14:00:06 1990 UTC

# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20  
21   #include  <ctype.h>
22  
23 < VIEW  ourview = STDVIEW(470);           /* viewing parameters */
23 > VIEW  ourview = STDVIEW;                /* viewing parameters */
24 > int  hresolu, vresolu;                  /* image resolution */
25  
26   int  psample = 8;                       /* pixel sample size */
27   double  maxdiff = .15;                  /* max. sample difference */
# Line 36 | Line 37 | double  minweight = 1e-2;              /* minimum ray weight */
37  
38   COLOR  ambval = BLKCOLOR;               /* ambient value */
39   double  ambacc = 0.2;                   /* ambient accuracy */
40 < int  ambres = 64;                       /* ambient resolution */
40 > int  ambres = 8;                        /* ambient resolution */
41   int  ambdiv = 32;                       /* ambient divisions */
42   int  ambssamp = 0;                      /* ambient super-samples */
43   int  ambounce = 0;                      /* ambient bounces */
# Line 44 | Line 45 | char  *amblist[128];                   /* ambient include/exclude list
45   int  ambincl = -1;                      /* include == 1, exclude == 0 */
46  
47   int  greyscale = 0;                     /* map colors to brightness? */
48 < char  *devname = "X";                   /* output device name */
48 > char  *devname = dev_default;           /* output device name */
49  
50   struct driver  *dev = NULL;             /* driver functions */
51  
# Line 68 | Line 69 | int  code;
69   devopen(dname)                          /* open device driver */
70   char  *dname;
71   {
72 <        extern char  *progname;
73 <        char  *devargv[3];
72 >        extern char  *progname, *octname;
73 >        char  *id;
74          register int  i;
75 +
76 +        id = octname!=NULL ? octname : progname;
77                                                  /* check device table */
78          for (i = 0; devtable[i].name; i++)
79                  if (!strcmp(dname, devtable[i].name))
80 <                        if ((dev = (*devtable[i].init)(progname)) == NULL) {
80 >                        if ((dev = (*devtable[i].init)(dname, id)) == NULL) {
81                                  sprintf(errmsg, "cannot initialize %s", dname);
82                                  error(USER, errmsg);
83                          } else
84                                  return;
85                                                  /* not there, try exec */
86 <        devargv[0] = dname;
84 <        devargv[1] = progname;
85 <        devargv[2] = NULL;
86 <        if ((dev = comm_init(devargv)) == NULL) {
86 >        if ((dev = comm_init(dname, id)) == NULL) {
87                  sprintf(errmsg, "cannot start device \"%s\"", dname);
88                  error(USER, errmsg);
89          }
# Line 115 | Line 115 | rview()                                /* do a view */
115          newimage();                     /* set up image */
116  
117          for ( ; ; ) {                   /* quit in command() */
118 <                while (ourview.hresolu <= 1<<pdepth &&
119 <                                ourview.vresolu <= 1<<pdepth)
118 >                while (hresolu <= 1<<pdepth &&
119 >                                vresolu <= 1<<pdepth)
120                          command("done: ");
121  
122 <                if (ourview.hresolu <= psample<<pdepth &&
123 <                                ourview.vresolu <= psample<<pdepth) {
122 >                if (hresolu <= psample<<pdepth &&
123 >                                vresolu <= psample<<pdepth) {
124                          sprintf(buf, "%d sampling...\n", 1<<pdepth);
125                          (*dev->comout)(buf);
126                          rsample();
127                  } else {
128                          sprintf(buf, "%d refining...\n", 1<<pdepth);
129                          (*dev->comout)(buf);
130 <                        refine(&ptrunk, 0, 0, ourview.hresolu,
131 <                                        ourview.vresolu, pdepth+1);
130 >                        refine(&ptrunk, 0, 0, hresolu, vresolu, pdepth+1);
131                  }
132                  if (dev->inpready)
133                          command(": ");
# Line 146 | Line 145 | char  *prompt;
145          char  inpbuf[256];
146          char  *args;
147   again:
148 <        (*dev->comout)(prompt);                 /* get command + arguments */
150 <        (*dev->comin)(inpbuf);
148 >        (*dev->comin)(inpbuf, prompt);          /* get command + arguments */
149          for (args = inpbuf; *args && *args != ' '; args++)
150                  ;
151          if (*args) *args++ = '\0';
# Line 199 | Line 197 | again:
197                          goto commerr;
198                  getmove(args);
199                  break;
200 <        case 'r':                               /* rotate camera */
201 <                if (badcom("rotate"))
202 <                        goto commerr;
200 >        case 'r':                               /* rotate/repaint */
201 >                if (badcom("rotate")) {
202 >                        if (badcom("repaint"))
203 >                                goto commerr;
204 >                        getrepaint(args);
205 >                        break;
206 >                }
207                  getrotate(args);
208                  break;
209          case 'p':                               /* pivot view */
# Line 263 | Line 265 | rsample()                      /* sample the image */
265           * difference, we subsample the super-pixels.  The testing process
266           * includes initialization of the next row.
267           */
268 <        xsiz = (((pframe.r-pframe.l)<<pdepth)+ourview.hresolu-1) /
269 <                        ourview.hresolu;
268 <        ysiz = (((pframe.u-pframe.d)<<pdepth)+ourview.vresolu-1) /
269 <                        ourview.vresolu;
268 >        xsiz = (((pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu;
269 >        ysiz = (((pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu;
270          rl = (RECT *)malloc(xsiz*sizeof(RECT));
271          pl = (PNODE **)malloc(xsiz*sizeof(PNODE *));
272          if (rl == NULL || pl == NULL)
# Line 275 | Line 275 | rsample()                      /* sample the image */
275           * Initialize the bottom row.
276           */
277          rl[0].l = rl[0].d = 0;
278 <        rl[0].r = ourview.hresolu; rl[0].u = ourview.vresolu;
278 >        rl[0].r = hresolu; rl[0].u = vresolu;
279          pl[0] = findrect(pframe.l, pframe.d, &ptrunk, rl, pdepth);
280          for (x = 1; x < xsiz; x++) {
281                  rl[x].l = rl[x].d = 0;
282 <                rl[x].r = ourview.hresolu; rl[x].u = ourview.vresolu;
283 <                pl[x] = findrect(pframe.l+((x*ourview.hresolu)>>pdepth),
282 >                rl[x].r = hresolu; rl[x].u = vresolu;
283 >                pl[x] = findrect(pframe.l+((x*hresolu)>>pdepth),
284                                  pframe.d, &ptrunk, rl+x, pdepth);
285          }
286                                                  /* sample the image */
# Line 308 | Line 308 | rsample()                      /* sample the image */
308                           * Find super-pixel at this position in next row.
309                           */
310                          r.l = r.d = 0;
311 <                        r.r = ourview.hresolu; r.u = ourview.vresolu;
312 <                        p = findrect(pframe.l+((x*ourview.hresolu)>>pdepth),
313 <                                pframe.d+(((y+1)*ourview.vresolu)>>pdepth),
311 >                        r.r = hresolu; r.u = vresolu;
312 >                        p = findrect(pframe.l+((x*hresolu)>>pdepth),
313 >                                pframe.d+(((y+1)*vresolu)>>pdepth),
314                                          &ptrunk, &r, pdepth);
315                          /*
316                           * Test super-pixel in next row.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines