ground work for lens dust
This commit is contained in:
parent
4356dfde0c
commit
51bd87d303
@ -2,6 +2,8 @@ uniform sampler2D tex_128;
|
|||||||
uniform sampler2D tex_256;
|
uniform sampler2D tex_256;
|
||||||
uniform sampler2D tex_512;
|
uniform sampler2D tex_512;
|
||||||
|
|
||||||
|
uniform sampler2D tex_dust;
|
||||||
|
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@ -10,5 +12,8 @@ void main()
|
|||||||
vec4 col = .125 * texture(tex_128, uv);
|
vec4 col = .125 * texture(tex_128, uv);
|
||||||
col += .25 * texture(tex_256, uv);
|
col += .25 * texture(tex_256, uv);
|
||||||
col += .5 * texture(tex_512, uv);
|
col += .5 * texture(tex_512, uv);
|
||||||
|
|
||||||
|
col = texture(tex_dust, uv);
|
||||||
|
|
||||||
FragColor = vec4(col.xyz, 1.);
|
FragColor = vec4(col.xyz, 1.);
|
||||||
}
|
}
|
||||||
|
@ -332,25 +332,32 @@ public:
|
|||||||
} // render
|
} // render
|
||||||
}; // BloomShader
|
}; // BloomShader
|
||||||
|
|
||||||
|
static video::ITexture *lensDustTex = 0;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
class BloomBlendShader : public TextureShader<BloomBlendShader, 3>
|
class BloomBlendShader : public TextureShader<BloomBlendShader, 4>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BloomBlendShader()
|
BloomBlendShader()
|
||||||
{
|
{
|
||||||
|
if (!lensDustTex)
|
||||||
|
lensDustTex = irr_driver->getTexture(FileManager::TEXTURE, "gfx_lensDust_a.png");
|
||||||
|
|
||||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
|
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
|
||||||
GL_FRAGMENT_SHADER, "bloomblend.frag");
|
GL_FRAGMENT_SHADER, "bloomblend.frag");
|
||||||
assignUniforms();
|
assignUniforms();
|
||||||
assignSamplerNames(0, "tex_128", ST_BILINEAR_FILTERED,
|
assignSamplerNames(0, "tex_128", ST_BILINEAR_FILTERED,
|
||||||
1, "tex_256", 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
|
} // BloomBlendShader
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void render()
|
void render()
|
||||||
{
|
{
|
||||||
setTextureUnits(irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
|
setTextureUnits(irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
|
||||||
irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
|
irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
|
||||||
irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
|
irr_driver->getRenderTargetTexture(RTT_BLOOM_512),
|
||||||
|
getTextureGLuint(lensDustTex));
|
||||||
drawFullScreenEffect();
|
drawFullScreenEffect();
|
||||||
} // render
|
} // render
|
||||||
}; // BloomBlendShader
|
}; // BloomBlendShader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user