25 |
|
int xfa; /* start of xf arguments */ |
26 |
|
|
27 |
|
XF tot; /* total transformation */ |
28 |
< |
int reverse; /* boolean true if scene inverted */ |
28 |
> |
int reverse; /* boolean true if scene mirrored */ |
29 |
|
|
30 |
+ |
int invert = 0; /* boolean true to invert surfaces */ |
31 |
+ |
|
32 |
|
int expand = 0; /* boolean true to expand commands */ |
33 |
|
|
34 |
|
char *newmod = NULL; /* new modifier for surfaces */ |
41 |
|
|
42 |
|
FUN ofun[NUMTYPES] = INIT_OTYPE; /* default types and actions */ |
43 |
|
|
44 |
+ |
short tinvers[NUMOTYPE]; /* inverse types for surfaces */ |
45 |
+ |
|
46 |
|
extern char *malloc(), *fgetword(); |
47 |
|
|
48 |
|
#define progname (xav[0]) |
80 |
|
break; |
81 |
|
expand = 1; |
82 |
|
continue; |
83 |
+ |
case 'I': |
84 |
+ |
if (argv[a][2]) |
85 |
+ |
break; |
86 |
+ |
invert = 1; |
87 |
+ |
continue; |
88 |
|
} |
89 |
|
break; |
90 |
|
} |
96 |
|
|
97 |
|
if (reverse = tot.sca < 0.0) |
98 |
|
tot.sca = -tot.sca; |
99 |
+ |
if (invert) |
100 |
+ |
reverse = !reverse; |
101 |
|
|
102 |
|
if (a < argc && argv[a][0] == '-') { |
103 |
|
fprintf(stderr, "%s: command line error at '%s'\n", |
236 |
|
char *fname; |
237 |
|
FILE *fin; |
238 |
|
{ |
239 |
+ |
extern char *strcpy(); |
240 |
|
char typ[16], nam[MAXSTR]; |
241 |
|
int fn; |
242 |
|
/* modifier and type */ |
248 |
|
progname, fname, typ); |
249 |
|
exit(1); |
250 |
|
} |
251 |
< |
printf("\n%s %s ", newmod!=NULL && issurface(fn) ? newmod : nam, typ); |
251 |
> |
if (issurface(fn)) |
252 |
> |
printf("\n%s %s ", newmod != NULL ? newmod : nam, |
253 |
> |
invert ? ofun[tinvers[fn]].funame : typ); |
254 |
> |
else |
255 |
> |
printf("\n%s %s ", nam, typ); |
256 |
|
/* object name */ |
257 |
|
fgetword(nam, sizeof(nam), fin); |
258 |
|
if (idprefix != NULL && issurface(fn)) |
619 |
|
|
620 |
|
multp3(p0, fa.farg, tot.xfm); |
621 |
|
multv3(pd, fa.farg+3, tot.xfm); |
622 |
+ |
if (invert) { |
623 |
+ |
pd[0] = -pd[0]; |
624 |
+ |
pd[1] = -pd[1]; |
625 |
+ |
pd[2] = -pd[2]; |
626 |
+ |
} |
627 |
|
r0 = fa.farg[6] * tot.sca; |
628 |
|
r1 = fa.farg[7] * tot.sca; |
629 |
|
printf(" %18.12g %18.12g %18.12g\n", p0[0], p0[1], p0[2]); |
680 |
|
ofun[PAT_BTEXT].funp = |
681 |
|
ofun[MIX_TEXT].funp = text; |
682 |
|
ofun[ALIAS].funp = alias; |
683 |
+ |
/* surface inverses */ |
684 |
+ |
tinvers[OBJ_SOURCE] = OBJ_SOURCE; |
685 |
+ |
tinvers[OBJ_CONE] = OBJ_CUP; |
686 |
+ |
tinvers[OBJ_CUP] = OBJ_CONE; |
687 |
+ |
tinvers[OBJ_SPHERE] = OBJ_BUBBLE; |
688 |
+ |
tinvers[OBJ_BUBBLE] = OBJ_SPHERE; |
689 |
+ |
tinvers[OBJ_RING] = OBJ_RING; |
690 |
+ |
tinvers[OBJ_CYLINDER] = OBJ_TUBE; |
691 |
+ |
tinvers[OBJ_TUBE] = OBJ_CYLINDER; |
692 |
+ |
tinvers[OBJ_INSTANCE] = OBJ_INSTANCE; /* oh, well */ |
693 |
|
} |