| 19 |
|
#include "plocate.h" |
| 20 |
|
#include "rhdisp.h" |
| 21 |
|
#include "rhd_qtree.h" |
| 22 |
< |
#include "x11icon.h" |
| 22 |
> |
#include "x11icon.h" |
| 23 |
|
|
| 24 |
|
#ifndef RAYQLEN |
| 25 |
|
#define RAYQLEN 50000 /* max. rays to queue before flush */ |
| 54 |
|
|
| 55 |
|
struct driver odev; /* global device driver structure */ |
| 56 |
|
|
| 57 |
+ |
TMstruct *tmGlobal; /* global tone-mapping structure */ |
| 58 |
+ |
|
| 59 |
|
char odev_args[64]; /* command arguments */ |
| 60 |
|
|
| 61 |
|
static XEvent currentevent; /* current event */ |
| 82 |
|
static void xnewcolr(int ndx, int r, int g, int b); |
| 83 |
|
static int getpixels(void); |
| 84 |
|
static void freepixels(void); |
| 85 |
< |
static unsigned long true_pixel(register BYTE rgb[3]); |
| 85 |
> |
static unsigned long true_pixel(register uby8 rgb[3]); |
| 86 |
|
static void getevent(void); |
| 87 |
|
static int ilclip(int dp[2][2], FVECT wp[2]); |
| 88 |
|
static void draw3dline(FVECT wp[2]); |
| 167 |
|
&myprims[BLU][CIEX],&myprims[BLU][CIEY], |
| 168 |
|
&myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) |
| 169 |
|
dpri = myprims; |
| 170 |
< |
if (tmInit(mytmflags(), dpri, gamval) == NULL) |
| 170 |
> |
tmGlobal = tmInit(mytmflags(), dpri, gamval); |
| 171 |
> |
if (tmGlobal == NULL) |
| 172 |
|
error(SYSTEM, "not enough memory in dev_open"); |
| 173 |
|
/* open window */ |
| 174 |
|
ourwinattr.background_pixel = ourblack; |
| 190 |
|
/* set window manager hints */ |
| 191 |
|
ourxwmhints.flags = InputHint|IconPixmapHint; |
| 192 |
|
ourxwmhints.input = True; |
| 193 |
< |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, |
| 194 |
< |
gwind, x11icon_bits, x11icon_width, x11icon_height); |
| 193 |
> |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind, |
| 194 |
> |
(char *)x11icon_bits, x11icon_width, x11icon_height); |
| 195 |
|
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
| 196 |
|
oursizhints.min_width = MINWIDTH; |
| 197 |
|
oursizhints.min_height = MINHEIGHT; |
| 228 |
|
XCloseDisplay(ourdisplay); |
| 229 |
|
ourdisplay = NULL; |
| 230 |
|
qtFreeLeaves(); |
| 231 |
< |
tmDone(NULL); |
| 231 |
> |
tmDone(tmGlobal); |
| 232 |
|
odev.v.type = 0; |
| 233 |
|
odev.hres = odev.vres = 0; |
| 234 |
|
odev.ifd = -1; |
| 295 |
|
|
| 296 |
|
extern void |
| 297 |
|
dev_section( /* add octree for geometry rendering */ |
| 298 |
< |
char *ofn |
| 298 |
> |
char *gfn, |
| 299 |
> |
char *pfn |
| 300 |
|
) |
| 301 |
|
{ |
| 302 |
|
/* unimplemented */ |
| 345 |
|
|
| 346 |
|
extern void |
| 347 |
|
dev_paintr( /* fill a rectangle */ |
| 348 |
< |
BYTE rgb[3], |
| 348 |
> |
uby8 rgb[3], |
| 349 |
|
int xmin, |
| 350 |
|
int ymin, |
| 351 |
|
int xmax, |
| 464 |
|
|
| 465 |
|
static unsigned long |
| 466 |
|
true_pixel( /* return true pixel value for color */ |
| 467 |
< |
register BYTE rgb[3] |
| 467 |
> |
register uby8 rgb[3] |
| 468 |
|
) |
| 469 |
|
{ |
| 470 |
|
register unsigned long rval; |
| 570 |
|
static void |
| 571 |
|
draw_grids(void) /* draw holodeck section grids */ |
| 572 |
|
{ |
| 573 |
< |
static BYTE gridrgb[3] = {0x0, 0xff, 0xff}; |
| 573 |
> |
static uby8 gridrgb[3] = {0x0, 0xff, 0xff}; |
| 574 |
|
unsigned long pixel; |
| 575 |
|
|
| 576 |
|
if (ncolors > 0) |
| 641 |
|
) |
| 642 |
|
{ |
| 643 |
|
int startx = ebut->x, starty = ebut->y; |
| 644 |
< |
int endx, endy; |
| 645 |
< |
|
| 644 |
> |
int endx, endy, midx, midy; |
| 645 |
> |
FVECT v1; |
| 646 |
> |
int li; |
| 647 |
> |
/* get mouse drag */ |
| 648 |
|
XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent)); |
| 649 |
|
endx = levptr(XButtonReleasedEvent)->x; |
| 650 |
|
endy = levptr(XButtonReleasedEvent)->y; |
| 651 |
< |
if ((endx == startx) | (endy == starty)) { |
| 652 |
< |
XBell(ourdisplay, 0); |
| 651 |
> |
midx = (startx + endx) >> 1; |
| 652 |
> |
midy = (starty + endy) >> 1; |
| 653 |
> |
/* set focus distance */ |
| 654 |
> |
if ((li = qtFindLeaf(midx, midy)) < 0) |
| 655 |
> |
return; /* not on window */ |
| 656 |
> |
VCOPY(v1, qtL.wp[li]); |
| 657 |
> |
odev.v.vdist = sqrt(dist2(odev.v.vp, v1)); |
| 658 |
> |
/* set frame for rendering */ |
| 659 |
> |
if ((endx == startx) | (endy == starty)) |
| 660 |
|
return; |
| 648 |
– |
} |
| 661 |
|
if (endx < startx) {register int c = endx; endx = startx; startx = c;} |
| 662 |
|
if (endy < starty) {register int c = endy; endy = starty; starty = c;} |
| 663 |
|
sprintf(odev_args, "%.3f %.3f %.3f %.3f", |