瀏覽代碼

Merge pull request #12697 from donmccurdy/feat-gltfexporter-flipy

GLTFExporter: Handle .flipY on textures.
Mr.doob 7 年之前
父節點
當前提交
89fe7f5e3d
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      examples/js/exporters/GLTFExporter.js

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

@@ -380,6 +380,14 @@ THREE.GLTFExporter.prototype = {
 				canvas.width = map.image.width;
 				canvas.width = map.image.width;
 				canvas.height = map.image.height;
 				canvas.height = map.image.height;
 				var ctx = canvas.getContext( '2d' );
 				var ctx = canvas.getContext( '2d' );
+
+				if ( map.flipY === true ) {
+
+					ctx.translate( 0, map.image.height );
+					ctx.scale( 1, -1 );
+
+				}
+
 				ctx.drawImage( map.image, 0, 0 );
 				ctx.drawImage( map.image, 0, 0 );
 
 
 				// @TODO Embed in { bufferView } if options.binary set.
 				// @TODO Embed in { bufferView } if options.binary set.