Fixed post in/decrement operators

This commit is contained in:
Christophe Riccio
2013-05-08 21:52:21 +02:00
parent 28c6bba18c
commit 691f04e14f
15 changed files with 273 additions and 105 deletions

View File

@@ -70,6 +70,9 @@ namespace detail
typedef detail::tvec1<uint, highp> highp_uvec1_t;
typedef detail::tvec1<uint, mediump> mediump_uvec1_t;
typedef detail::tvec1<uint, lowp> lowp_uvec1_t;
typedef detail::tvec1<bool, highp> highp_bvec1_t;
typedef detail::tvec1<bool, mediump> mediump_bvec1_t;
typedef detail::tvec1<bool, lowp> lowp_bvec1_t;
/// @addtogroup core_precision
/// @{

View File

@@ -128,8 +128,14 @@ namespace detail
GLM_FUNC_DECL tvec1<T, P> & operator/=(U const & s);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator/=(tvec1<U, P> const & v);
//////////////////////////////////////
// Increment and decrement operators
GLM_FUNC_DECL tvec1<T, P> & operator++();
GLM_FUNC_DECL tvec1<T, P> & operator--();
GLM_FUNC_DECL tvec1<T, P> operator++(int);
GLM_FUNC_DECL tvec1<T, P> operator--(int);
//////////////////////////////////////
// Unary bit operators

View File

@@ -266,6 +266,9 @@ namespace detail
return *this;
}
//////////////////////////////////////
// Increment and decrement operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator++()
{
@@ -280,6 +283,22 @@ namespace detail
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> tvec1<T, P>::operator++(int)
{
tvec1<T, P> Result(*this);
++*this;
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> tvec1<T, P>::operator--(int)
{
tvec1<T, P> Result(*this);
--*this;
return Result;
}
//////////////////////////////////////
// Boolean operators

View File

@@ -172,8 +172,14 @@ namespace detail
GLM_FUNC_DECL tvec2<T, P> & operator/=(U const & s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec2<U, P> const & v);
//////////////////////////////////////
// Increment and decrement operators
GLM_FUNC_DECL tvec2<T, P> & operator++();
GLM_FUNC_DECL tvec2<T, P> & operator--();
GLM_FUNC_DECL tvec2<T, P> operator++(int);
GLM_FUNC_DECL tvec2<T, P> operator--(int);
//////////////////////////////////////
// Unary bit operators

View File

@@ -290,6 +290,9 @@ namespace detail
return *this;
}
//////////////////////////////////////
// Increment and decrement operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator++()
{
@@ -306,6 +309,22 @@ namespace detail
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator++(int)
{
tvec2<T, P> Result(*this);
++*this;
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator--(int)
{
tvec2<T, P> Result(*this);
--*this;
return Result;
}
//////////////////////////////////////
// Boolean operators
@@ -704,30 +723,6 @@ namespace detail
-v.y);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator++
(
tvec2<T, P> const & v,
int
)
{
return tvec2<T, P>(
v.x + T(1),
v.y + T(1));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator--
(
tvec2<T, P> const & v,
int
)
{
return tvec2<T, P>(
v.x - T(1),
v.y - T(1));
}
//////////////////////////////////////
// Binary bit operators

View File

@@ -196,8 +196,14 @@ namespace detail
GLM_FUNC_DECL tvec3<T, P> & operator/=(U const & s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v);
//////////////////////////////////////
// Increment and decrement operators
GLM_FUNC_DECL tvec3<T, P> & operator++();
GLM_FUNC_DECL tvec3<T, P> & operator--();
GLM_FUNC_DECL tvec3<T, P> operator++(int);
GLM_FUNC_DECL tvec3<T, P> operator--(int);
//////////////////////////////////////
// Unary bit operators

View File

@@ -349,6 +349,9 @@ namespace detail
return *this;
}
//////////////////////////////////////
// Increment and decrement operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator++()
{
@@ -367,6 +370,22 @@ namespace detail
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec3<T, P>::operator++(int)
{
tvec3<T, P> Result(*this);
++*this;
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec3<T, P>::operator--(int)
{
tvec3<T, P> Result(*this);
--*this;
return Result;
}
//////////////////////////////////////
// Boolean operators
@@ -805,32 +824,6 @@ namespace detail
-v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator++
(
tvec3<T, P> const & v,
int
)
{
return tvec3<T, P>(
v.x + T(1),
v.y + T(1),
v.z + T(1));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator--
(
tvec3<T, P> const & v,
int
)
{
return tvec3<T, P>(
v.x - T(1),
v.y - T(1),
v.z - T(1));
}
//////////////////////////////////////
// Binary bit operators

View File

@@ -251,8 +251,14 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> & operator/=(U const & s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v);
//////////////////////////////////////
// Increment and decrement operators
GLM_FUNC_DECL tvec4<T, P> & operator++();
GLM_FUNC_DECL tvec4<T, P> & operator--();
GLM_FUNC_DECL tvec4<T, P> operator++(int);
GLM_FUNC_DECL tvec4<T, P> operator--(int);
//////////////////////////////////////
// Unary bit operators

View File

@@ -504,6 +504,9 @@ namespace detail
return *this;
}
//////////////////////////////////////
// Increment and decrement operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator++()
{
@@ -524,6 +527,22 @@ namespace detail
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec4<T, P>::operator++(int)
{
tvec4<T, P> Result(*this);
++*this;
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec4<T, P>::operator--(int)
{
tvec4<T, P> Result(*this);
--*this;
return Result;
}
//////////////////////////////////////
// Unary bit operators
@@ -980,36 +999,6 @@ namespace detail
-v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator++
(
tvec4<T, P> const & v,
int
)
{
typename tvec4<T, P>::value_type One(1);
return tvec4<T, P>(
v.x + One,
v.y + One,
v.z + One,
v.w + One);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator--
(
tvec4<T, P> const & v,
int
)
{
typename tvec4<T, P>::value_type One(1);
return tvec4<T, P>(
v.x - One,
v.y - One,
v.z - One,
v.w - One);
}
//////////////////////////////////////
// Boolean operators

View File

@@ -50,59 +50,88 @@ namespace glm
//! 1 component vector of high precision floating-point numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::highp_vec1_t highp_vec1;
typedef highp_vec1_t highp_vec1;
//! 1 component vector of medium precision floating-point numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::mediump_vec1_t mediump_vec1;
typedef mediump_vec1_t mediump_vec1;
//! 1 component vector of low precision floating-point numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::lowp_vec1_t lowp_vec1;
typedef lowp_vec1_t lowp_vec1;
//! 1 component vector of high precision signed integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::highp_ivec1_t highp_ivec1;
typedef highp_ivec1_t highp_ivec1;
//! 1 component vector of medium precision signed integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::mediump_ivec1_t mediump_ivec1;
typedef mediump_ivec1_t mediump_ivec1;
//! 1 component vector of low precision signed integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::lowp_ivec1_t lowp_ivec1;
typedef lowp_ivec1_t lowp_ivec1;
//! 1 component vector of high precision unsigned integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::highp_uvec1_t highp_uvec1;
typedef highp_uvec1_t highp_uvec1;
//! 1 component vector of medium precision unsigned integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::mediump_uvec1_t mediump_uvec1;
typedef mediump_uvec1_t mediump_uvec1;
//! 1 component vector of low precision unsigned integer numbers.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef detail::lowp_uvec1_t lowp_uvec1;
typedef lowp_uvec1_t lowp_uvec1;
//! 1 component vector of high precision boolean.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef highp_bvec1_t highp_bvec1;
//! 1 component vector of medium precision boolean.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef mediump_bvec1_t mediump_bvec1;
//! 1 component vector of low precision boolean.
//! There is no guarantee on the actual precision.
//! From GLM_GTX_vec1 extension.
typedef lowp_bvec1_t lowp_bvec1;
//////////////////////////
// vec1 definition
//! 1 component vector of boolean.
//! From GLM_GTX_vec1 extension.
typedef detail::tvec1<bool> bvec1;
#if(defined(GLM_PRECISION_HIGHP_BOOL))
typedef highp_bvec1 bvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
typedef mediump_bvec1 bvec1;
#elif(defined(GLM_PRECISION_LOWP_BOOL))
typedef lowp_bvec1 bvec1;
#else
/// 1 component vector of boolean.
/// From GLM_GTX_vec1 extension.
typedef highp_bvec1 bvec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_FLOAT))
typedef highp_vec1 vec1;
typedef highp_vec1 vec1;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef mediump_vec1 vec1;
#elif(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_vec1 vec1;
typedef lowp_vec1 vec1;
#else
//! 1 component vector of floating-point numbers.
//! From GLM_GTX_vec1 extension.
typedef mediump_vec1 vec1;
/// 1 component vector of floating-point numbers.
/// From GLM_GTX_vec1 extension.
typedef highp_vec1 vec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_INT))
@@ -112,9 +141,9 @@ namespace glm
#elif(defined(GLM_PRECISION_LOWP_INT))
typedef lowp_ivec1 ivec1;
#else
//! 1 component vector of signed integer numbers.
//! From GLM_GTX_vec1 extension.
typedef mediump_ivec1 ivec1;
/// 1 component vector of signed integer numbers.
/// From GLM_GTX_vec1 extension.
typedef highp_ivec1 ivec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_UINT))
@@ -124,9 +153,9 @@ namespace glm
#elif(defined(GLM_PRECISION_LOWP_UINT))
typedef lowp_uvec1 uvec1;
#else
//! 1 component vector of unsigned integer numbers.
//! From GLM_GTX_vec1 extension.
typedef mediump_uvec1 uvec1;
/// 1 component vector of unsigned integer numbers.
/// From GLM_GTX_vec1 extension.
typedef highp_uvec1 uvec1;
#endif//GLM_PRECISION
}// namespace glm