Upgrade to nalgebra 0.21

This commit is contained in:
Matthew Gordon 2020-05-22 21:05:30 -04:00
parent ec1ee394a9
commit 8bc2c4b229
3 changed files with 5 additions and 3 deletions

View File

@ -12,9 +12,10 @@ quickcheck = "0.9"
quickcheck_macros = "0.8" quickcheck_macros = "0.8"
rayon = "1.3" rayon = "1.3"
sdl2 = "0.32" sdl2 = "0.32"
simba = "0.1.2"
[dependencies.nalgebra] [dependencies.nalgebra]
version = "0.19" version = "0.21"
features = ["arbitrary"] features = ["arbitrary"]
[dev-dependencies] [dev-dependencies]

View File

@ -21,7 +21,7 @@ impl<T: Real> Plane<T> {
distance_from_origin: T, distance_from_origin: T,
material: Arc<dyn Material<T>>, material: Arc<dyn Material<T>>,
) -> Plane<T> { ) -> Plane<T> {
normal.normalize(); let normal = normal.normalize();
let mut axis_closest_to_tangent = Vector3::zeros(); let mut axis_closest_to_tangent = Vector3::zeros();
axis_closest_to_tangent[normal.iamin()] = T::one(); axis_closest_to_tangent[normal.iamin()] = T::one();
let cotangent = normal.cross(&axis_closest_to_tangent).normalize(); let cotangent = normal.cross(&axis_closest_to_tangent).normalize();

View File

@ -1,10 +1,11 @@
use simba::scalar::{SubsetOf,SupersetOf};
use nalgebra::RealField; use nalgebra::RealField;
pub trait NormalizedToU32 { pub trait NormalizedToU32 {
fn normalized_to_u32(self, num_bits: usize) -> u32; fn normalized_to_u32(self, num_bits: usize) -> u32;
} }
pub trait Real: RealField + NormalizedToU32 {} pub trait Real: RealField + SupersetOf<f32> + SubsetOf<f32> + NormalizedToU32 {}
impl NormalizedToU32 for f32 { impl NormalizedToU32 for f32 {
fn normalized_to_u32(self, num_bits: usize) -> u32 { fn normalized_to_u32(self, num_bits: usize) -> u32 {