summaryrefslogtreecommitdiff
path: root/core/math/vector3i.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-02-03 22:16:58 +0100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2022-02-06 13:34:41 +0100
commit8c7268664da7ef98f802ec90fa2ba17b4d695847 (patch)
treeb8f3bb21e79375402ceb68ed981693eb5189592d /core/math/vector3i.h
parentfd0d2dcabf5b7418691b693cd01baecbb69fdeb9 (diff)
Fix integer vector mul/div operators and bindings.
* Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively. * Create specializations to allow proper bindings. This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
Diffstat (limited to 'core/math/vector3i.h')
-rw-r--r--core/math/vector3i.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/math/vector3i.h b/core/math/vector3i.h
index 1564ee9173..d166de80aa 100644
--- a/core/math/vector3i.h
+++ b/core/math/vector3i.h
@@ -194,6 +194,12 @@ Vector3i &Vector3i::operator*=(const int32_t p_scalar) {
return *this;
}
+Vector3i Vector3i::operator*(const int32_t p_scalar) const {
+ return Vector3i(x * p_scalar, y * p_scalar, z * p_scalar);
+}
+
+// Multiplication operators required to workaround issues with LLVM using implicit conversion.
+
_FORCE_INLINE_ Vector3i operator*(const int32_t p_scalar, const Vector3i &p_vector) {
return p_vector * p_scalar;
}
@@ -210,10 +216,6 @@ _FORCE_INLINE_ Vector3i operator*(const double p_scalar, const Vector3i &p_vecto
return p_vector * p_scalar;
}
-Vector3i Vector3i::operator*(const int32_t p_scalar) const {
- return Vector3i(x * p_scalar, y * p_scalar, z * p_scalar);
-}
-
Vector3i &Vector3i::operator/=(const int32_t p_scalar) {
x /= p_scalar;
y /= p_scalar;