#version 300 es
#define goop 2
in highp vec3 oCol;
in lowp vec2 oTexCoord;
uniform sampler2D tex;
out mediump vec4 fragColor;
void main() {
mediump vec4 col = texture(tex, oTexCoord);
fragColor = col * vec4(oCol, 1.0);
}
#version 300 es
// vertex position
in vec2 pos;
// instanced attributes
in vec3 translate;
in vec3 col;
in float rot;
in uint index;
// uniforms to support pixel coordinate system
uniform vec2 mousePos;
uniform ivec2 resolution;
// spritesheet specific uniforms
uniform ivec2 frames;
uniform ivec2 spriteResolution;
uniform float time;
// color needs to be passed to the fragment
out highp vec3 oCol;
out lowp vec2 oTexCoord;
void main() {
vec2 fres = vec2(resolution);
float rot2 = rot + time * 0.001;
vec2 rotp = vec2(
pos.x * cos(rot2) - pos.y * sin(rot2),
pos.x * sin(rot2) + pos.y * cos(rot2)
) * vec2(spriteResolution / frames) / fres * translate.z;
vec2 m2 = translate.xy - mousePos * translate.z;
m2 = mod(m2, fres);
vec2 st = (m2 - 0.5 * fres) / (0.5 * fres);
gl_Position = vec4(rotp + st, 0.0, 1.0);
oCol = col;
ivec2 offse = ivec2(0.5 * sign(pos) + 0.5);
ivec2 f_ind = ivec2(
index % uint(frames.x),
index / uint(frames.x)
) + offse;
oTexCoord = vec2(f_ind) / vec2(frames);
}
#version 300 es
uniform sampler2D mainAttachment;
in highp vec2 texCoord;
out mediump vec4 fragColor;
void main() {
fragColor = texture(mainAttachment, texCoord);
}
#version 300 es
const lowp vec2 verts[] = vec2[](
vec2(-1.0, -1.0),
vec2( 1.0, -1.0),
vec2( 1.0, 1.0),
vec2(-1.0, -1.0),
vec2( 1.0, 1.0),
vec2(-1.0, 1.0)
);
out highp vec2 texCoord;
void main () {
vec2 ipos = verts[gl_VertexID];
gl_Position = vec4(ipos, 0.0, 1.0);
texCoord = (ipos + 1.0) * 0.5;
}
#version 300 es
in highp vec2 texCoord;
uniform sampler2D mainAttachment;
out mediump vec4 fragColor;
const lowp float weights[18] = float[] (1.0000, 0.9845, 0.9394, 0.8688, 0.7788, 0.6766, 0.5698, 0.4650, 0.3679, 0.2821, 0.2096, 0.1510, 0.1054, 0.0713, 0.0468, 0.0297, 0.0183, 0.0109);
uniform int blurAxis;
uniform int blurRadius;
void main() {
lowp float b = float(blurAxis);
highp vec2 blur_offset = vec2(
b,
1.0 - b
) * (1.0 / vec2(textureSize(mainAttachment, 0)));
mediump vec4 ocol = vec4(0.0);
for (int i = 0; i < blurRadius * (2 + 4 * blurAxis); i++) {
ocol += 0.125 * texture(mainAttachment, texCoord + blur_offset * float(i)) * weights[i];
ocol += 0.125 * texture(mainAttachment, texCoord - blur_offset * float(i)) * weights[i];
}
fragColor = ocol;
}
#version 300 es
in highp vec2 texCoord;
uniform sampler2D mainAttachment;
uniform ivec2 resolution;
out mediump vec4 fragColor;
void main() {
ivec2 pixel = ivec2(texCoord * vec2(resolution));
fragColor = vec4(1.0 - texture(
mainAttachment,
texCoord).rgb, 1.0);
}
#version 300 es
precision highp float;
#define ITER 100
#define THRESH 200.0
#define MAP_COL(v1, v2, v3) vec3(float(v1) / 255.0, float(v2) / 255.0, float(v3) / 255.0)
uniform float time;
vec2 square_complex(vec2 num)
{
return vec2(num.x * num.x - num.y * num.y, 2.0 * num.x * num.y);
}
vec3 vec_interp(vec3 col1, vec3 col2, float val)
{
return vec3(col1.x + (col2.x - col1.x) * val,
col1.y + (col2.y - col1.y) * val,
col1.z + (col2.z - col1.z) * val);
}
vec3 grad2(float val)
{
const vec3 col1 = MAP_COL(1, 2, 35);
const vec3 col2 = MAP_COL(240, 55, 215);
const vec3 col3 = MAP_COL(250, 255, 112);
vec3 bi1 = vec_interp(col1, col2, val);
vec3 bi2 = vec_interp(col2, col3, val);
vec3 final = vec_interp(bi1, bi2, val);
return final;
}
vec3 fractal(vec2 pos)
{
float t2 = time * 0.01;
vec2 c = vec2(-1.0, 2.0) * vec2(sin(t2), cos(t2));
vec2 z = pos - vec2(0, 0.9);
int j = 0;
for (int i = 0; i < ITER; i++)
{
z = square_complex(z) + c;
float l = dot(z, z);
if (l > THRESH)
{
break;
}
j = i;
}
float interp = float(j) / float(ITER);
return grad2(interp);
}
in vec2 texCoord;
out vec4 fragColor;
void main()
{
vec2 fragCoord2 = texCoord.xy / 1103.0;
//vec2 uv = ((fragCoord / iResolution.xy) - 0.5) * 2.0;
// Time varying pixel color
vec3 col = fractal(fragCoord2);
// Output to screen
fragColor = vec4(col, 1.0);//vec4(col,1.0);
}
#version 300 es
const lowp vec2 verts[] = vec2[](
vec2(-1.0, -1.0),
vec2( 1.0, -1.0),
vec2( 1.0, 1.0),
vec2(-1.0, -1.0),
vec2( 1.0, 1.0),
vec2(-1.0, 1.0)
);
out highp vec2 texCoord;
void main () {
vec2 ipos = verts[gl_VertexID];
gl_Position = vec4(ipos, 0.0, 1.0);
texCoord = (ipos + 1.0) * 0.5;
}