--- ray/src/util/rmatrix.c 2019/09/04 00:03:05 2.37 +++ ray/src/util/rmatrix.c 2020/03/25 01:51:09 2.40 @@ -1,14 +1,11 @@ #ifndef lint -static const char RCSid[] = "$Id: rmatrix.c,v 2.37 2019/09/04 00:03:05 greg Exp $"; +static const char RCSid[] = "$Id: rmatrix.c,v 2.40 2020/03/25 01:51:09 greg Exp $"; #endif /* * General matrix operations. */ -#include #include -#include -#include #include #include "rtio.h" #include "platform.h" @@ -103,6 +100,17 @@ get_dminfo(char *s, void *p) ip->swapin = (nativebigendian() != i); return(0); } + if (isexpos(s)) { + double d = exposval(s); + scalecolor(ip->mtx, d); + return(0); + } + if (iscolcor(s)) { + COLOR ctmp; + colcorval(ctmp, s); + multcolor(ip->mtx, ctmp); + return(0); + } if (!formatval(fmt, s)) { rmx_addinfo(ip, s); return(0); @@ -229,6 +237,7 @@ rmx_load(const char *inspec) dinfo.dtype = DTascii; /* assumed w/o FORMAT */ dinfo.swapin = 0; dinfo.info = NULL; + dinfo.mtx[0] = dinfo.mtx[1] = dinfo.mtx[2] = 1.; if (getheader(fp, get_dminfo, &dinfo) < 0) { fclose(fp); return(NULL); @@ -275,7 +284,14 @@ rmx_load(const char *inspec) case DTxyze: if (!rmx_load_rgbe(dnew, fp)) goto loaderr; - dnew->dtype = dinfo.dtype; + dnew->dtype = dinfo.dtype; /* undo exposure? */ + if ((dinfo.mtx[0] != 1.) | (dinfo.mtx[1] != 1.) | + (dinfo.mtx[2] != 1.)) { + dinfo.mtx[0] = 1./dinfo.mtx[0]; + dinfo.mtx[1] = 1./dinfo.mtx[1]; + dinfo.mtx[2] = 1./dinfo.mtx[2]; + rmx_scale(dnew, dinfo.mtx); + } break; default: goto loaderr; @@ -655,7 +671,7 @@ rmx_transform(const RMATRIX *msrc, int n, const double return(NULL); if (msrc->info) { char buf[128]; - sprintf(buf, "Applied %dx%d matrix transform\n", + sprintf(buf, "Applied %dx%d component transform\n", dnew->ncomp, msrc->ncomp); rmx_addinfo(dnew, msrc->info); rmx_addinfo(dnew, buf);