Skip to content
Snippets Groups Projects
Commit 32379c39 authored by Yoel's avatar Yoel
Browse files

Add intensity from emissioProfile to material and skysphere

parent d529c96c
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,8 @@ BackgroundMaterial::BackgroundMaterial(
}
BackgroundMaterial::BackgroundMaterial(
const std::shared_ptr<util::Sampler>& texture,
const util::Image& distribution)
: emission_profile({texture, distribution}) {
const util::Image& distribution, float intensity)
: emission_profile({texture, distribution, intensity}) {
}
BackgroundMaterial::BackgroundMaterial(const util::Vec3& albedo)
: emission_profile({std::make_shared<Constant>(albedo)}) {
......
......@@ -8,7 +8,7 @@ class BackgroundMaterial : public Material {
public:
BackgroundMaterial(const std::shared_ptr<util::Sampler>& texture);
BackgroundMaterial(const std::shared_ptr<util::Sampler>& texture,
const util::Image& distribution);
const util::Image& distribution, float intensity = 1);
BackgroundMaterial(const util::Vec3& albedo);
util::Vec3 albedo(const std::pair<float, float>& uv) const override;
......
......@@ -11,7 +11,7 @@ SkySphere::SkySphere(const std::shared_ptr<util::Sampler>& sampler)
: Sphere(1000, std::make_shared<material::BackgroundMaterial>(sampler)) {
}
SkySphere::SkySphere(const std::shared_ptr<util::Sampler>& sampler,
util::Image& distribution)
util::Image& distribution, float intensity)
: Sphere(1000, std::make_shared<material::BackgroundMaterial>(sampler)) {
for (int x = 0; x < distribution.width; x++) {
for (int y = 0; y < distribution.height; y++) {
......@@ -22,8 +22,8 @@ SkySphere::SkySphere(const std::shared_ptr<util::Sampler>& sampler,
distribution.setPixel(x, y, color);
}
}
material =
std::make_shared<material::BackgroundMaterial>(sampler, distribution);
material = std::make_shared<material::BackgroundMaterial>(
sampler, distribution, intensity);
}
// This intersect method rightly flips the normal.But the normal is never used
// for non scatter materials, so we do not flip the normal
......
......@@ -10,7 +10,7 @@ class SkySphere : public Sphere {
public:
SkySphere(const std::shared_ptr<util::Sampler>& sampler);
SkySphere(const std::shared_ptr<util::Sampler>& sampler,
util::Image& distribution);
util::Image& distribution, float intensity = 1);
float lightPdf(const util::SurfacePoint& p,
const util::Vec3& dl_out) const override;
// We should have to flip the normal, but it does not matter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment