X-Git-Url: https://codewiz.org/gitweb?p=mandelwow.git;a=blobdiff_plain;f=support%2Fvec3.rs;h=a515bde2a2ffe4fd50e0f8046db33f00f06d6c33;hp=10820fb36a5d8a3fa7235cea68c11a171f3ef24b;hb=082d9095991d445ad839e5ac3eb94bc3bc772951;hpb=5dd5a4d5b9ffe92b3a62914b2aaecf7482985a9d diff --git a/support/vec3.rs b/support/vec3.rs index 10820fb..a515bde 100644 --- a/support/vec3.rs +++ b/support/vec3.rs @@ -4,6 +4,7 @@ use std::f32; use std::ops::Add; use std::ops::AddAssign; use std::ops::Sub; +use std::ops::SubAssign; use std::ops::Mul; #[derive(Default, PartialEq, Debug, Clone, Copy)] @@ -29,6 +30,12 @@ impl Sub for Vec3 { } } +impl SubAssign for Vec3 { + fn sub_assign(&mut self, other: Vec3) { + *self = Vec3(self.0 - other.0, self.1 - other.1, self.2 - other.2) + } +} + impl Mul for Vec3 { type Output = Vec3; fn mul(self, f: f32) -> Vec3 {