diff --git a/examples/jsm/nodes/core/AttributeNode.js b/examples/jsm/nodes/core/AttributeNode.js index c1cb7c17126767..a9a210a1896090 100644 --- a/examples/jsm/nodes/core/AttributeNode.js +++ b/examples/jsm/nodes/core/AttributeNode.js @@ -4,10 +4,12 @@ import { nodeObject } from '../shadernode/ShaderNode.js'; class AttributeNode extends Node { - constructor( attributeName, nodeType = null ) { + constructor( attributeName, nodeType = null, defaultNode = null ) { super( nodeType ); + this.defaultNode = defaultNode; + this._attributeName = attributeName; } @@ -93,7 +95,17 @@ class AttributeNode extends Node { console.warn( `AttributeNode: Vertex attribute "${ attributeName }" not found on geometry.` ); - return builder.generateConst( nodeType ); + const { defaultNode } = this; + + if ( defaultNode !== null ) { + + return defaultNode.build( builder, nodeType ); + + } else { + + return builder.generateConst( nodeType ); + + } }