Explorar o código

GLTFExporter: Fixed alphaMode handling

Mr.doob %!s(int64=5) %!d(string=hai) anos
pai
achega
71ec3b2ea2

+ 6 - 4
examples/js/exporters/GLTFExporter.js

@@ -1088,13 +1088,15 @@ THREE.GLTFExporter.prototype = {
 			}
 			}
 
 
 			// alphaMode
 			// alphaMode
-			if ( material.transparent || material.alphaTest > 0.0 ) {
+			if ( material.transparent ) {
 
 
-				gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK';
+				gltfMaterial.alphaMode = 'BLEND';
 
 
-				// Write alphaCutoff if it's non-zero and different from the default (0.5).
-				if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) {
+			} else {
+
+				if ( material.alphaTest > 0.0 ) {
 
 
+					gltfMaterial.alphaMode = 'MASK';
 					gltfMaterial.alphaCutoff = material.alphaTest;
 					gltfMaterial.alphaCutoff = material.alphaTest;
 
 
 				}
 				}

+ 6 - 4
examples/jsm/exporters/GLTFExporter.js

@@ -1112,13 +1112,15 @@ GLTFExporter.prototype = {
 			}
 			}
 
 
 			// alphaMode
 			// alphaMode
-			if ( material.transparent || material.alphaTest > 0.0 ) {
+			if ( material.transparent ) {
 
 
-				gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK';
+				gltfMaterial.alphaMode = 'BLEND';
 
 
-				// Write alphaCutoff if it's non-zero and different from the default (0.5).
-				if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) {
+			} else {
+
+				if ( material.alphaTest > 0.0 ) {
 
 
+					gltfMaterial.alphaMode = 'MASK';
 					gltfMaterial.alphaCutoff = material.alphaTest;
 					gltfMaterial.alphaCutoff = material.alphaTest;
 
 
 				}
 				}