Skip to content

Commit

Permalink
Rewrite method to remove unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 25, 2022
1 parent 72239d0 commit 2b4839d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/fj-math/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,13 @@ impl Transform {
zfar: f64,
) -> [Scalar; 16] {
let projection = Perspective3::new(aspect_ratio, fovy, znear, zfar);
(projection.to_projective() * self.0)
.matrix()
.as_slice()
.iter()
.map(|f| Scalar::from(*f))
.collect::<Vec<Scalar>>()
.try_into()
.unwrap()

let mut array = [0.; 16];
array.copy_from_slice(
(projection.to_projective() * self.0).matrix().as_slice(),
);

array.map(Scalar::from)
}

/// Transform the given axis-aligned bounding box
Expand Down

0 comments on commit 2b4839d

Please sign in to comment.