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 2.4 by greg, Wed Oct 14 12:30:54 1992 UTC vs.
Revision 2.21 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  Shading for materials with arbitrary BRDF's
6   */
7  
8 < #include  "ray.h"
8 > #include "copyright.h"
9  
10 + #include  "ray.h"
11 + #include  "ambient.h"
12   #include  "data.h"
13 <
13 > #include  "source.h"
14   #include  "otypes.h"
15 <
15 > #include  "rtotypes.h"
16   #include  "func.h"
17  
18   /*
# Line 21 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   *  String arguments include the reflection function and files.
21   *  The BRDF is currently used just for the specular component to light
22   *  sources.  Reflectance values or data coordinates are functions
23 < *  of the direction to the light source.
23 > *  of the direction to the light source.  (Data modification functions
24 > *  are passed the source direction as args 2-4.)
25   *      We orient the surface towards the incoming ray, so a single
26   *  surface can be used to represent an infinitely thin object.
27   *
# Line 51 | Line 51 | static char SCCSid[] = "$SunId$ LBL";
51   *              rbrtd   gbrtd   bbrtd
52   *              funcfile        transform
53   *      0
54 < *      6+      red     grn     blu     rspec   trans   tspec   A7 ..
54 > *      9+      rdf     gdf     bdf
55 > *              rdb     gdb     bdb
56 > *              rdt     gdt     bdt     A10 ..
57   *
58   *      In addition to the normal variables available to functions,
59   *  we define the following:
60   *              NxP, NyP, NzP -         perturbed surface normal
61   *              RdotP -                 perturbed ray dot product
62 < *              CrP, CgP, CbP -         perturbed material color
62 > *              CrP, CgP, CbP -         perturbed material color (or pattern)
63   */
64  
65   typedef struct {
66          OBJREC  *mp;            /* material pointer */
67          RAY  *pr;               /* intersected ray */
68          DATARRAY  *dp;          /* data array for PDATA, MDATA or TDATA */
69 <        COLOR  mcolor;          /* color of this material */
70 <        double  rspec;          /* specular reflection */
71 <        double  rdiff;          /* diffuse reflection */
72 <        double  trans;          /* transmissivity */
73 <        double  tspec;          /* specular transmission */
74 <        double  tdiff;          /* diffuse transmission */
69 >        COLOR  mcolor;          /* material (or pattern) color */
70 >        COLOR  rdiff;           /* diffuse reflection */
71 >        COLOR  tdiff;           /* diffuse transmission */
72 >        double  rspec;          /* specular reflectance (1 for BRDTF) */
73 >        double  trans;          /* transmissivity (.5 for BRDTF) */
74 >        double  tspec;          /* specular transmittance (1 for BRDTF) */
75          FVECT  pnorm;           /* perturbed surface normal */
76          double  pdot;           /* perturbed dot product */
77   }  BRDFDAT;             /* BRDF material data */
78  
79  
80 < dirbrdf(cval, np, ldir, omega)          /* compute source contribution */
81 < COLOR  cval;                    /* returned coefficient */
82 < register BRDFDAT  *np;          /* material data */
83 < FVECT  ldir;                    /* light source direction */
84 < double  omega;                  /* light source size */
80 > static srcdirf_t dirbrdf;
81 > static int setbrdfunc(BRDFDAT  *np);
82 >
83 >
84 > static void
85 > dirbrdf(                /* compute source contribution */
86 >        COLOR  cval,                    /* returned coefficient */
87 >        void  *nnp,             /* material data */
88 >        FVECT  ldir,                    /* light source direction */
89 >        double  omega                   /* light source size */
90 > )
91   {
92 +        register BRDFDAT *np = nnp;
93          double  ldot;
94          double  dtmp;
95          COLOR  ctmp;
96          FVECT  ldx;
97 <        double  lddx[3], pt[MAXDIM];
97 >        static double  vldx[5], pt[MAXDIM];
98          register char   **sa;
99          register int    i;
100 + #define lddx (vldx+1)
101  
102          setcolor(cval, 0.0, 0.0, 0.0);
103          
# Line 95 | Line 105 | double  omega;                 /* light source size */
105  
106          if (ldot <= FTINY && ldot >= -FTINY)
107                  return;         /* too close to grazing */
108 +
109          if (ldot < 0.0 ? np->trans <= FTINY : np->trans >= 1.0-FTINY)
110                  return;         /* wrong side */
111  
112 <        if (ldot > 0.0 && np->rdiff > FTINY) {
112 >        if (ldot > 0.0) {
113                  /*
114                   *  Compute and add diffuse reflected component to returned
115                   *  color.  The diffuse reflected component will always be
116                   *  modified by the color of the material.
117                   */
118 <                copycolor(ctmp, np->mcolor);
119 <                dtmp = ldot * omega * np->rdiff / PI;
118 >                copycolor(ctmp, np->rdiff);
119 >                dtmp = ldot * omega / PI;
120                  scalecolor(ctmp, dtmp);
121                  addcolor(cval, ctmp);
122 <        }
112 <        if (ldot < 0.0 && np->tdiff > FTINY) {
122 >        } else {
123                  /*
124                   *  Diffuse transmitted component.
125                   */
126 <                copycolor(ctmp, np->mcolor);
127 <                dtmp = -ldot * omega * np->tdiff / PI;
126 >                copycolor(ctmp, np->tdiff);
127 >                dtmp = -ldot * omega / PI;
128                  scalecolor(ctmp, dtmp);
129                  addcolor(cval, ctmp);
130          }
# Line 128 | Line 138 | double  omega;                 /* light source size */
138          multv3(ldx, ldir, funcxf.xfm);
139          for (i = 0; i < 3; i++)
140                  lddx[i] = ldx[i]/funcxf.sca;
141 +        lddx[3] = omega;
142                                          /* compute BRTDF */
143          if (np->mp->otype == MAT_BRTDF) {
144 <                colval(ctmp,RED) = funvalue(sa[6], 3, lddx);
144 >                if (sa[6][0] == '0')            /* special case */
145 >                        colval(ctmp,RED) = 0.0;
146 >                else
147 >                        colval(ctmp,RED) = funvalue(sa[6], 4, lddx);
148                  if (!strcmp(sa[7],sa[6]))
149                          colval(ctmp,GRN) = colval(ctmp,RED);
150                  else
151 <                        colval(ctmp,GRN) = funvalue(sa[7], 3, lddx);
151 >                        colval(ctmp,GRN) = funvalue(sa[7], 4, lddx);
152                  if (!strcmp(sa[8],sa[6]))
153                          colval(ctmp,BLU) = colval(ctmp,RED);
154                  else if (!strcmp(sa[8],sa[7]))
155                          colval(ctmp,BLU) = colval(ctmp,GRN);
156                  else
157 <                        colval(ctmp,BLU) = funvalue(sa[8], 3, lddx);
157 >                        colval(ctmp,BLU) = funvalue(sa[8], 4, lddx);
158                  dtmp = bright(ctmp);
159          } else if (np->dp == NULL) {
160 <                dtmp = funvalue(sa[0], 3, lddx);
160 >                dtmp = funvalue(sa[0], 4, lddx);
161                  setcolor(ctmp, dtmp, dtmp, dtmp);
162          } else {
163                  for (i = 0; i < np->dp->nd; i++)
164 <                        pt[i] = funvalue(sa[3+i], 3, lddx);
165 <                dtmp = datavalue(np->dp, pt);
166 <                dtmp = funvalue(sa[0], 1, &dtmp);
164 >                        pt[i] = funvalue(sa[3+i], 4, lddx);
165 >                vldx[0] = datavalue(np->dp, pt);
166 >                dtmp = funvalue(sa[0], 5, vldx);
167                  setcolor(ctmp, dtmp, dtmp, dtmp);
168          }
169 <        if (errno) {
169 >        if (errno == EDOM || errno == ERANGE) {
170                  objerror(np->mp, WARNING, "compute error");
171                  return;
172          }
# Line 162 | Line 176 | double  omega;                 /* light source size */
176                  /*
177                   *  Compute reflected non-diffuse component.
178                   */
179 <                if (np->mp->otype == MAT_MFUNC || np->mp->otype == MAT_MDATA)
179 >                if ((np->mp->otype == MAT_MFUNC) | (np->mp->otype == MAT_MDATA))
180                          multcolor(ctmp, np->mcolor);
181                  dtmp = ldot * omega * np->rspec;
182                  scalecolor(ctmp, dtmp);
# Line 171 | Line 185 | double  omega;                 /* light source size */
185                  /*
186                   *  Compute transmitted non-diffuse component.
187                   */
188 <                if (np->mp->otype == MAT_TFUNC || np->mp->otype == MAT_TDATA)
188 >                if ((np->mp->otype == MAT_TFUNC) | (np->mp->otype == MAT_TDATA))
189                          multcolor(ctmp, np->mcolor);
190                  dtmp = -ldot * omega * np->tspec;
191                  scalecolor(ctmp, dtmp);
192                  addcolor(cval, ctmp);
193          }
194 + #undef lddx
195   }
196  
197  
198 < m_brdf(m, r)                    /* color a ray which hit a BRDF material */
199 < register OBJREC  *m;
200 < register RAY  *r;
198 > extern int
199 > m_brdf(                 /* color a ray that hit a BRDTfunc material */
200 >        register OBJREC  *m,
201 >        register RAY  *r
202 > )
203   {
204 <        int  minsa, minfa;
204 >        int  hitfront = 1;
205          BRDFDAT  nd;
206 +        RAY  sr;
207          double  transtest, transdist;
208 +        int  hasrefl, hastrans;
209          COLOR  ctmp;
210 <        double  dtmp, tspect, rspecr;
211 <        MFUNC  *mf;
210 >        FVECT  vtmp;
211 >        register MFUNC  *mf;
212          register int  i;
213                                                  /* check arguments */
214 <        switch (m->otype) {
196 <        case MAT_PFUNC: case MAT_MFUNC:
197 <                minsa = 2; minfa = 4; break;
198 <        case MAT_PDATA: case MAT_MDATA:
199 <                minsa = 4; minfa = 4; break;
200 <        case MAT_TFUNC:
201 <                minsa = 2; minfa = 6; break;
202 <        case MAT_TDATA:
203 <                minsa = 4; minfa = 6; break;
204 <        case MAT_BRTDF:
205 <                minsa = 10; minfa = 6; break;
206 <        }
207 <        if (m->oargs.nsargs < minsa || m->oargs.nfargs < minfa)
214 >        if ((m->oargs.nsargs < 10) | (m->oargs.nfargs < 9))
215                  objerror(m, USER, "bad # arguments");
216          nd.mp = m;
217          nd.pr = r;
218 <                                                /* get specular component */
219 <        nd.rspec = m->oargs.farg[3];
220 <                                                /* compute transmission */
221 <        if (m->otype == MAT_TFUNC || m->otype == MAT_TDATA
222 <                        || m->otype == MAT_BRTDF) {
223 <                nd.trans = m->oargs.farg[4]*(1.0 - nd.rspec);
224 <                nd.tspec = nd.trans * m->oargs.farg[5];
225 <                nd.tdiff = nd.trans - nd.tspec;
226 <        } else
227 <                nd.tdiff = nd.tspec = nd.trans = 0.0;
228 <                                                /* early shadow check */
229 <        if (r->crtype & SHADOW && (m->otype != MAT_BRTDF || nd.tspec <= FTINY))
230 <                return;
231 <                                                /* diffuse reflection */
232 <        nd.rdiff = 1.0 - nd.trans - nd.rspec;
233 <                                                /* get material color */
227 <        setcolor(nd.mcolor, m->oargs.farg[0],
228 <                           m->oargs.farg[1],
229 <                           m->oargs.farg[2]);
230 <                                                /* fix orientation */
231 <        if (r->rod < 0.0)
232 <                flipsurface(r);
218 >                                                /* dummy values */
219 >        nd.rspec = nd.tspec = 1.0;
220 >        nd.trans = 0.5;
221 >                                                /* diffuse reflectance */
222 >        if (r->rod > 0.0)
223 >                setcolor(nd.rdiff, m->oargs.farg[0],
224 >                                m->oargs.farg[1],
225 >                                m->oargs.farg[2]);
226 >        else
227 >                setcolor(nd.rdiff, m->oargs.farg[3],
228 >                                m->oargs.farg[4],
229 >                                m->oargs.farg[5]);
230 >                                                /* diffuse transmittance */
231 >        setcolor(nd.tdiff, m->oargs.farg[6],
232 >                        m->oargs.farg[7],
233 >                        m->oargs.farg[8]);
234                                                  /* get modifiers */
235          raytexture(r, m->omod);
236          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
237 <        multcolor(nd.mcolor, r->pcol);          /* modify material color */
238 <        transtest = 0;
239 <                                                /* load auxiliary files */
240 <        if (hasdata(m->otype)) {
241 <                nd.dp = getdata(m->oargs.sarg[1]);
242 <                i = (1 << nd.dp->nd) - 1;
243 <                mf = getfunc(m, 2, i<<3, 0);
243 <        } else if (m->otype == MAT_BRTDF) {
244 <                nd.dp = NULL;
245 <                mf = getfunc(m, 9, 0x3f, 0);
246 <        } else {
247 <                nd.dp = NULL;
248 <                mf = getfunc(m, 1, 0, 0);
237 >        if (r->rod < 0.0) {                     /* orient perturbed values */
238 >                nd.pdot = -nd.pdot;
239 >                for (i = 0; i < 3; i++) {
240 >                        nd.pnorm[i] = -nd.pnorm[i];
241 >                        r->pert[i] = -r->pert[i];
242 >                }
243 >                hitfront = 0;
244          }
245 <                                                /* set special variables */
246 <        setbrdfunc(&nd);
245 >        copycolor(nd.mcolor, r->pcol);          /* get pattern color */
246 >        multcolor(nd.rdiff, nd.mcolor);         /* modify diffuse values */
247 >        multcolor(nd.tdiff, nd.mcolor);
248 >        hasrefl = bright(nd.rdiff) > FTINY;
249 >        hastrans = bright(nd.tdiff) > FTINY;
250 >                                                /* load cal file */
251 >        nd.dp = NULL;
252 >        mf = getfunc(m, 9, 0x3f, 0);
253                                                  /* compute transmitted ray */
254 <        tspect = 0.;
255 <        if (m->otype == MAT_BRTDF && nd.tspec > FTINY) {
256 <                RAY  sr;
257 <                errno = 0;
258 <                setcolor(ctmp, evalue(mf->ep[3]),
259 <                                evalue(mf->ep[4]),
260 <                                evalue(mf->ep[5]));
261 <                scalecolor(ctmp, nd.trans);
262 <                if (errno)
263 <                        objerror(m, WARNING, "compute error");
264 <                else if ((tspect = bright(ctmp)) > FTINY &&
265 <                                rayorigin(&sr, r, TRANS, tspect) == 0) {
266 <                        if (!(r->crtype & SHADOW) &&
267 <                                        DOT(r->pert,r->pert) > FTINY*FTINY) {
268 <                                for (i = 0; i < 3; i++) /* perturb direction */
269 <                                        sr.rdir[i] = r->rdir[i] -
269 <                                                        .75*r->pert[i];
270 <                                if (normalize(sr.rdir) == 0.0) {
271 <                                        objerror(m, WARNING, "illegal perturbation");
272 <                                        VCOPY(sr.rdir, r->rdir);
273 <                                }
274 <                        } else {
254 >        setbrdfunc(&nd);
255 >        transtest = 0;
256 >        transdist = r->rot;
257 >        errno = 0;
258 >        setcolor(ctmp, evalue(mf->ep[3]),
259 >                        evalue(mf->ep[4]),
260 >                        evalue(mf->ep[5]));
261 >        if (errno == EDOM || errno == ERANGE)
262 >                objerror(m, WARNING, "compute error");
263 >        else if (rayorigin(&sr, r, TRANS, bright(ctmp)) == 0) {
264 >                if (!(r->crtype & SHADOW) &&
265 >                                DOT(r->pert,r->pert) > FTINY*FTINY) {
266 >                        for (i = 0; i < 3; i++) /* perturb direction */
267 >                                sr.rdir[i] = r->rdir[i] - .75*r->pert[i];
268 >                        if (normalize(sr.rdir) == 0.0) {
269 >                                objerror(m, WARNING, "illegal perturbation");
270                                  VCOPY(sr.rdir, r->rdir);
276                                transtest = 2;
271                          }
272 <                        rayvalue(&sr);
273 <                        multcolor(sr.rcol, ctmp);
274 <                        addcolor(r->rcol, sr.rcol);
281 <                        transtest *= bright(sr.rcol);
282 <                        transdist = r->rot + sr.rt;
272 >                } else {
273 >                        VCOPY(sr.rdir, r->rdir);
274 >                        transtest = 2;
275                  }
276 +                rayvalue(&sr);
277 +                multcolor(sr.rcol, ctmp);
278 +                addcolor(r->rcol, sr.rcol);
279 +                transtest *= bright(sr.rcol);
280 +                transdist = r->rot + sr.rt;
281          }
282          if (r->crtype & SHADOW)                 /* the rest is shadow */
283 <                return;
283 >                return(1);
284                                                  /* compute reflected ray */
285 <        rspecr = 0.;
286 <        if (m->otype == MAT_BRTDF && nd.rspec > FTINY) {
287 <                RAY  sr;
288 <                errno = 0;
289 <                setcolor(ctmp, evalue(mf->ep[0]),
290 <                                evalue(mf->ep[1]),
291 <                                evalue(mf->ep[2]));
292 <                if (errno)
293 <                        objerror(m, WARNING, "compute error");
294 <                else if ((rspecr = bright(ctmp)) > FTINY &&
295 <                                rayorigin(&sr, r, REFLECTED, rspecr) == 0) {
296 <                        for (i = 0; i < 3; i++)
297 <                                sr.rdir[i] = r->rdir[i] +
298 <                                                2.0*nd.pdot*nd.pnorm[i];
299 <                        rayvalue(&sr);
300 <                        multcolor(sr.rcol, ctmp);
301 <                        addcolor(r->rcol, sr.rcol);
285 >        setbrdfunc(&nd);
286 >        errno = 0;
287 >        setcolor(ctmp, evalue(mf->ep[0]),
288 >                        evalue(mf->ep[1]),
289 >                        evalue(mf->ep[2]));
290 >        if (errno == EDOM || errno == ERANGE)
291 >                objerror(m, WARNING, "compute error");
292 >        else if (rayorigin(&sr, r, REFLECTED, bright(ctmp)) == 0) {
293 >                for (i = 0; i < 3; i++)
294 >                        sr.rdir[i] = r->rdir[i] + 2.0*nd.pdot*nd.pnorm[i];
295 >                rayvalue(&sr);
296 >                multcolor(sr.rcol, ctmp);
297 >                addcolor(r->rcol, sr.rcol);
298 >        }
299 >                                                /* compute ambient */
300 >        if (hasrefl) {
301 >                if (!hitfront)
302 >                        flipsurface(r);
303 >                ambient(ctmp, r, nd.pnorm);
304 >                multcolor(ctmp, nd.rdiff);
305 >                addcolor(r->rcol, ctmp);        /* add to returned color */
306 >                if (!hitfront)
307 >                        flipsurface(r);
308 >        }
309 >        if (hastrans) {                         /* from other side */
310 >                if (hitfront)
311 >                        flipsurface(r);
312 >                vtmp[0] = -nd.pnorm[0];
313 >                vtmp[1] = -nd.pnorm[1];
314 >                vtmp[2] = -nd.pnorm[2];
315 >                ambient(ctmp, r, vtmp);
316 >                multcolor(ctmp, nd.tdiff);
317 >                addcolor(r->rcol, ctmp);
318 >                if (hitfront)
319 >                        flipsurface(r);
320 >        }
321 >        if (hasrefl | hastrans || m->oargs.sarg[6][0] != '0')
322 >                direct(r, dirbrdf, &nd);        /* add direct component */
323 >                                                /* check distance */
324 >        if (transtest > bright(r->rcol))
325 >                r->rt = transdist;
326 >
327 >        return(1);
328 > }
329 >
330 >
331 >
332 > extern int
333 > m_brdf2(                        /* color a ray that hit a BRDF material */
334 >        register OBJREC  *m,
335 >        register RAY  *r
336 > )
337 > {
338 >        BRDFDAT  nd;
339 >        COLOR  ctmp;
340 >        FVECT  vtmp;
341 >        double  dtmp;
342 >                                                /* always a shadow */
343 >        if (r->crtype & SHADOW)
344 >                return(1);
345 >                                                /* check arguments */
346 >        if ((m->oargs.nsargs < (hasdata(m->otype)?4:2)) | (m->oargs.nfargs <
347 >                        ((m->otype==MAT_TFUNC)|(m->otype==MAT_TDATA)?6:4)))
348 >                objerror(m, USER, "bad # arguments");
349 >                                                /* check for back side */
350 >        if (r->rod < 0.0) {
351 >                if (!backvis && m->otype != MAT_TFUNC
352 >                                && m->otype != MAT_TDATA) {
353 >                        raytrans(r);
354 >                        return(1);
355                  }
356 +                raytexture(r, m->omod);
357 +                flipsurface(r);                 /* reorient if backvis */
358 +        } else
359 +                raytexture(r, m->omod);
360 +
361 +        nd.mp = m;
362 +        nd.pr = r;
363 +                                                /* get material color */
364 +        setcolor(nd.mcolor, m->oargs.farg[0],
365 +                        m->oargs.farg[1],
366 +                        m->oargs.farg[2]);
367 +                                                /* get specular component */
368 +        nd.rspec = m->oargs.farg[3];
369 +                                                /* compute transmittance */
370 +        if ((m->otype == MAT_TFUNC) | (m->otype == MAT_TDATA)) {
371 +                nd.trans = m->oargs.farg[4]*(1.0 - nd.rspec);
372 +                nd.tspec = nd.trans * m->oargs.farg[5];
373 +                dtmp = nd.trans - nd.tspec;
374 +                setcolor(nd.tdiff, dtmp, dtmp, dtmp);
375 +        } else {
376 +                nd.tspec = nd.trans = 0.0;
377 +                setcolor(nd.tdiff, 0.0, 0.0, 0.0);
378          }
379 +                                                /* compute reflectance */
380 +        dtmp = 1.0 - nd.trans - nd.rspec;
381 +        setcolor(nd.rdiff, dtmp, dtmp, dtmp);
382 +        nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
383 +        multcolor(nd.mcolor, r->pcol);          /* modify material color */
384 +        multcolor(nd.rdiff, nd.mcolor);
385 +        multcolor(nd.tdiff, nd.mcolor);
386 +                                                /* load auxiliary files */
387 +        if (hasdata(m->otype)) {
388 +                nd.dp = getdata(m->oargs.sarg[1]);
389 +                getfunc(m, 2, 0, 0);
390 +        } else {
391 +                nd.dp = NULL;
392 +                getfunc(m, 1, 0, 0);
393 +        }
394                                                  /* compute ambient */
395 <        if ((dtmp = 1.0-nd.trans-rspecr) > FTINY) {
396 <                ambient(ctmp, r);
397 <                scalecolor(ctmp, dtmp);
395 >        if (nd.trans < 1.0-FTINY) {
396 >                ambient(ctmp, r, nd.pnorm);
397 >                scalecolor(ctmp, 1.0-nd.trans);
398                  multcolor(ctmp, nd.mcolor);     /* modified by material color */
399                  addcolor(r->rcol, ctmp);        /* add to returned color */
400          }
401 <        if ((dtmp = nd.trans-tspect) > FTINY) { /* from other side */
401 >        if (nd.trans > FTINY) {         /* from other side */
402                  flipsurface(r);
403 <                ambient(ctmp, r);
404 <                scalecolor(ctmp, dtmp);
403 >                vtmp[0] = -nd.pnorm[0];
404 >                vtmp[1] = -nd.pnorm[1];
405 >                vtmp[2] = -nd.pnorm[2];
406 >                ambient(ctmp, r, vtmp);
407 >                scalecolor(ctmp, nd.trans);
408                  multcolor(ctmp, nd.mcolor);
409                  addcolor(r->rcol, ctmp);
410                  flipsurface(r);
411          }
412                                                  /* add direct component */
413          direct(r, dirbrdf, &nd);
414 <                                                /* check distance */
415 <        if (transtest > bright(r->rcol))
326 <                r->rt = transdist;
414 >
415 >        return(1);
416   }
417  
418  
419 < setbrdfunc(np)                  /* set up brdf function and variables */
420 < register BRDFDAT  *np;
419 > static int
420 > setbrdfunc(                     /* set up brdf function and variables */
421 >        register BRDFDAT  *np
422 > )
423   {
424          FVECT  vec;
425  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines