diff options
author | Keuin <[email protected]> | 2022-04-15 14:06:27 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-15 14:06:27 +0800 |
commit | 2d4671d5469116b05709bb1acb614d784d339964 (patch) | |
tree | afa839deea5e01ab3cd062968eae30ca56310370 /ray.h | |
parent | 50cd8dd3dd029ce432f8e517b4c054e75b5cfe8e (diff) |
Make ray3::decay_ distinguishable between different color channels.
Diffstat (limited to 'ray.h')
-rw-r--r-- | ray.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -13,7 +13,7 @@ template<typename T> class ray3 { vec3<T> source_; vec3<T> 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<T> &source, const vec3<T> &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<T> 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_; } |