mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 02:04:35 +00:00
Merge pull request #887 from timmmeh/master
'if constexpr' warning (c++17) #887
This commit is contained in:
commit
1498e094b9
@ -293,6 +293,27 @@
|
||||
# define GLM_CONSTEXPR
|
||||
#endif
|
||||
|
||||
//
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr)
|
||||
# elif (GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# define GLM_HAS_IF_CONSTEXPR GLM_COMPILER >= GLM_COMPILER_GCC7
|
||||
# elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
|
||||
# define GLM_HAS_IF_CONSTEXPR 1
|
||||
# else
|
||||
# define GLM_HAS_IF_CONSTEXPR 0
|
||||
# endif
|
||||
#else
|
||||
# define GLM_HAS_IF_CONSTEXPR 0
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_IF_CONSTEXPR
|
||||
# define GLM_IF_CONSTEXPR if constexpr
|
||||
#else
|
||||
# define GLM_IF_CONSTEXPR if
|
||||
#endif
|
||||
|
||||
//
|
||||
#if GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_ASSIGNABLE 1
|
||||
|
@ -323,13 +323,13 @@ namespace glm
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar)
|
||||
{
|
||||
if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO)
|
||||
GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO)
|
||||
return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
|
||||
else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO)
|
||||
else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO)
|
||||
return perspectiveLH_NO(fovy, aspect, zNear, zFar);
|
||||
else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO)
|
||||
else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO)
|
||||
return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
|
||||
else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO)
|
||||
else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO)
|
||||
return perspectiveRH_NO(fovy, aspect, zNear, zFar);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
|
||||
{
|
||||
if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT)
|
||||
GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT)
|
||||
return lookAtLH(eye, center, up);
|
||||
else
|
||||
return lookAtRH(eye, center, up);
|
||||
|
Loading…
Reference in New Issue
Block a user