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.7 by gwlarson, Tue Jul 7 08:58:34 1998 UTC vs.
Revision 3.14 by greg, Mon May 19 16:32:19 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Program to display Radiance scene using OpenGL.
6   */
7  
11 #include "radogl.h"
12 #include "view.h"
13 #include "paths.h"
8   #include <sys/types.h>
9   #include <GL/glx.h>
10   #ifndef NOSTEREO
11   #include <X11/extensions/SGIStereo.h>
12   #endif
13   #include <ctype.h>
14 + #include <time.h>
15 + #include "radogl.h"
16 + #include "view.h"
17 + #include "paths.h"
18   #include "glradicon.h"
19  
20   #ifndef MAXVIEW
# Line 92 | Line 90 | int    displist;                       /* our scene display list */
90  
91   int     no_render = 0;                  /* don't rerender */
92  
93 < #ifdef BSD
96 < #define strchr          index
97 < #endif
98 <
99 < extern char     *strchr(), *fgets(), *fgetline(), *atos(), *scan4var();
93 > extern char     *fgetline(), *atos(), *scan4var();
94   extern int      nowarn;                 /* turn warnings off? */
101 extern time_t   time();
95  
96  
97   main(argc, argv)
# Line 161 | Line 154 | char   *argv[];
154          dev_open(radfile = argv[i]);
155                                          /* load octree or scene files */
156          if (octree != NULL) {
157 <                displist = rgl_octlist(octree, NULL, NULL);
157 >                displist = rgl_octlist(octree, NULL, NULL, NULL);
158                  startrtrace(octree);
159          } else
160 <                displist = rgl_filelist(nscenef, scene);
160 >                displist = rgl_filelist(nscenef, scene, NULL);
161                                          /* set initial view */
162          dev_view(currentview < 0 ? &thisview : vwl[currentview].v);
163                                          /* input/render loop */
# Line 173 | Line 166 | char   *argv[];
166                                          /* all done */
167          quit(0);
168   userr:
169 <        fprintf(stderr, "Usage: %s [-w][-b][-v view] rfile [VAR=value]..\n",
169 >        fprintf(stderr,
170 >                "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n",
171                          argv[0]);
172          quit(1);
173   }
174  
175  
176 + void
177   quit(code)                              /* exit gracefully */
178   int     code;
179   {
# Line 297 | Line 292 | char   **av;
292                                          atof(sskip2(buf+4,1)),
293                                          atof(sskip2(buf+4,2)));
294                  else if (backvis && !strncmp(buf, "-bv", 3) &&
295 <                                (!buf[3] || strchr(" 0-FfNn", buf[3]) != NULL))
295 >                                (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL))
296                          backvis = 0;
297          fclose(fp);
298          unlink(optfile);                        /* delete options file */
# Line 425 | Line 420 | char  *id;
420          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
421          glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
422          glEnable(GL_LIGHTING);
423 +        glFrontFace(GL_CCW);
424 +        glCullFace(GL_BACK);
425          if (backvis)
426                  glDisable(GL_CULL_FACE);
427 <        else {
431 <                glFrontFace(GL_CCW);
432 <                glCullFace(GL_BACK);
427 >        else
428                  glEnable(GL_CULL_FACE);
434        }
429          glDrawBuffer(GL_BACK);
430                                          /* figure out sensible view */
431          pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) /
# Line 626 | Line 620 | int    dx, dy, mov, orb;
620   }
621  
622  
623 + static
624 + waitabit()                              /* pause a moment */
625 + {
626 +        struct timespec ts;
627 +        ts.tv_sec = 0;
628 +        ts.tv_nsec = 5000000;
629 +        nanosleep(&ts, NULL);
630 + }
631 +
632 +
633   getmove(ebut)                           /* get view change */
634   XButtonPressedEvent     *ebut;
635   {
# Line 642 | Line 646 | XButtonPressedEvent    *ebut;
646  
647          while (!XCheckMaskEvent(ourdisplay,
648                          ButtonReleaseMask, levptr(XEvent))) {
649 +                                        /* pause so as not to move too fast */
650 +                waitabit();
651  
652                  if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
653                                  &rootx, &rooty, &wx, &wy, &statemask))
# Line 677 | Line 683 | double md;
683          if (md <= FTINY) md = FHUGE;
684          fbuf[3] = dir[0]*md; fbuf[4] = dir[1]*md; fbuf[5] = dir[2]*md;
685                                  /* trace that ray */
686 <        if (process(rtpd, fbuf, fbuf, 4*sizeof(float), 6*sizeof(float)) !=
687 <                        4*sizeof(float))
686 >        if (process(rtpd, (char *)fbuf, (char *)fbuf,
687 >                        4*sizeof(float), 6*sizeof(float)) != 4*sizeof(float))
688                  error(INTERNAL, "error getting data back from rtrace process");
689          if (fbuf[3] >= .99*FHUGE)
690                  return(0);      /* missed local objects */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines