Merge pull request #7 from g-truc/master

sync from gtruc/glm
This commit is contained in:
Thom de Villa 2015-10-31 21:12:21 +01:00
commit 10572b2f22
34 changed files with 249 additions and 21 deletions

View File

@ -65,6 +65,8 @@
#ifdef GLM_FORCE_PLATFORM_UNKNOWN
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
#elif defined(__CYGWIN__)
# define GLM_PLATFORM GLM_PLATFORM_CYGWIN
#elif defined(__QNXNTO__)
# define GLM_PLATFORM GLM_PLATFORM_QNXNTO
#elif defined(__APPLE__)
@ -650,7 +652,7 @@
// http://gcc.gnu.org/projects/cxx0x.html
// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
#if GLM_PLATFORM == GLM_PLATFORM_ANDROID
#if GLM_PLATFORM == GLM_PLATFORM_ANDROID || GLM_PLATFORM == GLM_PLATFORM_CYGWIN
# define GLM_HAS_CXX11_STL 0
#elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
# if __has_include(<__config>) // libc++

View File

@ -161,7 +161,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m);
GLM_FUNC_DECL tmat2x2<T, P> operator+(tmat2x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator-(tmat2x2<T, P> const & m);
// -- Binary operators --

View File

@ -374,7 +374,13 @@ namespace detail
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+(tmat2x2<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-(tmat2x2<T, P> const & m)
{
return tmat2x2<T, P>(
-m[0],

View File

@ -154,7 +154,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> const operator-(tmat2x3<T, P> const & m);
GLM_FUNC_DECL tmat2x3<T, P> operator+(tmat2x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator-(tmat2x3<T, P> const & m);
// -- Binary operators --

View File

@ -344,7 +344,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> const operator-(tmat2x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+(tmat2x3<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-(tmat2x3<T, P> const & m)
{
return tmat2x3<T, P>(
-m[0],

View File

@ -156,7 +156,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> const operator-(tmat2x4<T, P> const & m);
GLM_FUNC_DECL tmat2x4<T, P> operator+(tmat2x4<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator-(tmat2x4<T, P> const & m);
// -- Binary operators --

View File

@ -345,7 +345,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> const operator-(tmat2x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+(tmat2x4<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-(tmat2x4<T, P> const & m)
{
return tmat2x4<T, P>(
-m[0],

View File

@ -161,7 +161,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> const operator-(tmat3x2<T, P> const & m);
GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m);
// -- Binary operators --

View File

@ -384,7 +384,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> const operator-(tmat3x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+(tmat3x2<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-(tmat3x2<T, P> const & m)
{
return tmat3x2<T, P>(
-m[0],

View File

@ -169,7 +169,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> const operator-(tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> operator+(tmat3x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator-(tmat3x3<T, P> const & m);
// -- Binary operators --

View File

@ -423,7 +423,13 @@ namespace detail
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> const operator-(tmat3x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(tmat3x3<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(tmat3x3<T, P> const & m)
{
return tmat3x3<T, P>(
-m[0],

View File

@ -161,7 +161,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> const operator-(tmat3x4<T, P> const & m);
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m);
// -- Binary operators --

View File

@ -384,7 +384,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> const operator-(tmat3x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+(tmat3x4<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-(tmat3x4<T, P> const & m)
{
return tmat3x4<T, P>(
-m[0],

View File

@ -166,7 +166,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> const operator-(tmat4x2<T, P> const & m);
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m);
// -- Binary operators --

View File

@ -416,7 +416,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> const operator-(tmat4x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+(tmat4x2<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-(tmat4x2<T, P> const & m)
{
return tmat4x2<T, P>(
-m[0],

View File

@ -166,7 +166,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> const operator-(tmat4x3<T, P> const & m);
GLM_FUNC_DECL tmat4x3<T, P> operator+(tmat4x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator-(tmat4x3<T, P> const & m);
// -- Binary operators --

View File

@ -416,7 +416,13 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator-(tmat4x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+(tmat4x3<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator-(tmat4x3<T, P> const & m)
{
return tmat4x3<T, P>(
-m[0],

View File

@ -174,7 +174,10 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> const operator-(tmat4x4<T, P> const & m);
GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m);
// -- Binary operators --

View File

@ -522,7 +522,13 @@ namespace detail
// -- Unary constant operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator-(tmat4x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+(tmat4x4<T, P> const & m)
{
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-(tmat4x4<T, P> const & m)
{
return tmat4x4<T, P>(
-m[0],

View File

@ -208,6 +208,9 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v);
@ -314,6 +317,12 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator&&(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator||(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>

View File

@ -359,6 +359,12 @@ namespace glm
// -- Unary constant operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(tvec1<T, P> const & v)
{
return v;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(tvec1<T, P> const & v)
{
@ -601,4 +607,16 @@ namespace glm
{
return (v1.x != v2.x);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec1<bool, P> operator&&(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2)
{
return tvec1<bool, P>(v1.x && v2.x);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec1<bool, P> operator||(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2)
{
return tvec1<bool, P>(v1.x || v2.x);
}
}//namespace glm

View File

@ -237,6 +237,9 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v);
@ -406,6 +409,12 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec2<bool, P> operator&&(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>

View File

@ -493,6 +493,12 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v)
{
return v;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v)
{
@ -926,4 +932,16 @@ namespace glm
{
return (v1.x != v2.x) || (v1.y != v2.y);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec2<bool, P> operator&&(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2)
{
return tvec2<bool, P>(v1.x && v2.x, v1.y && v2.y);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2)
{
return tvec2<bool, P>(v1.x || v2.x, v1.y || v2.y);
}
}//namespace glm

View File

@ -263,6 +263,9 @@ namespace glm
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v);
@ -429,6 +432,12 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator&&(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator||(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>

View File

@ -573,6 +573,12 @@ namespace glm
// -- Unary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v)
{
return v;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v)
{
@ -1058,4 +1064,16 @@ namespace glm
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec3<bool, P> operator&&(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2)
{
return tvec3<bool, P>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec3<bool, P> operator||(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2)
{
return tvec3<bool, P>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z);
}
}//namespace glm

View File

@ -370,6 +370,9 @@ namespace detail
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v);
@ -542,6 +545,12 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator&&(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator||(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>

View File

@ -711,6 +711,12 @@ namespace glm
// -- Unary constant operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v)
{
return v;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v)
{
@ -1168,6 +1174,18 @@ namespace glm
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec4<bool, P> operator&&(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2)
{
return tvec4<bool, P>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
}
template <precision P>
GLM_FUNC_QUALIFIER tvec4<bool, P> operator||(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2)
{
return tvec4<bool, P>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
}
}//namespace glm
#if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS

View File

@ -169,6 +169,9 @@ namespace glm
// -- Unary bit operators --
template <typename T, precision P>
GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const & q);
template <typename T, precision P>
GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const & q);

View File

@ -363,6 +363,12 @@ namespace detail
// -- Unary bit operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q)
{
return q;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> operator-(tquat<T, P> const & q)
{

View File

@ -130,7 +130,10 @@ namespace glm
// -- Unary bit operators --
template <typename T, precision P>
GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const & q);
GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q);
template <typename T, precision P>
GLM_FUNC_DECL tdualquat<T, P> operator-(tdualquat<T, P> const & q);
// -- Binary operators --

View File

@ -196,7 +196,7 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER tdualquat<T, P> operator-(tdualquat<T, P> const & q)
{
return tdualquat<T, P>(-q.real,-q.dual);
return q;
}
// -- Binary operators --

View File

@ -59,10 +59,12 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Added (un)packUnorm and (un)packSnorm to GTC_packing
- Added 16bit pack and unpack to GTC_packing
- Added 8bit pack and unpack to GTC_packing
- Added missing bvec* && and || operators
##### Improvements:
- Improved GTC_random linearRand documentation
- Improved GTC_reciprocal documentation
- Added unary + operator #435
##### Fixes:
- Fixed GTX_extended_min_max filename typo #386
@ -72,6 +74,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Fixed GTC_round floorMultiple/ceilMultiple #412
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
- Fixed GTC_matrix_inverse affineInverse #192
- Fixed Cygwin build errors when using C++11 #405
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
##### Improvements:

View File

@ -159,6 +159,26 @@ int test_vec4_ctor()
return Error;
}
int test_bvec4_ctor()
{
int Error = 0;
glm::bvec4 const A(true);
glm::bvec4 const B(true);
glm::bvec4 const C(false);
glm::bvec4 const D = A && B;
glm::bvec4 const E = A && C;
glm::bvec4 const F = A || C;
bool const G = A == C;
bool const H = A != C;
Error += D == glm::bvec4(true) ? 0 : 1;
Error += E == glm::bvec4(false) ? 0 : 1;
Error += F == glm::bvec4(true) ? 0 : 1;
return Error;
}
int test_vec4_operators()
{
int Error = 0;
@ -511,6 +531,7 @@ int main()
Error += test_vec4_static_const();
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();
Error += test_vec4_operators();
Error += test_vec4_swizzle_partial();

View File

@ -438,6 +438,7 @@ int test_packSnorm1x8()
std::vector<glm::vec1> A;
A.push_back(glm::vec1( 1.0f));
A.push_back(glm::vec1(-0.7f));
A.push_back(glm::vec1(-1.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{