How to use the aframe/src.THREE.FileLoader function in aframe

To help you get started, we’ve selected a few aframe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kabbi / zanzarah-tools / src / components / fs-xhr.js View on Github external
init() {
    const { el: { components: { fs } } } = this;
    const { path, indexPath } = this.data;

    let indexPromise = null;
    const loader = new THREE.FileLoader();
    loader.setPath(path);

    const fetchIndex = () => {
      info('Fetching index for the first time');
      return fetchJson(`${path}${indexPath}`).then(index => ({
        indexMap: keyBy(index),
        index,
      }));
    };

    this.cleanup = fs.registerFileSystem({
      id: 'xhr',
      load(options, onLoad, onProgress, onError) {
        const { url, responseType } = options;
        loader.setResponseType(responseType);
        loader._originalLoad(url, onLoad, onProgress, onError);
github kabbi / zanzarah-tools / src / three / BSPLoader.js View on Github external
load(url, onLoad, onProgress, onError) {
    verbose('Loading data %s', url);
    this._url = url;
    const loader = new THREE.FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setResponseType('blob');
    loader.load(url, blob => {
      verbose('Loaded data from %s, %d bytes', url, blob.size);
      jBinary.load(blob, typeSet).then(binary => {
        onLoad(this.parse(binary.readAll()), this._meta);
      }).catch(err => {
        error('Fatal error', err);
        if (onError) {
          onError(err);
        }
      });
    }, onProgress, onError);
  }
github kabbi / zanzarah-tools / src / three / SKALoader.js View on Github external
load(url, onLoad, onProgress, onError) {
    verbose('Loading data %s', url);
    const loader = new THREE.FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setResponseType('blob');
    loader.load(url, blob => {
      verbose('Loaded data from %s, %d bytes', url, blob.size);
      jBinary.load(blob, typeSet).then(binary => {
        onLoad(this.parse(binary.readAll()));
      }).catch(err => {
        error('Fatal error', err);
        if (onError) {
          onError(err);
        }
      });
    }, onProgress, onError);
  }
github kabbi / zanzarah-tools / src / systems / loader.js View on Github external
handleAED(fileName) {
    const loader = new THREE.FileLoader();
    loader.setPath(getRootPath());
    loader.setResponseType('blob');
    loader.load(fileName, blob => {
      jBinary.load(blob, actorTypeSet).then(binary => {
        const actor = binary.readAll();
        this.target.appendChild(
          
        );
      }).catch(err => {
        warn('Error parsing actor: %o', err);
      });
    });
  },
github kabbi / zanzarah-tools / src / three / DFFLoader.js View on Github external
load(url, onLoad, onProgress, onError) {
    verbose('Loading data %s', url);
    const loader = new THREE.FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setResponseType('blob');
    loader.load(url, blob => {
      verbose('Loaded data from %s, %d bytes', url, blob.size);
      jBinary.load(blob, typeSet).then(binary => {
        onLoad(this.parse(binary.readAll(), url));
      }).catch(err => {
        error('Fatal error', err);
        if (onError) {
          onError(err);
        }
      });
    }, onProgress, onError);
  }