| 4 |
|
|
| 5 |
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
| 6 |
|
(c) Fraunhofer Institute for Solar Energy Systems, |
| 7 |
< |
Lucerne University of Applied Sciences & Arts |
| 7 |
> |
(c) Lucerne University of Applied Sciences and Arts, |
| 8 |
> |
supported by the Swiss National Science Foundation (SNSF, #147053) |
| 9 |
|
================================================================== |
| 10 |
|
|
| 11 |
|
$Id$ |
| 199 |
|
int niter, i = 0; |
| 200 |
|
|
| 201 |
|
/* Set up sample coordinates */ |
| 202 |
< |
do { |
| 202 |
< |
v [0] = v [1] = v [2] = 0; |
| 203 |
< |
v [i++] = 1; |
| 204 |
< |
fcross(u, v, nd -> pnorm); |
| 205 |
< |
} while (normalize(u) < FTINY); |
| 206 |
< |
|
| 202 |
> |
getperpendicular(u, nd -> pnorm); |
| 203 |
|
fcross(v, nd -> pnorm, u); |
| 204 |
|
|
| 205 |
|
if (nd -> specfl & SP_REFL) { |
| 263 |
|
int i = 0; |
| 264 |
|
|
| 265 |
|
/* Set up sample coordinates */ |
| 266 |
< |
do { |
| 271 |
< |
v [0] = v [1] = v [2] = 0; |
| 272 |
< |
v [i++] = 1; |
| 273 |
< |
fcross(u, v, normal); |
| 274 |
< |
} while (normalize(u) < FTINY); |
| 275 |
< |
|
| 266 |
> |
getperpendicular(u, normal); |
| 267 |
|
fcross(v, normal, u); |
| 268 |
|
|
| 269 |
|
/* Convert theta & phi to cartesian */ |
| 314 |
|
nd.specfl |= SP_FLAT; |
| 315 |
|
|
| 316 |
|
/* Perturb normal */ |
| 317 |
< |
if ((hastexture = DOT(rayIn -> pert, rayIn -> pert)) > sqr(FTINY)) |
| 317 |
> |
if ((hastexture = (DOT(rayIn -> pert, rayIn -> pert) > sqr(FTINY)) )) |
| 318 |
|
nd.pdot = raynormal(nd.pnorm, rayIn); |
| 319 |
|
else { |
| 320 |
|
VCOPY(nd.pnorm, rayIn -> ron); |
| 743 |
|
/* get modifiers */ |
| 744 |
|
raytexture(rayIn, mat -> omod); |
| 745 |
|
|
| 746 |
< |
if ((hastexture = DOT(rayIn -> pert, rayIn -> pert)) > FTINY * FTINY) |
| 746 |
> |
if ((hastexture = (DOT(rayIn -> pert, rayIn -> pert) > FTINY * FTINY))) |
| 747 |
|
/* Perturb normal */ |
| 748 |
|
cos1 = raynormal(dnorm, rayIn); |
| 749 |
|
else { |
| 890 |
|
/* reorient if necessary */ |
| 891 |
|
if (rayIn -> rod < 0) |
| 892 |
|
flipsurface(rayIn); |
| 893 |
< |
if ((hastexture = DOT(rayIn -> pert, rayIn -> pert)) > FTINY * FTINY) |
| 893 |
> |
if ((hastexture = (DOT(rayIn -> pert, rayIn -> pert) > FTINY * FTINY) )) |
| 894 |
|
pdot = raynormal(pnorm, rayIn); |
| 895 |
|
else { |
| 896 |
|
VCOPY(pnorm, rayIn -> ron); |
| 1649 |
|
return 0; |
| 1650 |
|
} |
| 1651 |
|
#else |
| 1652 |
+ |
|
| 1653 |
+ |
/* |
| 1654 |
+ |
The following code is |
| 1655 |
+ |
(c) Lucerne University of Applied Sciences and Arts, |
| 1656 |
+ |
supported by the Swiss National Science Foundation (SNSF, #147053) |
| 1657 |
+ |
*/ |
| 1658 |
|
|
| 1659 |
|
static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) |
| 1660 |
|
/* Generate new photon ray for BSDF modifier and recurse. */ |