lxgui
gui_vertex_cache.hpp
1 #ifndef LXGUI_GUI_VERTEX_CACHE_HPP
2 #define LXGUI_GUI_VERTEX_CACHE_HPP
3 
4 #include "lxgui/gui_vertex.hpp"
5 #include "lxgui/lxgui.hpp"
6 #include "lxgui/utils.hpp"
7 
8 #include <memory>
9 #include <vector>
10 
11 namespace lxgui::gui {
12 
29 class vertex_cache {
30 public:
32  enum class type {
33  triangles,
34  quads
35  };
36 
43  explicit vertex_cache(type t);
44 
46  virtual ~vertex_cache() = default;
47 
49  vertex_cache(const vertex_cache&) = delete;
50 
53 
55  vertex_cache& operator=(const vertex_cache&) = delete;
56 
59 
67  virtual void update(const vertex* vertex_data, std::size_t num_vertex) = 0;
68 
73  std::size_t get_vertex_count() const {
74  return num_vertex_;
75  }
76 
77 protected:
79  std::size_t num_vertex_ = 0;
80 };
81 
82 } // namespace lxgui::gui
83 
84 #endif
An object representing cached vertex data on the GPU.
type
The type of vertex data contained in a vertex_cache.
@ quads
3 vertices per element
std::size_t get_vertex_count() const
Returns the number of vertices stored in this cache.
vertex_cache(vertex_cache &&)=delete
Non-movable.
vertex_cache(const vertex_cache &)=delete
Non-copiable.
vertex_cache(type t)
Constructor.
vertex_cache & operator=(const vertex_cache &)=delete
Non-copiable.
vertex_cache & operator=(vertex_cache &&)=delete
Non-movable.
virtual void update(const vertex *vertex_data, std::size_t num_vertex)=0
Update the data stored in the cache to form new triangles.
virtual ~vertex_cache()=default
Destructor.
Holds position, texture coordinate, and color information for drawing.
Definition: gui_vertex.hpp:12