|
|
|
@ -32,44 +32,13 @@ |
|
|
|
|
|
|
|
|
|
namespace glm |
|
|
|
|
{ |
|
|
|
|
#ifdef 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 |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](length_t i) |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](length_t i) const |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////// |
|
|
|
|
// Implicit basic constructors |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2() |
|
|
|
|
# ifndef GLM_FORCE_NO_CTOR_INIT |
|
|
|
|
: x(0), y(0) |
|
|
|
|
: x(0), y(0) |
|
|
|
|
# endif |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
@ -92,8 +61,8 @@ namespace glm |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & s1, T const & s2) |
|
|
|
|
: x(s1), y(s2) |
|
|
|
|
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & a, T const & b) |
|
|
|
|
: x(a), y(b) |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////// |
|
|
|
@ -137,6 +106,51 @@ namespace glm |
|
|
|
|
, y(static_cast<T>(v.y)) |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////// |
|
|
|
|
// Component accesses |
|
|
|
|
|
|
|
|
|
# ifdef GLM_FORCE_SIZE_FUNC |
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::size() const |
|
|
|
|
{ |
|
|
|
|
return 2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i) |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i) const |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
# else |
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::length_type tvec2<T, P>::length() const |
|
|
|
|
{ |
|
|
|
|
return 2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const |
|
|
|
|
{ |
|
|
|
|
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this)); |
|
|
|
|
return (&x)[i]; |
|
|
|
|
} |
|
|
|
|
# endif//GLM_FORCE_SIZE_FUNC |
|
|
|
|
|
|
|
|
|
////////////////////////////////////// |
|
|
|
|
// Unary arithmetic operators |
|
|
|
|
|
|
|
|
|