summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/vector.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/engine/src/vector.rs b/engine/src/vector.rs
index 00b2ea5..e5947d5 100644
--- a/engine/src/vector.rs
+++ b/engine/src/vector.rs
@@ -144,6 +144,38 @@ where
}
}
+impl<Value> Add<Value> for Vec3<Value>
+where
+ Value: Add<Value, Output = Value> + Clone,
+{
+ type Output = Self;
+
+ fn add(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
+ }
+}
+
+impl<Value> Sub<Value> for Vec3<Value>
+where
+ Value: Sub<Value, Output = Value> + Clone,
+{
+ type Output = Self;
+
+ fn sub(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
+ }
+}
+
impl<Value> Mul<Value> for Vec3<Value>
where
Value: Mul<Value, Output = Value> + Clone,