瀏覽代碼

GLTF Added alphaCutoff support in exporter and loader

Fernando Serrano 8 年之前
父節點
當前提交
ff4613fda5
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. 7 1
      examples/js/exporters/GLTFExporter.js
  2. 2 0
      examples/js/loaders/GLTFLoader.js

+ 7 - 1
examples/js/exporters/GLTFExporter.js

@@ -520,7 +520,13 @@ THREE.GLTFExporter.prototype = {
 			// alphaMode
 			if ( material.transparent ) {
 
-				gltfMaterial.alphaMode = 'BLEND'; // @FIXME We should detect MASK or BLEND
+				gltfMaterial.alphaMode = 'MASK'; // @FIXME We should detect MASK or BLEND
+
+				if ( material.alphaTest !== 0.5 ) {
+
+					gltfMaterial.alphaCutoff = material.alphaTest;
+
+				}
 
 			}
 

+ 2 - 0
examples/js/loaders/GLTFLoader.js

@@ -1603,6 +1603,8 @@ THREE.GLTFLoader = ( function () {
 
 				materialParams.transparent = true;
 
+				materialParams.alphaTest = material.alphaCutoff || 0.5;
+
 			} else {
 
 				materialParams.transparent = false;