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.9 by greg, Thu Jun 13 13:58:16 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 236 | Line 237 | register RAY  *r;
237          raytexture(r, m->omod);
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 */
240 >        transtest = 0;
241                                                  /* load auxiliary files */
242          if (m->otype == MAT_PDATA || m->otype == MAT_MDATA
243                          || m->otype == MAT_TDATA) {
# Line 279 | Line 280 | register RAY  *r;
280                          objerror(m, WARNING, "compute error");
281                  else if ((dtmp = bright(ctmp)) > FTINY &&
282                                  rayorigin(&sr, r, TRANS, dtmp) == 0) {
283 <                        VCOPY(sr.rdir, r->rdir);
283 >                        if (DOT(r->pert,r->pert) > FTINY*FTINY) {
284 >                                for (i = 0; i < 3; i++) /* perturb direction */
285 >                                        sr.rdir[i] = r->rdir[i] -
286 >                                                        .75*r->pert[i];
287 >                                normalize(sr.rdir);
288 >                        } else {
289 >                                VCOPY(sr.rdir, r->rdir);
290 >                                transtest = 2;
291 >                        }
292                          rayvalue(&sr);
293                          multcolor(sr.rcol, ctmp);
294                          addcolor(r->rcol, sr.rcol);
295 <                        if (dtmp > .5)
296 <                                r->rt = r->rot + sr.rt;
295 >                        transtest *= bright(sr.rcol);
296 >                        transdist = r->rot + sr.rt;
297                  }
298          }
299          if (r->crtype & SHADOW)                 /* the rest is shadow */
# Line 332 | Line 341 | register RAY  *r;
341          }
342                                                  /* add direct component */
343          direct(r, dirbrdf, &nd);
344 +                                                /* check distance */
345 +        if (transtest > bright(r->rcol))
346 +                r->rt = transdist;
347   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines