The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux/math: add vec3 overloads for scalar multiplication

+15 -2
+15 -2
src/xrt/auxiliary/math/m_vec3.h
··· 1 - // Copyright 2019-2020, Collabora, Ltd. 1 + // Copyright 2019-2021, Collabora, Ltd. 2 2 // Copyright 2020, Nova King. 3 3 // SPDX-License-Identifier: BSL-1.0 4 4 /*! ··· 6 6 * @brief C vec3 math library. 7 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 8 * @author Nova King <technobaboo@gmail.com> 9 + * @author Moses Turner <moses@collabora.com>> 9 10 * 10 11 * @see xrt_vec3 11 12 * @ingroup aux_math ··· 150 151 return m_vec3_sub(a, b); 151 152 } 152 153 153 - static inline struct xrt_vec3 // Until clang-format-11 is on the CI. 154 + static inline struct xrt_vec3 155 + operator*(const struct xrt_vec3 &a, const float &b) 156 + { 157 + return m_vec3_mul_scalar(a, b); 158 + } 159 + 160 + static inline struct xrt_vec3 154 161 operator*(const struct xrt_vec3 &a, const struct xrt_vec3 &b) 155 162 { 156 163 return m_vec3_mul(a, b); ··· 176 183 177 184 static inline void 178 185 operator*=(struct xrt_vec3 &a, const struct xrt_vec3 &b) 186 + { 187 + a = a * b; 188 + } 189 + 190 + static inline void 191 + operator*=(struct xrt_vec3 &a, const float &b) 179 192 { 180 193 a = a * b; 181 194 }