summaryrefslogtreecommitdiffhomepage
path: root/draw/box.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'draw/box.hpp')
-rw-r--r--draw/box.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/draw/box.hpp b/draw/box.hpp
new file mode 100644
index 00000000..b187dc83
--- /dev/null
+++ b/draw/box.hpp
@@ -0,0 +1,29 @@
+#pragma once
+#include <array>
+#include <Corrade/Containers/ArrayViewStl.h>
+#include <Magnum/Math/Vector3.h>
+#include <Magnum/GL/Mesh.h>
+
+namespace floormat::wireframe {
+
+struct box final
+{
+ box(Vector3 center, Vector3 size, float line_width);
+
+ static constexpr std::size_t num_vertices = 8, num_indexes = 12*2;
+ static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::Lines;
+
+ using vertex_array = std::array<Vector3, num_vertices>;
+ using index_array = std::array<UnsignedShort, num_indexes>;
+
+ vertex_array make_vertex_array() const;
+ static index_array make_index_array();
+ void on_draw() const;
+
+private:
+ Vector3 center;
+ Vector3 size;
+ float line_width = 2;
+};
+
+} // namespace floormat::wireframe