var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var onError = function ( xhr ) {};
THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
if (name == "House"){
var loader = new THREE.OBJMTLLoader();
loader.load( 'models/House/house_obj/house_obj.obj', 'models/House/house_obj/house_obj.mtl', function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material.side = THREE.DoubleSide;
}
} );
object.rotation.x = Math.PI/2;
var scale = 0.15/ (MapWidth*0.5/3);//upsos tabani
object.scale.set(scale,scale,scale);
House = object;
}, onProgress, onError );
}
this is the code i used.. In this example i check if the user select to insert a house model. The onProgress and onError functions state the completeness of the loader. I use OBJMTLLoader.js and DDSLoader.js
loader.load()
are most probably wrong. Take a look at the example threejs.org/examples/#webgl_loader_obj_mtl and try to load your object. – gaitat