Sfoglia il codice sorgente

Added `setWithCredentials` function to: ImageLoader, and TextureLoader which send the `withCredentials` variable to the XHRLoader. (#9391)

Karim Beyrouti 9 anni fa
parent
commit
9d945e1194
2 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. 8 0
      src/loaders/ImageLoader.js
  2. 10 0
      src/loaders/TextureLoader.js

+ 8 - 0
src/loaders/ImageLoader.js

@@ -37,6 +37,7 @@ Object.assign( ImageLoader.prototype, {
 			var loader = new XHRLoader();
 			var loader = new XHRLoader();
 			loader.setPath( this.path );
 			loader.setPath( this.path );
 			loader.setResponseType( 'blob' );
 			loader.setResponseType( 'blob' );
+			loader.setWithCredentials( this.withCredentials );
 			loader.load( url, function ( blob ) {
 			loader.load( url, function ( blob ) {
 
 
 				image.src = URL.createObjectURL( blob );
 				image.src = URL.createObjectURL( blob );
@@ -58,6 +59,13 @@ Object.assign( ImageLoader.prototype, {
 
 
 	},
 	},
 
 
+	setWithCredentials: function ( value ) {
+
+		this.withCredentials = value;
+		return this;
+
+	},
+
 	setPath: function ( value ) {
 	setPath: function ( value ) {
 
 
 		this.path = value;
 		this.path = value;

+ 10 - 0
src/loaders/TextureLoader.js

@@ -21,6 +21,7 @@ Object.assign( TextureLoader.prototype, {
 
 
 		var loader = new ImageLoader( this.manager );
 		var loader = new ImageLoader( this.manager );
 		loader.setCrossOrigin( this.crossOrigin );
 		loader.setCrossOrigin( this.crossOrigin );
+		loader.setWithCredentials( this.withCredentials );
 		loader.setPath( this.path );
 		loader.setPath( this.path );
 		loader.load( url, function ( image ) {
 		loader.load( url, function ( image ) {
 
 
@@ -50,6 +51,13 @@ Object.assign( TextureLoader.prototype, {
 
 
 	},
 	},
 
 
+	setWithCredentials: function ( value ) {
+
+		this.withCredentials = value;
+		return this;
+
+	},
+
 	setPath: function ( value ) {
 	setPath: function ( value ) {
 
 
 		this.path = value;
 		this.path = value;
@@ -57,6 +65,8 @@ Object.assign( TextureLoader.prototype, {
 
 
 	}
 	}
 
 
+
+
 } );
 } );