src/asset-manager.js
/**
   * Returns a promise that resolves to a bound mesh.
   * @param  {String} name Mesh internal name
   * @return {Promise}     Resolves to the bound mesh.
   */
Returns a promise that resolves to a bound mesh.
@param  {String} name Mesh internal name
@return {Promise}     Resolves to the bound mesh.
Returns a promise that resolves to a bound mesh . @param { String } name Mesh internal name @return { Promise } Resolves to the bound mesh .
loadMesh(name) {
    if (!(name in this.manifest.mesh)) {
      return Promise.reject(new Error('Unknown mesh ' + name));
    } else if (this.meshes[name]) {
      this._recordUsage('mesh', name);
      return Promise.resolve(this.meshes[name]);
    } else {
      let asset = this.manifest.mesh[name];
      return this.loader.loadAsset(this._getFullPath(asset.static, asset.path), 'arraybuffer')
        .then((mesh) => {
          if (!this.meshes[name]) {
            this.meshes[name] = new FileMesh(this._gl, mesh);
          }
          this._recordUsage('mesh', name);
          return this.meshes[name];
        });
    }
  }
loadMesh ( name ) { if ( ! ( name in this . manifest . mesh ) ) { return Promise . reject ( new Error ( 'Unknown mesh ' + name ) ) ; } else if ( this . meshes [ name ] ) { this . _recordUsage ( 'mesh' , name ) ; return Promise . resolve ( this . meshes [ name ] ) ; } else { let asset = this . manifest . mesh [ name ] ; return this . loader . loadAsset ( this . _getFullPath ( asset . static , asset . path ) , 'arraybuffer' ) . then ( ( mesh ) => { if ( ! this . meshes [ name ] ) { this . meshes [ name ] = new FileMesh ( this . _gl , mesh ) ; } this . _recordUsage ( 'mesh' , name ) ; return this . meshes [ name ] ; } ) ; } }
Returns a promise that resolves to a bound mesh.
Returns a promise that resolves to a bound mesh .