Browse Source

Revert "GLTFExporter: guard against missing image data in textures (#25021)"

This reverts commit d93c3052fd54f16721fcbea9f7b213c6aa5f50f4.
Mr.doob 2 years ago
parent
commit
4eb061adcf
1 changed files with 6 additions and 8 deletions
  1. 6 8
      examples/jsm/exporters/GLTFExporter.js

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

@@ -1297,11 +1297,9 @@ class GLTFWriter {
 		}
 
 		// pbrMetallicRoughness.metallicRoughnessTexture
-		const metalnessMap = material.metalnessMap?.image ? material.metalnessMap : undefined;
-		const roughnessMap = material.roughnessMap?.image ? material.roughnessMap : undefined;
-		if ( metalnessMap || roughnessMap ) {
+		if ( material.metalnessMap || material.roughnessMap ) {
 
-			const metalRoughTexture = this.buildMetalRoughTexture( metalnessMap, roughnessMap );
+			const metalRoughTexture = this.buildMetalRoughTexture( material.metalnessMap, material.roughnessMap );
 
 			const metalRoughMapDef = { index: this.processTexture( metalRoughTexture ) };
 			this.applyTextureTransform( metalRoughMapDef, metalRoughTexture );
@@ -1310,7 +1308,7 @@ class GLTFWriter {
 		}
 
 		// pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
-		if ( material.map?.image ) {
+		if ( material.map ) {
 
 			const baseColorMapDef = { index: this.processTexture( material.map ) };
 			this.applyTextureTransform( baseColorMapDef, material.map );
@@ -1339,7 +1337,7 @@ class GLTFWriter {
 			}
 
 			// emissiveTexture
-			if ( material.emissiveMap?.image ) {
+			if ( material.emissiveMap ) {
 
 				const emissiveMapDef = { index: this.processTexture( material.emissiveMap ) };
 				this.applyTextureTransform( emissiveMapDef, material.emissiveMap );
@@ -1350,7 +1348,7 @@ class GLTFWriter {
 		}
 
 		// normalTexture
-		if ( material.normalMap?.image ) {
+		if ( material.normalMap ) {
 
 			const normalMapDef = { index: this.processTexture( material.normalMap ) };
 
@@ -1368,7 +1366,7 @@ class GLTFWriter {
 		}
 
 		// occlusionTexture
-		if ( material.aoMap?.image ) {
+		if ( material.aoMap ) {
 
 			const occlusionMapDef = {
 				index: this.processTexture( material.aoMap ),