diff --git a/nalgebra-glm/src/ext/matrix_clip_space.rs b/nalgebra-glm/src/ext/matrix_clip_space.rs index bf8c6aeb..8739d018 100644 --- a/nalgebra-glm/src/ext/matrix_clip_space.rs +++ b/nalgebra-glm/src/ext/matrix_clip_space.rs @@ -870,7 +870,20 @@ pub fn perspective_fov_zo(fov: N, width: N, height: N, near: N, far: N) /// 0 to 1 depth clip space or a -1 to 1 depth clip space. /// pub fn perspective(aspect: N, fovy: N, near: N, far: N) -> TMat4 { - // TODO: Breaking change: the arguments can be reversed back to proper glm conventions + // TODO: Breaking change - the arguments can be reversed back to proper glm conventions + // + // Prior to changes to support configuring the behaviour of this function it was simply + // a wrapper around Perspective3::new(). The argument order for that function is different + // than the glm convention, but reordering the arguments would've caused pointlessly + // un-optimal code to be generated so they were rearranged so the function would just call + // straight through. + // + // Now this call to Perspective3::new() is no longer made so the functions can have their + // arguments reordered to the glm convention. Unfortunately this is a breaking change so + // can't be cleanly integrated into the existing library version without breaking other + // people's code. Reordering to glm isn't a huge deal but if it is done it will have to be + // in a major API breaking update. + // if cfg!(feature="zero_to_one_clip_default") { perspective_zo(aspect, fovy, near, far) } else if cfg!(feature="negone_to_one_clip_default") { diff --git a/nalgebra-glm/tests/lib.rs b/nalgebra-glm/tests/lib.rs index f071572a..0813a7bc 100644 --- a/nalgebra-glm/tests/lib.rs +++ b/nalgebra-glm/tests/lib.rs @@ -6,6 +6,7 @@ use na::Orthographic3; use glm::Mat4; use glm::Vec4; +// Ensure that under default conditions the library doesn't break interface with old convention #[test] pub fn orthographic_glm_nalgebra_same() { @@ -19,6 +20,7 @@ pub fn orthographic_glm_nalgebra_same() assert_eq!(na_mat, gl_mat); } +// Ensure that under default conditions the library doesn't break interface with old convention #[test] pub fn perspective_glm_nalgebra_same() { @@ -33,6 +35,7 @@ pub fn perspective_glm_nalgebra_same() assert_eq!(na_mat, gl_mat); } +// Ensure that under default conditions the library doesn't break interface with old convention #[test] pub fn orthographic_glm_nalgebra_project_same() { @@ -48,9 +51,11 @@ pub fn orthographic_glm_nalgebra_project_same() let na_pt = na_mat * point; let gl_pt = gl_mat * point; + assert_eq!(na_mat, gl_mat); assert_eq!(na_pt, gl_pt); } +// Ensure that under default conditions the library doesn't break interface with old convention #[test] pub fn perspective_glm_nalgebra_project_same() { @@ -67,5 +72,6 @@ pub fn perspective_glm_nalgebra_project_same() let na_pt = na_mat * point; let gl_pt = gl_mat * point; + assert_eq!(na_mat, gl_mat); assert_eq!(na_pt, gl_pt); } \ No newline at end of file