Skip to content

Commit e8d2b08

Browse files
committed
ImageUtils: Use TextureLoader in loadTexture().
1 parent aa47670 commit e8d2b08

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/extras/ImageUtils.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,16 @@ THREE.ImageUtils = {
1010

1111
loadTexture: function ( url, mapping, onLoad, onError ) {
1212

13-
var loader = new THREE.ImageLoader();
14-
loader.crossOrigin = this.crossOrigin;
15-
16-
var texture = new THREE.Texture( undefined, mapping );
13+
var loader = new THREE.TextureLoader();
14+
loader.setCrossOrigin( this.crossOrigin );
1715

18-
loader.load( url, function ( image ) {
19-
20-
texture.image = image;
21-
texture.needsUpdate = true;
16+
var texture = loader.load( url, function ( texture ) {
2217

2318
if ( onLoad ) onLoad( texture );
2419

25-
}, undefined, function ( event ) {
26-
27-
if ( onError ) onError( event );
28-
29-
} );
20+
}, undefined, onError );
3021

22+
texture.mapping = mapping;
3123
texture.sourceFile = url;
3224

3325
return texture;

0 commit comments

Comments
 (0)