[418/906] effects: disable gst-indent in the sources
Fix some crazy formatting caused by gst-indent previous runs and disable the script for this file. The best would be to move shaders into separate files and load them at runtime or hardcode them at compile time.
This commit is contained in:
parent
e42b3eddbf
commit
4ff22b2c67
@ -24,6 +24,12 @@
|
||||
/* A common file for sources is needed since shader sources can be
|
||||
* generic and reused by several effects */
|
||||
|
||||
/* FIXME */
|
||||
/* Move sooner or later into single .frag .vert files and either bake
|
||||
* them into a c file at compile time or load them at run time */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
/* Vertex shader */
|
||||
const gchar *vertex_shader_source =
|
||||
"attribute vec4 a_position;"
|
||||
@ -125,7 +131,8 @@ const gchar *stretch_fragment_source =
|
||||
" normcoord *= 2.0 - smoothstep(0.0, 0.7, r);"
|
||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord);"
|
||||
" gl_FragColor = color * gl_Color;" "}";
|
||||
" gl_FragColor = color * gl_Color;"
|
||||
"}";
|
||||
|
||||
/* Light Tunnel effect */
|
||||
const gchar *tunnel_fragment_source =
|
||||
@ -134,14 +141,19 @@ const gchar *tunnel_fragment_source =
|
||||
"uniform float width, height;"
|
||||
"void main () {"
|
||||
" vec2 tex_size = vec2 (width, height);"
|
||||
" vec2 texturecoord = gl_TexCoord[0].xy;" " vec2 normcoord;"
|
||||
" vec2 texturecoord = gl_TexCoord[0].xy;"
|
||||
" vec2 normcoord;"
|
||||
/* little trick with normalized coords to obtain a circle */
|
||||
" normcoord = texturecoord / tex_size.x - tex_size / tex_size.x;" " float r = length(normcoord);" " float phi = atan(normcoord.y, normcoord.x);" " r = clamp (r, 0.0, 0.5);" /* is there a way to do this without polars? */
|
||||
" normcoord = texturecoord / tex_size.x - tex_size / tex_size.x;"
|
||||
" float r = length(normcoord);"
|
||||
" float phi = atan(normcoord.y, normcoord.x);"
|
||||
" r = clamp (r, 0.0, 0.5);" /* is there a way to do this without polars? */
|
||||
" normcoord.x = r * cos(phi);"
|
||||
" normcoord.y = r * sin(phi); "
|
||||
" texturecoord = (normcoord + tex_size/tex_size.x) * tex_size.x;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord); "
|
||||
" gl_FragColor = color;" "}";
|
||||
" gl_FragColor = color;"
|
||||
"}";
|
||||
|
||||
/* FishEye effect */
|
||||
const gchar *fisheye_fragment_source =
|
||||
@ -157,7 +169,8 @@ const gchar *fisheye_fragment_source =
|
||||
" normcoord *= r/sqrt(2.0);"
|
||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord);"
|
||||
" gl_FragColor = color;" "}";
|
||||
" gl_FragColor = color;"
|
||||
"}";
|
||||
|
||||
|
||||
/* Twirl effect */
|
||||
@ -177,7 +190,8 @@ const gchar *twirl_fragment_source =
|
||||
" normcoord.y = r * sin(phi);"
|
||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord); "
|
||||
" gl_FragColor = color;" "}";
|
||||
" gl_FragColor = color;"
|
||||
"}";
|
||||
|
||||
|
||||
/* Bulge effect */
|
||||
@ -194,7 +208,8 @@ const gchar *bulge_fragment_source =
|
||||
" normcoord *= smoothstep (-0.1, 0.5, r);"
|
||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord);"
|
||||
" gl_FragColor = color;" "}";
|
||||
" gl_FragColor = color;"
|
||||
"}";
|
||||
|
||||
|
||||
/* Square Effect */
|
||||
@ -213,10 +228,18 @@ const gchar *square_fragment_source =
|
||||
" normcoord /= 2.0; /* zoom amount */"
|
||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord);"
|
||||
" gl_FragColor = color * gl_Color;" "}";
|
||||
" gl_FragColor = color * gl_Color;"
|
||||
"}";
|
||||
|
||||
|
||||
const gchar *luma_threshold_fragment_source = "#extension GL_ARB_texture_rectangle : enable\n" "uniform sampler2DRect tex;" "void main () {" " vec2 texturecoord = gl_TexCoord[0].st;" " int i;" " vec4 color = texture2DRect(tex, texturecoord);" " float luma = dot(color.rgb, vec3(0.2125, 0.7154, 0.0721));" /* BT.709 (from orange book) */
|
||||
const gchar *luma_threshold_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"uniform sampler2DRect tex;"
|
||||
"void main () {"
|
||||
" vec2 texturecoord = gl_TexCoord[0].st;"
|
||||
" int i;"
|
||||
" vec4 color = texture2DRect(tex, texturecoord);"
|
||||
" float luma = dot(color.rgb, vec3(0.2125, 0.7154, 0.0721));" /* BT.709 (from orange book) */
|
||||
" gl_FragColor = vec4 (vec3 (smoothstep (0.30, 0.50, luma)), color.a);"
|
||||
"}";
|
||||
|
||||
@ -244,7 +267,9 @@ const gchar *sobel_fragment_source =
|
||||
" }"
|
||||
" }"
|
||||
" float g = sqrt(gx*gx + gy*gy);"
|
||||
" if (invert) g = 1.0 - g;" " gl_FragColor = vec4(vec3(g), 1.0);" "}";
|
||||
" if (invert) g = 1.0 - g;"
|
||||
" gl_FragColor = vec4(vec3(g), 1.0);"
|
||||
"}";
|
||||
|
||||
|
||||
/* horizontal convolution */
|
||||
@ -252,7 +277,9 @@ const gchar *hconv9_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"uniform sampler2DRect tex;"
|
||||
"uniform float norm_const;"
|
||||
"uniform float norm_offset;" "uniform float kernel[9];" "void main () {"
|
||||
"uniform float norm_offset;"
|
||||
"uniform float kernel[9];"
|
||||
"void main () {"
|
||||
/* "float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);" */
|
||||
/* don't use array constructor so we don't have to depend on #version 120 */
|
||||
" float offset[9];"
|
||||
@ -272,14 +299,19 @@ const gchar *hconv9_fragment_source =
|
||||
" if (kernel[i] != 0.0) {"
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s+offset[i], texturecoord.t)); "
|
||||
" sum += neighbor * kernel[i]/norm_const; "
|
||||
" }" " }" " gl_FragColor = sum + norm_offset;" "}";
|
||||
" }"
|
||||
" }"
|
||||
" gl_FragColor = sum + norm_offset;"
|
||||
"}";
|
||||
|
||||
/* vertical convolution */
|
||||
const gchar *vconv9_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"uniform sampler2DRect tex;"
|
||||
"uniform float norm_const;"
|
||||
"uniform float norm_offset;" "uniform float kernel[9];" "void main () {"
|
||||
"uniform float norm_offset;"
|
||||
"uniform float kernel[9];"
|
||||
"void main () {"
|
||||
/* "float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);" */
|
||||
/* don't use array constructor so we don't have to depend on #version 120 */
|
||||
" float offset[9];"
|
||||
@ -299,7 +331,10 @@ const gchar *vconv9_fragment_source =
|
||||
" if (kernel[i] != 0.0) {"
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s, texturecoord.t+offset[i])); "
|
||||
" sum += neighbor * kernel[i]/norm_const; "
|
||||
" }" " }" " gl_FragColor = sum + norm_offset;" "}";
|
||||
" }"
|
||||
" }"
|
||||
" gl_FragColor = sum + norm_offset;"
|
||||
"}";
|
||||
|
||||
|
||||
/* TODO: support several blend modes */
|
||||
@ -312,7 +347,8 @@ const gchar *sum_fragment_source =
|
||||
"void main () {"
|
||||
" vec4 basecolor = texture2DRect (base, gl_TexCoord[0].st);"
|
||||
" vec4 blendcolor = texture2DRect (blend, gl_TexCoord[0].st);"
|
||||
" gl_FragColor = alpha * basecolor + beta * blendcolor;" "}";
|
||||
" gl_FragColor = alpha * basecolor + beta * blendcolor;"
|
||||
"}";
|
||||
|
||||
const gchar *multiply_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
@ -334,7 +370,9 @@ const gchar *luma_to_curve_fragment_source =
|
||||
" vec2 texturecoord = gl_TexCoord[0].st;"
|
||||
" vec4 color = texture2DRect (tex, texturecoord);"
|
||||
" float luma = dot(color.rgb, vec3(0.2125, 0.7154, 0.0721));"
|
||||
" color = texture1D(curve, luma);" " gl_FragColor = color;" "}";
|
||||
" color = texture1D(curve, luma);"
|
||||
" gl_FragColor = color;"
|
||||
"}";
|
||||
|
||||
|
||||
/* lut operations, map rgb to tex1d, see orange book (chapter 19) */
|
||||
@ -349,11 +387,15 @@ const gchar *rgb_to_curve_fragment_source =
|
||||
" outcolor.r = texture1D(curve, color.r).r;"
|
||||
" outcolor.g = texture1D(curve, color.g).g;"
|
||||
" outcolor.b = texture1D(curve, color.b).b;"
|
||||
" outcolor.a = color.a;" " gl_FragColor = outcolor;" "}";
|
||||
" outcolor.a = color.a;"
|
||||
" gl_FragColor = outcolor;"
|
||||
"}";
|
||||
|
||||
const gchar *sin_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"uniform sampler2DRect tex;" "vec3 rgb2hsl (vec3 v) " "{"
|
||||
"uniform sampler2DRect tex;"
|
||||
"vec3 rgb2hsl (vec3 v)"
|
||||
"{"
|
||||
/* TODO: check this algorythm */
|
||||
" float MIN, MAX;"
|
||||
" float r, g, b;"
|
||||
@ -385,14 +427,16 @@ const gchar *sin_fragment_source =
|
||||
/* move hls discontinuity away from the desired red zone so we can use
|
||||
* smoothstep.. to try: convert degrees in radiants, divide by 2 and
|
||||
* smoothstep cosine */
|
||||
" HSL.x += 180.0;" " if ((HSL.x) > 360.0) HSL.x -= 360.0;"
|
||||
" HSL.x += 180.0;"
|
||||
" if ((HSL.x) > 360.0) HSL.x -= 360.0;"
|
||||
/* damn, it is extremely hard to get rid of human face reds! */
|
||||
/* picked hue is slightly shifted towards violet to prevent this but
|
||||
* still fails.. maybe hsl is not well suited for this */
|
||||
" float a = smoothstep (110.0, 150.0, HSL.x);"
|
||||
" float b = smoothstep (170.0, 210.0, HSL.x);"
|
||||
" float alpha = a - b;"
|
||||
" gl_FragColor = color * alpha + luma * (1.0 - alpha);" "}";
|
||||
" gl_FragColor = color * alpha + luma * (1.0 - alpha);"
|
||||
"}";
|
||||
|
||||
const gchar *interpolate_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
@ -402,7 +446,8 @@ const gchar *interpolate_fragment_source =
|
||||
"vec4 basecolor = texture2DRect (base, gl_TexCoord[0].st);"
|
||||
"vec4 blendcolor = texture2DRect (blend, gl_TexCoord[0].st);"
|
||||
"vec4 white = vec4(1.0);"
|
||||
"gl_FragColor = blendcolor + (1.0 - blendcolor.a) * basecolor;" "}";
|
||||
"gl_FragColor = blendcolor + (1.0 - blendcolor.a) * basecolor;"
|
||||
"}";
|
||||
|
||||
const gchar *texture_interp_fragment_source =
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
@ -438,3 +483,5 @@ const gchar *difference_fragment_source =
|
||||
"vec4 currentcolor = texture2DRect (current, gl_TexCoord[0].st);"
|
||||
"gl_FragColor = vec4 (step (0.12, length (savedcolor - currentcolor)));"
|
||||
"}";
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
Loading…
x
Reference in New Issue
Block a user