diff options
author | eug-vs <eugene@eug-vs.xyz> | 2021-10-26 00:46:41 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2021-10-26 00:46:41 +0300 |
commit | bd2150c70e5cbfc06cedfc6ec7e765d31c4ed506 (patch) | |
tree | 274e8e1e080d2caa34e244c90b80f214f7ee6bb0 /src/vector.rs | |
parent | 430ebecd2c3fe35393a3eb7861bdcff84525e9eb (diff) | |
download | pistol-bd2150c70e5cbfc06cedfc6ec7e765d31c4ed506.tar.gz |
feat: implement lighting
Diffstat (limited to 'src/vector.rs')
-rw-r--r-- | src/vector.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vector.rs b/src/vector.rs index d4e57cc..c4ddaab 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -58,6 +58,13 @@ impl ops::Div<f32> for Vector { } } +impl ops::Mul<Vector> for Vector { + type Output = f32; + fn mul(self, rhs: Vector) -> Self::Output { + self.x * rhs.x + self.y * rhs.y + self.z * rhs.z + } +} + impl Vector { pub fn magnitude_squared(self) -> f32 { self.x * self.x + self.y * self.y + self.z * self.z |