2018-12-10 20:53:39 +08:00

29 lines
750 B
JavaScript

import BaseLoader from './BaseLoader';
/**
* BinaryLoader
* @author tengge / https://github.com/tengge1
*/
function BinaryLoader() {
BaseLoader.call(this);
}
BinaryLoader.prototype = Object.create(BaseLoader.prototype);
BinaryLoader.prototype.constructor = BinaryLoader;
BinaryLoader.prototype.load = function (url) {
return new Promise(resolve => {
this.require('BinaryLoader').then(() => {
var loader = new THREE.BinaryLoader();
loader.load(url, (geometry, materials) => {
var mesh = new THREE.Mesh(geometry, materials);
resolve(mesh);
}, undefined, () => {
resolve(null);
});
});
});
};
export default BinaryLoader;