28 |
|
#include "standard.h" |
29 |
|
#include "rhd_odraw.h" |
30 |
|
#include "rhdisp.h" |
31 |
+ |
#include "paths.h" |
32 |
|
#ifdef DOBJ |
33 |
|
#include "rhdobj.h" |
34 |
|
#endif |
82 |
|
|
83 |
|
struct driver odev; /* global device driver structure */ |
84 |
|
|
85 |
+ |
TMstruct *tmGlobal; /* global tone-mapping structure */ |
86 |
+ |
|
87 |
|
char odev_args[64]; /* command arguments */ |
88 |
|
|
89 |
|
static GLfloat *depthbuffer = NULL; /* depth buffer */ |
211 |
|
&myprims[BLU][CIEX],&myprims[BLU][CIEY], |
212 |
|
&myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) |
213 |
|
dpri = myprims; |
214 |
< |
if (tmInit(mytmflags(), dpri, gamval) == NULL) |
214 |
> |
tmGlobal = tmInit(mytmflags(), dpri, gamval); |
215 |
> |
if (tmGlobal == NULL) |
216 |
|
error(SYSTEM, "not enough memory in dev_open"); |
217 |
|
/* open window */ |
218 |
|
ourwinattr.background_pixel = ourblack; |
235 |
|
/* set window manager hints */ |
236 |
|
ourxwmhints.flags = InputHint|IconPixmapHint; |
237 |
|
ourxwmhints.input = True; |
238 |
< |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, |
239 |
< |
gwind, x11icon_bits, x11icon_width, x11icon_height); |
238 |
> |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind, |
239 |
> |
(char *)x11icon_bits, x11icon_width, x11icon_height); |
240 |
|
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
241 |
|
oursizhints.min_width = MINWIDTH; |
242 |
|
#ifdef STEREO |
302 |
|
gwind = 0; |
303 |
|
XCloseDisplay(ourdisplay); |
304 |
|
ourdisplay = NULL; |
305 |
< |
tmDone(NULL); |
305 |
> |
tmDone(tmGlobal); |
306 |
|
odev.v.type = 0; |
307 |
|
odev.hres = odev.vres = 0; |
308 |
|
odev.ifd = -1; |
324 |
|
register VIEW *nv |
325 |
|
) |
326 |
|
{ |
327 |
+ |
#ifdef STEREO |
328 |
+ |
double d; |
329 |
+ |
#endif |
330 |
|
if (nv->type != VT_PER || /* check view legality */ |
331 |
|
nv->horiz > 160. || nv->vert > 160.) { |
332 |
|
error(COMMAND, "illegal view type/angle"); |
768 |
|
{ |
769 |
|
VIEW nv; |
770 |
|
FVECT odir, v1, wip; |
771 |
< |
double d, d1; |
771 |
> |
double d; |
772 |
> |
#ifdef DOBJ |
773 |
> |
double d1; |
774 |
> |
#endif |
775 |
|
/* start with old view */ |
776 |
|
nv = odev.v; |
777 |
|
/* orient our motion */ |
825 |
|
) |
826 |
|
{ |
827 |
|
int startx = ebut->x, starty = ebut->y; |
828 |
< |
int endx, endy; |
829 |
< |
|
828 |
> |
int endx, endy, midx, midy; |
829 |
> |
FVECT odir, v1; |
830 |
> |
double d; |
831 |
> |
#ifdef DOBJ |
832 |
> |
double d1; |
833 |
> |
#endif |
834 |
> |
/* get mouse drag */ |
835 |
|
XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent)); |
836 |
|
endx = levptr(XButtonReleasedEvent)->x; |
837 |
|
endy = levptr(XButtonReleasedEvent)->y; |
838 |
< |
if ((endx == startx) | (endy == starty)) { |
839 |
< |
XBell(ourdisplay, 0); |
838 |
> |
midx = (startx + endx) >> 1; |
839 |
> |
midy = (starty + endy) >> 1; |
840 |
> |
/* set focus distance */ |
841 |
> |
if (viewray(v1, odir, &odev.v, |
842 |
> |
(midx+.5)/odev.hres, (midy+.5)/odev.vres) < -FTINY) |
843 |
|
return; |
844 |
< |
} |
844 |
> |
d = getdistance(midx, midy, odir); /* distance from front plane */ |
845 |
> |
#ifdef DOBJ |
846 |
> |
d1 = dobj_trace(NULL, v1, odir); |
847 |
> |
if (d1 < d) |
848 |
> |
d = d1; |
849 |
> |
#endif |
850 |
> |
if (d < .99*FHUGE) |
851 |
> |
odev.v.vdist = d + sqrt(dist2(v1, odev.v.vp)); |
852 |
> |
/* set frame for rendering */ |
853 |
> |
if ((endx == startx) | (endy == starty)) |
854 |
> |
return; |
855 |
|
if (endx < startx) {register int c = endx; endx = startx; startx = c;} |
856 |
|
if (endy < starty) {register int c = endy; endy = starty; starty = c;} |
857 |
|
sprintf(odev_args, "%.3f %.3f %.3f %.3f", |