18 |
|
|
19 |
|
#include "x11icon.h" |
20 |
|
|
21 |
+ |
#ifndef RAYQLEN |
22 |
+ |
#define RAYQLEN 50000 /* max. rays to queue before flush */ |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#ifndef FEQ |
26 |
|
#define FEQ(a,b) ((a)-(b) <= FTINY && (a)-(b) >= -FTINY) |
27 |
|
#endif |
85 |
|
for (cp = tail; *cp && *cp != '.'; cp++) |
86 |
|
; |
87 |
|
if (cp-tail == 3 && !strncmp(tail, "x11", 3)) |
88 |
< |
return(TM_F_CAMERA); |
88 |
> |
return(TM_F_CAMERA|TM_F_NOSTDERR); |
89 |
|
if (cp-tail == 4 && !strncmp(tail, "x11h", 4)) |
90 |
< |
return(TM_F_HUMAN); |
90 |
> |
return(TM_F_HUMAN|TM_F_NOSTDERR); |
91 |
|
error(USER, "illegal driver name"); |
92 |
|
} |
93 |
|
|
96 |
|
char *id; |
97 |
|
{ |
98 |
|
extern char *getenv(); |
99 |
< |
char *gv; |
99 |
> |
static RGBPRIMS myprims = STDPRIMS; |
100 |
> |
char *ev; |
101 |
|
double gamval = GAMMA; |
102 |
+ |
RGBPRIMP dpri = stdprims; |
103 |
|
int nplanes; |
104 |
|
XSetWindowAttributes ourwinattr; |
105 |
|
XWMHints ourxwmhints; |
132 |
|
ourwhite = WhitePixel(ourdisplay,ourscreen); |
133 |
|
} |
134 |
|
/* set gamma and tone mapping */ |
135 |
< |
if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL |
136 |
< |
|| (gv = getenv("DISPLAY_GAMMA")) != NULL) |
137 |
< |
gamval = atof(gv); |
138 |
< |
if (tmInit(mytmflags(), stdprims, gamval) == NULL) |
135 |
> |
if ((ev = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL |
136 |
> |
|| (ev = getenv("DISPLAY_GAMMA")) != NULL) |
137 |
> |
gamval = atof(ev); |
138 |
> |
if ((ev = getenv("DISPLAY_PRIMARIES")) != NULL && |
139 |
> |
sscanf(ev, "%f %f %f %f %f %f %f %f", |
140 |
> |
&myprims[RED][CIEX],&myprims[RED][CIEY], |
141 |
> |
&myprims[GRN][CIEX],&myprims[GRN][CIEY], |
142 |
> |
&myprims[BLU][CIEX],&myprims[BLU][CIEY], |
143 |
> |
&myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) |
144 |
> |
dpri = myprims; |
145 |
> |
if (tmInit(mytmflags(), dpri, gamval) == NULL) |
146 |
|
error(SYSTEM, "not enough memory in dev_open"); |
147 |
|
/* open window */ |
148 |
|
ourwinattr.background_pixel = ourblack; |
171 |
|
oursizhints.min_height = MINHEIGHT; |
172 |
|
oursizhints.flags = PMinSize; |
173 |
|
XSetNormalHints(ourdisplay, gwind, &oursizhints); |
161 |
– |
/* map the window and get its size */ |
162 |
– |
XMapWindow(ourdisplay, gwind); |
163 |
– |
dev_input(); |
164 |
– |
/* allocate our leaf pile */ |
165 |
– |
if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * |
166 |
– |
DisplayHeight(ourdisplay,ourscreen) / |
167 |
– |
(qtMinNodesiz*qtMinNodesiz))) |
168 |
– |
error(SYSTEM, "insufficient memory for leaf storage"); |
169 |
– |
|
174 |
|
/* figure out sensible view */ |
175 |
|
pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) / |
176 |
|
DisplayWidth(ourdisplay, ourscreen); |
177 |
|
pheight = (double)DisplayHeightMM(ourdisplay, ourscreen) / |
178 |
|
DisplayHeight(ourdisplay, ourscreen); |
179 |
|
copystruct(&odev.v, &stdview); |
176 |
– |
odev.name = id; |
180 |
|
odev.v.type = VT_PER; |
181 |
< |
odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres); |
182 |
< |
odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres); |
181 |
> |
/* map the window and get its size */ |
182 |
> |
XMapWindow(ourdisplay, gwind); |
183 |
> |
dev_input(); /* sets size and view angles */ |
184 |
> |
/* allocate our leaf pile */ |
185 |
> |
if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * |
186 |
> |
DisplayHeight(ourdisplay,ourscreen) * 3 / |
187 |
> |
(qtMinNodesiz*qtMinNodesiz*2))) |
188 |
> |
error(SYSTEM, "insufficient memory for leaf storage"); |
189 |
> |
odev.name = id; |
190 |
|
odev.ifd = ConnectionNumber(ourdisplay); |
191 |
|
} |
192 |
|
|
208 |
|
} |
209 |
|
|
210 |
|
|
211 |
+ |
|
212 |
+ |
dev_clear() /* clear our quadtree */ |
213 |
+ |
{ |
214 |
+ |
qtCompost(100); |
215 |
+ |
if (ncolors > 0) |
216 |
+ |
new_ctab(ncolors); |
217 |
+ |
rayqleft = 0; /* hold off update */ |
218 |
+ |
} |
219 |
+ |
|
220 |
+ |
|
221 |
|
int |
222 |
|
dev_view(nv) /* assign new driver view */ |
223 |
|
VIEW *nv; |
256 |
|
odev.vres = dh; |
257 |
|
} |
258 |
|
XResizeWindow(ourdisplay, gwind, odev.hres, odev.vres); |
259 |
+ |
dev_input(); /* wait for resize event */ |
260 |
|
} |
261 |
|
copystruct(&odev.v, nv); |
262 |
|
} |
301 |
|
dev_flush() /* flush output */ |
302 |
|
{ |
303 |
|
qtUpdate(); |
304 |
+ |
rayqleft = RAYQLEN; |
305 |
|
return(XPending(ourdisplay)); |
306 |
|
} |
307 |
|
|
477 |
|
static BYTE gridrgb[3] = {0x0, 0xff, 0xff}; |
478 |
|
unsigned long pixel; |
479 |
|
|
480 |
< |
if (!mapped || odev.v.type != VT_PER) |
480 |
> |
if (!mapped) |
481 |
|
return; |
482 |
|
if (ncolors > 0) |
483 |
|
pixel = pixval[get_pixel(gridrgb, xnewcolr)]; |
623 |
|
if (ncolors > 0) |
624 |
|
new_ctab(ncolors); |
625 |
|
inpresflags |= DFL(DC_REDRAW); /* resend values from server */ |
626 |
+ |
rayqleft = 0; /* hold off update */ |
627 |
|
return; |
628 |
|
case 'K': /* kill rtrace process(es) */ |
629 |
|
inpresflags |= DFL(DC_KILL); |