Browse Source

Merge branch 'dev' into instancing

# Conflicts:
#	src/renderers/webgl/WebGLPrograms.js
Mr.doob 5 years ago
parent
commit
44a0b356b0
65 changed files with 1694 additions and 1690 deletions
  1. 8 7
      build/three.js
  2. 365 365
      build/three.min.js
  3. 8 7
      build/three.module.js
  4. 7 7
      examples/js/shaders/DOFMipMapShader.js
  5. 9 9
      examples/js/shaders/DotScreenShader.js
  6. 2 2
      examples/js/shaders/FXAAShader.js
  7. 12 12
      examples/js/shaders/FilmShader.js
  8. 28 28
      examples/js/shaders/FocusShader.js
  9. 34 34
      examples/js/shaders/FreiChenShader.js
  10. 16 16
      examples/js/shaders/FresnelShader.js
  11. 4 4
      examples/js/shaders/GammaCorrectionShader.js
  12. 8 8
      examples/js/shaders/GodRaysShader.js
  13. 158 158
      examples/js/shaders/HalftoneShader.js
  14. 13 13
      examples/js/shaders/HorizontalBlurShader.js
  15. 14 14
      examples/js/shaders/HorizontalTiltShiftShader.js
  16. 18 18
      examples/js/shaders/HueSaturationShader.js
  17. 11 11
      examples/js/shaders/KaleidoShader.js
  18. 8 8
      examples/js/shaders/LuminosityHighPassShader.js
  19. 5 5
      examples/js/shaders/LuminosityShader.js
  20. 14 14
      examples/js/shaders/MirrorShader.js
  21. 6 6
      examples/js/shaders/NormalMapShader.js
  22. 70 70
      examples/js/shaders/ParallaxShader.js
  23. 7 7
      examples/js/shaders/RGBShiftShader.js
  24. 8 8
      examples/js/shaders/SepiaShader.js
  25. 22 22
      examples/js/shaders/SobelOperatorShader.js
  26. 5 5
      examples/js/shaders/TechnicolorShader.js
  27. 102 102
      examples/js/shaders/TerrainShader.js
  28. 15 15
      examples/js/shaders/ToneMapShader.js
  29. 12 12
      examples/js/shaders/TriangleBlurShader.js
  30. 4 4
      examples/js/shaders/UnpackDepthRGBAShader.js
  31. 13 13
      examples/js/shaders/VerticalBlurShader.js
  32. 14 14
      examples/js/shaders/VerticalTiltShiftShader.js
  33. 13 13
      examples/js/shaders/VignetteShader.js
  34. 7 7
      examples/jsm/shaders/DOFMipMapShader.js
  35. 9 9
      examples/jsm/shaders/DotScreenShader.js
  36. 2 2
      examples/jsm/shaders/FXAAShader.js
  37. 12 12
      examples/jsm/shaders/FilmShader.js
  38. 28 28
      examples/jsm/shaders/FocusShader.js
  39. 34 34
      examples/jsm/shaders/FreiChenShader.js
  40. 16 16
      examples/jsm/shaders/FresnelShader.js
  41. 4 4
      examples/jsm/shaders/GammaCorrectionShader.js
  42. 8 8
      examples/jsm/shaders/GodRaysShader.js
  43. 158 158
      examples/jsm/shaders/HalftoneShader.js
  44. 13 13
      examples/jsm/shaders/HorizontalBlurShader.js
  45. 14 14
      examples/jsm/shaders/HorizontalTiltShiftShader.js
  46. 18 18
      examples/jsm/shaders/HueSaturationShader.js
  47. 11 11
      examples/jsm/shaders/KaleidoShader.js
  48. 8 8
      examples/jsm/shaders/LuminosityHighPassShader.js
  49. 5 5
      examples/jsm/shaders/LuminosityShader.js
  50. 14 14
      examples/jsm/shaders/MirrorShader.js
  51. 6 6
      examples/jsm/shaders/NormalMapShader.js
  52. 70 70
      examples/jsm/shaders/ParallaxShader.js
  53. 7 7
      examples/jsm/shaders/RGBShiftShader.js
  54. 8 8
      examples/jsm/shaders/SepiaShader.js
  55. 22 22
      examples/jsm/shaders/SobelOperatorShader.js
  56. 5 5
      examples/jsm/shaders/TechnicolorShader.js
  57. 102 102
      examples/jsm/shaders/TerrainShader.js
  58. 15 15
      examples/jsm/shaders/ToneMapShader.js
  59. 12 12
      examples/jsm/shaders/TriangleBlurShader.js
  60. 4 4
      examples/jsm/shaders/UnpackDepthRGBAShader.js
  61. 13 13
      examples/jsm/shaders/VerticalBlurShader.js
  62. 14 14
      examples/jsm/shaders/VerticalTiltShiftShader.js
  63. 13 13
      examples/jsm/shaders/VignetteShader.js
  64. 6 6
      src/renderers/webgl/WebGLProgram.js
  65. 3 1
      src/renderers/webgl/WebGLPrograms.js

+ 8 - 7
build/three.js

@@ -17634,7 +17634,7 @@
 
 	}
 
-	function WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities ) {
+	function WebGLProgram( renderer, extensions, code, material, shader, parameters ) {
 
 		var gl = renderer.getContext();
 
@@ -17650,7 +17650,7 @@
 
 		var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
 
-		var customExtensions = capabilities.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
+		var customExtensions = parameters.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
 
 		var customDefines = generateDefines( defines );
 
@@ -17744,7 +17744,7 @@
 				parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
 
 				parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-				parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+				parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 				'uniform mat4 modelMatrix;',
 				'uniform vec3 cameraPosition;',
 
@@ -17875,9 +17875,9 @@
 				parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '',
 
 				parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-				parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+				parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 
-				( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( capabilities.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
+				( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( parameters.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
 
 				'uniform vec3 cameraPosition;',
 
@@ -17921,7 +17921,7 @@
 		vertexShader = unrollLoops( vertexShader );
 		fragmentShader = unrollLoops( fragmentShader );
 
-		if ( capabilities.isWebGL2 && ! material.isRawShaderMaterial ) {
+		if ( parameters.isWebGL2 && ! material.isRawShaderMaterial ) {
 
 			var isGLSL3ShaderMaterial = false;
 
@@ -18262,6 +18262,7 @@
 				shaderID: shaderID,
 
 				precision: precision,
+				isWebGL2: capabilities.isWebGL2,
 				supportsVertexTextures: capabilities.vertexTextures,
 				outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ),
 				map: !! material.map,
@@ -18414,7 +18415,7 @@
 
 			if ( program === undefined ) {
 
-				program = new WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities );
+				program = new WebGLProgram( renderer, extensions, code, material, shader, parameters );
 				programs.push( program );
 
 			}

File diff suppressed because it is too large
+ 365 - 365
build/three.min.js


+ 8 - 7
build/three.module.js

@@ -17621,7 +17621,7 @@ function generateEnvMapBlendingDefine( parameters, material ) {
 
 }
 
-function WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities ) {
+function WebGLProgram( renderer, extensions, code, material, shader, parameters ) {
 
 	var gl = renderer.getContext();
 
@@ -17637,7 +17637,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 
 	var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
 
-	var customExtensions = capabilities.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
+	var customExtensions = parameters.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
 
 	var customDefines = generateDefines( defines );
 
@@ -17731,7 +17731,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 			parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
 
 			parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-			parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+			parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 			'uniform mat4 modelMatrix;',
 			'uniform vec3 cameraPosition;',
 
@@ -17864,9 +17864,9 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 			parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '',
 
 			parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-			parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+			parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 
-			( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( capabilities.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
+			( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( parameters.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
 
 			'uniform vec3 cameraPosition;',
 
@@ -17910,7 +17910,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 	vertexShader = unrollLoops( vertexShader );
 	fragmentShader = unrollLoops( fragmentShader );
 
-	if ( capabilities.isWebGL2 && ! material.isRawShaderMaterial ) {
+	if ( parameters.isWebGL2 && ! material.isRawShaderMaterial ) {
 
 		var isGLSL3ShaderMaterial = false;
 
@@ -18251,6 +18251,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 			shaderID: shaderID,
 
 			precision: precision,
+			isWebGL2: capabilities.isWebGL2,
 			supportsVertexTextures: capabilities.vertexTextures,
 			outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ),
 			map: !! material.map,
@@ -18403,7 +18404,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 		if ( program === undefined ) {
 
-			program = new WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities );
+			program = new WebGLProgram( renderer, extensions, code, material, shader, parameters );
 			programs.push( program );
 
 		}

+ 7 - 7
examples/js/shaders/DOFMipMapShader.js

@@ -23,8 +23,8 @@ THREE.DOFMipMapShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,14 +42,14 @@ THREE.DOFMipMapShader = {
 
 		"void main() {",
 
-			"vec4 depth = texture2D( tDepth, vUv );",
+		"	vec4 depth = texture2D( tDepth, vUv );",
 
-			"float factor = depth.x - focus;",
+		"	float factor = depth.x - focus;",
 
-			"vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
+		"	vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
 
-			"gl_FragColor = col;",
-			"gl_FragColor.a = 1.0;",
+		"	gl_FragColor = col;",
+		"	gl_FragColor.a = 1.0;",
 
 		"}"
 

+ 9 - 9
examples/js/shaders/DotScreenShader.js

@@ -24,8 +24,8 @@ THREE.DotScreenShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,22 +44,22 @@ THREE.DotScreenShader = {
 
 		"float pattern() {",
 
-			"float s = sin( angle ), c = cos( angle );",
+		"	float s = sin( angle ), c = cos( angle );",
 
-			"vec2 tex = vUv * tSize - center;",
-			"vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
+		"	vec2 tex = vUv * tSize - center;",
+		"	vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
 
-			"return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
+		"	return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
 
 		"}",
 
 		"void main() {",
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
+		"	vec4 color = texture2D( tDiffuse, vUv );",
 
-			"float average = ( color.r + color.g + color.b ) / 3.0;",
+		"	float average = ( color.r + color.g + color.b ) / 3.0;",
 
-			"gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
+		"	gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
 
 		"}"
 

+ 2 - 2
examples/js/shaders/FXAAShader.js

@@ -23,8 +23,8 @@ THREE.FXAAShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 

+ 12 - 12
examples/js/shaders/FilmShader.js

@@ -39,8 +39,8 @@ THREE.FilmShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -71,31 +71,31 @@ THREE.FilmShader = {
 		"void main() {",
 
 			// sample the source
-			"vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
+		"	vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
 
 			// make some noise
-			"float dx = rand( vUv + time );",
+		"	float dx = rand( vUv + time );",
 
 			// add noise
-			"vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
+		"	vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
 
 			// get us a sine and cosine
-			"vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
+		"	vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
 
 			// add scanlines
-			"cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
+		"	cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
 
 			// interpolate between source and result by intensity
-			"cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
+		"	cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
 
 			// convert to grayscale if desired
-			"if( grayscale ) {",
+		"	if( grayscale ) {",
 
-				"cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
+		"		cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
 
-			"}",
+		"	}",
 
-			"gl_FragColor =  vec4( cResult, cTextureScreen.a );",
+		"	gl_FragColor =  vec4( cResult, cTextureScreen.a );",
 
 		"}"
 

+ 28 - 28
examples/js/shaders/FocusShader.js

@@ -24,8 +24,8 @@ THREE.FocusShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,45 +44,45 @@ THREE.FocusShader = {
 
 		"void main() {",
 
-			"vec4 color, org, tmp, add;",
-			"float sample_dist, f;",
-			"vec2 vin;",
-			"vec2 uv = vUv;",
+		"	vec4 color, org, tmp, add;",
+		"	float sample_dist, f;",
+		"	vec2 vin;",
+		"	vec2 uv = vUv;",
 
-			"add = color = org = texture2D( tDiffuse, uv );",
+		"	add = color = org = texture2D( tDiffuse, uv );",
 
-			"vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
-			"sample_dist = dot( vin, vin ) * 2.0;",
+		"	vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
+		"	sample_dist = dot( vin, vin ) * 2.0;",
 
-			"f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
+		"	f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
 
-			"vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
+		"	vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
-			"color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
+		"	color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
+		"	color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
 
-			"gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
+		"	gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
 
 		"}"
 

+ 34 - 34
examples/js/shaders/FreiChenShader.js

@@ -21,8 +21,8 @@ THREE.FreiChenShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -55,38 +55,38 @@ THREE.FreiChenShader = {
 		"void main(void)",
 		"{",
 
-			"G[0] = g0,",
-			"G[1] = g1,",
-			"G[2] = g2,",
-			"G[3] = g3,",
-			"G[4] = g4,",
-			"G[5] = g5,",
-			"G[6] = g6,",
-			"G[7] = g7,",
-			"G[8] = g8;",
-
-			"mat3 I;",
-			"float cnv[9];",
-			"vec3 sample;",
-
-			/* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
-			"for (float i=0.0; i<3.0; i++) {",
-				"for (float j=0.0; j<3.0; j++) {",
-					"sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
-					"I[int(i)][int(j)] = length(sample);",
-				"}",
-			"}",
-
-			/* calculate the convolution values for all the masks */
-			"for (int i=0; i<9; i++) {",
-				"float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
-				"cnv[i] = dp3 * dp3;",
-			"}",
-
-			"float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
-			"float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
-
-			"gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
+		"	G[0] = g0,",
+		"	G[1] = g1,",
+		"	G[2] = g2,",
+		"	G[3] = g3,",
+		"	G[4] = g4,",
+		"	G[5] = g5,",
+		"	G[6] = g6,",
+		"	G[7] = g7,",
+		"	G[8] = g8;",
+
+		"	mat3 I;",
+		"	float cnv[9];",
+		"	vec3 sample;",
+
+		/* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
+		"	for (float i=0.0; i<3.0; i++) {",
+		"		for (float j=0.0; j<3.0; j++) {",
+		"			sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
+		"			I[int(i)][int(j)] = length(sample);",
+		"		}",
+		"	}",
+
+		/* calculate the convolution values for all the masks */
+		"	for (int i=0; i<9; i++) {",
+		"		float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
+		"		cnv[i] = dp3 * dp3;",
+		"	}",
+
+		"	float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
+		"	float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
+
+		"	gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
 		"}"
 
 	].join( "\n" )

+ 16 - 16
examples/js/shaders/FresnelShader.js

@@ -29,20 +29,20 @@ THREE.FresnelShader = {
 
 		"void main() {",
 
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
+		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
 
-			"vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );",
+		"	vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );",
 
-			"vec3 I = worldPosition.xyz - cameraPosition;",
+		"	vec3 I = worldPosition.xyz - cameraPosition;",
 
-			"vReflect = reflect( I, worldNormal );",
-			"vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );",
-			"vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );",
-			"vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );",
-			"vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );",
+		"	vReflect = reflect( I, worldNormal );",
+		"	vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );",
+		"	vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );",
+		"	vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );",
+		"	vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );",
 
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
 		"}"
 
@@ -58,14 +58,14 @@ THREE.FresnelShader = {
 
 		"void main() {",
 
-			"vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
-			"vec4 refractedColor = vec4( 1.0 );",
+		"	vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
+		"	vec4 refractedColor = vec4( 1.0 );",
 
-			"refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
-			"refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
-			"refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
+		"	refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
+		"	refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
+		"	refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
 
-			"gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
+		"	gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
 
 		"}"
 

+ 4 - 4
examples/js/shaders/GammaCorrectionShader.js

@@ -19,8 +19,8 @@ THREE.GammaCorrectionShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -34,9 +34,9 @@ THREE.GammaCorrectionShader = {
 
 		"void main() {",
 
-			"vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
+		"	vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
 
-			"gl_FragColor = LinearToGamma( tex, float( GAMMA_FACTOR ) );",
+		"	gl_FragColor = LinearToGamma( tex, float( GAMMA_FACTOR ) );",
 
 		"}"
 

+ 8 - 8
examples/js/shaders/GodRaysShader.js

@@ -141,16 +141,16 @@ THREE.GodRaysGenerateShader = {
 
 		"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {",
 
-			// Accumulate samples, making sure we dont walk past the light source.
+		// Accumulate samples, making sure we dont walk past the light source.
 
-			// The check for uv.y < 1 would not be necessary with "border" UV wrap
-			// mode, with a black border color. I don't think this is currently
-			// exposed by three.js. As a result there might be artifacts when the
-			// sun is to the left, right or bottom of screen as these cases are
-			// not specifically handled.
+		// The check for uv.y < 1 would not be necessary with "border" UV wrap
+		// mode, with a black border color. I don't think this is currently
+		// exposed by three.js. As a result there might be artifacts when the
+		// sun is to the left, right or bottom of screen as these cases are
+		// not specifically handled.
 
-			"col += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );",
-			"uv += stepv;",
+		"	col += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );",
+		"	uv += stepv;",
 
 		"}",
 		*/

+ 158 - 158
examples/js/shaders/HalftoneShader.js

@@ -70,242 +70,242 @@ THREE.HalftoneShader = {
 
 		"float blend( float a, float b, float t ) {",
 
-			// linear blend
-			"return a * ( 1.0 - t ) + b * t;",
+		// linear blend
+		"	return a * ( 1.0 - t ) + b * t;",
 
 		"}",
 
 		"float hypot( float x, float y ) {",
 
-			// vector magnitude
-			"return sqrt( x * x + y * y );",
+		// vector magnitude
+		"	return sqrt( x * x + y * y );",
 
 		"}",
 
 		"float rand( vec2 seed ){",
 
-			// get pseudo-random number
+		// get pseudo-random number
 	    "return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );",
 
 		"}",
 
 		"float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {",
 
-			// apply shape-specific transforms
-			"float dist = hypot( coord.x - p.x, coord.y - p.y );",
-			"float rad = channel;",
+		// apply shape-specific transforms
+		"	float dist = hypot( coord.x - p.x, coord.y - p.y );",
+		"	float rad = channel;",
 
-			"if ( shape == SHAPE_DOT ) {",
+		"	if ( shape == SHAPE_DOT ) {",
 
-				"rad = pow( abs( rad ), 1.125 ) * rad_max;",
+		"		rad = pow( abs( rad ), 1.125 ) * rad_max;",
 
-			"} else if ( shape == SHAPE_ELLIPSE ) {",
+		"	} else if ( shape == SHAPE_ELLIPSE ) {",
 
-				"rad = pow( abs( rad ), 1.125 ) * rad_max;",
+		"		rad = pow( abs( rad ), 1.125 ) * rad_max;",
 
-				"if ( dist != 0.0 ) {",
-					"float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );",
-					"dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;",
-				"}",
+		"		if ( dist != 0.0 ) {",
+		"			float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );",
+		"			dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;",
+		"		}",
 
-			"} else if ( shape == SHAPE_LINE ) {",
+		"	} else if ( shape == SHAPE_LINE ) {",
 
-				"rad = pow( abs( rad ), 1.5) * rad_max;",
-				"float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;",
-				"dist = hypot( normal.x * dot_p, normal.y * dot_p );",
+		"		rad = pow( abs( rad ), 1.5) * rad_max;",
+		"		float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;",
+		"		dist = hypot( normal.x * dot_p, normal.y * dot_p );",
 
-			"} else if ( shape == SHAPE_SQUARE ) {",
+		"	} else if ( shape == SHAPE_SQUARE ) {",
 
-				"float theta = atan( p.y - coord.y, p.x - coord.x ) - angle;",
-				"float sin_t = abs( sin( theta ) );",
-				"float cos_t = abs( cos( theta ) );",
-				"rad = pow( abs( rad ), 1.4 );",
-				"rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );",
+		"		float theta = atan( p.y - coord.y, p.x - coord.x ) - angle;",
+		"		float sin_t = abs( sin( theta ) );",
+		"		float cos_t = abs( cos( theta ) );",
+		"		rad = pow( abs( rad ), 1.4 );",
+		"		rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );",
 
-			"}",
+		"	}",
 
-			"return rad - dist;",
+		"	return rad - dist;",
 
 		"}",
 
 		"struct Cell {",
 
-			// grid sample positions
-			"vec2 normal;",
-			"vec2 p1;",
-			"vec2 p2;",
-			"vec2 p3;",
-			"vec2 p4;",
-			"float samp2;",
-			"float samp1;",
-			"float samp3;",
-			"float samp4;",
+		// grid sample positions
+		"	vec2 normal;",
+		"	vec2 p1;",
+		"	vec2 p2;",
+		"	vec2 p3;",
+		"	vec2 p4;",
+		"	float samp2;",
+		"	float samp1;",
+		"	float samp3;",
+		"	float samp4;",
 
 		"};",
 
 		"vec4 getSample( vec2 point ) {",
 
-			// multi-sampled point
-			"vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );",
-			"float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;",
-			"float step = PI2 / float( samples );",
-			"float dist = radius * 0.66;",
+		// multi-sampled point
+		"	vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );",
+		"	float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;",
+		"	float step = PI2 / float( samples );",
+		"	float dist = radius * 0.66;",
 
-			"for ( int i = 0; i < samples; ++i ) {",
+		"	for ( int i = 0; i < samples; ++i ) {",
 
-				"float r = base + step * float( i );",
-				"vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );",
-				"tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );",
+		"		float r = base + step * float( i );",
+		"		vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );",
+		"		tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );",
 
-			"}",
+		"	}",
 
-			"tex /= float( samples ) + 1.0;",
-			"return tex;",
+		"	tex /= float( samples ) + 1.0;",
+		"	return tex;",
 
 		"}",
 
 		"float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {",
 
-			// get colour for given point
-			"float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;",
+		// get colour for given point
+		"	float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;",
 
-			"if ( channel == 0 ) {",
+		"	if ( channel == 0 ) {",
 
-				"c.samp1 = getSample( c.p1 ).r;",
-				"c.samp2 = getSample( c.p2 ).r;",
-				"c.samp3 = getSample( c.p3 ).r;",
-				"c.samp4 = getSample( c.p4 ).r;",
+		"		c.samp1 = getSample( c.p1 ).r;",
+		"		c.samp2 = getSample( c.p2 ).r;",
+		"		c.samp3 = getSample( c.p3 ).r;",
+		"		c.samp4 = getSample( c.p4 ).r;",
 
-			"} else if (channel == 1) {",
+		"	} else if (channel == 1) {",
 
-				"c.samp1 = getSample( c.p1 ).g;",
-				"c.samp2 = getSample( c.p2 ).g;",
-				"c.samp3 = getSample( c.p3 ).g;",
-				"c.samp4 = getSample( c.p4 ).g;",
+		"		c.samp1 = getSample( c.p1 ).g;",
+		"		c.samp2 = getSample( c.p2 ).g;",
+		"		c.samp3 = getSample( c.p3 ).g;",
+		"		c.samp4 = getSample( c.p4 ).g;",
 
-			"} else {",
+		"	} else {",
 
-				"c.samp1 = getSample( c.p1 ).b;",
-				"c.samp3 = getSample( c.p3 ).b;",
-				"c.samp2 = getSample( c.p2 ).b;",
-				"c.samp4 = getSample( c.p4 ).b;",
+		"		c.samp1 = getSample( c.p1 ).b;",
+		"		c.samp3 = getSample( c.p3 ).b;",
+		"		c.samp2 = getSample( c.p2 ).b;",
+		"		c.samp4 = getSample( c.p4 ).b;",
 
-			"}",
+		"	}",
 
-			"dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );",
-			"dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );",
-			"dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );",
-			"dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );",
-			"res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;",
-			"res = clamp( res, 0.0, 1.0 );",
+		"	dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );",
+		"	dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );",
+		"	dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );",
+		"	dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );",
+		"	res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res = clamp( res, 0.0, 1.0 );",
 
-			"return res;",
+		"	return res;",
 
 		"}",
 
 		"Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {",
 
-			// get containing cell
-			"Cell c;",
-
-			// calc grid
-			"vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );",
-			"float threshold = step * 0.5;",
-			"float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );",
-			"float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );",
-			"vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );",
-			"float offset_normal = mod( hypot( offset.x, offset.y ), step );",
-			"float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;",
-			"float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;",
-			"float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );",
-			"float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;",
-			"float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;",
-
-			// get closest corner
-			"c.normal = n;",
-			"c.p1.x = p.x - n.x * normal_scale + n.y * line_scale;",
-			"c.p1.y = p.y - n.y * normal_scale - n.x * line_scale;",
-
-			// scatter
-			"if ( scatter != 0.0 ) {",
-
-				"float off_mag = scatter * threshold * 0.5;",
-				"float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;",
-				"c.p1.x += cos( off_angle ) * off_mag;",
-				"c.p1.y += sin( off_angle ) * off_mag;",
-
-			"}",
-
-			// find corners
-			"float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );",
-			"float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );",
-			"c.p2.x = c.p1.x - n.x * normal_step;",
-			"c.p2.y = c.p1.y - n.y * normal_step;",
-			"c.p3.x = c.p1.x + n.y * line_step;",
-			"c.p3.y = c.p1.y - n.x * line_step;",
-			"c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;",
-			"c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;",
-
-			"return c;",
+		// get containing cell
+		"	Cell c;",
+
+		// calc grid
+		"	vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );",
+		"	float threshold = step * 0.5;",
+		"	float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );",
+		"	float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );",
+		"	vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );",
+		"	float offset_normal = mod( hypot( offset.x, offset.y ), step );",
+		"	float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;",
+		"	float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;",
+		"	float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );",
+		"	float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;",
+		"	float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;",
+
+		// get closest corner
+		"	c.normal = n;",
+		"	c.p1.x = p.x - n.x * normal_scale + n.y * line_scale;",
+		"	c.p1.y = p.y - n.y * normal_scale - n.x * line_scale;",
+
+		// scatter
+		"	if ( scatter != 0.0 ) {",
+
+		"		float off_mag = scatter * threshold * 0.5;",
+		"		float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;",
+		"		c.p1.x += cos( off_angle ) * off_mag;",
+		"		c.p1.y += sin( off_angle ) * off_mag;",
+
+		"	}",
+
+		// find corners
+		"	float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );",
+		"	float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );",
+		"	c.p2.x = c.p1.x - n.x * normal_step;",
+		"	c.p2.y = c.p1.y - n.y * normal_step;",
+		"	c.p3.x = c.p1.x + n.y * line_step;",
+		"	c.p3.y = c.p1.y - n.x * line_step;",
+		"	c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;",
+		"	c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;",
+
+		"	return c;",
 
 		"}",
 
 		"float blendColour( float a, float b, float t ) {",
 
-			// blend colours
-			"if ( blendingMode == BLENDING_LINEAR ) {",
-				"return blend( a, b, 1.0 - t );",
-			"} else if ( blendingMode == BLENDING_ADD ) {",
-				"return blend( a, min( 1.0, a + b ), t );",
-			"} else if ( blendingMode == BLENDING_MULTIPLY ) {",
-				"return blend( a, max( 0.0, a * b ), t );",
-			"} else if ( blendingMode == BLENDING_LIGHTER ) {",
-				"return blend( a, max( a, b ), t );",
-			"} else if ( blendingMode == BLENDING_DARKER ) {",
-				"return blend( a, min( a, b ), t );",
-			"} else {",
-				"return blend( a, b, 1.0 - t );",
-			"}",
+		// blend colours
+		"	if ( blendingMode == BLENDING_LINEAR ) {",
+		"		return blend( a, b, 1.0 - t );",
+		"	} else if ( blendingMode == BLENDING_ADD ) {",
+		"		return blend( a, min( 1.0, a + b ), t );",
+		"	} else if ( blendingMode == BLENDING_MULTIPLY ) {",
+		"		return blend( a, max( 0.0, a * b ), t );",
+		"	} else if ( blendingMode == BLENDING_LIGHTER ) {",
+		"		return blend( a, max( a, b ), t );",
+		"	} else if ( blendingMode == BLENDING_DARKER ) {",
+		"		return blend( a, min( a, b ), t );",
+		"	} else {",
+		"		return blend( a, b, 1.0 - t );",
+		"	}",
 
 		"}",
 
 		"void main() {",
 
-			"if ( ! disable ) {",
+		"	if ( ! disable ) {",
 
-				// setup
-				"vec2 p = vec2( vUV.x * width, vUV.y * height );",
-				"vec2 origin = vec2( 0, 0 );",
-				"float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;",
+		// setup
+		"		vec2 p = vec2( vUV.x * width, vUV.y * height );",
+		"		vec2 origin = vec2( 0, 0 );",
+		"		float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;",
 
-				// get channel samples
-				"Cell cell_r = getReferenceCell( p, origin, rotateR, radius );",
-				"Cell cell_g = getReferenceCell( p, origin, rotateG, radius );",
-				"Cell cell_b = getReferenceCell( p, origin, rotateB, radius );",
-				"float r = getDotColour( cell_r, p, 0, rotateR, aa );",
-				"float g = getDotColour( cell_g, p, 1, rotateG, aa );",
-				"float b = getDotColour( cell_b, p, 2, rotateB, aa );",
+		// get channel samples
+		"		Cell cell_r = getReferenceCell( p, origin, rotateR, radius );",
+		"		Cell cell_g = getReferenceCell( p, origin, rotateG, radius );",
+		"		Cell cell_b = getReferenceCell( p, origin, rotateB, radius );",
+		"		float r = getDotColour( cell_r, p, 0, rotateR, aa );",
+		"		float g = getDotColour( cell_g, p, 1, rotateG, aa );",
+		"		float b = getDotColour( cell_b, p, 2, rotateB, aa );",
 
-				// blend with original
-				"vec4 colour = texture2D( tDiffuse, vUV );",
-				"r = blendColour( r, colour.r, blending );",
-				"g = blendColour( g, colour.g, blending );",
-				"b = blendColour( b, colour.b, blending );",
+		// blend with original
+		"		vec4 colour = texture2D( tDiffuse, vUV );",
+		"		r = blendColour( r, colour.r, blending );",
+		"		g = blendColour( g, colour.g, blending );",
+		"		b = blendColour( b, colour.b, blending );",
 
-				"if ( greyscale ) {",
-					"r = g = b = (r + b + g) / 3.0;",
-				"}",
+		"		if ( greyscale ) {",
+		"			r = g = b = (r + b + g) / 3.0;",
+		"		}",
 
-				"gl_FragColor = vec4( r, g, b, 1.0 );",
+		"		gl_FragColor = vec4( r, g, b, 1.0 );",
 
-			"} else {",
+		"	} else {",
 
-				"gl_FragColor = texture2D( tDiffuse, vUV );",
+		"		gl_FragColor = texture2D( tDiffuse, vUV );",
 
-			"}",
+		"	}",
 
 		"}"
 

+ 13 - 13
examples/js/shaders/HorizontalBlurShader.js

@@ -25,8 +25,8 @@ THREE.HorizontalBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -41,19 +41,19 @@ THREE.HorizontalBlurShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 14 - 14
examples/js/shaders/HorizontalTiltShiftShader.js

@@ -25,8 +25,8 @@ THREE.HorizontalTiltShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,21 +42,21 @@ THREE.HorizontalTiltShiftShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"float hh = h * abs( r - vUv.y );",
+		"	float hh = h * abs( r - vUv.y );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 18 - 18
examples/js/shaders/HueSaturationShader.js

@@ -23,9 +23,9 @@ THREE.HueSaturationShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -41,26 +41,26 @@ THREE.HueSaturationShader = {
 
 		"void main() {",
 
-			"gl_FragColor = texture2D( tDiffuse, vUv );",
+		"	gl_FragColor = texture2D( tDiffuse, vUv );",
 
 			// hue
-			"float angle = hue * 3.14159265;",
-			"float s = sin(angle), c = cos(angle);",
-			"vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
-			"float len = length(gl_FragColor.rgb);",
-			"gl_FragColor.rgb = vec3(",
-				"dot(gl_FragColor.rgb, weights.xyz),",
-				"dot(gl_FragColor.rgb, weights.zxy),",
-				"dot(gl_FragColor.rgb, weights.yzx)",
-			");",
+		"	float angle = hue * 3.14159265;",
+		"	float s = sin(angle), c = cos(angle);",
+		"	vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
+		"	float len = length(gl_FragColor.rgb);",
+		"	gl_FragColor.rgb = vec3(",
+		"		dot(gl_FragColor.rgb, weights.xyz),",
+		"		dot(gl_FragColor.rgb, weights.zxy),",
+		"		dot(gl_FragColor.rgb, weights.yzx)",
+		"	);",
 
 			// saturation
-			"float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
-			"if (saturation > 0.0) {",
-				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
-			"} else {",
-				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
-			"}",
+		"	float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
+		"	if (saturation > 0.0) {",
+		"		gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
+		"	} else {",
+		"		gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
+		"	}",
 
 		"}"
 

+ 11 - 11
examples/js/shaders/KaleidoShader.js

@@ -26,8 +26,8 @@ THREE.KaleidoShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,15 +43,15 @@ THREE.KaleidoShader = {
 
 		"void main() {",
 
-			"vec2 p = vUv - 0.5;",
-			"float r = length(p);",
-			"float a = atan(p.y, p.x) + angle;",
-			"float tau = 2. * 3.1416 ;",
-			"a = mod(a, tau/sides);",
-			"a = abs(a - tau/sides/2.) ;",
-			"p = r * vec2(cos(a), sin(a));",
-			"vec4 color = texture2D(tDiffuse, p + 0.5);",
-			"gl_FragColor = color;",
+		"	vec2 p = vUv - 0.5;",
+		"	float r = length(p);",
+		"	float a = atan(p.y, p.x) + angle;",
+		"	float tau = 2. * 3.1416 ;",
+		"	a = mod(a, tau/sides);",
+		"	a = abs(a - tau/sides/2.) ;",
+		"	p = r * vec2(cos(a), sin(a));",
+		"	vec4 color = texture2D(tDiffuse, p + 0.5);",
+		"	gl_FragColor = color;",
 
 		"}"
 

+ 8 - 8
examples/js/shaders/LuminosityHighPassShader.js

@@ -25,9 +25,9 @@ THREE.LuminosityHighPassShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -45,17 +45,17 @@ THREE.LuminosityHighPassShader = {
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+		"	vec3 luma = vec3( 0.299, 0.587, 0.114 );",
 
-			"float v = dot( texel.xyz, luma );",
+		"	float v = dot( texel.xyz, luma );",
 
-			"vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );",
+		"	vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );",
 
-			"float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );",
+		"	float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );",
 
-			"gl_FragColor = mix( outputColor, texel, alpha );",
+		"	gl_FragColor = mix( outputColor, texel, alpha );",
 
 		"}"
 

+ 5 - 5
examples/js/shaders/LuminosityShader.js

@@ -19,9 +19,9 @@ THREE.LuminosityShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -37,11 +37,11 @@ THREE.LuminosityShader = {
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"float l = linearToRelativeLuminance( texel.rgb );",
+		"	float l = linearToRelativeLuminance( texel.rgb );",
 
-			"gl_FragColor = vec4( l, l, l, texel.w );",
+		"	gl_FragColor = vec4( l, l, l, texel.w );",
 
 		"}"
 

+ 14 - 14
examples/js/shaders/MirrorShader.js

@@ -22,8 +22,8 @@ THREE.MirrorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -38,18 +38,18 @@ THREE.MirrorShader = {
 
 		"void main() {",
 
-			"vec2 p = vUv;",
-			"if (side == 0){",
-				"if (p.x > 0.5) p.x = 1.0 - p.x;",
-			"}else if (side == 1){",
-				"if (p.x < 0.5) p.x = 1.0 - p.x;",
-			"}else if (side == 2){",
-				"if (p.y < 0.5) p.y = 1.0 - p.y;",
-			"}else if (side == 3){",
-				"if (p.y > 0.5) p.y = 1.0 - p.y;",
-			"} ",
-			"vec4 color = texture2D(tDiffuse, p);",
-			"gl_FragColor = color;",
+		"	vec2 p = vUv;",
+		"	if (side == 0){",
+		"		if (p.x > 0.5) p.x = 1.0 - p.x;",
+		"	}else if (side == 1){",
+		"		if (p.x < 0.5) p.x = 1.0 - p.x;",
+		"	}else if (side == 2){",
+		"		if (p.y < 0.5) p.y = 1.0 - p.y;",
+		"	}else if (side == 3){",
+		"		if (p.y > 0.5) p.y = 1.0 - p.y;",
+		"	} ",
+		"	vec4 color = texture2D(tDiffuse, p);",
+		"	gl_FragColor = color;",
 
 		"}"
 

+ 6 - 6
examples/js/shaders/NormalMapShader.js

@@ -22,8 +22,8 @@ THREE.NormalMapShader = {
 
 		"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 @@ THREE.NormalMapShader = {
 
 		"void main() {",
 
-			"float val = texture2D( heightMap, vUv ).x;",
+		"	float val = texture2D( heightMap, vUv ).x;",
 
-			"float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
-			"float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
+		"	float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
+		"	float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
 
-			"gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
+		"	gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
 
 		"}"
 

+ 70 - 70
examples/js/shaders/ParallaxShader.js

@@ -28,11 +28,11 @@ THREE.ParallaxShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vViewPosition = -mvPosition.xyz;",
-			"vNormal = normalize( normalMatrix * normal );",
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	vUv = uv;",
+		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"	vViewPosition = -mvPosition.xyz;",
+		"	vNormal = normalize( normalMatrix * normal );",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
 		"}"
 
@@ -52,130 +52,130 @@ THREE.ParallaxShader = {
 
 		"#ifdef USE_BASIC_PARALLAX",
 
-			"vec2 parallaxMap( in vec3 V ) {",
+		"	vec2 parallaxMap( in vec3 V ) {",
 
-				"float initialHeight = texture2D( bumpMap, vUv ).r;",
+		"		float initialHeight = texture2D( bumpMap, vUv ).r;",
 
 				// No Offset Limitting: messy, floating output at grazing angles.
 				//"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;",
 
 				// Offset Limiting
-				"vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;",
-				"return vUv - texCoordOffset;",
+		"		vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;",
+		"		return vUv - texCoordOffset;",
 
-			"}",
+		"	}",
 
 		"#else",
 
-			"vec2 parallaxMap( in vec3 V ) {",
+		"	vec2 parallaxMap( in vec3 V ) {",
 
 				// Determine number of layers from angle between V and N
-				"float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );",
+		"		float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );",
 
-				"float layerHeight = 1.0 / numLayers;",
-				"float currentLayerHeight = 0.0;",
+		"		float layerHeight = 1.0 / numLayers;",
+		"		float currentLayerHeight = 0.0;",
 				// Shift of texture coordinates for each iteration
-				"vec2 dtex = parallaxScale * V.xy / V.z / numLayers;",
+		"		vec2 dtex = parallaxScale * V.xy / V.z / numLayers;",
 
-				"vec2 currentTextureCoords = vUv;",
+		"		vec2 currentTextureCoords = vUv;",
 
-				"float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"		float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 
 				// while ( heightFromTexture > currentLayerHeight )
 				// Infinite loops are not well supported. Do a "large" finite
 				// loop, but not too large, as it slows down some compilers.
-				"for ( int i = 0; i < 30; i += 1 ) {",
-					"if ( heightFromTexture <= currentLayerHeight ) {",
-						"break;",
-					"}",
-					"currentLayerHeight += layerHeight;",
+		"		for ( int i = 0; i < 30; i += 1 ) {",
+		"			if ( heightFromTexture <= currentLayerHeight ) {",
+		"				break;",
+		"			}",
+		"			currentLayerHeight += layerHeight;",
 					// Shift texture coordinates along vector V
-					"currentTextureCoords -= dtex;",
-					"heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
-				"}",
+		"			currentTextureCoords -= dtex;",
+		"			heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"		}",
 
-				"#ifdef USE_STEEP_PARALLAX",
+		"		#ifdef USE_STEEP_PARALLAX",
 
-					"return currentTextureCoords;",
+		"			return currentTextureCoords;",
 
-				"#elif defined( USE_RELIEF_PARALLAX )",
+		"		#elif defined( USE_RELIEF_PARALLAX )",
 
-					"vec2 deltaTexCoord = dtex / 2.0;",
-					"float deltaHeight = layerHeight / 2.0;",
+		"			vec2 deltaTexCoord = dtex / 2.0;",
+		"			float deltaHeight = layerHeight / 2.0;",
 
 					// Return to the mid point of previous layer
-					"currentTextureCoords += deltaTexCoord;",
-					"currentLayerHeight -= deltaHeight;",
+		"			currentTextureCoords += deltaTexCoord;",
+		"			currentLayerHeight -= deltaHeight;",
 
 					// Binary search to increase precision of Steep Parallax Mapping
-					"const int numSearches = 5;",
-					"for ( int i = 0; i < numSearches; i += 1 ) {",
+		"			const int numSearches = 5;",
+		"			for ( int i = 0; i < numSearches; i += 1 ) {",
 
-						"deltaTexCoord /= 2.0;",
-						"deltaHeight /= 2.0;",
-						"heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"				deltaTexCoord /= 2.0;",
+		"				deltaHeight /= 2.0;",
+		"				heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 						// Shift along or against vector V
-						"if( heightFromTexture > currentLayerHeight ) {", // Below the surface
+		"				if( heightFromTexture > currentLayerHeight ) {", // Below the surface
 
-							"currentTextureCoords -= deltaTexCoord;",
-							"currentLayerHeight += deltaHeight;",
+		"					currentTextureCoords -= deltaTexCoord;",
+		"					currentLayerHeight += deltaHeight;",
 
-						"} else {", // above the surface
+		"				} else {", // above the surface
 
-							"currentTextureCoords += deltaTexCoord;",
-							"currentLayerHeight -= deltaHeight;",
+		"					currentTextureCoords += deltaTexCoord;",
+		"					currentLayerHeight -= deltaHeight;",
 
-						"}",
+		"				}",
 
-					"}",
-					"return currentTextureCoords;",
+		"			}",
+		"			return currentTextureCoords;",
 
-				"#elif defined( USE_OCLUSION_PARALLAX )",
+		"		#elif defined( USE_OCLUSION_PARALLAX )",
 
-					"vec2 prevTCoords = currentTextureCoords + dtex;",
+		"			vec2 prevTCoords = currentTextureCoords + dtex;",
 
 					// Heights for linear interpolation
-					"float nextH = heightFromTexture - currentLayerHeight;",
-					"float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;",
+		"			float nextH = heightFromTexture - currentLayerHeight;",
+		"			float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;",
 
 					// Proportions for linear interpolation
-					"float weight = nextH / ( nextH - prevH );",
+		"			float weight = nextH / ( nextH - prevH );",
 
 					// Interpolation of texture coordinates
-					"return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );",
+		"			return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );",
 
-				"#else", // NO_PARALLAX
+		"		#else", // NO_PARALLAX
 
-					"return vUv;",
+		"			return vUv;",
 
-				"#endif",
+		"		#endif",
 
-			"}",
+		"	}",
 		"#endif",
 
 		"vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {",
 
- 			"vec2 texDx = dFdx( vUv );",
-			"vec2 texDy = dFdy( vUv );",
+ 		"	vec2 texDx = dFdx( vUv );",
+		"	vec2 texDy = dFdy( vUv );",
 
-			"vec3 vSigmaX = dFdx( surfPosition );",
-			"vec3 vSigmaY = dFdy( surfPosition );",
-			"vec3 vR1 = cross( vSigmaY, surfNormal );",
-			"vec3 vR2 = cross( surfNormal, vSigmaX );",
-			"float fDet = dot( vSigmaX, vR1 );",
+		"	vec3 vSigmaX = dFdx( surfPosition );",
+		"	vec3 vSigmaY = dFdy( surfPosition );",
+		"	vec3 vR1 = cross( vSigmaY, surfNormal );",
+		"	vec3 vR2 = cross( surfNormal, vSigmaX );",
+		"	float fDet = dot( vSigmaX, vR1 );",
 
-			"vec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );",
-			"vec3 vProjVtex;",
-			"vProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;",
-			"vProjVtex.z = dot( surfNormal, viewPosition );",
+		"	vec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );",
+		"	vec3 vProjVtex;",
+		"	vProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;",
+		"	vProjVtex.z = dot( surfNormal, viewPosition );",
 
-			"return parallaxMap( vProjVtex );",
+		"	return parallaxMap( vProjVtex );",
 		"}",
 
 		"void main() {",
 
-			"vec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );",
-			"gl_FragColor = texture2D( map, mapUv );",
+		"	vec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );",
+		"	gl_FragColor = texture2D( map, mapUv );",
 
 		"}"
 

+ 7 - 7
examples/js/shaders/RGBShiftShader.js

@@ -26,8 +26,8 @@ THREE.RGBShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,11 +43,11 @@ THREE.RGBShiftShader = {
 
 		"void main() {",
 
-			"vec2 offset = amount * vec2( cos(angle), sin(angle));",
-			"vec4 cr = texture2D(tDiffuse, vUv + offset);",
-			"vec4 cga = texture2D(tDiffuse, vUv);",
-			"vec4 cb = texture2D(tDiffuse, vUv - offset);",
-			"gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
+		"	vec2 offset = amount * vec2( cos(angle), sin(angle));",
+		"	vec4 cr = texture2D(tDiffuse, vUv + offset);",
+		"	vec4 cga = texture2D(tDiffuse, vUv);",
+		"	vec4 cb = texture2D(tDiffuse, vUv - offset);",
+		"	gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
 
 		"}"
 

+ 8 - 8
examples/js/shaders/SepiaShader.js

@@ -21,8 +21,8 @@ THREE.SepiaShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -38,14 +38,14 @@ THREE.SepiaShader = {
 
 		"void main() {",
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
-			"vec3 c = color.rgb;",
+		"	vec4 color = texture2D( tDiffuse, vUv );",
+		"	vec3 c = color.rgb;",
 
-			"color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
-			"color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
-			"color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
+		"	color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
+		"	color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
+		"	color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
 
-			"gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
+		"	gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
 
 		"}"
 

+ 22 - 22
examples/js/shaders/SobelOperatorShader.js

@@ -22,9 +22,9 @@ THREE.SobelOperatorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -38,50 +38,50 @@ THREE.SobelOperatorShader = {
 
 		"void main() {",
 
-			"vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );",
+		"	vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );",
 
 			// kernel definition (in glsl matrices are filled in column-major order)
 
-			"const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel
-			"const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel
+		"	const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel
+		"	const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel
 
 			// fetch the 3x3 neighbourhood of a fragment
 
 			// first column
 
-			"float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;",
-			"float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1,  0 ) ).r;",
-			"float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1,  1 ) ).r;",
+		"	float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;",
+		"	float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1,  0 ) ).r;",
+		"	float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1,  1 ) ).r;",
 
 			// second column
 
-			"float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2(  0, -1 ) ).r;",
-			"float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2(  0,  0 ) ).r;",
-			"float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2(  0,  1 ) ).r;",
+		"	float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2(  0, -1 ) ).r;",
+		"	float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2(  0,  0 ) ).r;",
+		"	float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2(  0,  1 ) ).r;",
 
 			// third column
 
-			"float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2(  1, -1 ) ).r;",
-			"float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2(  1,  0 ) ).r;",
-			"float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2(  1,  1 ) ).r;",
+		"	float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2(  1, -1 ) ).r;",
+		"	float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2(  1,  0 ) ).r;",
+		"	float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2(  1,  1 ) ).r;",
 
 			// gradient value in x direction
 
-			"float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ",
-				"Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ",
-				"Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ",
+		"	float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ",
+		"		Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ",
+		"		Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ",
 
 			// gradient value in y direction
 
-			"float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ",
-				"Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ",
-				"Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ",
+		"	float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ",
+		"		Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ",
+		"		Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ",
 
 			// magnitute of the total gradient
 
-			"float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );",
+		"	float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );",
 
-			"gl_FragColor = vec4( vec3( G ), 1 );",
+		"	gl_FragColor = vec4( vec3( G ), 1 );",
 
 		"}"
 

+ 5 - 5
examples/js/shaders/TechnicolorShader.js

@@ -21,8 +21,8 @@ THREE.TechnicolorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -35,10 +35,10 @@ THREE.TechnicolorShader = {
 
 		"void main() {",
 
-			"vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
-			"vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
+		"	vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
+		"	vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
 
-			"gl_FragColor = newTex;",
+		"	gl_FragColor = newTex;",
 
 		"}"
 

+ 102 - 102
examples/js/shaders/TerrainShader.js

@@ -90,151 +90,151 @@ THREE.TerrainShader = {
 		THREE.ShaderChunk[ "fog_pars_fragment" ],
 
 		"float calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {",
-				"if ( decayExponent > 0.0 ) {",
-					"return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );",
-				"}",
-				"return 1.0;",
-			"}",
+		"		if ( decayExponent > 0.0 ) {",
+		"			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );",
+		"		}",
+		"		return 1.0;",
+		"	}",
 
 		"void main() {",
 
-			"vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-			"vec4 diffuseColor = vec4( diffuse, opacity );",
+		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
+		"	vec4 diffuseColor = vec4( diffuse, opacity );",
 
-			"vec3 specularTex = vec3( 1.0 );",
+		"	vec3 specularTex = vec3( 1.0 );",
 
-			"vec2 uvOverlay = uRepeatOverlay * vUv + uOffset;",
-			"vec2 uvBase = uRepeatBase * vUv;",
+		"	vec2 uvOverlay = uRepeatOverlay * vUv + uOffset;",
+		"	vec2 uvBase = uRepeatBase * vUv;",
 
-			"vec3 normalTex = texture2D( tDetail, uvOverlay ).xyz * 2.0 - 1.0;",
-			"normalTex.xy *= uNormalScale;",
-			"normalTex = normalize( normalTex );",
+		"	vec3 normalTex = texture2D( tDetail, uvOverlay ).xyz * 2.0 - 1.0;",
+		"	normalTex.xy *= uNormalScale;",
+		"	normalTex = normalize( normalTex );",
 
-			"if( enableDiffuse1 && enableDiffuse2 ) {",
+		"	if( enableDiffuse1 && enableDiffuse2 ) {",
 
-				"vec4 colDiffuse1 = texture2D( tDiffuse1, uvOverlay );",
-				"vec4 colDiffuse2 = texture2D( tDiffuse2, uvOverlay );",
+		"		vec4 colDiffuse1 = texture2D( tDiffuse1, uvOverlay );",
+		"		vec4 colDiffuse2 = texture2D( tDiffuse2, uvOverlay );",
 
-				"colDiffuse1 = GammaToLinear( colDiffuse1, float( GAMMA_FACTOR ) );",
-				"colDiffuse2 = GammaToLinear( colDiffuse2, float( GAMMA_FACTOR ) );",
+		"		colDiffuse1 = GammaToLinear( colDiffuse1, float( GAMMA_FACTOR ) );",
+		"		colDiffuse2 = GammaToLinear( colDiffuse2, float( GAMMA_FACTOR ) );",
 
-				"diffuseColor *= mix ( colDiffuse1, colDiffuse2, 1.0 - texture2D( tDisplacement, uvBase ) );",
+		"		diffuseColor *= mix ( colDiffuse1, colDiffuse2, 1.0 - texture2D( tDisplacement, uvBase ) );",
 
-			" } else if( enableDiffuse1 ) {",
+		"	 } else if( enableDiffuse1 ) {",
 
-				"diffuseColor *= texture2D( tDiffuse1, uvOverlay );",
+		"		diffuseColor *= texture2D( tDiffuse1, uvOverlay );",
 
-			"} else if( enableDiffuse2 ) {",
+		"	} else if( enableDiffuse2 ) {",
 
-				"diffuseColor *= texture2D( tDiffuse2, uvOverlay );",
+		"		diffuseColor *= texture2D( tDiffuse2, uvOverlay );",
 
-			"}",
+		"	}",
 
-			"if( enableSpecular )",
-				"specularTex = texture2D( tSpecular, uvOverlay ).xyz;",
+		"	if( enableSpecular )",
+		"		specularTex = texture2D( tSpecular, uvOverlay ).xyz;",
 
-			"mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
-			"vec3 finalNormal = tsb * normalTex;",
+		"	mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
+		"	vec3 finalNormal = tsb * normalTex;",
 
-			"vec3 normal = normalize( finalNormal );",
-			"vec3 viewPosition = normalize( vViewPosition );",
+		"	vec3 normal = normalize( finalNormal );",
+		"	vec3 viewPosition = normalize( vViewPosition );",
 
-			"vec3 totalDiffuseLight = vec3( 0.0 );",
-			"vec3 totalSpecularLight = vec3( 0.0 );",
+		"	vec3 totalDiffuseLight = vec3( 0.0 );",
+		"	vec3 totalSpecularLight = vec3( 0.0 );",
 
 			// point lights
 
-			"#if NUM_POINT_LIGHTS > 0",
+		"	#if NUM_POINT_LIGHTS > 0",
 
-				"for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
+		"		for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
 
-					"vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
+		"			vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
 
-					"float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
+		"			float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
 
-					"lVector = normalize( lVector );",
+		"			lVector = normalize( lVector );",
 
-					"vec3 pointHalfVector = normalize( lVector + viewPosition );",
+		"			vec3 pointHalfVector = normalize( lVector + viewPosition );",
 
-					"float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
-					"float pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );",
+		"			float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
+		"			float pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );",
 
-					"float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
+		"			float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
 
-					"totalDiffuseLight += attenuation * pointLights[ i ].color * pointDiffuseWeight;",
-					"totalSpecularLight += attenuation * pointLights[ i ].color * specular * pointSpecularWeight * pointDiffuseWeight;",
+		"			totalDiffuseLight += attenuation * pointLights[ i ].color * pointDiffuseWeight;",
+		"			totalSpecularLight += attenuation * pointLights[ i ].color * specular * pointSpecularWeight * pointDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
 			// directional lights
 
-			"#if NUM_DIR_LIGHTS > 0",
+		"	#if NUM_DIR_LIGHTS > 0",
 
-				"vec3 dirDiffuse = vec3( 0.0 );",
-				"vec3 dirSpecular = vec3( 0.0 );",
+		"		vec3 dirDiffuse = vec3( 0.0 );",
+		"		vec3 dirSpecular = vec3( 0.0 );",
 
-				"for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
+		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
 
-					"vec3 dirVector = directionalLights[ i ].direction;",
-					"vec3 dirHalfVector = normalize( dirVector + viewPosition );",
+		"			vec3 dirVector = directionalLights[ i ].direction;",
+		"			vec3 dirHalfVector = normalize( dirVector + viewPosition );",
 
-					"float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
-					"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
+		"			float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
+		"			float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
 
-					"float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
+		"			float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
 
-					"totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-					"totalSpecularLight += directionalLights[ i ].color * specular * dirSpecularWeight * dirDiffuseWeight;",
+		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
+		"			totalSpecularLight += directionalLights[ i ].color * specular * dirSpecularWeight * dirDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
 			// hemisphere lights
 
-			"#if NUM_HEMI_LIGHTS > 0",
+		"	#if NUM_HEMI_LIGHTS > 0",
 
-				"vec3 hemiDiffuse  = vec3( 0.0 );",
-				"vec3 hemiSpecular = vec3( 0.0 );",
+		"		vec3 hemiDiffuse  = vec3( 0.0 );",
+		"		vec3 hemiSpecular = vec3( 0.0 );",
 
-				"for( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
+		"		for( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
 
-					"vec3 lVector = hemisphereLightDirection[ i ];",
+		"			vec3 lVector = hemisphereLightDirection[ i ];",
 
 					// diffuse
 
-					"float dotProduct = dot( normal, lVector );",
-					"float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
+		"			float dotProduct = dot( normal, lVector );",
+		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
 
-					"totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );",
+		"			totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );",
 
 					// specular (sky light)
 
-					"float hemiSpecularWeight = 0.0;",
+		"			float hemiSpecularWeight = 0.0;",
 
-					"vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
-					"float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
-					"hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
+		"			vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
+		"			float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
+		"			hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
 
 					// specular (ground light)
 
-					"vec3 lVectorGround = -lVector;",
+		"			vec3 lVectorGround = -lVector;",
 
-					"vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );",
-					"float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;",
-					"hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );",
+		"			vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );",
+		"			float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;",
+		"			hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );",
 
-					"totalSpecularLight += specular * mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight ) * hemiSpecularWeight * hemiDiffuseWeight;",
+		"			totalSpecularLight += specular * mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight ) * hemiSpecularWeight * hemiDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
-			"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
+		"	outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
 
-			"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
+		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
 			THREE.ShaderChunk[ "fog_fragment" ],
 
@@ -252,9 +252,9 @@ THREE.TerrainShader = {
 
 		"#ifdef VERTEX_TEXTURES",
 
-			"uniform sampler2D tDisplacement;",
-			"uniform float uDisplacementScale;",
-			"uniform float uDisplacementBias;",
+		"	uniform sampler2D tDisplacement;",
+		"	uniform float uDisplacementScale;",
+		"	uniform float uDisplacementBias;",
 
 		"#endif",
 
@@ -270,45 +270,45 @@ THREE.TerrainShader = {
 
 		"void main() {",
 
-			"vNormal = normalize( normalMatrix * normal );",
+		"	vNormal = normalize( normalMatrix * normal );",
 
 			// tangent and binormal vectors
 
-			"vTangent = normalize( normalMatrix * tangent.xyz );",
+		"	vTangent = normalize( normalMatrix * tangent.xyz );",
 
-			"vBinormal = cross( vNormal, vTangent ) * tangent.w;",
-			"vBinormal = normalize( vBinormal );",
+		"	vBinormal = cross( vNormal, vTangent ) * tangent.w;",
+		"	vBinormal = normalize( vBinormal );",
 
 			// texture coordinates
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"vec2 uvBase = uv * uRepeatBase;",
+		"	vec2 uvBase = uv * uRepeatBase;",
 
 			// displacement mapping
 
-			"#ifdef VERTEX_TEXTURES",
+		"	#ifdef VERTEX_TEXTURES",
 
-				"vec3 dv = texture2D( tDisplacement, uvBase ).xyz;",
-				"float df = uDisplacementScale * dv.x + uDisplacementBias;",
-				"vec3 displacedPosition = normal * df + position;",
+		"		vec3 dv = texture2D( tDisplacement, uvBase ).xyz;",
+		"		float df = uDisplacementScale * dv.x + uDisplacementBias;",
+		"		vec3 displacedPosition = normal * df + position;",
 
-				"vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
-				"vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
+		"		vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
+		"		vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
 
-			"#else",
+		"	#else",
 
-				"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-				"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"		vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
+		"		vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
 
-			"#endif",
+		"	#endif",
 
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
-			"vViewPosition = -mvPosition.xyz;",
+		"	vViewPosition = -mvPosition.xyz;",
 
-			"vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;",
-			"vNormal = normalMatrix * normalTex;",
+		"	vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;",
+		"	vNormal = normalMatrix * normalTex;",
 
 			THREE.ShaderChunk[ "shadowmap_vertex" ],
 			THREE.ShaderChunk[ "fog_vertex" ],

+ 15 - 15
examples/js/shaders/ToneMapShader.js

@@ -22,8 +22,8 @@ THREE.ToneMapShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -41,34 +41,34 @@ THREE.ToneMapShader = {
 		"uniform float minLuminance;",
 		"uniform float maxLuminance;",
 		"#ifdef ADAPTED_LUMINANCE",
-			"uniform sampler2D luminanceMap;",
+		"	uniform sampler2D luminanceMap;",
 		"#else",
-			"uniform float averageLuminance;",
+		"	uniform float averageLuminance;",
 		"#endif",
 
 		"vec3 ToneMap( vec3 vColor ) {",
-			"#ifdef ADAPTED_LUMINANCE",
+		"	#ifdef ADAPTED_LUMINANCE",
 				// Get the calculated average luminance
-				"float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;",
-			"#else",
-				"float fLumAvg = averageLuminance;",
-			"#endif",
+		"		float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;",
+		"	#else",
+		"		float fLumAvg = averageLuminance;",
+		"	#endif",
 
 			// Calculate the luminance of the current pixel
-			"float fLumPixel = linearToRelativeLuminance( vColor );",
+		"	float fLumPixel = linearToRelativeLuminance( vColor );",
 
 			// Apply the modified operator (Eq. 4)
-			"float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );",
+		"	float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );",
 
-			"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);",
-			"return fLumCompressed * vColor;",
+		"	float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);",
+		"	return fLumCompressed * vColor;",
 		"}",
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );",
+		"	gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );",
 
 		"}"
 

+ 12 - 12
examples/js/shaders/TriangleBlurShader.js

@@ -25,8 +25,8 @@ THREE.TriangleBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -45,25 +45,25 @@ THREE.TriangleBlurShader = {
 
 		"void main() {",
 
-			"vec4 color = vec4( 0.0 );",
+		"	vec4 color = vec4( 0.0 );",
 
-			"float total = 0.0;",
+		"	float total = 0.0;",
 
 			// randomize the lookup values to hide the fixed number of samples
 
-			"float offset = rand( vUv );",
+		"	float offset = rand( vUv );",
 
-			"for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
+		"	for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
 
-				"float percent = ( t + offset - 0.5 ) / ITERATIONS;",
-				"float weight = 1.0 - abs( percent );",
+		"		float percent = ( t + offset - 0.5 ) / ITERATIONS;",
+		"		float weight = 1.0 - abs( percent );",
 
-				"color += texture2D( texture, vUv + delta * percent ) * weight;",
-				"total += weight;",
+		"		color += texture2D( texture, vUv + delta * percent ) * weight;",
+		"		total += weight;",
 
-			"}",
+		"	}",
 
-			"gl_FragColor = color / total;",
+		"	gl_FragColor = color / total;",
 
 		"}"
 

+ 4 - 4
examples/js/shaders/UnpackDepthRGBAShader.js

@@ -20,8 +20,8 @@ THREE.UnpackDepthRGBAShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -39,8 +39,8 @@ THREE.UnpackDepthRGBAShader = {
 
 		"void main() {",
 
-			"float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );",
-			"gl_FragColor = vec4( vec3( depth ), opacity );",
+		"	float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );",
+		"	gl_FragColor = vec4( vec3( depth ), opacity );",
 
 		"}"
 

+ 13 - 13
examples/js/shaders/VerticalBlurShader.js

@@ -25,8 +25,8 @@ THREE.VerticalBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -41,19 +41,19 @@ THREE.VerticalBlurShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 14 - 14
examples/js/shaders/VerticalTiltShiftShader.js

@@ -25,8 +25,8 @@ THREE.VerticalTiltShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,21 +42,21 @@ THREE.VerticalTiltShiftShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"float vv = v * abs( r - vUv.y );",
+		"	float vv = v * abs( r - vUv.y );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 13 - 13
examples/js/shaders/VignetteShader.js

@@ -22,8 +22,8 @@ THREE.VignetteShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,19 +42,19 @@ THREE.VignetteShader = {
 
 			// Eskil's vignette
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
-			"vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
-			"gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
+		"	gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
 
-			/*
-			// alternative version from glfx.js
-			// this one makes more "dusty" look (as opposed to "burned")
+		/*
+		// alternative version from glfx.js
+		// this one makes more "dusty" look (as opposed to "burned")
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
-			"float dist = distance( vUv, vec2( 0.5 ) );",
-			"color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
-			"gl_FragColor = color;",
-			*/
+		"	vec4 color = texture2D( tDiffuse, vUv );",
+		"	float dist = distance( vUv, vec2( 0.5 ) );",
+		"	color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
+		"	gl_FragColor = color;",
+		*/
 
 		"}"
 

+ 7 - 7
examples/jsm/shaders/DOFMipMapShader.js

@@ -25,8 +25,8 @@ var DOFMipMapShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,14 +44,14 @@ var DOFMipMapShader = {
 
 		"void main() {",
 
-			"vec4 depth = texture2D( tDepth, vUv );",
+		"	vec4 depth = texture2D( tDepth, vUv );",
 
-			"float factor = depth.x - focus;",
+		"	float factor = depth.x - focus;",
 
-			"vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
+		"	vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
 
-			"gl_FragColor = col;",
-			"gl_FragColor.a = 1.0;",
+		"	gl_FragColor = col;",
+		"	gl_FragColor.a = 1.0;",
 
 		"}"
 

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

@@ -28,8 +28,8 @@ var DotScreenShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -48,22 +48,22 @@ var DotScreenShader = {
 
 		"float pattern() {",
 
-			"float s = sin( angle ), c = cos( angle );",
+		"	float s = sin( angle ), c = cos( angle );",
 
-			"vec2 tex = vUv * tSize - center;",
-			"vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
+		"	vec2 tex = vUv * tSize - center;",
+		"	vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
 
-			"return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
+		"	return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
 
 		"}",
 
 		"void main() {",
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
+		"	vec4 color = texture2D( tDiffuse, vUv );",
 
-			"float average = ( color.r + color.g + color.b ) / 3.0;",
+		"	float average = ( color.r + color.g + color.b ) / 3.0;",
 
-			"gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
+		"	gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
 
 		"}"
 

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

@@ -27,8 +27,8 @@ var FXAAShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 

+ 12 - 12
examples/jsm/shaders/FilmShader.js

@@ -41,8 +41,8 @@ var FilmShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -73,31 +73,31 @@ var FilmShader = {
 		"void main() {",
 
 			// sample the source
-			"vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
+		"	vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
 
 			// make some noise
-			"float dx = rand( vUv + time );",
+		"	float dx = rand( vUv + time );",
 
 			// add noise
-			"vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
+		"	vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
 
 			// get us a sine and cosine
-			"vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
+		"	vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
 
 			// add scanlines
-			"cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
+		"	cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
 
 			// interpolate between source and result by intensity
-			"cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
+		"	cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
 
 			// convert to grayscale if desired
-			"if( grayscale ) {",
+		"	if( grayscale ) {",
 
-				"cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
+		"		cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
 
-			"}",
+		"	}",
 
-			"gl_FragColor =  vec4( cResult, cTextureScreen.a );",
+		"	gl_FragColor =  vec4( cResult, cTextureScreen.a );",
 
 		"}"
 

+ 28 - 28
examples/jsm/shaders/FocusShader.js

@@ -26,8 +26,8 @@ var FocusShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -46,45 +46,45 @@ var FocusShader = {
 
 		"void main() {",
 
-			"vec4 color, org, tmp, add;",
-			"float sample_dist, f;",
-			"vec2 vin;",
-			"vec2 uv = vUv;",
+		"	vec4 color, org, tmp, add;",
+		"	float sample_dist, f;",
+		"	vec2 vin;",
+		"	vec2 uv = vUv;",
 
-			"add = color = org = texture2D( tDiffuse, uv );",
+		"	add = color = org = texture2D( tDiffuse, uv );",
 
-			"vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
-			"sample_dist = dot( vin, vin ) * 2.0;",
+		"	vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
+		"	sample_dist = dot( vin, vin ) * 2.0;",
 
-			"f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
+		"	f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
 
-			"vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
+		"	vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
-			"if( tmp.b < color.b ) color = tmp;",
+		"	add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
+		"	if( tmp.b < color.b ) color = tmp;",
 
-			"color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
-			"color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
+		"	color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
+		"	color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
 
-			"gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
+		"	gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
 
 		"}"
 

+ 34 - 34
examples/jsm/shaders/FreiChenShader.js

@@ -25,8 +25,8 @@ var FreiChenShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -59,38 +59,38 @@ var FreiChenShader = {
 		"void main(void)",
 		"{",
 
-			"G[0] = g0,",
-			"G[1] = g1,",
-			"G[2] = g2,",
-			"G[3] = g3,",
-			"G[4] = g4,",
-			"G[5] = g5,",
-			"G[6] = g6,",
-			"G[7] = g7,",
-			"G[8] = g8;",
-
-			"mat3 I;",
-			"float cnv[9];",
-			"vec3 sample;",
-
-			/* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
-			"for (float i=0.0; i<3.0; i++) {",
-				"for (float j=0.0; j<3.0; j++) {",
-					"sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
-					"I[int(i)][int(j)] = length(sample);",
-				"}",
-			"}",
-
-			/* calculate the convolution values for all the masks */
-			"for (int i=0; i<9; i++) {",
-				"float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
-				"cnv[i] = dp3 * dp3;",
-			"}",
-
-			"float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
-			"float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
-
-			"gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
+		"	G[0] = g0,",
+		"	G[1] = g1,",
+		"	G[2] = g2,",
+		"	G[3] = g3,",
+		"	G[4] = g4,",
+		"	G[5] = g5,",
+		"	G[6] = g6,",
+		"	G[7] = g7,",
+		"	G[8] = g8;",
+
+		"	mat3 I;",
+		"	float cnv[9];",
+		"	vec3 sample;",
+
+		/* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
+		"	for (float i=0.0; i<3.0; i++) {",
+		"		for (float j=0.0; j<3.0; j++) {",
+		"			sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
+		"			I[int(i)][int(j)] = length(sample);",
+		"		}",
+		"	}",
+
+		/* calculate the convolution values for all the masks */
+		"	for (int i=0; i<9; i++) {",
+		"		float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
+		"		cnv[i] = dp3 * dp3;",
+		"	}",
+
+		"	float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
+		"	float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
+
+		"	gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
 		"}"
 
 	].join( "\n" )

+ 16 - 16
examples/jsm/shaders/FresnelShader.js

@@ -31,20 +31,20 @@ var FresnelShader = {
 
 		"void main() {",
 
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
+		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
 
-			"vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );",
+		"	vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );",
 
-			"vec3 I = worldPosition.xyz - cameraPosition;",
+		"	vec3 I = worldPosition.xyz - cameraPosition;",
 
-			"vReflect = reflect( I, worldNormal );",
-			"vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );",
-			"vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );",
-			"vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );",
-			"vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );",
+		"	vReflect = reflect( I, worldNormal );",
+		"	vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );",
+		"	vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );",
+		"	vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );",
+		"	vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );",
 
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
 		"}"
 
@@ -60,14 +60,14 @@ var FresnelShader = {
 
 		"void main() {",
 
-			"vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
-			"vec4 refractedColor = vec4( 1.0 );",
+		"	vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
+		"	vec4 refractedColor = vec4( 1.0 );",
 
-			"refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
-			"refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
-			"refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
+		"	refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
+		"	refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
+		"	refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
 
-			"gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
+		"	gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
 
 		"}"
 

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

@@ -21,8 +21,8 @@ var GammaCorrectionShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -36,9 +36,9 @@ var GammaCorrectionShader = {
 
 		"void main() {",
 
-			"vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
+		"	vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
 
-			"gl_FragColor = LinearToGamma( tex, float( GAMMA_FACTOR ) );",
+		"	gl_FragColor = LinearToGamma( tex, float( GAMMA_FACTOR ) );",
 
 		"}"
 

+ 8 - 8
examples/jsm/shaders/GodRaysShader.js

@@ -146,16 +146,16 @@ var GodRaysGenerateShader = {
 
 		"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {",
 
-			// Accumulate samples, making sure we dont walk past the light source.
+		// Accumulate samples, making sure we dont walk past the light source.
 
-			// The check for uv.y < 1 would not be necessary with "border" UV wrap
-			// mode, with a black border color. I don't think this is currently
-			// exposed by three.js. As a result there might be artifacts when the
-			// sun is to the left, right or bottom of screen as these cases are
-			// not specifically handled.
+		// The check for uv.y < 1 would not be necessary with "border" UV wrap
+		// mode, with a black border color. I don't think this is currently
+		// exposed by three.js. As a result there might be artifacts when the
+		// sun is to the left, right or bottom of screen as these cases are
+		// not specifically handled.
 
-			"col += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );",
-			"uv += stepv;",
+		"	col += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );",
+		"	uv += stepv;",
 
 		"}",
 		*/

+ 158 - 158
examples/jsm/shaders/HalftoneShader.js

@@ -72,242 +72,242 @@ var HalftoneShader = {
 
 		"float blend( float a, float b, float t ) {",
 
-			// linear blend
-			"return a * ( 1.0 - t ) + b * t;",
+		// linear blend
+		"	return a * ( 1.0 - t ) + b * t;",
 
 		"}",
 
 		"float hypot( float x, float y ) {",
 
-			// vector magnitude
-			"return sqrt( x * x + y * y );",
+		// vector magnitude
+		"	return sqrt( x * x + y * y );",
 
 		"}",
 
 		"float rand( vec2 seed ){",
 
-			// get pseudo-random number
+		// get pseudo-random number
 	    "return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );",
 
 		"}",
 
 		"float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {",
 
-			// apply shape-specific transforms
-			"float dist = hypot( coord.x - p.x, coord.y - p.y );",
-			"float rad = channel;",
+		// apply shape-specific transforms
+		"	float dist = hypot( coord.x - p.x, coord.y - p.y );",
+		"	float rad = channel;",
 
-			"if ( shape == SHAPE_DOT ) {",
+		"	if ( shape == SHAPE_DOT ) {",
 
-				"rad = pow( abs( rad ), 1.125 ) * rad_max;",
+		"		rad = pow( abs( rad ), 1.125 ) * rad_max;",
 
-			"} else if ( shape == SHAPE_ELLIPSE ) {",
+		"	} else if ( shape == SHAPE_ELLIPSE ) {",
 
-				"rad = pow( abs( rad ), 1.125 ) * rad_max;",
+		"		rad = pow( abs( rad ), 1.125 ) * rad_max;",
 
-				"if ( dist != 0.0 ) {",
-					"float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );",
-					"dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;",
-				"}",
+		"		if ( dist != 0.0 ) {",
+		"			float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );",
+		"			dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;",
+		"		}",
 
-			"} else if ( shape == SHAPE_LINE ) {",
+		"	} else if ( shape == SHAPE_LINE ) {",
 
-				"rad = pow( abs( rad ), 1.5) * rad_max;",
-				"float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;",
-				"dist = hypot( normal.x * dot_p, normal.y * dot_p );",
+		"		rad = pow( abs( rad ), 1.5) * rad_max;",
+		"		float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;",
+		"		dist = hypot( normal.x * dot_p, normal.y * dot_p );",
 
-			"} else if ( shape == SHAPE_SQUARE ) {",
+		"	} else if ( shape == SHAPE_SQUARE ) {",
 
-				"float theta = atan( p.y - coord.y, p.x - coord.x ) - angle;",
-				"float sin_t = abs( sin( theta ) );",
-				"float cos_t = abs( cos( theta ) );",
-				"rad = pow( abs( rad ), 1.4 );",
-				"rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );",
+		"		float theta = atan( p.y - coord.y, p.x - coord.x ) - angle;",
+		"		float sin_t = abs( sin( theta ) );",
+		"		float cos_t = abs( cos( theta ) );",
+		"		rad = pow( abs( rad ), 1.4 );",
+		"		rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );",
 
-			"}",
+		"	}",
 
-			"return rad - dist;",
+		"	return rad - dist;",
 
 		"}",
 
 		"struct Cell {",
 
-			// grid sample positions
-			"vec2 normal;",
-			"vec2 p1;",
-			"vec2 p2;",
-			"vec2 p3;",
-			"vec2 p4;",
-			"float samp2;",
-			"float samp1;",
-			"float samp3;",
-			"float samp4;",
+		// grid sample positions
+		"	vec2 normal;",
+		"	vec2 p1;",
+		"	vec2 p2;",
+		"	vec2 p3;",
+		"	vec2 p4;",
+		"	float samp2;",
+		"	float samp1;",
+		"	float samp3;",
+		"	float samp4;",
 
 		"};",
 
 		"vec4 getSample( vec2 point ) {",
 
-			// multi-sampled point
-			"vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );",
-			"float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;",
-			"float step = PI2 / float( samples );",
-			"float dist = radius * 0.66;",
+		// multi-sampled point
+		"	vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );",
+		"	float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;",
+		"	float step = PI2 / float( samples );",
+		"	float dist = radius * 0.66;",
 
-			"for ( int i = 0; i < samples; ++i ) {",
+		"	for ( int i = 0; i < samples; ++i ) {",
 
-				"float r = base + step * float( i );",
-				"vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );",
-				"tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );",
+		"		float r = base + step * float( i );",
+		"		vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );",
+		"		tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );",
 
-			"}",
+		"	}",
 
-			"tex /= float( samples ) + 1.0;",
-			"return tex;",
+		"	tex /= float( samples ) + 1.0;",
+		"	return tex;",
 
 		"}",
 
 		"float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {",
 
-			// get colour for given point
-			"float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;",
+		// get colour for given point
+		"	float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;",
 
-			"if ( channel == 0 ) {",
+		"	if ( channel == 0 ) {",
 
-				"c.samp1 = getSample( c.p1 ).r;",
-				"c.samp2 = getSample( c.p2 ).r;",
-				"c.samp3 = getSample( c.p3 ).r;",
-				"c.samp4 = getSample( c.p4 ).r;",
+		"		c.samp1 = getSample( c.p1 ).r;",
+		"		c.samp2 = getSample( c.p2 ).r;",
+		"		c.samp3 = getSample( c.p3 ).r;",
+		"		c.samp4 = getSample( c.p4 ).r;",
 
-			"} else if (channel == 1) {",
+		"	} else if (channel == 1) {",
 
-				"c.samp1 = getSample( c.p1 ).g;",
-				"c.samp2 = getSample( c.p2 ).g;",
-				"c.samp3 = getSample( c.p3 ).g;",
-				"c.samp4 = getSample( c.p4 ).g;",
+		"		c.samp1 = getSample( c.p1 ).g;",
+		"		c.samp2 = getSample( c.p2 ).g;",
+		"		c.samp3 = getSample( c.p3 ).g;",
+		"		c.samp4 = getSample( c.p4 ).g;",
 
-			"} else {",
+		"	} else {",
 
-				"c.samp1 = getSample( c.p1 ).b;",
-				"c.samp3 = getSample( c.p3 ).b;",
-				"c.samp2 = getSample( c.p2 ).b;",
-				"c.samp4 = getSample( c.p4 ).b;",
+		"		c.samp1 = getSample( c.p1 ).b;",
+		"		c.samp3 = getSample( c.p3 ).b;",
+		"		c.samp2 = getSample( c.p2 ).b;",
+		"		c.samp4 = getSample( c.p4 ).b;",
 
-			"}",
+		"	}",
 
-			"dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );",
-			"dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );",
-			"dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );",
-			"dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );",
-			"res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;",
-			"res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;",
-			"res = clamp( res, 0.0, 1.0 );",
+		"	dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );",
+		"	dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );",
+		"	dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );",
+		"	dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );",
+		"	res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;",
+		"	res = clamp( res, 0.0, 1.0 );",
 
-			"return res;",
+		"	return res;",
 
 		"}",
 
 		"Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {",
 
-			// get containing cell
-			"Cell c;",
-
-			// calc grid
-			"vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );",
-			"float threshold = step * 0.5;",
-			"float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );",
-			"float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );",
-			"vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );",
-			"float offset_normal = mod( hypot( offset.x, offset.y ), step );",
-			"float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;",
-			"float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;",
-			"float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );",
-			"float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;",
-			"float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;",
-
-			// get closest corner
-			"c.normal = n;",
-			"c.p1.x = p.x - n.x * normal_scale + n.y * line_scale;",
-			"c.p1.y = p.y - n.y * normal_scale - n.x * line_scale;",
-
-			// scatter
-			"if ( scatter != 0.0 ) {",
-
-				"float off_mag = scatter * threshold * 0.5;",
-				"float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;",
-				"c.p1.x += cos( off_angle ) * off_mag;",
-				"c.p1.y += sin( off_angle ) * off_mag;",
-
-			"}",
-
-			// find corners
-			"float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );",
-			"float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );",
-			"c.p2.x = c.p1.x - n.x * normal_step;",
-			"c.p2.y = c.p1.y - n.y * normal_step;",
-			"c.p3.x = c.p1.x + n.y * line_step;",
-			"c.p3.y = c.p1.y - n.x * line_step;",
-			"c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;",
-			"c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;",
-
-			"return c;",
+		// get containing cell
+		"	Cell c;",
+
+		// calc grid
+		"	vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );",
+		"	float threshold = step * 0.5;",
+		"	float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );",
+		"	float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );",
+		"	vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );",
+		"	float offset_normal = mod( hypot( offset.x, offset.y ), step );",
+		"	float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;",
+		"	float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;",
+		"	float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );",
+		"	float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;",
+		"	float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;",
+
+		// get closest corner
+		"	c.normal = n;",
+		"	c.p1.x = p.x - n.x * normal_scale + n.y * line_scale;",
+		"	c.p1.y = p.y - n.y * normal_scale - n.x * line_scale;",
+
+		// scatter
+		"	if ( scatter != 0.0 ) {",
+
+		"		float off_mag = scatter * threshold * 0.5;",
+		"		float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;",
+		"		c.p1.x += cos( off_angle ) * off_mag;",
+		"		c.p1.y += sin( off_angle ) * off_mag;",
+
+		"	}",
+
+		// find corners
+		"	float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );",
+		"	float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );",
+		"	c.p2.x = c.p1.x - n.x * normal_step;",
+		"	c.p2.y = c.p1.y - n.y * normal_step;",
+		"	c.p3.x = c.p1.x + n.y * line_step;",
+		"	c.p3.y = c.p1.y - n.x * line_step;",
+		"	c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;",
+		"	c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;",
+
+		"	return c;",
 
 		"}",
 
 		"float blendColour( float a, float b, float t ) {",
 
-			// blend colours
-			"if ( blendingMode == BLENDING_LINEAR ) {",
-				"return blend( a, b, 1.0 - t );",
-			"} else if ( blendingMode == BLENDING_ADD ) {",
-				"return blend( a, min( 1.0, a + b ), t );",
-			"} else if ( blendingMode == BLENDING_MULTIPLY ) {",
-				"return blend( a, max( 0.0, a * b ), t );",
-			"} else if ( blendingMode == BLENDING_LIGHTER ) {",
-				"return blend( a, max( a, b ), t );",
-			"} else if ( blendingMode == BLENDING_DARKER ) {",
-				"return blend( a, min( a, b ), t );",
-			"} else {",
-				"return blend( a, b, 1.0 - t );",
-			"}",
+		// blend colours
+		"	if ( blendingMode == BLENDING_LINEAR ) {",
+		"		return blend( a, b, 1.0 - t );",
+		"	} else if ( blendingMode == BLENDING_ADD ) {",
+		"		return blend( a, min( 1.0, a + b ), t );",
+		"	} else if ( blendingMode == BLENDING_MULTIPLY ) {",
+		"		return blend( a, max( 0.0, a * b ), t );",
+		"	} else if ( blendingMode == BLENDING_LIGHTER ) {",
+		"		return blend( a, max( a, b ), t );",
+		"	} else if ( blendingMode == BLENDING_DARKER ) {",
+		"		return blend( a, min( a, b ), t );",
+		"	} else {",
+		"		return blend( a, b, 1.0 - t );",
+		"	}",
 
 		"}",
 
 		"void main() {",
 
-			"if ( ! disable ) {",
+		"	if ( ! disable ) {",
 
-				// setup
-				"vec2 p = vec2( vUV.x * width, vUV.y * height );",
-				"vec2 origin = vec2( 0, 0 );",
-				"float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;",
+		// setup
+		"		vec2 p = vec2( vUV.x * width, vUV.y * height );",
+		"		vec2 origin = vec2( 0, 0 );",
+		"		float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;",
 
-				// get channel samples
-				"Cell cell_r = getReferenceCell( p, origin, rotateR, radius );",
-				"Cell cell_g = getReferenceCell( p, origin, rotateG, radius );",
-				"Cell cell_b = getReferenceCell( p, origin, rotateB, radius );",
-				"float r = getDotColour( cell_r, p, 0, rotateR, aa );",
-				"float g = getDotColour( cell_g, p, 1, rotateG, aa );",
-				"float b = getDotColour( cell_b, p, 2, rotateB, aa );",
+		// get channel samples
+		"		Cell cell_r = getReferenceCell( p, origin, rotateR, radius );",
+		"		Cell cell_g = getReferenceCell( p, origin, rotateG, radius );",
+		"		Cell cell_b = getReferenceCell( p, origin, rotateB, radius );",
+		"		float r = getDotColour( cell_r, p, 0, rotateR, aa );",
+		"		float g = getDotColour( cell_g, p, 1, rotateG, aa );",
+		"		float b = getDotColour( cell_b, p, 2, rotateB, aa );",
 
-				// blend with original
-				"vec4 colour = texture2D( tDiffuse, vUV );",
-				"r = blendColour( r, colour.r, blending );",
-				"g = blendColour( g, colour.g, blending );",
-				"b = blendColour( b, colour.b, blending );",
+		// blend with original
+		"		vec4 colour = texture2D( tDiffuse, vUV );",
+		"		r = blendColour( r, colour.r, blending );",
+		"		g = blendColour( g, colour.g, blending );",
+		"		b = blendColour( b, colour.b, blending );",
 
-				"if ( greyscale ) {",
-					"r = g = b = (r + b + g) / 3.0;",
-				"}",
+		"		if ( greyscale ) {",
+		"			r = g = b = (r + b + g) / 3.0;",
+		"		}",
 
-				"gl_FragColor = vec4( r, g, b, 1.0 );",
+		"		gl_FragColor = vec4( r, g, b, 1.0 );",
 
-			"} else {",
+		"	} else {",
 
-				"gl_FragColor = texture2D( tDiffuse, vUV );",
+		"		gl_FragColor = texture2D( tDiffuse, vUV );",
 
-			"}",
+		"	}",
 
 		"}"
 

+ 13 - 13
examples/jsm/shaders/HorizontalBlurShader.js

@@ -27,8 +27,8 @@ var HorizontalBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,19 +43,19 @@ var HorizontalBlurShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

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

@@ -27,8 +27,8 @@ var HorizontalTiltShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,21 +44,21 @@ var HorizontalTiltShiftShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"float hh = h * abs( r - vUv.y );",
+		"	float hh = h * abs( r - vUv.y );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 18 - 18
examples/jsm/shaders/HueSaturationShader.js

@@ -25,9 +25,9 @@ var HueSaturationShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,26 +43,26 @@ var HueSaturationShader = {
 
 		"void main() {",
 
-			"gl_FragColor = texture2D( tDiffuse, vUv );",
+		"	gl_FragColor = texture2D( tDiffuse, vUv );",
 
 			// hue
-			"float angle = hue * 3.14159265;",
-			"float s = sin(angle), c = cos(angle);",
-			"vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
-			"float len = length(gl_FragColor.rgb);",
-			"gl_FragColor.rgb = vec3(",
-				"dot(gl_FragColor.rgb, weights.xyz),",
-				"dot(gl_FragColor.rgb, weights.zxy),",
-				"dot(gl_FragColor.rgb, weights.yzx)",
-			");",
+		"	float angle = hue * 3.14159265;",
+		"	float s = sin(angle), c = cos(angle);",
+		"	vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
+		"	float len = length(gl_FragColor.rgb);",
+		"	gl_FragColor.rgb = vec3(",
+		"		dot(gl_FragColor.rgb, weights.xyz),",
+		"		dot(gl_FragColor.rgb, weights.zxy),",
+		"		dot(gl_FragColor.rgb, weights.yzx)",
+		"	);",
 
 			// saturation
-			"float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
-			"if (saturation > 0.0) {",
-				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
-			"} else {",
-				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
-			"}",
+		"	float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
+		"	if (saturation > 0.0) {",
+		"		gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
+		"	} else {",
+		"		gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
+		"	}",
 
 		"}"
 

+ 11 - 11
examples/jsm/shaders/KaleidoShader.js

@@ -28,8 +28,8 @@ var KaleidoShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -45,15 +45,15 @@ var KaleidoShader = {
 
 		"void main() {",
 
-			"vec2 p = vUv - 0.5;",
-			"float r = length(p);",
-			"float a = atan(p.y, p.x) + angle;",
-			"float tau = 2. * 3.1416 ;",
-			"a = mod(a, tau/sides);",
-			"a = abs(a - tau/sides/2.) ;",
-			"p = r * vec2(cos(a), sin(a));",
-			"vec4 color = texture2D(tDiffuse, p + 0.5);",
-			"gl_FragColor = color;",
+		"	vec2 p = vUv - 0.5;",
+		"	float r = length(p);",
+		"	float a = atan(p.y, p.x) + angle;",
+		"	float tau = 2. * 3.1416 ;",
+		"	a = mod(a, tau/sides);",
+		"	a = abs(a - tau/sides/2.) ;",
+		"	p = r * vec2(cos(a), sin(a));",
+		"	vec4 color = texture2D(tDiffuse, p + 0.5);",
+		"	gl_FragColor = color;",
 
 		"}"
 

+ 8 - 8
examples/jsm/shaders/LuminosityHighPassShader.js

@@ -29,9 +29,9 @@ var LuminosityHighPassShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -49,17 +49,17 @@ var LuminosityHighPassShader = {
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+		"	vec3 luma = vec3( 0.299, 0.587, 0.114 );",
 
-			"float v = dot( texel.xyz, luma );",
+		"	float v = dot( texel.xyz, luma );",
 
-			"vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );",
+		"	vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );",
 
-			"float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );",
+		"	float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );",
 
-			"gl_FragColor = mix( outputColor, texel, alpha );",
+		"	gl_FragColor = mix( outputColor, texel, alpha );",
 
 		"}"
 

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

@@ -21,9 +21,9 @@ var LuminosityShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -39,11 +39,11 @@ var LuminosityShader = {
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"float l = linearToRelativeLuminance( texel.rgb );",
+		"	float l = linearToRelativeLuminance( texel.rgb );",
 
-			"gl_FragColor = vec4( l, l, l, texel.w );",
+		"	gl_FragColor = vec4( l, l, l, texel.w );",
 
 		"}"
 

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

@@ -24,8 +24,8 @@ var MirrorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -40,18 +40,18 @@ var MirrorShader = {
 
 		"void main() {",
 
-			"vec2 p = vUv;",
-			"if (side == 0){",
-				"if (p.x > 0.5) p.x = 1.0 - p.x;",
-			"}else if (side == 1){",
-				"if (p.x < 0.5) p.x = 1.0 - p.x;",
-			"}else if (side == 2){",
-				"if (p.y < 0.5) p.y = 1.0 - p.y;",
-			"}else if (side == 3){",
-				"if (p.y > 0.5) p.y = 1.0 - p.y;",
-			"} ",
-			"vec4 color = texture2D(tDiffuse, p);",
-			"gl_FragColor = color;",
+		"	vec2 p = vUv;",
+		"	if (side == 0){",
+		"		if (p.x > 0.5) p.x = 1.0 - p.x;",
+		"	}else if (side == 1){",
+		"		if (p.x < 0.5) p.x = 1.0 - p.x;",
+		"	}else if (side == 2){",
+		"		if (p.y < 0.5) p.y = 1.0 - p.y;",
+		"	}else if (side == 3){",
+		"		if (p.y > 0.5) p.y = 1.0 - p.y;",
+		"	} ",
+		"	vec4 color = texture2D(tDiffuse, p);",
+		"	gl_FragColor = color;",
 
 		"}"
 

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

@@ -26,8 +26,8 @@ var NormalMapShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,12 +43,12 @@ var NormalMapShader = {
 
 		"void main() {",
 
-			"float val = texture2D( heightMap, vUv ).x;",
+		"	float val = texture2D( heightMap, vUv ).x;",
 
-			"float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
-			"float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
+		"	float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
+		"	float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
 
-			"gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
+		"	gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
 
 		"}"
 

+ 70 - 70
examples/jsm/shaders/ParallaxShader.js

@@ -28,11 +28,11 @@ var ParallaxShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vViewPosition = -mvPosition.xyz;",
-			"vNormal = normalize( normalMatrix * normal );",
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	vUv = uv;",
+		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"	vViewPosition = -mvPosition.xyz;",
+		"	vNormal = normalize( normalMatrix * normal );",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
 		"}"
 
@@ -52,130 +52,130 @@ var ParallaxShader = {
 
 		"#ifdef USE_BASIC_PARALLAX",
 
-			"vec2 parallaxMap( in vec3 V ) {",
+		"	vec2 parallaxMap( in vec3 V ) {",
 
-				"float initialHeight = texture2D( bumpMap, vUv ).r;",
+		"		float initialHeight = texture2D( bumpMap, vUv ).r;",
 
 				// No Offset Limitting: messy, floating output at grazing angles.
 				//"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;",
 
 				// Offset Limiting
-				"vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;",
-				"return vUv - texCoordOffset;",
+		"		vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;",
+		"		return vUv - texCoordOffset;",
 
-			"}",
+		"	}",
 
 		"#else",
 
-			"vec2 parallaxMap( in vec3 V ) {",
+		"	vec2 parallaxMap( in vec3 V ) {",
 
 				// Determine number of layers from angle between V and N
-				"float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );",
+		"		float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );",
 
-				"float layerHeight = 1.0 / numLayers;",
-				"float currentLayerHeight = 0.0;",
+		"		float layerHeight = 1.0 / numLayers;",
+		"		float currentLayerHeight = 0.0;",
 				// Shift of texture coordinates for each iteration
-				"vec2 dtex = parallaxScale * V.xy / V.z / numLayers;",
+		"		vec2 dtex = parallaxScale * V.xy / V.z / numLayers;",
 
-				"vec2 currentTextureCoords = vUv;",
+		"		vec2 currentTextureCoords = vUv;",
 
-				"float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"		float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 
 				// while ( heightFromTexture > currentLayerHeight )
 				// Infinite loops are not well supported. Do a "large" finite
 				// loop, but not too large, as it slows down some compilers.
-				"for ( int i = 0; i < 30; i += 1 ) {",
-					"if ( heightFromTexture <= currentLayerHeight ) {",
-						"break;",
-					"}",
-					"currentLayerHeight += layerHeight;",
+		"		for ( int i = 0; i < 30; i += 1 ) {",
+		"			if ( heightFromTexture <= currentLayerHeight ) {",
+		"				break;",
+		"			}",
+		"			currentLayerHeight += layerHeight;",
 					// Shift texture coordinates along vector V
-					"currentTextureCoords -= dtex;",
-					"heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
-				"}",
+		"			currentTextureCoords -= dtex;",
+		"			heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"		}",
 
-				"#ifdef USE_STEEP_PARALLAX",
+		"		#ifdef USE_STEEP_PARALLAX",
 
-					"return currentTextureCoords;",
+		"			return currentTextureCoords;",
 
-				"#elif defined( USE_RELIEF_PARALLAX )",
+		"		#elif defined( USE_RELIEF_PARALLAX )",
 
-					"vec2 deltaTexCoord = dtex / 2.0;",
-					"float deltaHeight = layerHeight / 2.0;",
+		"			vec2 deltaTexCoord = dtex / 2.0;",
+		"			float deltaHeight = layerHeight / 2.0;",
 
 					// Return to the mid point of previous layer
-					"currentTextureCoords += deltaTexCoord;",
-					"currentLayerHeight -= deltaHeight;",
+		"			currentTextureCoords += deltaTexCoord;",
+		"			currentLayerHeight -= deltaHeight;",
 
 					// Binary search to increase precision of Steep Parallax Mapping
-					"const int numSearches = 5;",
-					"for ( int i = 0; i < numSearches; i += 1 ) {",
+		"			const int numSearches = 5;",
+		"			for ( int i = 0; i < numSearches; i += 1 ) {",
 
-						"deltaTexCoord /= 2.0;",
-						"deltaHeight /= 2.0;",
-						"heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
+		"				deltaTexCoord /= 2.0;",
+		"				deltaHeight /= 2.0;",
+		"				heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 						// Shift along or against vector V
-						"if( heightFromTexture > currentLayerHeight ) {", // Below the surface
+		"				if( heightFromTexture > currentLayerHeight ) {", // Below the surface
 
-							"currentTextureCoords -= deltaTexCoord;",
-							"currentLayerHeight += deltaHeight;",
+		"					currentTextureCoords -= deltaTexCoord;",
+		"					currentLayerHeight += deltaHeight;",
 
-						"} else {", // above the surface
+		"				} else {", // above the surface
 
-							"currentTextureCoords += deltaTexCoord;",
-							"currentLayerHeight -= deltaHeight;",
+		"					currentTextureCoords += deltaTexCoord;",
+		"					currentLayerHeight -= deltaHeight;",
 
-						"}",
+		"				}",
 
-					"}",
-					"return currentTextureCoords;",
+		"			}",
+		"			return currentTextureCoords;",
 
-				"#elif defined( USE_OCLUSION_PARALLAX )",
+		"		#elif defined( USE_OCLUSION_PARALLAX )",
 
-					"vec2 prevTCoords = currentTextureCoords + dtex;",
+		"			vec2 prevTCoords = currentTextureCoords + dtex;",
 
 					// Heights for linear interpolation
-					"float nextH = heightFromTexture - currentLayerHeight;",
-					"float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;",
+		"			float nextH = heightFromTexture - currentLayerHeight;",
+		"			float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;",
 
 					// Proportions for linear interpolation
-					"float weight = nextH / ( nextH - prevH );",
+		"			float weight = nextH / ( nextH - prevH );",
 
 					// Interpolation of texture coordinates
-					"return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );",
+		"			return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );",
 
-				"#else", // NO_PARALLAX
+		"		#else", // NO_PARALLAX
 
-					"return vUv;",
+		"			return vUv;",
 
-				"#endif",
+		"		#endif",
 
-			"}",
+		"	}",
 		"#endif",
 
 		"vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {",
 
- 			"vec2 texDx = dFdx( vUv );",
-			"vec2 texDy = dFdy( vUv );",
+ 		"	vec2 texDx = dFdx( vUv );",
+		"	vec2 texDy = dFdy( vUv );",
 
-			"vec3 vSigmaX = dFdx( surfPosition );",
-			"vec3 vSigmaY = dFdy( surfPosition );",
-			"vec3 vR1 = cross( vSigmaY, surfNormal );",
-			"vec3 vR2 = cross( surfNormal, vSigmaX );",
-			"float fDet = dot( vSigmaX, vR1 );",
+		"	vec3 vSigmaX = dFdx( surfPosition );",
+		"	vec3 vSigmaY = dFdy( surfPosition );",
+		"	vec3 vR1 = cross( vSigmaY, surfNormal );",
+		"	vec3 vR2 = cross( surfNormal, vSigmaX );",
+		"	float fDet = dot( vSigmaX, vR1 );",
 
-			"vec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );",
-			"vec3 vProjVtex;",
-			"vProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;",
-			"vProjVtex.z = dot( surfNormal, viewPosition );",
+		"	vec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );",
+		"	vec3 vProjVtex;",
+		"	vProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;",
+		"	vProjVtex.z = dot( surfNormal, viewPosition );",
 
-			"return parallaxMap( vProjVtex );",
+		"	return parallaxMap( vProjVtex );",
 		"}",
 
 		"void main() {",
 
-			"vec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );",
-			"gl_FragColor = texture2D( map, mapUv );",
+		"	vec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );",
+		"	gl_FragColor = texture2D( map, mapUv );",
 
 		"}"
 

+ 7 - 7
examples/jsm/shaders/RGBShiftShader.js

@@ -28,8 +28,8 @@ var RGBShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -45,11 +45,11 @@ var RGBShiftShader = {
 
 		"void main() {",
 
-			"vec2 offset = amount * vec2( cos(angle), sin(angle));",
-			"vec4 cr = texture2D(tDiffuse, vUv + offset);",
-			"vec4 cga = texture2D(tDiffuse, vUv);",
-			"vec4 cb = texture2D(tDiffuse, vUv - offset);",
-			"gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
+		"	vec2 offset = amount * vec2( cos(angle), sin(angle));",
+		"	vec4 cr = texture2D(tDiffuse, vUv + offset);",
+		"	vec4 cga = texture2D(tDiffuse, vUv);",
+		"	vec4 cb = texture2D(tDiffuse, vUv - offset);",
+		"	gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
 
 		"}"
 

+ 8 - 8
examples/jsm/shaders/SepiaShader.js

@@ -23,8 +23,8 @@ var SepiaShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -40,14 +40,14 @@ var SepiaShader = {
 
 		"void main() {",
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
-			"vec3 c = color.rgb;",
+		"	vec4 color = texture2D( tDiffuse, vUv );",
+		"	vec3 c = color.rgb;",
 
-			"color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
-			"color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
-			"color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
+		"	color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
+		"	color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
+		"	color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
 
-			"gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
+		"	gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
 
 		"}"
 

+ 22 - 22
examples/jsm/shaders/SobelOperatorShader.js

@@ -26,9 +26,9 @@ var SobelOperatorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -42,50 +42,50 @@ var SobelOperatorShader = {
 
 		"void main() {",
 
-			"vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );",
+		"	vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );",
 
 			// kernel definition (in glsl matrices are filled in column-major order)
 
-			"const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel
-			"const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel
+		"	const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel
+		"	const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel
 
 			// fetch the 3x3 neighbourhood of a fragment
 
 			// first column
 
-			"float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;",
-			"float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1,  0 ) ).r;",
-			"float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1,  1 ) ).r;",
+		"	float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;",
+		"	float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1,  0 ) ).r;",
+		"	float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1,  1 ) ).r;",
 
 			// second column
 
-			"float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2(  0, -1 ) ).r;",
-			"float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2(  0,  0 ) ).r;",
-			"float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2(  0,  1 ) ).r;",
+		"	float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2(  0, -1 ) ).r;",
+		"	float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2(  0,  0 ) ).r;",
+		"	float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2(  0,  1 ) ).r;",
 
 			// third column
 
-			"float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2(  1, -1 ) ).r;",
-			"float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2(  1,  0 ) ).r;",
-			"float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2(  1,  1 ) ).r;",
+		"	float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2(  1, -1 ) ).r;",
+		"	float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2(  1,  0 ) ).r;",
+		"	float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2(  1,  1 ) ).r;",
 
 			// gradient value in x direction
 
-			"float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ",
-				"Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ",
-				"Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ",
+		"	float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ",
+		"		Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ",
+		"		Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ",
 
 			// gradient value in y direction
 
-			"float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ",
-				"Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ",
-				"Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ",
+		"	float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ",
+		"		Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ",
+		"		Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ",
 
 			// magnitute of the total gradient
 
-			"float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );",
+		"	float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );",
 
-			"gl_FragColor = vec4( vec3( G ), 1 );",
+		"	gl_FragColor = vec4( vec3( G ), 1 );",
 
 		"}"
 

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

@@ -23,8 +23,8 @@ var TechnicolorShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -37,10 +37,10 @@ var TechnicolorShader = {
 
 		"void main() {",
 
-			"vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
-			"vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
+		"	vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
+		"	vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
 
-			"gl_FragColor = newTex;",
+		"	gl_FragColor = newTex;",
 
 		"}"
 

+ 102 - 102
examples/jsm/shaders/TerrainShader.js

@@ -98,151 +98,151 @@ var TerrainShader = {
 		ShaderChunk[ "fog_pars_fragment" ],
 
 		"float calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {",
-				"if ( decayExponent > 0.0 ) {",
-					"return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );",
-				"}",
-				"return 1.0;",
-			"}",
+		"		if ( decayExponent > 0.0 ) {",
+		"			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );",
+		"		}",
+		"		return 1.0;",
+		"	}",
 
 		"void main() {",
 
-			"vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-			"vec4 diffuseColor = vec4( diffuse, opacity );",
+		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
+		"	vec4 diffuseColor = vec4( diffuse, opacity );",
 
-			"vec3 specularTex = vec3( 1.0 );",
+		"	vec3 specularTex = vec3( 1.0 );",
 
-			"vec2 uvOverlay = uRepeatOverlay * vUv + uOffset;",
-			"vec2 uvBase = uRepeatBase * vUv;",
+		"	vec2 uvOverlay = uRepeatOverlay * vUv + uOffset;",
+		"	vec2 uvBase = uRepeatBase * vUv;",
 
-			"vec3 normalTex = texture2D( tDetail, uvOverlay ).xyz * 2.0 - 1.0;",
-			"normalTex.xy *= uNormalScale;",
-			"normalTex = normalize( normalTex );",
+		"	vec3 normalTex = texture2D( tDetail, uvOverlay ).xyz * 2.0 - 1.0;",
+		"	normalTex.xy *= uNormalScale;",
+		"	normalTex = normalize( normalTex );",
 
-			"if( enableDiffuse1 && enableDiffuse2 ) {",
+		"	if( enableDiffuse1 && enableDiffuse2 ) {",
 
-				"vec4 colDiffuse1 = texture2D( tDiffuse1, uvOverlay );",
-				"vec4 colDiffuse2 = texture2D( tDiffuse2, uvOverlay );",
+		"		vec4 colDiffuse1 = texture2D( tDiffuse1, uvOverlay );",
+		"		vec4 colDiffuse2 = texture2D( tDiffuse2, uvOverlay );",
 
-				"colDiffuse1 = GammaToLinear( colDiffuse1, float( GAMMA_FACTOR ) );",
-				"colDiffuse2 = GammaToLinear( colDiffuse2, float( GAMMA_FACTOR ) );",
+		"		colDiffuse1 = GammaToLinear( colDiffuse1, float( GAMMA_FACTOR ) );",
+		"		colDiffuse2 = GammaToLinear( colDiffuse2, float( GAMMA_FACTOR ) );",
 
-				"diffuseColor *= mix ( colDiffuse1, colDiffuse2, 1.0 - texture2D( tDisplacement, uvBase ) );",
+		"		diffuseColor *= mix ( colDiffuse1, colDiffuse2, 1.0 - texture2D( tDisplacement, uvBase ) );",
 
-			" } else if( enableDiffuse1 ) {",
+		"	 } else if( enableDiffuse1 ) {",
 
-				"diffuseColor *= texture2D( tDiffuse1, uvOverlay );",
+		"		diffuseColor *= texture2D( tDiffuse1, uvOverlay );",
 
-			"} else if( enableDiffuse2 ) {",
+		"	} else if( enableDiffuse2 ) {",
 
-				"diffuseColor *= texture2D( tDiffuse2, uvOverlay );",
+		"		diffuseColor *= texture2D( tDiffuse2, uvOverlay );",
 
-			"}",
+		"	}",
 
-			"if( enableSpecular )",
-				"specularTex = texture2D( tSpecular, uvOverlay ).xyz;",
+		"	if( enableSpecular )",
+		"		specularTex = texture2D( tSpecular, uvOverlay ).xyz;",
 
-			"mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
-			"vec3 finalNormal = tsb * normalTex;",
+		"	mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
+		"	vec3 finalNormal = tsb * normalTex;",
 
-			"vec3 normal = normalize( finalNormal );",
-			"vec3 viewPosition = normalize( vViewPosition );",
+		"	vec3 normal = normalize( finalNormal );",
+		"	vec3 viewPosition = normalize( vViewPosition );",
 
-			"vec3 totalDiffuseLight = vec3( 0.0 );",
-			"vec3 totalSpecularLight = vec3( 0.0 );",
+		"	vec3 totalDiffuseLight = vec3( 0.0 );",
+		"	vec3 totalSpecularLight = vec3( 0.0 );",
 
 			// point lights
 
-			"#if NUM_POINT_LIGHTS > 0",
+		"	#if NUM_POINT_LIGHTS > 0",
 
-				"for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
+		"		for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
 
-					"vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
+		"			vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
 
-					"float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
+		"			float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
 
-					"lVector = normalize( lVector );",
+		"			lVector = normalize( lVector );",
 
-					"vec3 pointHalfVector = normalize( lVector + viewPosition );",
+		"			vec3 pointHalfVector = normalize( lVector + viewPosition );",
 
-					"float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
-					"float pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );",
+		"			float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
+		"			float pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );",
 
-					"float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
+		"			float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
 
-					"totalDiffuseLight += attenuation * pointLights[ i ].color * pointDiffuseWeight;",
-					"totalSpecularLight += attenuation * pointLights[ i ].color * specular * pointSpecularWeight * pointDiffuseWeight;",
+		"			totalDiffuseLight += attenuation * pointLights[ i ].color * pointDiffuseWeight;",
+		"			totalSpecularLight += attenuation * pointLights[ i ].color * specular * pointSpecularWeight * pointDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
 			// directional lights
 
-			"#if NUM_DIR_LIGHTS > 0",
+		"	#if NUM_DIR_LIGHTS > 0",
 
-				"vec3 dirDiffuse = vec3( 0.0 );",
-				"vec3 dirSpecular = vec3( 0.0 );",
+		"		vec3 dirDiffuse = vec3( 0.0 );",
+		"		vec3 dirSpecular = vec3( 0.0 );",
 
-				"for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
+		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
 
-					"vec3 dirVector = directionalLights[ i ].direction;",
-					"vec3 dirHalfVector = normalize( dirVector + viewPosition );",
+		"			vec3 dirVector = directionalLights[ i ].direction;",
+		"			vec3 dirHalfVector = normalize( dirVector + viewPosition );",
 
-					"float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
-					"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
+		"			float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
+		"			float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
 
-					"float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
+		"			float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
 
-					"totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-					"totalSpecularLight += directionalLights[ i ].color * specular * dirSpecularWeight * dirDiffuseWeight;",
+		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
+		"			totalSpecularLight += directionalLights[ i ].color * specular * dirSpecularWeight * dirDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
 			// hemisphere lights
 
-			"#if NUM_HEMI_LIGHTS > 0",
+		"	#if NUM_HEMI_LIGHTS > 0",
 
-				"vec3 hemiDiffuse  = vec3( 0.0 );",
-				"vec3 hemiSpecular = vec3( 0.0 );",
+		"		vec3 hemiDiffuse  = vec3( 0.0 );",
+		"		vec3 hemiSpecular = vec3( 0.0 );",
 
-				"for( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
+		"		for( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
 
-					"vec3 lVector = hemisphereLightDirection[ i ];",
+		"			vec3 lVector = hemisphereLightDirection[ i ];",
 
 					// diffuse
 
-					"float dotProduct = dot( normal, lVector );",
-					"float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
+		"			float dotProduct = dot( normal, lVector );",
+		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
 
-					"totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );",
+		"			totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );",
 
 					// specular (sky light)
 
-					"float hemiSpecularWeight = 0.0;",
+		"			float hemiSpecularWeight = 0.0;",
 
-					"vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
-					"float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
-					"hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
+		"			vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
+		"			float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
+		"			hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
 
 					// specular (ground light)
 
-					"vec3 lVectorGround = -lVector;",
+		"			vec3 lVectorGround = -lVector;",
 
-					"vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );",
-					"float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;",
-					"hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );",
+		"			vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );",
+		"			float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;",
+		"			hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );",
 
-					"totalSpecularLight += specular * mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight ) * hemiSpecularWeight * hemiDiffuseWeight;",
+		"			totalSpecularLight += specular * mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight ) * hemiSpecularWeight * hemiDiffuseWeight;",
 
-				"}",
+		"		}",
 
-			"#endif",
+		"	#endif",
 
-			"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
+		"	outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
 
-			"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
+		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
 			ShaderChunk[ "fog_fragment" ],
 
@@ -260,9 +260,9 @@ var TerrainShader = {
 
 		"#ifdef VERTEX_TEXTURES",
 
-			"uniform sampler2D tDisplacement;",
-			"uniform float uDisplacementScale;",
-			"uniform float uDisplacementBias;",
+		"	uniform sampler2D tDisplacement;",
+		"	uniform float uDisplacementScale;",
+		"	uniform float uDisplacementBias;",
 
 		"#endif",
 
@@ -278,45 +278,45 @@ var TerrainShader = {
 
 		"void main() {",
 
-			"vNormal = normalize( normalMatrix * normal );",
+		"	vNormal = normalize( normalMatrix * normal );",
 
 			// tangent and binormal vectors
 
-			"vTangent = normalize( normalMatrix * tangent.xyz );",
+		"	vTangent = normalize( normalMatrix * tangent.xyz );",
 
-			"vBinormal = cross( vNormal, vTangent ) * tangent.w;",
-			"vBinormal = normalize( vBinormal );",
+		"	vBinormal = cross( vNormal, vTangent ) * tangent.w;",
+		"	vBinormal = normalize( vBinormal );",
 
 			// texture coordinates
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"vec2 uvBase = uv * uRepeatBase;",
+		"	vec2 uvBase = uv * uRepeatBase;",
 
 			// displacement mapping
 
-			"#ifdef VERTEX_TEXTURES",
+		"	#ifdef VERTEX_TEXTURES",
 
-				"vec3 dv = texture2D( tDisplacement, uvBase ).xyz;",
-				"float df = uDisplacementScale * dv.x + uDisplacementBias;",
-				"vec3 displacedPosition = normal * df + position;",
+		"		vec3 dv = texture2D( tDisplacement, uvBase ).xyz;",
+		"		float df = uDisplacementScale * dv.x + uDisplacementBias;",
+		"		vec3 displacedPosition = normal * df + position;",
 
-				"vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
-				"vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
+		"		vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
+		"		vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
 
-			"#else",
+		"	#else",
 
-				"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-				"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+		"		vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
+		"		vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
 
-			"#endif",
+		"	#endif",
 
-			"gl_Position = projectionMatrix * mvPosition;",
+		"	gl_Position = projectionMatrix * mvPosition;",
 
-			"vViewPosition = -mvPosition.xyz;",
+		"	vViewPosition = -mvPosition.xyz;",
 
-			"vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;",
-			"vNormal = normalMatrix * normalTex;",
+		"	vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;",
+		"	vNormal = normalMatrix * normalTex;",
 
 			ShaderChunk[ "shadowmap_vertex" ],
 			ShaderChunk[ "fog_vertex" ],

+ 15 - 15
examples/jsm/shaders/ToneMapShader.js

@@ -24,8 +24,8 @@ var ToneMapShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,34 +43,34 @@ var ToneMapShader = {
 		"uniform float minLuminance;",
 		"uniform float maxLuminance;",
 		"#ifdef ADAPTED_LUMINANCE",
-			"uniform sampler2D luminanceMap;",
+		"	uniform sampler2D luminanceMap;",
 		"#else",
-			"uniform float averageLuminance;",
+		"	uniform float averageLuminance;",
 		"#endif",
 
 		"vec3 ToneMap( vec3 vColor ) {",
-			"#ifdef ADAPTED_LUMINANCE",
+		"	#ifdef ADAPTED_LUMINANCE",
 				// Get the calculated average luminance
-				"float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;",
-			"#else",
-				"float fLumAvg = averageLuminance;",
-			"#endif",
+		"		float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;",
+		"	#else",
+		"		float fLumAvg = averageLuminance;",
+		"	#endif",
 
 			// Calculate the luminance of the current pixel
-			"float fLumPixel = linearToRelativeLuminance( vColor );",
+		"	float fLumPixel = linearToRelativeLuminance( vColor );",
 
 			// Apply the modified operator (Eq. 4)
-			"float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );",
+		"	float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );",
 
-			"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);",
-			"return fLumCompressed * vColor;",
+		"	float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);",
+		"	return fLumCompressed * vColor;",
 		"}",
 
 		"void main() {",
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
 
-			"gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );",
+		"	gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );",
 
 		"}"
 

+ 12 - 12
examples/jsm/shaders/TriangleBlurShader.js

@@ -29,8 +29,8 @@ var TriangleBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -49,25 +49,25 @@ var TriangleBlurShader = {
 
 		"void main() {",
 
-			"vec4 color = vec4( 0.0 );",
+		"	vec4 color = vec4( 0.0 );",
 
-			"float total = 0.0;",
+		"	float total = 0.0;",
 
 			// randomize the lookup values to hide the fixed number of samples
 
-			"float offset = rand( vUv );",
+		"	float offset = rand( vUv );",
 
-			"for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
+		"	for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
 
-				"float percent = ( t + offset - 0.5 ) / ITERATIONS;",
-				"float weight = 1.0 - abs( percent );",
+		"		float percent = ( t + offset - 0.5 ) / ITERATIONS;",
+		"		float weight = 1.0 - abs( percent );",
 
-				"color += texture2D( texture, vUv + delta * percent ) * weight;",
-				"total += weight;",
+		"		color += texture2D( texture, vUv + delta * percent ) * weight;",
+		"		total += weight;",
 
-			"}",
+		"	}",
 
-			"gl_FragColor = color / total;",
+		"	gl_FragColor = color / total;",
 
 		"}"
 

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

@@ -22,8 +22,8 @@ var UnpackDepthRGBAShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -41,8 +41,8 @@ var UnpackDepthRGBAShader = {
 
 		"void main() {",
 
-			"float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );",
-			"gl_FragColor = vec4( vec3( depth ), opacity );",
+		"	float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );",
+		"	gl_FragColor = vec4( vec3( depth ), opacity );",
 
 		"}"
 

+ 13 - 13
examples/jsm/shaders/VerticalBlurShader.js

@@ -27,8 +27,8 @@ var VerticalBlurShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -43,19 +43,19 @@ var VerticalBlurShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

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

@@ -27,8 +27,8 @@ var VerticalTiltShiftShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,21 +44,21 @@ var VerticalTiltShiftShader = {
 
 		"void main() {",
 
-			"vec4 sum = vec4( 0.0 );",
+		"	vec4 sum = vec4( 0.0 );",
 
-			"float vv = v * abs( r - vUv.y );",
+		"	float vv = v * abs( r - vUv.y );",
 
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
-			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
+		"	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
 
-			"gl_FragColor = sum;",
+		"	gl_FragColor = sum;",
 
 		"}"
 

+ 13 - 13
examples/jsm/shaders/VignetteShader.js

@@ -24,8 +24,8 @@ var VignetteShader = {
 
 		"void main() {",
 
-			"vUv = uv;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	vUv = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -44,19 +44,19 @@ var VignetteShader = {
 
 			// Eskil's vignette
 
-			"vec4 texel = texture2D( tDiffuse, vUv );",
-			"vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
-			"gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
+		"	vec4 texel = texture2D( tDiffuse, vUv );",
+		"	vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
+		"	gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
 
-			/*
-			// alternative version from glfx.js
-			// this one makes more "dusty" look (as opposed to "burned")
+		/*
+		// alternative version from glfx.js
+		// this one makes more "dusty" look (as opposed to "burned")
 
-			"vec4 color = texture2D( tDiffuse, vUv );",
-			"float dist = distance( vUv, vec2( 0.5 ) );",
-			"color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
-			"gl_FragColor = color;",
-			*/
+		"	vec4 color = texture2D( tDiffuse, vUv );",
+		"	float dist = distance( vUv, vec2( 0.5 ) );",
+		"	color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
+		"	gl_FragColor = color;",
+		*/
 
 		"}"
 

+ 6 - 6
src/renderers/webgl/WebGLProgram.js

@@ -371,7 +371,7 @@ function generateEnvMapBlendingDefine( parameters, material ) {
 
 }
 
-function WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities ) {
+function WebGLProgram( renderer, extensions, code, material, shader, parameters ) {
 
 	var gl = renderer.getContext();
 
@@ -387,7 +387,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 
 	var gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
 
-	var customExtensions = capabilities.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
+	var customExtensions = parameters.isWebGL2 ? '' : generateExtensions( material.extensions, parameters, extensions );
 
 	var customDefines = generateDefines( defines );
 
@@ -482,7 +482,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 			parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
 
 			parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-			parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+			parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 			'uniform mat4 modelMatrix;',
 			'uniform vec3 cameraPosition;',
 
@@ -621,9 +621,9 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 			parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '',
 
 			parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
-			parameters.logarithmicDepthBuffer && ( capabilities.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
+			parameters.logarithmicDepthBuffer && ( parameters.isWebGL2 || extensions.get( 'EXT_frag_depth' ) ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
 
-			( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( capabilities.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
+			( ( material.extensions ? material.extensions.shaderTextureLOD : false ) || parameters.envMap ) && ( parameters.isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) ) ? '#define TEXTURE_LOD_EXT' : '',
 
 			'uniform vec3 cameraPosition;',
 
@@ -667,7 +667,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
 	vertexShader = unrollLoops( vertexShader );
 	fragmentShader = unrollLoops( fragmentShader );
 
-	if ( capabilities.isWebGL2 && ! material.isRawShaderMaterial ) {
+	if ( parameters.isWebGL2 && ! material.isRawShaderMaterial ) {
 
 		var isGLSL3ShaderMaterial = false;
 

+ 3 - 1
src/renderers/webgl/WebGLPrograms.js

@@ -135,6 +135,8 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 		var parameters = {
 
+			isWebGL2: capabilities.isWebGL2,
+
 			shaderID: shaderID,
 
 			precision: precision,
@@ -293,7 +295,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
 
 		if ( program === undefined ) {
 
-			program = new WebGLProgram( renderer, extensions, code, material, shader, parameters, capabilities );
+			program = new WebGLProgram( renderer, extensions, code, material, shader, parameters );
 			programs.push( program );
 
 		}

Some files were not shown because too many files changed in this diff