|
|
@@ -28,51 +28,22 @@
|
|
|
|
|
|
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)
|
|
|
-# endif
|
|
|
- {}
|
|
|
+# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2()
|
|
|
+# ifndef GLM_FORCE_NO_CTOR_INIT
|
|
|
+ : x(0), y(0)
|
|
|
+# endif
|
|
|
+ {}
|
|
|
|
|
|
- template <typename T, precision P>
|
|
|
- GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec2<T, P> const & v)
|
|
|
- : x(v.x), y(v.y)
|
|
|
- {}
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec2<T, P> const & v)
|
|
|
+ : x(v.x), y(v.y)
|
|
|
+ {}
|
|
|
+# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
|
|
|
|
|
|
template <typename T, precision P>
|
|
|
template <precision Q>
|
|
|
@@ -138,16 +109,63 @@ 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
|
|
|
|
|
|
- template <typename T, precision P>
|
|
|
- GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<T, P> const & v)
|
|
|
- {
|
|
|
- this->x = v.x;
|
|
|
- this->y = v.y;
|
|
|
- return *this;
|
|
|
- }
|
|
|
+# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<T, P> const & v)
|
|
|
+ {
|
|
|
+ this->x = v.x;
|
|
|
+ this->y = v.y;
|
|
|
+ return *this;
|
|
|
+ }
|
|
|
+# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
|
|
|
|
|
|
template <typename T, precision P>
|
|
|
template <typename U>
|