Skip to content
Snippets Groups Projects
Commit 1fe1fcb5 authored by Yoel's avatar Yoel
Browse files

sL-method now takes a hit

parent 95f76249
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,11 @@ LightSingleGroup::LightSingleGroup(const util::Mat4& matrix,
: light(light), transform(util::Transformation(matrix)) {
}
util::SurfacePoint LightSingleGroup::sampleLight() const {
auto sample = light->sampleLight();
util::SurfacePoint LightSingleGroup::sampleLight(const cam::Hit& h) const {
cam::Hit xx(transform.fromWorld.transformPoint(h.point()),
transform.fromWorldN.transformDir(h.normal()), h.texel(),
h.scalar(), h.material);
auto sample = light->sampleLight(xx);
auto result =
util::SurfacePoint(transform.toWorld.transformPoint(sample.point()),
transform.toWorldN.transformDir(sample.normal()),
......
......@@ -11,7 +11,7 @@ class LightSingleGroup : public Light {
std::shared_ptr<Light> shape);
LightSingleGroup(const util::Mat4& matrix, std::shared_ptr<Light> shape);
util::SurfacePoint sampleLight() const override;
util::SurfacePoint sampleLight(const cam::Hit& h) const override;
util::Vec3 calculateLightEmission(const util::SurfacePoint& p,
const util::Vec3& d) const override;
......
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