Skip to content

Commit edcf593

Browse files
idanmuzechitoyuuBromeon
committed
implemented MulAssign for Transform
Co-Authored-By: Chitose Yuuzaki <chitoyuu@potatoes.gay> Co-Authored-By: Jan Haller <708488+Bromeon@users.noreply.github.com>
1 parent 6163455 commit edcf593

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

gdnative-core/src/core_types/geom/transform.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::ops::Mul;
1+
use std::ops::{Mul, MulAssign};
22

33
use crate::core_types::{Basis, Vector3};
44

@@ -295,12 +295,18 @@ impl Transform {
295295

296296
impl Mul<Transform> for Transform {
297297
type Output = Transform;
298+
#[inline]
299+
fn mul(mut self, rhs: Self) -> Self::Output {
300+
self *= rhs;
301+
self
302+
}
303+
}
298304

305+
impl MulAssign<Transform> for Transform {
299306
#[inline]
300-
fn mul(self, rhs: Self) -> Self::Output {
301-
let origin = self.xform(rhs.origin);
302-
let basis = self.basis * rhs.basis;
303-
Self { origin, basis }
307+
fn mul_assign(&mut self, rhs: Self) {
308+
self.origin = self.xform(rhs.origin);
309+
self.basis = self.basis * rhs.basis;
304310
}
305311
}
306312

0 commit comments

Comments
 (0)