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.2 by greg, Fri Jun 19 06:49:42 2009 UTC vs.
Revision 2.3 by greg, Fri Jun 19 14:21:42 2009 UTC

# Line 295 | Line 295 | cm_bsdf(const struct BSDF_data *bsdf)
295   {
296          CMATRIX *cm = cm_alloc(bsdf->nout, bsdf->ninc);
297          COLORV  *mp = cm->cmem;
298 +        int     nbadohm = 0;
299 +        int     nneg = 0;
300          int     r, c;
301          
302          for (r = 0; r < cm->nrows; r++)
303 <                for (c = 0; c < cm->ncols; c++, mp += 3)
304 <                        mp[0] = mp[1] = mp[2] = BSDF_value(bsdf,c,r);
303 >                for (c = 0; c < cm->ncols; c++, mp += 3) {
304 >                        float   f = BSDF_value(bsdf,c,r);
305 >                        float   dom = getBSDF_incohm(bsdf,c);
306 >                        FVECT   v;
307 >                        
308 >                        if (f <= .0) {
309 >                                nneg += (f < -FTINY);
310 >                                continue;
311 >                        }
312 >                        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];
320 >                }
321 >        if (nbadohm | nneg) {
322 >                sprintf(errmsg,
323 >                    "BTDF has %d negatives and %d bad incoming solid angles");
324 >                error(WARNING, errmsg);
325 >        }
326          return(cm);
327   }
328  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines