Tatooine
line_loop.h
Go to the documentation of this file.
1#ifndef TATOOINE_RENDERING_LINE_LOOP_H
2#define TATOOINE_RENDERING_LINE_LOOP_H
3//==============================================================================
5//==============================================================================
6namespace tatooine::rendering {
7//==============================================================================
8template <typename... VertexAttributes>
9struct line_loop {
10 private:
11 gl::indexeddata<VertexAttributes...> m_geometry;
12
13 public:
14 explicit line_loop(std::size_t const size) {
16 m_geometry.indexbuffer().resize(size);
17
18 {
19 auto map = m_geometry.indexbuffer().wmap();
20 for (std::size_t i = 0; i < size; ++i) {
21 map[i] = i;
22 }
23 }
24 }
25 //----------------------------------------------------------------------------
26 auto bind() { m_geometry.bind(); }
28 //----------------------------------------------------------------------------
29 auto geometry() const -> auto const& { return m_geometry; }
30 auto geometry() -> auto& { return m_geometry; }
31 //----------------------------------------------------------------------------
32 auto vertexbuffer() const -> auto const& { return m_geometry.vertexbuffer(); }
33 auto vertexbuffer() -> auto& { return m_geometry.vertexbuffer(); }
34};
35//==============================================================================
36} // namespace tatooine::rendering
37//==============================================================================
38#endif
Definition: indexeddata.h:13
void draw_line_loop() const
Definition: indexeddata.h:89
auto indexbuffer() -> auto &
Definition: indexeddata.h:145
auto vertexbuffer() -> auto &
Definition: indexeddata.h:148
Definition: camera.h:12
auto constexpr map(F &&f, Ts &&... ts)
maps unary function f to all single parameters of parameter pack ts
Definition: map.h:10
auto size(vec< ValueType, N > const &v)
Definition: vec.h:148
Definition: line_loop.h:9
auto vertexbuffer() -> auto &
Definition: line_loop.h:33
auto draw()
Definition: line_loop.h:27
auto bind()
Definition: line_loop.h:26
auto geometry() const -> auto const &
Definition: line_loop.h:29
auto geometry() -> auto &
Definition: line_loop.h:30
gl::indexeddata< VertexAttributes... > m_geometry
Definition: line_loop.h:11
auto vertexbuffer() const -> auto const &
Definition: line_loop.h:32
line_loop(std::size_t const size)
Definition: line_loop.h:14