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.15 by greg, Sat Feb 22 02:07:28 2003 UTC vs.
Revision 2.18 by greg, Wed Mar 5 16:16:53 2003 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   *  Shading for materials with arbitrary BRDF's
6   */
7  
8 < /* ====================================================================
9 < * The Radiance Software License, Version 1.0
10 < *
11 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
12 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
13 < *
14 < * Redistribution and use in source and binary forms, with or without
15 < * modification, are permitted provided that the following conditions
16 < * are met:
17 < *
18 < * 1. Redistributions of source code must retain the above copyright
19 < *         notice, this list of conditions and the following disclaimer.
20 < *
21 < * 2. Redistributions in binary form must reproduce the above copyright
22 < *       notice, this list of conditions and the following disclaimer in
23 < *       the documentation and/or other materials provided with the
24 < *       distribution.
25 < *
26 < * 3. The end-user documentation included with the redistribution,
27 < *           if any, must include the following acknowledgment:
28 < *             "This product includes Radiance software
29 < *                 (http://radsite.lbl.gov/)
30 < *                 developed by the Lawrence Berkeley National Laboratory
31 < *               (http://www.lbl.gov/)."
32 < *       Alternately, this acknowledgment may appear in the software itself,
33 < *       if and wherever such third-party acknowledgments normally appear.
34 < *
35 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
36 < *       and "The Regents of the University of California" must
37 < *       not be used to endorse or promote products derived from this
38 < *       software without prior written permission. For written
39 < *       permission, please contact [email protected].
40 < *
41 < * 5. Products derived from this software may not be called "Radiance",
42 < *       nor may "Radiance" appear in their name, without prior written
43 < *       permission of Lawrence Berkeley National Laboratory.
44 < *
45 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
49 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 < * SUCH DAMAGE.
57 < * ====================================================================
58 < *
59 < * This software consists of voluntary contributions made by many
60 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
61 < * information on Lawrence Berkeley National Laboratory, please see
62 < * <http://www.lbl.gov/>.
63 < */
8 > #include "copyright.h"
9  
10   #include  "ray.h"
11  
# Line 215 | Line 160 | double  omega;                 /* light source size */
160                  dtmp = funvalue(sa[0], 5, vldx);
161                  setcolor(ctmp, dtmp, dtmp, dtmp);
162          }
163 <        if (errno) {
163 >        if (errno == EDOM || errno == ERANGE) {
164                  objerror(np->mp, WARNING, "compute error");
165                  return;
166          }
# Line 279 | Line 224 | register RAY  *r;
224          setcolor(nd.tdiff, m->oargs.farg[6],
225                          m->oargs.farg[7],
226                          m->oargs.farg[8]);
227 <                                        /* get modifiers */
227 >                                                /* get modifiers */
228          raytexture(r, m->omod);
229          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
230          if (r->rod < 0.0) {                     /* orient perturbed values */
# Line 306 | Line 251 | register RAY  *r;
251          setcolor(ctmp, evalue(mf->ep[3]),
252                          evalue(mf->ep[4]),
253                          evalue(mf->ep[5]));
254 <        if (errno)
254 >        if (errno == EDOM || errno == ERANGE)
255                  objerror(m, WARNING, "compute error");
256          else if (rayorigin(&sr, r, TRANS, bright(ctmp)) == 0) {
257                  if (!(r->crtype & SHADOW) &&
# Line 335 | Line 280 | register RAY  *r;
280          setcolor(ctmp, evalue(mf->ep[0]),
281                          evalue(mf->ep[1]),
282                          evalue(mf->ep[2]));
283 <        if (errno)
283 >        if (errno == EDOM || errno == ERANGE)
284                  objerror(m, WARNING, "compute error");
285          else if (rayorigin(&sr, r, REFLECTED, bright(ctmp)) == 0) {
286                  for (i = 0; i < 3; i++)
# Line 393 | Line 338 | register RAY  *r;
338          if (m->oargs.nsargs < (hasdata(m->otype)?4:2) | m->oargs.nfargs <
339                          (m->otype==MAT_TFUNC|m->otype==MAT_TDATA?6:4))
340                  objerror(m, USER, "bad # arguments");
341 +                                                /* check for back side */
342 +        if (r->rod < 0.0) {
343 +                if (!backvis && m->otype != MAT_TFUNC
344 +                                && m->otype != MAT_TDATA) {
345 +                        raytrans(r);
346 +                        return(1);
347 +                }
348 +                raytexture(r, m->omod);
349 +                flipsurface(r);                 /* reorient if backvis */
350 +        } else
351 +                raytexture(r, m->omod);
352 +
353          nd.mp = m;
354          nd.pr = r;
355                                                  /* get material color */
# Line 414 | Line 371 | register RAY  *r;
371                                                  /* compute reflectance */
372          dtmp = 1.0 - nd.trans - nd.rspec;
373          setcolor(nd.rdiff, dtmp, dtmp, dtmp);
417                                                /* check for back side */
418        if (r->rod < 0.0) {
419                if (!backvis && m->otype != MAT_TFUNC
420                                && m->otype != MAT_TDATA) {
421                        raytrans(r);
422                        return(1);
423                }
424                flipsurface(r);                 /* reorient if backvis */
425        }
426                                                /* get modifiers */
427        raytexture(r, m->omod);
374          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
375          multcolor(nd.mcolor, r->pcol);          /* modify material color */
376          multcolor(nd.rdiff, nd.mcolor);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines