lxgui
|
An object representing cached vertex data on the GPU. More...
#include <gui_gl_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. | |
~vertex_cache () override | |
Destructor. | |
void | update_data (const vertex *vertex_data, std::size_t num_vertex) |
Update the data stored in the cache, reusing existing indices. | |
void | update_indices (const std::uint32_t *vertex_indices, std::size_t num_indices) |
Update the indices stored in the cache, reusing existing data. | |
void | update_indices_if_grow (const std::uint32_t *vertex_indices, std::size_t num_indices) |
Update the indices stored in the cache, but only if the current index cache is smaller. | |
void | update (const vertex *vertex_data, std::size_t num_vertex) override |
Update the data stored in the cache to form new triangles. | |
void | render () const |
Renders the cache. | |
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_gl_vertex_cache.hpp.
|
stronginherited |
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 |
|
overridevirtual |
Destructor.
Reimplemented from lxgui::gui::vertex_cache.
|
inlineinherited |
Returns the number of vertices stored in this cache.
Definition at line 73 of file gui_vertex_cache.hpp.
void lxgui::gui::gl::vertex_cache::render | ( | ) | const |
Renders the cache.
|
overridevirtual |
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 |
Implements lxgui::gui::vertex_cache.
void lxgui::gui::gl::vertex_cache::update_data | ( | const vertex * | vertex_data, |
std::size_t | num_vertex | ||
) |
Update the data stored in the cache, reusing existing indices.
vertex_data | The vertices to cache |
num_vertex | The number of vertices to cache |
void lxgui::gui::gl::vertex_cache::update_indices | ( | const std::uint32_t * | vertex_indices, |
std::size_t | num_indices | ||
) |
Update the indices stored in the cache, reusing existing data.
vertex_indices | The indices to use for drawing triangles |
num_indices | The number of indices to cache |
void lxgui::gui::gl::vertex_cache::update_indices_if_grow | ( | const std::uint32_t * | vertex_indices, |
std::size_t | num_indices | ||
) |
Update the indices stored in the cache, but only if the current index cache is smaller.
vertex_indices | The indices to use for drawing triangles |
num_indices | The number of indices to cache |
|
protectedinherited |
Definition at line 79 of file gui_vertex_cache.hpp.
|
protectedinherited |
Definition at line 78 of file gui_vertex_cache.hpp.