36 |
|
setcolor(mp, .0f, .0f, .0f); |
37 |
|
} else if (bsdf->chroma != NULL) { |
38 |
|
C_COLOR cxy; |
39 |
< |
c_decodeChroma(&cxy, |
40 |
< |
bsdf->chroma[r*bsdf->ninc + c]); |
39 |
> |
c_decodeChroma(&cxy, mBSDF_chroma(bsdf,c,r)); |
40 |
|
ccy2rgb(&cxy, f, mp); |
41 |
|
} else |
42 |
|
setcolor(mp, f, f, f); |
102 |
|
setcolor(mp, .0f, .0f, .0f); |
103 |
|
} else if (bsdf->chroma != NULL) { |
104 |
|
C_COLOR cxy; |
105 |
< |
c_decodeChroma(&cxy, |
107 |
< |
bsdf->chroma[ro*bsdf->ninc + ri]); |
105 |
> |
c_decodeChroma(&cxy, mBSDF_chroma(bsdf,ri,ro)); |
106 |
|
ccy2rgb(&cxy, f, mp); |
107 |
|
} else |
108 |
|
setcolor(mp, f, f, f); |
139 |
|
cm_loadBTDF(char *fname) |
140 |
|
{ |
141 |
|
CMATRIX *Tmat; |
144 |
– |
char *fpath; |
142 |
|
int recip; |
143 |
|
SDError ec; |
144 |
|
SDData myBSDF; |
145 |
|
SDSpectralDF *tdf; |
146 |
|
COLOR diffBSDF; |
147 |
< |
/* find path to BSDF file */ |
151 |
< |
fpath = getpath(fname, getrlibpath(), R_OK); |
152 |
< |
if (fpath == NULL) { |
153 |
< |
sprintf(errmsg, "cannot find BSDF file '%s'", fname); |
154 |
< |
error(USER, errmsg); |
155 |
< |
} |
147 |
> |
|
148 |
|
SDclearBSDF(&myBSDF, fname); /* load XML and check type */ |
149 |
< |
ec = SDloadFile(&myBSDF, fpath); |
149 |
> |
ec = SDloadFile(&myBSDF, fname); |
150 |
|
if (ec) |
151 |
|
error(USER, transSDError(ec)); |
152 |
|
ccy2rgb(&myBSDF.tLamb.spec, myBSDF.tLamb.cieY/PI, diffBSDF); |
157 |
|
return(cm_bsdf_Lamb(diffBSDF)); |
158 |
|
} |
159 |
|
if (tdf->ncomp != 1 || tdf->comp[0].func != &SDhandleMtx) { |
160 |
< |
sprintf(errmsg, "unsupported BSDF '%s'", fpath); |
160 |
> |
sprintf(errmsg, "unsupported BSDF '%s'", fname); |
161 |
|
error(USER, errmsg); |
162 |
|
} |
163 |
|
/* convert BTDF to matrix */ |