erebus
view liberebus/src/brdf.cc @ 16:d2b6cee8ea5c
fixed visual studio build
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 25 May 2014 02:23:39 +0300 |
parents | 474a0244f57d |
children | e49f4d7ad04c |
line source
1 #include "brdf.h"
2 #include "erebus_impl.h"
4 // ---- class Reflectance ----
5 Reflectance::Reflectance()
6 {
7 }
9 float Reflectance::sample(const Vector3 &norm, const Vector3 &outdir, Vector3 *indir) const
10 {
11 *indir = sample_dir(norm, outdir);
12 return eval(norm, outdir, *indir);
13 }
15 // --- class LambertRefl ---
16 Vector3 LambertRefl::sample_dir(const Vector3 &norm, const Vector3 &outdir) const
17 {
18 Vector3 dir = Vector3{randf(-1, 1), randf(-1, 1), randf(-1, 1)}.normalized();
19 return dot_product(dir, norm) < 0.0 ? -dir : dir;
20 }
22 float LambertRefl::eval(const Vector3 &norm, const Vector3 &outdir, const Vector3 &indir) const
23 {
24 return dot_product(norm, outdir);
25 }