diff options
| author | Mel <einebeere@gmail.com> | 2024-02-06 02:09:17 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-02-06 02:09:17 +0100 |
| commit | c61e09ce986fa99debea040a7c0ac42749ad8052 (patch) | |
| tree | 177b39f7f692723cb4ace8392349f3f8f0d2192b /src/GFX/Util/Primitives.hpp | |
| parent | 091bf9e418ffdcf36e1735ed78d544f3d1b86785 (diff) | |
| download | meowcraft-c61e09ce986fa99debea040a7c0ac42749ad8052.tar.zst meowcraft-c61e09ce986fa99debea040a7c0ac42749ad8052.zip | |
Render outlines on currently targeted blocks
Diffstat (limited to 'src/GFX/Util/Primitives.hpp')
| -rw-r--r-- | src/GFX/Util/Primitives.hpp | 14 |
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); + } |
