From cf372b7dc89937dab369df4c8d85d2a8fcdc7314 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Wed, 16 Jul 2025 13:01:17 -0500 Subject: [PATCH] vec3: add *= --- math/vec3.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/math/vec3.hpp b/math/vec3.hpp index 98240aa..92ee3df 100644 --- a/math/vec3.hpp +++ b/math/vec3.hpp @@ -26,6 +26,7 @@ struct vec<3, T> inline constexpr vec<3, T>& operator=(vec<3, T> const& v); inline constexpr vec<3, T>& operator+=(vec<3, T> const& v); inline constexpr vec<3, T>& operator-=(vec<3, T> const& v); + inline constexpr vec<3, T>& operator*=(T const& scalar); }; template @@ -84,6 +85,13 @@ inline constexpr vec<3, T>& vec<3, T>::operator-=(vec<3, T> const& v) return *this; } +template +inline constexpr vec<3, T>& vec<3, T>::operator*=(T const& scalar) +{ + *this = *this * scalar; + return *this; +} + template inline constexpr vec<3, T> operator+(vec<3, T> const& v1, vec<3, T> const& v2) {