|
| vertex_buffer_inst (std::span< const float > instance_data, vertex_buffer_layout &&layout) noexcept |
|
| vertex_buffer_inst (std::span< const float > instance_data) noexcept |
|
| ~vertex_buffer_inst () noexcept=default |
|
| vertex_buffer_inst (const vertex_buffer_inst &)=delete |
|
auto | operator= (const vertex_buffer_inst &) -> vertex_buffer_inst &=delete |
|
| vertex_buffer_inst (vertex_buffer_inst &&) noexcept=default |
|
auto | operator= (vertex_buffer_inst &&) noexcept -> vertex_buffer_inst &=default |
|
void | add_instance (std::span< const float > instance_data) noexcept |
| Add an instance to the buffer.
|
|
auto | delete_instance (std::int32_t index) noexcept -> int32_t |
| Delete an instance from the buffer, does not preserve the order of the instances.
|
|
void | update_instance (std::int32_t index, std::span< const float > instance_data) noexcept |
| Update the data of an instance in the buffer.
|
|
constexpr auto | instance_count () const noexcept -> std::int32_t |
|
constexpr auto | instance_size () const noexcept -> std::size_t |
|
constexpr auto | capacity () const noexcept -> std::size_t |
|
| vertex_buffer (std::span< const float > vertices) noexcept |
| Construct a new vertex buffer object.
|
|
| vertex_buffer (std::span< const float > vertices, driver_draw_hint hint) noexcept |
|
| vertex_buffer (std::span< const float > vertices, vertex_buffer_layout &&layout) noexcept |
|
| vertex_buffer (std::span< const float > vertices, vertex_buffer_layout &&layout, driver_draw_hint hint) noexcept |
|
| ~vertex_buffer () |
|
| vertex_buffer (const vertex_buffer &)=delete |
|
auto | operator= (const vertex_buffer &) -> vertex_buffer &=delete |
|
| vertex_buffer (vertex_buffer &&other) noexcept |
|
auto | operator= (vertex_buffer &&other) noexcept -> vertex_buffer & |
|
void | bind () const |
| Bind the vertex buffer object.
|
|
void | set_layout (const vertex_buffer_layout &layout) |
| Set the layout object.
|
|
constexpr auto | layout () const -> const vertex_buffer_layout & |
|
void | set_data (std::span< const float > vertices) const noexcept |
| Give new data to the vertex buffer object, overwriting the old one.
|
|
void | set_data (std::span< const float > vertices, driver_draw_hint hint) const noexcept |
| Give new data to the vertex buffer object, overwriting the old one. Also re-specify the hint.
|
|
constexpr auto | id () const noexcept -> std::uint32_t |
| Get the id of the vertex buffer object.
|
|
constexpr auto | size () const noexcept -> std::size_t |
| Get the number of vertices in the vertex buffer object.
|
|
constexpr auto | draw_hint () const noexcept -> driver_draw_hint |
| Return the driver draw hint of the vertex buffer object.
|
|
constexpr auto | size_bytes () const noexcept -> std::size_t |
| Get the size of the vertex buffer object in bytes.
|
|
template<plain_old_data T> |
void | apply (const std::function< void(std::span< T > vertices)> &func, driver_access_specifier access_specifier=staplegl::READ_WRITE) noexcept |
| Applies a function to the vertices of the vertex buffer object.
|
|
A vertex buffer object for instanced rendering.
This class is a specialization of the vertex_buffer class, and it is meant to help with instanced rendering, allowing the user of staplegl to build a more performant renderer.
When using this class, the user should initialize the buffer with an empty span of data and a layout that describes how a single instance of the object is laid out in memory.
Alternatively, the user can also supply a span with the initial data, to avoid calling add_instance() multiple times.
Adding and deleting instances automatically resizes the buffer in a way similar to std::vector, so that the user does not have to worry about the size of the buffer.
When deleting an instance, the user should be aware that the last instance in the buffer will be moved to the position of the deleted instance, so the order of the instances is not preserved, to help the user keep track of the indices of the instances, we return the index of the deleted instance (which is the index of the last instance in the buffer before the deletion).
- See also
- vertex_buffer.hpp
- Attention
- None of the base class methods are virtual, so this class is not meant to be used polymorphically.
- Examples
- batches.cpp.
Definition at line 56 of file vertex_buffer_inst.hpp.