ground work for lens dust

This commit is contained in:
samuncle 2015-07-26 04:48:29 +02:00
parent 4356dfde0c
commit 51bd87d303
2 changed files with 15 additions and 3 deletions

View File

@ -2,6 +2,8 @@ uniform sampler2D tex_128;
uniform sampler2D tex_256;
uniform sampler2D tex_512;
uniform sampler2D tex_dust;
out vec4 FragColor;
void main()
@ -10,5 +12,8 @@ void main()
vec4 col = .125 * texture(tex_128, uv);
col += .25 * texture(tex_256, uv);
col += .5 * texture(tex_512, uv);
col = texture(tex_dust, uv);
FragColor = vec4(col.xyz, 1.);
}

View File

@ -332,25 +332,32 @@ public:
} // render
}; // BloomShader
static video::ITexture *lensDustTex = 0;
// ============================================================================
class BloomBlendShader : public TextureShader<BloomBlendShader, 3>
class BloomBlendShader : public TextureShader<BloomBlendShader, 4>
{
public:
BloomBlendShader()
{
if (!lensDustTex)
lensDustTex = irr_driver->getTexture(FileManager::TEXTURE, "gfx_lensDust_a.png");
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "bloomblend.frag");
assignUniforms();
assignSamplerNames(0, "tex_128", ST_BILINEAR_FILTERED,
1, "tex_256", ST_BILINEAR_FILTERED,
2, "tex_512", ST_BILINEAR_FILTERED);
2, "tex_512", ST_BILINEAR_FILTERED,
3, "tex_dust", ST_BILINEAR_FILTERED);
} // BloomBlendShader
// ------------------------------------------------------------------------
void render()
{
setTextureUnits(irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
irr_driver->getRenderTargetTexture(RTT_BLOOM_512),
getTextureGLuint(lensDustTex));
drawFullScreenEffect();
} // render
}; // BloomBlendShader