Fixed-size array of uniform shader variable identifiers representing an array inside a ShaderProgram.
More...
#include <donut/graphics/ShaderParameter.hpp>
|
| ShaderArray (const ShaderProgram &program, const char *name) |
| Construct an array of uniform shader variable identifiers for a specific shader array. More...
|
|
std::size_t | size () const noexcept |
| Get the size of the array. More...
|
|
T & | operator[] (std::size_t i) |
| Access an element of the array. More...
|
|
const T & | operator[] (std::size_t i) const |
| Access an element of the array. More...
|
|
decltype(auto) | begin () const noexcept |
| Get an iterator to the beginning of the array. More...
|
|
decltype(auto) | end () const noexcept |
| Get an iterator to the end of the array. More...
|
|
template<typename T, std::size_t N>
class donut::graphics::ShaderArray< T, N >
Fixed-size array of uniform shader variable identifiers representing an array inside a ShaderProgram.
- Template Parameters
-
T | the type of uniform shader variable identifier to use for each element of the array. |
N | the number of elements in the array. |
- Examples
- example_game.cpp.
◆ ShaderArray()
template<typename T , std::size_t N>
Construct an array of uniform shader variable identifiers for a specific shader array.
- Parameters
-
program | shader program in which the array resides. |
name | name of the array. |
- Exceptions
-
std::bad_alloc | on allocation failure. |
- Note
- If the array elements are not found, the resulting identifiers will be invalid.
◆ size()
template<typename T , std::size_t N>
Get the size of the array.
- Returns
- the number of elements in the array, which is always equal to template parameter N.
◆ operator[]() [1/2]
template<typename T , std::size_t N>
Access an element of the array.
- Parameters
-
i | the index of the element to get. Must be less than the size of the array. |
- Returns
- a reference to the element at index i.
◆ operator[]() [2/2]
template<typename T , std::size_t N>
Access an element of the array.
- Parameters
-
i | the index of the element to get. Must be less than the size of the array. |
- Returns
- a read-only reference to the element at index i.
◆ begin()
template<typename T , std::size_t N>
Get an iterator to the beginning of the array.
- Returns
- the begin iterator.
◆ end()
template<typename T , std::size_t N>
Get an iterator to the end of the array.
- Returns
- the end iterator.
The documentation for this class was generated from the following file: