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.23 by greg, Wed Nov 15 18:02:53 2023 UTC vs.
Revision 2.24 by greg, Thu May 29 16:42:28 2025 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9  
10   #include  "ray.h"
11   #include  "otypes.h"
12 + #include  "otspecial.h"
13   #include  "rtotypes.h"
14   #include  "source.h"
15  
# Line 44 | Line 45 | m_mirror(                      /* shade mirrored ray */
45                  objerror(m, USER, "bad number of arguments");
46                                          /* check for substitute material */
47                                          /* but avoid double-counting */
48 <        if ( m->oargs.nsargs > 0 &&
49 <                        (r->rsrc < 0 || source[r->rsrc].so != r->ro) &&
50 <                        !(r->crtype & (AMBIENT|SPECULAR) && r->rod > 0.) ) {
51 <                if (!strcmp(m->oargs.sarg[0], VOIDID)) {
52 <                        raytrans(r);
48 >        if (m->oargs.nsargs > 0 &&
49 >                        (r->rsrc < 0 || source[r->rsrc].so != r->ro)) {
50 >                int     passOK = (r->rod < 0.) |
51 >                                        !(r->crtype & (AMBIENT|SPECULAR));
52 >                if (strcmp(m->oargs.sarg[0], VOIDID)) {
53 >                        OBJECT  altmod = lastmod(objndx(m), m->oargs.sarg[0]);
54 >                        OBJREC  *altmat;
55 >                        if (passOK)             /* no double-count hazard? */
56 >                                return(rayshade(r, altmod));
57 >                        if (altmod == OVOID ||  /* else check alternate type */
58 >                                        (altmat = findmaterial(objptr(altmod))) == NULL)
59 >                                return(0);
60 >                        if (istransp(altmat))   /* pass "transparent" materials */
61 >                                return(rayshade(r, altmod));
62 >                } else if (passOK) {
63 >                        raytrans(r);            /* "safe" void passage */
64                          return(1);
65                  }
54                return(rayshade(r, lastmod(objndx(m), m->oargs.sarg[0])));
66          }
67                                          /* check for bad source ray */
68          if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines