var manager = new THREE.LoadingManager();
manager.onStart = function (item, loaded, total) {
console.log('Loading started');
};
manager.onLoad = function () {
console.log('Loading complete');
bar.destroy();
};
manager.onProgress = function (item, loaded, total) {
console.log(item, loaded, total);
console.log('Loaded:', Math.round(loaded / total * 100, 2) + '%')
bar.animate(1.0);
};
manager.onError = function (url) {
console.log('Error loading');
};
var mtlLoader = new MTLLoader(manager);
mtlLoader.setPath('media/' + this.missionId + '/3D/Model/');
mtlLoader.load('threed.mtl', function(materials) {
materials.preload();
materials.materials.texture.map.magFilter = THREE.NearestFilter;
materials.materials.texture.map.minFilter = THREE.LinearFilter;
OBJLoader(THREE);
var objLoader = new THREE.OBJLoader(manager);
objLoader.setMaterials(materials);
objLoader.setPath('media/' + scope.missionId + '/3D/Model/');
objLoader.load('threed.obj', function(object) {
object.traverse(function(child) {
if (child instanceof THREE.Mesh) {
scope.objects.push(child);
}
});
scope.scene.add(object);
console.log('Object::', object);
});
});