added impl-nalgebra feature
This commit is contained in:
parent
3cd65dce54
commit
40ddb05797
@ -22,6 +22,11 @@ default = ["std", "impl-cgmath"]
|
||||
serialization = ["serde", "serde_derive"]
|
||||
std = []
|
||||
impl-cgmath = ["cgmath"]
|
||||
impl-nalgebra = ["nalgebra"]
|
||||
|
||||
[dependencies.nalgebra]
|
||||
version = "0.16"
|
||||
optional = true
|
||||
|
||||
[dependencies.cgmath]
|
||||
version = "0.16"
|
||||
|
18
src/lib.rs
18
src/lib.rs
@ -98,11 +98,15 @@
|
||||
|
||||
#[cfg(feature = "impl-cgmath")] extern crate cgmath;
|
||||
|
||||
#[cfg(feature = "impl-nalgebra")] extern crate nalgebra;
|
||||
|
||||
#[cfg(feature = "serialization")] extern crate serde;
|
||||
#[cfg(feature = "serialization")] #[macro_use] extern crate serde_derive;
|
||||
|
||||
#[cfg(feature = "impl-cgmath")] use cgmath::{InnerSpace, Quaternion, Vector2, Vector3, Vector4};
|
||||
|
||||
#[cfg(feature = "impl-nalgera")] use nalgera::{Point, Vector};
|
||||
|
||||
#[cfg(feature = "std")] use std::cmp::Ordering;
|
||||
#[cfg(feature = "std")] use std::f32::consts;
|
||||
#[cfg(feature = "std")] use std::ops::{Add, Div, Mul, Sub};
|
||||
@ -385,6 +389,20 @@ impl Interpolate for Quaternion<f32> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "impl-nalgebra")]
|
||||
impl<T : Interpolate > Interpolate for Point<T> {
|
||||
fn lerp(a: Self, b: Self, t: f32) -> Self {
|
||||
a.lerp(b, t)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "impl-nalgebra")]
|
||||
impl<T : Interpolate > Interpolate for Vector<T> {
|
||||
fn lerp(a: Self, b: Self, t: f32) -> Self {
|
||||
a.lerp(b, t)
|
||||
}
|
||||
}
|
||||
|
||||
// Default implementation of Interpolate::cubic_hermit.
|
||||
pub(crate) fn cubic_hermite<T>(x: (T, f32), a: (T, f32), b: (T, f32), y: (T, f32), t: f32) -> T
|
||||
where T: Copy + Add<Output = T> + Sub<Output = T> + Mul<f32, Output = T> + Div<f32, Output = T> {
|
||||
|
Loading…
Reference in New Issue
Block a user