diff options
author | Adrian Kummerlaender | 2018-05-23 20:16:09 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2018-05-23 20:16:09 +0200 |
commit | 630038754c1a9a04e05fc59bdbced17c06f3dab5 (patch) | |
tree | 235eb0cde1c7a4f667b77402617a99360797f80f /src/shader | |
parent | 84bcd409a3743e933d039a9b3e073030fd2630df (diff) | |
download | computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar.gz computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar.bz2 computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar.lz computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar.xz computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.tar.zst computicle-630038754c1a9a04e05fc59bdbced17c06f3dab5.zip |
Pass texture count to display fragment shader
Diffstat (limited to 'src/shader')
-rw-r--r-- | src/shader/display_fragment.glsl | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/shader/display_fragment.glsl b/src/shader/display_fragment.glsl index 03986a0..b731ebe 100644 --- a/src/shader/display_fragment.glsl +++ b/src/shader/display_fragment.glsl @@ -4,27 +4,12 @@ static const std::string DISPLAY_FRAGMENT_SHADER_CODE = R"( out vec4 FragColor; in vec2 TexCoords; -uniform sampler2D screen_texture_0; -uniform sampler2D screen_texture_1; -uniform sampler2D screen_texture_2; -uniform sampler2D screen_texture_3; -uniform sampler2D screen_texture_4; -uniform sampler2D screen_texture_5; -uniform sampler2D screen_texture_6; -uniform sampler2D screen_texture_7; -uniform sampler2D screen_texture_8; -uniform sampler2D screen_texture_9; +uniform sampler2D screen_textures[64]; +uniform int screen_textures_size; void main() { - FragColor = texture(screen_texture_0, TexCoords) - + 0.9 * texture(screen_texture_1, TexCoords) - + 0.8 * texture(screen_texture_2, TexCoords) - + 0.7 * texture(screen_texture_3, TexCoords) - + 0.6 * texture(screen_texture_4, TexCoords) - + 0.5 * texture(screen_texture_5, TexCoords) - + 0.4 * texture(screen_texture_6, TexCoords) - + 0.3 * texture(screen_texture_7, TexCoords) - + 0.2 * texture(screen_texture_8, TexCoords) - + 0.1 * texture(screen_texture_9, TexCoords); + for ( int i = 0; i < screen_textures_size; ++i ) { + FragColor += (1.0 - i*1.0/screen_textures_size) * texture(screen_textures[i], TexCoords); + } } )"; |