Fixed GLM_EXT_matrix_clip_space warnings #980

This commit is contained in:
Christophe 2019-12-09 14:21:08 +01:00
parent d666b5e533
commit 8828c3f1fd
2 changed files with 72 additions and 50 deletions

View File

@ -67,51 +67,56 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoZO(T left, T right, T bottom, T top, T zNear, T zFar) 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); return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
else # else
return orthoRH_ZO(left, right, bottom, top, zNear, zFar); return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoNO(T left, T right, T bottom, T top, T zNear, T zFar) 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); return orthoLH_NO(left, right, bottom, top, zNear, zFar);
else # else
return orthoRH_NO(left, right, bottom, top, zNear, zFar); return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH(T left, T right, T bottom, T top, T zNear, T zFar) 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); return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
else # else
return orthoLH_NO(left, right, bottom, top, zNear, zFar); return orthoLH_NO(left, right, bottom, top, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH(T left, T right, T bottom, T top, T zNear, T zFar) 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); return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
else # else
return orthoRH_NO(left, right, bottom, top, zNear, zFar); return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top, T zNear, T zFar) 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); 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); 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); 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); return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
@ -173,50 +178,55 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumZO(T left, T right, T bottom, T top, T nearVal, T farVal) 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); return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
else # else
return frustumRH_ZO(left, right, bottom, top, nearVal, farVal); return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumNO(T left, T right, T bottom, T top, T nearVal, T farVal) 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); return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
else # else
return frustumRH_NO(left, right, bottom, top, nearVal, farVal); return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH(T left, T right, T bottom, T top, T nearVal, T farVal) 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); return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
else # else
return frustumLH_NO(left, right, bottom, top, nearVal, farVal); return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH(T left, T right, T bottom, T top, T nearVal, T farVal) 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); return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
else # else
return frustumRH_NO(left, right, bottom, top, nearVal, farVal); return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustum(T left, T right, T bottom, T top, T nearVal, T farVal) 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); 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); 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); 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); return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
} }
template<typename T> template<typename T>
@ -286,51 +296,56 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveZO(T fovy, T aspect, T zNear, T zFar) 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); return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
else # else
return perspectiveRH_ZO(fovy, aspect, zNear, zFar); return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveNO(T fovy, T aspect, T zNear, T zFar) 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); return perspectiveLH_NO(fovy, aspect, zNear, zFar);
else # else
return perspectiveRH_NO(fovy, aspect, zNear, zFar); return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar) 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); return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
else # else
return perspectiveLH_NO(fovy, aspect, zNear, zFar); return perspectiveLH_NO(fovy, aspect, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar) 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); return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
else # else
return perspectiveRH_NO(fovy, aspect, zNear, zFar); return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar) 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); 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); 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); 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); return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
@ -416,50 +431,55 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovZO(T fov, T width, T height, T zNear, T zFar) 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); return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
else # else
return perspectiveFovRH_ZO(fov, width, height, zNear, zFar); return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovNO(T fov, T width, T height, T zNear, T zFar) 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); return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
else # else
return perspectiveFovRH_NO(fov, width, height, zNear, zFar); return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar) 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); return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
else # else
return perspectiveFovLH_NO(fov, width, height, zNear, zFar); return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar) 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); return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
else # else
return perspectiveFovRH_NO(fov, width, height, zNear, zFar); return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFov(T fov, T width, T height, T zNear, T zFar) 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); 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); 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); 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); return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
} }
template<typename T> template<typename T>
@ -501,10 +521,11 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspective(T fovy, T aspect, T zNear) 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); return infinitePerspectiveLH(fovy, aspect, zNear);
else # else
return infinitePerspectiveRH(fovy, aspect, zNear); return infinitePerspectiveRH(fovy, aspect, zNear);
# endif
} }
// Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf // Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf

View File

@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
- Fixed equal ULP variation when using negative sign #965 - Fixed equal ULP variation when using negative sign #965
- Fixed for intersection ray/plane and added related tests #953 - Fixed for intersection ray/plane and added related tests #953
- Fixed ARM 64bit detection #949 - 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 ### [GLM 0.9.9.6](https://github.com/g-truc/glm/releases/tag/0.9.9.6) - 2019-09-08
#### Features: #### Features: