From 878dca08034a13d444731014e0951f8e99ffea86 Mon Sep 17 00:00:00 2001 From: sunag Date: Tue, 24 Jul 2018 21:20:12 -0300 Subject: [PATCH] fix normal doubleSided --- examples/js/nodes/accessors/NormalNode.js | 4 ++-- examples/js/nodes/misc/BumpMapNode.js | 2 +- examples/js/nodes/misc/NormalMapNode.js | 2 +- examples/webgl_materials_nodes.html | 11 +++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/js/nodes/accessors/NormalNode.js b/examples/js/nodes/accessors/NormalNode.js index 42b7e47b42..db25409709 100644 --- a/examples/js/nodes/accessors/NormalNode.js +++ b/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; diff --git a/examples/js/nodes/misc/BumpMapNode.js b/examples/js/nodes/misc/BumpMapNode.js index 7086abbf27..f5f45b1df9 100644 --- a/examples/js/nodes/misc/BumpMapNode.js +++ b/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' ) + ', ' + diff --git a/examples/js/nodes/misc/NormalMapNode.js b/examples/js/nodes/misc/NormalMapNode.js index eea72d4198..261d15a2d6 100644 --- a/examples/js/nodes/misc/NormalMapNode.js +++ b/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(); diff --git a/examples/webgl_materials_nodes.html b/examples/webgl_materials_nodes.html index 9782a5fa84..24d52efc8a 100644 --- a/examples/webgl_materials_nodes.html +++ b/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; } -- GitLab