2
0
Эх сурвалжийг харах

Merge pull request #19956 from linbingquan/dev-cleanup

Core: Clean up.
Mr.doob 5 жил өмнө
parent
commit
ebd5b3a3b3

+ 5 - 5
src/math/Vector4.js

@@ -315,17 +315,17 @@ Object.assign( Vector4.prototype, {
 			m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
 			m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
 
 
 		if ( ( Math.abs( m12 - m21 ) < epsilon ) &&
 		if ( ( Math.abs( m12 - m21 ) < epsilon ) &&
-		     ( Math.abs( m13 - m31 ) < epsilon ) &&
-		     ( Math.abs( m23 - m32 ) < epsilon ) ) {
+			 ( Math.abs( m13 - m31 ) < epsilon ) &&
+			 ( Math.abs( m23 - m32 ) < epsilon ) ) {
 
 
 			// singularity found
 			// singularity found
 			// first check for identity matrix which must have +1 for all terms
 			// first check for identity matrix which must have +1 for all terms
 			// in leading diagonal and zero in other terms
 			// in leading diagonal and zero in other terms
 
 
 			if ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&
 			if ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&
-			     ( Math.abs( m13 + m31 ) < epsilon2 ) &&
-			     ( Math.abs( m23 + m32 ) < epsilon2 ) &&
-			     ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {
+				 ( Math.abs( m13 + m31 ) < epsilon2 ) &&
+				 ( Math.abs( m23 + m32 ) < epsilon2 ) &&
+				 ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {
 
 
 				// this singularity is identity matrix so angle = 0
 				// this singularity is identity matrix so angle = 0
 
 

+ 5 - 5
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js

@@ -154,9 +154,9 @@ vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 view
 
 
 vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
 vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
 
 
-	const float LUT_SIZE  = 64.0;
+	const float LUT_SIZE = 64.0;
 	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
 	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
-	const float LUT_BIAS  = 0.5 / LUT_SIZE;
+	const float LUT_BIAS = 0.5 / LUT_SIZE;
 
 
 	float dotNV = saturate( dot( N, V ) );
 	float dotNV = saturate( dot( N, V ) );
 
 
@@ -244,9 +244,9 @@ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m
 	float len = length( vectorFormFactor );
 	float len = length( vectorFormFactor );
 	float z = vectorFormFactor.z / len;
 	float z = vectorFormFactor.z / len;
 
 
-	const float LUT_SIZE  = 64.0;
+	const float LUT_SIZE = 64.0;
 	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
 	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
-	const float LUT_BIAS  = 0.5 / LUT_SIZE;
+	const float LUT_BIAS = 0.5 / LUT_SIZE;
 
 
 	// tabulated horizon-clipped sphere, apparently...
 	// tabulated horizon-clipped sphere, apparently...
 	vec2 uv = vec2( z * 0.5 + 0.5, len );
 	vec2 uv = vec2( z * 0.5 + 0.5, len );
@@ -342,7 +342,7 @@ float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L94
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L94
 float D_Charlie(float roughness, float NoH) {
 float D_Charlie(float roughness, float NoH) {
 	// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
 	// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
-	float invAlpha  = 1.0 / roughness;
+	float invAlpha = 1.0 / roughness;
 	float cos2h = NoH * NoH;
 	float cos2h = NoH * NoH;
 	float sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16
 	float sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16
 	return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
 	return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);

+ 81 - 81
src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js

@@ -11,74 +11,74 @@ export default /* glsl */`
 // sampling a textureCube (not generally normalized).
 // sampling a textureCube (not generally normalized).
 
 
 float getFace(vec3 direction) {
 float getFace(vec3 direction) {
-    vec3 absDirection = abs(direction);
-    float face = -1.0;
-    if (absDirection.x > absDirection.z) {
-      if (absDirection.x > absDirection.y)
-        face = direction.x > 0.0 ? 0.0 : 3.0;
-      else
-        face = direction.y > 0.0 ? 1.0 : 4.0;
-    } else {
-      if (absDirection.z > absDirection.y)
-        face = direction.z > 0.0 ? 2.0 : 5.0;
-      else
-        face = direction.y > 0.0 ? 1.0 : 4.0;
-    }
-    return face;
+	vec3 absDirection = abs(direction);
+	float face = -1.0;
+	if (absDirection.x > absDirection.z) {
+		if (absDirection.x > absDirection.y)
+			face = direction.x > 0.0 ? 0.0 : 3.0;
+		else
+			face = direction.y > 0.0 ? 1.0 : 4.0;
+	} else {
+		if (absDirection.z > absDirection.y)
+			face = direction.z > 0.0 ? 2.0 : 5.0;
+		else
+			face = direction.y > 0.0 ? 1.0 : 4.0;
+	}
+	return face;
 }
 }
 
 
 // RH coordinate system; PMREM face-indexing convention
 // RH coordinate system; PMREM face-indexing convention
 vec2 getUV(vec3 direction, float face) {
 vec2 getUV(vec3 direction, float face) {
-    vec2 uv;
-    if (face == 0.0) {
-      uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
-    } else if (face == 1.0) {
-      uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
-    } else if (face == 2.0) {
-      uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
-    } else if (face == 3.0) {
-      uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
-    } else if (face == 4.0) {
-      uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
-    } else {
-      uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
-    }
-    return 0.5 * (uv + 1.0);
+	vec2 uv;
+	if (face == 0.0) {
+		uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
+	} else if (face == 1.0) {
+		uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
+	} else if (face == 2.0) {
+		uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
+	} else if (face == 3.0) {
+		uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
+	} else if (face == 4.0) {
+		uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
+	} else {
+		uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
+	}
+	return 0.5 * (uv + 1.0);
 }
 }
 
 
 vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
 vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
-  float face = getFace(direction);
-  float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
-  mipInt = max(mipInt, cubeUV_minMipLevel);
-  float faceSize = exp2(mipInt);
+	float face = getFace(direction);
+	float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
+	mipInt = max(mipInt, cubeUV_minMipLevel);
+	float faceSize = exp2(mipInt);
 
 
-  float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
+	float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
 
 
-  vec2 uv = getUV(direction, face) * (faceSize - 1.0);
-  vec2 f = fract(uv);
-  uv += 0.5 - f;
-  if (face > 2.0) {
-    uv.y += faceSize;
-    face -= 3.0;
-  }
-  uv.x += face * faceSize;
-  if(mipInt < cubeUV_maxMipLevel){
-    uv.y += 2.0 * cubeUV_maxTileSize;
-  }
-  uv.y += filterInt * 2.0 * cubeUV_minTileSize;
-  uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
-  uv *= texelSize;
+	vec2 uv = getUV(direction, face) * (faceSize - 1.0);
+	vec2 f = fract(uv);
+	uv += 0.5 - f;
+	if (face > 2.0) {
+		uv.y += faceSize;
+		face -= 3.0;
+	}
+	uv.x += face * faceSize;
+	if(mipInt < cubeUV_maxMipLevel){
+		uv.y += 2.0 * cubeUV_maxTileSize;
+	}
+	uv.y += filterInt * 2.0 * cubeUV_minTileSize;
+	uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
+	uv *= texelSize;
 
 
-  vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
-  uv.x += texelSize;
-  vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
-  uv.y += texelSize;
-  vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
-  uv.x -= texelSize;
-  vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
-  vec3 tm = mix(tl, tr, f.x);
-  vec3 bm = mix(bl, br, f.x);
-  return mix(tm, bm, f.y);
+	vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
+	uv.x += texelSize;
+	vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
+	uv.y += texelSize;
+	vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
+	uv.x -= texelSize;
+	vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
+	vec3 tm = mix(tl, tr, f.x);
+	vec3 bm = mix(bl, br, f.x);
+	return mix(tm, bm, f.y);
 }
 }
 
 
 // These defines must match with PMREMGenerator
 // These defines must match with PMREMGenerator
@@ -100,33 +100,33 @@ vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
 #define m6 4.0
 #define m6 4.0
 
 
 float roughnessToMip(float roughness) {
 float roughnessToMip(float roughness) {
-  float mip = 0.0;
-  if (roughness >= r1) {
-    mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
-  } else if (roughness >= r4) {
-    mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
-  } else if (roughness >= r5) {
-    mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
-  } else if (roughness >= r6) {
-    mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
-  } else {
-    mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
-  }
-  return mip;
+	float mip = 0.0;
+	if (roughness >= r1) {
+		mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
+	} else if (roughness >= r4) {
+		mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
+	} else if (roughness >= r5) {
+		mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
+	} else if (roughness >= r6) {
+		mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
+	} else {
+		mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
+	}
+	return mip;
 }
 }
 
 
 vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {
 vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {
-  float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);
-  float mipF = fract(mip);
-  float mipInt = floor(mip);
+	float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);
+	float mipF = fract(mip);
+	float mipInt = floor(mip);
 
 
-  vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);
-  if (mipF == 0.0) {
-    return vec4(color0, 1.0);
-  } else {
-    vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);
-    return vec4(mix(color0, color1, mipF), 1.0);
-  }
+	vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);
+	if (mipF == 0.0) {
+		return vec4(color0, 1.0);
+	} else {
+		vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);
+		return vec4(mix(color0, color1, mipF), 1.0);
+	}
 }
 }
 #endif
 #endif
 `;
 `;

+ 2 - 2
src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js

@@ -29,7 +29,7 @@ vec4 LinearToRGBE( in vec4 value ) {
 	float maxComponent = max( max( value.r, value.g ), value.b );
 	float maxComponent = max( max( value.r, value.g ), value.b );
 	float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
 	float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
 	return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
 	return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
-//  return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );
+	// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );
 }
 }
 
 
 // reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html
 // reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html
@@ -64,7 +64,7 @@ vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
 
 
 // M matrix, for encoding
 // M matrix, for encoding
 const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
 const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
-vec4 LinearToLogLuv( in vec4 value )  {
+vec4 LinearToLogLuv( in vec4 value ) {
 	vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
 	vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
 	Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
 	Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
 	vec4 vResult;
 	vec4 vResult;

+ 2 - 2
src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js

@@ -4,12 +4,12 @@ export default /* glsl */`
 	#ifdef ENV_WORLDPOS
 	#ifdef ENV_WORLDPOS
 
 
 		vec3 cameraToFrag;
 		vec3 cameraToFrag;
-		
+
 		if ( isOrthographic ) {
 		if ( isOrthographic ) {
 
 
 			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
 			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
 
 
-		}  else {
+		} else {
 
 
 			cameraToFrag = normalize( vWorldPosition - cameraPosition );
 			cameraToFrag = normalize( vWorldPosition - cameraPosition );
 
 

+ 4 - 4
src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js

@@ -60,14 +60,14 @@ export default /* glsl */`
 
 
 		#ifdef ENVMAP_MODE_REFLECTION
 		#ifdef ENVMAP_MODE_REFLECTION
 
 
-		  vec3 reflectVec = reflect( -viewDir, normal );
+			vec3 reflectVec = reflect( -viewDir, normal );
 
 
-		  // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
-		  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
+			// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
+			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
 
 
 		#else
 		#else
 
 
-		  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
+			vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
 
 
 		#endif
 		#endif
 
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js

@@ -117,7 +117,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
 	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
 	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
 
 
 	// directLight is an out parameter as having it as a return value caused compiler errors on some devices
 	// directLight is an out parameter as having it as a return value caused compiler errors on some devices
-	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {
+	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
 
 
 		vec3 lVector = spotLight.position - geometry.position;
 		vec3 lVector = spotLight.position - geometry.position;
 		directLight.direction = normalize( lVector );
 		directLight.direction = normalize( lVector );

+ 1 - 1
src/renderers/shaders/ShaderChunk/packing.glsl.js

@@ -10,7 +10,7 @@ vec3 unpackRGBToNormal( const in vec3 rgb ) {
 const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
 const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
 const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
 const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
 
 
-const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );
+const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
 const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
 const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
 
 
 const float ShiftRight8 = 1. / 256.;
 const float ShiftRight8 = 1. / 256.;

+ 1 - 1
src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js

@@ -6,7 +6,7 @@ export default /* glsl */`
 	skinMatrix += skinWeight.y * boneMatY;
 	skinMatrix += skinWeight.y * boneMatY;
 	skinMatrix += skinWeight.z * boneMatZ;
 	skinMatrix += skinWeight.z * boneMatZ;
 	skinMatrix += skinWeight.w * boneMatW;
 	skinMatrix += skinWeight.w * boneMatW;
-	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;
+	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
 
 
 	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
 	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
 
 

+ 18 - 18
src/renderers/shaders/ShaderLib/vsm_frag.glsl.js

@@ -7,36 +7,36 @@ uniform float radius;
 
 
 void main() {
 void main() {
 
 
-  float mean = 0.0;
-  float squared_mean = 0.0;
+	float mean = 0.0;
+	float squared_mean = 0.0;
 
 
 	// This seems totally useless but it's a crazy work around for a Adreno compiler bug
 	// This seems totally useless but it's a crazy work around for a Adreno compiler bug
-	float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) / resolution ) );
+	float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
 
 
-  for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
+	for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
 
 
-    #ifdef HORIZONAL_PASS
+		#ifdef HORIZONAL_PASS
 
 
-      vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
-      mean += distribution.x;
-      squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
+			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
+			mean += distribution.x;
+			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
 
 
-    #else
+		#else
 
 
-      float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) / resolution ) );
-      mean += depth;
-      squared_mean += depth * depth;
+			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
+			mean += depth;
+			squared_mean += depth * depth;
 
 
-    #endif
+		#endif
 
 
-  }
+	}
 
 
-  mean = mean * HALF_SAMPLE_RATE;
-  squared_mean = squared_mean * HALF_SAMPLE_RATE;
+	mean = mean * HALF_SAMPLE_RATE;
+	squared_mean = squared_mean * HALF_SAMPLE_RATE;
 
 
-  float std_dev = sqrt( squared_mean - mean * mean );
+	float std_dev = sqrt( squared_mean - mean * mean );
 
 
-  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
+	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
 
 
 }
 }
 `;
 `;

+ 4 - 4
src/renderers/webgl/WebGLState.js

@@ -243,8 +243,8 @@ function WebGLState( gl, extensions, capabilities ) {
 			setFunc: function ( stencilFunc, stencilRef, stencilMask ) {
 			setFunc: function ( stencilFunc, stencilRef, stencilMask ) {
 
 
 				if ( currentStencilFunc !== stencilFunc ||
 				if ( currentStencilFunc !== stencilFunc ||
-				     currentStencilRef 	!== stencilRef 	||
-				     currentStencilFuncMask !== stencilMask ) {
+					 currentStencilRef 	!== stencilRef 	||
+					 currentStencilFuncMask !== stencilMask ) {
 
 
 					gl.stencilFunc( stencilFunc, stencilRef, stencilMask );
 					gl.stencilFunc( stencilFunc, stencilRef, stencilMask );
 
 
@@ -259,8 +259,8 @@ function WebGLState( gl, extensions, capabilities ) {
 			setOp: function ( stencilFail, stencilZFail, stencilZPass ) {
 			setOp: function ( stencilFail, stencilZFail, stencilZPass ) {
 
 
 				if ( currentStencilFail	 !== stencilFail 	||
 				if ( currentStencilFail	 !== stencilFail 	||
-				     currentStencilZFail !== stencilZFail ||
-				     currentStencilZPass !== stencilZPass ) {
+					 currentStencilZFail !== stencilZFail ||
+					 currentStencilZPass !== stencilZPass ) {
 
 
 					gl.stencilOp( stencilFail, stencilZFail, stencilZPass );
 					gl.stencilOp( stencilFail, stencilZFail, stencilZPass );