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

Comparing ray/src/px/x11image.c (file contents):
Revision 2.21 by greg, Fri Feb 19 10:46:16 1993 UTC vs.
Revision 2.22 by greg, Tue Mar 2 10:54:08 1993 UTC

# Line 508 | Line 508 | getevent()                             /* process the next event */
508          case ButtonPress:
509                  if (e.b.state & (ShiftMask|ControlMask))
510                          moveimage(&e.b);
511 +                else if (e.b.button == Button2)
512 +                        traceray(e.b.x, e.b.y);
513                  else
514                          getbox(&e.b);
515                  break;
# Line 515 | Line 517 | getevent()                             /* process the next event */
517   }
518  
519  
520 < docom(ekey)                                     /* execute command */
520 > traceray(xpos, ypos)                    /* print ray corresponding to pixel */
521 > int  xpos, ypos;
522 > {
523 >        FLOAT  hv[2];
524 >        FVECT  rorg, rdir;
525 >
526 >        if (!gotview) {         /* no view, no can do */
527 >                XBell(thedisplay, 0);
528 >                return(-1);
529 >        }
530 >        pix2loc(hv, &inpres, xpos-xoff, ypos-yoff);
531 >        if (viewray(rorg, rdir, &ourview, hv[0], hv[1]) < 0)
532 >                return(-1);
533 >        printf("%e %e %e ", rorg[0], rorg[1], rorg[2]);
534 >        printf("%e %e %e\n", rdir[0], rdir[1], rdir[2]);
535 >        fflush(stdout);
536 >        return(0);
537 > }
538 >
539 >
540 > docom(ekey)                             /* execute command */
541   XKeyPressedEvent  *ekey;
542   {
543          char  buf[80];
# Line 524 | Line 546 | XKeyPressedEvent  *ekey;
546          int  com, n;
547          double  comp;
548          FLOAT  hv[2];
527        FVECT  rorg, rdir;
549  
550          n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL);
551          if (n == 0)
# Line 532 | Line 553 | XKeyPressedEvent  *ekey;
553          com = buf[0];
554          switch (com) {                  /* interpret command */
555          case 'q':
556 +        case 'Q':
557          case CTRL('D'):                         /* quit */
558                  quiterr(NULL);
559          case '\n':
# Line 579 | Line 601 | XKeyPressedEvent  *ekey;
601                                          buf, strlen(buf));
602                  return(0);
603          case 't':                               /* trace */
604 <                if (!gotview) {
583 <                        XBell(thedisplay, 0);
584 <                        return(-1);
585 <                }
586 <                pix2loc(hv, &inpres, ekey->x-xoff, ekey->y-yoff);
587 <                if (viewray(rorg, rdir, &ourview, hv[0], hv[1]) < 0)
588 <                        return(-1);
589 <                printf("%e %e %e ", rorg[0], rorg[1], rorg[2]);
590 <                printf("%e %e %e\n", rdir[0], rdir[1], rdir[2]);
591 <                fflush(stdout);
592 <                return(0);
604 >                return(traceray(ekey->x, ekey->y));
605          case '=':                               /* adjust exposure */
606                  if (avgbox(cval) == -1)
607                          return(-1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines