diff options
Diffstat (limited to 'draw/quad-floor.hpp')
-rw-r--r-- | draw/quad-floor.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/draw/quad-floor.hpp b/draw/quad-floor.hpp new file mode 100644 index 00000000..7a8ec59a --- /dev/null +++ b/draw/quad-floor.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_floor final +{ + quad_floor(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 |