18 |
|
|
19 |
|
#include "otypes.h" |
20 |
|
|
21 |
+ |
#ifndef DEFPATH |
22 |
+ |
#define DEFPATH ":/usr/local/lib/ray" |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#define OMARGIN (10*FTINY) /* margin around global cube */ |
26 |
|
|
27 |
|
#define MAXOBJFIL 63 /* maximum number of scene files */ |
50 |
|
int argc; |
51 |
|
char **argv; |
52 |
|
{ |
53 |
< |
char *getenv(); |
50 |
< |
double atof(); |
53 |
> |
extern char *getenv(); |
54 |
|
FVECT bbmin, bbmax; |
55 |
|
char *infile = NULL; |
56 |
|
int outflags = IO_ALL; |
60 |
|
progname = argv[0]; |
61 |
|
|
62 |
|
if ((libpath = getenv("RAYPATH")) == NULL) |
63 |
< |
libpath = ":/usr/local/lib/ray"; |
63 |
> |
libpath = DEFPATH; |
64 |
|
|
65 |
|
initotypes(); |
66 |
|
|
106 |
|
} |
107 |
|
|
108 |
|
printargs(argc, argv, stdout); /* info. header */ |
109 |
+ |
fputformat(OCTFMT, stdout); |
110 |
|
printf("\n"); |
111 |
|
|
112 |
|
startobj = nobjects; /* previous objects already converted */ |
211 |
|
CUBE cukid; |
212 |
|
OCTREE ot; |
213 |
|
OBJECT oset[MAXSET+1]; |
214 |
< |
unsigned char inflg[MAXSET/8], volflg[MAXSET/8]; |
214 |
> |
unsigned char inflg[(MAXSET+7)/8], volflg[(MAXSET+7)/8]; |
215 |
|
int in; |
216 |
|
register int i, j; |
217 |
|
|
248 |
|
if (in==O_IN || oset[0] < objlim || cukid.cusize < mincusize) { |
249 |
|
/* add to set */ |
250 |
|
if (oset[0] >= MAXSET) { |
251 |
< |
sprintf(errmsg, |
248 |
< |
"set overflow in addobject (%s)", |
251 |
> |
sprintf(errmsg, "set overflow in addobject (%s)", |
252 |
|
objptr(obj)->oname); |
253 |
|
error(INTERNAL, errmsg); |
254 |
|
} |
267 |
|
if (isvolume(objptr(oset[j])->otype)) { |
268 |
|
setbit(volflg,j-1); |
269 |
|
if ((*ofun[objptr(oset[j])->otype].funp) |
270 |
< |
(objptr(oset[j]),cu) == O_IN) |
270 |
> |
(objptr(oset[j]), cu) == O_IN) |
271 |
|
setbit(inflg,j-1); |
272 |
|
} |
273 |
|
/* assign subcubes */ |
284 |
|
addobject(&cukid, oset[j]); |
285 |
|
/* then this object */ |
286 |
|
addobject(&cukid, obj); |
287 |
< |
/* partial volumes */ |
287 |
> |
/* then partial volumes */ |
288 |
|
for (j = 1; j <= oset[0]; j++) |
289 |
|
if (tstbit(volflg,j-1) && |
290 |
|
!tstbit(inflg,j-1)) |
291 |
|
addobject(&cukid, oset[j]); |
292 |
< |
/* full volumes */ |
292 |
> |
/* full volumes last */ |
293 |
|
for (j = 1; j <= oset[0]; j++) |
294 |
|
if (tstbit(inflg,j-1)) |
295 |
|
addobject(&cukid, oset[j]); |