瀏覽代碼

Merge pull request #13415 from takahirox/GLTFExporterMetallicRoughnessTexture

GLTFExporter: Support metallicRoughnessTexture
Mr.doob 7 年之前
父節點
當前提交
b1227ff3e5
共有 1 個文件被更改,包括 19 次插入0 次删除
  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 ) {