提交 96a2f631 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #11393 from Mugen87/dev

ColladaLoader2: Fixed Textures
......@@ -16,10 +16,14 @@ THREE.ColladaLoader.prototype = {
var scope = this;
var resourceDirectory = url.split( /[\\\/]/ );
resourceDirectory.pop();
resourceDirectory = resourceDirectory.join( '/' ) + '/';
var loader = new THREE.FileLoader( scope.manager );
loader.load( url, function ( text ) {
onLoad( scope.parse( text ) );
onLoad( scope.parse( text, resourceDirectory ) );
}, onProgress, onError );
......@@ -29,7 +33,7 @@ THREE.ColladaLoader.prototype = {
set convertUpAxis( value ) {
console.log( 'ColladaLoder.options.convertUpAxis: TODO' );
console.log( 'ColladaLoader.options.convertUpAxis: TODO' );
}
......@@ -41,7 +45,7 @@ THREE.ColladaLoader.prototype = {
},
parse: function ( text ) {
parse: function ( text, resourceDirectory ) {
function getElementsByTagName( xml, name ) {
......@@ -188,7 +192,7 @@ THREE.ColladaLoader.prototype = {
if ( data.build !== undefined ) return data.build;
return new Image();
return data.init_from;
}
......@@ -572,7 +576,7 @@ THREE.ColladaLoader.prototype = {
var surface = effect.profile.surfaces[ sampler.source ];
var texture = new THREE.Texture( getImage( surface.init_from ) );
var texture = textureLoader.load( getImage( surface.init_from ) );
var extra = textureObject.extra;
......@@ -583,8 +587,8 @@ THREE.ColladaLoader.prototype = {
texture.wrapS = technique.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
texture.wrapT = technique.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
texture.offset.set( technique.offsetU, technique.offsetV );
texture.repeat.set( technique.repeatU, technique.repeatV );
texture.offset.set( technique.offsetU || 0, technique.offsetV || 0 );
texture.repeat.set( technique.repeatU || 1, technique.repeatV || 1 );
} else {
......@@ -593,13 +597,11 @@ THREE.ColladaLoader.prototype = {
}
texture.needsUpdate = true;
return texture;
}
console.error( 'ColladaLoder: Undefined sampler', textureObject.id );
console.error( 'ColladaLoader: Undefined sampler', textureObject.id );
return null;
......@@ -1527,6 +1529,7 @@ THREE.ColladaLoader.prototype = {
console.log( 'ColladaLoader: File version', version );
var asset = parseAsset( getElementsByTagName( collada, 'asset' )[ 0 ] );
var textureLoader = new THREE.TextureLoader( this.manager ).setPath( resourceDirectory );
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册