summary refs log tree commit diff
path: root/src/GFX/Util/Primitives.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GFX/Util/Primitives.hpp')
-rw-r--r--src/GFX/Util/Primitives.hpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/GFX/Util/Primitives.hpp b/src/GFX/Util/Primitives.hpp
index a267130..6654da6 100644
--- a/src/GFX/Util/Primitives.hpp
+++ b/src/GFX/Util/Primitives.hpp
@@ -31,17 +31,25 @@ private:
     Value m_set;
 };
 
-template <uint N>
-struct Primitive {
+// A base primitive, could represent lines, triangles, quads primitives, etc.
+template <uint N, uint I>
+struct BasePrimitive {
     std::array<Vector<3, F32>, N> positions;
     std::array<Vector<3, F32>, N> normals;
-    std::array<U32, N + N / 2> indices;
+    std::array<U32, I> indices;
 };
 
+// Primitive made out of triangles (GL_TRIANGLES)
+template <uint N>
+using Primitive = BasePrimitive<N, N + N / 2>;
+
 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);
+
 }