mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Added GLM_FORCE_SIZE_FUNC to replace .length() by .size() #245
This commit is contained in:
parent
03a01880b0
commit
291708ce07
@ -29,6 +29,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Version
|
||||
@ -761,7 +762,8 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if defined(GLM_FORCE_SIZE_T_LENGTH)
|
||||
typedef std::size_t size_t;
|
||||
#if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
|
||||
typedef std::size_t length_t;
|
||||
#else
|
||||
typedef int length_t;
|
||||
|
@ -47,7 +47,11 @@ namespace glm
|
||||
typedef tmat2x2<T, P> type;
|
||||
typedef tmat2x2<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
|
||||
|
@ -46,8 +46,19 @@ namespace detail
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const {return 2;}
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x2<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -48,7 +48,11 @@ namespace glm
|
||||
typedef tmat2x3<T, P> type;
|
||||
typedef tmat3x2<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x3<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -48,7 +48,11 @@ namespace glm
|
||||
typedef tmat2x4<T, P> type;
|
||||
typedef tmat4x2<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x4<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -48,7 +48,11 @@ namespace glm
|
||||
typedef tmat3x2<T, P> type;
|
||||
typedef tmat2x3<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x2<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -47,7 +47,11 @@ namespace glm
|
||||
typedef tmat3x3<T, P> type;
|
||||
typedef tmat3x3<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
|
||||
|
@ -52,11 +52,19 @@ namespace detail
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x3<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -42,13 +42,17 @@ namespace glm
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef size_t size_type;
|
||||
typedef tvec4<T, P> col_type;
|
||||
typedef tvec3<T, P> row_type;
|
||||
typedef tmat3x4<T, P> type;
|
||||
typedef tmat4x3<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x4<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -48,7 +48,11 @@ namespace glm
|
||||
typedef tmat4x2<T, P> type;
|
||||
typedef tmat2x4<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x2<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -48,7 +48,11 @@ namespace glm
|
||||
typedef tmat4x3<T, P> type;
|
||||
typedef tmat3x4<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x3<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
@ -699,4 +707,3 @@ namespace glm
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
} //namespace glm
|
||||
|
||||
|
@ -47,7 +47,11 @@ namespace glm
|
||||
typedef tmat4x4<T, P> type;
|
||||
typedef tmat4x4<T, P> transpose_type;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
|
||||
|
@ -88,11 +88,19 @@ namespace detail
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x4<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -56,7 +56,13 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec1<T, P>::size() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1<T, P>::length() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -57,7 +57,13 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec2<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -57,7 +57,13 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec3<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -80,7 +80,13 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of the vector
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -28,11 +28,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec4<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
@ -66,7 +66,13 @@ namespace glm
|
||||
public:
|
||||
T x, y, z, w;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of a quaternion
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of a quaternion
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tquat();
|
||||
|
@ -45,11 +45,19 @@ namespace detail
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tquat<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat() :
|
||||
|
@ -64,7 +64,13 @@ namespace glm
|
||||
public:
|
||||
glm::tquat<T, P> real, dual;
|
||||
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of a dual quaternion
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
#else
|
||||
/// Return the count of components of a dual quaternion
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
#endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tdualquat();
|
||||
|
@ -31,11 +31,19 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tdualquat<T, P>::size() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
#else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat<T, P>::length() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat() :
|
||||
|
@ -57,7 +57,7 @@ namespace glm
|
||||
/// @param y A second vector
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
/// @see gtx_rotate_vector
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> slerp(
|
||||
tvec3<T, P> const & x,
|
||||
|
@ -60,6 +60,7 @@ GLM 0.9.6.0: 2014-XX-XX
|
||||
- Added GTX_range for C++ 11 compiler only #240
|
||||
- Added Added closestPointOnLine function for tvec2 to GTX_closest_point #238
|
||||
- Moved template types from 'detail' to 'glm' namespace #239, #244
|
||||
- Added GLM_FORCE_SIZE_FUNC to replace .length() by .size() #245
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.4: 2014-06-21
|
||||
|
Loading…
Reference in New Issue
Block a user