#pragma once #include "../../Common/Sizes.hpp" #include "../../Math/AABB.hpp" #include namespace MC::GFX::Util::Primitives { class FaceSet { public: enum Value : U8 { Front = 1 << 0, Back = 1 << 1, Top = 1 << 2, Bottom = 1 << 3, Right = 1 << 4, Left = 1 << 5, }; static constexpr UInt Size = 6; FaceSet() = default; FaceSet(const Value set) : m_set(set) {} operator Value() const { return m_set; } static FaceSet all() { return static_cast(Front | Back | Top | Bottom | Right | Left); } private: Value m_set; }; // A base primitive, could represent lines, triangles, quads primitives, etc. template struct BasePrimitive { std::array, N> positions; std::array, N> normals; std::array indices; }; // Primitive made out of triangles (GL_TRIANGLES) template using Primitive = BasePrimitive; using PlanePrimitive = Primitive<4>; PlanePrimitive plane(AABB aabb, FaceSet face); using BoxPrimitive = Primitive<4 * 6>; BoxPrimitive box(AABB aabb, FaceSet faces = FaceSet::all()); using LineBoxPrimitive = BasePrimitive<4 * 2, 4 * 6>; LineBoxPrimitive line_box(AABB aabb); }