From 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 18 Sep 2019 17:31:58 -0700 Subject: [PATCH] Fix some indents --- .../js/shaders/BrightnessContrastShader.js | 18 ++--- examples/js/shaders/ColorCorrectionShader.js | 8 +- examples/js/shaders/ColorifyShader.js | 12 +-- examples/js/shaders/ConvolutionShader.js | 18 ++--- examples/js/shaders/CopyShader.js | 8 +- examples/js/shaders/DigitalGlitch.js | 80 +++++++++---------- 6 files changed, 72 insertions(+), 72 deletions(-) diff --git a/examples/js/shaders/BrightnessContrastShader.js b/examples/js/shaders/BrightnessContrastShader.js index 7f0c1fe7d6..8487c2d058 100644 --- a/examples/js/shaders/BrightnessContrastShader.js +++ b/examples/js/shaders/BrightnessContrastShader.js @@ -23,9 +23,9 @@ THREE.BrightnessContrastShader = { "void main() {", - "vUv = uv;", + " vUv = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -41,15 +41,15 @@ THREE.BrightnessContrastShader = { "void main() {", - "gl_FragColor = texture2D( tDiffuse, vUv );", + " gl_FragColor = texture2D( tDiffuse, vUv );", - "gl_FragColor.rgb += brightness;", + " gl_FragColor.rgb += brightness;", - "if (contrast > 0.0) {", - "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;", - "} else {", - "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;", - "}", + " if (contrast > 0.0) {", + " gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;", + " } else {", + " gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;", + " }", "}" diff --git a/examples/js/shaders/ColorCorrectionShader.js b/examples/js/shaders/ColorCorrectionShader.js index adbb752299..3972ef33dc 100644 --- a/examples/js/shaders/ColorCorrectionShader.js +++ b/examples/js/shaders/ColorCorrectionShader.js @@ -21,9 +21,9 @@ THREE.ColorCorrectionShader = { "void main() {", - "vUv = uv;", + " vUv = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -40,8 +40,8 @@ THREE.ColorCorrectionShader = { "void main() {", - "gl_FragColor = texture2D( tDiffuse, vUv );", - "gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );", + " gl_FragColor = texture2D( tDiffuse, vUv );", + " gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );", "}" diff --git a/examples/js/shaders/ColorifyShader.js b/examples/js/shaders/ColorifyShader.js index 037f69ae00..16b1092033 100644 --- a/examples/js/shaders/ColorifyShader.js +++ b/examples/js/shaders/ColorifyShader.js @@ -19,8 +19,8 @@ THREE.ColorifyShader = { "void main() {", - "vUv = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " vUv = uv;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -35,12 +35,12 @@ THREE.ColorifyShader = { "void main() {", - "vec4 texel = texture2D( tDiffuse, vUv );", + " vec4 texel = texture2D( tDiffuse, vUv );", - "vec3 luma = vec3( 0.299, 0.587, 0.114 );", - "float v = dot( texel.xyz, luma );", + " vec3 luma = vec3( 0.299, 0.587, 0.114 );", + " float v = dot( texel.xyz, luma );", - "gl_FragColor = vec4( v * color, texel.w );", + " gl_FragColor = vec4( v * color, texel.w );", "}" diff --git a/examples/js/shaders/ConvolutionShader.js b/examples/js/shaders/ConvolutionShader.js index 0e52065307..446609fa34 100644 --- a/examples/js/shaders/ConvolutionShader.js +++ b/examples/js/shaders/ConvolutionShader.js @@ -31,8 +31,8 @@ THREE.ConvolutionShader = { "void main() {", - "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -49,17 +49,17 @@ THREE.ConvolutionShader = { "void main() {", - "vec2 imageCoord = vUv;", - "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", + " vec2 imageCoord = vUv;", + " vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", - "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", + " for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", - "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", - "imageCoord += uImageIncrement;", + " sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", + " imageCoord += uImageIncrement;", - "}", + " }", - "gl_FragColor = sum;", + " gl_FragColor = sum;", "}" diff --git a/examples/js/shaders/CopyShader.js b/examples/js/shaders/CopyShader.js index 9843a42fc4..0cd00e4db0 100644 --- a/examples/js/shaders/CopyShader.js +++ b/examples/js/shaders/CopyShader.js @@ -19,8 +19,8 @@ THREE.CopyShader = { "void main() {", - "vUv = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " vUv = uv;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -36,8 +36,8 @@ THREE.CopyShader = { "void main() {", - "vec4 texel = texture2D( tDiffuse, vUv );", - "gl_FragColor = opacity * texel;", + " vec4 texel = texture2D( tDiffuse, vUv );", + " gl_FragColor = opacity * texel;", "}" diff --git a/examples/js/shaders/DigitalGlitch.js b/examples/js/shaders/DigitalGlitch.js index 0dfc3b1cbf..223cd171b6 100644 --- a/examples/js/shaders/DigitalGlitch.js +++ b/examples/js/shaders/DigitalGlitch.js @@ -31,8 +31,8 @@ THREE.DigitalGlitch = { "varying vec2 vUv;", "void main() {", - "vUv = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " vUv = uv;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join( "\n" ), @@ -55,47 +55,47 @@ THREE.DigitalGlitch = { "float rand(vec2 co){", - "return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);", + " return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);", "}", "void main() {", - "if(byp<1) {", - "vec2 p = vUv;", - "float xs = floor(gl_FragCoord.x / 0.5);", - "float ys = floor(gl_FragCoord.y / 0.5);", - //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch - "vec4 normal = texture2D (tDisp, p*seed*seed);", - "if(p.ydistortion_x-col_s*seed) {", - "if(seed_x>0.){", - "p.y = 1. - (p.y + distortion_y);", - "}", - "else {", - "p.y = distortion_y;", - "}", - "}", - "if(p.xdistortion_y-col_s*seed) {", - "if(seed_y>0.){", - "p.x=distortion_x;", - "}", - "else {", - "p.x = 1. - (p.x + distortion_x);", - "}", - "}", - "p.x+=normal.x*seed_x*(seed/5.);", - "p.y+=normal.y*seed_y*(seed/5.);", - //base from RGB shift shader - "vec2 offset = amount * vec2( cos(angle), sin(angle));", - "vec4 cr = texture2D(tDiffuse, p + offset);", - "vec4 cga = texture2D(tDiffuse, p);", - "vec4 cb = texture2D(tDiffuse, p - offset);", - "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);", - //add noise - "vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);", - "gl_FragColor = gl_FragColor+ snow;", - "}", - "else {", - "gl_FragColor=texture2D (tDiffuse, vUv);", - "}", + " if(byp<1) {", + " vec2 p = vUv;", + " float xs = floor(gl_FragCoord.x / 0.5);", + " float ys = floor(gl_FragCoord.y / 0.5);", + //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch + " vec4 normal = texture2D (tDisp, p*seed*seed);", + " if(p.ydistortion_x-col_s*seed) {", + " if(seed_x>0.){", + " p.y = 1. - (p.y + distortion_y);", + " }", + " else {", + " p.y = distortion_y;", + " }", + " }", + " if(p.xdistortion_y-col_s*seed) {", + " if(seed_y>0.){", + " p.x=distortion_x;", + " }", + " else {", + " p.x = 1. - (p.x + distortion_x);", + " }", + " }", + " p.x+=normal.x*seed_x*(seed/5.);", + " p.y+=normal.y*seed_y*(seed/5.);", + //base from RGB shift shader + " vec2 offset = amount * vec2( cos(angle), sin(angle));", + " vec4 cr = texture2D(tDiffuse, p + offset);", + " vec4 cga = texture2D(tDiffuse, p);", + " vec4 cb = texture2D(tDiffuse, p - offset);", + " gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);", + //add noise + " vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);", + " gl_FragColor = gl_FragColor+ snow;", + " }", + " else {", + " gl_FragColor=texture2D (tDiffuse, vUv);", + " }", "}" ].join( "\n" ) -- GitLab