lxgui
|
An object representing cached vertex data on the GPU. More...
#include <gui_sfml_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. | |
void | update (const vertex *vertex_data, std::size_t num_vertex) override |
Update the data stored in the cache to form new triangles. | |
std::size_t | get_vertex_count () const |
Returns the number of vertices currently stored in the cache. | |
const sf::VertexBuffer & | get_impl () const |
Returns the SFML vertex buffer object. | |
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 28 of file gui_sfml_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 |
const sf::VertexBuffer & lxgui::gui::sfml::vertex_cache::get_impl | ( | ) | const |
Returns the SFML vertex buffer object.
std::size_t lxgui::gui::sfml::vertex_cache::get_vertex_count | ( | ) | const |
Returns the number of vertices currently stored in 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.
|
protectedinherited |
Definition at line 79 of file gui_vertex_cache.hpp.
|
protectedinherited |
Definition at line 78 of file gui_vertex_cache.hpp.