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

Comparing ray/src/rt/m_bsdf.c (file contents):
Revision 2.2 by greg, Fri Feb 18 02:41:55 2011 UTC vs.
Revision 2.3 by greg, Sat Feb 19 01:48:59 2011 UTC

# Line 73 | Line 73 | dirbsdf(
73          double  omega                   /* light source size */
74   )
75   {
76 <        BSDFDAT         *np = nnp;
76 >        BSDFDAT         *np = (BSDFDAT *)nnp;
77          SDError         ec;
78          SDValue         sv;
79          FVECT           vout;
# Line 126 | Line 126 | dirbsdf(
126                  scalecolor(ctmp2, dtmp);
127                  setcolor(ctmp1, 1.-dtmp, 1.-dtmp, 1.-dtmp);
128                  addcolor(ctmp1, ctmp2);
129 <                multcolor(ctmp, ctmp1); /* apply desaturated pattern */
129 >                multcolor(ctmp, ctmp1); /* apply derated pattern */
130                  dtmp = ldot * omega;
131          } else {                        /* full pattern on transmission */
132                  multcolor(ctmp, np->pr->pcol);
# Line 185 | Line 185 | sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int usep
185                          ++nsent;                /* Russian roulette victim */
186                          continue;
187                  }
188 <                                                /* need to move origin? */
189 <                sthick = (ndp->pr->rod > .0) ? -ndp->thick : ndp->thick;
190 <                if (sthick < .0 ^ vout[2] > .0)
191 <                        VSUM(sr.rorg, sr.rorg, ndp->pr->ron, sthick);
192 <
188 >                if (ndp->thick > FTINY) {       /* need to move origin? */
189 >                        sthick = (ndp->pr->rod > .0) ? -ndp->thick : ndp->thick;
190 >                        if (sthick < .0 ^ vout[2] > .0)
191 >                                VSUM(sr.rorg, sr.rorg, ndp->pr->ron, sthick);
192 >                }
193                  rayvalue(&sr);                  /* send & evaluate sample */
194                  multcolor(sr.rcol, sr.rcoef);
195                  addcolor(ndp->pr->rcol, sr.rcol);
# Line 225 | Line 225 | sample_sdf(BSDFDAT *ndp, int sflags)
225                  return(0);
226                                                  /* below sampling threshold? */
227          if (dfp->maxHemi <= specthresh+FTINY) {
228 <                if (dfp->maxHemi > FTINY) {     /* XXX no color from BSDF! */
228 >                if (dfp->maxHemi > FTINY) {     /* XXX no color from BSDF */
229                          double  d = SDdirectHemi(ndp->vinc, sflags, ndp->sd);
230                          COLOR   ctmp;
231                          if (sflags == SDsampSpT) {
# Line 272 | Line 272 | m_bsdf(OBJREC *m, RAY *r)
272                  nd.thick = .0;
273                                                  /* check shadow */
274          if (r->crtype & SHADOW) {
275 <                SDfreeCache(nd.sd);
276 <                if (nd.thick > FTINY && nd.sd->tf != NULL &&
277 <                                nd.sd->tf->maxHemi > FTINY)
275 >                if ((nd.thick > FTINY) & (nd.sd->tf != NULL))
276                          raytrans(r);            /* pass-through */
277 +                SDfreeCache(nd.sd);
278                  return(1);                      /* else shadow */
279          }
280                                                  /* check unscattered ray */
281 <        if (!(r->crtype & (SPECULAR|AMBIENT)) && nd.thick > FTINY &&
282 <                        nd.sd->tf != NULL && nd.sd->tf->maxHemi > FTINY) {
281 >        if (!(r->crtype & (SPECULAR|AMBIENT)) &&
282 >                        (nd.thick > FTINY) & (nd.sd->tf != NULL)) {
283                  SDfreeCache(nd.sd);
284                  raytrans(r);                    /* pass-through */
285                  return(1);
# Line 295 | Line 294 | m_bsdf(OBJREC *m, RAY *r)
294                                          m->oargs.farg[2]);
295          } else {
296                  if (m->oargs.nfargs < 6) {      /* check invisible backside */
297 <                        if (!backvis && (nd.sd->rb == NULL ||
298 <                                                nd.sd->rb->maxHemi <= FTINY) &&
300 <                                        (nd.sd->tf == NULL ||
301 <                                                nd.sd->tf->maxHemi <= FTINY)) {
297 >                        if (!backvis && (nd.sd->rb == NULL) &
298 >                                                (nd.sd->tf == NULL)) {
299                                  SDfreeCache(nd.sd);
300                                  raytrans(r);
301                                  return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines