14 |
|
|
15 |
|
#define MAXDEPTH 32 /* ridiculous ray tree depth */ |
16 |
|
|
17 |
< |
char rtcom[] = "rtrace -h -otp -fa -x 1"; |
18 |
< |
char xicom[] = "x11image -f"; |
17 |
> |
char rtcom[] = "rtrace -h- -otp -fa -x 1"; |
18 |
> |
char xicom[] = "ximage"; |
19 |
|
|
20 |
|
VIEW ourview = STDVIEW; /* view for picture */ |
21 |
|
int xres, yres; |
22 |
|
|
23 |
|
char *progname; /* program name */ |
24 |
|
|
25 |
+ |
char *picture; /* picture name */ |
26 |
+ |
|
27 |
|
FILE *pin; /* input stream */ |
28 |
|
|
29 |
|
Display *theDisplay = NULL; /* connection to server */ |
45 |
|
{ |
46 |
|
int i; |
47 |
|
char combuf[256]; |
46 |
– |
Cursor curs; |
48 |
|
|
49 |
|
progname = argv[0]; |
50 |
|
for (i = 1; i < argc-2; i++) |
54 |
|
break; |
55 |
|
if (i > argc-2) { |
56 |
|
fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n", |
57 |
< |
argv[0]); |
57 |
> |
progname); |
58 |
|
exit(1); |
59 |
|
} |
60 |
+ |
picture = argv[argc-1]; |
61 |
|
/* get the viewing parameters */ |
62 |
< |
if (viewfile(argv[argc-1], &ourview, &xres, &yres) <= 0 || |
62 |
> |
if (viewfile(picture, &ourview, &xres, &yres) <= 0 || |
63 |
|
setview(&ourview) != NULL) { |
64 |
|
fprintf(stderr, "%s: cannot get view from \"%s\"\n", |
65 |
< |
argv[0], argv[argc-1]); |
65 |
> |
progname, picture); |
66 |
|
exit(1); |
67 |
|
} |
68 |
|
/* open the display */ |
69 |
|
if ((theDisplay = XOpenDisplay(NULL)) == NULL) { |
70 |
|
fprintf(stderr, |
71 |
|
"%s: cannot open display; DISPLAY variable set?\n", |
72 |
< |
argv[0]); |
72 |
> |
progname); |
73 |
|
exit(1); |
74 |
|
} |
75 |
|
/* build input command */ |
76 |
< |
sprintf(combuf, "%s %s | %s", xicom, argv[argc-1], rtcom); |
76 |
> |
sprintf(combuf, "%s %s | %s", xicom, picture, rtcom); |
77 |
|
for ( ; i < argc-1; i++) { |
78 |
|
strcat(combuf, " "); |
79 |
|
strcat(combuf, argv[i]); |
177 |
|
XWindowAttributes wa; |
178 |
|
XColor xc; |
179 |
|
XGCValues gcv; |
180 |
< |
int pm, rx, ry, wx, wy, rw, cw; |
180 |
> |
int rx, ry, wx, wy; |
181 |
> |
Window rw, cw; |
182 |
> |
unsigned int pm; |
183 |
|
/* compute pointer location */ |
184 |
< |
if (gwind == 0) { |
185 |
< |
XQueryPointer(theDisplay, rwind, &rw, &gwind, |
186 |
< |
&rx, &ry, &wx, &wy, &pm); |
184 |
> |
if (gwind == 0 && |
185 |
> |
(gwind = xfindwind(theDisplay, rwind, picture, 2)) == 0) { |
186 |
> |
fprintf(stderr, "%s: cannot find display window!\n", progname); |
187 |
> |
exit(1); |
188 |
|
} |
189 |
< |
XQueryPointer(theDisplay, gwind, &rw, &cw, |
185 |
< |
&rx, &ry, &wx, &wy, &pm); |
189 |
> |
XQueryPointer(theDisplay, gwind, &rw, &cw, &rx, &ry, &wx, &wy, &pm); |
190 |
|
xoff = wx - ipt[0]*xres; |
191 |
|
yoff = wy - (1.-ipt[1])*yres; |
192 |
|
/* set graphics context */ |