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

Comparing ray/src/util/glrad.c (file contents):
Revision 3.18 by schorsch, Fri Jan 2 12:51:54 2004 UTC vs.
Revision 3.25 by greg, Mon Apr 25 20:06:22 2016 UTC

# Line 29 | Line 29 | static const char      RCSid[] = "$Id$";
29  
30   #define ZOOMPCT         9               /* percent to zoom at a time */
31  
32 < #define MOVPCT          7               /* percent distance to move /frame */
32 > #define MOVPCT          4               /* percent distance to move /frame */
33   #define MOVDIR(b)       ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)
34 < #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
34 > #define MOVDEG          (-1.5)          /* degrees to orbit CW/down /frame */
35   #define MOVORB(s)       ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)
36  
37   #define BORWIDTH        5               /* border width */
# Line 97 | Line 97 | extern int     nowarn;                 /* turn warnings off? */
97  
98   static void startrtrace(char    *octname);
99   static void runrad(int  ac, char        **av);
100 < static int findvw(register char *nm);
101 < static int varmatch(register char       *s, register char       *vn);
100 > static int findvw(char  *nm);
101 > static int varmatch(char        *s, char        *vn);
102   static char * scan4var(char     *buf, int       buflen, char    *vname, FILE    *fp);
103   static void dev_open(char  *id);
104   static void dev_close(void);
105 < static int dev_view(register VIEW       *nv);
105 > static int dev_view(VIEW        *nv);
106   static int dev_input(int        nsecs);
107   static void render(void);
108   static int moveview(int dx, int dy, int mov, int        orb);
109   static void waitabit(void);
110   static void getmove(XButtonPressedEvent *ebut);
111   static int getintersect(FVECT   wp, FVECT       org, FVECT      dir, double     md);
112 < static void setglpersp(register VIEW    *vp);
113 < static int getkey(register XKeyPressedEvent  *ekey);
112 > static void setglpersp(VIEW     *vp);
113 > static int getkey(XKeyPressedEvent  *ekey);
114   static void zoomview(int        pct, int        dx, int dy);
115   static void gotoview(int        vwnum);
116   static void appendview(char     *nm, VIEW       *vp);
117   static void copylastv(char      *cause);
118 < static void fixwindow(register XExposeEvent  *eexp);
119 < static void resizewindow(register XConfigureEvent  *ersz);
118 > static void fixwindow(XExposeEvent  *eexp);
119 > static void resizewindow(XConfigureEvent  *ersz);
120  
121  
122   int
# Line 203 | Line 203 | userr:
203  
204  
205   void
206 < quit(code)                              /* exit gracefully */
207 < int     code;
206 > quit(                           /* exit gracefully */
207 >        int     code
208 > )
209   {
210          if (ourdisplay != NULL)
211                  dev_close();
# Line 244 | Line 245 | runrad(                                /* run rad and load variables */
245          static char     optfile[] = TEMPLATE;
246          int     nvn = 0, nvv = 0;
247          FILE    *fp;
248 <        register char   *cp;
248 >        char    *cp;
249          char    radcomm[256], buf[128], nam[32];
250                                          /* set rad commmand */
251          strcpy(radcomm, "rad -w -v 0        "); /* look out below! */
# Line 280 | Line 281 | runrad(                                /* run rad and load variables */
281                  eyedist = atof(cp);
282                                                  /* look for materials */
283          while ((cp = scan4var(buf, sizeof(buf), "materials", fp)) != NULL) {
284 <                nscenef += wordstring(scene+nscenef, cp);
284 >                nscenef += wordstring(scene+nscenef, MAXSCENE-nscenef, cp);
285                  buf[0] = '\0';
286          }
287                                                  /* look for octree */
# Line 288 | Line 289 | runrad(                                /* run rad and load variables */
289                  octree = savqstr(cp);
290                                                  /* look for scene files */
291          while ((cp = scan4var(buf, sizeof(buf), "scene", fp)) != NULL) {
292 <                nscenef += wordstring(scene+nscenef, cp);
292 >                nscenef += wordstring(scene+nscenef, MAXSCENE-nscenef, cp);
293                  buf[0] = '\0';
294          }
295                                                  /* load view names */
# Line 334 | Line 335 | runrad(                                /* run rad and load variables */
335  
336   static int
337   findvw(                 /* find named view */
338 <        register char   *nm
338 >        char    *nm
339   )
340   {
341 <        register int    n;
341 >        int     n;
342  
343          if ((*nm >= '1') & (*nm <= '9') &&
344                          (n = atoi(nm)-1) <= MAXVIEW && vwl[n].v != NULL)
# Line 351 | Line 352 | findvw(                        /* find named view */
352  
353   static int
354   varmatch(                               /* match line to variable */
355 <        register char   *s,
356 <        register char   *vn
355 >        char    *s,
356 >        char    *vn
357   )
358   {
359 <        register int    c;
359 >        int     c;
360  
361          for ( ; *vn && *s == *vn; s++, vn++)
362                  ;
# Line 378 | Line 379 | scan4var(      /* scan for variable from fp */
379   )
380   {
381          int     cval;
382 <        register char   *cp;
382 >        char    *cp;
383                                          /* search out matching line */
384          while ((cval = varmatch(buf, vname))) {
385                  if (cval > 0)                   /* gone too far? */
# Line 448 | Line 449 | dev_open(                      /* initialize GLX driver */
449                                          /* set window manager hints */
450          ourxwmhints.flags = InputHint|IconPixmapHint;
451          ourxwmhints.input = True;
452 <        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
453 <                gwind, glradicon_bits, glradicon_width, glradicon_height);
452 >        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind,
453 >                (char *)glradicon_bits, glradicon_width, glradicon_height);
454          XSetWMHints(ourdisplay, gwind, &ourxwmhints);
455                                          /* set GLX context */
456          glXMakeCurrent(ourdisplay, gwind, gctx);
# Line 500 | Line 501 | dev_close(void)                        /* close our display and free resour
501  
502   static int
503   dev_view(                       /* assign new driver view */
504 <        register VIEW   *nv
504 >        VIEW    *nv
505   )
506   {
507          int     newhres = hres, newvres = vres;
# Line 538 | Line 539 | dev_view(                      /* assign new driver view */
539                          XResizeWindow(ourdisplay, gwind, newhres, newvres);
540                          do
541                                  dev_input(0);           /* get resize event */
542 <                        while ((newhres != hres) | (newvres != vres));
542 >                        while ((newhres != hres) & (newvres != vres));
543                          no_render--;
544                  }
545          }
# Line 645 | Line 646 | moveview(      /* move our view */
646                  VSUM(nv.vp, wp, odir, -1.);
647                  spinvector(nv.vdir, nv.vdir, nv.vup, d);
648          } else if (orb) {               /* orbit up/down */
649 <                fcross(v1, odir, nv.vup);
650 <                if (normalize(v1) == 0.)
649 >                if (geodesic(odir, odir, nv.vup,
650 >                                d=MOVDEG*PI/180.*orb, GEOD_RAD) == 0.0)
651                          return(0);
651                spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb);
652                  VSUM(nv.vp, wp, odir, -1.);
653 <                spinvector(nv.vdir, nv.vdir, v1, d);
653 >                geodesic(nv.vdir, nv.vdir, nv.vup, d, GEOD_RAD);
654          } else if (mov) {               /* move forward/backward */
655                  d = MOVPCT/100. * mov;
656                  VSUM(nv.vp, nv.vp, odir, d);
# Line 672 | Line 672 | waitabit(void)                         /* pause a moment */
672   {
673          struct timespec ts;
674          ts.tv_sec = 0;
675 <        ts.tv_nsec = 5000000;
675 >        ts.tv_nsec = 50000000;
676          nanosleep(&ts, NULL);
677   }
678  
# Line 748 | Line 748 | getintersect(          /* intersect ray with scene geometry */
748  
749   static void
750   setglpersp(                     /* set perspective view in GL */
751 <        register VIEW   *vp
751 >        VIEW    *vp
752   )
753   {
754          double  d, xmin, xmax, ymin, ymax, zmin, zmax;
# Line 782 | Line 782 | setglpersp(                    /* set perspective view in GL */
782  
783   static int
784   getkey(                         /* get input key */
785 <        register XKeyPressedEvent  *ekey
785 >        XKeyPressedEvent  *ekey
786   )
787   {
788          int  n;
# Line 931 | Line 931 | copylastv(                     /* copy last view position */
931  
932   static void
933   fixwindow(                              /* repair damage to window */
934 <        register XExposeEvent  *eexp
934 >        XExposeEvent  *eexp
935   )
936   {
937          if ((hres == 0) | (vres == 0)) {        /* first exposure */
# Line 947 | Line 947 | fixwindow(                             /* repair damage to window */
947  
948   static void
949   resizewindow(                   /* resize window */
950 <        register XConfigureEvent  *ersz
950 >        XConfigureEvent  *ersz
951   )
952   {
953          static char     resizing[] = "resizing window";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines