 
 			#endif
 
-		#endif
-
-		envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
+			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
+
+		#endif
 
 		return envMapColor.rgb * envMapIntensity;
 

				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );

			#endif

		#elif defined( ENVMAP_TYPE_CUBE_UV )



			#endif

			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;

		#elif defined( ENVMAP_TYPE_SPHERE )

			vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
