From 8828c3f1fd05e173d94417ca4565aa634dabb1c1 Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 9 Dec 2019 14:21:08 +0100 Subject: [PATCH] Fixed GLM_EXT_matrix_clip_space warnings #980 --- glm/ext/matrix_clip_space.inl | 121 ++++++++++++++++++++-------------- readme.md | 1 + 2 files changed, 72 insertions(+), 50 deletions(-) diff --git a/glm/ext/matrix_clip_space.inl b/glm/ext/matrix_clip_space.inl index baf68cca..1b4c7708 100644 --- a/glm/ext/matrix_clip_space.inl +++ b/glm/ext/matrix_clip_space.inl @@ -67,51 +67,56 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoZO(T left, T right, T bottom, T top, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return orthoLH_ZO(left, right, bottom, top, zNear, zFar); - else +# else return orthoRH_ZO(left, right, bottom, top, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoNO(T left, T right, T bottom, T top, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return orthoLH_NO(left, right, bottom, top, zNear, zFar); - else +# else return orthoRH_NO(left, right, bottom, top, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH(T left, T right, T bottom, T top, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return orthoLH_ZO(left, right, bottom, top, zNear, zFar); - else +# else return orthoLH_NO(left, right, bottom, top, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH(T left, T right, T bottom, T top, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return orthoRH_ZO(left, right, bottom, top, zNear, zFar); - else +# else return orthoRH_NO(left, right, bottom, top, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) +# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO return orthoLH_ZO(left, right, bottom, top, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO return orthoLH_NO(left, right, bottom, top, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO return orthoRH_ZO(left, right, bottom, top, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO return orthoRH_NO(left, right, bottom, top, zNear, zFar); +# endif } template @@ -173,50 +178,55 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumZO(T left, T right, T bottom, T top, T nearVal, T farVal) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return frustumLH_ZO(left, right, bottom, top, nearVal, farVal); - else +# else return frustumRH_ZO(left, right, bottom, top, nearVal, farVal); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumNO(T left, T right, T bottom, T top, T nearVal, T farVal) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return frustumLH_NO(left, right, bottom, top, nearVal, farVal); - else +# else return frustumRH_NO(left, right, bottom, top, nearVal, farVal); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH(T left, T right, T bottom, T top, T nearVal, T farVal) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return frustumLH_ZO(left, right, bottom, top, nearVal, farVal); - else +# else return frustumLH_NO(left, right, bottom, top, nearVal, farVal); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH(T left, T right, T bottom, T top, T nearVal, T farVal) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return frustumRH_ZO(left, right, bottom, top, nearVal, farVal); - else +# else return frustumRH_NO(left, right, bottom, top, nearVal, farVal); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustum(T left, T right, T bottom, T top, T nearVal, T farVal) { - if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) +# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO return frustumLH_ZO(left, right, bottom, top, nearVal, farVal); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO return frustumLH_NO(left, right, bottom, top, nearVal, farVal); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO return frustumRH_ZO(left, right, bottom, top, nearVal, farVal); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO return frustumRH_NO(left, right, bottom, top, nearVal, farVal); +# endif } template @@ -286,51 +296,56 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveZO(T fovy, T aspect, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else +# else return perspectiveRH_ZO(fovy, aspect, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveNO(T fovy, T aspect, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return perspectiveLH_NO(fovy, aspect, zNear, zFar); - else +# else return perspectiveRH_NO(fovy, aspect, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else +# else return perspectiveLH_NO(fovy, aspect, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return perspectiveRH_ZO(fovy, aspect, zNear, zFar); - else +# else return perspectiveRH_NO(fovy, aspect, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar) { - GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) +# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO return perspectiveLH_NO(fovy, aspect, zNear, zFar); - else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO return perspectiveRH_ZO(fovy, aspect, zNear, zFar); - else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) +# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO return perspectiveRH_NO(fovy, aspect, zNear, zFar); +# endif } template @@ -416,50 +431,55 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovZO(T fov, T width, T height, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return perspectiveFovLH_ZO(fov, width, height, zNear, zFar); - else +# else return perspectiveFovRH_ZO(fov, width, height, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovNO(T fov, T width, T height, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return perspectiveFovLH_NO(fov, width, height, zNear, zFar); - else +# else return perspectiveFovRH_NO(fov, width, height, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return perspectiveFovLH_ZO(fov, width, height, zNear, zFar); - else +# else return perspectiveFovLH_NO(fov, width, height, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT return perspectiveFovRH_ZO(fov, width, height, zNear, zFar); - else +# else return perspectiveFovRH_NO(fov, width, height, zNear, zFar); +# endif } template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFov(T fov, T width, T height, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) +# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO return perspectiveFovLH_ZO(fov, width, height, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) + elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO return perspectiveFovLH_NO(fov, width, height, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) + elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO return perspectiveFovRH_ZO(fov, width, height, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) + elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO return perspectiveFovRH_NO(fov, width, height, zNear, zFar); +# endif } template @@ -501,10 +521,11 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspective(T fovy, T aspect, T zNear) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) +# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT return infinitePerspectiveLH(fovy, aspect, zNear); - else +# else return infinitePerspectiveRH(fovy, aspect, zNear); +# endif } // Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf diff --git a/readme.md b/readme.md index 547602ef..bae80988 100644 --- a/readme.md +++ b/readme.md @@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) - Fixed equal ULP variation when using negative sign #965 - Fixed for intersection ray/plane and added related tests #953 - Fixed ARM 64bit detection #949 +- Fixed GLM_EXT_matrix_clip_space warnings #980 ### [GLM 0.9.9.6](https://github.com/g-truc/glm/releases/tag/0.9.9.6) - 2019-09-08 #### Features: