From 22eed5aa037529fe595cbb84dbd76a9ffdac612d Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Thu, 5 Feb 2026 01:57:32 +0100 Subject: [PATCH] auto align --- interfaces/Crafter.Math-Vector.cppm | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/interfaces/Crafter.Math-Vector.cppm b/interfaces/Crafter.Math-Vector.cppm index 8a040d2..a3a1c9d 100755 --- a/interfaces/Crafter.Math-Vector.cppm +++ b/interfaces/Crafter.Math-Vector.cppm @@ -79,6 +79,61 @@ namespace Crafter { VectorBase() = default; }; + template + struct VectorBase { + T v[Len]; + }; + + template + struct VectorBase { + union { + T v[1]; + T x; + }; + }; + + template + struct VectorBase { + union { + T v[2]; + struct { + T x, y; + }; + }; + VectorBase(float x, float y): x(x), y(y) { + + } + VectorBase() = default; + }; + + template + struct VectorBase { + union { + T v[3]; + struct { + T x, y, z; + }; + }; + VectorBase(float x, float y, float z): x(x), y(y), z(z) { + + } + VectorBase() = default; + }; + + template + struct VectorBase { + union { + T v[4]; + struct { + T x, y, z, w; + }; + }; + VectorBase(float x, float y, float z, float w): x(x), y(y), z(z), w(w) { + + } + VectorBase() = default; + }; + export template class Vector : public VectorBase { public: