From 8bc2c4b229892311bebdeab785c175ebd64c9ac9 Mon Sep 17 00:00:00 2001 From: Matthew Gordon Date: Fri, 22 May 2020 21:05:30 -0400 Subject: [PATCH] Upgrade to nalgebra 0.21 --- Cargo.toml | 3 ++- src/raycasting/plane.rs | 2 +- src/realtype.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 67bcb2b..24c0e47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,9 +12,10 @@ quickcheck = "0.9" quickcheck_macros = "0.8" rayon = "1.3" sdl2 = "0.32" +simba = "0.1.2" [dependencies.nalgebra] -version = "0.19" +version = "0.21" features = ["arbitrary"] [dev-dependencies] diff --git a/src/raycasting/plane.rs b/src/raycasting/plane.rs index b26c3e3..64ae562 100644 --- a/src/raycasting/plane.rs +++ b/src/raycasting/plane.rs @@ -21,7 +21,7 @@ impl Plane { distance_from_origin: T, material: Arc>, ) -> Plane { - normal.normalize(); + let normal = normal.normalize(); let mut axis_closest_to_tangent = Vector3::zeros(); axis_closest_to_tangent[normal.iamin()] = T::one(); let cotangent = normal.cross(&axis_closest_to_tangent).normalize(); diff --git a/src/realtype.rs b/src/realtype.rs index 5fe4bf1..4c5dc95 100644 --- a/src/realtype.rs +++ b/src/realtype.rs @@ -1,10 +1,11 @@ +use simba::scalar::{SubsetOf,SupersetOf}; use nalgebra::RealField; pub trait NormalizedToU32 { fn normalized_to_u32(self, num_bits: usize) -> u32; } -pub trait Real: RealField + NormalizedToU32 {} +pub trait Real: RealField + SupersetOf + SubsetOf + NormalizedToU32 {} impl NormalizedToU32 for f32 { fn normalized_to_u32(self, num_bits: usize) -> u32 {