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.5 by greg, Thu Mar 21 10:24:59 1996 UTC vs.
Revision 2.9 by gregl, Wed May 28 14:38:32 1997 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), which is added to the global extinction coefficient, set
# Line 44 | Line 44 | static char SCCSid[] = "$SunId$ LBL";
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 102 | Line 106 | register int  *sl;
106          for (i = sl[0]; i > 0; i--)
107                  if (!inslist(r->slights, sl[i])) {
108                          if (r->slights[0] >= MAXSLIST)
109 <                                error(USER, "scattering source list overflow");
109 >                                error(INTERNAL,
110 >                                        "scattering source list overflow");
111                          r->slights[++r->slights[0]] = sl[i];
112                  }
113   }
# Line 119 | Line 124 | register RAY  *r;
124          double  re, ge, be;
125          register int  i, j;
126                                          /* check arguments */
127 <        if (m->oargs.nfargs > 5)
127 >        if (m->oargs.nfargs > 7)
128                  objerror(m, USER, "bad arguments");
129                                          /* get source indices */
130          if (m->oargs.nsargs > 0 && (myslist = (int *)m->os) == NULL) {
131                  if (m->oargs.nsargs > MAXSLIST)
132 <                        objerror(m, USER, "too many sources in list");
132 >                        objerror(m, INTERNAL, "too many sources in list");
133                  myslist = (int *)malloc((m->oargs.nsargs+1)*sizeof(int));
134                  if (myslist == NULL)
135                          goto memerr;
# Line 166 | Line 171 | register RAY  *r;
171                  p.slights[0] = 0;
172          if (r->rod > 0.) {                      /* entering ray */
173                  addcolor(p.cext, mext);
174 <                if (m->oargs.nfargs > 3)
175 <                        p.albedo = m->oargs.farg[3];
176 <                if (m->oargs.nfargs > 4)
177 <                        p.gecc = m->oargs.farg[4];
174 >                if (m->oargs.nfargs > 5)
175 >                        setcolor(p.albedo, m->oargs.farg[3],
176 >                                        m->oargs.farg[4], m->oargs.farg[5]);
177 >                if (m->oargs.nfargs > 6)
178 >                        p.gecc = m->oargs.farg[6];
179                  add2slist(&p, myslist);                 /* add to list */
180          } else {                                /* leaving ray */
181                  if (myslist != NULL) {                  /* delete from list */
# Line 181 | Line 187 | register RAY  *r;
187                                          p.slights[++i] = p.slights[j];
188                          if (p.slights[0] - i < myslist[0]) {    /* fix old */
189                                  addcolor(r->cext, mext);
190 <                                if (m->oargs.nfargs > 3)
191 <                                        r->albedo = m->oargs.farg[3];
192 <                                if (m->oargs.nfargs > 4)
193 <                                        r->gecc = m->oargs.farg[4];
190 >                                if (m->oargs.nfargs > 5)
191 >                                        setcolor(r->albedo, m->oargs.farg[3],
192 >                                        m->oargs.farg[4], m->oargs.farg[5]);
193 >                                if (m->oargs.nfargs > 6)
194 >                                        r->gecc = m->oargs.farg[6];
195                                  add2slist(r, myslist);
196                          }
197                          p.slights[0] = i;
# Line 199 | Line 206 | register RAY  *r;
206                                  colval(cextinction,BLU))
207                          be = colval(cextinction,BLU);
208                  setcolor(p.cext, re, ge, be);
209 <                if (m->oargs.nfargs > 3)
210 <                        p.albedo = salbedo;
211 <                if (m->oargs.nfargs > 4)
209 >                if (m->oargs.nfargs > 5)
210 >                        copycolor(p.albedo, salbedo);
211 >                if (m->oargs.nfargs > 6)
212                          p.gecc = seccg;
213          }
214          rayvalue(&p);                           /* calls rayparticipate() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines