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

Comparing ray/src/rt/rv2.c (file contents):
Revision 1.19 by greg, Mon Feb 5 09:57:45 1990 UTC vs.
Revision 1.23 by greg, Thu Jul 18 15:49:06 1991 UTC

# Line 151 | Line 151 | char  *s;
151                          newview(&nv);
152                  return;
153          }
154 <        if (oldview.horiz == 0) {       /* no old view! */
154 >        if (oldview.type == 0) {        /* no old view! */
155                  error(COMMAND, "no previous view");
156                  return;
157          }
# Line 171 | Line 171 | char  *s;
171  
172          if (getinterest(s, 1, nv.vdir, &zfact) < 0)
173                  return;
174 +        nv.type = ourview.type;
175          VCOPY(nv.vp, ourview.vp);
176          VCOPY(nv.vup, ourview.vup);
177          nv.hoff = ourview.hoff; nv.voff = ourview.voff;
178 <        if ((nv.type = ourview.type) == VT_PAR) {
179 <                nv.horiz = ourview.horiz / zfact;
179 <                nv.vert = ourview.vert / zfact;
180 <        } else {
181 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
182 <                                (PI/180./2.);
183 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
184 <                                (PI/180./2.);
185 <        }
178 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
179 >        zoomview(&nv, zfact);
180          newview(&nv);
181   }
182  
# Line 212 | Line 206 | char  *s;
206                  error(COMMAND, "missing angle");
207                  return;
208          }
209 +        nv.type = ourview.type;
210          VCOPY(nv.vp, ourview.vp);
211          VCOPY(nv.vup, ourview.vup);
212          nv.hoff = ourview.hoff; nv.voff = ourview.voff;
# Line 221 | Line 216 | char  *s;
216                  normalize(v1);
217                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
218          }
219 <        if ((nv.type = ourview.type) == VT_PAR) {
220 <                nv.horiz = ourview.horiz / zfact;
226 <                nv.vert = ourview.vert / zfact;
227 <        } else {
228 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
229 <                                (PI/180./2.);
230 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
231 <                                (PI/180./2.);
232 <        }
219 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
220 >        zoomview(&nv, zfact);
221          newview(&nv);
222   }
223  
# Line 330 | Line 318 | register char  *s;
318          extern int  ambdiv;
319          extern int  ambssamp;
320          extern int  ambounce;
321 +        extern int  directinvis;
322 +        extern int  do_irrad;
323          int  i0;
324          double  d0, d1, d2;
325 <        char  buf[128];
325 >        char  buf[128], ans[4];
326          
327          if (s[0] == '\0') {
328 <                (*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: ");
328 >                (*dev->comout)(
329 >                        "aa ab ad ar as av b dc dj di dt i lr lw sp st: ");
330                  (*dev->comin)(buf, NULL);
331                  s = buf;
332          }
# Line 403 | Line 394 | register char  *s;
394                          }
395                          shadthresh = d0;
396                          break;
397 +                case 'i':                       /* invisibility */
398 +                        if (sscanf(s+2, "%1s", ans) != 1) {
399 +                                sprintf(buf, "direct invisibility (%c): ",
400 +                                                directinvis ? 'y' : 'n');
401 +                                (*dev->comout)(buf);
402 +                                (*dev->comin)(buf, NULL);
403 +                                if (sscanf(buf, "%1s", ans) != 1)
404 +                                        break;
405 +                        }
406 +                        directinvis = tolower(ans[0]) == 'y';
407 +                        break;
408                  default:
409                          goto badparam;
410                  }
411                  break;
412 +        case 'b':                       /* black and white */
413 +                if (sscanf(s+1, "%1s", ans) != 1) {
414 +                        sprintf(buf, "black and white (%c): ",
415 +                                        greyscale ? 'y' : 'n');
416 +                        (*dev->comout)(buf);
417 +                        (*dev->comin)(buf, NULL);
418 +                        if (sscanf(buf, "%1s", ans) != 1)
419 +                                break;
420 +                }
421 +                greyscale = tolower(ans[0]) == 'y';
422 +                break;
423 +        case 'i':                       /* irradiance */
424 +                if (sscanf(s+1, "%1s", ans) != 1) {
425 +                        sprintf(buf, "irradiance (%c): ",
426 +                                        do_irrad ? 'y' : 'n');
427 +                        (*dev->comout)(buf);
428 +                        (*dev->comin)(buf, NULL);
429 +                        if (sscanf(buf, "%1s", ans) != 1)
430 +                                break;
431 +                }
432 +                do_irrad = tolower(ans[0]) == 'y';
433 +                break;
434          case 'a':                       /* ambient */
435                  switch (s[1]) {
436                  case 'v':                       /* value */
# Line 541 | Line 565 | char  *s;
565                  if ((*dev->getcur)(&x, &y) == ABORT)
566                          return;
567  
568 <                viewray(thisray.rorg, thisray.rdir, &ourview,
569 <                                (x+.5)/hresolu, (y+.5)/vresolu);
570 <                
568 >                if (viewray(thisray.rorg, thisray.rdir, &ourview,
569 >                                (x+.5)/hresolu, (y+.5)/vresolu) < 0) {
570 >                        error(COMMAND, "not on image");
571 >                        return;
572 >                }
573 >
574          } else if (normalize(thisray.rdir) == 0.0) {
575                  error(COMMAND, "zero ray direction");
576                  return;
# Line 610 | Line 637 | char  *s;
637                  fputexpos(exposure, fp);
638          if (dev->pixaspect != 1.0)
639                  fputaspect(dev->pixaspect, fp);
640 +        fputformat(COLRFMT, fp);
641          putc('\n', fp);
642          fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
643  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines