| 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++) { |
| 547 |
|
sc->descr[sc->ndescr++] = savqstr((char *)comment); |
| 548 |
|
} |
| 549 |
|
|
| 550 |
+ |
/* Find index for comment containing the given string (starting from n) */ |
| 551 |
+ |
int |
| 552 |
+ |
findComment(Scene *sc, const char *match, int n) |
| 553 |
+ |
{ |
| 554 |
+ |
if (n >= sc->ndescr) |
| 555 |
+ |
return(-1); |
| 556 |
+ |
n *= (n > 0); |
| 557 |
+ |
while (n < sc->ndescr) |
| 558 |
+ |
if (strstr(sc->descr[n], match) != NULL) |
| 559 |
+ |
return(n); |
| 560 |
+ |
return(-1); |
| 561 |
+ |
} |
| 562 |
+ |
|
| 563 |
|
/* Clear comments */ |
| 564 |
|
void |
| 565 |
|
clearComments(Scene *sc) |
| 703 |
|
sc->flist = f; |
| 704 |
|
sc->nfaces++; |
| 705 |
|
/* check face area */ |
| 706 |
< |
if (!(f->flags & FACE_DEGENERATE) && faceArea(sc, f, NULL) <= FTINY) |
| 706 |
> |
if (!(f->flags & FACE_DEGENERATE) && faceArea(sc, f, NULL) <= FTINY*FTINY) |
| 707 |
|
f->flags |= FACE_DEGENERATE; |
| 708 |
|
return(f); |
| 709 |
|
} |
| 773 |
|
return(sc); |
| 774 |
|
} |
| 775 |
|
|
| 776 |
+ |
#define MAXAC 100 |
| 777 |
+ |
|
| 778 |
|
/* Transform entire scene */ |
| 779 |
|
int |
| 780 |
|
xfScene(Scene *sc, int xac, char *xav[]) |
| 781 |
|
{ |
| 782 |
+ |
char comm[24+MAXAC*8]; |
| 783 |
+ |
char *cp; |
| 784 |
|
XF myxf; |
| 785 |
|
FVECT vec; |
| 786 |
|
int i; |
| 803 |
|
vec[0] /= myxf.sca; vec[1] /= myxf.sca; vec[2] /= myxf.sca; |
| 804 |
|
VCOPY(sc->norm[i], vec); |
| 805 |
|
} |
| 806 |
+ |
/* add comment */ |
| 807 |
+ |
cp = strcpy(comm, "Transformed by:"); |
| 808 |
+ |
for (i = 0; i < xac; i++) { |
| 809 |
+ |
while (*cp) cp++; |
| 810 |
+ |
*cp++ = ' '; |
| 811 |
+ |
strcpy(cp, xav[i]); |
| 812 |
+ |
} |
| 813 |
+ |
addComment(sc, comm); |
| 814 |
|
return(xac); /* all done */ |
| 815 |
|
} |
| 816 |
|
|
| 817 |
|
/* Ditto, using transform string rather than pre-parsed words */ |
| 793 |
– |
#define MAXAC 100 |
| 818 |
|
int |
| 819 |
|
xfmScene(Scene *sc, const char *xfm) |
| 820 |
|
{ |