! Evaluates the power cosine distribution. \param wh is the half * vector */
| 425 | /*! Evaluates the power cosine distribution. \param wh is the half |
| 426 | * vector */ |
| 427 | inline float AnisotropicBlinn__eval(const AnisotropicBlinn* This, const Vec3fa& wh) |
| 428 | { |
| 429 | const float cosPhiH = dot(wh, This->dx); |
| 430 | const float sinPhiH = dot(wh, This->dy); |
| 431 | const float cosThetaH = dot(wh, This->dz); |
| 432 | const float R = sqr(cosPhiH)+sqr(sinPhiH); |
| 433 | if (R == 0.0f) return This->norm2; |
| 434 | const float n = (This->nx*sqr(cosPhiH)+This->ny*sqr(sinPhiH))*rcp(R); |
| 435 | return This->norm2 * powf(abs(cosThetaH), n); |
| 436 | } |
| 437 | |
| 438 | /*! Samples the distribution. \param s is the sample location |
| 439 | * provided by the caller. */ |