--- ray/src/hd/rhd_glx1.c 2004/01/01 11:21:55 3.3 +++ ray/src/hd/rhd_glx1.c 2012/09/06 00:07:43 3.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rhd_glx1.c,v 3.3 2004/01/01 11:21:55 schorsch Exp $"; +static const char RCSid[] = "$Id: rhd_glx1.c,v 3.8 2012/09/06 00:07:43 greg Exp $"; #endif /* * OpenGL GLX driver for holodeck display. @@ -11,6 +11,7 @@ static const char RCSid[] = "$Id: rhd_glx1.c,v 3.3 200 #include #include +#include "platform.h" #include "rhd_qtree.h" #include "rhdriver.h" #include "rhdisp.h" @@ -60,6 +61,8 @@ static const char RCSid[] = "$Id: rhd_glx1.c,v 3.3 200 struct driver odev; /* global device driver structure */ +TMstruct *tmGlobal; /* global tone-mapping structure */ + char odev_args[64]; /* command arguments */ static XEvent currentevent; /* current event */ @@ -141,7 +144,8 @@ dev_open( &myprims[BLU][CIEX],&myprims[BLU][CIEY], &myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) dpri = myprims; - if (tmInit(mytmflags(), dpri, gamval) == NULL) + tmGlobal = tmInit(mytmflags(), dpri, gamval); + if (tmGlobal == NULL) error(SYSTEM, "not enough memory in dev_open"); /* open window */ ourwinattr.background_pixel = ourblack; @@ -210,7 +214,7 @@ dev_close(void) /* close our display and free resour XCloseDisplay(ourdisplay); ourdisplay = NULL; qtFreeLeaves(); - tmDone(NULL); + tmDone(tmGlobal); freecones(); odev.v.type = 0; odev.hres = odev.vres = 0; @@ -282,7 +286,8 @@ dev_view( /* assign new driver view */ extern void dev_section( /* add octree for geometry rendering */ - char *ofn + char *gfn, + char *pfn ) { /* unimplemented */ @@ -339,7 +344,7 @@ dev_flush(void) /* flush output */ extern void dev_cone( /* render a cone in view coordinates */ - BYTE rgb[3], + uby8 rgb[3], FVECT ip, double rad ) @@ -479,7 +484,7 @@ draw3dline( /* draw 3d line in world coordinates */ static void draw_grids(void) /* draw holodeck section grids */ { - static BYTE gridrgba[4] = {0x0, 0xff, 0xff, 0x00}; + static uby8 gridrgba[4] = {0x0, 0xff, 0xff, 0x00}; double xmin, xmax, ymin, ymax, zmin, zmax; double d; /* can we even do it? */ @@ -551,12 +556,11 @@ moveview( /* move our view */ VSUM(nv.vp, qtL.wp[li], 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.) + if (geodesic(odir, odir, nv.vup, + d=MOVDEG*PI/180.*orb, GEOD_RAD) == 0.0) return(0); - spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb); VSUM(nv.vp, qtL.wp[li], odir, -1.); - spinvector(nv.vdir, nv.vdir, v1, d); + geodesic(nv.vdir, nv.vdir, nv.vup, d, GEOD_RAD); } else if (mov) { /* move forward/backward */ d = MOVPCT/100. * mov; VSUM(nv.vp, nv.vp, odir, d);