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

Comparing ray/src/rt/m_mist.c (file contents):
Revision 2.4 by greg, Sun Dec 17 11:51:47 1995 UTC vs.
Revision 2.7 by greg, Wed Jun 5 11:27:33 1996 UTC

# Line 33 | Line 33 | static char SCCSid[] = "$SunId$ LBL";
33   *
34   *  Up to five real arguments may be given for MAT_MIST:
35   *
36 < *      [ext_r  ext_g  ext_b  [albedo [gecc]]]
36 > *      [ext_r  ext_g  ext_b  [albedo_r albedo_g albedo_b [gecc]]]
37   *
38   *  The primaries indicate medium extinction per unit length (absorption
39 < *  plus scattering).  The albedo is the ratio of scattering to extinction,
39 > *  plus scattering), which is added to the global extinction coefficient, set
40 > *  by the -me option.  The albedo is the ratio of scattering to extinction,
41   *  and is set globally by the -ma option (salbedo) and overridden here.
42   *  The Heyney-Greenstein eccentricity parameter (-mg seccg) indicates how much
43   *  scattering favors the forward direction.  A value of 0 means isotropic
44   *  scattering.  A value approaching 1 indicates strong forward scattering.
45   */
46  
47 + #ifndef  MAXSLIST
48 + #define  MAXSLIST       32      /* maximum sources to check */
49 + #endif
50 +
51   #define RELAYDELIM      '>'             /* relay delimiter character */
52  
53   extern COLOR  cextinction;              /* global coefficient of extinction */
54 < extern double  salbedo;                 /* global scattering albedo */
54 > extern COLOR  salbedo;                  /* global scattering albedo */
55   extern double  seccg;                   /* global scattering eccentricity */
56  
57  
# Line 165 | Line 170 | register RAY  *r;
170                  p.slights[0] = 0;
171          if (r->rod > 0.) {                      /* entering ray */
172                  addcolor(p.cext, mext);
173 <                if (m->oargs.nfargs > 3)
174 <                        p.albedo = m->oargs.farg[3];
175 <                if (m->oargs.nfargs > 4)
176 <                        p.gecc = m->oargs.farg[4];
173 >                if (m->oargs.nfargs > 5)
174 >                        setcolor(p.albedo, m->oargs.farg[3],
175 >                                        m->oargs.farg[4], m->oargs.farg[5]);
176 >                if (m->oargs.nfargs > 6)
177 >                        p.gecc = m->oargs.farg[6];
178                  add2slist(&p, myslist);                 /* add to list */
179          } else {                                /* leaving ray */
180                  if (myslist != NULL) {                  /* delete from list */
# Line 180 | Line 186 | register RAY  *r;
186                                          p.slights[++i] = p.slights[j];
187                          if (p.slights[0] - i < myslist[0]) {    /* fix old */
188                                  addcolor(r->cext, mext);
189 <                                if (m->oargs.nfargs > 3)
190 <                                        r->albedo = m->oargs.farg[3];
191 <                                if (m->oargs.nfargs > 4)
192 <                                        r->gecc = m->oargs.farg[4];
189 >                                if (m->oargs.nfargs > 5)
190 >                                        setcolor(r->albedo, m->oargs.farg[3],
191 >                                        m->oargs.farg[4], m->oargs.farg[5]);
192 >                                if (m->oargs.nfargs > 6)
193 >                                        r->gecc = m->oargs.farg[6];
194                                  add2slist(r, myslist);
195                          }
196                          p.slights[0] = i;
197                  }
198 <                re = colval(r->cext,RED) - colval(mext,RED);
199 <                ge = colval(r->cext,GRN) - colval(mext,GRN);
200 <                be = colval(r->cext,BLU) - colval(mext,BLU);
201 <                setcolor(p.cext, re<0. ? 0. : re,
202 <                                ge<0. ? 0. : ge,
203 <                                be<0. ? 0. : be);
204 <                if (m->oargs.nfargs > 3)
205 <                        p.albedo = salbedo;
206 <                if (m->oargs.nfargs > 4)
198 >                if ((re = colval(r->cext,RED) - colval(mext,RED)) <
199 >                                colval(cextinction,RED))
200 >                        re = colval(cextinction,RED);
201 >                if ((ge = colval(r->cext,GRN) - colval(mext,GRN)) <
202 >                                colval(cextinction,GRN))
203 >                        ge = colval(cextinction,GRN);
204 >                if ((be = colval(r->cext,BLU) - colval(mext,BLU)) <
205 >                                colval(cextinction,BLU))
206 >                        be = colval(cextinction,BLU);
207 >                setcolor(p.cext, re, ge, be);
208 >                if (m->oargs.nfargs > 5)
209 >                        copycolor(p.albedo, salbedo);
210 >                if (m->oargs.nfargs > 6)
211                          p.gecc = seccg;
212          }
213          rayvalue(&p);                           /* calls rayparticipate() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines