1 |
– |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Mist volumetric material. |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
|
#include "ray.h" |
11 |
|
|
12 |
|
#include "source.h" |
49 |
|
|
50 |
|
#define RELAYDELIM '>' /* relay delimiter character */ |
51 |
|
|
53 |
– |
extern COLOR cextinction; /* global coefficient of extinction */ |
54 |
– |
extern COLOR salbedo; /* global scattering albedo */ |
55 |
– |
extern double seccg; /* global scattering eccentricity */ |
52 |
|
|
57 |
– |
|
53 |
|
static int |
54 |
|
inslist(sl, n) /* return index of source n if it's in list sl */ |
55 |
|
register int *sl; |
69 |
|
register SRCREC *sp; |
70 |
|
register char *id; |
71 |
|
{ |
77 |
– |
extern char *index(); |
72 |
|
register char *cp; |
73 |
|
/* check for relay sources */ |
74 |
|
while ((cp = index(id, RELAYDELIM)) != NULL) { |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
< |
static |
88 |
> |
static void |
89 |
|
add2slist(r, sl) /* add source list to ray's */ |
90 |
|
register RAY *r; |
91 |
|
register int *sl; |
100 |
|
for (i = sl[0]; i > 0; i--) |
101 |
|
if (!inslist(r->slights, sl[i])) { |
102 |
|
if (r->slights[0] >= MAXSLIST) |
103 |
< |
error(USER, "scattering source list overflow"); |
103 |
> |
error(INTERNAL, |
104 |
> |
"scattering source list overflow"); |
105 |
|
r->slights[++r->slights[0]] = sl[i]; |
106 |
|
} |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
+ |
int |
111 |
|
m_mist(m, r) /* process a ray entering or leaving some mist */ |
112 |
|
OBJREC *m; |
113 |
|
register RAY *r; |
124 |
|
/* get source indices */ |
125 |
|
if (m->oargs.nsargs > 0 && (myslist = (int *)m->os) == NULL) { |
126 |
|
if (m->oargs.nsargs > MAXSLIST) |
127 |
< |
objerror(m, USER, "too many sources in list"); |
127 |
> |
objerror(m, INTERNAL, "too many sources in list"); |
128 |
|
myslist = (int *)malloc((m->oargs.nsargs+1)*sizeof(int)); |
129 |
|
if (myslist == NULL) |
130 |
|
goto memerr; |