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.2 by greg, Sat Dec 9 09:40:42 1995 UTC vs.
Revision 2.6 by greg, Wed Apr 17 14:10:23 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
# Line 46 | Line 47 | static char SCCSid[] = "$SunId$ LBL";
47   #define RELAYDELIM      '>'             /* relay delimiter character */
48  
49   extern COLOR  cextinction;              /* global coefficient of extinction */
50 < extern double  salbedo;                 /* global scattering albedo */
50 > extern COLOR  salbedo;                  /* global scattering albedo */
51   extern double  seccg;                   /* global scattering eccentricity */
52  
53  
# Line 165 | Line 166 | register RAY  *r;
166                  p.slights[0] = 0;
167          if (r->rod > 0.) {                      /* entering ray */
168                  addcolor(p.cext, mext);
169 <                if (m->oargs.nfargs > 3)
170 <                        p.albedo = m->oargs.farg[3];
171 <                if (m->oargs.nfargs > 4)
172 <                        p.gecc = m->oargs.farg[4];
169 >                if (m->oargs.nfargs > 5)
170 >                        setcolor(p.albedo, m->oargs.farg[3],
171 >                                        m->oargs.farg[4], m->oargs.farg[5]);
172 >                if (m->oargs.nfargs > 6)
173 >                        p.gecc = m->oargs.farg[6];
174                  add2slist(&p, myslist);                 /* add to list */
175          } else {                                /* leaving ray */
176                  if (myslist != NULL) {                  /* delete from list */
# Line 180 | Line 182 | register RAY  *r;
182                                          p.slights[++i] = p.slights[j];
183                          if (p.slights[0] - i < myslist[0]) {    /* fix old */
184                                  addcolor(r->cext, mext);
185 <                                if (m->oargs.nfargs > 3)
186 <                                        r->albedo = m->oargs.farg[3];
187 <                                if (m->oargs.nfargs > 4)
188 <                                        r->gecc = m->oargs.farg[4];
185 >                                if (m->oargs.nfargs > 5)
186 >                                        setcolor(r->albedo, m->oargs.farg[3],
187 >                                        m->oargs.farg[4], m->oargs.farg[5]);
188 >                                if (m->oargs.nfargs > 6)
189 >                                        r->gecc = m->oargs.farg[6];
190                                  add2slist(r, myslist);
191                          }
192                          p.slights[0] = i;
193                  }
194 <                re = colval(r->cext,RED) - colval(mext,RED);
195 <                ge = colval(r->cext,GRN) - colval(mext,GRN);
196 <                be = colval(r->cext,BLU) - colval(mext,BLU);
197 <                setcolor(p.cext, re<0. ? 0. : re,
198 <                                ge<0. ? 0. : ge,
199 <                                be<0. ? 0. : be);
200 <                if (m->oargs.nfargs > 3)
201 <                        p.albedo = salbedo;
202 <                if (m->oargs.nfargs > 4)
194 >                if ((re = colval(r->cext,RED) - colval(mext,RED)) <
195 >                                colval(cextinction,RED))
196 >                        re = colval(cextinction,RED);
197 >                if ((ge = colval(r->cext,GRN) - colval(mext,GRN)) <
198 >                                colval(cextinction,GRN))
199 >                        ge = colval(cextinction,GRN);
200 >                if ((be = colval(r->cext,BLU) - colval(mext,BLU)) <
201 >                                colval(cextinction,BLU))
202 >                        be = colval(cextinction,BLU);
203 >                setcolor(p.cext, re, ge, be);
204 >                if (m->oargs.nfargs > 5)
205 >                        copycolor(p.albedo, salbedo);
206 >                if (m->oargs.nfargs > 6)
207                          p.gecc = seccg;
208          }
209          rayvalue(&p);                           /* calls rayparticipate() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines