diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-09 03:11:56 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-09 03:11:56 +0200 |
| commit | acdace16824b741948b02da0bcc7d0d059c7f683 (patch) | |
| tree | 1ffd35712af0a9412477e678310a82ba3988ccf3 /src/wireframe-mesh.hpp | |
| parent | 542bc1c103f129c2f648dbe77affb485cfdf93ab (diff) | |
a
Diffstat (limited to 'src/wireframe-mesh.hpp')
| -rw-r--r-- | src/wireframe-mesh.hpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/wireframe-mesh.hpp b/src/wireframe-mesh.hpp index 2a7cf10c..26dfb9ec 100644 --- a/src/wireframe-mesh.hpp +++ b/src/wireframe-mesh.hpp @@ -19,38 +19,32 @@ namespace wireframe template<typename T> concept traits = requires (const T& x) { {T::num_vertices} -> std::convertible_to<std::size_t>; - {T::num_indexes} -> std::convertible_to<std::size_t>; {x.primitive} -> std::convertible_to<GL::MeshPrimitive>; {x.make_vertex_array() } -> std::same_as<std::array<Vector3, T::num_vertices>>; - {x.make_index_array() } -> std::same_as<std::array<UnsignedShort, T::num_indexes>>; }; struct null final { static constexpr auto primitive = GL::MeshPrimitive::Triangles; - static constexpr std::size_t num_vertices = 0, num_indexes = 0; + static constexpr std::size_t num_vertices = 0; static GL::RectangleTexture make_constant_texture(); static std::array<Vector3, 0> make_vertex_array() { return {}; } - static std::array<UnsignedShort, 0> make_index_array() { return {}; } }; struct quad final { quad(Vector3 center, Vector2 size); - constexpr quad() = default; - static constexpr std::size_t num_vertices = 4, num_indexes = 6; - static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::Triangles; + static constexpr std::size_t num_vertices = 4; + static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::LineLoop; 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() ; private: - Vector3 center = {}; - Vector2 size = { TILE_SIZE[0], TILE_SIZE[1] }; + Vector3 center; + Vector2 size; }; } // namespace wireframe @@ -63,8 +57,7 @@ struct wireframe_mesh final private: GL::Buffer _vertex_buffer{std::array<Vector3, T::num_vertices>{}, GL::BufferUsage::DynamicDraw}, - _texcoords_buffer{std::array<Vector2, T::num_vertices>{}, GL::BufferUsage::DynamicDraw}, - _index_buffer{std::array<UnsignedShort , T::num_indexes>{}, GL::BufferUsage::DynamicDraw}; + _texcoords_buffer{std::array<Vector2, T::num_vertices>{}, GL::BufferUsage::DynamicDraw}; GL::RectangleTexture _texture = wireframe::null::make_constant_texture(); GL::Mesh _mesh; }; |
