38 const Vector& dir_out)
const override {
39 const Vector out = 2._f *
dot(normal, dir_in) * normal - dir_in;
40 return albedo /
PI + 0.3_f *
pow(
abs(
dot(out, dir_out)), alpha);
64 const Vector& dir_out)
const override {
65 const Float mu_i =
dot(normal, dir_in);
66 const Float mu_e =
dot(normal, dir_out);
67 SPH_ASSERT(mu_i > 0._f && mu_e > 0._f, mu_i, mu_e);
69 const Float alpha = 0._f;
70 return albedo / (mu_i + mu_e) * ((1._f + B(alpha)) * P(alpha) + H(mu_i) * H(mu_e) - 1._f) *
76 return B0 / (1._f +
tan(0.5_f * alpha) / h);
80 return (1._f -
sqr(g)) /
pow(1._f + 2._f * g *
cos(alpha) +
sqr(g), 1.5_f);
84 return 1._f - Aw * mu / (r0 + 0.5_f * (1._f - 2._f * r0 * mu) * log((1._f + mu) / mu));
#define SPH_ASSERT(x,...)
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
constexpr INLINE Float pow(const Float v)
Power for floats.
INLINE auto abs(const T &f)
constexpr Float PI
Mathematical constants.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Basic vector algebra. Computations are accelerated using SIMD.
INLINE float dot(const BasicVector< float > &v1, const BasicVector< float > &v2)
Make sure the vector is trivially constructible and destructible, needed for fast initialization of a...
virtual Float transport(const Vector &normal, const Vector &dir_in, const Vector &dir_out) const override
virtual Float transport(const Vector &normal, const Vector &dir_in, const Vector &dir_out) const =0
virtual Float transport(const Vector &UNUSED(normal), const Vector &UNUSED(dir_in), const Vector &UNUSED(dir_out)) const override
LambertBrdf(const Float albedo)
virtual Float transport(const Vector &normal, const Vector &dir_in, const Vector &dir_out) const override
PhongBrdf(const Float albedo)
Base class for all polymorphic objects.