浏览代码

Updated processImage cache scheme to handle different combinations of mimeType and flipY export options.

Alan Chambers 7 年之前
父节点
当前提交
68ada25111
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. 12 3
      examples/js/exporters/GLTFExporter.js

+ 12 - 3
examples/js/exporters/GLTFExporter.js

@@ -606,9 +606,18 @@ THREE.GLTFExporter.prototype = {
 		 */
 		 */
 		function processImage( image, mimeType, flipY ) {
 		function processImage( image, mimeType, flipY ) {
 
 
-			if ( cachedData.images.has( image ) ) {
+			if ( ! cachedData.images.has( image ) ) {
 
 
-				return cachedData.images.get( image );
+				cachedData.images.set( image, {} );
+
+			}
+
+			var cachedImages = cachedData.images.get( image );
+			var key = mimeType + ":" + flipY.toString();
+
+			if ( cachedImages[ key ] !== undefined ) {
+
+				return cachedImages[ key ];
 
 
 			}
 			}
 
 
@@ -680,7 +689,7 @@ THREE.GLTFExporter.prototype = {
 			outputJSON.images.push( gltfImage );
 			outputJSON.images.push( gltfImage );
 
 
 			var index = outputJSON.images.length - 1;
 			var index = outputJSON.images.length - 1;
-			cachedData.images.set( image, index );
+			cachedImages[ key ] = index;
 
 
 			return index;
 			return index;