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

Comparing ray/src/util/rmatrix.c (file contents):
Revision 2.47 by greg, Fri Jan 22 16:19:15 2021 UTC vs.
Revision 2.48 by greg, Thu Mar 18 00:34:31 2021 UTC

# Line 398 | Line 398 | rmx_write_rgbe(const RMATRIX *rm, FILE *fp)
398          return(1);
399   }
400  
401 + /* Check if CIE XYZ primaries were specified */
402 + static int
403 + findCIEprims(const char *info)
404 + {
405 +        RGBPRIMS        prims;
406 +
407 +        if (!info)
408 +                return(0);
409 +        info = strstr(info, PRIMARYSTR);
410 +        if (!info || !primsval(prims, info))
411 +                return(0);
412 +
413 +        return((prims[RED][CIEX] > .99) & (prims[RED][CIEY] < .01) &&
414 +                        (prims[GRN][CIEX] < .01) & (prims[GRN][CIEY] > .99) &&
415 +                        (prims[BLU][CIEX] < .01) & (prims[BLU][CIEY] < .01));
416 + }
417 +
418   /* Write matrix to file type indicated by dtype */
419   int
420   rmx_write(const RMATRIX *rm, int dtype, FILE *fp)
# Line 415 | Line 432 | rmx_write(const RMATRIX *rm, int dtype, FILE *fp)
432                  fputs(rm->info, fp);
433          if (dtype == DTfromHeader)
434                  dtype = rm->dtype;
435 <        else if ((dtype == DTrgbe) & (rm->dtype == DTxyze))
435 >        else if (dtype == DTrgbe && (rm->dtype == DTxyze ||
436 >                                        findCIEprims(rm->info)))
437                  dtype = DTxyze;
438          else if ((dtype == DTxyze) & (rm->dtype == DTrgbe))
439                  dtype = DTrgbe;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines