Fixed build on GCC

This commit is contained in:
Christophe Riccio 2014-01-11 19:45:40 +01:00
parent f2bce9c8fa
commit 3394af0cf2
5 changed files with 24 additions and 18 deletions

View File

@ -38,6 +38,15 @@ namespace detail
template <template <class, precision> class vecType, typename T, precision P> template <template <class, precision> class vecType, typename T, precision P>
struct compute_dot{}; struct compute_dot{};
template <typename T, precision P>
struct compute_dot<detail::tvec1, T, P>
{
static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
{
return detail::tvec1<T, P>(x * y).x;
}
};
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<detail::tvec2, T, P> struct compute_dot<detail::tvec2, T, P>
{ {
@ -159,22 +168,15 @@ namespace detail
} }
// dot // dot
GLM_FUNC_QUALIFIER float dot template <typename T>
GLM_FUNC_QUALIFIER T dot
( (
float const & x, T const & x,
float const & y T const & y
) )
{ {
return x * y; GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
} return detail::compute_dot<detail::tvec1, T, highp>::call(x, y);
GLM_FUNC_QUALIFIER double dot
(
double const & x,
double const & y
)
{
return x * y;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>

View File

@ -503,7 +503,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_inverse<detail::tmat4x4, T, P> struct compute_inverse<detail::tmat4x4, T, P>
{ {
static detail::tmat4x4<T, lowp> call(detail::tmat4x4<T, P> const & m) static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
{ {
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
@ -552,7 +552,10 @@ namespace detail
detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
T OneOverDeterminant = static_cast<T>(1) / dot(m[0], Row0); detail::tvec4<T, P> Dot0(m[0] * Row0);
T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
T OneOverDeterminant = static_cast<T>(1) / Dot1;
return Inverse * OneOverDeterminant; return Inverse * OneOverDeterminant;
} }

View File

@ -92,7 +92,7 @@ namespace detail
GLM_FUNC_DECL explicit tvec1( GLM_FUNC_DECL explicit tvec1(
ctor); ctor);
GLM_FUNC_DECL explicit tvec1( GLM_FUNC_DECL tvec1(
T const & s); T const & s);
////////////////////////////////////// //////////////////////////////////////

View File

@ -37,7 +37,7 @@ More informations in GLM manual:
http://glm.g-truc.net/glm.pdf http://glm.g-truc.net/glm.pdf
================================================================================ ================================================================================
GLM 0.9.5.1: 2014-XX-XX GLM 0.9.5.1: 2014-01-11
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed angle and orientedAngle that sometimes return NaN values (#145) - Fixed angle and orientedAngle that sometimes return NaN values (#145)
- Deprecated degrees for function parameters and display a message - Deprecated degrees for function parameters and display a message
@ -46,6 +46,7 @@ GLM 0.9.5.1: 2014-XX-XX
- Fixed mismatch between some declarations and definitions - Fixed mismatch between some declarations and definitions
- Fixed inverse link error when using namespace glm; (#147) - Fixed inverse link error when using namespace glm; (#147)
- Optimized matrix inverse and division code (#149) - Optimized matrix inverse and division code (#149)
- Added intersectRayPlane function (#153)
================================================================================ ================================================================================
GLM 0.9.5.0: 2013-12-25 GLM 0.9.5.0: 2013-12-25

View File

@ -29,7 +29,7 @@ int test_vec2_cast()
my_vec2 I; my_vec2 I;
glm::vec2 J = static_cast<glm::vec2>(I); glm::vec2 J = static_cast<glm::vec2>(I);
glm::vec2 K(7.8); glm::vec2 K(7.8f);
int Error(0); int Error(0);