vendor/GLTFExporter.js
function processBufferViewImage(blob) {
      if (!outputJSON.bufferViews) {
        outputJSON.bufferViews = [];
      }

      return new Promise(function(resolve) {
        var reader = new window.FileReader();
        reader.readAsArrayBuffer(blob);
        reader.onloadend = function() {
          var buffer = getPaddedArrayBuffer(reader.result);

          var bufferView = {
            buffer: processBuffer(buffer),
            byteOffset: byteOffset,
            byteLength: buffer.byteLength
          };

          byteOffset += buffer.byteLength;

          outputJSON.bufferViews.push(bufferView);

          resolve(outputJSON.bufferViews.length - 1);
        };
      });
    }
function processBufferViewImage(blob) {
      if (!outputJSON.bufferViews) {
        outputJSON.bufferViews = [];
      }

      return new Promise(function(resolve) {
        var reader = new window.FileReader();
        reader.readAsArrayBuffer(blob);
        reader.onloadend = function() {
          var buffer = getPaddedArrayBuffer(reader.result);

          var bufferView = {
            buffer: processBuffer(buffer),
            byteOffset: byteOffset,
            byteLength: buffer.byteLength
          };

          byteOffset += buffer.byteLength;

          outputJSON.bufferViews.push(bufferView);

          resolve(outputJSON.bufferViews.length - 1);
        };
      });
    }
function processBufferViewImage ( blob ) { if ( ! outputJSON . bufferViews ) { outputJSON . bufferViews = [ ] ; } return new Promise ( function ( resolve ) { var reader = new window . FileReader ( ) ; reader . readAsArrayBuffer ( blob ) ; reader . onloadend = function ( ) { var buffer = getPaddedArrayBuffer ( reader . result ) ; var bufferView = { buffer : processBuffer ( buffer ) , byteOffset : byteOffset , byteLength : buffer . byteLength } ; byteOffset += buffer . byteLength ; outputJSON . bufferViews . push ( bufferView ) ; resolve ( outputJSON . bufferViews . length - 1 ) ; } ; } ) ; }
Process and generate a BufferView from an image Blob.
@param {Blob} blob
@return {Promise<Integer>}
Process and generate a BufferView from an image Blob .