From 20c79a655b138d86d2a803937f8b689c27fedf7d Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sat, 8 Sep 2018 21:52:49 -0700 Subject: [PATCH] Implement Vec3 + f32 --- rtiow/src/vec3.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rtiow/src/vec3.rs b/rtiow/src/vec3.rs index cdd9dab..6caccfe 100644 --- a/rtiow/src/vec3.rs +++ b/rtiow/src/vec3.rs @@ -71,6 +71,18 @@ impl str::FromStr for Vec3 { } } +impl Add for Vec3 { + type Output = Vec3; + + fn add(self, r: f32) -> Vec3 { + Vec3 { + x: self.x + r, + y: self.y + r, + z: self.z + r, + } + } +} + impl Add for Vec3 { type Output = Vec3;