--- ray/src/util/rmtxop.c 2021/01/19 23:32:00 2.18 +++ ray/src/util/rmtxop.c 2023/11/21 01:30:20 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rmtxop.c,v 2.18 2021/01/19 23:32:00 greg Exp $"; +static const char RCSid[] = "$Id: rmtxop.c,v 2.21 2023/11/21 01:30:20 greg Exp $"; #endif /* * General component matrix operations. @@ -38,7 +38,7 @@ int verbose = 0; /* verbose reporting? */ static int loadmatrix(ROPMAT *rop) { - if (rop->mtx != NULL) + if (rop->mtx != NULL) /* already loaded? */ return(0); rop->mtx = rmx_load(rop->inspec, rop->rmp); @@ -239,7 +239,7 @@ op_right2left(ROPMAT *mop) while (rpos-- > 0) { if (mright == NULL) break; - mright = binaryop(mop[rpos].inspec, + mright = binaryop(mop[rpos+1].inspec, loadop(mop+rpos), mop[rpos].binop, mright); } return(mright); @@ -418,6 +418,8 @@ main(int argc, char *argv[]) /* write result to stdout */ if (outfmt == DTfromHeader) outfmt = mres->dtype; + if ((outfmt == DTrgbe) & (mres->ncomp > 3)) + outfmt = DTspec; if (outfmt != DTascii) SET_FILE_BINARY(stdout); newheader("RADIANCE", stdout); @@ -430,7 +432,7 @@ main(int argc, char *argv[]) return(0); userr: fprintf(stderr, - "Usage: %s [-v][-f[adfc][-t][-s sf .. | -c ce ..][-r[fb]] m1 [.+*/] .. > mres\n", + "Usage: %s [-v][-f[adfc][-t][-s sf .. | -c ce ..][-rf|-rb] m1 [.+*/] .. > mres\n", argv[0]); return(1); }