FastUIDraw
|
A PainterShader encapsulates how to draw or blend. More...
#include <painter_shader.hpp>
Classes | |
class | Tag |
A Tag is how a PainterShader is described for and by a PainterShaderRegistrar. More... | |
Public Member Functions | |
PainterShader (unsigned int num_sub_shaders=1) | |
PainterShader (reference_counted_ptr< PainterShader > parent, unsigned int sub_shader) | |
uint32_t | group (const PainterShaderRegistrar &) const |
uint32_t | ID (const PainterShaderRegistrar &) const |
unsigned int | number_sub_shaders (void) const |
const reference_counted_ptr< PainterShader > & | parent (void) const |
bool | registered_to (const PainterShaderRegistrar &) const |
uint32_t | sub_shader (void) const |
Tag | tag (const PainterShaderRegistrar &) const |
Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
reference_counted_base (void) | |
Friends | |
class | PainterShaderRegistrar |
Additional Inherited Members | |
Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
static void | add_reference (const reference_counted_base< T, Counter > *p) |
static void | remove_reference (const reference_counted_base< T, Counter > *p) |
A PainterShader encapsulates how to draw or blend.
The real meat of a PainterShader is dependent on the backend. Typically it is a shader source code -fragment- that is placed into a large uber-shader.
Definition at line 40 of file painter_shader.hpp.
|
explicit |
Ctor for creating a PainterShader which has multiple sub-shaders. The purpose of sub-shaders is for the case where multiple shaders almost same code and those code differences can be realized by examining a sub-shader ID.
num_sub_shaders | number of sub-shaders |
fastuidraw::PainterShader::PainterShader | ( | reference_counted_ptr< PainterShader > | parent, |
unsigned int | sub_shader | ||
) |
Ctor to create a PainterShader realized as a sub-shader of an existing PainterShader.
parent | parent PainterShader that has sub-shaders. |
sub_shader | which sub-shader of the parent PainterShader The parent PainterShader MUST already be registered to a PainterShaderRegistrar. |
uint32_t fastuidraw::PainterShader::group | ( | const PainterShaderRegistrar & | ) | const |
Returns the shader group to which the shader belongs. A different value in group() triggers a call to PainterDraw:draw_break() to note that the shader group changed. The shader must be registered to the passed PainterShaderRegistrar to have a value from the registrar.
uint32_t fastuidraw::PainterShader::ID | ( | const PainterShaderRegistrar & | ) | const |
Returns the ID of the shader, the shader must be registered to the passed PainterShaderRegistrar to have an ID value for the passed registrar.
unsigned int fastuidraw::PainterShader::number_sub_shaders | ( | void | ) | const |
Returns the number of sub-shaders the PainterShader supports.
const reference_counted_ptr<PainterShader>& fastuidraw::PainterShader::parent | ( | void | ) | const |
If the PainterShader is a sub-shader returns the parent shader, otherwise returns nullptr.
bool fastuidraw::PainterShader::registered_to | ( | const PainterShaderRegistrar & | ) | const |
Returns true if this shader has been registered the the passed PainterShaderRegistrar.
uint32_t fastuidraw::PainterShader::sub_shader | ( | void | ) | const |
Returns the sub-shader value as passed in ctor if a sub-shader, otherwise returns 0.
Tag fastuidraw::PainterShader::tag | ( | const PainterShaderRegistrar & | ) | const |
Returns the Tag of the shader which holds the value for ID() in Tag::m_ID and group() in Tag::m_group. The shader must be registered to the passed PainterShaderRegistrar to have a Tag value from the registrar.