Selaa lähdekoodia

GLTFExporter: Support metallicRoughnessTexture

Takahiro 7 vuotta sitten
vanhempi
commit
944b3d6c01
1 muutettua tiedostoa jossa 19 lisäystä ja 0 poistoa
  1. 19 0
      examples/js/exporters/GLTFExporter.js

+ 19 - 0
examples/js/exporters/GLTFExporter.js

@@ -613,6 +613,25 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
+			// pbrMetallicRoughness.metallicRoughnessTexture
+			if ( material.metalnessMap || material.roughnessMap ) {
+
+				if ( material.metalnessMap === material.roughnessMap ) {
+
+					gltfMaterial.pbrMetallicRoughness.metallicRoughnessTexture = {
+
+						index: processTexture( material.metalnessMap )
+
+					};
+
+				} else {
+
+					console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
+
+				}
+
+			}
+
 			// pbrMetallicRoughness.baseColorTexture
 			if ( material.map ) {