28 |
|
#define MAXCONE 16 /* number of different cone sizes */ |
29 |
|
#endif |
30 |
|
#ifndef MAXVERT |
31 |
< |
#define MAXVERT 32 /* maximum number of cone vertices */ |
31 |
> |
#define MAXVERT 64 /* maximum number of cone vertices */ |
32 |
|
#endif |
33 |
|
#ifndef MINVERT |
34 |
|
#define MINVERT 4 /* minimum number of cone vertices */ |
94 |
|
char *id; |
95 |
|
{ |
96 |
|
extern char *getenv(); |
97 |
+ |
static RGBPRIMS myprims = STDPRIMS; |
98 |
|
static int atlBest[] = {GLX_RGBA, GLX_RED_SIZE,8, |
99 |
|
GLX_GREEN_SIZE,8, GLX_BLUE_SIZE,8, |
100 |
|
GLX_DEPTH_SIZE,15, None}; |
101 |
< |
char *gv; |
101 |
> |
char *ev; |
102 |
|
double gamval = GAMMA; |
103 |
+ |
RGBPRIMP dpri = stdprims; |
104 |
|
XSetWindowAttributes ourwinattr; |
105 |
|
XWMHints ourxwmhints; |
106 |
|
XSizeHints oursizhints; |
118 |
|
/* get a context */ |
119 |
|
gctx = glXCreateContext(ourdisplay, ourvinf, NULL, GL_TRUE); |
120 |
|
/* set gamma and tone mapping */ |
121 |
< |
if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL |
122 |
< |
|| (gv = getenv("DISPLAY_GAMMA")) != NULL) |
123 |
< |
gamval = atof(gv); |
124 |
< |
if (tmInit(mytmflags(), stdprims, gamval) == NULL) |
121 |
> |
if ((ev = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL |
122 |
> |
|| (ev = getenv("DISPLAY_GAMMA")) != NULL) |
123 |
> |
gamval = atof(ev); |
124 |
> |
if ((ev = getenv("DISPLAY_PRIMARIES")) != NULL && |
125 |
> |
sscanf(ev, "%f %f %f %f %f %f %f %f", |
126 |
> |
&myprims[RED][CIEX],&myprims[RED][CIEY], |
127 |
> |
&myprims[GRN][CIEX],&myprims[GRN][CIEY], |
128 |
> |
&myprims[BLU][CIEX],&myprims[BLU][CIEY], |
129 |
> |
&myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6) |
130 |
> |
dpri = myprims; |
131 |
> |
if (tmInit(mytmflags(), dpri, gamval) == NULL) |
132 |
|
error(SYSTEM, "not enough memory in dev_open"); |
133 |
|
/* open window */ |
134 |
|
ourwinattr.background_pixel = ourblack; |
204 |
|
} |
205 |
|
|
206 |
|
|
207 |
+ |
dev_clear() /* clear our quadtree */ |
208 |
+ |
{ |
209 |
+ |
qtCompost(100); |
210 |
+ |
glClear(GL_DEPTH_BUFFER_BIT); |
211 |
+ |
rayqleft = 0; /* hold off update */ |
212 |
+ |
} |
213 |
+ |
|
214 |
+ |
|
215 |
|
int |
216 |
|
dev_view(nv) /* assign new driver view */ |
217 |
|
register VIEW *nv; |
264 |
|
} |
265 |
|
|
266 |
|
|
267 |
+ |
VIEW * |
268 |
+ |
dev_auxview(n, hvres) /* return nth auxiliary view */ |
269 |
+ |
int n; |
270 |
+ |
int hvres[2]; |
271 |
+ |
{ |
272 |
+ |
if (n) |
273 |
+ |
return(NULL); |
274 |
+ |
hvres[0] = odev.hres; hvres[1] = odev.vres; |
275 |
+ |
return(&odev.v); |
276 |
+ |
} |
277 |
+ |
|
278 |
+ |
|
279 |
|
int |
280 |
|
dev_input() /* get X11 input */ |
281 |
|
{ |
307 |
|
{ |
308 |
|
register int ci, j; |
309 |
|
double apexh, basez; |
310 |
+ |
/* is window mapped? */ |
311 |
+ |
if (!mapped) |
312 |
+ |
return; |
313 |
|
/* compute apex height (0. to 1.) */ |
314 |
|
if (ip[2] > 1e6) |
315 |
|
apexh = 1. - 1./DEPTHFACT; |
371 |
|
for (i = 0; i < MAXCONE; i++) { |
372 |
|
d = (double)i/(MAXCONE-1); d *= d; /* x^2 distribution */ |
373 |
|
cone[i].rad = minrad + (1.-minrad)*d; |
374 |
< |
cone[i].nverts = MINVERT + (MAXVERT-MINVERT)*d; |
374 |
> |
cone[i].nverts = MINVERT + 0.5 + (MAXVERT-MINVERT)*d; |
375 |
|
cone[i].va = (FVECT *)malloc(cone[i].nverts*sizeof(FVECT)); |
376 |
|
if (cone[i].va == NULL) |
377 |
|
error(SYSTEM, "out of memory in initcones"); |
623 |
|
glFlush(); |
624 |
|
qtCompost(100); /* get rid of old values */ |
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); |