// Generated by tools/gen_filter_shaders.py from the GLSL that p5.js 2.x
// (p5.strands) generates for its filters. DO NOT EDIT.
///|
let filter_base_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_base_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|vec4 HOOK_getColor(FilterInputs inputs, in sampler2D canvasContent) {
#| return getTexture(canvasContent, inputs.texCoord);
#| }
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_blur_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|uniform float radius;
#|uniform vec2 direction;
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_blur_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|uniform float radius;
#|uniform vec2 direction;
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| float T0 = floor((radius * float(7.0000)));
#| float T1;
#| if (mod(T0, float(2)) == float(0.0000))
#| {
#| float T2 = (T0 + float(1.0000));
#| T1 = T2;
#| }
#| else
#| {
#| T1 = T0;
#| }
#| vec4 T3 = vec4(0.0000, 0.0000, 0.0000, 0.0000);
#| float T4 = float(1.0000);
#| float T5;
#| float T6;
#| if (T1 > float(64.0000))
#| {
#| float T7 = (T1 / float(64.0000));
#| float T8 = float(64.0000);
#| T5 = T7;
#| T6 = T8;
#| }
#| else
#| {
#| T5 = T4;
#| T6 = T1;
#| }
#| vec3 T9 = fract(((_p5_param_inputs.texCoord * _p5_param_inputs.canvasSize).xyx * vec3(0.1031)));
#| vec3 T10 = (T9 + vec3(dot(T9, (T9.yzx + vec3(33.3300)))));
#| float T11 = float(0.0000);
#| float T12;
#| vec4 T13;
#| float T14;
#| float T15 = float(0.0000);
#| T13 = T3;
#| T14 = T11;
#| for (
#| T12 = T15;
#| ;
#|
#| )
#| {
#| if (!(T12 < T6))
#| {
#| break;
#| }
#| vec4 T16 = T13;
#| float T17 = T14;
#| float T18 = (((T12 * T5) - (((T6 - float(1.0000)) * float(0.5000)) * T5)) + (max((T5 - (_p5_param_inputs.texelSize.x * _p5_param_inputs.canvasSize.x)), float(0)) * mix(-float(0.5000), float(0.5), fract(((T10.x + T10.y) * T10.z)))));
#| float T19 = pow(((((T6 - float(1.0000)) * float(0.5000)) * T5) - abs(T18)), float(2));
#| vec4 T20 = getTexture(_p5_param_canvasContent, (_p5_param_inputs.texCoord + ((vec2(T18, T18) / _p5_param_inputs.canvasSize) * direction)));
#| T13 = (T16 + ((vec4(T19) * T20) * vec4(T20.w, T20.w, T20.w, 1.0000)));
#| T14 = (T17 + T19);
#| T12 = (T12 + float(1.0000));
#| }
#| vec4 T21 = (T13 / vec4(T14));
#| return vec4((T21.x / T21.w), (T21.y / T21.w), (T21.z / T21.w), T21.w);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_dilate_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_dilate_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, vec2(_p5_param_inputs.texCoord));
#| float T1 = dot(T0.xyz, vec3(0.2126, 0.7152, 0.0722));
#| float T2;
#| float T3;
#| vec4 T4;
#| float T5 = -float(1.0000);
#| T3 = T1;
#| T4 = T0;
#| for (
#| T2 = T5;
#| (T2 <= float(1.0000));
#| T2 = (T2 + float(1.0000))
#| )
#| {
#| float T6 = T3;
#| vec4 T7 = T4;
#| float T8;
#| float T9;
#| vec4 T10;
#| float T11 = -float(1.0000);
#| T9 = T6;
#| T10 = T7;
#| for (
#| T8 = T11;
#| (T8 <= float(1.0000));
#| T8 = (T8 + float(1.0000))
#| )
#| {
#| float T12 = T9;
#| vec4 T13 = T10;
#| float T14;
#| vec4 T15;
#| if ((T2 != float(0.0000)) || (T8 != float(0.0000)))
#| {
#| vec4 T16 = getTexture(_p5_param_canvasContent, (_p5_param_inputs.texCoord + (vec2(T2, T8) * _p5_param_inputs.texelSize)));
#| float T17 = dot(T16.xyz, vec3(0.2126, 0.7152, 0.0722));
#| float T18;
#| vec4 T19;
#| if (T17 > T12)
#| {
#| T18 = T17;
#| T19 = T16;
#| }
#| else
#| {
#| T18 = T12;
#| T19 = T13;
#| }
#| T14 = T18;
#| T15 = T19;
#| }
#| else
#| {
#| T14 = T12;
#| T15 = T13;
#| }
#| T9 = T14;
#| T10 = T15;
#| }
#| T3 = T9;
#| T4 = T10;
#| }
#| return T4;
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_erode_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_erode_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, vec2(_p5_param_inputs.texCoord));
#| float T1 = dot(T0.xyz, vec3(0.2126, 0.7152, 0.0722));
#| float T2;
#| float T3;
#| vec4 T4;
#| float T5 = -float(1.0000);
#| T3 = T1;
#| T4 = T0;
#| for (
#| T2 = T5;
#| (T2 <= float(1.0000));
#| T2 = (T2 + float(1.0000))
#| )
#| {
#| float T6 = T3;
#| vec4 T7 = T4;
#| float T8;
#| float T9;
#| vec4 T10;
#| float T11 = -float(1.0000);
#| T9 = T6;
#| T10 = T7;
#| for (
#| T8 = T11;
#| (T8 <= float(1.0000));
#| T8 = (T8 + float(1.0000))
#| )
#| {
#| float T12 = T9;
#| vec4 T13 = T10;
#| float T14;
#| vec4 T15;
#| if ((T2 != float(0.0000)) || (T8 != float(0.0000)))
#| {
#| vec4 T16 = getTexture(_p5_param_canvasContent, (_p5_param_inputs.texCoord + (vec2(T2, T8) * _p5_param_inputs.texelSize)));
#| float T17 = dot(T16.xyz, vec3(0.2126, 0.7152, 0.0722));
#| float T18;
#| vec4 T19;
#| if (T17 < T12)
#| {
#| T18 = T17;
#| T19 = T16;
#| }
#| else
#| {
#| T18 = T12;
#| T19 = T13;
#| }
#| T14 = T18;
#| T15 = T19;
#| }
#| else
#| {
#| T14 = T12;
#| T15 = T13;
#| }
#| T9 = T14;
#| T10 = T15;
#| }
#| T3 = T9;
#| T4 = T10;
#| }
#| return T4;
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_gray_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_gray_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, vec2(_p5_param_inputs.texCoord));
#| float T1 = dot(T0.xyz, vec3(0.2126, 0.7152, 0.0722));
#| return vec4(T1, T1, T1, T0.w);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_invert_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_invert_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, vec2(_p5_param_inputs.texCoord));
#| return vec4((vec3(1.0000, 1.0000, 1.0000) - T0.xyz), T0.w);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_opaque_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_opaque_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| return vec4(getTexture(_p5_param_canvasContent, vec2(_p5_param_inputs.texCoord)).xyz, 1.0000);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_posterize_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|uniform float filterParameter;
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_posterize_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|uniform float filterParameter;
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, _p5_param_inputs.texCoord);
#| return vec4((floor((T0.xyz * vec3(filterParameter))) / vec3((filterParameter - float(1.0000)))), T0.w);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|
///|
let filter_threshold_vert : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp int;
#|
#|uniform mat4 uModelViewMatrix;
#|uniform mat4 uProjectionMatrix;
#|
#|IN vec3 aPosition;
#|IN vec2 aTexCoord;
#|OUT vec2 vTexCoord;
#|
#|
#|uniform float filterParameter;
#|
#|
#|
#|
#|void main() {
#| // transferring texcoords for the frag shader
#| vTexCoord = aTexCoord;
#|
#| // copy position with a fourth coordinate for projection (1.0 is normal)
#| vec4 positionVec4 = vec4(aPosition, 1.0);
#|
#| // project to 3D space
#| gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
#|}
#|
///|
let filter_threshold_frag : String =
#|#ifdef WEBGL2
#|
#|#define IN in
#|#define OUT out
#|
#|#ifdef FRAGMENT_SHADER
#|out vec4 outColor;
#|#define OUT_COLOR outColor
#|#endif
#|#define TEXTURE texture
#|
#|#else
#|
#|#ifdef FRAGMENT_SHADER
#|#define IN varying
#|#else
#|#define IN attribute
#|#endif
#|#define OUT varying
#|#define TEXTURE texture2D
#|
#|#ifdef FRAGMENT_SHADER
#|#define OUT_COLOR gl_FragColor
#|#endif
#|
#|#endif
#|
#|vec4 getTexture(in sampler2D content, vec2 coord) {
#| vec4 color = TEXTURE(content, coord);
#| if (color.a > 0.) color.rgb /= color.a;
#| return color;
#|}
#|precision highp float;
#|
#|uniform sampler2D tex0;
#|uniform vec2 canvasSize;
#|uniform vec2 texelSize;
#|
#|IN vec2 vTexCoord;
#|
#|struct FilterInputs {
#| vec2 texCoord;
#| vec2 canvasSize;
#| vec2 texelSize;
#|};
#|
#|
#|#define AUGMENTED_HOOK_getColor
#|uniform float filterParameter;
#|
#|
#|
#|
#|vec4 HOOK_getColor(FilterInputs _p5_param_inputs, sampler2D _p5_param_canvasContent) {
#| vec4 T0 = getTexture(_p5_param_canvasContent, _p5_param_inputs.texCoord);
#| float T1 = step((floor((filterParameter * float(255.0000))) / float(255.0000)), dot(T0.xyz, vec3(0.2126, 0.7152, 0.0722)));
#| return vec4(T1, T1, T1, T0.w);
#|}
#|void main(void) {
#| FilterInputs inputs;
#| inputs.texCoord = vTexCoord;
#| inputs.canvasSize = canvasSize;
#| inputs.texelSize = texelSize;
#| OUT_COLOR = HOOK_getColor(inputs, tex0);
#| OUT_COLOR.rgb *= outColor.a;
#|}
#|