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.24 by greg, Tue Jul 2 23:59:20 2024 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 394 | Line 395 | init_drawsources(
395  
396   void                            /* add sources smaller than rad to computed subimage */
397   drawsources(
398 <        COLOR   *pic[],                         /* subimage pixel value array */
398 >        COLORV  *pic[],                         /* subimage pixel value array */
399          float   *zbf[],                         /* subimage distance array (opt.) */
400          int     x0,                             /* origin and size of subimage */
401          int     xsiz,
# Line 432 | Line 433 | drawsources(
433                                  ymax = spoly[i][1]*vres - FTINY;
434                  }
435                                          /* evaluate each pixel in BBox */
436 <                for (y = ymin; y <= ymax; y++)
437 <                        for (x = xmin; x <= xmax; x++) {
436 >                for (y = ymin; y <= ymax; y++) {
437 >                        COLORV  *pp = pic[y-y0] + (xmin-x0)*NCSAMP;
438 >                        for (x = xmin; x <= xmax; x++, pp += NCSAMP) {
439                                                          /* subarea for pixel */
440                                  npv = box_clip_poly(spoly, nsv,
441                                                  (double)x/hres, (x+1.)/hres,
# 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                                                          /* modify pixel */
459                                  w = poly_area(ppoly, npv) * hres * vres;
460                                  if (zbf[y-y0] != NULL &&
461 <                                                sr.rt < 0.99*zbf[y-y0][x-x0]) {
462 <                                        zbf[y-y0][x-x0] = sr.rt;
463 <                                } else if (!bigdiff(sr.rcol, pic[y-y0][x-x0],
464 <                                                0.01)) { /* source sample */
463 <                                        scalecolor(pic[y-y0][x-x0], w);
461 >                                                sr.rxt < 0.99*zbf[y-y0][x-x0]) {
462 >                                        zbf[y-y0][x-x0] = sr.rxt;
463 >                                } else if (!sbigsdiff(sr.rcol, pp, 0.01)) { /* source sample */
464 >                                        scalescolor(pp, w);
465                                          continue;
466                                  }
467 <                                scalecolor(sr.rcol, w);
468 <                                scalecolor(pic[y-y0][x-x0], 1.-w);
469 <                                addcolor(pic[y-y0][x-x0], sr.rcol);
467 >                                scalescolor(sr.rcol, w);
468 >                                scalescolor(pp, 1.-w);
469 >                                saddscolor(pp, sr.rcol);
470                          }
471 +                }
472          }
473   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines