浏览代码

jsm updates

Garrett Johnson 5 年之前
父节点
当前提交
51d0799e16

+ 9 - 9
examples/jsm/shaders/AfterimageShader.js

@@ -24,8 +24,8 @@ var AfterimageShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -39,21 +39,21 @@ var AfterimageShader = {
 		"uniform sampler2D tNew;",
 
 		"varying vec2 vUv;",
-		
+
 		"vec4 when_gt( vec4 x, float y ) {",
 
-			"return max( sign( x - y ), 0.0 );",
+		"	return max( sign( x - y ), 0.0 );",
 
 		"}",
 
 		"void main() {",
 
-			"vec4 texelOld = texture2D( tOld, vUv );",
-			"vec4 texelNew = texture2D( tNew, vUv );",
-			
-			"texelOld *= damp * when_gt( texelOld, 0.1 );",
+		"	vec4 texelOld = texture2D( tOld, vUv );",
+		"	vec4 texelNew = texture2D( tNew, vUv );",
+
+		"	texelOld *= damp * when_gt( texelOld, 0.1 );",
 
-			"gl_FragColor = max(texelNew, texelOld);",
+		"	gl_FragColor = max(texelNew, texelOld);",
 
 		"}"
 

+ 2 - 2
examples/jsm/shaders/BasicShader.js

@@ -14,7 +14,7 @@ var BasicShader = {
 
 		"void main() {",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -24,7 +24,7 @@ var BasicShader = {
 
 		"void main() {",
 
-			"gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
+		"	gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
 
 		"}"
 

+ 14 - 14
examples/jsm/shaders/BleachBypassShader.js

@@ -23,8 +23,8 @@ var BleachBypassShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -40,24 +40,24 @@ var BleachBypassShader = {
 
 		"void main() {",
 
-			"vec4 base = texture2D( tDiffuse, vUv );",
+		"	vec4 base = texture2D( tDiffuse, vUv );",
 
-			"vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );",
-			"float lum = dot( lumCoeff, base.rgb );",
-			"vec3 blend = vec3( lum );",
+		"	vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );",
+		"	float lum = dot( lumCoeff, base.rgb );",
+		"	vec3 blend = vec3( lum );",
 
-			"float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );",
+		"	float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );",
 
-			"vec3 result1 = 2.0 * base.rgb * blend;",
-			"vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );",
+		"	vec3 result1 = 2.0 * base.rgb * blend;",
+		"	vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );",
 
-			"vec3 newColor = mix( result1, result2, L );",
+		"	vec3 newColor = mix( result1, result2, L );",
 
-			"float A2 = opacity * base.a;",
-			"vec3 mixRGB = A2 * newColor.rgb;",
-			"mixRGB += ( ( 1.0 - A2 ) * base.rgb );",
+		"	float A2 = opacity * base.a;",
+		"	vec3 mixRGB = A2 * newColor.rgb;",
+		"	mixRGB += ( ( 1.0 - A2 ) * base.rgb );",
 
-			"gl_FragColor = vec4( mixRGB, base.a );",
+		"	gl_FragColor = vec4( mixRGB, base.a );",
 
 		"}"
 

+ 5 - 5
examples/jsm/shaders/BlendShader.js

@@ -23,8 +23,8 @@ var BlendShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,9 +42,9 @@ var BlendShader = {
 
 		"void main() {",
 
-			"vec4 texel1 = texture2D( tDiffuse1, vUv );",
-			"vec4 texel2 = texture2D( tDiffuse2, vUv );",
-			"gl_FragColor = opacity * mix( texel1, texel2, mixRatio );",
+		"	vec4 texel1 = texture2D( tDiffuse1, vUv );",
+		"	vec4 texel2 = texture2D( tDiffuse2, vUv );",
+		"	gl_FragColor = opacity * mix( texel1, texel2, mixRatio );",
 
 		"}"
 

+ 63 - 63
examples/jsm/shaders/BokehShader.js

@@ -34,8 +34,8 @@ var BokehShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -79,67 +79,67 @@ var BokehShader = {
 
 		"void main() {",
 
-			"vec2 aspectcorrect = vec2( 1.0, aspect );",
-
-			"float viewZ = getViewZ( getDepth( vUv ) );",
-
-			"float factor = ( focus + viewZ );", // viewZ is <= 0, so this is a difference equation
-
-			"vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );",
-
-			"vec2 dofblur9 = dofblur * 0.9;",
-			"vec2 dofblur7 = dofblur * 0.7;",
-			"vec2 dofblur4 = dofblur * 0.4;",
-
-			"vec4 col = vec4( 0.0 );",
-
-			"col += texture2D( tColor, vUv.xy );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );",
-
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
-
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );",
-
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
-			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );",
-
-			"gl_FragColor = col / 41.0;",
-			"gl_FragColor.a = 1.0;",
+		"	vec2 aspectcorrect = vec2( 1.0, aspect );",
+
+		"	float viewZ = getViewZ( getDepth( vUv ) );",
+
+		"	float factor = ( focus + viewZ );", // viewZ is <= 0, so this is a difference equation
+
+		"	vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );",
+
+		"	vec2 dofblur9 = dofblur * 0.9;",
+		"	vec2 dofblur7 = dofblur * 0.7;",
+		"	vec2 dofblur4 = dofblur * 0.4;",
+
+		"	vec4 col = vec4( 0.0 );",
+
+		"	col += texture2D( tColor, vUv.xy );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );",
+
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
+
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );",
+
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
+		"	col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );",
+
+		"	gl_FragColor = col / 41.0;",
+		"	gl_FragColor.a = 1.0;",
 
 		"}"
 

+ 138 - 138
examples/jsm/shaders/BokehShader2.js

@@ -59,8 +59,8 @@ var BokehShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -146,213 +146,213 @@ var BokehShader = {
 		"//------------------------------------------",
 
 		"float penta(vec2 coords) {",
-			"//pentagonal shape",
-			"float scale = float(rings) - 1.3;",
-			"vec4  HS0 = vec4( 1.0,         0.0,         0.0,  1.0);",
-			"vec4  HS1 = vec4( 0.309016994, 0.951056516, 0.0,  1.0);",
-			"vec4  HS2 = vec4(-0.809016994, 0.587785252, 0.0,  1.0);",
-			"vec4  HS3 = vec4(-0.809016994,-0.587785252, 0.0,  1.0);",
-			"vec4  HS4 = vec4( 0.309016994,-0.951056516, 0.0,  1.0);",
-			"vec4  HS5 = vec4( 0.0        ,0.0         , 1.0,  1.0);",
+		"	//pentagonal shape",
+		"	float scale = float(rings) - 1.3;",
+		"	vec4  HS0 = vec4( 1.0,         0.0,         0.0,  1.0);",
+		"	vec4  HS1 = vec4( 0.309016994, 0.951056516, 0.0,  1.0);",
+		"	vec4  HS2 = vec4(-0.809016994, 0.587785252, 0.0,  1.0);",
+		"	vec4  HS3 = vec4(-0.809016994,-0.587785252, 0.0,  1.0);",
+		"	vec4  HS4 = vec4( 0.309016994,-0.951056516, 0.0,  1.0);",
+		"	vec4  HS5 = vec4( 0.0        ,0.0         , 1.0,  1.0);",
 
-			"vec4  one = vec4( 1.0 );",
+		"	vec4  one = vec4( 1.0 );",
 
-			"vec4 P = vec4((coords),vec2(scale, scale));",
+		"	vec4 P = vec4((coords),vec2(scale, scale));",
 
-			"vec4 dist = vec4(0.0);",
-			"float inorout = -4.0;",
+		"	vec4 dist = vec4(0.0);",
+		"	float inorout = -4.0;",
 
-			"dist.x = dot( P, HS0 );",
-			"dist.y = dot( P, HS1 );",
-			"dist.z = dot( P, HS2 );",
-			"dist.w = dot( P, HS3 );",
+		"	dist.x = dot( P, HS0 );",
+		"	dist.y = dot( P, HS1 );",
+		"	dist.z = dot( P, HS2 );",
+		"	dist.w = dot( P, HS3 );",
 
-			"dist = smoothstep( -feather, feather, dist );",
+		"	dist = smoothstep( -feather, feather, dist );",
 
-			"inorout += dot( dist, one );",
+		"	inorout += dot( dist, one );",
 
-			"dist.x = dot( P, HS4 );",
-			"dist.y = HS5.w - abs( P.z );",
+		"	dist.x = dot( P, HS4 );",
+		"	dist.y = HS5.w - abs( P.z );",
 
-			"dist = smoothstep( -feather, feather, dist );",
-			"inorout += dist.x;",
+		"	dist = smoothstep( -feather, feather, dist );",
+		"	inorout += dist.x;",
 
-			"return clamp( inorout, 0.0, 1.0 );",
+		"	return clamp( inorout, 0.0, 1.0 );",
 		"}",
 
 		"float bdepth(vec2 coords) {",
-			"// Depth buffer blur",
-			"float d = 0.0;",
-			"float kernel[9];",
-			"vec2 offset[9];",
+		"	// Depth buffer blur",
+		"	float d = 0.0;",
+		"	float kernel[9];",
+		"	vec2 offset[9];",
 
-			"vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;",
+		"	vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;",
 
-			"offset[0] = vec2(-wh.x,-wh.y);",
-			"offset[1] = vec2( 0.0, -wh.y);",
-			"offset[2] = vec2( wh.x -wh.y);",
+		"	offset[0] = vec2(-wh.x,-wh.y);",
+		"	offset[1] = vec2( 0.0, -wh.y);",
+		"	offset[2] = vec2( wh.x -wh.y);",
 
-			"offset[3] = vec2(-wh.x,  0.0);",
-			"offset[4] = vec2( 0.0,   0.0);",
-			"offset[5] = vec2( wh.x,  0.0);",
+		"	offset[3] = vec2(-wh.x,  0.0);",
+		"	offset[4] = vec2( 0.0,   0.0);",
+		"	offset[5] = vec2( wh.x,  0.0);",
 
-			"offset[6] = vec2(-wh.x, wh.y);",
-			"offset[7] = vec2( 0.0,  wh.y);",
-			"offset[8] = vec2( wh.x, wh.y);",
+		"	offset[6] = vec2(-wh.x, wh.y);",
+		"	offset[7] = vec2( 0.0,  wh.y);",
+		"	offset[8] = vec2( wh.x, wh.y);",
 
-			"kernel[0] = 1.0/16.0;   kernel[1] = 2.0/16.0;   kernel[2] = 1.0/16.0;",
-			"kernel[3] = 2.0/16.0;   kernel[4] = 4.0/16.0;   kernel[5] = 2.0/16.0;",
-			"kernel[6] = 1.0/16.0;   kernel[7] = 2.0/16.0;   kernel[8] = 1.0/16.0;",
+		"	kernel[0] = 1.0/16.0;   kernel[1] = 2.0/16.0;   kernel[2] = 1.0/16.0;",
+		"	kernel[3] = 2.0/16.0;   kernel[4] = 4.0/16.0;   kernel[5] = 2.0/16.0;",
+		"	kernel[6] = 1.0/16.0;   kernel[7] = 2.0/16.0;   kernel[8] = 1.0/16.0;",
 
 
-			"for( int i=0; i<9; i++ ) {",
-				"float tmp = texture2D(tDepth, coords + offset[i]).r;",
-				"d += tmp * kernel[i];",
-			"}",
+		"	for( int i=0; i<9; i++ ) {",
+		"		float tmp = texture2D(tDepth, coords + offset[i]).r;",
+		"		d += tmp * kernel[i];",
+		"	}",
 
-			"return d;",
+		"	return d;",
 		"}",
 
 
 		"vec3 color(vec2 coords,float blur) {",
-			"//processing the sample",
+		"	//processing the sample",
 
-			"vec3 col = vec3(0.0);",
-			"vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);",
+		"	vec3 col = vec3(0.0);",
+		"	vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);",
 
-			"col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;",
-			"col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;",
-			"col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;",
+		"	col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;",
+		"	col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;",
+		"	col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;",
 
-			"vec3 lumcoeff = vec3(0.299,0.587,0.114);",
-			"float lum = dot(col.rgb, lumcoeff);",
-			"float thresh = max((lum-threshold)*gain, 0.0);",
-			"return col+mix(vec3(0.0),col,thresh*blur);",
+		"	vec3 lumcoeff = vec3(0.299,0.587,0.114);",
+		"	float lum = dot(col.rgb, lumcoeff);",
+		"	float thresh = max((lum-threshold)*gain, 0.0);",
+		"	return col+mix(vec3(0.0),col,thresh*blur);",
 		"}",
 
 		"vec3 debugFocus(vec3 col, float blur, float depth) {",
-			"float edge = 0.002*depth; //distance based edge smoothing",
-			"float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);",
-			"float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);",
+		"	float edge = 0.002*depth; //distance based edge smoothing",
+		"	float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);",
+		"	float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);",
 
-			"col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);",
-			"col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);",
+		"	col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);",
+		"	col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);",
 
-			"return col;",
+		"	return col;",
 		"}",
 
 		"float linearize(float depth) {",
-			"return -zfar * znear / (depth * (zfar - znear) - zfar);",
+		"	return -zfar * znear / (depth * (zfar - znear) - zfar);",
 		"}",
 
 
 		"float vignette() {",
-			"float dist = distance(vUv.xy, vec2(0.5,0.5));",
-			"dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);",
-			"return clamp(dist,0.0,1.0);",
+		"	float dist = distance(vUv.xy, vec2(0.5,0.5));",
+		"	dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);",
+		"	return clamp(dist,0.0,1.0);",
 		"}",
 
 		"float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {",
-			"float rings2 = float(rings);",
-			"float step = PI*2.0 / float(ringsamples);",
-			"float pw = cos(j*step)*i;",
-			"float ph = sin(j*step)*i;",
-			"float p = 1.0;",
-			"if (pentagon) {",
-				"p = penta(vec2(pw,ph));",
-			"}",
-			"col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;",
-			"return 1.0 * mix(1.0, i /rings2, bias) * p;",
+		"	float rings2 = float(rings);",
+		"	float step = PI*2.0 / float(ringsamples);",
+		"	float pw = cos(j*step)*i;",
+		"	float ph = sin(j*step)*i;",
+		"	float p = 1.0;",
+		"	if (pentagon) {",
+		"		p = penta(vec2(pw,ph));",
+		"	}",
+		"	col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;",
+		"	return 1.0 * mix(1.0, i /rings2, bias) * p;",
 		"}",
 
 		"void main() {",
-			"//scene depth calculation",
+		"	//scene depth calculation",
 
-			"float depth = linearize(texture2D(tDepth,vUv.xy).x);",
+		"	float depth = linearize(texture2D(tDepth,vUv.xy).x);",
 
-			"// Blur depth?",
-			"if ( depthblur ) {",
-				"depth = linearize(bdepth(vUv.xy));",
-			"}",
+		"	// Blur depth?",
+		"	if ( depthblur ) {",
+		"		depth = linearize(bdepth(vUv.xy));",
+		"	}",
 
-			"//focal plane calculation",
+		"	//focal plane calculation",
 
-			"float fDepth = focalDepth;",
+		"	float fDepth = focalDepth;",
 
-			"if (shaderFocus) {",
+		"	if (shaderFocus) {",
 
-				"fDepth = linearize(texture2D(tDepth,focusCoords).x);",
+		"		fDepth = linearize(texture2D(tDepth,focusCoords).x);",
 
-			"}",
+		"	}",
 
-			"// dof blur factor calculation",
+		"	// dof blur factor calculation",
 
-			"float blur = 0.0;",
+		"	float blur = 0.0;",
 
-			"if (manualdof) {",
-				"float a = depth-fDepth; // Focal plane",
-				"float b = (a-fdofstart)/fdofdist; // Far DoF",
-				"float c = (-a-ndofstart)/ndofdist; // Near Dof",
-				"blur = (a>0.0) ? b : c;",
-			"} else {",
-				"float f = focalLength; // focal length in mm",
-				"float d = fDepth*1000.0; // focal plane in mm",
-				"float o = depth*1000.0; // depth in mm",
+		"	if (manualdof) {",
+		"		float a = depth-fDepth; // Focal plane",
+		"		float b = (a-fdofstart)/fdofdist; // Far DoF",
+		"		float c = (-a-ndofstart)/ndofdist; // Near Dof",
+		"		blur = (a>0.0) ? b : c;",
+		"	} else {",
+		"		float f = focalLength; // focal length in mm",
+		"		float d = fDepth*1000.0; // focal plane in mm",
+		"		float o = depth*1000.0; // depth in mm",
 
-				"float a = (o*f)/(o-f);",
-				"float b = (d*f)/(d-f);",
-				"float c = (d-f)/(d*fstop*CoC);",
+		"		float a = (o*f)/(o-f);",
+		"		float b = (d*f)/(d-f);",
+		"		float c = (d-f)/(d*fstop*CoC);",
 
-				"blur = abs(a-b)*c;",
-			"}",
+		"		blur = abs(a-b)*c;",
+		"	}",
 
-			"blur = clamp(blur,0.0,1.0);",
+		"	blur = clamp(blur,0.0,1.0);",
 
-			"// calculation of pattern for dithering",
+		"	// calculation of pattern for dithering",
 
-			"vec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;",
+		"	vec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;",
 
-			"// getting blur x and y step factor",
+		"	// getting blur x and y step factor",
 
-			"float w = (1.0/textureWidth)*blur*maxblur+noise.x;",
-			"float h = (1.0/textureHeight)*blur*maxblur+noise.y;",
+		"	float w = (1.0/textureWidth)*blur*maxblur+noise.x;",
+		"	float h = (1.0/textureHeight)*blur*maxblur+noise.y;",
 
-			"// calculation of final color",
+		"	// calculation of final color",
 
-			"vec3 col = vec3(0.0);",
+		"	vec3 col = vec3(0.0);",
 
-			"if(blur < 0.05) {",
-				"//some optimization thingy",
-				"col = texture2D(tColor, vUv.xy).rgb;",
-			"} else {",
-				"col = texture2D(tColor, vUv.xy).rgb;",
-				"float s = 1.0;",
-				"int ringsamples;",
+		"	if(blur < 0.05) {",
+		"		//some optimization thingy",
+		"		col = texture2D(tColor, vUv.xy).rgb;",
+		"	} else {",
+		"		col = texture2D(tColor, vUv.xy).rgb;",
+		"		float s = 1.0;",
+		"		int ringsamples;",
 
-				"for (int i = 1; i <= rings; i++) {",
-					"/*unboxstart*/",
-					"ringsamples = i * samples;",
+		"		for (int i = 1; i <= rings; i++) {",
+		"			/*unboxstart*/",
+		"			ringsamples = i * samples;",
 
-					"for (int j = 0 ; j < maxringsamples ; j++) {",
-						"if (j >= ringsamples) break;",
-						"s += gather(float(i), float(j), ringsamples, col, w, h, blur);",
-					"}",
-					"/*unboxend*/",
-				"}",
+		"			for (int j = 0 ; j < maxringsamples ; j++) {",
+		"				if (j >= ringsamples) break;",
+		"				s += gather(float(i), float(j), ringsamples, col, w, h, blur);",
+		"			}",
+		"			/*unboxend*/",
+		"		}",
 
-				"col /= s; //divide by sample count",
-			"}",
+		"		col /= s; //divide by sample count",
+		"	}",
 
-			"if (showFocus) {",
-				"col = debugFocus(col, blur, depth);",
-			"}",
+		"	if (showFocus) {",
+		"		col = debugFocus(col, blur, depth);",
+		"	}",
 
-			"if (vignetting) {",
-				"col *= vignette();",
-			"}",
+		"	if (vignetting) {",
+		"		col *= vignette();",
+		"	}",
 
-			"gl_FragColor.rgb = col;",
-			"gl_FragColor.a = 1.0;",
+		"	gl_FragColor.rgb = col;",
+		"	gl_FragColor.a = 1.0;",
 		"} "
 
 	].join( "\n" )

+ 9 - 9
examples/jsm/shaders/BrightnessContrastShader.js

@@ -25,9 +25,9 @@ var BrightnessContrastShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,15 +43,15 @@ var 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;",
+		"	}",
 
 		"}"
 

+ 4 - 4
examples/jsm/shaders/ColorCorrectionShader.js

@@ -25,9 +25,9 @@ var ColorCorrectionShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,8 +44,8 @@ var 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 );",
 
 		"}"
 

+ 6 - 6
examples/jsm/shaders/ColorifyShader.js

@@ -23,8 +23,8 @@ var ColorifyShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -39,12 +39,12 @@ var 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 );",
 
 		"}"
 

+ 9 - 9
examples/jsm/shaders/ConvolutionShader.js

@@ -35,8 +35,8 @@ var 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 );",
 
 		"}"
 
@@ -53,17 +53,17 @@ var 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;",
 
 		"}"
 

+ 4 - 4
examples/jsm/shaders/CopyShader.js

@@ -21,8 +21,8 @@ var CopyShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -38,8 +38,8 @@ var CopyShader = {
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
-			"gl_FragColor = opacity * texel;",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
+		"	gl_FragColor = opacity * texel;",
 
 		"}"
 

+ 40 - 40
examples/jsm/shaders/DigitalGlitch.js

@@ -33,8 +33,8 @@ var 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" ),
 
@@ -57,47 +57,47 @@ var 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.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {",
-					"if(seed_x>0.){",
-						"p.y = 1. - (p.y + distortion_y);",
-					"}",
-					"else {",
-						"p.y = distortion_y;",
-					"}",
-				"}",
-				"if(p.x<distortion_y+col_s && p.x>distortion_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.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {",
+		"			if(seed_x>0.){",
+		"				p.y = 1. - (p.y + distortion_y);",
+		"			}",
+		"			else {",
+		"				p.y = distortion_y;",
+		"			}",
+		"		}",
+		"		if(p.x<distortion_y+col_s && p.x>distortion_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" )