Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions include/vsg/maths/vec2.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ namespace vsg
return *this;
}

friend constexpr t_vec2<T> operator*(const t_vec2<T>& lhs, T rhs)
{
return t_vec2<T>(lhs[0] * rhs, lhs[1] * rhs);
}

friend constexpr t_vec2<T> operator*(T lhs, const t_vec2<T>& rhs)
{
return t_vec2<T>(lhs * rhs[0], lhs * rhs[1]);
}

inline t_vec2& operator/=(value_type rhs)
{
if constexpr (std::is_floating_point_v<value_type>)
Expand Down Expand Up @@ -194,12 +204,6 @@ namespace vsg
return t_vec2<T>(lhs[0] + rhs[0], lhs[1] + rhs[1]);
}

template<typename T>
constexpr t_vec2<T> operator*(const t_vec2<T>& lhs, T rhs)
{
return t_vec2<T>(lhs[0] * rhs, lhs[1] * rhs);
}

template<typename T>
constexpr t_vec2<T> operator*(const t_vec2<T>& lhs, const t_vec2<T>& rhs)
{
Expand Down
16 changes: 10 additions & 6 deletions include/vsg/maths/vec3.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ namespace vsg
return *this;
}

friend constexpr t_vec3<T> operator*(const t_vec3<T>& lhs, T rhs)
{
return t_vec3<T>(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs);
}

friend constexpr t_vec3<T> operator*(T lhs, const t_vec3<T>& rhs)
{
return t_vec3<T>(lhs * rhs[0], lhs * rhs[1], lhs * rhs[2]);
}

inline t_vec3& operator*=(const t_vec3& rhs)
{
value[0] *= rhs.value[0];
Expand Down Expand Up @@ -204,12 +214,6 @@ namespace vsg
return t_vec3<T>(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2]);
}

template<typename T>
constexpr t_vec3<T> operator*(const t_vec3<T>& lhs, T rhs)
{
return t_vec3<T>(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs);
}

template<typename T>
constexpr t_vec3<T> operator*(const t_vec3<T>& lhs, const t_vec3<T>& rhs)
{
Expand Down
16 changes: 10 additions & 6 deletions include/vsg/maths/vec4.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ namespace vsg
return *this;
}

friend constexpr t_vec4<T> operator*(const t_vec4<T>& lhs, T rhs)
{
return t_vec4<T>(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs, lhs[3] * rhs);
}

friend constexpr t_vec4<T> operator*(T lhs, const t_vec4<T>& rhs)
{
return t_vec4<T>(lhs * rhs[0], lhs * rhs[1], lhs * rhs[2], lhs * rhs[3]);
}

inline t_vec4& operator/=(value_type rhs)
{
if constexpr (std::is_floating_point_v<value_type>)
Expand Down Expand Up @@ -236,12 +246,6 @@ namespace vsg
return t_vec4<T>(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2], lhs[3] + rhs[3]);
}

template<typename T>
constexpr t_vec4<T> operator*(const t_vec4<T>& lhs, T rhs)
{
return t_vec4<T>(lhs[0] * rhs, lhs[1] * rhs, lhs[2] * rhs, lhs[3] * rhs);
}

template<typename T>
constexpr t_vec4<T> operator*(const t_vec4<T>& lhs, const t_vec4<T>& rhs)
{
Expand Down
Loading