Fixed GCC 4.5 and older build #566

This commit is contained in:
Christophe Riccio
2016-12-01 23:05:43 +01:00
parent 57091f8553
commit 2dda5af72c
11 changed files with 53 additions and 27 deletions

View File

@@ -451,6 +451,11 @@
((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70))))
#endif
#define GLM_HAS_ONLY_XYZW ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER < GLM_COMPILER_GCC46))
#if GLM_HAS_ONLY_XYZW
# pragma message("GLM: GCC older than 4.6 has a bug presenting the use of rgba and stpq components")
#endif
//
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_ASSIGNABLE 1

View File

@@ -27,7 +27,10 @@ namespace glm
// -- Data --
# if GLM_HAS_ALIGNED_TYPE
# if GLM_HAS_ONLY_XYZW
T x;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"

View File

@@ -26,7 +26,10 @@ namespace glm
// -- Data --
# if GLM_HAS_ALIGNED_TYPE
# if GLM_HAS_ONLY_XYZW
T x, y;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"

View File

@@ -26,7 +26,10 @@ namespace glm
// -- Data --
# if GLM_HAS_ALIGNED_TYPE
# if GLM_HAS_ONLY_XYZW
T x, y, z;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"

View File

@@ -26,7 +26,10 @@ namespace glm
// -- Data --
# if GLM_HAS_ALIGNED_TYPE
# if GLM_HAS_ONLY_XYZW
T x, y, z, w;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
@@ -36,7 +39,7 @@ namespace glm
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
union
{
struct { T x, y, z, w;};

View File

@@ -23,7 +23,7 @@ namespace detail
{
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection)
{
return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.a);
return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.w);
}
};
@@ -44,7 +44,7 @@ namespace detail
{
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma)
{
return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.a);
return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.w);
}
};
}//namespace detail

View File

@@ -105,20 +105,18 @@ namespace glm
{
tvec3<T, defaultp> rgbw = tvec3<T, defaultp>(T(0.2126), T(0.7152), T(0.0722));
T col0 = (T(1) - s) * rgbw.r;
T col1 = (T(1) - s) * rgbw.g;
T col2 = (T(1) - s) * rgbw.b;
tvec3<T, defaultp> const col((T(1) - s) * rgbw);
tmat4x4<T, defaultp> result(T(1));
result[0][0] = col0 + s;
result[0][1] = col0;
result[0][2] = col0;
result[1][0] = col1;
result[1][1] = col1 + s;
result[1][2] = col1;
result[2][0] = col2;
result[2][1] = col2;
result[2][2] = col2 + s;
result[0][0] = col.x + s;
result[0][1] = col.x;
result[0][2] = col.x;
result[1][0] = col.y;
result[1][1] = col.y + s;
result[1][2] = col.y;
result[2][0] = col.z;
result[2][1] = col.z;
result[2][2] = col.z + s;
return result;
}