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.57 by greg, Mon Mar 14 23:28:14 2022 UTC vs.
Revision 2.58 by greg, Thu May 18 23:55:10 2023 UTC

# Line 32 | Line 32 | rmx_new(int nr, int nc, int n)
32                  dnew->nrows = nr;
33                  dnew->ncols = nc;
34                  dnew->ncomp = n;
35 +                setcolor(dnew->cexp, 1.f, 1.f, 1.f);
36          }
37          return(dnew);
38   }
# Line 301 | Line 302 | rmx_load(const char *inspec, RMPref rmp)
302                  return(NULL);
303          }
304          dnew->dtype = DTascii;                  /* assumed w/o FORMAT */
304        dnew->cexp[0] = dnew->cexp[1] = dnew->cexp[2] = 1.f;
305          if (getheader(fp, get_dminfo, dnew) < 0) {
306                  fclose(fp);
307                  return(NULL);
# Line 338 | Line 338 | rmx_load(const char *inspec, RMPref rmp)
338          case DTxyze:
339                  if (!rmx_load_rgbe(dnew, fp))
340                          goto loaderr;
341                                                /* undo exposure? */
342                if ((dnew->cexp[0] != 1.f) | (dnew->cexp[1] != 1.f) |
343                                (dnew->cexp[2] != 1.f)) {
344                        double  cmlt[3];
345                        cmlt[0] = 1./dnew->cexp[0];
346                        cmlt[1] = 1./dnew->cexp[1];
347                        cmlt[2] = 1./dnew->cexp[2];
348                        rmx_scale(dnew, cmlt);
349                }
350                dnew->swapin = 0;
341                  break;
342          default:
343                  goto loaderr;
# Line 362 | Line 352 | rmx_load(const char *inspec, RMPref rmp)
352          else
353                  funlockfile(fp);
354   #endif
355 +                                                /* undo exposure? */
356 +        if (dnew->ncomp == 3 && (dnew->cexp[0] != 1.f) |
357 +                        (dnew->cexp[1] != 1.f) | (dnew->cexp[2] != 1.f)) {
358 +                double  cmlt[3];
359 +                cmlt[0] = 1./dnew->cexp[0];
360 +                cmlt[1] = 1./dnew->cexp[1];
361 +                cmlt[2] = 1./dnew->cexp[2];
362 +                rmx_scale(dnew, cmlt);
363 +                setcolor(dnew->cexp, 1.f, 1.f, 1.f);
364 +        }
365          return(dnew);
366   loaderr:                                        /* should report error? */
367          if (inspec[0] == '!')
# Line 488 | Line 488 | rmx_write(const RMATRIX *rm, int dtype, FILE *fp)
488                  dtype = DTxyze;
489          else if ((dtype == DTxyze) & (rm->dtype == DTrgbe))
490                  dtype = DTrgbe;
491 +        if (rm->ncomp == 3) {                   /* write exposure? */
492 +                if ((rm->cexp[RED] != rm->cexp[GRN]) |
493 +                                (rm->cexp[GRN] != rm->cexp[BLU]))
494 +                        fputcolcor(rm->cexp, fp);
495 +                else if (rm->cexp[GRN] != 1.f)
496 +                        fputexpos(rm->cexp[GRN], fp);
497 +        }
498          if ((dtype != DTrgbe) & (dtype != DTxyze)) {
499                  fprintf(fp, "NROWS=%d\n", rm->nrows);
500                  fprintf(fp, "NCOLS=%d\n", rm->ncols);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines