00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LUX_ANISOTROPIC_H
00024 #define LUX_ANISOTROPIC_H
00025
00026 #include "lux.h"
00027 #include "bxdf.h"
00028 #include "geometry.h"
00029 #include "microfacetdistribution.h"
00030
00031 namespace lux
00032 {
00033
00034 class Anisotropic : public MicrofacetDistribution {
00035 public:
00036
00037 Anisotropic(float x, float y) { ex = x; ey = y;
00038 if (ex > 100000.f || isnan(ex)) ex = 100000.f;
00039 if (ey > 100000.f || isnan(ey)) ey = 100000.f;
00040 }
00041 float D(const Vector &wh) const {
00042 float costhetah = fabsf(CosTheta(wh));
00043 float e = (ex * wh.x * wh.x + ey * wh.y * wh.y) /
00044 (1.f - costhetah * costhetah);
00045 return sqrtf((ex+2)*(ey+2)) * INV_TWOPI * powf(costhetah, e);
00046 }
00047 void Sample_f(const Vector &wo, Vector *wi, float u1, float u2, float *pdf) const;
00048 float Pdf(const Vector &wo, const Vector &wi) const;
00049 void sampleFirstQuadrant(float u1, float u2, float *phi, float *costheta) const;
00050 private:
00051 float ex, ey;
00052 };
00053
00054 }
00055
00056 #endif // LUX_ANISOTROPIC_H
00057