Ver código fonte

WebGPURenderer: Support Material.blending = NoBlending (#26295)

* add support for meshPhongNodeMaterial

* fix rendering to formats that do not support blending

* fix missing semicolon

---------

Co-authored-by: aardgoose <[email protected]>
aardgoose 2 anos atrás
pai
commit
3a7692fd66

+ 6 - 8
examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -57,13 +57,14 @@ class WebGPUPipelineUtils {
 
 		// blending
 
-		let alphaBlend = {};
-		let colorBlend = {};
+		let blending;
 
 		if ( material.transparent === true && material.blending !== NoBlending ) {
 
-			alphaBlend = this._getAlphaBlend( material );
-			colorBlend = this._getColorBlend( material );
+			blending = {
+				alpha: this._getAlphaBlend( material ),
+				color: this._getColorBlend( material )
+			};
 
 		}
 
@@ -98,10 +99,7 @@ class WebGPUPipelineUtils {
 			vertex: Object.assign( {}, vertexModule, { buffers: vertexBuffers } ),
 			fragment: Object.assign( {}, fragmentModule, { targets: [ {
 				format: colorFormat,
-				blend: {
-					alpha: alphaBlend,
-					color: colorBlend
-				},
+				blend: blending,
 				writeMask: colorWriteMask
 			} ] } ),
 			primitive: primitiveState,