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

Comparing ray/src/rt/srcdraw.c (file contents):
Revision 2.17 by greg, Tue Jul 8 18:25:00 2014 UTC vs.
Revision 2.22 by greg, Wed Nov 15 18:02:53 2023 UTC

# Line 12 | Line 12 | static const char      RCSid[] = "$Id$";
12   #include  "ray.h"
13   #include  "view.h"
14   #include  "otypes.h"
15 + #include  "otspecial.h"
16   #include  "source.h"
17  
18  
# Line 324 | Line 325 | sourcepoly(                    /* compute image polygon for source */
325                                          ap[i] += ourview.vp[i];
326                                  }
327                          }
328 <                        viewloc(ip, &ourview, ap);      /* find image point */
329 <                        if (ip[2] <= 0.)
328 >                                                        /* find image point */
329 >                        if (viewloc(ip, &ourview, ap) != VL_GOOD)
330                                  return(0);              /* in front of view */
331                          sp[j][0] = ip[0]; sp[j][1] = ip[1];
332                  }
# Line 348 | Line 349 | sourcepoly(                    /* compute image polygon for source */
349                          if (cubeord[dir][j] & 4) ap[i] += s->ss[SW][i];
350                          else ap[i] -= s->ss[SW][i];
351                  }
352 <                viewloc(ip, &ourview, ap);      /* find image point */
353 <                if (ip[2] <= 0.)
352 >                                                /* find image point */
353 >                if (viewloc(ip, &ourview, ap) != VL_GOOD)
354                          return(0);              /* in front of view */
355                  pt[j][0] = ip[0]; pt[j][1] = ip[1];
356          }
# Line 406 | Line 407 | drawsources(
407          int     nsv, npv;
408          int     xmin, xmax, ymin, ymax, x, y;
409          RREAL   cxy[2];
410 +        COLOR   rcol;
411          double  w;
412          RAY     sr;
413          SPLIST  *sp;
# Line 451 | Line 453 | drawsources(
453                                  rayorigin(&sr, SHADOW, NULL, NULL);
454                                  sr.rsrc = sp->sn;
455                                  rayvalue(&sr);          /* compute value */
456 <                                if (bright(sr.rcol) <= FTINY)
456 >                                if (sintens(sr.rcol) <= FTINY)
457                                          continue;       /* missed/blocked */
458 +                                scolor_rgb(rcol, sr.rcol);
459                                                          /* modify pixel */
460                                  w = poly_area(ppoly, npv) * hres * vres;
461                                  if (zbf[y-y0] != NULL &&
462 <                                                sr.rt < 0.99*zbf[y-y0][x-x0]) {
463 <                                        zbf[y-y0][x-x0] = sr.rt;
464 <                                } else if (!bigdiff(sr.rcol, pic[y-y0][x-x0],
462 >                                                sr.rxt < 0.99*zbf[y-y0][x-x0]) {
463 >                                        zbf[y-y0][x-x0] = sr.rxt;
464 >                                } else if (!bigdiff(rcol, pic[y-y0][x-x0],
465                                                  0.01)) { /* source sample */
466                                          scalecolor(pic[y-y0][x-x0], w);
467                                          continue;
468                                  }
469 <                                scalecolor(sr.rcol, w);
469 >                                scalecolor(rcol, w);
470                                  scalecolor(pic[y-y0][x-x0], 1.-w);
471 <                                addcolor(pic[y-y0][x-x0], sr.rcol);
471 >                                addcolor(pic[y-y0][x-x0], rcol);
472                          }
473          }
474   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines