瀏覽代碼

more indent fixes

Garrett Johnson 5 年之前
父節點
當前提交
e693ce2ccb

+ 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 );",
 
 		"}"
 

+ 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 );",
 
 		"}"