Fog: Use depthbuffer.
This commit is contained in:
parent
bc57d246e7
commit
ecac127dd6
@ -15,9 +15,9 @@ out vec4 FragColor;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float z = texture(tex, uv).a;
|
float z = texture(tex, uv).x;
|
||||||
|
|
||||||
vec3 tmp = vec3(gl_TexCoord[0].xy, z);
|
vec3 tmp = vec3(uv, z);
|
||||||
tmp = tmp * 2.0 - 1.0;
|
tmp = tmp * 2.0 - 1.0;
|
||||||
|
|
||||||
vec4 xpos = vec4(tmp, 1.0);
|
vec4 xpos = vec4(tmp, 1.0);
|
||||||
|
@ -567,7 +567,7 @@ void PostProcessing::renderFog(const core::vector3df &campos, const core::matrix
|
|||||||
glUseProgram(FullScreenShader::FogShader::Program);
|
glUseProgram(FullScreenShader::FogShader::Program);
|
||||||
glBindVertexArray(FullScreenShader::FogShader::vao);
|
glBindVertexArray(FullScreenShader::FogShader::vao);
|
||||||
|
|
||||||
setTexture(0, static_cast<irr::video::COpenGLTexture*>(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH))->getOpenGLTextureName(), GL_NEAREST, GL_NEAREST);
|
setTexture(0, static_cast<irr::video::COpenGLFBOTexture*>(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH))->DepthBufferTexture, GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::FogShader::setUniforms(ipvmat, fogmax, startH, endH, start, end, col, campos, 0);
|
FullScreenShader::FogShader::setUniforms(ipvmat, fogmax, startH, endH, start, end, col, campos, 0);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user