summaryrefslogtreecommitdiffhomepage
path: root/draw/quad-wall-w.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-29 18:21:25 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-29 18:21:25 +0200
commitd309ed0b2ac06d7ba48322303d56bf39c8b57fe4 (patch)
tree0b4444b6a3789c61e5fdd7a27af2519b22f7dac7 /draw/quad-wall-w.cpp
parentd36ca021562c7a5d9d012cfdcb6e3260e9acdae5 (diff)
add wall outline wireframes
Diffstat (limited to 'draw/quad-wall-w.cpp')
-rw-r--r--draw/quad-wall-w.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/draw/quad-wall-w.cpp b/draw/quad-wall-w.cpp
new file mode 100644
index 00000000..ad0e2ca0
--- /dev/null
+++ b/draw/quad-wall-w.cpp
@@ -0,0 +1,28 @@
+#include "quad-wall-w.hpp"
+#include <array>
+#include <Magnum/GL/Renderer.h>
+
+namespace floormat::wireframe {
+
+auto quad_wall_w::make_vertex_array() const -> vertex_array
+{
+ const float x = size[0]*.5f, y = size[1]*.5f, z = size[2];
+ const auto cx = center[0], cy = center[1], cz = center[2];
+ return {{
+ { -x + cx, -y + cy, cz },
+ { -x + cx, y + cy, cz },
+ { -x + cx, y + cy, z + cz },
+ { -x + cx, -y + cy, z + cz },
+ }};
+}
+
+quad_wall_w::quad_wall_w(Vector3 center, Vector3 size, float line_width) :
+ center(center), size(size), line_width{line_width}
+{}
+
+void quad_wall_w::on_draw() const
+{
+ GL::Renderer::setLineWidth(line_width);
+}
+
+} // namespace floormat::wireframe