--- ray/src/ot/oconv.c 1990/08/29 21:56:17 1.11 +++ ray/src/ot/oconv.c 1992/08/24 15:19:12 2.3 @@ -18,6 +18,10 @@ static char SCCSid[] = "$SunId$ LBL"; #include "otypes.h" +#ifndef DEFPATH +#define DEFPATH ":/usr/local/lib/ray" +#endif + #define OMARGIN (10*FTINY) /* margin around global cube */ #define MAXOBJFIL 63 /* maximum number of scene files */ @@ -46,8 +50,7 @@ main(argc, argv) /* convert object files to an octree int argc; char **argv; { - char *getenv(); - double atof(); + extern char *getenv(); FVECT bbmin, bbmax; char *infile = NULL; int outflags = IO_ALL; @@ -57,8 +60,10 @@ char **argv; progname = argv[0]; if ((libpath = getenv("RAYPATH")) == NULL) - libpath = ":/usr/local/lib/ray"; + libpath = DEFPATH; + initotypes(); + for (i = 1; i < argc && argv[i][0] == '-'; i++) switch (argv[i][1]) { case '\0': /* scene from stdin */ @@ -101,6 +106,7 @@ breakopt: } printargs(argc, argv, stdout); /* info. header */ + fputformat(OCTFMT, stdout); printf("\n"); startobj = nobjects; /* previous objects already converted */ @@ -205,7 +211,7 @@ OBJECT obj; CUBE cukid; OCTREE ot; OBJECT oset[MAXSET+1]; - unsigned char inflg[MAXSET/8], volflg[MAXSET/8]; + unsigned char inflg[(MAXSET+7)/8], volflg[(MAXSET+7)/8]; int in; register int i, j; @@ -242,8 +248,7 @@ OBJECT obj; if (in==O_IN || oset[0] < objlim || cukid.cusize < mincusize) { /* add to set */ if (oset[0] >= MAXSET) { - sprintf(errmsg, - "set overflow in addobject (%s)", + sprintf(errmsg, "set overflow in addobject (%s)", objptr(obj)->oname); error(INTERNAL, errmsg); } @@ -262,7 +267,7 @@ OBJECT obj; if (isvolume(objptr(oset[j])->otype)) { setbit(volflg,j-1); if ((*ofun[objptr(oset[j])->otype].funp) - (objptr(oset[j]),cu) == O_IN) + (objptr(oset[j]), cu) == O_IN) setbit(inflg,j-1); } /* assign subcubes */ @@ -279,12 +284,12 @@ OBJECT obj; addobject(&cukid, oset[j]); /* then this object */ addobject(&cukid, obj); - /* partial volumes */ + /* then partial volumes */ for (j = 1; j <= oset[0]; j++) if (tstbit(volflg,j-1) && !tstbit(inflg,j-1)) addobject(&cukid, oset[j]); - /* full volumes */ + /* full volumes last */ for (j = 1; j <= oset[0]; j++) if (tstbit(inflg,j-1)) addobject(&cukid, oset[j]);