Beatmup
|
Handles a collection of common rendering programs of predefined types and shared operations among these programs. More...
#include <rendering_programs.h>
Classes | |
class | Backend |
Public Types | |
enum class | Operation { BLEND , MASKED_BLEND , MASKED_8BIT_BLEND , SHAPED_BLEND , BLEND_EXT , MASKED_BLEND_EXT , MASKED_8BIT_BLEND_EXT , SHAPED_BLEND_EXT } |
Standard rendering operations. More... | |
Public Member Functions | |
void | enableProgram (GraphicPipeline *gpu, Operation program) |
Select and enable a common program. More... | |
Program & | getCurrentProgram () |
void | bindMask (GraphicPipeline *gpu, AbstractBitmap &mask) |
Binds a mask to a masked rendering program. More... | |
void | blend (bool onScreen) |
Performs the blending operation. More... | |
void | paveBackground (GraphicPipeline *gpu, TextureHandler &content, GL::TextureHandler *output) |
Fills background with a repeated texture taking 1 pixel of this texture per 1 pixel of the output. More... | |
const VertexShader & | getDefaultVertexShader (const GraphicPipeline *gpu) const |
RenderingPrograms (GraphicPipeline *gpu) | |
~RenderingPrograms () | |
Static Public Attributes | |
static const char * | VERTEX_COORD_ATTRIB_NAME = "inVertex" |
vertex coordinate attribute name in vertex shaders More... | |
static const char * | TEXTURE_COORD_ATTRIB_NAME = "inTexCoord" |
texture coordinate attribute name in vertex shaders More... | |
static const char * | VERTICAL_FLIP_ID = "flipVertically" |
Vertical flipping variable name in vertex shader. More... | |
static const char * | MODELVIEW_MATRIX_ID = "modelview" |
Modelview matrix (mapping input geometry to output) shader variable name in vertex shader. More... | |
static const char * | TEXTURE_COORDINATES_ID = "texCoord" |
Texture coordinates shader variable name in vertex shader. More... | |
static const char * | DECLARE_TEXTURE_COORDINATES_IN_FRAG = "varying highp vec2 texCoord;\n" |
Declaring texture coordinates in fragment shader. More... | |
Private Member Functions | |
Program & | getProgram (const GraphicPipeline *gpu, Operation program) |
Private Attributes | |
Backend * | backend |
Program * | currentGlProgram |
Operation | currentProgram |
bool | maskSetUp |
VertexShader | defaultVertexShader |
std::map< Operation, RenderingProgram > | programs |
Handles a collection of common rendering programs of predefined types and shared operations among these programs.
Programs compilation and linking is done in a deferred fashion, so that the first rendering pass would usually take much more time, but no time is spent on initializing programs that will never be used.
Definition at line 33 of file rendering_programs.h.
|
strong |
Standard rendering operations.
Definition at line 38 of file rendering_programs.h.
RenderingPrograms::RenderingPrograms | ( | GraphicPipeline * | gpu | ) |
Definition at line 249 of file rendering_programs.cpp.
RenderingPrograms::~RenderingPrograms | ( | ) |
Definition at line 254 of file rendering_programs.cpp.
void RenderingPrograms::enableProgram | ( | GraphicPipeline * | gpu, |
Operation | program | ||
) |
Select and enable a common program.
If the selected program is not yet ready, it is linked and complied.
[in,out] | gpu | A graphic pipeline instance |
[in,out] | program | The selected common program to use |
Definition at line 314 of file rendering_programs.cpp.
Program & RenderingPrograms::getCurrentProgram | ( | ) |
Definition at line 334 of file rendering_programs.cpp.
void RenderingPrograms::bindMask | ( | GraphicPipeline * | gpu, |
AbstractBitmap & | mask | ||
) |
Binds a mask to a masked rendering program.
Throws an exception when a mask is about to be bound to a non-masked rendering program.
[in,out] | gpu | A graphic pipeline instance |
[in,out] | mask | The mask bitmap |
Definition at line 341 of file rendering_programs.cpp.
void RenderingPrograms::blend | ( | bool | onScreen | ) |
Performs the blending operation.
[in] | onScreen | If true , the rendering is performed on a screen, not into a bitmap. |
Definition at line 353 of file rendering_programs.cpp.
void RenderingPrograms::paveBackground | ( | GraphicPipeline * | gpu, |
TextureHandler & | content, | ||
GL::TextureHandler * | output | ||
) |
Fills background with a repeated texture taking 1 pixel of this texture per 1 pixel of the output.
[in,out] | gpu | A graphic pipeline instance |
[in] | content | The texture |
[in] | output | Target texture handler or null if onscreen rendering |
Definition at line 368 of file rendering_programs.cpp.
const VertexShader & RenderingPrograms::getDefaultVertexShader | ( | const GraphicPipeline * | gpu | ) | const |
Definition at line 392 of file rendering_programs.cpp.
|
private |
Definition at line 259 of file rendering_programs.cpp.
|
static |
vertex coordinate attribute name in vertex shaders
Definition at line 50 of file rendering_programs.h.
|
static |
texture coordinate attribute name in vertex shaders
Definition at line 51 of file rendering_programs.h.
|
static |
Vertical flipping variable name in vertex shader.
Definition at line 53 of file rendering_programs.h.
|
static |
Modelview matrix (mapping input geometry to output) shader variable name in vertex shader.
Definition at line 54 of file rendering_programs.h.
|
static |
Texture coordinates shader variable name in vertex shader.
Definition at line 55 of file rendering_programs.h.
|
static |
Declaring texture coordinates in fragment shader.
Definition at line 57 of file rendering_programs.h.
|
private |
Definition at line 110 of file rendering_programs.h.
|
private |
Definition at line 111 of file rendering_programs.h.
|
private |
Definition at line 112 of file rendering_programs.h.
|
private |
Definition at line 113 of file rendering_programs.h.
|
private |
Definition at line 115 of file rendering_programs.h.
|
private |
Definition at line 116 of file rendering_programs.h.