--- ray/src/util/dctimestep.c 2009/06/21 21:42:12 2.7 +++ ray/src/util/dctimestep.c 2009/07/02 02:13:08 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: dctimestep.c,v 2.7 2009/06/21 21:42:12 greg Exp $"; +static const char RCSid[] = "$Id: dctimestep.c,v 2.10 2009/07/02 02:13:08 greg Exp $"; #endif /* * Compute time-step result using Daylight Coefficient method. @@ -38,7 +38,7 @@ cm_alloc(int nrows, int ncols) CMATRIX *cm; if ((nrows <= 0) | (ncols <= 0)) - return(NULL); + error(USER, "attempt to create empty matrix"); cm = (CMATRIX *)malloc(sizeof(CMATRIX) + 3*sizeof(COLORV)*(nrows*ncols - 1)); if (cm == NULL) @@ -294,12 +294,11 @@ static CMATRIX * cm_bsdf(const struct BSDF_data *bsdf) { CMATRIX *cm = cm_alloc(bsdf->nout, bsdf->ninc); - COLORV *mp = cm->cmem; int nbadohm = 0; int nneg = 0; int r, c; - for (c = 0; c < cm->ncols; c++, mp += 3) { + for (c = 0; c < cm->ncols; c++) { float dom = getBSDF_incohm(bsdf,c); FVECT v; @@ -313,10 +312,11 @@ cm_bsdf(const struct BSDF_data *bsdf) for (r = 0; r < cm->nrows; r++) { float f = BSDF_value(bsdf,c,r); + COLORV *mp = cm_lval(cm,r,c); if (f <= .0) { nneg += (f < -FTINY); - continue; + f = .0f; } mp[0] = mp[1] = mp[2] = f * dom; }