|
@@ -10,24 +10,16 @@ THREE.ImageUtils = {
|
|
|
|
|
|
loadTexture: function ( url, mapping, onLoad, onError ) {
|
|
loadTexture: function ( url, mapping, onLoad, onError ) {
|
|
|
|
|
|
- var loader = new THREE.ImageLoader();
|
|
|
|
- loader.crossOrigin = this.crossOrigin;
|
|
|
|
-
|
|
|
|
- var texture = new THREE.Texture( undefined, mapping );
|
|
|
|
|
|
+ var loader = new THREE.TextureLoader();
|
|
|
|
+ loader.setCrossOrigin( this.crossOrigin );
|
|
|
|
|
|
- loader.load( url, function ( image ) {
|
|
|
|
-
|
|
|
|
- texture.image = image;
|
|
|
|
- texture.needsUpdate = true;
|
|
|
|
|
|
+ var texture = loader.load( url, function ( texture ) {
|
|
|
|
|
|
if ( onLoad ) onLoad( texture );
|
|
if ( onLoad ) onLoad( texture );
|
|
|
|
|
|
- }, undefined, function ( event ) {
|
|
|
|
-
|
|
|
|
- if ( onError ) onError( event );
|
|
|
|
-
|
|
|
|
- } );
|
|
|
|
|
|
+ }, undefined, onError );
|
|
|
|
|
|
|
|
+ texture.mapping = mapping;
|
|
texture.sourceFile = url;
|
|
texture.sourceFile = url;
|
|
|
|
|
|
return texture;
|
|
return texture;
|