--- ray/src/ot/obj2mesh.c 2004/04/22 17:33:48 2.9 +++ ray/src/ot/obj2mesh.c 2008/11/12 03:54:31 2.13 @@ -1,11 +1,12 @@ #ifndef lint -static const char RCSid[] = "$Id: obj2mesh.c,v 2.9 2004/04/22 17:33:48 greg Exp $"; +static const char RCSid[] = "$Id: obj2mesh.c,v 2.13 2008/11/12 03:54:31 greg Exp $"; #endif /* * Main program to compile a Wavefront .OBJ file into a Radiance mesh */ #include "copyright.h" +#include "paths.h" #include "platform.h" #include "standard.h" #include "resolu.h" @@ -22,7 +23,7 @@ char *progname; /* argv[0] */ int nowarn = 0; /* supress warnings? */ -int objlim = 15; /* # of objects before split */ +int objlim = 9; /* # of objects before split */ int resolu = 16384; /* octree resolution limit */ @@ -39,7 +40,10 @@ main( /* compile a .OBJ file into a mesh */ ) { int nmatf = 0; - char *matinp[32]; + char pathnames[12800]; + char *pns = pathnames; + char *matinp[128]; + char *cp; int i, j; progname = argv[0]; @@ -56,6 +60,18 @@ main( /* compile a .OBJ file into a mesh */ case 'a': /* material file */ matinp[nmatf++] = argv[++i]; break; + case 'l': /* library material */ + cp = getpath(argv[++i], getrlibpath(), R_OK); + if (cp == NULL) { + sprintf(errmsg, + "cannot find library material: '%s'", + argv[i]); + error(USER, errmsg); + } + matinp[nmatf++] = strcpy(pns, cp); + while (*pns++) + ; + break; case 'w': /* supress warnings */ nowarn = 1; break; @@ -206,7 +222,7 @@ add2full( /* add object to full node */ objset(oset, cu->cutree); cukid.cusize = cu->cusize * 0.5; - if (inc==O_IN || oset[0] < objlim || cukid.cusize < + if (oset[0] < objlim || cukid.cusize < (oset[0] < MAXSET ? mincusize : mincusize/256.0)) { /* add to set */ if (oset[0] >= MAXSET) {