impl AddAssign for Color

This commit is contained in:
Carter Anderson 2020-04-28 00:59:26 -07:00
parent c2c543e0ba
commit 0c3a77ac9f

View file

@ -3,7 +3,7 @@ use crate::shader::ShaderDefSuffixProvider;
use bevy_asset::Handle;
use bevy_core::bytes::GetBytes;
use glam::Vec4;
use std::ops::Add;
use std::ops::{AddAssign, Add};
use zerocopy::AsBytes;
#[repr(C)]
@ -25,6 +25,17 @@ impl Color {
}
}
impl AddAssign<Color> for Color {
fn add_assign(&mut self, rhs: Color) {
*self = Color {
r: self.r + rhs.r,
g: self.g + rhs.g,
b: self.b + rhs.b,
a: self.a + rhs.a,
}
}
}
impl Add<Color> for Color {
type Output = Color;
fn add(self, rhs: Color) -> Self::Output {