ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/xform.c
(Generate patch)

Comparing ray/src/gen/xform.c (file contents):
Revision 1.15 by greg, Tue Jul 23 15:24:21 1991 UTC vs.
Revision 1.16 by greg, Tue Oct 22 13:32:58 1991 UTC

# Line 25 | Line 25 | char  **xav;                           /* global xform argument pointer */
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 */
# Line 39 | Line 41 | char  *idprefix = NULL;                        /* prefix for object identif
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])
# Line 76 | Line 80 | char  *argv[];
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          }
# Line 87 | Line 96 | char  *argv[];
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",
# Line 225 | Line 236 | xfobject(fname, fin)                           /* transform an object */
236   char  *fname;
237   FILE  *fin;
238   {
239 +        extern char  *strcpy();
240          char  typ[16], nam[MAXSTR];
241          int  fn;
242                                                  /* modifier and type */
# Line 236 | Line 248 | FILE  *fin;
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))
# Line 603 | Line 619 | FILE  *fin;
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]);
# Line 659 | Line 680 | initotypes()                   /* initialize ofun[] array */
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines