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.6 by gwlarson, Fri Jun 19 11:29:50 1998 UTC vs.
Revision 3.13 by greg, Sat Feb 22 02:07:30 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 161 | Line 159 | char   *argv[];
159          dev_open(radfile = argv[i]);
160                                          /* load octree or scene files */
161          if (octree != NULL) {
162 <                displist = rgl_octlist(octree, NULL, NULL);
162 >                displist = rgl_octlist(octree, NULL, NULL, NULL);
163                  startrtrace(octree);
164          } else
165 <                displist = rgl_filelist(nscenef, scene);
165 >                displist = rgl_filelist(nscenef, scene, NULL);
166                                          /* set initial view */
167          dev_view(currentview < 0 ? &thisview : vwl[currentview].v);
168                                          /* input/render loop */
# Line 173 | Line 171 | char   *argv[];
171                                          /* all done */
172          quit(0);
173   userr:
174 <        fprintf(stderr, "Usage: %s [-w][-b][-v view] rfile [VAR=value]..\n",
174 >        fprintf(stderr,
175 >                "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n",
176                          argv[0]);
177          quit(1);
178   }
179  
180  
181 + void
182   quit(code)                              /* exit gracefully */
183   int     code;
184   {
# Line 297 | Line 297 | char   **av;
297                                          atof(sskip2(buf+4,1)),
298                                          atof(sskip2(buf+4,2)));
299                  else if (backvis && !strncmp(buf, "-bv", 3) &&
300 <                                (!buf[3] || strchr(" 0-FfNn", buf[3]) != NULL))
300 >                                (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL))
301                          backvis = 0;
302          fclose(fp);
303          unlink(optfile);                        /* delete options file */
# Line 423 | Line 423 | char  *id;
423          glDepthFunc(GL_LESS);
424          glShadeModel(GL_SMOOTH);
425          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
426 <        glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
426 >        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
427          glEnable(GL_LIGHTING);
428 +        glFrontFace(GL_CCW);
429 +        glCullFace(GL_BACK);
430          if (backvis)
431                  glDisable(GL_CULL_FACE);
432 <        else {
431 <                glFrontFace(GL_CCW);
432 <                glCullFace(GL_BACK);
432 >        else
433                  glEnable(GL_CULL_FACE);
434        }
434          glDrawBuffer(GL_BACK);
435                                          /* figure out sensible view */
436          pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) /
# Line 626 | Line 625 | int    dx, dy, mov, orb;
625   }
626  
627  
628 + static
629 + waitabit()                              /* pause a moment */
630 + {
631 +        struct timespec ts;
632 +        ts.tv_sec = 0;
633 +        ts.tv_nsec = 5000000;
634 +        nanosleep(&ts, NULL);
635 + }
636 +
637 +
638   getmove(ebut)                           /* get view change */
639   XButtonPressedEvent     *ebut;
640   {
# Line 642 | Line 651 | XButtonPressedEvent    *ebut;
651  
652          while (!XCheckMaskEvent(ourdisplay,
653                          ButtonReleaseMask, levptr(XEvent))) {
654 +                                        /* pause so as not to move too fast */
655 +                waitabit();
656  
657                  if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
658                                  &rootx, &rooty, &wx, &wy, &statemask))
# Line 677 | Line 688 | double md;
688          if (md <= FTINY) md = FHUGE;
689          fbuf[3] = dir[0]*md; fbuf[4] = dir[1]*md; fbuf[5] = dir[2]*md;
690                                  /* trace that ray */
691 <        if (process(rtpd, fbuf, fbuf, 4*sizeof(float), 6*sizeof(float)) !=
692 <                        4*sizeof(float))
691 >        if (process(rtpd, (char *)fbuf, (char *)fbuf,
692 >                        4*sizeof(float), 6*sizeof(float)) != 4*sizeof(float))
693                  error(INTERNAL, "error getting data back from rtrace process");
694          if (fbuf[3] >= .99*FHUGE)
695                  return(0);      /* missed local objects */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines