19 |
|
int |
20 |
|
findName(const char *nm, const char **nmlist, int n) |
21 |
|
{ |
22 |
< |
register int i; |
22 |
> |
int i; |
23 |
|
|
24 |
|
for (i = n; i-- > 0; ) |
25 |
|
if (!strcmp(nmlist[i], nm)) |
322 |
|
goto linkerr; |
323 |
|
/* XXX doesn't allow for multiple references to prev in face */ |
324 |
|
f->v[j].vid = repl; /* replace vertex itself */ |
325 |
< |
if (faceArea(sc, f, NULL) <= FTINY) |
325 |
> |
if (faceArea(sc, f, NULL) <= FTINY*FTINY) |
326 |
|
f->flags |= FACE_DEGENERATE; |
327 |
|
if (f->v[j].tid >= 0) /* replace texture if appropriate */ |
328 |
|
for (i = 0; repl_tex[i] >= 0; i++) { |
460 |
|
++nfound; |
461 |
|
} |
462 |
|
} |
463 |
+ |
if (verbose) |
464 |
+ |
fprintf(stderr, "Found %d duplicate faces\n", nfound); |
465 |
|
return(nfound); |
466 |
|
} |
467 |
|
|
549 |
|
sc->descr[sc->ndescr++] = savqstr((char *)comment); |
550 |
|
} |
551 |
|
|
552 |
+ |
/* Find index for comment containing the given string (starting from n) */ |
553 |
+ |
int |
554 |
+ |
findComment(Scene *sc, const char *match, int n) |
555 |
+ |
{ |
556 |
+ |
if (n >= sc->ndescr) |
557 |
+ |
return(-1); |
558 |
+ |
n *= (n > 0); |
559 |
+ |
while (n < sc->ndescr) |
560 |
+ |
if (strstr(sc->descr[n], match) != NULL) |
561 |
+ |
return(n); |
562 |
+ |
return(-1); |
563 |
+ |
} |
564 |
+ |
|
565 |
|
/* Clear comments */ |
566 |
|
void |
567 |
|
clearComments(Scene *sc) |
705 |
|
sc->flist = f; |
706 |
|
sc->nfaces++; |
707 |
|
/* check face area */ |
708 |
< |
if (!(f->flags & FACE_DEGENERATE) && faceArea(sc, f, NULL) <= FTINY) |
708 |
> |
if (!(f->flags & FACE_DEGENERATE) && faceArea(sc, f, NULL) <= FTINY*FTINY) |
709 |
|
f->flags |= FACE_DEGENERATE; |
710 |
|
return(f); |
711 |
|
} |
775 |
|
return(sc); |
776 |
|
} |
777 |
|
|
778 |
+ |
#define MAXAC 100 |
779 |
+ |
|
780 |
|
/* Transform entire scene */ |
781 |
|
int |
782 |
|
xfScene(Scene *sc, int xac, char *xav[]) |
783 |
|
{ |
784 |
+ |
char comm[24+MAXAC*8]; |
785 |
+ |
char *cp; |
786 |
|
XF myxf; |
787 |
|
FVECT vec; |
788 |
|
int i; |
805 |
|
vec[0] /= myxf.sca; vec[1] /= myxf.sca; vec[2] /= myxf.sca; |
806 |
|
VCOPY(sc->norm[i], vec); |
807 |
|
} |
808 |
+ |
/* add comment */ |
809 |
+ |
cp = strcpy(comm, "Transformed by:"); |
810 |
+ |
for (i = 0; i < xac; i++) { |
811 |
+ |
while (*cp) cp++; |
812 |
+ |
*cp++ = ' '; |
813 |
+ |
strcpy(cp, xav[i]); |
814 |
+ |
} |
815 |
+ |
addComment(sc, comm); |
816 |
|
return(xac); /* all done */ |
817 |
|
} |
818 |
|
|
819 |
|
/* Ditto, using transform string rather than pre-parsed words */ |
793 |
– |
#define MAXAC 100 |
820 |
|
int |
821 |
|
xfmScene(Scene *sc, const char *xfm) |
822 |
|
{ |