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

Comparing ray/src/rt/func.c (file contents):
Revision 1.12 by greg, Sat Dec 15 15:03:26 1990 UTC vs.
Revision 1.13 by greg, Sat Jan 12 18:01:19 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  "otypes.h"
16  
17  
18 + XF  unitxf = {                  /* identity transform */
19 +        1.0, 0.0, 0.0, 0.0,
20 +        0.0, 1.0, 0.0, 0.0,
21 +        0.0, 0.0, 1.0, 0.0,
22 +        0.0, 0.0, 0.0, 1.0,
23 +        1.0
24 + };
25 +
26   XF  funcxf;                     /* current transformation */
27   static OBJREC  *fobj = NULL;    /* current function object */
28   static RAY  *fray = NULL;       /* current function ray */
# Line 29 | Line 37 | XF  *bx;
37          extern double  l_hermite(), l_fnoise3(), l_arg();
38          extern long  eclock;
39          static char  *initfile = "rayinit.cal";
32        static long  lastrno = -1;
33                                        /* check to see if already set */
34        if (m == fobj && r->rno == lastrno)
35                return;
40                                          /* initialize if first call */
41          if (initfile != NULL) {
42                  loadfunc(initfile);
# Line 55 | Line 59 | XF  *bx;
59          }
60          fobj = m;
61          fray = r;
62 <        lastrno = r->rno;
63 <        if (r->rox != NULL) {
64 <                funcxf.sca = r->rox->b.sca * bx->sca;
65 <                multmat4(funcxf.xfm, r->rox->b.xfm, bx->xfm);
66 <        } else
62 >        if (r->rox != NULL)
63 >                if (bx != &unitxf) {
64 >                        funcxf.sca = r->rox->b.sca * bx->sca;
65 >                        multmat4(funcxf.xfm, r->rox->b.xfm, bx->xfm);
66 >                } else
67 >                        copystruct(&funcxf, &r->rox->b);
68 >        else
69                  copystruct(&funcxf, bx);
70          eclock++;               /* notify expression evaluator */
71   }
# Line 78 | Line 84 | RAY  *r;
84                  for (n = m->oargs.nsargs, sa = m->oargs.sarg;
85                                  n > 0 && **sa != '-'; n--, sa++)
86                          ;
87 <                mxf = (XF *)malloc(sizeof(XF));
88 <                if (mxf == NULL)
89 <                        goto memerr;
90 <                if (invxf(mxf, n, sa) != n)
91 <                        objerror(m, USER, "bad transform");
92 <                if (mxf->sca < 0.0)
93 <                        mxf->sca = -mxf->sca;
87 >                if (n == 0)
88 >                        mxf = &unitxf;
89 >                else {
90 >                        mxf = (XF *)malloc(sizeof(XF));
91 >                        if (mxf == NULL)
92 >                                goto memerr;
93 >                        if (invxf(mxf, n, sa) != n)
94 >                                objerror(m, USER, "bad transform");
95 >                        if (mxf->sca < 0.0)
96 >                                mxf->sca = -mxf->sca;
97 >                }
98                  m->os = (char *)mxf;
99          }
100          setmap(m, r, mxf);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines