ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/ot/obj2mesh.c
(Generate patch)

Comparing ray/src/ot/obj2mesh.c (file contents):
Revision 2.8 by schorsch, Sat Mar 27 12:41:45 2004 UTC vs.
Revision 2.16 by greg, Wed Jul 28 22:16:43 2021 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   */
7  
8   #include "copyright.h"
9 + #include "paths.h"
10   #include "platform.h"
11   #include "standard.h"
12   #include "resolu.h"
# Line 22 | Line 23 | char  *progname;                       /* argv[0] */
23  
24   int  nowarn = 0;                        /* supress warnings? */
25  
26 < int  objlim = 15;                       /* # of objects before split */
26 > int  objlim = 9;                        /* # of objects before split */
27  
28   int  resolu = 16384;                    /* octree resolution limit */
29  
# Line 38 | Line 39 | main(          /* compile a .OBJ file into a mesh */
39          char  *argv[]
40   )
41   {
42 <        int  nmatf = 0;
43 <        char  *matinp[32];
42 >        int  verbose = 0;
43 >        char  *cp;
44          int  i, j;
45  
46          progname = argv[0];
# Line 54 | Line 55 | main(          /* compile a .OBJ file into a mesh */
55                          resolu = atoi(argv[++i]);
56                          break;
57                  case 'a':                               /* material file */
58 <                        matinp[nmatf++] = argv[++i];
58 >                        readobj(argv[++i]);
59                          break;
60 +                case 'l':                               /* library material */
61 +                        cp = getpath(argv[++i], getrlibpath(), R_OK);
62 +                        if (cp == NULL) {
63 +                                sprintf(errmsg,
64 +                                        "cannot find library material: '%s'",
65 +                                                argv[i]);
66 +                                error(SYSTEM, errmsg);
67 +                        }
68 +                        readobj(cp);
69 +                        break;
70                  case 'w':                               /* supress warnings */
71                          nowarn = 1;
72                          break;
73 +                case 'v':                               /* print mesh stats */
74 +                        verbose = 1;
75 +                        break;
76                  default:
77                          sprintf(errmsg, "unknown option: '%s'", argv[i]);
78                          error(USER, errmsg);
# Line 69 | Line 83 | main(          /* compile a .OBJ file into a mesh */
83                  error(USER, "too many file arguments");
84                                          /* initialize mesh */
85          cvinit(i==argc-2 ? argv[i+1] : "<stdout>");
72                                        /* load material input */
73        for (j = 0; j < nmatf; j++)
74                readobj(matinp[j]);
86                                          /* read .OBJ file into triangles */
87          if (i == argc)
88                  wfreadobj(NULL);
# Line 105 | Line 116 | main(          /* compile a .OBJ file into a mesh */
116  
117          writemesh(ourmesh, stdout);     /* write mesh to output */
118          
119 <        /* printmeshstats(ourmesh, stderr); */
119 >        if (verbose)
120 >                printmeshstats(ourmesh, stderr);
121  
122          quit(0);
123          return 0; /* pro forma return */
# Line 206 | Line 218 | add2full(                      /* add object to full node */
218          objset(oset, cu->cutree);
219          cukid.cusize = cu->cusize * 0.5;
220  
221 <        if (oset[0] < objlim || cukid.cusize < mincusize) {
221 >        if (oset[0] < objlim || cukid.cusize <
222 >                        (oset[0] < MAXSET ? mincusize : mincusize/256.0)) {
223                                                  /* add to set */
224                  if (oset[0] >= MAXSET) {
225                          sprintf(errmsg, "set overflow in addobject (%s)",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines