Browse Source

Simplified flipSided handling in shaders.

alteredq 13 years ago
parent
commit
6ae29843fc
2 changed files with 13 additions and 30 deletions
  1. 5 5
      build/three.min.js
  2. 8 25
      src/renderers/WebGLShaders.js

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


+ 8 - 25
src/renderers/WebGLShaders.js

@@ -112,15 +112,7 @@ THREE.ShaderChunk = {
 
 			"#else",
 
-				"#ifdef FLIP_SIDED",
-				
-					"vec4 cubeColor = textureCube( envMap, -vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );",
-					
-				"#else",
-				
-					"vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );",
-					
-				"#endif",
+				"vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );",
 
 			"#endif",
 
@@ -467,16 +459,7 @@ THREE.ShaderChunk = {
 
 		"#endif",
 
-		"#ifdef FLIP_SIDED",
-		
-			"transformedNormal = normalize( -transformedNormal );",
-			
-		"#else",
-		
-			"transformedNormal = normalize( transformedNormal );",
-			
-		"#endif",
-
+		"transformedNormal = normalize( transformedNormal );",
 
 		"#if MAX_DIR_LIGHTS > 0",
 
@@ -836,12 +819,6 @@ THREE.ShaderChunk = {
 		"vec3 normal = normalize( vNormal );",
 		"vec3 viewPosition = normalize( vViewPosition );",
 
-		"#ifdef FLIP_SIDED",
-		
-			"normal = -normal;",
-			
-		"#endif",
-
 		"#ifdef DOUBLE_SIDED",
 
 			"normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );",
@@ -1435,6 +1412,12 @@ THREE.ShaderChunk = {
 
 		"#endif",
 
+		"#ifdef FLIP_SIDED",
+
+			"objectNormal = -objectNormal;",
+
+		"#endif",
+
 		"vec3 transformedNormal = normalMatrix * objectNormal;",
 
 	].join("\n"),

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