summaryrefslogtreecommitdiff
path: root/bitmap.h
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-15 14:06:27 +0800
committerKeuin <[email protected]>2022-04-15 14:06:27 +0800
commit2d4671d5469116b05709bb1acb614d784d339964 (patch)
treeafa839deea5e01ab3cd062968eae30ca56310370 /bitmap.h
parent50cd8dd3dd029ce432f8e517b4c054e75b5cfe8e (diff)
Make ray3::decay_ distinguishable between different color channels.
Diffstat (limited to 'bitmap.h')
-rw-r--r--bitmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/bitmap.h b/bitmap.h
index 64f69a6..a544b03 100644
--- a/bitmap.h
+++ b/bitmap.h
@@ -123,6 +123,11 @@ pixel<T> operator*(S scale, const pixel <T> &pixel) {
return ::pixel < T > {.r=(T) (pixel.r * scale), .g=(T) (pixel.g * scale), .b=(T) (pixel.b * scale)};
}
+template<typename S, typename T>
+pixel<T> operator*(const vec3<S> &scale, const pixel <T> &pixel) {
+ return ::pixel < T > {.r=(T) (pixel.r * scale.x), .g=(T) (pixel.g * scale.y), .b=(T) (pixel.b * scale.z)};
+}
+
// Mix two colors a and b. Returns a*u + b*v
template<typename T>
inline pixel<T> mix(const pixel<T> &a, const pixel<T> &b, double u, double v) {