|
|
|
@ -31,7 +31,7 @@ namespace glm
|
|
|
|
|
}
|
|
|
|
|
template <typename... T>
|
|
|
|
|
consteval bool NotSameArithmeticTypes() {
|
|
|
|
|
return ( (!(std::is_integral_v<T> || std::floating_point_v<T>) || ...) || !(SameArithmeticTypes<T...>()) );
|
|
|
|
|
return ( (!(std::is_integral_v<T> || std::is_floating_point_v<T>) || ...) || !(SameArithmeticTypes<T...>()) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
@ -96,6 +96,8 @@ namespace glm
|
|
|
|
|
}
|
|
|
|
|
#include "element.hpp"
|
|
|
|
|
#include "simd_helpers.inl"
|
|
|
|
|
#include "../compute_vector_relational.hpp"
|
|
|
|
|
#include "../compute_vector_decl.hpp"
|
|
|
|
|
namespace glm
|
|
|
|
|
{
|
|
|
|
|
template<length_t L, typename T, qualifier Q>
|
|
|
|
@ -117,26 +119,24 @@ namespace glm
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// -- Component Access --
|
|
|
|
|
static constexpr length_t length(){ return L; }
|
|
|
|
|
static consteval length_t length(){ return L; }
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR decltype(auto) operator[](length_t i)
|
|
|
|
|
inline GLM_CONSTEXPR T& operator[](length_t i)
|
|
|
|
|
{
|
|
|
|
|
if (std::is_constant_evaluated()) {
|
|
|
|
|
static_assert(i <= length());
|
|
|
|
|
} else {
|
|
|
|
|
GLM_ASSERT_LENGTH(i, this->length());
|
|
|
|
|
if (!std::is_constant_evaluated()) {
|
|
|
|
|
GLM_ASSERT_LENGTH(i, L);
|
|
|
|
|
}
|
|
|
|
|
switch (i)
|
|
|
|
|
switch (std::max(i, length()))
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case 0:
|
|
|
|
|
return x;
|
|
|
|
|
case 1:
|
|
|
|
|
return y;
|
|
|
|
|
return y.t;
|
|
|
|
|
case 2:
|
|
|
|
|
return z;
|
|
|
|
|
return z.t;
|
|
|
|
|
case 3:
|
|
|
|
|
return w;
|
|
|
|
|
return w.t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ namespace glm
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
struct {
|
|
|
|
|
union { E<1> x, r, s; };
|
|
|
|
|
union { T x, r, s; };
|
|
|
|
|
GLM_N union { GLM_N E<2> y; GLM_N E<2> g; GLM_N E<2> t; };
|
|
|
|
|
GLM_N union { GLM_N E<3> z; GLM_N E<3> b; GLM_N E<3> p; };
|
|
|
|
|
GLM_N union { GLM_N E<4> w; GLM_N E<4> a; GLM_N E<4> q; };
|
|
|
|
@ -205,9 +205,9 @@ namespace glm
|
|
|
|
|
constexpr auto ctor(VecGetter vecGetter) {
|
|
|
|
|
if (std::is_constant_evaluated()) {
|
|
|
|
|
DataArray a = {};
|
|
|
|
|
constexpr auto v = vecGetter();
|
|
|
|
|
auto v = vecGetter();
|
|
|
|
|
constexpr length_t vL = v.length();
|
|
|
|
|
using ArrX = VecDataArray<vL, decltype(v)::value_type, decltype(v)::k_qual>;
|
|
|
|
|
using ArrX = VecDataArray<vL, typename decltype(v)::value_type, decltype(v)::k_qual>;
|
|
|
|
|
ArrX ax = std::bit_cast<ArrX>(v.data);
|
|
|
|
|
for (length_t i = 0; i < v.length(); i++) {
|
|
|
|
|
a.p[i] = (T)ax.p[i];
|
|
|
|
@ -242,12 +242,13 @@ namespace glm
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return var_t{RetPair{a, i}};
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
constexpr vec(arithmetic auto scalar) : data{ [scalar](){ auto s = [scalar](){ return scalar; }; return ctor_scalar(s); }() } {}
|
|
|
|
|
constexpr vec() : data{} {}
|
|
|
|
|
constexpr vec(arithmetic auto scalar) : data{ [scalar,this](){ auto s = [scalar](){ return scalar; }; return ctor_scalar(s); }() } {}
|
|
|
|
|
|
|
|
|
|
template <length_t Lx, typename Tx, qualifier Qx>
|
|
|
|
|
constexpr vec(vec<Lx, Tx, Qx> v) : data{ [v](){ auto vv = [v](){ return v; }; return ctor(vv); }() } {}
|
|
|
|
|
constexpr vec(vec<Lx, Tx, Qx> v) : data{ [v, this](){ auto vv = [v](){ return v; }; return ctor(vv); }() } {}
|
|
|
|
|
|
|
|
|
|
template <arithmetic... Scalar> requires (sizeof...(Scalar) == L)
|
|
|
|
|
constexpr vec(Scalar... scalar)
|
|
|
|
@ -274,7 +275,7 @@ namespace glm
|
|
|
|
|
length_t i = 0;
|
|
|
|
|
using var_t = std::variant<RetPair, VecOrScalar...>;
|
|
|
|
|
for (auto var_vs : std::array<var_t, sizeof...(vecOrScalar)>{ vecOrScalar... } ) {
|
|
|
|
|
auto visitee = [i](auto&& arg) -> var_t { return ctor_mixed_constexpr_single<var_t>(arg, i); };
|
|
|
|
|
auto visitee = [i](auto&& arg) -> var_t { return ctor_mixed_constexpr_single.template operator()<var_t>(arg, i); };
|
|
|
|
|
RetPair pair = std::get<RetPair>(std::visit(visitee, var_vs));
|
|
|
|
|
for (length_t j = pair.i; j < i+pair.i; j++) {
|
|
|
|
|
a.p[j] = pair.a.p[j];
|
|
|
|
@ -288,84 +289,84 @@ namespace glm
|
|
|
|
|
|
|
|
|
|
// -- Unary arithmetic operators --
|
|
|
|
|
template <length_t Lx, typename Tx, qualifier Qx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator=(vec<Lx, Tx, Qx> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator=(vec<Lx, Tx, Qx> v)
|
|
|
|
|
{
|
|
|
|
|
*this = vec<L, T, Q>(v);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q>& operator+=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q>& operator+=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L T, Q>(v)));
|
|
|
|
|
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -- Increment and decrement operators --
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator++()
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator++()
|
|
|
|
|
{
|
|
|
|
|
++this->x;
|
|
|
|
|
++this->y;
|
|
|
|
@ -374,7 +375,7 @@ namespace glm
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator--()
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator--()
|
|
|
|
|
{
|
|
|
|
|
--this->x;
|
|
|
|
|
--this->y;
|
|
|
|
@ -383,14 +384,14 @@ namespace glm
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator++(int)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator++(int)
|
|
|
|
|
{
|
|
|
|
|
vec<L, T, Q> Result(*this);
|
|
|
|
|
++*this;
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator--(int)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator--(int)
|
|
|
|
|
{
|
|
|
|
|
vec<L, T, Q> Result(*this);
|
|
|
|
|
--*this;
|
|
|
|
@ -399,227 +400,227 @@ namespace glm
|
|
|
|
|
|
|
|
|
|
// -- Unary bit operators --
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<1, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<1, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<L, Tx, Q> v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<L, Tx, Q> v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<1, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<1, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<L, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<L, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<1, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<1, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<L, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<L, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<1, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<1, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<L, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<L, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(arithmetic auto scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(arithmetic auto scalar)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<1, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<1, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename Tx>
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<L, Tx, Q> const& v)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<L, Tx, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -- Unary constant operators --
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+()
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator+()
|
|
|
|
|
{
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-()
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator-()
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(0) -= *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -- Binary arithmetic operators --
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) += scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v2)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) += v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) += scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v2) += v1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<L, T, Q> v2)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<L, T, Q> v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) += v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) -= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v2)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) -= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) -= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) -= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) -= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) *= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v2)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) *= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) *= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v2) *= v1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) *= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) /= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v2)
|
|
|
|
|
inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(*this) /= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) /= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) /= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) /= v2;
|
|
|
|
|
}
|
|
|
|
@ -627,212 +628,213 @@ namespace glm
|
|
|
|
|
// -- Binary bit operators --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) %= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) %= v2.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) %= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<1, T, Q> const& scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<1, T, Q> const& scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar.x) %= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) %= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) &= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, vec<1, T, Q> const& scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, vec<1, T, Q> const& scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) &= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) &= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) &= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) &= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) |= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) |= v2.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) |= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) |= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) |= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) ^= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) ^= v2.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) ^= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) ^= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) ^= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) <<= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) <<= v2.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) <<= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) <<= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) <<= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v, T scalar)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v) >>= scalar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) >>= v2.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(T scalar, vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(scalar) >>= v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1.x) >>= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, T, Q>(v1) >>= v2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator~(vec<L, T, Q> const& v)
|
|
|
|
|
friend inline GLM_CONSTEXPR vec<L, T, Q> operator~(vec<L, T, Q> const& v)
|
|
|
|
|
{
|
|
|
|
|
return detail::compute_vec_bitwise_not<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -- Boolean operators --
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR bool operator==(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return detail::compute_vec_equal<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
friend inline GLM_CONSTEXPR bool operator!=(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return detail::compute_vec_nequal<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> operator&&(vec<L, bool, Q> const& v1, vec<L, bool, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, bool, Q>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> operator||(vec<L, bool, Q> const& v1, vec<L, bool, Q> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<L, bool, Q>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <length_t Lx, typename Tx, qualifier Qx> requires (std::is_same_v<Tx, bool>)
|
|
|
|
|
inline GLM_CONSTEXPR vec<Lx, bool, Qx> operator&&(vec<Lx, Tx, Qx> const& v1, vec<Lx, Tx, Qx> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<Lx, bool, Qx>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
|
|
|
|
|
}
|
|
|
|
|
template <length_t Lx, typename Tx, qualifier Qx> requires (std::is_same_v<Tx, bool>)
|
|
|
|
|
inline GLM_CONSTEXPR vec<Lx, bool, Qx> operator||(vec<Lx, bool, Qx> const& v1, vec<Lx, bool, Qx> const& v2)
|
|
|
|
|
{
|
|
|
|
|
return vec<Lx, bool, Qx>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
|
|
|
|
|
}
|
|
|
|
|
}
|