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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.88 by greg, Wed Nov 15 18:02:53 2023 UTC vs.
Revision 2.94 by greg, Sat Jan 18 03:49:00 2025 UTC

# Line 50 | Line 50 | rayorigin(             /* start new ray from old one */
50                  rw = 1.0;
51                  setscolor(r->rcoef, 1., 1., 1.);
52          } else {
53 <                rw = sintens(rc);
53 >                rw = sintens((COLORV *)rc);
54                  if (rw > 1.0)
55                          rw = 1.0;               /* avoid calculation growth */
56                  if (rc != r->rcoef)
# Line 73 | Line 73 | rayorigin(             /* start new ray from old one */
73                          return(-1);             /* illegal continuation */
74                  }
75                  r->rlvl = ro->rlvl;
76 +                r->rsrc = ro->rsrc;
77                  if (rt & RAYREFL) {
78                          r->rlvl++;
79 <                        r->rsrc = -1;
79 >                        if (r->rsrc >= 0)       /* malfunctioning material? */
80 >                                r->rsrc = -1;
81                          r->clipset = ro->clipset;
82                          r->rmax = 0.0;
83                  } else {
82                        r->rsrc = ro->rsrc;
84                          r->clipset = ro->newcset;
85 <                        r->rmax = ro->rmax <= FTINY ? 0.0 : ro->rmax - ro->rot;
85 >                        r->rmax = (ro->rmax > FTINY)*(ro->rmax - ro->rot);
86                  }
87                  r->revf = ro->revf;
88                  copycolor(r->cext, ro->cext);
# Line 212 | Line 213 | raytirrad(                     /* irradiance hack */
213          RAY     *r
214   )
215   {
216 <        if (ofun[m->otype].flags & (T_M|T_X) && m->otype != MAT_CLIP) {
217 <                if (istransp(m->otype) || isBSDFproxy(m)) {
216 >        if (m->otype != MAT_CLIP && ismaterial(m->otype)) {
217 >                if (istransp(m) || isBSDFproxy(m)) {
218                          raytrans(r);
219                          return(1);
220                  }
# Line 454 | Line 455 | raynormal(             /* compute perturbed normal for ray */
455                  return(r->rod);
456          }
457          newdot = -DOT(norm, r->rdir);
458 <        if ((newdot > 0.0) != (r->rod > 0.0)) {         /* fix orientation */
458 >        if ((newdot > 0.0) ^ (r->rod > 0.0)) {          /* fix orientation */
459                  for (i = 0; i < 3; i++)
460                          norm[i] += 2.0*newdot*r->rdir[i];
461                  newdot = -newdot;
# Line 543 | Line 544 | rayreject(             /* check if candidate hit is worse than cu
544                          return(1);      /* old has material, new does not */
545          } else if (mray == NULL) {
546                  return(0);              /* new has material, old does not */
547 <        } else if (istransp(mnew->otype)) {
548 <                if (!istransp(mray->otype))
547 >        } else if (istransp(mnew)) {
548 >                if (!istransp(mray))
549                          return(1);      /* new is transparent, old is not */
550 <        } else if (istransp(mray->otype)) {
550 >        } else if (istransp(mray)) {
551                  return(0);              /* old is transparent, new is not */
552          }
553          if (rod <= 0) {                 /* check which side we hit */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines