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