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.4 by greg, Fri Apr 18 21:47:45 2003 UTC vs.
Revision 2.10 by greg, Thu Apr 22 17:35:54 2004 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 "resolu.h"
12   #include "cvmesh.h"
13   #include "otypes.h"
14  
15 < extern int      o_face();
15 > extern int      o_face(); /* XXX should go to a header file */
16  
17   int     o_default() { return(O_MISS); }
18  
# Line 26 | Line 28 | int  resolu = 16384;                   /* octree resolution limit */
28  
29   double  mincusize;                      /* minimum cube size from resolu */
30  
31 + static void addface(CUBE  *cu, OBJECT   obj);
32 + static void add2full(CUBE  *cu, OBJECT  obj);
33  
34 < main(argc, argv)                /* compile a .OBJ file into a mesh */
35 < int  argc;
36 < char  *argv[];
34 >
35 > int
36 > main(           /* compile a .OBJ file into a mesh */
37 >        int  argc,
38 >        char  *argv[]
39 > )
40   {
41          int  nmatf = 0;
42          char  *matinp[32];
# Line 57 | Line 64 | char  *argv[];
64                          error(USER, errmsg);
65                          break;
66                  }
67 +
68 +        if (i < argc-2)
69 +                error(USER, "too many file arguments");
70                                          /* initialize mesh */
71          cvinit(i==argc-2 ? argv[i+1] : "<stdout>");
72                                          /* load material input */
# Line 73 | Line 83 | char  *argv[];
83          if (i == argc-2)                /* open output file */
84                  if (freopen(argv[i+1], "w", stdout) == NULL)
85                          error(SYSTEM, "cannot open output file");
86 < #ifdef MSDOS
77 <        setmode(fileno(stdout), O_BINARY);
78 < #endif
86 >        SET_FILE_BINARY(stdout);
87          newheader("RADIANCE", stdout);  /* new binary file header */
88          printargs(i<argc ? i+1 : argc, argv, stdout);
89          fputformat(MESHFMT, stdout);
# Line 100 | Line 108 | char  *argv[];
108          /* printmeshstats(ourmesh, stderr); */
109  
110          quit(0);
111 +        return 0; /* pro forma return */
112   }
113  
114  
115   void
116 < quit(code)                              /* exit program */
117 < int  code;
116 > quit(                           /* exit program */
117 >        int  code
118 > )
119   {
120          exit(code);
121   }
122  
123  
124   void
125 < cputs()                                 /* interactive error */
125 > cputs(void)                                     /* interactive error */
126   {
127          /* referenced, but not used */
128   }
129  
130  
131   void
132 < wputs(s)                                /* warning message */
133 < char  *s;
132 > wputs(                          /* warning message */
133 >        char  *s
134 > )
135   {
136          if (!nowarn)
137                  eputs(s);
# Line 128 | Line 139 | char  *s;
139  
140  
141   void
142 < eputs(s)                                /* put string to stderr */
143 < register char  *s;
142 > eputs(                          /* put string to stderr */
143 >        register char  *s
144 > )
145   {
146          static int  inln = 0;
147  
# Line 143 | Line 155 | register char  *s;
155   }
156  
157  
158 < addface(cu, obj)                        /* add a face to a cube */
159 < register CUBE  *cu;
160 < OBJECT  obj;
158 > static void
159 > addface(                        /* add a face to a cube */
160 >        register CUBE  *cu,
161 >        OBJECT  obj
162 > )
163   {
164  
165          if (o_face(objptr(obj), cu) == O_MISS)
# Line 178 | Line 192 | OBJECT obj;
192   }
193  
194  
195 < add2full(cu, obj)                       /* add object to full node */
196 < register CUBE  *cu;
197 < OBJECT  obj;
195 > static void
196 > add2full(                       /* add object to full node */
197 >        register CUBE  *cu,
198 >        OBJECT  obj
199 > )
200   {
201          OCTREE  ot;
202          OBJECT  oset[MAXSET+1];
# Line 190 | Line 206 | OBJECT obj;
206          objset(oset, cu->cutree);
207          cukid.cusize = cu->cusize * 0.5;
208  
209 <        if (oset[0] < objlim || cukid.cusize < mincusize) {
209 >        if (oset[0] < objlim || cukid.cusize <
210 >                        (oset[0] < MAXSET ? mincusize : mincusize/256.0)) {
211                                                  /* add to set */
212                  if (oset[0] >= MAXSET) {
213                          sprintf(errmsg, "set overflow in addobject (%s)",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines