1 #ifndef DONUT_GRAPHICS_SHADER_PARAMETER_HPP
2 #define DONUT_GRAPHICS_SHADER_PARAMETER_HPP
40 std::int32_t location;
51 template <
typename T, std::
size_t N>
67 : array([&]<std::size_t... Indices>(std::index_sequence<Indices...>) -> std::array<T, N> {
68 return {(T{program, (std::string{name} +
"[" + std::to_string(Indices) +
"]").c_str()})...};
69 }(std::make_index_sequence<N>{})) {}
77 [[nodiscard]] std::size_t
size() const noexcept {
110 [[nodiscard]] decltype(
auto)
begin() const noexcept {
111 return array.begin();
119 [[nodiscard]] decltype(
auto)
end() const noexcept {
124 std::array<T, N> array;
Fixed-size array of uniform shader variable identifiers representing an array inside a ShaderProgram.
Definition: ShaderParameter.hpp:52
T & operator[](std::size_t i)
Access an element of the array.
Definition: ShaderParameter.hpp:89
decltype(auto) end() const noexcept
Get an iterator to the end of the array.
Definition: ShaderParameter.hpp:119
std::size_t size() const noexcept
Get the size of the array.
Definition: ShaderParameter.hpp:77
const T & operator[](std::size_t i) const
Access an element of the array.
Definition: ShaderParameter.hpp:101
ShaderArray(const ShaderProgram &program, const char *name)
Construct an array of uniform shader variable identifiers for a specific shader array.
Definition: ShaderParameter.hpp:66
decltype(auto) begin() const noexcept
Get an iterator to the beginning of the array.
Definition: ShaderParameter.hpp:110
Identifier for a uniform shader variable inside a ShaderProgram.
Definition: ShaderParameter.hpp:17
std::int32_t getLocation() const noexcept
Get the location of the variable in the shader program.
Definition: ShaderParameter.hpp:35
ShaderParameter(const ShaderProgram &program, const char *name)
Construct an identifier for a specific uniform shader variable.
Compiled and linked GPU shader program.
Definition: ShaderProgram.hpp:46