Merge pull request #277 from bjz/remove-static-constraints
Remove 'static constraints
This commit is contained in:
commit
bf20874586
4 changed files with 7 additions and 6 deletions
|
@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Add missing by-ref and by-val permutations of `Quaternion` operators.
|
- Add missing by-ref and by-val permutations of `Quaternion` operators.
|
||||||
|
- Ease lifetime constraints by removing `'static` from some scalar type
|
||||||
|
parameters.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Remove redundant `Point::{min, max}` methods - these are now covered by the
|
- Remove redundant `Point::{min, max}` methods - these are now covered by the
|
||||||
|
|
|
@ -63,7 +63,6 @@ partial_ord_float!(f64);
|
||||||
pub trait BaseNum:
|
pub trait BaseNum:
|
||||||
Copy + NumCast + Clone + Num
|
Copy + NumCast + Clone + Num
|
||||||
+ PartialOrd + cmp::PartialOrd + fmt::Debug
|
+ PartialOrd + cmp::PartialOrd + fmt::Debug
|
||||||
+ 'static
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use num::BaseFloat;
|
||||||
///
|
///
|
||||||
/// This is the equivalent to the [gluPerspective]
|
/// This is the equivalent to the [gluPerspective]
|
||||||
/// (http://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml) function.
|
/// (http://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml) function.
|
||||||
pub fn perspective<S: BaseFloat + 'static, A: Angle<S>>(fovy: A, aspect: S, near: S, far: S) -> Matrix4<S> {
|
pub fn perspective<S: BaseFloat, A: Angle<S>>(fovy: A, aspect: S, near: S, far: S) -> Matrix4<S> {
|
||||||
PerspectiveFov {
|
PerspectiveFov {
|
||||||
fovy: fovy,
|
fovy: fovy,
|
||||||
aspect: aspect,
|
aspect: aspect,
|
||||||
|
@ -37,7 +37,7 @@ pub fn perspective<S: BaseFloat + 'static, A: Angle<S>>(fovy: A, aspect: S, near
|
||||||
///
|
///
|
||||||
/// This is the equivalent of the now deprecated [glFrustrum]
|
/// This is the equivalent of the now deprecated [glFrustrum]
|
||||||
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function.
|
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function.
|
||||||
pub fn frustum<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
|
pub fn frustum<S: BaseFloat>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
|
||||||
Perspective {
|
Perspective {
|
||||||
left: left,
|
left: left,
|
||||||
right: right,
|
right: right,
|
||||||
|
@ -52,7 +52,7 @@ pub fn frustum<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, nea
|
||||||
///
|
///
|
||||||
/// This is the equivalent of the now deprecated [glOrtho]
|
/// This is the equivalent of the now deprecated [glOrtho]
|
||||||
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml) function.
|
/// (http://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml) function.
|
||||||
pub fn ortho<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
|
pub fn ortho<S: BaseFloat>(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4<S> {
|
||||||
Ortho {
|
Ortho {
|
||||||
left: left,
|
left: left,
|
||||||
right: right,
|
right: right,
|
||||||
|
@ -143,7 +143,7 @@ pub struct Perspective<S> {
|
||||||
pub far: S,
|
pub far: S,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: BaseFloat + 'static> From<Perspective<S>> for Matrix4<S> {
|
impl<S: BaseFloat> From<Perspective<S>> for Matrix4<S> {
|
||||||
fn from(persp: Perspective<S>) -> Matrix4<S> {
|
fn from(persp: Perspective<S>) -> Matrix4<S> {
|
||||||
assert!(persp.left <= persp.right, "`left` cannot be greater than `right`, found: left: {:?} right: {:?}", persp.left, persp.right);
|
assert!(persp.left <= persp.right, "`left` cannot be greater than `right`, found: left: {:?} right: {:?}", persp.left, persp.right);
|
||||||
assert!(persp.bottom <= persp.top, "`bottom` cannot be greater than `top`, found: bottom: {:?} top: {:?}", persp.bottom, persp.top);
|
assert!(persp.bottom <= persp.top, "`bottom` cannot be greater than `top`, found: bottom: {:?} top: {:?}", persp.bottom, persp.top);
|
||||||
|
|
|
@ -359,7 +359,7 @@ impl<S: BaseFloat> Rotation<Point3<S>> for Quaternion<S> {
|
||||||
fn invert_self(&mut self) { *self = self.invert() }
|
fn invert_self(&mut self) { *self = self.invert() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: BaseFloat> Rotation3<S> for Quaternion<S> where S: 'static {
|
impl<S: BaseFloat> Rotation3<S> for Quaternion<S> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Quaternion<S> {
|
fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Quaternion<S> {
|
||||||
let (s, c) = sin_cos(angle.mul_s(cast(0.5f64).unwrap()));
|
let (s, c) = sin_cos(angle.mul_s(cast(0.5f64).unwrap()));
|
||||||
|
|
Loading…
Reference in a new issue