4#include <unordered_map>
19using std::unordered_map;
33PostProcessingShader::PostProcessingShader(
Renderer* renderer)
47 for (
auto shaderIt:
shader) {
48 delete shaderIt.second;
54 auto initialized =
true;
55 for (
auto shaderIt:
shader) {
56 initialized&= shaderIt.second->isInitialized();
63 for (
auto shaderIt:
shader) {
64 shaderIt.second->initialize();
90 auto shaderIt =
shader.find(
id);
91 if (shaderIt ==
shader.end()) {
92 shaderIt =
shader.find(
"default");
97 if (currentImplementation !=
nullptr) currentImplementation->
unUseProgram();
Post processing shader blur implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
Post processing shader default implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
Post processing shader desaturation implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
Post processing shader implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
Post processing shader vignette implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
void initialize()
Initialize renderer.
unordered_map< string, PostProcessingShaderImplementation * > shader
PostProcessingShaderImplementation * implementation
~PostProcessingShader()
Public destructor.
void setShader(int contextIdx, const string &id)
Set post processing shader.
void setBufferPixelWidth(int contextIdx, float pixelWidth)
Set source buffer pixel width.
void useProgram()
Use program.
bool hasShader(const string &id)
Has post processing shader.
void setShaderParameters(int contextIdx, Engine *engine)
Set shader parameters.
void unUseProgram()
Unuse program.
void setBufferPixelHeight(int contextIdx, float pixelHeight)
Set source buffer pixel height.
Post processing shader program implementation interface.
virtual void setShaderParameters(int contextIdx, Engine *engine)=0
Set shader parameters.
virtual void setBufferPixelHeight(int contextIdx, float pixelHeight)=0
Set source buffer pixel height.
virtual void unUseProgram()=0
Unuse program.
virtual void setBufferPixelWidth(int contextIdx, float pixelWidth)=0
Set source buffer pixel width.
virtual void useProgram(int contextIdx)=0
Use program.