Explorar o código

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

GLTFExporter: Handle .flipY on textures.
Mr.doob %!s(int64=7) %!d(string=hai) anos
pai
achega
89fe7f5e3d
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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.height = map.image.height;
 				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 );
 
 				// @TODO Embed in { bufferView } if options.binary set.