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

Comparing ray/src/util/rmtxop.c (file contents):
Revision 2.27 by greg, Sat Dec 2 00:42:21 2023 UTC vs.
Revision 2.30 by greg, Fri Dec 8 00:12:31 2023 UTC

# Line 69 | Line 69 | checkreffile(ROPMAT *rop)
69                  fclose(fp);
70                  curRF = rop->preop.csym;
71          }
72 <        if ((refm.ncomp == 3) & (refm.dtype != DTspec)) {
72 >        if (refm.ncomp == 3) {
73                  rop->preop.csym = (refm.dtype == DTxyze) ? "XYZ" : "RGB";
74                  return(checksymbolic(rop));
75          }
# Line 103 | Line 103 | checkreffile(ROPMAT *rop)
103                  for (j = refm.ncomp; j-- > 0; )
104                          rop->preop.cmat[j*nc + i] = scresp[j];
105          }
106 +        memcpy(rop->mtx->wlpart, refm.wlpart, sizeof(rop->mtx->wlpart));
107          return(0);
108   }
109  
# Line 244 | Line 245 | checksymbolic(ROPMAT *rop)
245          } else if (!strcmp(rop->preop.csym, "RGB")) {
246                  if (dt <= DTspec)
247                          return(DTrgbe);
248 <        }
248 <        if ((nc > 3) & (dt <= DTspec))
248 >        } else if (dt == DTspec)
249                  return(DTfloat);        /* probably not actual spectrum */
250          return(0);
251   }
# Line 274 | Line 274 | loadop(ROPMAT *rop)
274                          if (rop->preop.nsf == 1) {
275                                  for (i = rop->preop.clen; i--; )
276                                          rop->preop.cmat[i] *= rop->preop.sca[0];
277 <                        } else if (rop->preop.nsf != rop->mtx->ncomp) {
277 >                        } else if (rop->preop.nsf*rop->mtx->ncomp != rop->preop.clen) {
278                                  fprintf(stderr, "%s: -s must have one or %d factors\n",
279 <                                                rop->inspec, rop->mtx->ncomp);
279 >                                                rop->inspec,
280 >                                                rop->preop.clen/rop->mtx->ncomp);
281                                  goto failure;
282                          } else {
283 <                                for (j = rop->preop.clen/rop->preop.nsf; j--; )
284 <                                        for (i = rop->preop.nsf; i--; )
285 <                                                rop->preop.cmat[j*rop->preop.nsf+i] *=
286 <                                                                rop->preop.sca[i];
283 >                                for (i = rop->preop.nsf; i--; )
284 >                                        for (j = rop->mtx->ncomp; j--; )
285 >                                                rop->preop.cmat[i*rop->mtx->ncomp+j]
286 >                                                                *= rop->preop.sca[i];
287                          }
288                  }
289                  mres = rmx_transform(rop->mtx, rop->preop.clen/rop->mtx->ncomp,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines