summaryrefslogtreecommitdiffhomepage
path: root/draw/quad.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-25 16:37:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-25 16:37:58 +0200
commitf1df7c20129a1f1cc47c47e5731efd10f8e49aeb (patch)
tree0241e953981404e50a5c1fcd6d49f583ecf5995e /draw/quad.hpp
parenta00ac8b5fed9d03cb2b3eafb4cd7d04546e341b1 (diff)
rename in draw/
Diffstat (limited to 'draw/quad.hpp')
-rw-r--r--draw/quad.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/draw/quad.hpp b/draw/quad.hpp
new file mode 100644
index 00000000..050eeb78
--- /dev/null
+++ b/draw/quad.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <array>
+#include <Magnum/Math/Vector2.h>
+#include <Magnum/Math/Vector3.h>
+#include <Magnum/GL/Mesh.h>
+#include <Corrade/Containers/ArrayViewStl.h>
+
+namespace floormat::wireframe {
+
+struct quad final
+{
+ quad(Vector3 center, Vector2 size, float line_width);
+
+ static constexpr std::size_t num_vertices = 4, num_indexes = 0;
+ static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::LineLoop;
+
+ using vertex_array = std::array<Vector3, num_vertices>;
+
+ static ArrayView<const void> make_index_array() { return {}; }
+ vertex_array make_vertex_array() const;
+ void on_draw() const;
+
+private:
+ Vector3 center;
+ Vector2 size;
+ float line_width;
+};
+
+} // namespace floormat::wireframe