11 |
|
#include "otypes.h" |
12 |
|
#include "rtotypes.h" |
13 |
|
#include "source.h" |
14 |
+ |
#include "pmapmat.h" |
15 |
|
|
16 |
|
/* |
17 |
|
* The real arguments for MAT_MIRROR are simply: |
30 |
|
VSMATERIAL mirror_vs = {mir_proj, 1}; |
31 |
|
|
32 |
|
|
33 |
< |
extern int |
33 |
> |
int |
34 |
|
m_mirror( /* shade mirrored ray */ |
35 |
< |
register OBJREC *m, |
36 |
< |
register RAY *r |
35 |
> |
OBJREC *m, |
36 |
> |
RAY *r |
37 |
|
) |
38 |
|
{ |
39 |
|
COLOR mcolor; |
40 |
|
RAY nr; |
41 |
|
int rpure = 1; |
42 |
< |
register int i; |
42 |
> |
int i; |
43 |
> |
|
44 |
> |
/* PMAP: skip specular refl via ambient bounce if already accounted for |
45 |
> |
* in photon map */ |
46 |
> |
if (ambRayInPmap(r)) |
47 |
> |
return(1); |
48 |
|
/* check arguments */ |
49 |
|
if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) |
50 |
|
objerror(m, USER, "bad number of arguments"); |
88 |
|
|
89 |
|
if (rayorigin(&nr, REFLECTED, r, mcolor) < 0) |
90 |
|
return(1); |
91 |
< |
if (DOT(r->pert,r->pert) > FTINY*FTINY) { |
91 |
> |
if (!(r->crtype & AMBIENT) && |
92 |
> |
DOT(r->pert,r->pert) > FTINY*FTINY) { |
93 |
|
pdot = raynormal(pnorm, r); /* use textures */ |
94 |
|
for (i = 0; i < 3; i++) |
95 |
|
nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i]; |
113 |
|
static int |
114 |
|
mir_proj( /* compute a mirror's projection */ |
115 |
|
MAT4 pm, |
116 |
< |
register OBJREC *o, |
116 |
> |
OBJREC *o, |
117 |
|
SRCREC *s, |
118 |
|
int n |
119 |
|
) |
149 |
|
|
150 |
|
static void |
151 |
|
mirrorproj( /* get mirror projection for surface */ |
152 |
< |
register MAT4 m, |
152 |
> |
MAT4 m, |
153 |
|
FVECT nv, |
154 |
|
double offs |
155 |
|
) |
156 |
|
{ |
157 |
< |
register int i, j; |
157 |
> |
int i, j; |
158 |
|
/* assign matrix */ |
159 |
|
setident4(m); |
160 |
|
for (j = 0; j < 3; j++) { |