--- ray/src/ot/oconv.c 1992/09/21 12:11:39 2.4 +++ ray/src/ot/oconv.c 1993/02/12 18:43:24 2.6 @@ -51,12 +51,13 @@ char **argv; extern char *getenv(); FVECT bbmin, bbmax; char *infile = NULL; + int inpfrozen = 0; int outflags = IO_ALL; OBJECT startobj; int i; - - progname = argv[0]; + progname = argv[0] = fixargv0(argv[0]); + if ((libpath = getenv(ULIBVAR)) == NULL) libpath = DEFPATH; @@ -65,6 +66,7 @@ char **argv; for (i = 1; i < argc && argv[i][0] == '-'; i++) switch (argv[i][1]) { case '\0': /* scene from stdin */ + outflags &= ~IO_FILES; goto breakopt; case 'i': /* input octree */ infile = argv[++i]; @@ -100,10 +102,8 @@ breakopt: if (thescene.cusize > FTINY) error(USER, "only one of '-b' or '-i'"); nfiles = readoct(infile, IO_ALL, &thescene, ofname); - if (nfiles == 0 && outflags & IO_FILES) { - error(WARNING, "frozen octree"); - outflags &= ~IO_FILES; - } + if (nfiles == 0) + inpfrozen++; } printargs(argc, argv, stdout); /* info. header */ @@ -111,7 +111,7 @@ breakopt: printf("\n"); startobj = nobjects; /* previous objects already converted */ - + for ( ; i < argc; i++) /* read new scene descriptions */ if (!strcmp(argv[i], "-")) { /* from stdin */ readobj(NULL); @@ -123,6 +123,11 @@ breakopt: } ofname[nfiles] = NULL; + + if (inpfrozen && outflags & IO_FILES) { + error(WARNING, "frozen octree"); + outflags &= ~IO_FILES; + } /* find bounding box */ bbmin[0] = bbmin[1] = bbmin[2] = FHUGE; bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE; @@ -150,10 +155,10 @@ breakopt: } mincusize = thescene.cusize / resolu - FTINY; - + for (i = startobj; i < nobjects; i++) /* add new objects */ addobject(&thescene, i); - + thescene.cutree = combine(thescene.cutree); /* optimize */ writeoct(outflags, &thescene, ofname); /* write structures to stdout */ @@ -220,7 +225,7 @@ OBJECT obj; if (in == O_MISS) return; /* no intersection */ - + if (istree(cu->cutree)) { /* do children */ cukid.cusize = cu->cusize * 0.5; @@ -245,7 +250,7 @@ OBJECT obj; /* add to full node */ objset(oset, cu->cutree); cukid.cusize = cu->cusize * 0.5; - + if (in==O_IN || oset[0] < objlim || cukid.cusize < mincusize) { /* add to set */ if (oset[0] >= MAXSET) {