--- ray/src/ot/obj2mesh.c 2016/03/22 03:56:17 2.14 +++ ray/src/ot/obj2mesh.c 2021/07/28 22:16:43 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: obj2mesh.c,v 2.14 2016/03/22 03:56:17 greg Exp $"; +static const char RCSid[] = "$Id: obj2mesh.c,v 2.16 2021/07/28 22:16:43 greg Exp $"; #endif /* * Main program to compile a Wavefront .OBJ file into a Radiance mesh @@ -39,10 +39,7 @@ main( /* compile a .OBJ file into a mesh */ char *argv[] ) { - int nmatf = 0; - char pathnames[12800]; - char *pns = pathnames; - char *matinp[128]; + int verbose = 0; char *cp; int i, j; @@ -58,7 +55,7 @@ main( /* compile a .OBJ file into a mesh */ resolu = atoi(argv[++i]); break; case 'a': /* material file */ - matinp[nmatf++] = argv[++i]; + readobj(argv[++i]); break; case 'l': /* library material */ cp = getpath(argv[++i], getrlibpath(), R_OK); @@ -68,13 +65,14 @@ main( /* compile a .OBJ file into a mesh */ argv[i]); error(SYSTEM, errmsg); } - matinp[nmatf++] = strcpy(pns, cp); - while (*pns++) - ; + readobj(cp); break; case 'w': /* supress warnings */ nowarn = 1; break; + case 'v': /* print mesh stats */ + verbose = 1; + break; default: sprintf(errmsg, "unknown option: '%s'", argv[i]); error(USER, errmsg); @@ -85,9 +83,6 @@ main( /* compile a .OBJ file into a mesh */ error(USER, "too many file arguments"); /* initialize mesh */ cvinit(i==argc-2 ? argv[i+1] : ""); - /* load material input */ - for (j = 0; j < nmatf; j++) - readobj(matinp[j]); /* read .OBJ file into triangles */ if (i == argc) wfreadobj(NULL); @@ -121,7 +116,8 @@ main( /* compile a .OBJ file into a mesh */ writemesh(ourmesh, stdout); /* write mesh to output */ - /* printmeshstats(ourmesh, stderr); */ + if (verbose) + printmeshstats(ourmesh, stderr); quit(0); return 0; /* pro forma return */