diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 5dc62644e..34708d4ca 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -526,6 +526,51 @@ public: } // GodRayShader }; // GodRayShader +// ============================================================================ +class MLAAColorEdgeDetectionSHader + : public TextureShader +{ +public: + MLAAColorEdgeDetectionSHader() + { + loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", + GL_FRAGMENT_SHADER, "mlaa_color1.frag"); + assignUniforms("PIXEL_SIZE"); + assignSamplerNames(0, "colorMapG", ST_NEAREST_FILTERED); + } // MLAAColorEdgeDetectionSHader +}; // MLAAColorEdgeDetectionSHader + +// ============================================================================ +class MLAABlendWeightSHader : public TextureShader +{ +public: + MLAABlendWeightSHader() + { + loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", + GL_FRAGMENT_SHADER, "mlaa_blend2.frag"); + assignUniforms("PIXEL_SIZE"); + + assignSamplerNames(0, "edgesMap", ST_BILINEAR_FILTERED, + 1, "areaMap", ST_NEAREST_FILTERED); + } // MLAABlendWeightSHader +}; // MLAABlendWeightSHader + +// ============================================================================ +class MLAAGatherSHader : public TextureShader +{ +public: + MLAAGatherSHader() + { + loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", + GL_FRAGMENT_SHADER, "mlaa_neigh3.frag"); + assignUniforms("PIXEL_SIZE"); + assignSamplerNames(0, "blendMap", ST_NEAREST_FILTERED, + 1, "colorMap", ST_NEAREST_FILTERED); + } // MLAAGatherSHader +}; // MLAAGatherSHader + // ============================================================================ PostProcessing::PostProcessing(IVideoDriver* video_driver) @@ -1199,11 +1244,10 @@ void PostProcessing::applyMLAA() glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); // Pass 1: color edge detection - FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance()->use(); - FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance() + MLAAColorEdgeDetectionSHader::getInstance()->use(); + MLAAColorEdgeDetectionSHader::getInstance() ->setTextureUnits(irr_driver->getRenderTargetTexture(RTT_MLAA_COLORS)); - DrawFullScreenEffect - (PIXEL_SIZE); + DrawFullScreenEffect(PIXEL_SIZE); glStencilFunc(GL_EQUAL, 1, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); @@ -1212,11 +1256,11 @@ void PostProcessing::applyMLAA() irr_driver->getFBO(FBO_MLAA_BLEND).Bind(); glClear(GL_COLOR_BUFFER_BIT); - FullScreenShader::MLAABlendWeightSHader::getInstance()->use(); - FullScreenShader::MLAABlendWeightSHader::getInstance() + MLAABlendWeightSHader::getInstance()->use(); + MLAABlendWeightSHader::getInstance() ->setTextureUnits(irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), getTextureGLuint(m_areamap)); - DrawFullScreenEffect(PIXEL_SIZE); + DrawFullScreenEffect(PIXEL_SIZE); // Blit in to tmp1 FrameBuffer::Blit(irr_driver->getFBO(FBO_MLAA_COLORS), @@ -1225,11 +1269,11 @@ void PostProcessing::applyMLAA() // Pass 3: gather irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); - FullScreenShader::MLAAGatherSHader::getInstance()->use(); - FullScreenShader::MLAAGatherSHader::getInstance() + MLAAGatherSHader::getInstance()->use(); + MLAAGatherSHader::getInstance() ->setTextureUnits(irr_driver->getRenderTargetTexture(RTT_MLAA_BLEND), irr_driver->getRenderTargetTexture(RTT_MLAA_TMP)); - DrawFullScreenEffect(PIXEL_SIZE); + DrawFullScreenEffect(PIXEL_SIZE); // Done. glDisable(GL_STENCIL_TEST); diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 8509c0e58..4ac0eb0dc 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -468,35 +468,4 @@ namespace FullScreenShader assignSamplerNames(0, "tex", ST_NEAREST_FILTERED); } - MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader() - { - loadProgram(OBJECT, - GL_VERTEX_SHADER, "screenquad.vert", - GL_FRAGMENT_SHADER, "mlaa_color1.frag"); - assignUniforms("PIXEL_SIZE"); - - assignSamplerNames(0, "colorMapG", ST_NEAREST_FILTERED); - } - - MLAABlendWeightSHader::MLAABlendWeightSHader() - { - loadProgram(OBJECT, - GL_VERTEX_SHADER, "screenquad.vert", - GL_FRAGMENT_SHADER, "mlaa_blend2.frag"); - assignUniforms("PIXEL_SIZE"); - - assignSamplerNames(0, "edgesMap", ST_BILINEAR_FILTERED, - 1, "areaMap", ST_NEAREST_FILTERED); - } - - MLAAGatherSHader::MLAAGatherSHader() - { - loadProgram(OBJECT, - GL_VERTEX_SHADER, "screenquad.vert", - GL_FRAGMENT_SHADER, "mlaa_neigh3.frag"); - assignUniforms("PIXEL_SIZE"); - - assignSamplerNames(0, "blendMap", ST_NEAREST_FILTERED, - 1, "colorMap", ST_NEAREST_FILTERED); - } } diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 6b5c3a1ec..2653600be 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -94,24 +94,6 @@ public: FogShader(); }; -class MLAAColorEdgeDetectionSHader : public TextureShader -{ -public: - MLAAColorEdgeDetectionSHader(); -}; - -class MLAABlendWeightSHader : public TextureShader -{ -public: - MLAABlendWeightSHader(); -}; - -class MLAAGatherSHader : public TextureShader -{ -public: - MLAAGatherSHader(); -}; - } #define FOREACH_SHADER(ACT) \