From 1fe1fcb50a9328730157460630bbe178086bc7fb Mon Sep 17 00:00:00 2001 From: Yoel <s73017@beuth-hochschule.de> Date: Tue, 16 Mar 2021 14:40:53 +0100 Subject: [PATCH] sL-method now takes a hit --- RayTracer/shape/LightSingleGroup.cpp | 7 +++++-- RayTracer/shape/LightSingleGroup.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RayTracer/shape/LightSingleGroup.cpp b/RayTracer/shape/LightSingleGroup.cpp index 3cea533..79a9216 100644 --- a/RayTracer/shape/LightSingleGroup.cpp +++ b/RayTracer/shape/LightSingleGroup.cpp @@ -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()), diff --git a/RayTracer/shape/LightSingleGroup.h b/RayTracer/shape/LightSingleGroup.h index b824d42..0cda9ba 100644 --- a/RayTracer/shape/LightSingleGroup.h +++ b/RayTracer/shape/LightSingleGroup.h @@ -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; -- GitLab