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

Comparing ray/src/rt/t_func.c (file contents):
Revision 1.7 by greg, Thu Oct 5 07:23:20 1989 UTC vs.
Revision 1.8 by greg, Sat Dec 15 15:03:38 1990 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1990 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 28 | Line 28 | static char SCCSid[] = "$SunId$ LBL";
28   *  from the original coordinates to the current coordinates.
29   */
30  
31 typedef struct {
32        struct {
33                double  sca;            /* scale factor */
34                double  xfm[4][4];      /* transformation matrix */
35        }  fore, back;
36 }  XFORM;
31  
38
32   t_func(m, r)                    /* compute texture for ray */
33   register OBJREC  *m;
34   register RAY  *r;
# Line 44 | Line 37 | register RAY  *r;
37          extern int  errno;
38          FVECT  disp;
39          double  d;
40 <        register XFORM  *mxf;
40 >        register FULLXF  *mxf;
41          register int  i;
42          register char  **sa;
43  
# Line 52 | Line 45 | register RAY  *r;
45                  objerror(m, USER, "bad # arguments");
46          sa = m->oargs.sarg;
47  
48 <        if ((mxf = (XFORM *)m->os) == NULL) {
49 <                mxf = (XFORM *)malloc(sizeof(XFORM));
48 >        if ((mxf = (FULLXF *)m->os) == NULL) {
49 >                mxf = (FULLXF *)malloc(sizeof(FULLXF));
50                  if (mxf == NULL)
51                          goto memerr;
52 <                if (xf(mxf->fore.xfm, &mxf->fore.sca,
60 <                        m->oargs.nsargs-4, sa+4) != m->oargs.nsargs-4)
52 >                if (fullxf(mxf, m->oargs.nsargs-4, sa+4) != m->oargs.nsargs-4)
53                          objerror(m, USER, "bad transform");
54 <                if (mxf->fore.sca < 0.0)
55 <                        mxf->fore.sca = -mxf->fore.sca;
56 <                invxf(mxf->back.xfm, &mxf->back.sca,
57 <                                m->oargs.nsargs-4, sa+4);
66 <                if (mxf->back.sca < 0.0)
67 <                        mxf->back.sca = -mxf->back.sca;
54 >                if (mxf->f.sca < 0.0)
55 >                        mxf->f.sca = -mxf->f.sca;
56 >                if (mxf->b.sca < 0.0)
57 >                        mxf->b.sca = -mxf->b.sca;
58                  m->os = (char *)mxf;
59          }
60  
61 <        setmap(m, r, mxf->back.xfm, mxf->back.sca);
61 >        setmap(m, r, &mxf->b);
62  
63          if (!vardefined(sa[0]))
64                  loadfunc(sa[3]);
# Line 79 | Line 69 | register RAY  *r;
69                  objerror(m, WARNING, "compute error");
70                  return;
71          }
72 <        multv3(disp, disp, mxf->fore.xfm);
73 <        multv3(disp, disp, r->rofx);
74 <        d = 1.0 / (mxf->fore.sca * r->rofs);
72 >        multv3(disp, disp, mxf->f.xfm);
73 >        if (r->rox != NULL) {
74 >                multv3(disp, disp, r->rox->f.xfm);
75 >                d = 1.0 / (mxf->f.sca * r->rox->f.sca);
76 >        } else
77 >                d = 1.0 / mxf->f.sca;
78          for (i = 0; i < 3; i++)
79                  r->pert[i] += disp[i] * d;
80          return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines