diff options
Diffstat (limited to 'core/math/quat.h')
-rw-r--r-- | core/math/quat.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/math/quat.h b/core/math/quat.h index 617bffd908..1ab64a2655 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -40,8 +40,22 @@ class Quat { public: - real_t x = 0, y = 0, z = 0, w = 1; - + union { + struct { + real_t x; + real_t y; + real_t z; + real_t w; + }; + real_t components[4] = { 0, 0, 0, 1.0 }; + }; + + _FORCE_INLINE_ real_t &operator[](int idx) { + return components[idx]; + } + _FORCE_INLINE_ const real_t &operator[](int idx) const { + return components[idx]; + } _FORCE_INLINE_ real_t length_squared() const; bool is_equal_approx(const Quat &p_quat) const; real_t length() const; |