提交 e96712e6 编写于 作者: M Mr.doob

ImageUtils: Use CubeTextureLoader in loadTextureCube.

上级 839efa18
......@@ -20,48 +20,23 @@ THREE.ImageUtils = {
}, undefined, onError );
texture.mapping = mapping;
texture.sourceFile = url;
return texture;
},
loadTextureCube: function ( array, mapping, onLoad, onError ) {
loadTextureCube: function ( urls, mapping, onLoad, onError ) {
var images = [];
var loader = new THREE.ImageLoader();
loader.crossOrigin = this.crossOrigin;
var texture = new THREE.CubeTexture( images, mapping );
var loaded = 0;
function loadTexture( i ) {
loader.load( array[ i ], function ( image ) {
texture.images[ i ] = image;
loaded += 1;
if ( loaded === 6 ) {
texture.needsUpdate = true;
if ( onLoad ) onLoad( texture );
}
}, undefined, onError );
var loader = new THREE.CubeTextureLoader();
loader.setCrossOrigin( this.crossOrigin );
}
var texture = loader.load( urls, function ( texture ) {
for ( var i = 0, il = array.length; i < il; ++ i ) {
if ( onLoad ) onLoad( texture );
loadTexture( i );
}, undefined, onError );
}
texture.mapping = mapping;
return texture;
......
......@@ -14,11 +14,9 @@ THREE.TextureLoader.prototype = {
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var texture = new THREE.Texture();
var loader = new THREE.ImageLoader( scope.manager );
var loader = new THREE.ImageLoader( this.manager );
loader.setCrossOrigin( this.crossOrigin );
loader.load( url, function ( image ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册