瀏覽代碼

Clean up the GLTF2Loader code

Takahiro 8 年之前
父節點
當前提交
64637ea4c6
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      examples/js/loaders/GLTF2Loader.js

+ 2 - 1
examples/js/loaders/GLTF2Loader.js

@@ -1430,7 +1430,8 @@ THREE.GLTF2Loader = ( function () {
 
 							_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_DATATYPES[ texture.type ] : THREE.UnsignedByteType;
 
-							var sampler = texture.sampler === undefined ? {} : json.samplers[ texture.sampler ];
+							var samplers = json.samplers || {};
+							var sampler = samplers[ texture.sampler ] || {};
 
 							_texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
 							_texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.NearestMipMapLinearFilter;