6 |
|
*/ |
7 |
|
|
8 |
|
#include "copyright.h" |
9 |
+ |
#include "paths.h" |
10 |
|
#include "platform.h" |
11 |
|
#include "standard.h" |
12 |
|
#include "resolu.h" |
39 |
|
char *argv[] |
40 |
|
) |
41 |
|
{ |
42 |
< |
int nmatf = 0; |
42 |
< |
char pathnames[12800]; |
43 |
< |
char *pns = pathnames; |
44 |
< |
char *matinp[128]; |
42 |
> |
int verbose = 0; |
43 |
|
char *cp; |
44 |
|
int i, j; |
45 |
|
|
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); |
63 |
|
sprintf(errmsg, |
64 |
|
"cannot find library material: '%s'", |
65 |
|
argv[i]); |
66 |
< |
error(USER, errmsg); |
66 |
> |
error(SYSTEM, errmsg); |
67 |
|
} |
68 |
< |
matinp[nmatf++] = strcpy(pns, cp); |
71 |
< |
while (*pns++) |
72 |
< |
; |
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); |
83 |
|
error(USER, "too many file arguments"); |
84 |
|
/* initialize mesh */ |
85 |
|
cvinit(i==argc-2 ? argv[i+1] : "<stdout>"); |
87 |
– |
/* load material input */ |
88 |
– |
for (j = 0; j < nmatf; j++) |
89 |
– |
readobj(matinp[j]); |
86 |
|
/* read .OBJ file into triangles */ |
87 |
|
if (i == argc) |
88 |
|
wfreadobj(NULL); |
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 */ |