From 836e363c07cf59b759b907d4fbf4b4529bc2dcaf Mon Sep 17 00:00:00 2001 From: sunag Date: Tue, 19 Jun 2018 22:31:31 -0300 Subject: [PATCH] fix bypassnode without .value --- examples/js/nodes/core/BypassNode.js | 30 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/examples/js/nodes/core/BypassNode.js b/examples/js/nodes/core/BypassNode.js index fe9dcd147b..149ee3a0de 100644 --- a/examples/js/nodes/core/BypassNode.js +++ b/examples/js/nodes/core/BypassNode.js @@ -17,7 +17,17 @@ THREE.BypassNode.prototype.nodeType = "Bypass"; THREE.BypassNode.prototype.getType = function ( builder ) { - return this.value ? this.value.getType( builder ) : 'void'; + if ( this.value ) { + + return this.value.getType( builder ); + + } else if (builder.isShader( 'fragment' )) { + + return 'fv1'; + + } + + return 'void'; }; @@ -25,19 +35,21 @@ THREE.BypassNode.prototype.generate = function ( builder, output ) { var code = this.code.build( builder, output ) + ';'; - if ( builder.isShader( 'fragment' ) ) { + if ( builder.isShader( 'vertex' ) ) { - builder.material.addFragmentNode( code ); + builder.material.addVertexNode( code ); + + if (this.value) { + + return this.value.build( builder, output ); + + } } else { - builder.material.addVertexNode( code ); - - } - - if (this.value) { + builder.material.addFragmentNode( code ); - return this.value.build( builder, output ); + return this.value ? this.value.build( builder, output ) : builder.format( '0.0', 'fv1', output ); } -- GitLab