summaryrefslogtreecommitdiffhomepage
path: root/draw/quad-floor.hpp
blob: 0c52dbc3940c1df2c7a0f58045f1300dc54fa6c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <array>
#include <Magnum/Math/Vector2.h>
#include <Magnum/Math/Vector3.h>
#include <Magnum/GL/Mesh.h>

namespace floormat::wireframe {

struct quad_floor
{
    quad_floor(Vector3 center, Vector2 size, float line_width);

    static constexpr size_t num_vertices = 4, num_indexes = 0;
    static constexpr auto 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