Tinkering with a way to do modal UIs for things like inventory etc.
This commit is contained in:
parent
db441000f8
commit
d8400d0a76
9 changed files with 120 additions and 92 deletions
23
shaders/modal.frag
Normal file
23
shaders/modal.frag
Normal file
|
@ -0,0 +1,23 @@
|
|||
uniform sampler2D source;
|
||||
uniform sampler2D bloom;
|
||||
uniform vec2 offsetFactor;
|
||||
uniform float darkness;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 textureCoordinates = gl_TexCoord[0].xy;
|
||||
vec4 color = vec4(0.0);
|
||||
color += texture2D(source, textureCoordinates - 4.0 * offsetFactor) * 0.0162162162;
|
||||
color += texture2D(source, textureCoordinates - 3.0 * offsetFactor) * 0.0540540541;
|
||||
color += texture2D(source, textureCoordinates - 2.0 * offsetFactor) * 0.1216216216;
|
||||
color += texture2D(source, textureCoordinates - offsetFactor) * 0.1945945946;
|
||||
color += texture2D(source, textureCoordinates) * 0.2270270270;
|
||||
color += texture2D(source, textureCoordinates + offsetFactor) * 0.1945945946;
|
||||
color += texture2D(source, textureCoordinates + 2.0 * offsetFactor) * 0.1216216216;
|
||||
color += texture2D(source, textureCoordinates + 3.0 * offsetFactor) * 0.0540540541;
|
||||
color += texture2D(source, textureCoordinates + 4.0 * offsetFactor) * 0.0162162162;
|
||||
|
||||
vec4 sourceFragment = texture2D(source, gl_TexCoord[0].xy);
|
||||
vec4 bloomFragment = texture2D(bloom, gl_TexCoord[0].xy);
|
||||
gl_FragColor = color + sourceFragment - bloomFragment - darkness;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue