--- ray/src/util/glrad.c 1998/07/08 18:00:39 3.8 +++ ray/src/util/glrad.c 2003/02/22 02:07:30 3.13 @@ -1,22 +1,20 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: glrad.c,v 3.13 2003/02/22 02:07:30 greg Exp $"; #endif - /* * Program to display Radiance scene using OpenGL. */ -#include "radogl.h" -#include "view.h" -#include "paths.h" #include #include #ifndef NOSTEREO #include #endif #include +#include +#include "radogl.h" +#include "view.h" +#include "paths.h" #include "glradicon.h" #ifndef MAXVIEW @@ -161,10 +159,10 @@ char *argv[]; dev_open(radfile = argv[i]); /* load octree or scene files */ if (octree != NULL) { - displist = rgl_octlist(octree, NULL, NULL); + displist = rgl_octlist(octree, NULL, NULL, NULL); startrtrace(octree); } else - displist = rgl_filelist(nscenef, scene); + displist = rgl_filelist(nscenef, scene, NULL); /* set initial view */ dev_view(currentview < 0 ? &thisview : vwl[currentview].v); /* input/render loop */ @@ -180,6 +178,7 @@ userr: } +void quit(code) /* exit gracefully */ int code; { @@ -298,7 +297,7 @@ char **av; atof(sskip2(buf+4,1)), atof(sskip2(buf+4,2))); else if (backvis && !strncmp(buf, "-bv", 3) && - (!buf[3] || strchr(" 0-FfNn", buf[3]) != NULL)) + (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL)) backvis = 0; fclose(fp); unlink(optfile); /* delete options file */ @@ -426,13 +425,12 @@ char *id; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glEnable(GL_LIGHTING); + glFrontFace(GL_CCW); + glCullFace(GL_BACK); if (backvis) glDisable(GL_CULL_FACE); - else { - glFrontFace(GL_CCW); - glCullFace(GL_BACK); + else glEnable(GL_CULL_FACE); - } glDrawBuffer(GL_BACK); /* figure out sensible view */ pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) / @@ -627,6 +625,16 @@ int dx, dy, mov, orb; } +static +waitabit() /* pause a moment */ +{ + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 5000000; + nanosleep(&ts, NULL); +} + + getmove(ebut) /* get view change */ XButtonPressedEvent *ebut; { @@ -643,6 +651,8 @@ XButtonPressedEvent *ebut; while (!XCheckMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent))) { + /* pause so as not to move too fast */ + waitabit(); if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw, &rootx, &rooty, &wx, &wy, &statemask)) @@ -678,8 +688,8 @@ double md; if (md <= FTINY) md = FHUGE; fbuf[3] = dir[0]*md; fbuf[4] = dir[1]*md; fbuf[5] = dir[2]*md; /* trace that ray */ - if (process(rtpd, fbuf, fbuf, 4*sizeof(float), 6*sizeof(float)) != - 4*sizeof(float)) + if (process(rtpd, (char *)fbuf, (char *)fbuf, + 4*sizeof(float), 6*sizeof(float)) != 4*sizeof(float)) error(INTERNAL, "error getting data back from rtrace process"); if (fbuf[3] >= .99*FHUGE) return(0); /* missed local objects */