diff options
-rw-r--r-- | engine/src/vector.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/engine/src/vector.rs b/engine/src/vector.rs index 0a2f88b..ab80aac 100644 --- a/engine/src/vector.rs +++ b/engine/src/vector.rs @@ -1,4 +1,4 @@ -use std::ops::{Add, Neg, Sub}; +use std::ops::{Add, Mul, Neg, Sub}; #[derive(Debug)] pub struct Vec2<Value> @@ -147,3 +147,19 @@ where self } } + +impl<Value> Mul<Value> for Vec3<Value> +where + Value: Mul<Value, Output = Value> + Clone, +{ + type Output = Self; + + fn mul(mut self, rhs: Value) -> Self::Output + { + self.x = self.x * rhs.clone(); + self.y = self.y * rhs.clone(); + self.z = self.z * rhs.clone(); + + self + } +} |