diff --git a/ostd/vecmath.hh b/ostd/vecmath.hh new file mode 100644 index 0000000..e6b1f1c --- /dev/null +++ b/ostd/vecmath.hh @@ -0,0 +1,59 @@ +/* Vector math for OctaSTD. + * + * This file is part of OctaSTD. See COPYING.md for futher information. + */ + +#ifndef OSTD_VECMATH_HH +#define OSTD_VECMATH_HH + +#include "ostd/types.hh" + +namespace ostd { + +template +struct Vec2 { + union { + struct { T x, y; }; + T value[2]; + }; +}; + +using Vec2f = Vec2; +using Vec2d = Vec2; +using Vec2b = Vec2; +using Vec2s = Vec2; +using Vec2i = Vec2; + +template +struct Vec3 { + union { + struct { T x, y, z; }; + struct { T r, g, b; }; + T value[3]; + }; +}; + +using Vec3f = Vec3; +using Vec3d = Vec3; +using Vec3b = Vec3; +using Vec3s = Vec3; +using Vec3i = Vec3; + +template +struct Vec4 { + union { + struct { T x, y, z, w; }; + struct { T r, g, b, a; }; + T value[4]; + }; +}; + +using Vec4f = Vec4; +using Vec4d = Vec4; +using Vec4b = Vec4; +using Vec4s = Vec4; +using Vec4i = Vec4; + +} /* namespace ostd */ + +#endif \ No newline at end of file