This commit is contained in:
Anuken
2019-06-24 19:39:57 -04:00
parent ab716e96e2
commit f8526e1ac7
12 changed files with 645 additions and 23 deletions

View File

@@ -0,0 +1,23 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture0;
uniform sampler2D u_texture1;
uniform float BloomIntensity;
uniform float OriginalIntensity;
varying MED vec2 v_texCoords;
void main()
{
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
original = original * (vec4(1.0) - bloom);
gl_FragColor = original + bloom;
}

View File

@@ -0,0 +1,26 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture;
varying MED vec2 v_texCoords0;
varying MED vec2 v_texCoords1;
varying MED vec2 v_texCoords2;
varying MED vec2 v_texCoords3;
varying MED vec2 v_texCoords4;
const float center = 0.2270270270;
const float close = 0.3162162162;
const float far = 0.0702702703;
void main()
{
gl_FragColor = far * texture2D(u_texture, v_texCoords0)
+ close * texture2D(u_texture, v_texCoords1)
+ center * texture2D(u_texture, v_texCoords2)
+ close * texture2D(u_texture, v_texCoords3)
+ far * texture2D(u_texture, v_texCoords4);
}

View File

@@ -0,0 +1,15 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
gl_FragColor = (texture2D(u_texture0, v_texCoords) - vec4(threshold.r)) * threshold.g;
}

View File

@@ -0,0 +1,23 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture0;
uniform sampler2D u_texture1;
uniform float BloomIntensity;
uniform float OriginalIntensity;
varying MED vec2 v_texCoords;
void main()
{
vec3 original = texture2D(u_texture0, v_texCoords).rgb;
vec3 bloom = texture2D(u_texture1, v_texCoords).rgb * BloomIntensity;
original = OriginalIntensity * (original - original * bloom);
gl_FragColor.rgb = original + bloom;
}

View File

@@ -0,0 +1,31 @@
#ifdef GL_ES
#define MED mediump
#else
#define MED
#endif
attribute vec4 a_position;
attribute vec2 a_texCoord0;
uniform vec2 dir;
uniform vec2 size;
varying MED vec2 v_texCoords0;
varying MED vec2 v_texCoords1;
varying MED vec2 v_texCoords2;
varying MED vec2 v_texCoords3;
varying MED vec2 v_texCoords4;
const vec2 futher = vec2(3.2307692308, 3.2307692308);
const vec2 closer = vec2(1.3846153846, 1.3846153846);
void main()
{
vec2 sizeAndDir = dir / size;
vec2 f = futher*sizeAndDir;
vec2 c = closer*sizeAndDir;
v_texCoords0 = a_texCoord0 - f;
v_texCoords1 = a_texCoord0 - c;
v_texCoords2 = a_texCoord0;
v_texCoords3 = a_texCoord0 + c;
v_texCoords4 = a_texCoord0 + f;
gl_Position = a_position;
}

View File

@@ -0,0 +1,26 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture;
varying MED vec2 v_texCoords0;
varying MED vec2 v_texCoords1;
varying MED vec2 v_texCoords2;
varying MED vec2 v_texCoords3;
varying MED vec2 v_texCoords4;
const float center = 0.2270270270;
const float close = 0.3162162162;
const float far = 0.0702702703;
void main()
{
gl_FragColor.rgb = far * texture2D(u_texture, v_texCoords0).rgb
+ close * texture2D(u_texture, v_texCoords1).rgb
+ center * texture2D(u_texture, v_texCoords2).rgb
+ close * texture2D(u_texture, v_texCoords3).rgb
+ far * texture2D(u_texture, v_texCoords4).rgb;
}

View File

@@ -0,0 +1,17 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
vec4 tex = texture2D(u_texture0, v_texCoords);
vec3 colors = (tex.rgb - threshold.r) * threshold.g * tex.a;
gl_FragColor = vec4(colors, tex.a);
}

View File

@@ -0,0 +1,13 @@
#ifdef GL_ES
#define MED mediump
#else
#define MED
#endif
attribute vec4 a_position;
attribute vec2 a_texCoord0;
varying MED vec2 v_texCoords;
void main()
{
v_texCoords = a_texCoord0;
gl_Position = a_position;
}

View File

@@ -0,0 +1,15 @@
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define LOWP
#define MED
#endif
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
gl_FragColor.rgb = (texture2D(u_texture0, v_texCoords).rgb - vec3(threshold.x)) * threshold.y;
}