Browse Source

fix normal doubleSided

sunag 7 years ago
parent
commit
878dca0803

+ 2 - 2
examples/js/nodes/accessors/NormalNode.js

@@ -45,7 +45,7 @@ NormalNode.prototype.generate = function ( builder, output ) {
 
 			builder.requires.normal = true;
 
-			result = builder.isShader( 'vertex' ) ? 'normal' : 'vObjectNormal';
+			result = 'normal';
 
 			break;
 
@@ -59,7 +59,7 @@ NormalNode.prototype.generate = function ( builder, output ) {
 
 		case NormalNode.VIEW:
 
-			result = 'normal';
+			result = 'vNormal';
 
 			break;
 

+ 1 - 1
examples/js/nodes/misc/BumpMapNode.js

@@ -114,7 +114,7 @@ BumpMapNode.prototype.generate = function ( builder, output ) {
 			var derivativeHeight = builder.include( BumpMapNode.Nodes.dHdxy_fwd ),
 				perturbNormalArb = builder.include( BumpMapNode.Nodes.perturbNormalArb );
 
-			this.normal = this.normal || new NormalNode( NormalNode.VIEW );
+			this.normal = this.normal || new NormalNode();
 			this.position = this.position || new PositionNode( PositionNode.VIEW );
 
 			var derivativeHeightCode = derivativeHeight + '( ' + this.value.build( builder, 'sampler2D' ) + ', ' +

+ 1 - 1
examples/js/nodes/misc/NormalMapNode.js

@@ -68,7 +68,7 @@ NormalMapNode.prototype.generate = function ( builder, output ) {
 
 		var perturbNormal2Arb = builder.include( NormalMapNode.Nodes.perturbNormal2Arb );
 
-		this.normal = this.normal || new NormalNode( NormalNode.VIEW );
+		this.normal = this.normal || new NormalNode();
 		this.position = this.position || new PositionNode( PositionNode.VIEW );
 		this.uv = this.uv || new UVNode();
 

+ 7 - 4
examples/webgl_materials_nodes.html

@@ -764,7 +764,7 @@
 						var color = new THREE.ColorNode( 0xFFFFFF );
 
 						var viewZ = new THREE.Math2Node(
-							new THREE.NormalNode( THREE.NormalNode.VIEW ),
+							new THREE.NormalNode(),
 							new THREE.Vector3Node( 0, 0, - intensity ),
 							THREE.Math2Node.DOT
 						);
@@ -1045,7 +1045,7 @@
 						var color = new THREE.CubeTextureNode( cubemap );
 
 						var viewZ = new THREE.Math2Node(
-							new THREE.NormalNode( THREE.NormalNode.VIEW ),
+							new THREE.NormalNode(),
 							new THREE.Vector3Node( 0, 0, - 1 ),
 							THREE.Math2Node.DOT
 						);
@@ -1690,7 +1690,7 @@
 						var fur = new THREE.FloatNode( .5 );
 
 						var posDirection = new THREE.Math1Node( new THREE.PositionNode( THREE.PositionNode.VIEW ), THREE.Math1Node.NORMALIZE );
-						var norDirection = new THREE.Math1Node( new THREE.NormalNode( THREE.NormalNode.VIEW ), THREE.Math1Node.NORMALIZE );
+						var norDirection = new THREE.Math1Node( new THREE.NormalNode(), THREE.Math1Node.NORMALIZE );
 
 						var viewZ = new THREE.Math2Node(
 							posDirection,
@@ -1874,7 +1874,7 @@
 						// LINE
 
 						var posDirection = new THREE.Math1Node( new THREE.PositionNode( THREE.PositionNode.VIEW ), THREE.Math1Node.NORMALIZE );
-						var norDirection = new THREE.Math1Node( new THREE.NormalNode( THREE.NormalNode.VIEW ), THREE.Math1Node.NORMALIZE );
+						var norDirection = new THREE.Math1Node( new THREE.NormalNode(), THREE.Math1Node.NORMALIZE );
 
 						var viewZ = new THREE.Math2Node(
 							posDirection,
@@ -2534,6 +2534,9 @@
 				}
 
 				// set material
+
+				mtl.side = THREE.DoubleSide;
+
 				mesh.material = mtl;
 
 			}