Browse Source

Removed hatching commented code from ShaderUtils.

Mr.doob 14 years ago
parent
commit
0b8323f426
1 changed files with 11 additions and 98 deletions
  1. 11 98
      src/extras/ShaderUtils.js

+ 11 - 98
src/extras/ShaderUtils.js

@@ -262,28 +262,21 @@ var ShaderUtils = {
 			].join("\n")
 
 		},
-		/*
-		'hatching' : {
 
-			uniforms: {
-
-				"uSampler": { type: "t", value: 2, texture: null },
-
-				"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-				"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
-
-				"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) }
+		'cube': {
 
-			},
+			uniforms: { "tCube": { type: "t", value: 1, texture: null } },
 
 			vertex_shader: [
 
-				"varying vec3 vNormal;",
+				"varying vec3 vViewPosition;",
 
 				"void main() {",
 
+					"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
+					"vViewPosition = cameraPosition - mPosition.xyz;",
+
 					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-					"vNormal = normalize( normalMatrix * normal );",
 
 				"}"
 
@@ -291,65 +284,21 @@ var ShaderUtils = {
 
 			fragment_shader: [
 
-				"uniform vec3 uDirLightPos;",
-				"uniform vec3 uDirLightColor;",
-
-				"uniform vec3 uAmbientLightColor;",
-
-				"uniform sampler2D uSampler;",
+				"uniform samplerCube tCube;",
 
-				"varying vec3 vNormal;",
+				"varying vec3 vViewPosition;",
 
 				"void main() {",
 
-					"float directionalLightWeighting = max(dot(normalize(vNormal), uDirLightPos), 0.0);",
-					"vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;",
-
-					"gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);",
-
-					"if (length(lightWeighting) < 1.00) {",
-
-						"if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {",
-
-							"gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
-
-						"}",
-
-					"}",
-
-					"if (length(lightWeighting) < 0.75) {",
-
-						"if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {",
-
-							"gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
-
-						"}",
-					"}",
-
-					"if (length(lightWeighting) < 0.50) {",
-
-						"if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {",
-
-							"gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
-
-						"}",
-					"}",
-
-					"if (length(lightWeighting) < 0.3465) {",
-
-						"if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {",
-
-							"gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
-
-						"}",
-					"}",
+					"vec3 wPos = cameraPosition - vViewPosition;",
+					"gl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );",
 
 				"}"
 
 			].join("\n")
 
 		},
-		*/
+
 		'basic': {
 
 			uniforms: {},
@@ -374,42 +323,6 @@ var ShaderUtils = {
 
 			].join("\n")
 
-		},
-
-		'cube': {
-
-			uniforms: { "tCube": { type: "t", value: 1, texture: null } },
-
-			vertex_shader: [
-
-				"varying vec3 vViewPosition;",
-
-				"void main() {",
-
-					"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
-					"vViewPosition = cameraPosition - mPosition.xyz;",
-
-					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-				"}"
-
-			].join("\n"),
-
-			fragment_shader: [
-
-				"uniform samplerCube tCube;",
-
-				"varying vec3 vViewPosition;",
-
-				"void main() {",
-
-					"vec3 wPos = cameraPosition - vViewPosition;",
-					"gl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );",
-
-				"}"
-
-			].join("\n")
-
 		}
 
 	}