-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv_light.h
59 lines (43 loc) · 1.8 KB
/
env_light.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _ENV_LIGHT_H_
#define _ENV_LIGHT_H_
#include "common.h"
#include "light.h"
#include "pdf.h"
namespace Renzoku {
class EnvLight : public Light {
public:
EnvLight(Surface *_surface, ImageFloat *envmap);
virtual ~EnvLight();
virtual Light::Type get_light_type() const {
return Light::ENV_LIGHT;
}
virtual bool hit(const Ray &r, Float tmin, Float tmax, Float time, HitRecord &record) const;
virtual bool hit(const Ray &r, Float tmin, Float tmax, Float time) const;
virtual Float area() const;
virtual Rgb power() const;
/**
* Uniform sample the sphere
*/
virtual void sample(Random &rd, Vec3 &wo, Float &pdf) const;
virtual void sample(Random &rd, Vec3 &wo, Rgb &radiance, Float &pdf) const;
/**
* Perform the cosine weighted sampling of the hemisphere the orientation n belongs to.
*/
virtual void sample(Random &rd, const Vec3 &n, Vec3 &wo, Float &pdf) const;
virtual void pdf(const Vec3 &n, const Vec3 &wo, Float &pdf) const;
virtual void sample(Random &rd, Vec3 &wo, Float &pdf, const Receiver &patch) const;
virtual void sample(Random &rd, Vec3 &wo, Rgb &radiance, Float &pdf, const Receiver &patch) const;
virtual Float pdf(const Vec3 &wo) const;
virtual Float pdf(const Vec3 &wo, const Receiver &patch) const;
virtual void query(const Vec3 &wo, Rgb &radiance) const;
virtual Rgb first_bounce(Scene *scene, const Receiver &r, DirectionSampler *dir_sampler = NULL) const;
virtual Rgb irradiance(Scene *scene, const LocalGeometry &dg, LightSamplingRecord &sr) const;
protected:
ImageFloat *envmap;
Surface *surface;
Sphere *sphere;
Onb *uvn; // local transformation (rotation) of the sphere
DiscretePdf2D pdf2d;
};
} // end namespace Renzoku
#endif