4 #include <unordered_map>
19 using std::unordered_map;
33 PostProcessingShader::PostProcessingShader(
Renderer* renderer)
47 for (
const auto& [shaderId, shader]:
shaders) {
54 auto initialized =
true;
55 for (
const auto& [shaderId, shader]:
shaders) {
56 initialized&= shader->isInitialized();
63 for (
const auto& [shaderId, shader]:
shaders) {
70 for (
const auto& [shaderId, shader]:
shaders) {
71 shader->unloadTextures();
97 auto shaderIt =
shaders.find(
id);
98 if (shaderIt ==
shaders.end()) {
99 shaderIt =
shaders.find(
"default");
104 if (currentImplementation !=
nullptr) currentImplementation->
unUseProgram();
125 for (
const auto& [shaderId, shader]:
shaders) {
126 shader->unloadTextures();
127 shader->loadTextures(pathName);
Post processing shader default implementation.
static bool isSupported(Renderer *renderer)
Returns if shader is supported on given renderer.
Post processing shader depth blur 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.
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.
unordered_map< string, PostProcessingShaderImplementation * > shaders
void dispose()
Initialize.
void useProgram()
Use program.
bool hasShader(const string &id)
Has post processing shader.
void setShaderParameters(int contextIdx, Engine *engine)
Set shader parameters.
void loadTextures(const string &pathName)
Load textures.
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.