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.2 by greg, Wed Mar 12 04:59:04 2003 UTC vs.
Revision 2.7 by greg, Mon Jul 14 05:00:45 2003 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   */
7  
8   #include "copyright.h"
9 + #include "platform.h"
10   #include "standard.h"
11   #include "cvmesh.h"
12   #include "otypes.h"
# Line 31 | Line 32 | main(argc, argv)               /* compile a .OBJ file into a mesh *
32   int  argc;
33   char  *argv[];
34   {
35 <        int  i;
35 >        int  nmatf = 0;
36 >        char  *matinp[32];
37 >        int  i, j;
38  
39          progname = argv[0];
40          ofun[OBJ_FACE].funp = o_face;
# Line 44 | Line 47 | char  *argv[];
47                  case 'r':                               /* resolution limit */
48                          resolu = atoi(argv[++i]);
49                          break;
50 +                case 'a':                               /* material file */
51 +                        matinp[nmatf++] = argv[++i];
52 +                        break;
53                  case 'w':                               /* supress warnings */
54                          nowarn = 1;
55                          break;
# Line 52 | Line 58 | char  *argv[];
58                          error(USER, errmsg);
59                          break;
60                  }
61 +
62 +        if (i < argc-2)
63 +                error(USER, "too many file arguments");
64                                          /* initialize mesh */
65          cvinit(i==argc-2 ? argv[i+1] : "<stdout>");
66 <
67 <        if (i == argc)                  /* read .OBJ file into triangles */
66 >                                        /* load material input */
67 >        for (j = 0; j < nmatf; j++)
68 >                readobj(matinp[j]);
69 >                                        /* read .OBJ file into triangles */
70 >        if (i == argc)
71                  wfreadobj(NULL);
72          else
73                  wfreadobj(argv[i]);
# Line 65 | Line 77 | char  *argv[];
77          if (i == argc-2)                /* open output file */
78                  if (freopen(argv[i+1], "w", stdout) == NULL)
79                          error(SYSTEM, "cannot open output file");
80 < #ifdef MSDOS
69 <        setmode(fileno(stdout), O_BINARY);
70 < #endif
80 >        SET_FILE_BINARY(stdout);
81          newheader("RADIANCE", stdout);  /* new binary file header */
82          printargs(i<argc ? i+1 : argc, argv, stdout);
83          fputformat(MESHFMT, stdout);
# Line 76 | Line 86 | char  *argv[];
86          mincusize = ourmesh->mcube.cusize / resolu - FTINY;
87  
88          for (i = 0; i < nobjects; i++)  /* add triangles to octree */
89 <                addface(&ourmesh->mcube, i);
89 >                if (objptr(i)->otype == OBJ_FACE)
90 >                        addface(&ourmesh->mcube, i);
91  
92                                          /* optimize octree */
93          ourmesh->mcube.cutree = combine(ourmesh->mcube.cutree);
# Line 88 | Line 99 | char  *argv[];
99  
100          writemesh(ourmesh, stdout);     /* write mesh to output */
101          
102 < printmeshstats(ourmesh, stderr);
102 >        /* printmeshstats(ourmesh, stderr); */
103  
104          quit(0);
105   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines