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.26 by greg, Wed Jul 31 22:21:28 2024 UTC vs.
Revision 2.27 by greg, Mon Aug 12 18:57:00 2024 UTC

# Line 396 | Line 396 | init_drawsources(
396   void                            /* add sources smaller than rad to computed subimage */
397   drawsources(
398          COLORV  *pic[],                         /* subimage pixel value array */
399 <        int     nc,                             /* number of target components */
399 >        RGBPRIMP primp,                         /* output primaries */
400          float   *zbf[],                         /* subimage distance array (opt.) */
401          int     x0,                             /* origin and size of subimage */
402          int     xsiz,
# Line 404 | Line 404 | drawsources(
404          int     ysiz
405   )
406   {
407 <        RREAL   spoly[MAXVERT][2], ppoly[MAXVERT][2];
408 <        int     nsv, npv;
409 <        int     xmin, xmax, ymin, ymax, x, y;
410 <        RREAL   cxy[2];
411 <        COLOR   rcol;
412 <        double  w;
413 <        RAY     sr;
414 <        SPLIST  *sp;
415 <        int     i;
416 <                                        /* check #components */
417 <        if ((nc != 3) & (nc != NCSAMP))
418 <                error(INTERNAL, "unsupported #components in drawsources()");
407 >        const int       NC = primp ? 3 : NCSAMP;
408 >        RREAL           spoly[MAXVERT][2], ppoly[MAXVERT][2];
409 >        int             nsv, npv;
410 >        int             xmin, xmax, ymin, ymax, x, y;
411 >        RREAL           cxy[2];
412 >        COLOR           rcol;
413 >        double          w;
414 >        RAY             sr;
415 >        SPLIST          *sp;
416 >        int             i;
417                                          /* check each source in our list */
418          for (sp = sphead; sp != NULL; sp = sp->next) {
419                                          /* clip source poly to subimage */
# Line 439 | Line 437 | drawsources(
437                  }
438                                          /* evaluate each pixel in BBox */
439                  for (y = ymin; y <= ymax; y++) {
440 <                        COLORV  *pp = pic[y-y0] + (xmin-x0)*nc;
441 <                        for (x = xmin; x <= xmax; x++, pp += nc) {
440 >                        COLORV  *pp = pic[y-y0] + (xmin-x0)*NC;
441 >                        for (x = xmin; x <= xmax; x++, pp += NC) {
442                                                          /* subarea for pixel */
443                                  npv = box_clip_poly(spoly, nsv,
444                                                  (double)x/hres, (x+1.)/hres,
# Line 460 | Line 458 | drawsources(
458                                  rayvalue(&sr);          /* compute value */
459                                  if (sintens(sr.rcol) <= FTINY)
460                                          continue;       /* missed/blocked */
461 <                                if (nc == 3)
462 <                                        scolor_rgb(rcol, sr.rcol);
461 >                                if (NC == 3)
462 >                                        scolor_out(rcol, primp, sr.rcol);
463                                                          /* modify pixel */
464                                  w = poly_area(ppoly, npv) * hres * vres;
465                                  if (zbf[y-y0] != NULL &&
466                                                  sr.rxt < 0.99*zbf[y-y0][x-x0]) {
467                                          zbf[y-y0][x-x0] = sr.rxt;
468 <                                } else if (nc == 3) {
468 >                                } else if (NC == 3) {
469                                          if (!bigdiff(rcol, pp, 0.07)) {
470                                                  scalecolor(pp, w);
471                                                  continue;
# Line 476 | Line 474 | drawsources(
474                                          scalescolor(pp, w);
475                                          continue;
476                                  }
477 <                                if (nc == 3) {
477 >                                if (NC == 3) {
478                                          scalecolor(rcol, w);
479                                          scalecolor(pp, 1.-w);
480                                          addcolor(pp, rcol);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines