vec4 add, sub, mul and div binary operators use unary operators implementation

This commit is contained in:
Christophe Riccio 2016-05-23 21:20:04 +02:00
parent 276505f409
commit eab004bfe5

View File

@ -722,51 +722,31 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x / scalar,
v.y / scalar,
v.z / scalar,
v.w / scalar);
return tvec4<T, P>(v) /= scalar;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec1<T, P> const & v2)
{
return tvec4<T, P>(
v1.x / v2.x,
v1.y / v2.x,
v1.z / v2.x,
v1.w / v2.x);
return tvec4<T, P>(v1) /= v2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(T scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
scalar / v.x,
scalar / v.y,
scalar / v.z,
scalar / v.w);
return tvec4<T, P>(scalar) /= v;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x / v2.x,
v1.x / v2.y,
v1.x / v2.z,
v1.x / v2.w);
return tvec4<T, P>(v1.x) /= v2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x / v2.x,
v1.y / v2.y,
v1.z / v2.z,
v1.w / v2.w);
return tvec4<T, P>(v1) /= v2;
}
// -- Binary bit operators --