31 |
|
int argc; |
32 |
|
char *argv[]; |
33 |
|
{ |
34 |
< |
int i; |
34 |
> |
int nmatf = 0; |
35 |
> |
char *matinp[32]; |
36 |
> |
int i, j; |
37 |
|
|
38 |
|
progname = argv[0]; |
39 |
|
ofun[OBJ_FACE].funp = o_face; |
46 |
|
case 'r': /* resolution limit */ |
47 |
|
resolu = atoi(argv[++i]); |
48 |
|
break; |
49 |
+ |
case 'a': /* material file */ |
50 |
+ |
matinp[nmatf++] = argv[++i]; |
51 |
+ |
break; |
52 |
|
case 'w': /* supress warnings */ |
53 |
|
nowarn = 1; |
54 |
|
break; |
59 |
|
} |
60 |
|
/* initialize mesh */ |
61 |
|
cvinit(i==argc-2 ? argv[i+1] : "<stdout>"); |
62 |
< |
|
63 |
< |
if (i == argc) /* read .OBJ file into triangles */ |
62 |
> |
/* load material input */ |
63 |
> |
for (j = 0; j < nmatf; j++) |
64 |
> |
readobj(matinp[j]); |
65 |
> |
/* read .OBJ file into triangles */ |
66 |
> |
if (i == argc) |
67 |
|
wfreadobj(NULL); |
68 |
|
else |
69 |
|
wfreadobj(argv[i]); |
84 |
|
mincusize = ourmesh->mcube.cusize / resolu - FTINY; |
85 |
|
|
86 |
|
for (i = 0; i < nobjects; i++) /* add triangles to octree */ |
87 |
< |
addface(&ourmesh->mcube, i); |
87 |
> |
if (objptr(i)->otype == OBJ_FACE) |
88 |
> |
addface(&ourmesh->mcube, i); |
89 |
|
|
90 |
|
/* optimize octree */ |
91 |
|
ourmesh->mcube.cutree = combine(ourmesh->mcube.cutree); |