15 |
|
|
16 |
|
#define MAXDEPTH 32 /* ridiculous ray tree depth */ |
17 |
|
|
18 |
< |
#ifdef SMLFLT |
19 |
< |
#define sscanvec(s,v) (sscanf(s,"%f %f %f",v,v+1,v+2)==3) |
20 |
< |
#else |
21 |
< |
#define sscanvec(s,v) (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3) |
22 |
< |
#endif |
18 |
> |
#define sscanvec(s,v) (sscanf(s,FVFORMAT,v,v+1,v+2)==3) |
19 |
|
|
20 |
< |
char rtcom[] = "rtrace -h- -otp -fa -x 1"; |
20 |
> |
char rtcom[64] = "rtrace -h- -otp -fa -x 1"; |
21 |
|
char xicom[] = "ximage -c 256"; |
22 |
|
|
23 |
|
VIEW ourview = STDVIEW; /* view for picture */ |
41 |
|
|
42 |
|
int slow = 0; /* slow trace? */ |
43 |
|
|
44 |
+ |
void mainloop(void); |
45 |
+ |
static void freetree(struct node *tp); |
46 |
+ |
static void tracerays(struct node *tp); |
47 |
+ |
static int strtoipt(int ipt[2], char *str); |
48 |
+ |
static void setvec(int ipt[2]); |
49 |
+ |
static void vector(int ip1[2], int ip2[2]); |
50 |
|
|
51 |
< |
main(argc, argv) /* takes both the octree and the image */ |
52 |
< |
int argc; |
53 |
< |
char *argv[]; |
51 |
> |
|
52 |
> |
int |
53 |
> |
main( /* takes both the octree and the image */ |
54 |
> |
int argc, |
55 |
> |
char *argv[] |
56 |
> |
) |
57 |
|
{ |
58 |
|
int i; |
59 |
|
char combuf[PATH_MAX]; |
62 |
|
for (i = 1; i < argc-2; i++) |
63 |
|
if (!strcmp(argv[i], "-s")) |
64 |
|
slow++; |
65 |
+ |
else if (!strcmp(argv[i], "-T")) |
66 |
+ |
strcat(rtcom, " -oTp"); |
67 |
|
else |
68 |
|
break; |
69 |
|
if (i > argc-2) { |
70 |
< |
fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n", |
70 |
> |
fprintf(stderr, "Usage: %s [-s][-T] [rtrace args] octree picture\n", |
71 |
|
progname); |
72 |
|
exit(1); |
73 |
|
} |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
< |
mainloop() /* get and process input */ |
106 |
> |
void |
107 |
> |
mainloop(void) /* get and process input */ |
108 |
|
{ |
109 |
|
static struct node *sis[MAXDEPTH]; |
110 |
|
register struct node *newp; |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
< |
freetree(tp) /* free a trace tree */ |
147 |
< |
struct node *tp; |
146 |
> |
static void |
147 |
> |
freetree( /* free a trace tree */ |
148 |
> |
struct node *tp |
149 |
> |
) |
150 |
|
{ |
151 |
|
register struct node *kid, *k2; |
152 |
|
|
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
< |
tracerays(tp) /* trace a ray tree */ |
162 |
< |
struct node *tp; |
161 |
> |
static void |
162 |
> |
tracerays( /* trace a ray tree */ |
163 |
> |
struct node *tp |
164 |
> |
) |
165 |
|
{ |
166 |
|
register struct node *kid; |
167 |
|
|
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
< |
strtoipt(ipt, str) /* convert string x y z to image point */ |
176 |
< |
int ipt[2]; |
177 |
< |
char *str; |
175 |
> |
static int |
176 |
> |
strtoipt( /* convert string x y z to image point */ |
177 |
> |
int ipt[2], |
178 |
> |
char *str |
179 |
> |
) |
180 |
|
{ |
181 |
|
FVECT im_pt, pt; |
182 |
|
|
200 |
|
int xoff, yoff; |
201 |
|
|
202 |
|
|
203 |
< |
setvec(ipt) /* set up vector drawing for pick */ |
204 |
< |
int ipt[2]; |
203 |
> |
static void |
204 |
> |
setvec( /* set up vector drawing for pick */ |
205 |
> |
int ipt[2] |
206 |
> |
) |
207 |
|
{ |
208 |
|
extern Window xfindwind(); |
209 |
|
XWindowAttributes wa; |
242 |
|
} |
243 |
|
|
244 |
|
|
245 |
< |
vector(ip1, ip2) /* draw a vector */ |
246 |
< |
int ip1[2], ip2[2]; |
245 |
> |
static void |
246 |
> |
vector( /* draw a vector */ |
247 |
> |
int ip1[2], |
248 |
> |
int ip2[2] |
249 |
> |
) |
250 |
|
{ |
251 |
|
if (ip2[0] == -1 && ip2[1] == -1) |
252 |
|
return; /* null vector */ |