19 |
|
extern double specthresh; /* specular sampling threshold */ |
20 |
|
extern double specjitter; /* specular sampling jitter */ |
21 |
|
|
22 |
+ |
extern int backvis; /* back faces visible? */ |
23 |
+ |
|
24 |
|
static agaussamp(), getacoords(); |
25 |
|
|
26 |
|
/* |
203 |
|
nd.v_alpha = m->oargs.farg[5]; |
204 |
|
if (nd.u_alpha < FTINY || nd.v_alpha <= FTINY) |
205 |
|
objerror(m, USER, "roughness too small"); |
206 |
< |
/* reorient if necessary */ |
207 |
< |
if (r->rod < 0.0) |
208 |
< |
flipsurface(r); |
206 |
> |
/* check for back side */ |
207 |
> |
if (r->rod < 0.0) { |
208 |
> |
if (!backvis && m->otype != MAT_TRANS2) { |
209 |
> |
raytrans(r); |
210 |
> |
return(1); |
211 |
> |
} |
212 |
> |
flipsurface(r); /* reorient if backvis */ |
213 |
> |
} |
214 |
|
/* get modifiers */ |
215 |
|
raytexture(r, m->omod); |
216 |
|
nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ |
263 |
|
/* diffuse reflection */ |
264 |
|
nd.rdiff = 1.0 - nd.trans - nd.rspec; |
265 |
|
|
266 |
< |
if (r->ro != NULL && (r->ro->otype == OBJ_FACE || |
260 |
< |
r->ro->otype == OBJ_RING)) |
266 |
> |
if (r->ro != NULL && isflat(r->ro->otype)) |
267 |
|
nd.specfl |= SP_FLAT; |
268 |
|
|
269 |
|
getacoords(r, &nd); /* set up coordinates */ |