15 |
|
#define MAXDEPTH 32 /* ridiculous ray tree depth */ |
16 |
|
|
17 |
|
char rtcom[] = "rtrace -h -otp -fa -x 1"; |
18 |
< |
char xicom[] = "x11image"; |
18 |
> |
char xicom[] = "x11image -f"; |
19 |
|
|
20 |
|
VIEW ourview = STDVIEW; /* view for picture */ |
21 |
|
int xres, yres; |
34 |
|
|
35 |
|
#define newnode() (struct node *)calloc(1, sizeof(struct node)) |
36 |
|
|
37 |
+ |
int slow = 0; /* slow trace? */ |
38 |
|
|
39 |
+ |
|
40 |
|
main(argc, argv) /* takes both the octree and the image */ |
41 |
|
int argc; |
42 |
|
char *argv[]; |
43 |
|
{ |
44 |
|
int i; |
45 |
|
char combuf[256]; |
44 |
– |
Cursor curs; |
46 |
|
|
47 |
|
progname = argv[0]; |
48 |
< |
if (argc < 3) { |
49 |
< |
fprintf(stderr, "Usage: %s [rtrace args] octree picture\n", |
48 |
> |
for (i = 1; i < argc-2; i++) |
49 |
> |
if (!strcmp(argv[i], "-s")) |
50 |
> |
slow++; |
51 |
> |
else |
52 |
> |
break; |
53 |
> |
if (i > argc-2) { |
54 |
> |
fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n", |
55 |
|
argv[0]); |
56 |
|
exit(1); |
57 |
|
} |
71 |
|
} |
72 |
|
/* build input command */ |
73 |
|
sprintf(combuf, "%s %s | %s", xicom, argv[argc-1], rtcom); |
74 |
< |
for (i = 1; i < argc-1; i++) { |
74 |
> |
for ( ; i < argc-1; i++) { |
75 |
|
strcat(combuf, " "); |
76 |
|
strcat(combuf, argv[i]); |
77 |
|
} |
115 |
|
if (i == 0) { |
116 |
|
setvec(sis[0]->ipt); |
117 |
|
tracerays(sis[0]); |
112 |
– |
XFlush(theDisplay); |
118 |
|
freetree(sis[0]); |
119 |
|
sis[0] = NULL; |
120 |
+ |
if (!slow) |
121 |
+ |
XFlush(theDisplay); |
122 |
|
} |
123 |
|
} |
124 |
|
} |
141 |
|
register struct node *kid; |
142 |
|
|
143 |
|
for (kid = tp->daughter; kid != NULL; kid = kid->sister) { |
137 |
– |
tracerays(kid); |
144 |
|
vector(tp->ipt, kid->ipt); |
145 |
+ |
tracerays(kid); |
146 |
|
} |
147 |
|
} |
148 |
|
|
174 |
|
XWindowAttributes wa; |
175 |
|
XColor xc; |
176 |
|
XGCValues gcv; |
177 |
< |
int pm, rx, ry, wx, wy, rw, cw; |
177 |
> |
int rx, ry, wx, wy; |
178 |
> |
Window rw, cw; |
179 |
> |
unsigned int pm; |
180 |
|
/* compute pointer location */ |
181 |
|
if (gwind == 0) { |
182 |
|
XQueryPointer(theDisplay, rwind, &rw, &gwind, |
208 |
|
XDrawLine(theDisplay, gwind, vecGC, |
209 |
|
(int)(ip1[0]*xres)+xoff, (int)((1.-ip1[1])*yres)+yoff, |
210 |
|
(int)(ip2[0]*xres)+xoff, (int)((1.-ip2[1])*yres)+yoff); |
211 |
+ |
if (slow) { |
212 |
+ |
XFlush(theDisplay); |
213 |
+ |
sleep(1); |
214 |
+ |
} |
215 |
|
} |