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

Comparing ray/src/util/dctimestep.c (file contents):
Revision 2.6 by greg, Sat Jun 20 04:37:43 2009 UTC vs.
Revision 2.9 by greg, Sun Jun 21 21:53:10 2009 UTC

# Line 294 | Line 294 | static CMATRIX *
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;
300          
301 <        for (r = 0; r < cm->nrows; r++)
302 <                for (c = 0; c < cm->ncols; c++, mp += 3) {
301 >        for (c = 0; c < cm->ncols; c++) {
302 >                float   dom = getBSDF_incohm(bsdf,c);
303 >                FVECT   v;
304 >                
305 >                if (dom <= .0) {
306 >                        nbadohm++;
307 >                        continue;
308 >                }
309 >                if (!getBSDF_incvec(v,bsdf,c) || v[2] > FTINY)
310 >                        error(USER, "illegal incoming BTDF direction");
311 >                dom *= -v[2];
312 >
313 >                for (r = 0; r < cm->nrows; r++) {
314                          float   f = BSDF_value(bsdf,c,r);
315 <                        float   dom = getBSDF_incohm(bsdf,c);
316 <                        FVECT   v;
307 <                        
315 >                        COLORV  *mp = cm_lval(cm,r,c);
316 >
317                          if (f <= .0) {
318                                  nneg += (f < -FTINY);
319 <                                continue;
319 >                                f = .0f;
320                          }
321 <                        if (dom <= .0) {
313 <                                nbadohm++;
314 <                                continue;
315 <                        }
316 <                        if (!getBSDF_incvec(v,bsdf,c) || v[2] > FTINY)
317 <                                error(USER, "illegal incoming BTDF direction");
318 <                                
319 <                        mp[0] = mp[1] = mp[2] = f * dom * -v[2];
321 >                        mp[0] = mp[1] = mp[2] = f * dom;
322                  }
323 +        }
324          if (nneg || nbadohm) {
325                  sprintf(errmsg,
326                      "BTDF has %d negatives and %d bad incoming solid angles",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines