Back to index

radiance  4R0+20100331
Defines | Functions | Variables
glrad.c File Reference
#include <sys/types.h>
#include <GL/glx.h>
#include <X11/extensions/SGIStereo.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include "radogl.h"
#include "view.h"
#include "paths.h"
#include "glradicon.h"
#include "rtprocess.h"

Go to the source code of this file.

Defines

#define MAXVIEW   63 /* maximum number of standard views */
#define MAXSCENE   127 /* maximum number of scene files */
#define ZOOMPCT   9 /* percent to zoom at a time */
#define MOVPCT   7 /* percent distance to move /frame */
#define MOVDIR(b)   ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)
#define MOVDEG   (-5) /* degrees to orbit CW/down /frame */
#define MOVORB(s)   ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)
#define BORWIDTH   5 /* border width */
#define ourscreen   DefaultScreen(ourdisplay)
#define ourroot   RootWindow(ourdisplay,ourscreen)
#define ourmask
#define levptr(etype)   ((etype *)&currentevent)
#define setstereobuf(bid)

Functions

static void startrtrace (char *octname)
static void runrad (int ac, char **av)
static int findvw (register char *nm)
static int varmatch (register char *s, register char *vn)
static char * scan4var (char *buf, int buflen, char *vname, FILE *fp)
static void dev_open (char *id)
static void dev_close (void)
static int dev_view (register VIEW *nv)
static int dev_input (int nsecs)
static void render (void)
static int moveview (int dx, int dy, int mov, int orb)
static void waitabit (void)
static void getmove (XButtonPressedEvent *ebut)
static int getintersect (FVECT wp, FVECT org, FVECT dir, double md)
static void setglpersp (register VIEW *vp)
static int getkey (register XKeyPressedEvent *ekey)
static void zoomview (int pct, int dx, int dy)
static void gotoview (int vwnum)
static void appendview (char *nm, VIEW *vp)
static void copylastv (char *cause)
static void fixwindow (register XExposeEvent *eexp)
static void resizewindow (register XConfigureEvent *ersz)
int main (int argc, char *argv[])
void quit (int code)

Variables

static const char RCSid [] = "$Id: glrad.c,v 3.20 2005/07/24 19:53:08 greg Exp $"
XEvent currentevent
int mapped = 0
unsigned long ourblack = 0
unsigned long ourwhite = ~0
Display * ourdisplay = NULL
XVisualInfo * ourvinf
Window gwind = 0
int hres
int vres
int maxhres
int maxvres
GLXContext gctx
double pwidth
double pheight
int headlocked = 0
struct {
char * nam
VIEWv
vwl [MAXVIEW+1]
int currentview = 0
VIEW thisview = STDVIEW
double eyedist = 1
VIEW lastview
char * progname
char * radfile
char * scene [MAXSCENE+1]
int nscenef = 0
char * octree
SUBPROC rtpd
int silent = 0
int backvis = 1
int stereo = 0
int displist
int no_render = 0
int nowarn

Define Documentation

#define BORWIDTH   5 /* border width */

Definition at line 37 of file glrad.c.

#define levptr (   etype)    ((etype *)&currentevent)

Definition at line 44 of file glrad.c.

#define MAXSCENE   127 /* maximum number of scene files */

Definition at line 27 of file glrad.c.

#define MAXVIEW   63 /* maximum number of standard views */

Definition at line 24 of file glrad.c.

#define MOVDEG   (-5) /* degrees to orbit CW/down /frame */

Definition at line 34 of file glrad.c.

#define MOVDIR (   b)    ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)

Definition at line 33 of file glrad.c.

#define MOVORB (   s)    ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)

Definition at line 35 of file glrad.c.

#define MOVPCT   7 /* percent distance to move /frame */

Definition at line 32 of file glrad.c.

#define ourmask
Value:
(StructureNotifyMask|ExposureMask|KeyPressMask|\
                     ButtonPressMask|ButtonReleaseMask)

Definition at line 41 of file glrad.c.

#define ourroot   RootWindow(ourdisplay,ourscreen)

Definition at line 40 of file glrad.c.

#define ourscreen   DefaultScreen(ourdisplay)

Definition at line 39 of file glrad.c.

#define setstereobuf (   bid)
Value:
(glXWaitGL(), \
                            XSGISetStereoBuffer(ourdisplay, gwind, bid), \
                            glXWaitX())

Definition at line 87 of file glrad.c.

#define ZOOMPCT   9 /* percent to zoom at a time */

Definition at line 30 of file glrad.c.


Function Documentation

static void appendview ( char *  nm,
VIEW vp 
) [static]

Definition at line 885 of file glrad.c.

{
       FILE   *fp;
                                   /* check if already in there */
       if (!memcmp(&thisview, vwl[currentview].v, sizeof(VIEW))) {
              error(COMMAND, "view already in standard list");
              return;
       }
                                   /* append to file */
       if ((fp = fopen(radfile, "a")) == NULL) {
              error(COMMAND, "cannot append rad input file");
              return;
       }
       fputs("view=", fp);
       if (nm != NULL) {
              fputc(' ', fp); fputs(nm, fp);
       }
       fprintview(vp, fp); fputc('\n', fp);
       fclose(fp);
                                   /* append to our list */
       while (vwl[currentview].v != NULL)
              currentview++;
       if (currentview >= MAXVIEW)
              error(INTERNAL, "too many views in appendview");
       vwl[currentview].v = (VIEW *)bmalloc(sizeof(VIEW));
       *(vwl[currentview].v) = thisview;
       if (nm != NULL)
              vwl[currentview].nam = savqstr(nm);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void copylastv ( char *  cause) [static]

Definition at line 920 of file glrad.c.

{
       static char   *lastvc;

       if (cause == lastvc)
              return;                     /* only record one view per cause */
       lastvc = cause;
       lastview = thisview;
}

Here is the caller graph for this function:

static void dev_close ( void  ) [static]
static int dev_input ( int  nsecs) [static]

Definition at line 554 of file glrad.c.

{
#if 0
       static time_t lasttime = 0;
       time_t thistime;

       if (nsecs > 0) {
              thistime = time(0);
              nsecs -= (long)(thistime - lasttime);
              lasttime = thistime;
       }
       if (nsecs > 0)
              alarm(nsecs);
#endif
       XNextEvent(ourdisplay, levptr(XEvent));
       switch (levptr(XEvent)->type) {
       case ConfigureNotify:
              resizewindow(levptr(XConfigureEvent));
              break;
       case UnmapNotify:
              mapped = 0;
              break;
       case MapNotify:
              mapped = 1;
              break;
       case Expose:
              fixwindow(levptr(XExposeEvent));
              break;
       case KeyPress:
              return(getkey(levptr(XKeyPressedEvent)));
       case ButtonPress:
              getmove(levptr(XButtonPressedEvent));
              break;
       }
       return(1);
}

Here is the call graph for this function:

static void dev_open ( char *  id) [static]
static int dev_view ( register VIEW nv) [static]
static int findvw ( register char *  nm) [static]

Definition at line 337 of file glrad.c.

{
       register int  n;

       if ((*nm >= '1') & (*nm <= '9') &&
                     (n = atoi(nm)-1) <= MAXVIEW && vwl[n].v != NULL)
              return(n);
       for (n = 0; vwl[n].v != NULL; n++)
              if (vwl[n].nam != NULL && !strcmp(nm, vwl[n].nam))
                     return(n);
       return(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void fixwindow ( register XExposeEvent *  eexp) [static]

Definition at line 934 of file glrad.c.

{
       if ((hres == 0) | (vres == 0)) {   /* first exposure */
              resizewindow((XConfigureEvent *)eexp);
              return;
       }
       if (eexp->count)            /* wait for final exposure */
              return;
                                   /* rerender everything */
       render();
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int getintersect ( FVECT  wp,
FVECT  org,
FVECT  dir,
double  md 
) [static]

Definition at line 722 of file glrad.c.

{
       float  fbuf[6];
                            /* check to see if rtrace is running */
       /* if (rtpd.pid <= 0) */
       if (!rtpd.running)
              return(0);
                            /* assign origin */
       fbuf[0] = org[0]; fbuf[1] = org[1]; fbuf[2] = org[2];
                            /* compute clipping distance */
       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, (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 */
       wp[0] = fbuf[0]; wp[1] = fbuf[1]; wp[2] = fbuf[2];
       return(1);           /* else return world intersection */
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int getkey ( register XKeyPressedEvent *  ekey) [static]

Definition at line 785 of file glrad.c.

{
       int  n;
       char   buf[8];

       n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL);
       if (n != 1)
              return(1);
       switch (buf[0]) {
       case 'h':                   /* turn on height motion lock */
              headlocked = 1;
              break;
       case 'H':                   /* turn off height motion lock */
              headlocked = 0;
              break;
       case 'l':                   /* retrieve last (premouse) view */
              if (lastview.type) {
                     VIEW   vtmp;
                     vtmp = thisview;
                     dev_view(&lastview);
                     lastview = vtmp;
              } else
                     XBell(ourdisplay, 0);
              break;
       case 'n':                   /* move to next standard view */
              gotoview(currentview+1);
              break;
       case 'p':                   /* move to last standard view */
              gotoview(currentview-1);
              break;
       case '+':                   /* zoom in */
              zoomview(100+ZOOMPCT, ekey->x, vres-1-ekey->y);
              break;
       case '-':                   /* zoom out */
              zoomview(100-ZOOMPCT, ekey->x, vres-1-ekey->y);
              break;
       case 'v':                   /* spit current view to stdout */
              fputs(VIEWSTR, stdout);
              fprintview(&thisview, stdout);
              fputc('\n', stdout);
              break;
       case 'V':                   /* append view to rad file */
              appendview(NULL, &thisview);
              break;
       case 'q':                   /* quit the program */
              return(0);
       default:
              XBell(ourdisplay, 0);
              break;
       }
       return(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void getmove ( XButtonPressedEvent *  ebut) [static]

Definition at line 682 of file glrad.c.

{
       int    movdir = MOVDIR(ebut->button);
       int    movorb = MOVORB(ebut->state);
       int    moved = 0;
       Window rootw, childw;
       int    rootx, rooty, wx, wy;
       unsigned int  statemask;

       copylastv( movorb ? (movdir ? "left/right" : "up/down") :
                     (movdir ? "fore/back" : "rotate") );
       XNoOp(ourdisplay);

       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))
                     break;        /* on another screen */

              if (!moveview(wx, vres-1-wy, movdir, movorb)) {
                     sleep(1);
                     continue;
              } else
                     moved++;
       }
       if (!moved) {                             /* do final motion */
              movdir = MOVDIR(levptr(XButtonReleasedEvent)->button);
              wx = levptr(XButtonReleasedEvent)->x;
              wy = levptr(XButtonReleasedEvent)->y;
              moveview(wx, vres-1-wy, movdir, movorb);
       }
}

Here is the call graph for this function:

static void gotoview ( int  vwnum) [static]

Definition at line 870 of file glrad.c.

{
       if (vwnum < 0)
              for (vwnum = currentview; vwl[vwnum+1].v != NULL; vwnum++)
                     ;
       else if (vwnum >= MAXVIEW || vwl[vwnum].v == NULL)
              vwnum = 0;
       copylastv("standard view");
       dev_view(vwl[currentview=vwnum].v);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 123 of file glrad.c.

{
       char   *viewsel = NULL;
       long   vwintvl = 0;
       int    i;

       progname = argv[0];
       for (i = 1; i < argc && argv[i][0] == '-'; i++)
              switch (argv[i][1]) {
              case 'v':
                     viewsel = argv[++i];
                     break;
              case 'w':
                     nowarn = !nowarn;
                     break;
              case 's':
                     silent = !silent;
                     break;
              case 'S':
                     stereo = !stereo;
                     break;
              case 'c':
                     vwintvl = atoi(argv[++i]);
                     break;
              case 'b':
                     backvis = !backvis;
                     break;
              default:
                     goto userr;
              }
       if (i >= argc)
              goto userr;
#ifdef NOSTEREO
       if (stereo)
              error(INTERNAL, "stereo not supported in this version");
#endif
                                   /* run rad and get views */
       runrad(argc-i, argv+i);
                                   /* check view */
       if (viewsel != NULL) {
              if (viewsel[0] == '-') {
                     char   *ve = viewsel;
                     if (!sscanview(&thisview, viewsel) ||
                                   (ve = setview(&thisview)) != NULL) {
                            fprintf(stderr, "%s: bad view: %s\n",
                                          progname, ve);
                            quit(1);
                     }
                     currentview = -1;
              } else if ((currentview = findvw(viewsel)) < 0) {
                     fprintf(stderr, "%s: no such view: %s\n",
                                          progname, viewsel);
                     quit(1);
              }
       }
                                   /* open GL */
       dev_open(radfile = argv[i]);
                                   /* load octree or scene files */
       if (octree != NULL) {
              displist = rgl_octlist(octree, NULL, NULL, NULL);
              startrtrace(octree);
       } else
              displist = rgl_filelist(nscenef, scene, NULL);
                                   /* set initial view */
       dev_view(currentview < 0 ? &thisview : vwl[currentview].v);
                                   /* input/render loop */
       while (dev_input(vwintvl))
              ;
                                   /* all done */
       quit(0);
userr:
       fprintf(stderr,
              "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n",
                     argv[0]);
       quit(1);
       return 1; /* pro forma return */
}

Here is the call graph for this function:

static int moveview ( int  dx,
int  dy,
int  mov,
int  orb 
) [static]

Definition at line 622 of file glrad.c.

{
       VIEW   nv;
       FVECT  odir, v1, wp;
       double d;
                            /* start with old view */
       nv = thisview;
                            /* change view direction */
       if ((d = viewray(v1, odir, &thisview,
                     (dx+.5)/hres, (dy+.5)/vres)) < -FTINY)
              return(0);           /* outside view */
       if (mov | orb) {
              if (!getintersect(wp, v1, odir, d))
                     return(0);
              VSUM(odir, wp, nv.vp, -1.);
       } else
              VCOPY(nv.vdir, odir);
       if (orb && mov) {           /* orbit left/right */
              spinvector(odir, odir, nv.vup, d=MOVDEG*PI/180.*mov);
              VSUM(nv.vp, wp, odir, -1.);
              spinvector(nv.vdir, nv.vdir, nv.vup, d);
       } else if (orb) {           /* orbit up/down */
              fcross(v1, odir, nv.vup);
              if (normalize(v1) == 0.)
                     return(0);
              spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb);
              VSUM(nv.vp, wp, odir, -1.);
              spinvector(nv.vdir, nv.vdir, v1, d);
       } else if (mov) {           /* move forward/backward */
              d = MOVPCT/100. * mov;
              VSUM(nv.vp, nv.vp, odir, d);
       }
       if (!mov ^ !orb && headlocked) {   /* restore head height */
              VSUM(v1, thisview.vp, nv.vp, -1.);
              d = DOT(v1, thisview.vup);
              VSUM(nv.vp, nv.vp, thisview.vup, d);
       }
       if (setview(&nv) != NULL)
              return(0);    /* illegal view */
       dev_view(&nv);
       return(1);
}

Here is the call graph for this function:

void quit ( int  code)

Definition at line 206 of file glrad.c.

{
       if (ourdisplay != NULL)
              dev_close();
       /* if (rtpd.pid > 0) { */
       if (rtpd.running) {
              if (close_process(&rtpd) > 0)
                     wputs("bad exit status from rtrace\n");
              /* rtpd.pid = 0; */
       }
       exit(code);
}

Here is the call graph for this function:

static void render ( void  ) [static]

Definition at line 595 of file glrad.c.

{
       double d;

       if (!mapped | no_render)
              return;
       glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
       glCallList(displist);
       if (stereo) {                      /* do right eye for stereo */
              setstereobuf(STEREO_BUFFER_RIGHT);
              glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
              glMatrixMode(GL_MODELVIEW);
              glPushMatrix();
              d = -eyedist / sqrt(thisview.hn2);
              glTranslated(d*thisview.hvec[0], d*thisview.hvec[1],
                            d*thisview.hvec[2]);
              glCallList(displist);
              glMatrixMode(GL_MODELVIEW);
              glPopMatrix();
              setstereobuf(STEREO_BUFFER_LEFT);
       }
       glXSwapBuffers(ourdisplay, gwind); /* calls glFlush() */
       rgl_checkerr("rendering display list");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void resizewindow ( register XConfigureEvent *  ersz) [static]

Definition at line 950 of file glrad.c.

{
       static char   resizing[] = "resizing window";
       double wa, va;

       glViewport(0, 0, hres=ersz->width, vres=ersz->height);
       if (hres > maxhres) maxhres = hres;
       if (vres > maxvres) maxvres = vres;
       if (no_render)
              return;
       wa = (vres*pheight)/(hres*pwidth);
       va = viewaspect(&thisview);
       if (va > wa+.05) {
              copylastv(resizing);
              thisview.vert = 2.*180./PI *
                            atan( tan(PI/180./2. * thisview.horiz) * wa );
       } else if (va < wa-.05) {
              copylastv(resizing);
              thisview.horiz = 2.*180./PI *
                            atan( tan(PI/180./2. * thisview.vert) / wa );
       } else
              return;
       setview(&thisview);
       dev_view(&thisview);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void runrad ( int  ac,
char **  av 
) [static]

Definition at line 240 of file glrad.c.

{
       static char   optfile[] = TEMPLATE;
       int    nvn = 0, nvv = 0;
       FILE   *fp;
       register char *cp;
       char   radcomm[256], buf[128], nam[32];
                                   /* set rad commmand */
       strcpy(radcomm, "rad -w -v 0        ");   /* look out below! */
       cp = radcomm + 19;
       if (silent) {
              strcpy(cp, "-s ");
              cp += 3;
       }
       while (ac--) {
              strcpy(cp, *av++);
              while (*cp) cp++;
              *cp++ = ' ';
       }
       strcpy(cp, "OPTFILE=");            /* create temporary options file */
       strcpy(cp+8, mktemp(optfile));
       if (system(radcomm))        /* update octree */
              error(USER, "error executing rad command");
                                   /* replace "-v 0" with "-n -e -s -V" */
       strcpy(radcomm+7, "-n -e -s -V");
       radcomm[18] = ' ';
       if ((fp = popen(radcomm, "r")) == NULL)
              error(SYSTEM, "cannot start rad command");
       buf[0] = '\0';                     /* read variables alphabetically */
                                          /* get exposure */
       if ((cp = scan4var(buf, sizeof(buf), "EXPOSURE", fp)) != NULL) {
              expval = atof(cp);
              if ((*cp == '-') | (*cp == '+'))
                     expval = pow(2., expval);
              expval *= 0.5;              /* compensate for local shading */
       }
                                          /* look for eye separation */
       if ((cp = scan4var(buf, sizeof(buf), "EYESEP", fp)) != NULL)
              eyedist = atof(cp);
                                          /* look for materials */
       while ((cp = scan4var(buf, sizeof(buf), "materials", fp)) != NULL) {
              nscenef += wordstring(scene+nscenef, cp);
              buf[0] = '\0';
       }
                                          /* look for octree */
       if ((cp = scan4var(buf, sizeof(buf), "OCTREE", fp)) != NULL)
              octree = savqstr(cp);
                                          /* look for scene files */
       while ((cp = scan4var(buf, sizeof(buf), "scene", fp)) != NULL) {
              nscenef += wordstring(scene+nscenef, cp);
              buf[0] = '\0';
       }
                                          /* load view names */
       while ((cp = scan4var(buf, sizeof(buf), "view", fp)) != NULL) {
              if (nvn >= MAXVIEW)
                     error(INTERNAL, "too many views in rad file");
              vwl[nvn++].nam = *cp == '-' ? (char *)NULL :
                            savqstr(atos(nam, sizeof(nam), cp));
              buf[0] = '\0';
       }
                                          /* load actual views */
       do
              if (isview(buf)) {
                     vwl[nvv].v = (VIEW *)bmalloc(sizeof(VIEW));
                     *(vwl[nvv].v) = stdview;
                     sscanview(vwl[nvv].v, buf);
                     if ((cp = setview(vwl[nvv++].v)) != NULL) {
                            fprintf(stderr, "%s: bad view %d - %s\n",
                                          progname, nvv, cp);
                            quit(1);
                     }
              }
       while (fgets(buf, sizeof(buf), fp) != NULL);
       if (nvv != nvn)
              error(INTERNAL, "view miscount in runrad");
       pclose(fp);
                                          /* open options file */
       if ((fp = fopen(optfile, "r")) == NULL)
              error(SYSTEM, "cannot open options file");
                                          /* get relevant options */
       while (fgets(buf, sizeof(buf), fp) != NULL)
              if (!strncmp(buf, "-av ", 4))
                     setcolor(ambval, atof(buf+4),
                                   atof(sskip2(buf+4,1)),
                                   atof(sskip2(buf+4,2)));
              else if (backvis && !strncmp(buf, "-bv", 3) &&
                            (!buf[3] || strchr("0-FfNn \n",buf[3])!=NULL))
                     backvis = 0;
       fclose(fp);
       unlink(optfile);                   /* delete options file */
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char * scan4var ( char *  buf,
int  buflen,
char *  vname,
FILE *  fp 
) [static]

Definition at line 374 of file glrad.c.

{
       int    cval;
       register char *cp;
                                   /* search out matching line */
       while ((cval = varmatch(buf, vname))) {
              if (cval > 0)               /* gone too far? */
                     return(NULL);
              buf[0] = '\0';                     /* else get next line */
              if (fgetline(buf, buflen, fp) == NULL)
                     return(NULL);
       }
                                   /* skip variable name and '=' */
       for (cp = buf; *cp++ != '='; )
              ;
       while (isspace(*cp)) cp++;
       return(cp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void setglpersp ( register VIEW vp) [static]

Definition at line 751 of file glrad.c.

{
       double d, xmin, xmax, ymin, ymax, zmin, zmax;

       zmin = 0.1;
       zmax = 1000.;
       if (thisview.vfore > FTINY)
              zmin = thisview.vfore;
       if (thisview.vaft > FTINY)
              zmax = thisview.vaft;
       xmax = zmin * tan(PI/180./2. * thisview.horiz);
       xmin = -xmax;
       d = thisview.hoff * (xmax - xmin);
       xmin += d; xmax += d;
       ymax = zmin * tan(PI/180./2. * thisview.vert);
       ymin = -ymax;
       d = thisview.voff * (ymax - ymin);
       ymin += d; ymax += d;
                                   /* set view matrix */
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glFrustum(xmin, xmax, ymin, ymax, zmin, zmax);
       gluLookAt(thisview.vp[0], thisview.vp[1], thisview.vp[2],
              thisview.vp[0] + thisview.vdir[0],
              thisview.vp[1] + thisview.vdir[1],
              thisview.vp[2] + thisview.vdir[2],
              thisview.vup[0], thisview.vup[1], thisview.vup[2]);
       rgl_checkerr("setting perspective view");
}

Here is the call graph for this function:

static void startrtrace ( char *  octname) [static]

Definition at line 223 of file glrad.c.

{
       static char   *av[12] = {"rtrace", "-h", "-fff", "-ld+",
                                   "-opL", "-x", "1"};
       int    ac = 7;

       if (nowarn) av[ac++] = "-w-";
       av[ac++] = octname;
       av[ac] = NULL;
       if (open_process(&rtpd, av) <= 0)
              error(SYSTEM, "cannot start rtrace process");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int varmatch ( register char *  s,
register char *  vn 
) [static]

Definition at line 354 of file glrad.c.

{
       register int  c;

       for ( ; *vn && *s == *vn; s++, vn++)
              ;
       while (isspace(*s))
              s++;
       if (*s == '=')
              return(*vn);
       while (!(c = toupper(*s++) - toupper(*vn)) && *vn++)
              ;
       return(c);
}

Here is the caller graph for this function:

static void waitabit ( void  ) [static]

Definition at line 672 of file glrad.c.

{
       struct timespec      ts;
       ts.tv_sec = 0;
       ts.tv_nsec = 5000000;
       nanosleep(&ts, NULL);
}

Here is the caller graph for this function:

static void zoomview ( int  pct,
int  dx,
int  dy 
) [static]

Definition at line 842 of file glrad.c.

{
       double h, v;

       if ((pct == 100) | (pct <= 0))
              return;
       copylastv("zooming");
       h = (dx+.5)/hres - 0.5;
       v = (dy+.5)/vres - 0.5;
       h *= (1. - 100./pct);
       v *= (1. - 100./pct);
       thisview.vdir[0] += h*thisview.hvec[0] + v*thisview.vvec[0];
       thisview.vdir[1] += h*thisview.hvec[1] + v*thisview.vvec[1];
       thisview.vdir[2] += h*thisview.hvec[2] + v*thisview.vvec[2];
       thisview.horiz = 2.*180./PI * atan( 100./pct *
                                   tan(PI/180./2.*thisview.horiz) );
       thisview.vert = 2.*180./PI * atan( 100./pct *
                                   tan(PI/180./2.*thisview.vert) );
       setview(&thisview);
       dev_view(&thisview);
}

Here is the call graph for this function:


Variable Documentation

int backvis = 1

Definition at line 81 of file glrad.c.

XEvent currentevent

Definition at line 46 of file glrad.c.

int currentview = 0

Definition at line 67 of file glrad.c.

int displist

Definition at line 92 of file glrad.c.

double eyedist = 1

Definition at line 69 of file glrad.c.

GLXContext gctx

Definition at line 56 of file glrad.c.

Window gwind = 0

Definition at line 53 of file glrad.c.

int headlocked = 0

Definition at line 60 of file glrad.c.

int hres

Definition at line 54 of file glrad.c.

Definition at line 70 of file glrad.c.

int mapped = 0

Definition at line 48 of file glrad.c.

int maxhres

Definition at line 55 of file glrad.c.

int maxvres

Definition at line 55 of file glrad.c.

int no_render = 0

Definition at line 94 of file glrad.c.

int nowarn

Definition at line 92 of file rcalc.c.

int nscenef = 0

Definition at line 75 of file glrad.c.

char* octree

Definition at line 76 of file glrad.c.

unsigned long ourblack = 0

Definition at line 49 of file glrad.c.

Display* ourdisplay = NULL

Definition at line 51 of file glrad.c.

XVisualInfo* ourvinf

Definition at line 52 of file glrad.c.

unsigned long ourwhite = ~0

Definition at line 49 of file glrad.c.

double pheight

Definition at line 58 of file glrad.c.

char* progname

Definition at line 72 of file glrad.c.

double pwidth

Definition at line 58 of file glrad.c.

char* radfile

Definition at line 73 of file glrad.c.

const char RCSid[] = "$Id: glrad.c,v 3.20 2005/07/24 19:53:08 greg Exp $" [static]

Definition at line 2 of file glrad.c.

Definition at line 78 of file glrad.c.

char* scene[MAXSCENE+1]

Definition at line 74 of file glrad.c.

int silent = 0

Definition at line 80 of file glrad.c.

int stereo = 0

Definition at line 82 of file glrad.c.

Definition at line 68 of file glrad.c.

int vres

Definition at line 54 of file glrad.c.

struct { ... } vwl[MAXVIEW+1]