From b4b1b8f95c9d14e98b9b813c53894ef4f80a8117 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 22 Jan 2019 13:26:56 +1100 Subject: [PATCH] added tile effect --- effects/tile.frag | 27 +++++++++++++++++++++++++++ effects/tile.xml | 13 +++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 effects/tile.frag create mode 100644 effects/tile.xml diff --git a/effects/tile.frag b/effects/tile.frag new file mode 100644 index 000000000..c1f48d767 --- /dev/null +++ b/effects/tile.frag @@ -0,0 +1,27 @@ +#version 110 + +varying vec2 vTexCoord; +uniform sampler2D tex0; // scene buffer + +uniform float tilecount; +uniform bool mirrorx; +uniform bool mirrory; + +void main(void) { + vec2 texCoord = vTexCoord; + + vec2 coord = vec2( + mod(vTexCoord.x*tilecount, 1.0), + mod(vTexCoord.y*tilecount, 1.0) + ); + + if (mirrorx && mod(vTexCoord.x*tilecount, 2.0) > 1.0) { + coord.x = 1.0 - coord.x; + } + + if (mirrory && mod(vTexCoord.y*tilecount, 2.0) > 1.0) { + coord.y = 1.0 - coord.y; + } + + gl_FragColor = vec4(texture2D(tex0, coord)); +} \ No newline at end of file diff --git a/effects/tile.xml b/effects/tile.xml new file mode 100644 index 000000000..d73a6e79e --- /dev/null +++ b/effects/tile.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file