Lightprepass: Remove now useless lightblend shader.

This commit is contained in:
Vincent Lejeune 2014-02-02 20:17:47 +01:00
parent 06b7ba09f5
commit cd43ee3c9d
6 changed files with 4 additions and 103 deletions

View File

@ -1,21 +0,0 @@
#version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 texc = uv;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -342,57 +342,6 @@ void PostProcessing::renderSunlight()
glBindVertexArray(0);
}
void PostProcessing::renderLightbBlend(ITexture *diffuse, ITexture *specular, ITexture *ao, ITexture *specmap, bool debug)
{
const SColorf s = irr_driver->getSceneManager()->getAmbientLight();
glStencilFunc(GL_EQUAL, 1, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
if (debug)
glBlendFunc(GL_ONE, GL_ZERO);
else
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glDisable(GL_DEPTH_TEST);
glUseProgram(FullScreenShader::LightBlendShader::Program);
glBindVertexArray(FullScreenShader::LightBlendShader::vao);
glUniform3f(FullScreenShader::LightBlendShader::uniform_ambient, s.r, s.g, s.b);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(diffuse)->getOpenGLTextureName());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glUniform1i(FullScreenShader::LightBlendShader::uniform_diffuse, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(specular)->getOpenGLTextureName());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glUniform1i(FullScreenShader::LightBlendShader::uniform_specular, 1);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(ao)->getOpenGLTextureName());
glUniform1i(FullScreenShader::LightBlendShader::uniform_ambient_occlusion, 2);
glActiveTexture(GL_TEXTURE3);
if (!UserConfigParams::m_ssao)
{
GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ONE};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(specmap)->getOpenGLTextureName());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glUniform1i(FullScreenShader::LightBlendShader::uniform_specular_map, 3);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
glDisable(GL_STENCIL_TEST);
}
void PostProcessing::renderGaussian3Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height)
{

View File

@ -75,8 +75,6 @@ public:
/** Generate diffuse and specular map */
void renderPointlight(const std::vector<float> &positions, const std::vector<float> &colors, const std::vector<float> &energy);
void renderSunlight();
/** Blend all light related map */
void renderLightbBlend(video::ITexture *diffuse, video::ITexture *specular, video::ITexture *ao, video::ITexture *specmap, bool debug);
void renderFog(const core::vector3df &campos, const core::matrix4 &ipvmat);
void renderSSAO(const core::matrix4 &invprojm, const core::matrix4 &projm);

View File

@ -249,7 +249,6 @@ void Shaders::loadShaders()
FullScreenShader::Gaussian6HBlurShader::init();
FullScreenShader::Gaussian6VBlurShader::init();
FullScreenShader::GlowShader::init();
FullScreenShader::LightBlendShader::init();
FullScreenShader::PassThroughShader::init();
FullScreenShader::PointLightShader::init();
FullScreenShader::PPDisplaceShader::init();
@ -1192,24 +1191,6 @@ namespace FullScreenShader
glUniform1i(uniform_dtex, TU_dtex);
}
GLuint LightBlendShader::Program;
GLuint LightBlendShader::uniform_diffuse;
GLuint LightBlendShader::uniform_specular;
GLuint LightBlendShader::uniform_ambient_occlusion;
GLuint LightBlendShader::uniform_specular_map;
GLuint LightBlendShader::uniform_ambient;
GLuint LightBlendShader::vao;
void LightBlendShader::init()
{
Program = LoadProgram(file_manager->getAsset("shaders/screenquad.vert").c_str(), file_manager->getAsset("shaders/lightblend.frag").c_str());
uniform_diffuse = glGetUniformLocation(Program, "diffuse");
uniform_specular = glGetUniformLocation(Program, "specular");
uniform_ambient_occlusion = glGetUniformLocation(Program, "ambient_occlusion");
uniform_specular_map = glGetUniformLocation(Program, "specular_map");
uniform_ambient = glGetUniformLocation(Program, "ambient");
vao = createVAO(Program);
}
GLuint Gaussian6HBlurShader::Program;
GLuint Gaussian6HBlurShader::uniform_tex;
GLuint Gaussian6HBlurShader::uniform_pixel;

View File

@ -341,16 +341,6 @@ public:
static void setUniforms(const core::vector3df &direction, const core::matrix4 &InvProjMatrix, float r, float g, float b, unsigned TU_ntex, unsigned TU_dtex);
};
class LightBlendShader
{
public:
static GLuint Program;
static GLuint uniform_diffuse, uniform_specular, uniform_ambient_occlusion, uniform_specular_map, uniform_ambient;
static GLuint vao;
static void init();
};
class Gaussian6HBlurShader
{
public:

View File

@ -222,6 +222,7 @@ void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjecti
void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
{
glDisable(GL_CULL_FACE);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
@ -234,6 +235,7 @@ void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProje
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
glEnable(GL_CULL_FACE);
}
static
@ -387,6 +389,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
{
glDisable(GL_CULL_FACE);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
@ -416,6 +419,7 @@ void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glEnable(GL_CULL_FACE);
}
void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector3df windDir)