35 |
|
RREAL (*vtlist)[2]; /* map vertex list */ |
36 |
|
int nvts; |
37 |
|
|
38 |
+ |
int ndegen = 0; /* count of degenerate faces */ |
39 |
+ |
int n0norm = 0; /* count of zero normals */ |
40 |
+ |
|
41 |
|
typedef int VNDX[3]; /* vertex index (point,map,normal) */ |
42 |
|
|
43 |
|
#define CHUNKSIZ 1024 /* vertex allocation chunk size */ |
143 |
|
printargs(argc, argv, stdout); |
144 |
|
convert(stdin); |
145 |
|
} |
146 |
+ |
if (ndegen) |
147 |
+ |
printf("# %d degenerate faces\n", ndegen); |
148 |
+ |
if (n0norm) |
149 |
+ |
printf("# %d invalid (zero) normals\n", n0norm); |
150 |
|
exit(0); |
151 |
|
userr: |
152 |
|
fprintf(stderr, "Usage: %s [-o obj][-m mapping][-n][-f] [file.obj]\n", |
277 |
|
if (!strcmp(argv[1], "off")) |
278 |
|
mapname[0] = '\0'; |
279 |
|
else |
280 |
< |
sprintf(mapname, "%s.pic", argv[1]); |
280 |
> |
sprintf(mapname, "%s.hdr", argv[1]); |
281 |
|
} else |
282 |
|
goto unknown; |
283 |
|
break; |
501 |
|
return(0); |
502 |
|
} else |
503 |
|
vi[2] = -1; |
504 |
+ |
/* zero normal is not normal */ |
505 |
+ |
if (vi[2] >= 0 && DOT(vnlist[vi[2]],vnlist[vi[2]]) <= FTINY) |
506 |
+ |
vi[2] = -1; |
507 |
|
return(1); |
508 |
|
} |
509 |
|
|
625 |
|
|
626 |
|
switch (flatness) { |
627 |
|
case DEGEN: /* zero area */ |
628 |
+ |
ndegen++; |
629 |
|
return(-1); |
630 |
|
case RVFLAT: /* reversed normals, but flat */ |
631 |
|
case ISFLAT: /* smoothing unnecessary */ |
646 |
|
if (texOK | patOK) |
647 |
|
if (comp_baryc(&bvecs, vlist[v1i[0]], vlist[v2i[0]], |
648 |
|
vlist[v3i[0]]) < 0) |
649 |
< |
return(-1); |
649 |
> |
texOK = patOK = 0; |
650 |
|
/* put out texture (if any) */ |
651 |
|
if (texOK) { |
652 |
|
printf("\n%s texfunc %s\n", mod, TEXNAME); |
759 |
|
vnlist[nvns][0] = x; |
760 |
|
vnlist[nvns][1] = y; |
761 |
|
vnlist[nvns][2] = z; |
762 |
< |
if (normalize(vnlist[nvns]) == 0.0) |
752 |
< |
return(0); |
762 |
> |
n0norm += (normalize(vnlist[nvns]) == 0.0); |
763 |
|
return(++nvns); |
764 |
|
} |
765 |
|
|