--- ray/src/rt/m_mist.c 1996/04/17 14:10:23 2.6 +++ ray/src/rt/m_mist.c 2003/03/10 17:26:26 2.12 @@ -1,13 +1,12 @@ -/* Copyright (c) 1995 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id"; #endif - /* * Mist volumetric material. */ +#include "copyright.h" + #include "ray.h" #include "source.h" @@ -44,13 +43,13 @@ static char SCCSid[] = "$SunId$ LBL"; * scattering. A value approaching 1 indicates strong forward scattering. */ +#ifndef MAXSLIST +#define MAXSLIST 32 /* maximum sources to check */ +#endif + #define RELAYDELIM '>' /* relay delimiter character */ -extern COLOR cextinction; /* global coefficient of extinction */ -extern COLOR salbedo; /* global scattering albedo */ -extern double seccg; /* global scattering eccentricity */ - static int inslist(sl, n) /* return index of source n if it's in list sl */ register int *sl; @@ -70,7 +69,6 @@ srcmatch(sp, id) /* check for an id match on a light s register SRCREC *sp; register char *id; { - extern char *index(); register char *cp; /* check for relay sources */ while ((cp = index(id, RELAYDELIM)) != NULL) { @@ -87,7 +85,7 @@ register char *id; } -static +static void add2slist(r, sl) /* add source list to ray's */ register RAY *r; register int *sl; @@ -102,12 +100,14 @@ register int *sl; for (i = sl[0]; i > 0; i--) if (!inslist(r->slights, sl[i])) { if (r->slights[0] >= MAXSLIST) - error(USER, "scattering source list overflow"); + error(INTERNAL, + "scattering source list overflow"); r->slights[++r->slights[0]] = sl[i]; } } +int m_mist(m, r) /* process a ray entering or leaving some mist */ OBJREC *m; register RAY *r; @@ -119,12 +119,12 @@ register RAY *r; double re, ge, be; register int i, j; /* check arguments */ - if (m->oargs.nfargs > 5) + if (m->oargs.nfargs > 7) objerror(m, USER, "bad arguments"); /* get source indices */ if (m->oargs.nsargs > 0 && (myslist = (int *)m->os) == NULL) { if (m->oargs.nsargs > MAXSLIST) - objerror(m, USER, "too many sources in list"); + objerror(m, INTERNAL, "too many sources in list"); myslist = (int *)malloc((m->oargs.nsargs+1)*sizeof(int)); if (myslist == NULL) goto memerr;