From 2d4671d5469116b05709bb1acb614d784d339964 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 15 Apr 2022 14:06:27 +0800 Subject: Make ray3::decay_ distinguishable between different color channels. --- ray.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ray.h') diff --git a/ray.h b/ray.h index 51a3da1..11baa30 100644 --- a/ray.h +++ b/ray.h @@ -13,7 +13,7 @@ template class ray3 { vec3 source_; vec3 direction_; // unit vector - double decay_; // How much power remaining + vec3d decay_; // How much power remaining public: ~ray3() = default; @@ -30,7 +30,7 @@ public: } ray3(const vec3 &source, const vec3 &direction) : - source_(source), direction_(direction.unit_vec()), decay_(1.0) {} + source_(source), direction_(direction.unit_vec()), decay_{vec3d::one()} {} // Get the source point from where the ray emits. vec3 source() const { @@ -65,11 +65,11 @@ public: return decay_ * color; } - void decay(double a) { - decay_ *= a; + void decay(const vec3d &a) { + decay_ = decay_.scale(a); } - double decay() const { + vec3d decay() const { return decay_; } -- cgit v1.2.3