public:
// --- Vector2: data structures ---
- union {
+ alignas (16) union {
struct {
MT x;
MT y;
};
MT xy[2];
- } __attribute__((packed));
+ };
// --- Vector2: constructors and deconstructors ---
Vector2()
- : xy{0, 0}
+ : xy{0.0, 0.0}
{
}
bool isNull() const
{
- return x == 0 && y == 0;
+ return x == 0.0 && y == 0.0;
}
MT length() const
Vector3<MT> vector3() const
{
- return {x, y, 0};
+ return {x, y, 0.0};
}
Vector4<MT> vector4() const
{
- return {x, y, 0, 0};
+ return {x, y, 0.0, 0.0};
}
// --- Vector2: static methods ---
static Vector3<MT> toVector3(const Vector2& vec)
{
- return {vec.x, vec.y, 0};
+ return {vec.x, vec.y, 0.0};
}
static Vector4<MT> toVector4(const Vector2& vec)
{
- return {vec.x, vec.y, 0, 0};
+ return {vec.x, vec.y, 0.0, 0.0};
}
};
public:
// --- Vector3: data structures ---
- union {
+ alignas (16) union {
struct {
MT x;
MT y;
MT z;
};
MT xyz[3];
- } __attribute__((packed));
+ };
// --- Vector3: constructors and deconstructors ---
Vector3()
- : xyz{0, 0, 0}
+ : xyz{0.0, 0.0, 0.0}
{
}
}
Vector3(const Vector2<MT>& vec)
- : xyz{vec.x, vec.y, 0}
+ : xyz{vec.x, vec.y, 0.0}
{
}
bool isNull() const
{
- return x == 0 && y == 0 && z == 0;
+ return x == 0.0 && y == 0.0 && z == 0.0;
}
MT length() const
Vector4<MT> vector4() const
{
- return {x, y, z, 0};
+ return {x, y, z, 0.0};
}
// --- Vector3: static methods ---
static Vector4<MT> toVector4(const Vector3& vec)
{
- return {vec.x, vec.y, vec.z, 0};
+ return {vec.x, vec.y, vec.z, 0.0};
}
};
public:
// --- Vector4: data structures ---
- union {
+ alignas (16) union {
struct {
MT x;
MT y;
MT w;
};
MT xyzw[4];
- } __attribute__((packed));
+ };
// --- Vector4: constructors and deconstructors ---
Vector4()
- : xyzw{0, 0, 0, 0}
+ : xyzw{0.0, 0.0, 0.0, 0.0}
{
}
}
Vector4(const Vector2<MT>& vec)
- : xyzw{vec.x, vec.y, 0, 0}
+ : xyzw{vec.x, vec.y, 0.0, 0.0}
{
}
}
Vector4(const Vector3<MT>& vec)
- : xyzw{vec.x, vec.y, vec.z, 0}
+ : xyzw{vec.x, vec.y, vec.z, 0.0}
{
}
bool isNull() const
{
- return x == 0 && y == 0 && z == 0 && w == 0;
+ return x == 0.0 && y == 0.0 && z == 0.0 && w == 0.0;
}
MT length() const