Port passthrough and glow shaders
This commit is contained in:
parent
c3cead9f9c
commit
465e52713e
@ -446,15 +446,11 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
||||
|
||||
void PostProcessing::renderPassThrough(GLuint tex)
|
||||
{
|
||||
glUseProgram(FullScreenShader::PassThroughShader::getInstance()->Program);
|
||||
glBindVertexArray(FullScreenShader::PassThroughShader::getInstance()->vao);
|
||||
|
||||
glUseProgram(FullScreenShader::PassThroughShader::Program);
|
||||
glBindVertexArray(FullScreenShader::PassThroughShader::vao);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glUniform1i(FullScreenShader::PassThroughShader::uniform_texture, 0);
|
||||
setTexture(FullScreenShader::PassThroughShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::PassThroughShader::getInstance()->setUniforms();
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
@ -476,18 +472,15 @@ void PostProcessing::renderTextureLayer(unsigned tex, unsigned layer)
|
||||
|
||||
void PostProcessing::renderGlow(unsigned tex)
|
||||
{
|
||||
glUseProgram(FullScreenShader::GlowShader::getInstance()->Program);
|
||||
glBindVertexArray(FullScreenShader::GlowShader::getInstance()->vao);
|
||||
|
||||
glUseProgram(FullScreenShader::GlowShader::Program);
|
||||
glBindVertexArray(FullScreenShader::GlowShader::vao);
|
||||
|
||||
setTexture(0, tex, GL_LINEAR, GL_LINEAR);
|
||||
glUniform1i(FullScreenShader::GlowShader::uniform_tex, 0);
|
||||
setTexture(FullScreenShader::GlowShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||
FullScreenShader::GlowShader::getInstance()->setUniforms();
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
ITexture *noise_tex = 0;
|
||||
|
||||
void PostProcessing::renderSSAO()
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@ -503,9 +496,6 @@ void PostProcessing::renderSSAO()
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
irr_driver->getFBO(FBO_SSAO).Bind();
|
||||
|
||||
if (!noise_tex)
|
||||
noise_tex = irr_driver->getTexture(file_manager->getAsset("textures/noise.png").c_str());
|
||||
|
||||
glUseProgram(FullScreenShader::SSAOShader::getInstance()->Program);
|
||||
glBindVertexArray(FullScreenShader::SSAOShader::getInstance()->vao);
|
||||
|
||||
@ -634,13 +624,6 @@ static void renderDoF(FrameBuffer &fbo, GLuint rtt)
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
static void averageTexture(GLuint tex)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void PostProcessing::applyMLAA()
|
||||
{
|
||||
const core::vector2df &PIXEL_SIZE = core::vector2df(1.0f / UserConfigParams::m_width, 1.0f / UserConfigParams::m_height);
|
||||
|
@ -373,8 +373,6 @@ void Shaders::loadShaders()
|
||||
initCubeVBO();
|
||||
initFrustrumVBO();
|
||||
initShadowVPMUBO();
|
||||
FullScreenShader::GlowShader::init();
|
||||
FullScreenShader::PassThroughShader::init();
|
||||
FullScreenShader::LayerPassThroughShader::init();
|
||||
FullScreenShader::DiffuseEnvMapShader::init();
|
||||
FullScreenShader::RHDebug::init();
|
||||
@ -1840,15 +1838,14 @@ namespace FullScreenShader
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
GLuint PassThroughShader::Program;
|
||||
GLuint PassThroughShader::uniform_texture;
|
||||
GLuint PassThroughShader::vao;
|
||||
void PassThroughShader::init()
|
||||
PassThroughShader::PassThroughShader()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/texturedquad.frag").c_str());
|
||||
uniform_texture = glGetUniformLocation(Program, "texture");
|
||||
TU_tex = 0;
|
||||
AssignUniforms();
|
||||
AssignTextureUnit(Program, TexUnit(TU_tex, "texture"));
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
@ -1877,15 +1874,14 @@ namespace FullScreenShader
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
GLuint GlowShader::Program;
|
||||
GLuint GlowShader::uniform_tex;
|
||||
GLuint GlowShader::vao;
|
||||
void GlowShader::init()
|
||||
GlowShader::GlowShader()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/glow.frag").c_str());
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
AssignUniforms();
|
||||
TU_tex = 0;
|
||||
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||
vao = createVAO(Program);
|
||||
}
|
||||
|
||||
|
@ -682,14 +682,13 @@ public:
|
||||
Gaussian3VBlurShader();
|
||||
};
|
||||
|
||||
class PassThroughShader
|
||||
class PassThroughShader : public ShaderHelperSingleton<PassThroughShader>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_texture;
|
||||
static GLuint vao;
|
||||
GLuint TU_tex;
|
||||
GLuint vao;
|
||||
|
||||
static void init();
|
||||
PassThroughShader();
|
||||
};
|
||||
|
||||
class LayerPassThroughShader
|
||||
@ -711,14 +710,13 @@ public:
|
||||
LinearizeDepthShader();
|
||||
};
|
||||
|
||||
class GlowShader
|
||||
class GlowShader : public ShaderHelperSingleton<GlowShader>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_tex;
|
||||
static GLuint vao;
|
||||
GLuint TU_tex;
|
||||
GLuint vao;
|
||||
|
||||
static void init();
|
||||
GlowShader();
|
||||
};
|
||||
|
||||
class SSAOShader : public ShaderHelperSingleton<SSAOShader, float, float, float>
|
||||
|
Loading…
Reference in New Issue
Block a user