Added per feature headers and added length_t and GLM_FORCE_SIZE_T_LENGTH
This commit is contained in:
parent
5ef31a6e18
commit
ca2463d5f2
@ -726,6 +726,30 @@
|
||||
# endif
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Length type
|
||||
|
||||
// User defines: GLM_FORCE_SIZE_T_LENGTH
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if defined(GLM_FORCE_SIZE_T_LENGTH)
|
||||
typedef std::size_t length_t;
|
||||
#else
|
||||
typedef int length_t;
|
||||
#endif
|
||||
}//namespace glm
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
|
||||
# define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
|
||||
# if defined(GLM_FORCE_SIZE_T_LENGTH)
|
||||
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
|
||||
# else
|
||||
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
|
||||
# pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
|
||||
# endif
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Qualifiers
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
public:
|
||||
// Implementation detail
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::size_type tmat2x2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::size_type tmat2x3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::size_type tmat2x4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::size_type tmat3x2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
public:
|
||||
/// Implementation detail
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::size_type tmat3x3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::size_type tmat3x4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::size_type tmat4x2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
private:
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::size_type tmat4x3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace detail
|
||||
static GLM_FUNC_DECL size_type col_size();
|
||||
static GLM_FUNC_DECL size_type row_size();
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
public:
|
||||
/// Implementation detail
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::size_type tmat4x4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
@ -71,8 +71,8 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](int i);
|
||||
GLM_FUNC_DECL T const & operator[](int i) const;
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tvec1<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1<T, P>::length() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -39,14 +39,14 @@ namespace detail
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](int i)
|
||||
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](length_t i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](int i) const
|
||||
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](length_t i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
|
@ -62,7 +62,7 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
@ -96,8 +96,8 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](int i);
|
||||
GLM_FUNC_DECL T const & operator[](int i) const;
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
@ -39,14 +39,14 @@ namespace detail
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](int i)
|
||||
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](length_t i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](int i) const
|
||||
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](length_t i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
|
@ -62,7 +62,7 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
@ -97,8 +97,8 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](int i);
|
||||
GLM_FUNC_DECL T const & operator[](int i) const;
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::size_type tvec3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
@ -39,14 +39,14 @@ namespace detail
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](int i)
|
||||
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](length_t i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](int i) const
|
||||
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](length_t i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
|
@ -63,7 +63,7 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
@ -99,8 +99,8 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](int i);
|
||||
GLM_FUNC_DECL T const & operator[](int i) const;
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::size_type tvec4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@ -39,14 +39,14 @@ namespace detail
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](int i)
|
||||
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](length_t i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](int i) const
|
||||
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](length_t i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
|
@ -56,6 +56,7 @@ GLM 0.9.5.0: 2013-12-25
|
||||
- Clean up compiler detection code for unsupported compilers
|
||||
- Uses C++ casts
|
||||
- Fixed .length() that should return a int and not a size_t
|
||||
- Added GLM_FORCE_SIZE_T_LENGTH and glm::length_t
|
||||
- Removed unnecessary conversions
|
||||
- Optimized packing and unpacking functions
|
||||
- Removed the normalization of the up argument of lookAt function (#114)
|
||||
|
Loading…
Reference in New Issue
Block a user