OpenGL render state. More...
#include <kanzi/core.ui/platform/graphics_backend/gl/gl_render_state.hpp>
Classes | |
class | RenderValueInfo |
Render value information. More... | |
union | RenderValueUnion |
Union containing one render value to be arranged into an array. More... | |
struct | TextureRenderValue |
Container for texture render value and the width/height uniforms. More... | |
Public Types | |
using | HandleType = int |
Type for handle identifiers into values in the render state. More... | |
Public Member Functions | |
void | attach (MaterialSharedPtr material) |
Attach to a certain material/node combination. More... | |
bool | bind (Renderer &renderer) |
Applies the render state the render state. More... | |
optional< GraphicsBlendMode > | getBlendModeValue () const |
Get blend mode value. More... | |
template<typename T > | |
size_t | getElementCount (GlRenderState::HandleType handle) const |
Gets the number of elements for given handle. More... | |
template<> | |
size_t | getElementCount (GlRenderState::HandleType handle) const |
GlRenderState::getElementCount() specialization. More... | |
template<typename T > | |
HandleType | getHandle (string_view name) |
Access handle by type. More... | |
template<> | |
GlRenderState::HandleType | getHandle (string_view name) |
GlRenderState::getHandle() specialization. More... | |
MaterialSharedPtr | getMaterial () const |
Access material. More... | |
template<typename T > | |
T | getValue (HandleType handle, size_t index) const |
Accesses a value by handle. More... | |
template<typename T > | |
T | getValue (HandleType handle) const |
Accesses a value by handle. More... | |
template<> | |
TextureSharedPtr | getValue (GlRenderState::HandleType handle) const |
GlRenderState::getValue() specialization. More... | |
GlRenderState () | |
Empty constructor. More... | |
template<typename T > | |
bool | handleMatches (HandleType handle, string_view name) const |
Checks whether given handle matches the current render state. More... | |
template<> | |
bool | handleMatches (GlRenderState::HandleType handle, string_view name) const |
GlRenderState::handleMatches() specialization. More... | |
void | reattach () |
Reattach already-attached material. More... | |
bool | setRange (HandleType handle, AbstractRange &range) |
Sets values of a render target array from a range. More... | |
bool | setRange (HandleType handle, AbstractRange *range) |
Sets values of a render target array from a range. More... | |
bool | setRange (HandleType handle, AbstractRangeSharedPtr range) |
Sets values of a render target array from a range. More... | |
template<typename T > | |
void | setValue (HandleType handle, const T &value, size_t elementIndex) |
Set a render value identified by handle. More... | |
template<typename T > | |
void | setValue (HandleType handle, const T &value) |
Wrapper for setting a render value by handle. More... | |
void | setValue (GraphicsBlendMode value) |
Set blend mode value. More... | |
Protected Types | |
typedef vector< RenderValueInfo > | RenderValueInfoContainer |
Container for render value information. More... | |
typedef vector< RenderValueUnion > | RenderValueUnionContainer |
Container for render values. More... | |
typedef vector< TextureRenderValue > | TextureRenderValueContainer |
Container for texture render values. More... | |
OpenGL render state.
using kanzi::GlRenderState::HandleType = int |
Type for handle identifiers into values in the render state.
|
protected |
Container for render value information.
|
protected |
Container for render values.
|
protected |
Container for texture render values.
|
inlineexplicit |
Empty constructor.
bool kanzi::GlRenderState::bind | ( | Renderer & | renderer | ) |
Applies the render state the render state.
After calling this function, geometry can be rendered using the render state settings.
renderer | Renderer to use. |
void kanzi::GlRenderState::attach | ( | MaterialSharedPtr | material | ) |
Attach to a certain material/node combination.
material | Material to attach to. |
void kanzi::GlRenderState::reattach | ( | ) |
Reattach already-attached material.
Does nothing if no material attached.
|
inline |
Access material.
|
inline |
Set a render value identified by handle.
The handle may be invalid (negative), in which case this function does nothing.
handle | Identifying handle. |
value | Value to set. |
elementIndex | Index of the element in the value to set. |
|
inline |
Wrapper for setting a render value by handle.
Element index is zero.
handle | Identifying handle. |
value | Value to set. |
|
inline |
Get blend mode value.
|
inline |
Set blend mode value.
value | Value. |
|
inline |
Access handle by type.
name | Value name. |
|
inline |
Gets the number of elements for given handle.
handle | Handle. |
|
inline |
Accesses a value by handle.
Handle must be valid, access with invalid handle is undefined behavior.
handle | Handle to value. |
index | Index of the value to access. |
|
inline |
Accesses a value by handle.
Index of the accessed value is zero.
handle | Handle to value. |
|
inline |
Checks whether given handle matches the current render state.
handle | Handle to check. |
name | Name to compare against. |
bool kanzi::GlRenderState::setRange | ( | HandleType | handle, |
AbstractRange & | range | ||
) |
Sets values of a render target array from a range.
If the array is larger than the range, writes default values to the remaining values in the end of the array.
handle | Handle from the render state. |
range | Range input. |
bool kanzi::GlRenderState::setRange | ( | HandleType | handle, |
AbstractRange * | range | ||
) |
Sets values of a render target array from a range.
If the array is larger than the range, writes default values to the remaining values in the end of the array. If the range is a nullptr, sets all the elements of the render target array to default values.
handle | Handle from the render state. |
range | Range input. |
bool kanzi::GlRenderState::setRange | ( | HandleType | handle, |
AbstractRangeSharedPtr | range | ||
) |
Sets values of a render target array from a range.
If the array is larger than the range, writes default values to the remaining values in the end of the array. If the range is a nullptr, sets all the elements of the render target array to default values.
handle | Handle from the render state. |
range | Range input. |
GlRenderState::HandleType kanzi::GlRenderState::getHandle | ( | string_view | name | ) |
GlRenderState::getHandle() specialization.
bool kanzi::GlRenderState::handleMatches | ( | GlRenderState::HandleType | handle, |
string_view | name | ||
) | const |
GlRenderState::handleMatches() specialization.
TextureSharedPtr kanzi::GlRenderState::getValue | ( | GlRenderState::HandleType | handle | ) | const |
GlRenderState::getValue() specialization.
size_t kanzi::GlRenderState::getElementCount | ( | GlRenderState::HandleType | handle | ) | const |
GlRenderState::getElementCount() specialization.