lxgui
|
An object representing cached vertex data on the GPU. More...
#include <gui_vertex_cache.hpp>
Public Types | |
enum class | type { triangles , quads } |
The type of vertex data contained in a vertex_cache. More... | |
Public Member Functions | |
vertex_cache (type t) | |
Constructor. | |
virtual | ~vertex_cache ()=default |
Destructor. | |
vertex_cache (const vertex_cache &)=delete | |
Non-copiable. | |
vertex_cache (vertex_cache &&)=delete | |
Non-movable. | |
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. | |
std::size_t | get_vertex_count () const |
Returns the number of vertices stored in this cache. | |
Protected Attributes | |
type | type_ = type::triangles |
std::size_t | num_vertex_ = 0 |
An object representing cached vertex data on the GPU.
A vertex cache stores vertices and indices that can be used to draw any shape on the screen. If the type is TRIANGLES, each group of 3 vertices forms a triangle, while if the type is QUADS, each group of 4 vertices forms a quad.
Using this class enables more efficient rendering of large groups of sprites or quads that share the same material (texture). This is especially true if the data to render does not change often.
A vertex cache can be rendered with gui::renderer::render_vertex_cache().
Definition at line 29 of file gui_vertex_cache.hpp.
|
strong |
The type of vertex data contained in a vertex_cache.
Enumerator | |
---|---|
triangles | |
quads | 3 vertices per element 4 vertices per element |
Definition at line 32 of file gui_vertex_cache.hpp.
|
explicit |
Constructor.
t | The type of data this cache will hold |
A default constructed vertex cache holds no data. Use update() to store vertices to be rendered.
Definition at line 5 of file gui_vertex_cache.cpp.
|
virtualdefault |
Destructor.
Reimplemented in lxgui::gui::gl::vertex_cache.
|
delete |
Non-copiable.
|
delete |
Non-movable.
|
inline |
Returns the number of vertices stored in this cache.
Definition at line 73 of file gui_vertex_cache.hpp.
|
delete |
Non-copiable.
|
delete |
Non-movable.
|
pure virtual |
Update the data stored in the cache to form new triangles.
vertex_data | The vertices to cache |
num_vertex | The number of vertices to cache |
Implemented in lxgui::gui::gl::vertex_cache, and lxgui::gui::sfml::vertex_cache.
|
protected |
Definition at line 79 of file gui_vertex_cache.hpp.
|
protected |
Definition at line 78 of file gui_vertex_cache.hpp.