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

Comparing ray/src/rt/m_mirror.c (file contents):
Revision 1.1 by greg, Thu Jun 20 13:44:35 1991 UTC vs.
Revision 2.1 by greg, Tue Nov 12 17:10:20 1991 UTC

# Line 40 | Line 40 | register RAY  *r;
40                                          /* check arguments */
41          if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1)
42                  objerror(m, USER, "bad number of arguments");
43 <                                        /* check if source ray */
44 <        if (r->rsrc >= 0) {                     /* aiming for somebody */
45 <                if (source[r->rsrc].so != r->ro)
46 <                        return;                         /* but not us */
47 <        } else if (m->oargs.nsargs > 0) {       /* else call substitute? */
43 >                                        /* check for substitute material */
44 >        if (m->oargs.nsargs > 0 &&
45 >                        (r->rsrc < 0 || source[r->rsrc].so != r->ro)) {
46                  rayshade(r, modifier(m->oargs.sarg[0]));
47                  return;
48          }
49 +                                        /* check for bad source ray */
50 +        if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
51 +                return;
52 +
53          if (r->rod < 0.)                /* back is black */
54                  return;
55                                          /* get modifiers */
# Line 64 | Line 66 | register RAY  *r;
66                  for (i = 0; i < 3; i++)
67                          nr.rdir[i] = r->rdir[i] + 2.*r->rod*r->ron[i];
68                                          /* source we're aiming for next */
69 <                nr.rsrc = source[r->rsrc].sa.svnext;
69 >                nr.rsrc = source[r->rsrc].sa.sv.sn;
70          } else {                                /* ordinary reflection */
71                  FVECT  pnorm;
72                  double  pdot;
# Line 84 | Line 86 | register RAY  *r;
86   mir_proj(pm, o, s, n)           /* compute a mirror's projection */
87   MAT4  pm;
88   register OBJREC  *o;
89 < register SRCREC  *s;
89 > SRCREC  *s;
90   int  n;
91   {
92          FVECT  nv;
93          double  od;
94                                  /* get surface normal and offset */
95 <        if (sfun[o->otype].of->getpleq == NULL)
94 <                return(0);              /* reject non-planar case */
95 <        od = (*sfun[o->otype].of->getpleq)(nv, o);
95 >        od = getplaneq(nv, o);
96                                  /* check for behind */
97          if (DOT(s->sloc, nv) <= (s->sflags & SDISTANT ? FTINY : od+FTINY))
98                  return(0);
# Line 110 | Line 110 | double  offs;
110          register int  i, j;
111                                          /* assign matrix */
112          setident4(m);
113 <        for (i = 0; i < 3; i++)
114 <                for (j = 0; j < 3; j++)
113 >        for (j = 0; j < 3; j++) {
114 >                for (i = 0; i < 3; i++)
115                          m[i][j] -= 2.*nv[i]*nv[j];
116        for (j = 0; j < 3; j++)
116                  m[3][j] = 2.*offs*nv[j];
117 +        }
118   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines