Browse Source

GLTFExporter: Handle .flipY on textures.

Don McCurdy 7 years ago
parent
commit
4065f26125
1 changed files with 8 additions and 0 deletions
  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.