mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
aux/math: add vec3 overloads for scalar multiplication
This commit is contained in:
parent
11d18bcc8d
commit
8cde257817
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019-2020, Collabora, Ltd.
|
||||
// Copyright 2019-2021, Collabora, Ltd.
|
||||
// Copyright 2020, Nova King.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
|
@ -6,6 +6,7 @@
|
|||
* @brief C vec3 math library.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Nova King <technobaboo@gmail.com>
|
||||
* @author Moses Turner <moses@collabora.com>>
|
||||
*
|
||||
* @see xrt_vec3
|
||||
* @ingroup aux_math
|
||||
|
@ -150,7 +151,13 @@ operator-(const struct xrt_vec3 &a, const struct xrt_vec3 &b)
|
|||
return m_vec3_sub(a, b);
|
||||
}
|
||||
|
||||
static inline struct xrt_vec3 // Until clang-format-11 is on the CI.
|
||||
static inline struct xrt_vec3
|
||||
operator*(const struct xrt_vec3 &a, const float &b)
|
||||
{
|
||||
return m_vec3_mul_scalar(a, b);
|
||||
}
|
||||
|
||||
static inline struct xrt_vec3
|
||||
operator*(const struct xrt_vec3 &a, const struct xrt_vec3 &b)
|
||||
{
|
||||
return m_vec3_mul(a, b);
|
||||
|
@ -180,6 +187,12 @@ operator*=(struct xrt_vec3 &a, const struct xrt_vec3 &b)
|
|||
a = a * b;
|
||||
}
|
||||
|
||||
static inline void
|
||||
operator*=(struct xrt_vec3 &a, const float &b)
|
||||
{
|
||||
a = a * b;
|
||||
}
|
||||
|
||||
static inline void
|
||||
operator/=(struct xrt_vec3 &a, const struct xrt_vec3 &b)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue