auto align
This commit is contained in:
parent
6f54581dfe
commit
22eed5aa03
1 changed files with 55 additions and 0 deletions
|
|
@ -79,6 +79,61 @@ namespace Crafter {
|
|||
VectorBase<T, 4, Aligment>() = default;
|
||||
};
|
||||
|
||||
template <typename T, std::uint32_t Len>
|
||||
struct VectorBase<T, Len, 0> {
|
||||
T v[Len];
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VectorBase<T, 1, 0> {
|
||||
union {
|
||||
T v[1];
|
||||
T x;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VectorBase<T, 2, 0> {
|
||||
union {
|
||||
T v[2];
|
||||
struct {
|
||||
T x, y;
|
||||
};
|
||||
};
|
||||
VectorBase<T, 2, 0>(float x, float y): x(x), y(y) {
|
||||
|
||||
}
|
||||
VectorBase<T, 2, 0>() = default;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VectorBase<T, 3, 0> {
|
||||
union {
|
||||
T v[3];
|
||||
struct {
|
||||
T x, y, z;
|
||||
};
|
||||
};
|
||||
VectorBase<T, 3, 0>(float x, float y, float z): x(x), y(y), z(z) {
|
||||
|
||||
}
|
||||
VectorBase<T, 3, 0>() = default;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct VectorBase<T, 4, 0> {
|
||||
union {
|
||||
T v[4];
|
||||
struct {
|
||||
T x, y, z, w;
|
||||
};
|
||||
};
|
||||
VectorBase<T, 4, 0>(float x, float y, float z, float w): x(x), y(y), z(z), w(w) {
|
||||
|
||||
}
|
||||
VectorBase<T, 4, 0>() = default;
|
||||
};
|
||||
|
||||
export template <typename T, std::uint32_t Len, std::uint32_t Aligment>
|
||||
class Vector : public VectorBase<T, Len, Aligment> {
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue