+= and /= for vectors
This commit is contained in:
parent
bfaf3c2cb6
commit
e862a86fe6
1 changed files with 13 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
fmt,
|
||||
ops::{Add, Deref, Div, Mul, Sub},
|
||||
ops::{Add, AddAssign, Deref, Div, DivAssign, Mul, Sub},
|
||||
};
|
||||
|
||||
pub mod shapes;
|
||||
|
@ -94,6 +94,12 @@ impl Div<f32> for Vector {
|
|||
}
|
||||
}
|
||||
|
||||
impl DivAssign<f32> for Vector {
|
||||
fn div_assign(&mut self, rhs: f32) {
|
||||
*self = *self / rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Vector {
|
||||
type Output = Self;
|
||||
|
||||
|
@ -102,6 +108,12 @@ impl Add for Vector {
|
|||
}
|
||||
}
|
||||
|
||||
impl AddAssign for Vector {
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
*self = *self + rhs;
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Point(glam::Vec3A);
|
||||
|
|
Loading…
Add table
Reference in a new issue