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.13 by greg, Sun Sep 26 15:51:15 2010 UTC vs.
Revision 2.16 by greg, Sat May 10 17:43:01 2014 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 <        if (m->oargs.nsargs > 0 &&
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)) {
49                  if (!strcmp(m->oargs.sarg[0], VOIDID)) {
50                          raytrans(r);
# Line 55 | Line 56 | m_mirror(                      /* shade mirrored ray */
56          if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
57                  return(1);
58  
59 <        if (r->rod < 0.)                /* back is black */
59 >        if (r->rod < 0.) {              /* back is black */
60 >                if (!backvis)
61 >                        raytrans(r);    /* unless back visibility is off */
62                  return(1);
63 +        }
64                                          /* get modifiers */
65          raytexture(r, m->omod);
66                                          /* assign material color */
# Line 78 | Line 82 | m_mirror(                      /* shade mirrored ray */
82  
83                  if (rayorigin(&nr, REFLECTED, r, mcolor) < 0)
84                          return(1);
85 <                if (DOT(r->pert,r->pert) > FTINY*FTINY) {
85 >                if (!(r->crtype & AMBIENT) &&
86 >                                DOT(r->pert,r->pert) > FTINY*FTINY) {
87                          pdot = raynormal(pnorm, r);     /* use textures */
88                          for (i = 0; i < 3; i++)
89                                  nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i];
# Line 102 | Line 107 | m_mirror(                      /* shade mirrored ray */
107   static int
108   mir_proj(               /* compute a mirror's projection */
109          MAT4  pm,
110 <        register OBJREC  *o,
110 >        OBJREC  *o,
111          SRCREC  *s,
112          int  n
113   )
# Line 138 | Line 143 | mir_proj(              /* compute a mirror's projection */
143  
144   static void
145   mirrorproj(             /* get mirror projection for surface */
146 <        register MAT4  m,
146 >        MAT4  m,
147          FVECT  nv,
148          double  offs
149   )
150   {
151 <        register int  i, j;
151 >        int  i, j;
152                                          /* assign matrix */
153          setident4(m);
154          for (j = 0; j < 3; j++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines