diff options
| author | K. S. Ernest (iFire) Lee <fire@users.noreply.github.com> | 2024-04-08 07:51:34 -0700 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-03 00:58:27 +0200 |
| commit | f9b488508ccc294db03d427c15c182864fae74de (patch) | |
| tree | 4d48dd7b8b85c219faf6ecb8a43a9c3d57f71b38 /core/math | |
| parent | b9e022302aa4a5d97f8b25a1db809e64b46b6f96 (diff) | |
| download | redot-engine-f9b488508ccc294db03d427c15c182864fae74de.tar.gz | |
Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'core/math')
| -rw-r--r-- | core/math/vector4.cpp | 6 | ||||
| -rw-r--r-- | core/math/vector4.h | 30 |
2 files changed, 15 insertions, 21 deletions
diff --git a/core/math/vector4.cpp b/core/math/vector4.cpp index 555ca6c66c..b6b914f36d 100644 --- a/core/math/vector4.cpp +++ b/core/math/vector4.cpp @@ -30,6 +30,8 @@ #include "vector4.h" +#include "core/math/math_funcs.h" +#include "core/math/vector4i.h" #include "core/string/ustring.h" Vector4::Axis Vector4::min_axis_index() const { @@ -215,3 +217,7 @@ Vector4::operator String() const { } static_assert(sizeof(Vector4) == 4 * sizeof(real_t)); + +Vector4::operator Vector4i() const { + return Vector4i(x, y, z, w); +} diff --git a/core/math/vector4.h b/core/math/vector4.h index 52699c6281..f69b4752bb 100644 --- a/core/math/vector4.h +++ b/core/math/vector4.h @@ -32,9 +32,11 @@ #define VECTOR4_H #include "core/error/error_macros.h" -#include "core/math/math_funcs.h" +#include "core/math/math_defs.h" +#include "core/typedefs.h" class String; +struct Vector4i; struct _NO_DISCARD_ Vector4 { static const int AXIS_COUNT = 4; @@ -140,28 +142,14 @@ struct _NO_DISCARD_ Vector4 { _FORCE_INLINE_ bool operator<=(const Vector4 &p_vec4) const; operator String() const; + operator Vector4i() const; _FORCE_INLINE_ Vector4() {} - - _FORCE_INLINE_ Vector4(real_t p_x, real_t p_y, real_t p_z, real_t p_w) : - x(p_x), - y(p_y), - z(p_z), - w(p_w) { - } - - Vector4(const Vector4 &p_vec4) : - x(p_vec4.x), - y(p_vec4.y), - z(p_vec4.z), - w(p_vec4.w) { - } - - void operator=(const Vector4 &p_vec4) { - x = p_vec4.x; - y = p_vec4.y; - z = p_vec4.z; - w = p_vec4.w; + _FORCE_INLINE_ Vector4(real_t p_x, real_t p_y, real_t p_z, real_t p_w) { + x = p_x; + y = p_y; + z = p_z; + w = p_w; } }; |
