mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Merge pull request #74 from mackron/0.9.5_Compilation_Fixes
SIMD compilation fixes + clamp() ambiguity fix.
This commit is contained in:
commit
fb99c4d2e7
@ -208,7 +208,7 @@ namespace glm
|
||||
genType const & minVal,
|
||||
genType const & maxVal);
|
||||
|
||||
template <typename genType>
|
||||
template <typename genType, precision P>
|
||||
genType clamp(
|
||||
genType const & x,
|
||||
typename genType::value_type const & minVal,
|
||||
|
@ -339,7 +339,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, typename U>
|
||||
template <typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> project
|
||||
(
|
||||
detail::tvec3<T, P> const & obj,
|
||||
@ -360,7 +360,7 @@ namespace glm
|
||||
return detail::tvec3<T, P>(tmp);
|
||||
}
|
||||
|
||||
template <typename T, precision P, typename U>
|
||||
template <typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> unProject
|
||||
(
|
||||
detail::tvec3<T, P> const & win,
|
||||
|
@ -27,20 +27,20 @@ namespace glm
|
||||
return f;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fastPow(
|
||||
const detail::tvec2<T, P>& x,
|
||||
const detail::tvec2<int>& y)
|
||||
const detail::tvec2<int, P>& y)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
fastPow(x.x, y.x),
|
||||
fastPow(x.y, y.y));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fastPow(
|
||||
const detail::tvec3<T, P>& x,
|
||||
const detail::tvec3<int>& y)
|
||||
const detail::tvec3<int, P>& y)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
fastPow(x.x, y.x),
|
||||
@ -48,10 +48,10 @@ namespace glm
|
||||
fastPow(x.z, y.z));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fastPow(
|
||||
const detail::tvec4<T, P>& x,
|
||||
const detail::tvec4<int>& y)
|
||||
const detail::tvec4<int, P>& y)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
fastPow(x.x, y.x),
|
||||
|
@ -36,7 +36,7 @@ namespace glm
|
||||
i = 0x5f375a86 - (i >> 1);
|
||||
//x = *(float*)&i;
|
||||
//x = *((float*)(char*)&i);
|
||||
tmp = detail::uif(i).f;
|
||||
tmp = detail::uif32(i).f;
|
||||
tmp = tmp * (1.5f - xhalf * tmp * tmp);
|
||||
return genType(tmp);
|
||||
}
|
||||
@ -53,30 +53,30 @@ namespace glm
|
||||
return abs(x);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER valType fastLength
|
||||
(
|
||||
detail::tvec2<valType> const & x
|
||||
detail::tvec2<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y;
|
||||
return fastSqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER valType fastLength
|
||||
(
|
||||
detail::tvec3<valType> const & x
|
||||
detail::tvec3<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
|
||||
return fastSqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER valType fastLength
|
||||
(
|
||||
detail::tvec4<valType> const & x
|
||||
detail::tvec4<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||
@ -104,30 +104,30 @@ namespace glm
|
||||
return x > genType(0) ? genType(1) : -genType(1);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> fastNormalize
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<valType, P> fastNormalize
|
||||
(
|
||||
detail::tvec2<valType> const & x
|
||||
detail::tvec2<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y;
|
||||
return x * fastInverseSqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> fastNormalize
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType, P> fastNormalize
|
||||
(
|
||||
detail::tvec3<valType> const & x
|
||||
detail::tvec3<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
|
||||
return x * fastInverseSqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> fastNormalize
|
||||
template <typename valType, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<valType, P> fastNormalize
|
||||
(
|
||||
detail::tvec4<valType> const & x
|
||||
detail::tvec4<valType, P> const & x
|
||||
)
|
||||
{
|
||||
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||
|
@ -53,7 +53,7 @@ namespace glm
|
||||
|
||||
//! Computes triangle normal from triangle points.
|
||||
//! From GLM_GTX_normal extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> triangleNormal(
|
||||
detail::tvec3<T, P> const & p1,
|
||||
detail::tvec3<T, P> const & p2,
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> triangleNormal
|
||||
(
|
||||
detail::tvec3<T, P> const & p1,
|
||||
|
@ -53,13 +53,13 @@ namespace glm
|
||||
|
||||
//! Returns the orthonormalized matrix of m.
|
||||
//! From GLM_GTX_orthonormalize extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> orthonormalize(
|
||||
const detail::tmat3x3<T, P>& m);
|
||||
|
||||
//! Orthonormalizes x according y.
|
||||
//! From GLM_GTX_orthonormalize extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> orthonormalize(
|
||||
const detail::tvec3<T, P>& x,
|
||||
const detail::tvec3<T, P>& y);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> orthonormalize
|
||||
(
|
||||
const detail::tmat3x3<T, P>& m
|
||||
@ -31,7 +31,7 @@ namespace glm
|
||||
return r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> orthonormalize
|
||||
(
|
||||
const detail::tvec3<T, P>& x,
|
||||
|
@ -90,7 +90,7 @@ namespace detail
|
||||
fvec4SIMD const & v2,
|
||||
fvec4SIMD const & v3);
|
||||
explicit fmat4x4SIMD(
|
||||
tmat4x4<float> const & m);
|
||||
mat4x4 const & m);
|
||||
explicit fmat4x4SIMD(
|
||||
__m128 const in[4]);
|
||||
|
||||
@ -163,7 +163,7 @@ namespace detail
|
||||
|
||||
//! Convert a simdMat4 to a mat4.
|
||||
//! (From GLM_GTX_simd_mat4 extension)
|
||||
detail::tmat4x4<float> mat4_cast(
|
||||
mat4 mat4_cast(
|
||||
detail::fmat4x4SIMD const & x);
|
||||
|
||||
//! Multiply matrix x by matrix y component-wise, i.e.,
|
||||
|
@ -73,7 +73,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
|
||||
(
|
||||
tmat4x4<float> const & m
|
||||
mat4 const & m
|
||||
)
|
||||
{
|
||||
this->Data[0] = fvec4SIMD(m[0]);
|
||||
@ -520,12 +520,12 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD const operator++
|
||||
|
||||
}//namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<float> mat4_cast
|
||||
GLM_FUNC_QUALIFIER mat4 mat4_cast
|
||||
(
|
||||
detail::fmat4x4SIMD const & x
|
||||
)
|
||||
{
|
||||
GLM_ALIGN(16) detail::tmat4x4<float> Result;
|
||||
GLM_ALIGN(16) mat4 Result;
|
||||
_mm_store_ps(&Result[0][0], x.Data[0].Data);
|
||||
_mm_store_ps(&Result[1][0], x.Data[1].Data);
|
||||
_mm_store_ps(&Result[2][0], x.Data[2].Data);
|
||||
|
@ -76,7 +76,7 @@ namespace detail
|
||||
static size_type value_size();
|
||||
|
||||
typedef fvec4SIMD type;
|
||||
typedef tvec4<bool> bool_type;
|
||||
typedef tvec4<bool, highp> bool_type;
|
||||
|
||||
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
|
||||
union
|
||||
@ -108,7 +108,7 @@ namespace detail
|
||||
float const & z,
|
||||
float const & w);
|
||||
explicit fvec4SIMD(
|
||||
tvec4<float> const & v);
|
||||
vec4 const & v);
|
||||
|
||||
////////////////////////////////////////
|
||||
//// Convertion vector constructors
|
||||
@ -161,7 +161,7 @@ namespace detail
|
||||
|
||||
//! Convert a simdVec4 to a vec4.
|
||||
//! (From GLM_GTX_simd_vec4 extension)
|
||||
detail::tvec4<float> vec4_cast(
|
||||
vec4 vec4_cast(
|
||||
detail::fvec4SIMD const & x);
|
||||
|
||||
//! Returns x if x >= 0; otherwise, it returns -x.
|
||||
|
@ -33,7 +33,7 @@ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(fvec4SIMD const & v) :
|
||||
Data(v.Data)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(tvec4<float> const & v) :
|
||||
GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec4 const & v) :
|
||||
Data(_mm_set_ps(v.w, v.z, v.y, v.x))
|
||||
{}
|
||||
|
||||
@ -269,12 +269,12 @@ GLM_FUNC_QUALIFIER fvec4SIMD operator-- (fvec4SIMD const & v, int)
|
||||
|
||||
}//namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> vec4_cast
|
||||
GLM_FUNC_QUALIFIER vec4 vec4_cast
|
||||
(
|
||||
detail::fvec4SIMD const & x
|
||||
)
|
||||
{
|
||||
GLM_ALIGN(16) detail::tvec4<float> Result;
|
||||
GLM_ALIGN(16) vec4 Result;
|
||||
_mm_store_ps(&Result[0], x.Data);
|
||||
return Result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user