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 2.14 by greg, Thu Aug 29 15:37:16 2013 UTC vs.
Revision 2.21 by greg, Fri Apr 19 19:01:32 2019 UTC

# Line 29 | Line 29 | static void mirrorproj(MAT4  m, FVECT  nv, double  off
29   VSMATERIAL  mirror_vs = {mir_proj, 1};
30  
31  
32 < extern int
32 > int
33   m_mirror(                       /* shade mirrored ray */
34 <        register OBJREC  *m,
35 <        register RAY  *r
34 >        OBJREC  *m,
35 >        RAY  *r
36   )
37   {
38          COLOR  mcolor;
39          RAY  nr;
40          int  rpure = 1;
41 <        register int  i;
41 >        int  i;
42                                          /* check arguments */
43          if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1)
44                  objerror(m, USER, "bad number of arguments");
45                                          /* check for substitute material */
46                                          /* but avoid double-counting */
47 <        if (m->oargs.nsargs > 0 && !(r->crtype & (AMBIENT|SPECULAR)) &&
48 <                        (r->rsrc < 0 || source[r->rsrc].so != r->ro)) {
47 >        if ( m->oargs.nsargs > 0 &&
48 >                        (r->rsrc < 0 || source[r->rsrc].so != r->ro) &&
49 >                        !(r->crtype & (AMBIENT|SPECULAR) && r->rod > 0.) ) {
50                  if (!strcmp(m->oargs.sarg[0], VOIDID)) {
51                          raytrans(r);
52                          return(1);
# Line 56 | Line 57 | m_mirror(                      /* shade mirrored ray */
57          if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
58                  return(1);
59  
60 <        if (r->rod < 0.)                /* back is black */
60 >        if (r->rod < 0.) {              /* back is black */
61 >                if (!backvis)
62 >                        raytrans(r);    /* unless back visibility is off */
63                  return(1);
64 +        }
65                                          /* get modifiers */
66          raytexture(r, m->omod);
67                                          /* assign material color */
# Line 79 | Line 83 | m_mirror(                      /* shade mirrored ray */
83  
84                  if (rayorigin(&nr, REFLECTED, r, mcolor) < 0)
85                          return(1);
86 <                if (DOT(r->pert,r->pert) > FTINY*FTINY) {
86 >                if (!(r->crtype & AMBIENT) &&
87 >                                DOT(r->pert,r->pert) > FTINY*FTINY) {
88                          pdot = raynormal(pnorm, r);     /* use textures */
89                          for (i = 0; i < 3; i++)
90                                  nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i];
# Line 93 | Line 98 | m_mirror(                      /* shade mirrored ray */
98          checknorm(nr.rdir);
99          rayvalue(&nr);
100          multcolor(nr.rcol, nr.rcoef);
101 +        copycolor(r->mcol, nr.rcol);
102          addcolor(r->rcol, nr.rcol);
103 +        r->rmt = r->rot;
104          if (rpure && r->ro != NULL && isflat(r->ro->otype))
105 <                r->rt = r->rot + nr.rt;
105 >                r->rmt += r->rot + raydistance(&nr);
106          return(1);
107   }
108  
# Line 103 | Line 110 | m_mirror(                      /* shade mirrored ray */
110   static int
111   mir_proj(               /* compute a mirror's projection */
112          MAT4  pm,
113 <        register OBJREC  *o,
113 >        OBJREC  *o,
114          SRCREC  *s,
115          int  n
116   )
# Line 139 | Line 146 | mir_proj(              /* compute a mirror's projection */
146  
147   static void
148   mirrorproj(             /* get mirror projection for surface */
149 <        register MAT4  m,
149 >        MAT4  m,
150          FVECT  nv,
151          double  offs
152   )
153   {
154 <        register int  i, j;
154 >        int  i, j;
155                                          /* assign matrix */
156          setident4(m);
157          for (j = 0; j < 3; j++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines