38 |
|
CMATRIX *cm; |
39 |
|
|
40 |
|
if ((nrows <= 0) | (ncols <= 0)) |
41 |
< |
return(NULL); |
41 |
> |
error(USER, "attempt to create empty matrix"); |
42 |
|
cm = (CMATRIX *)malloc(sizeof(CMATRIX) + |
43 |
|
3*sizeof(COLORV)*(nrows*ncols - 1)); |
44 |
|
if (cm == NULL) |
294 |
|
cm_bsdf(const struct BSDF_data *bsdf) |
295 |
|
{ |
296 |
|
CMATRIX *cm = cm_alloc(bsdf->nout, bsdf->ninc); |
297 |
– |
COLORV *mp = cm->cmem; |
297 |
|
int nbadohm = 0; |
298 |
|
int nneg = 0; |
299 |
|
int r, c; |
312 |
|
|
313 |
|
for (r = 0; r < cm->nrows; r++) { |
314 |
|
float f = BSDF_value(bsdf,c,r); |
315 |
+ |
COLORV *mp = cm_lval(cm,r,c); |
316 |
|
|
317 |
|
if (f <= .0) { |
318 |
|
nneg += (f < -FTINY); |
319 |
|
f = .0f; |
320 |
|
} |
321 |
– |
mp = cm_lval(cm,r,c); |
321 |
|
mp[0] = mp[1] = mp[2] = f * dom; |
322 |
|
} |
323 |
|
} |