10 |
|
#include "ray.h" |
11 |
|
#include "otypes.h" |
12 |
|
#include "rtotypes.h" |
13 |
+ |
#include "pmapmat.h" |
14 |
|
|
15 |
|
#ifdef DISPERSE |
16 |
|
#include "source.h" |
51 |
|
|
52 |
|
#define MINCOS 0.997 /* minimum dot product for dispersion */ |
53 |
|
|
53 |
– |
|
54 |
|
static double |
55 |
|
mylog( /* special log for extinction coefficients */ |
56 |
|
double x |
64 |
|
} |
65 |
|
|
66 |
|
|
67 |
< |
extern int |
67 |
> |
int |
68 |
|
m_dielectric( /* color a ray which hit a dielectric interface */ |
69 |
|
OBJREC *m, |
70 |
< |
register RAY *r |
70 |
> |
RAY *r |
71 |
|
) |
72 |
|
{ |
73 |
|
double cos1, cos2, nratio; |
74 |
|
COLOR ctrans; |
75 |
|
COLOR talb; |
76 |
|
int hastexture; |
77 |
< |
double transdist, transtest=0; |
78 |
< |
double mirdist, mirtest=0; |
77 |
> |
double transdist=0, transtest=0; |
78 |
> |
double mirdist=0, mirtest=0; |
79 |
|
int flatsurface; |
80 |
|
double refl, trans; |
81 |
|
FVECT dnorm; |
82 |
|
double d1, d2; |
83 |
|
RAY p; |
84 |
< |
register int i; |
84 |
> |
int i; |
85 |
|
|
86 |
+ |
/* PMAP: skip refracted shadow or ambient ray if accounted for in |
87 |
+ |
photon map */ |
88 |
+ |
if (shadowRayInPmap(r) || ambRayInPmap(r)) |
89 |
+ |
return(1); |
90 |
+ |
|
91 |
|
if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8)) |
92 |
|
objerror(m, USER, "bad arguments"); |
93 |
|
|
99 |
|
VCOPY(dnorm, r->ron); |
100 |
|
cos1 = r->rod; |
101 |
|
} |
102 |
< |
flatsurface = !hastexture && r->ro != NULL && isflat(r->ro->otype); |
102 |
> |
flatsurface = r->ro != NULL && isflat(r->ro->otype) && |
103 |
> |
!hastexture | (r->crtype & AMBIENT); |
104 |
|
|
105 |
|
/* index of refraction */ |
106 |
|
if (m->otype == MAT_DIELECTRIC) |
205 |
|
addcolor(r->rcol, p.rcol); |
206 |
|
/* virtual distance */ |
207 |
|
if (flatsurface || |
208 |
< |
(1.-FTINY <= nratio && |
209 |
< |
nratio <= 1.+FTINY)) { |
208 |
> |
(1.-FTINY <= nratio) & |
209 |
> |
(nratio <= 1.+FTINY)) { |
210 |
|
transtest = 2*bright(p.rcol); |
211 |
|
transdist = r->rot + p.rt; |
212 |
|
} |
386 |
|
|
387 |
|
static int |
388 |
|
lambda( /* compute lambda for material */ |
389 |
< |
register OBJREC *m, |
389 |
> |
OBJREC *m, |
390 |
|
FVECT v2, |
391 |
|
FVECT dv, |
392 |
|
FVECT lr |