Tatooine
pointset.h
Go to the documentation of this file.
1#ifndef TATOOINE_RENDERING_POINTSET_H
2#define TATOOINE_RENDERING_POINTSET_H
3//==============================================================================
4#include <tatooine/pointset.h>
6//==============================================================================
7namespace tatooine::rendering {
8//==============================================================================
9template <typename... VertexAttributes>
10struct pointset {
11 private:
12 gl::indexeddata<VertexAttributes...> m_geometry;
13 public:
14 pointset(std::size_t const num_vertices){
15 m_geometry.vertexbuffer().resize(num_vertices);
16 m_geometry.indexbuffer().resize(num_vertices);
17 {
18 auto map = m_geometry.indexbuffer().wmap();
19 for (std::size_t i = 0; i < num_vertices; ++i) {
20 map[i] = i;
21 }
22 }
23 }
24 //----------------------------------------------------------------------------
25 auto bind() { m_geometry.bind(); }
27 //----------------------------------------------------------------------------
28 auto geometry() const -> auto const& { return m_geometry; }
29 auto geometry() -> auto& { return m_geometry; }
30 //----------------------------------------------------------------------------
31 auto vertexbuffer() const -> auto const& { return m_geometry.vertexbuffer(); }
32 auto vertexbuffer() -> auto& { return m_geometry.vertexbuffer(); }
33};
34//==============================================================================
35} // namespace tatooine::rendering
36//==============================================================================
37#endif
Definition: indexeddata.h:13
auto indexbuffer() -> auto &
Definition: indexeddata.h:145
auto vertexbuffer() -> auto &
Definition: indexeddata.h:148
void draw_points() const
Definition: indexeddata.h:77
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
Definition: pointset.h:10
auto vertexbuffer() const -> auto const &
Definition: pointset.h:31
gl::indexeddata< VertexAttributes... > m_geometry
Definition: pointset.h:12
auto bind()
Definition: pointset.h:25
auto vertexbuffer() -> auto &
Definition: pointset.h:32
pointset(std::size_t const num_vertices)
Definition: pointset.h:14
auto draw()
Definition: pointset.h:26
auto geometry() -> auto &
Definition: pointset.h:29
auto geometry() const -> auto const &
Definition: pointset.h:28