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

Comparing ray/src/hd/rhd_x11.c (file contents):
Revision 3.13 by gregl, Thu Dec 11 09:37:43 1997 UTC vs.
Revision 3.17 by gregl, Fri Dec 19 14:44:58 1997 UTC

# Line 22 | Line 22 | static char SCCSid[] = "$SunId$ SGI";
22   #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
23   #endif
24  
25 #define CTRL(c)         ((c)-'@')
26
25   #define GAMMA           2.2             /* default gamma correction */
26  
27   #define MOVPCT          7               /* percent distance to move /frame */
# Line 205 | Line 203 | dev_view(nv)                   /* assign new driver view */
203   VIEW    *nv;
204   {
205          if (nv->type == VT_PAR ||               /* check view legality */
206 <                nv->horiz > 160. || nv->vert > 160.) {
206 >                        nv->horiz > 160. || nv->vert > 160.) {
207                  error(COMMAND, "illegal view type/angle");
208                  nv->type = VT_PER;
209                  nv->horiz = odev.v.horiz;
# Line 224 | Line 222 | VIEW   *nv;
222                          int     dh = DisplayHeight(ourdisplay,ourscreen);
223  
224                          dw -= 25;       /* for window frame */
225 <                        dh -= 100;
225 >                        dh -= 50;
226                          odev.hres = 2.*VIEWDIST/pwidth *
227                                          tan(PI/180./2.*nv->horiz);
228                          odev.vres = 2.*VIEWDIST/pheight *
# Line 474 | Line 472 | moveview(dx, dy, mov, orb)     /* move our view */
472   int     dx, dy, mov, orb;
473   {
474          VIEW    nv;
475 <        FVECT   v1;
475 >        FVECT   odir, v1;
476          double  d;
477          register int    li;
478                                  /* start with old view */
# Line 483 | Line 481 | int    dx, dy, mov, orb;
481          if (mov | orb) {
482                  if ((li = qtFindLeaf(dx, dy)) < 0)
483                          return(0);      /* not on window */
484 <                VSUM(nv.vdir, qtL.wp[li], nv.vp, -1.);
484 >                VSUM(odir, qtL.wp[li], nv.vp, -1.);
485          } else {
486                  if (viewray(nv.vp, nv.vdir, &odev.v,
487                                  (dx+.5)/odev.hres, (dy+.5)/odev.vres) < -FTINY)
488                          return(0);      /* outside view */
489          }
490          if (orb && mov) {               /* orbit left/right */
491 <                spinvector(nv.vdir, nv.vdir, nv.vup, MOVDEG*PI/180.*mov);
492 <                VSUM(nv.vp, qtL.wp[li], nv.vdir, -1.);
491 >                spinvector(odir, odir, nv.vup, d=MOVDEG*PI/180.*mov);
492 >                VSUM(nv.vp, qtL.wp[li], odir, -1.);
493 >                spinvector(nv.vdir, nv.vdir, nv.vup, d);
494          } else if (orb) {               /* orbit up/down */
495 <                fcross(v1, nv.vdir, nv.vup);
495 >                fcross(v1, odir, nv.vup);
496                  if (normalize(v1) == 0.)
497                          return(0);
498 <                spinvector(nv.vdir, nv.vdir, v1, MOVDEG*PI/180.*orb);
499 <                VSUM(nv.vp, qtL.wp[li], nv.vdir, -1.);
498 >                spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb);
499 >                VSUM(nv.vp, qtL.wp[li], odir, -1.);
500 >                spinvector(nv.vdir, nv.vdir, v1, d);
501          } else if (mov) {               /* move forward/backward */
502                  d = MOVPCT/100. * mov;
503 <                VSUM(nv.vp, nv.vp, nv.vdir, d);
503 >                VSUM(nv.vp, nv.vp, odir, d);
504          }
505          if (!mov ^ !orb && headlocked) {        /* restore head height */
506                  VSUM(v1, odev.v.vp, nv.vp, -1.);
# Line 510 | Line 510 | int    dx, dy, mov, orb;
510          if (setview(&nv) != NULL)
511                  return(0);      /* illegal view */
512          dev_view(&nv);
513 <        inpresflags |= DEV_NEWVIEW;
513 >        inpresflags |= DFL(DC_SETVIEW);
514          return(1);
515   }
516  
# Line 544 | Line 544 | XButtonPressedEvent    *ebut;
544                  qtUpdate();
545                  draw_grids();
546          }
547 <        if (!(inpresflags & DEV_NEWVIEW)) {     /* do final motion */
547 >        if (!(inpresflags & DFL(DC_SETVIEW))) { /* do final motion */
548                  movdir = MOVDIR(levptr(XButtonReleasedEvent)->button);
549                  wx = levptr(XButtonReleasedEvent)->x;
550                  wy = levptr(XButtonReleasedEvent)->y;
# Line 574 | Line 574 | register XKeyPressedEvent  *ekey;
574                  headlocked = 0;
575                  return;
576          case 'l':                       /* retrieve last view */
577 <                inpresflags |= DEV_LASTVIEW;
577 >                inpresflags |= DFL(DC_LASTVIEW);
578                  return;
579        case CTRL('S'):
579          case 'p':                       /* pause computation */
580 <                inpresflags |= DEV_WAIT;
580 >                inpresflags |= DFL(DC_PAUSE);
581                  return;
582          case 'v':                       /* spit out view */
583 <                inpresflags |= DEV_PUTVIEW;
583 >                inpresflags |= DFL(DC_GETVIEW);
584                  return;
586        case CTRL('Q'):
585          case '\n':
586          case '\r':                      /* resume computation */
587 <                inpresflags |= DEV_RESUME;
587 >                inpresflags |= DFL(DC_RESUME);
588                  return;
589          case CTRL('R'):                 /* redraw screen */
590                  if (ncolors > 0)
# Line 594 | Line 592 | register XKeyPressedEvent  *ekey;
592                  qtRedraw(0, 0, odev.hres, odev.vres);
593                  return;
594          case CTRL('L'):                 /* refresh from server */
595 <                if (inpresflags & DEV_REDRAW)
595 >                if (inpresflags & DFL(DC_REDRAW))
596                          return;
597                  XClearWindow(ourdisplay, gwind);
598                  draw_grids();
# Line 602 | Line 600 | register XKeyPressedEvent  *ekey;
600                  qtCompost(100);                 /* unload the old tree */
601                  if (ncolors > 0)
602                          new_ctab(ncolors);
603 <                inpresflags |= DEV_REDRAW;      /* resend values from server */
603 >                inpresflags |= DFL(DC_REDRAW);  /* resend values from server */
604                  return;
605 <        case CTRL('D'):
606 <        case 'Q':
605 >        case 'K':                       /* kill rtrace process(es) */
606 >                inpresflags |= DFL(DC_KILL);
607 >                break;
608 >        case 'R':                       /* restart rtrace */
609 >                inpresflags |= DFL(DC_RESTART);
610 >                break;
611 >        case 'C':                       /* clobber holodeck */
612 >                inpresflags |= DFL(DC_CLOBBER);
613 >                break;
614          case 'q':                       /* quit the program */
615 <                inpresflags |= DEV_SHUTDOWN;
615 >                inpresflags |= DFL(DC_QUIT);
616                  return;
617          default:
618                  XBell(ourdisplay, 0);
# Line 623 | Line 628 | register XExposeEvent  *eexp;
628          if (odev.hres == 0 || odev.vres == 0) { /* first exposure */
629                  odev.hres = eexp->width;
630                  odev.vres = eexp->height;
626                inpresflags |= DEV_NEWSIZE;
631          }
632          qtRedraw(eexp->x, odev.vres - eexp->y - eexp->height,
633                          eexp->x + eexp->width, odev.vres - eexp->y);
# Line 643 | Line 647 | register XConfigureEvent  *ersz;
647          odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres);
648          odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres);
649  
650 <        inpresflags |= DEV_NEWSIZE|DEV_NEWVIEW;
650 >        inpresflags |= DFL(DC_SETVIEW);
651   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines