14 |
|
#include "source.h" |
15 |
|
#include "func.h" |
16 |
|
#include "random.h" |
17 |
+ |
#include "pmapmat.h" |
18 |
|
|
19 |
|
#ifndef MAXITER |
20 |
|
#define MAXITER 10 /* maximum # specular ray attempts */ |
93 |
|
scalecolor(ctmp, dtmp); |
94 |
|
addcolor(cval, ctmp); |
95 |
|
|
96 |
< |
if (!(np->specfl & SPA_REFL)) |
96 |
> |
if (!(np->specfl & SPA_REFL) || ambRayInPmap(np->rp)) |
97 |
|
return; |
98 |
|
/* |
99 |
|
* Compute specular reflection coefficient |
217 |
|
if (normalize(np->v) == 0.0) { |
218 |
|
if (fabs(np->u_power - np->v_power) > 0.1) |
219 |
|
objerror(np->mp, WARNING, "bad orientation vector"); |
220 |
< |
getperpendicular(np->u, np->pnorm); /* punting */ |
220 |
> |
getperpendicular(np->u, np->pnorm, 1); /* punting */ |
221 |
|
fcross(np->v, np->pnorm, np->u); |
222 |
|
np->u_power = np->v_power = |
223 |
|
2./(1./(np->u_power+1e-5) + 1./(np->v_power+1e-5)); |