Browse Source

add opacityNode and rename to colorNode property

sunag 4 years ago
parent
commit
806eb90507

+ 8 - 2
examples/jsm/renderers/webgpu/WebGPUNodeBuilder.js

@@ -49,9 +49,15 @@ class WebGPUNodeBuilder extends NodeBuilder {
 		
 		if ( material.isMeshBasicMaterial ) {
 			
-			if ( material.color.isNode ) {
+			if ( material.colorNode !== undefined ) {
 				
-				this.addSlot( 'fragment', new NodeSlot( material.color, 'COLOR', 'vec3' ) );
+				this.addSlot( 'fragment', new NodeSlot( material.colorNode, 'COLOR', 'vec3' ) );
+				
+			}
+			
+			if ( material.opacityNode !== undefined ) {
+				
+				this.addSlot( 'fragment', new NodeSlot( material.opacityNode, 'OPACITY', 'float' ) );
 				
 			}
 			

+ 4 - 0
examples/jsm/renderers/webgpu/WebGPURenderPipelines.js

@@ -842,6 +842,10 @@ const ShaderLib = {
 				outColor.rgb = NODE_COLOR;
 			#endif
 
+			#ifdef NODE_OPACITY
+				outColor.a *= NODE_OPACITY;
+			#endif
+
 			outColor.a *= opacityUniforms.opacity;
 		}`
 	},