14 |
|
#include "copyright.h" |
15 |
|
|
16 |
|
#include "ray.h" |
17 |
< |
|
17 |
> |
#include "ambient.h" |
18 |
> |
#include "source.h" |
19 |
|
#include "otypes.h" |
20 |
< |
|
20 |
> |
#include "rtotypes.h" |
21 |
|
#include "random.h" |
22 |
|
|
23 |
|
#ifndef MAXITER |
26 |
|
/* estimate of Fresnel function */ |
27 |
|
#define FRESNE(ci) (exp(-5.85*(ci)) - 0.00287989916) |
28 |
|
|
28 |
– |
static void gaussamp(); |
29 |
|
|
30 |
|
/* |
31 |
|
* This routine implements the isotropic Gaussian |
64 |
|
double pdot; /* perturbed dot product */ |
65 |
|
} NORMDAT; /* normal material data */ |
66 |
|
|
67 |
+ |
static srcdirf_t dirnorm; |
68 |
+ |
static void gaussamp(RAY *r, NORMDAT *np); |
69 |
|
|
70 |
+ |
|
71 |
|
static void |
72 |
< |
dirnorm(cval, np, ldir, omega) /* compute source contribution */ |
73 |
< |
COLOR cval; /* returned coefficient */ |
74 |
< |
register NORMDAT *np; /* material data */ |
75 |
< |
FVECT ldir; /* light source direction */ |
76 |
< |
double omega; /* light source size */ |
72 |
> |
dirnorm( /* compute source contribution */ |
73 |
> |
COLOR cval, /* returned coefficient */ |
74 |
> |
void *nnp, /* material data */ |
75 |
> |
FVECT ldir, /* light source direction */ |
76 |
> |
double omega /* light source size */ |
77 |
> |
) |
78 |
|
{ |
79 |
+ |
register NORMDAT *np = nnp; |
80 |
|
double ldot; |
81 |
|
double ldiff; |
82 |
|
double dtmp, d2; |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
< |
int |
166 |
< |
m_normal(m, r) /* color a ray that hit something normal */ |
167 |
< |
register OBJREC *m; |
168 |
< |
register RAY *r; |
165 |
> |
extern int |
166 |
> |
m_normal( /* color a ray that hit something normal */ |
167 |
> |
register OBJREC *m, |
168 |
> |
register RAY *r |
169 |
> |
) |
170 |
|
{ |
171 |
|
NORMDAT nd; |
172 |
|
double fest; |
357 |
|
|
358 |
|
|
359 |
|
static void |
360 |
< |
gaussamp(r, np) /* sample gaussian specular */ |
361 |
< |
RAY *r; |
362 |
< |
register NORMDAT *np; |
360 |
> |
gaussamp( /* sample gaussian specular */ |
361 |
> |
RAY *r, |
362 |
> |
register NORMDAT *np |
363 |
> |
) |
364 |
|
{ |
365 |
|
RAY sr; |
366 |
|
FVECT u, v, h; |