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

Comparing ray/src/rt/m_brdf.c (file contents):
Revision 1.6 by greg, Tue May 7 17:45:47 1991 UTC vs.
Revision 1.7 by greg, Wed May 8 08:27:50 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 132 | Line 132 | double  omega;                 /* light source size */
132                                          /* compute BRTDF */
133          if (np->mp->otype == MAT_BRTDF) {
134                  colval(ctmp,RED) = funvalue(sa[6], 3, ldx);
135 <                if (sa[7] == sa[6])
135 >                if (!strcmp(sa[7],sa[6]))
136                          colval(ctmp,GRN) = colval(ctmp,RED);
137                  else
138                          colval(ctmp,GRN) = funvalue(sa[7], 3, ldx);
139 <                if (sa[8] == sa[6])
139 >                if (!strcmp(sa[8],sa[6]))
140                          colval(ctmp,BLU) = colval(ctmp,RED);
141 <                else if (sa[8] == sa[7])
141 >                else if (!strcmp(sa[8],sa[7]))
142                          colval(ctmp,BLU) = colval(ctmp,GRN);
143                  else
144                          colval(ctmp,BLU) = funvalue(sa[8], 3, ldx);
# Line 189 | Line 189 | register RAY  *r;
189   {
190          int  minsa, minfa;
191          BRDFDAT  nd;
192 +        double  transtest, transdist;
193          COLOR  ctmp;
194          double  dtmp;
195          FVECT  vec;
# Line 237 | Line 238 | register RAY  *r;
238          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
239          multcolor(nd.mcolor, r->pcol);          /* modify material color */
240          r->rt = r->rot;                         /* default ray length */
241 +        transtest = 0;
242                                                  /* load auxiliary files */
243          if (m->otype == MAT_PDATA || m->otype == MAT_MDATA
244                          || m->otype == MAT_TDATA) {
# Line 279 | Line 281 | register RAY  *r;
281                          objerror(m, WARNING, "compute error");
282                  else if ((dtmp = bright(ctmp)) > FTINY &&
283                                  rayorigin(&sr, r, TRANS, dtmp) == 0) {
284 <                        VCOPY(sr.rdir, r->rdir);
284 >                        if (DOT(r->pert,r->pert) > FTINY*FTINY) {
285 >                                for (i = 0; i < 3; i++) /* perturb direction */
286 >                                        sr.rdir[i] = r->rdir[i] -
287 >                                                        .75*r->pert[i];
288 >                                normalize(sr.rdir);
289 >                        } else
290 >                                transtest = 2;
291                          rayvalue(&sr);
292                          multcolor(sr.rcol, ctmp);
293                          addcolor(r->rcol, sr.rcol);
294 <                        if (dtmp > .5)
295 <                                r->rt = r->rot + sr.rt;
294 >                        transtest *= bright(sr.rcol);
295 >                        transdist = r->rot + sr.rt;
296                  }
297          }
298          if (r->crtype & SHADOW)                 /* the rest is shadow */
# Line 332 | Line 340 | register RAY  *r;
340          }
341                                                  /* add direct component */
342          direct(r, dirbrdf, &nd);
343 +                                                /* check distance */
344 +        if (transtest > bright(r->rcol))
345 +                r->rt = transdist;
346   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines