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

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.107 by greg, Wed Nov 15 18:02:53 2023 UTC vs.
Revision 2.112 by greg, Sat Jan 6 01:21:34 2024 UTC

# Line 87 | Line 87 | static double nextray(FVECT org, FVECT dir);
87   static void tabin(RAY *r);
88   static void ourtrace(RAY *r);
89  
90 < static void  putscolor(const COLORV *scol);
90 > static void  putscolor(COLORV *scol);
91  
92   static oputf_t *ray_out[32], *every_out[32];
93   static putf_t *putreal;
# Line 253 | Line 253 | setrtoutput(void)                      /* set up output tables, return #c
253          case 'c':
254                  if (outvals[1] || !strchr("vrx", outvals[0]))
255                          error(USER, "color format only with -ov, -or, -ox");
256 +                if (nco < 3)
257 +                        error(USER, "color format incompatible with -pY, -pS, -pM");
258                  break;
259          default:
260                  error(CONSISTENCY, "botched output format");
# Line 682 | Line 684 | oputr(                         /* print mirrored contribution */
684          RAY  *r
685   )
686   {
687 <        RREAL   cval[3];
686 <
687 <        cval[0] = colval(r->mcol,RED);
688 <        cval[1] = colval(r->mcol,GRN);
689 <        cval[2] = colval(r->mcol,BLU);
690 <        (*putreal)(cval, 3);
687 >        putscolor(r->mcol);
688   }
689  
690  
# Line 924 | Line 921 | static void
921   putd(RREAL *v, int n)           /* output binary double(s) */
922   {
923   #ifdef  SMLFLT
924 <        double  da[3];
924 >        double  da[MAXCSAMP];
925          int     i;
926  
927 <        if (n > 3)
927 >        if (n > MAXCSAMP)
928                  error(INTERNAL, "code error in putd()");
929          for (i = n; i--; )
930                  da[i] = v[i];
# Line 942 | Line 939 | static void
939   putf(RREAL *v, int n)           /* output binary float(s) */
940   {
941   #ifndef SMLFLT
942 <        float   fa[3];
942 >        float   fa[MAXCSAMP];
943          int     i;
944  
945 <        if (n > 3)
945 >        if (n > MAXCSAMP)
946                  error(INTERNAL, "code error in putf()");
947          for (i = n; i--; )
948                  fa[i] = v[i];
# Line 957 | Line 954 | putf(RREAL *v, int n)          /* output binary float(s) */
954  
955  
956   static void
957 < putscolor(const COLORV *scol)           /* output (spectral) color */
957 > putscolor(COLORV *scol)         /* output (spectral) color */
958   {
959          static COLORMAT xyz2myrgbmat;
960          SCOLOR          my_scol;
961          COLOR           col;
962 <                                        /* apply scalefactor if any */
963 <        if (out_scalefactor != 1.) {
962 >                                        /* single channel output? */
963 >        if (sens_curve != NULL) {
964 >                RREAL   v = (*sens_curve)(scol) * out_scalefactor;
965 >                (*putreal)(&v, 1);
966 >                return;
967 >        }
968 >        if (out_scalefactor != 1.) {    /* apply scalefactor if any */
969                  copyscolor(my_scol, scol);
970                  scalescolor(my_scol, out_scalefactor);
971                  scol = my_scol;
970        }
971        if (sens_curve != NULL) {       /* single channel output */
972                RREAL   v = (*sens_curve)(scol);
973                (*putreal)(&v, 1);
974                return;
972          }
973          if (out_prims == NULL) {        /* full spectral reporting */
974                  if (outform == 'c') {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines