GLTFParser constructor

GLTFParser(
  1. dynamic json,
  2. Map<String, dynamic>? options
)

Implementation

GLTFParser(json, Map<String, dynamic>? options) {
  this.json = json ?? {};
  this.extensions = {};
  this.plugins = {};
  this.options = options ?? {};

  // loader object cache
  this.cache = new GLTFRegistry();

  this.textureCache = {};
  this.sourceCache = {};

  // associations between Three.js objects and glTF elements
  this.associations = new Map();

  // BufferGeometry caching
  this.primitiveCache = {};

  // Object3D instance caches
  this.meshCache = {"refs": {}, "uses": {}};
  this.cameraCache = {"refs": {}, "uses": {}};
  this.lightCache = {"refs": {}, "uses": {}};

  // Track node names, to ensure no duplicates
  this.nodeNamesUsed = {};

  // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
  // expensive work of uploading a texture to the GPU off the main thread.
  // if ( createImageBitmap != null && /Firefox/.test( navigator.userAgent ) == false ) {
  //   this.textureLoader = new ImageBitmapLoader( this.options.manager );
  // } else {
  this.textureLoader = new TextureLoader(this.options["manager"]);
  // }

  this.textureLoader.setCrossOrigin(this.options["crossOrigin"]);
  this.textureLoader.setRequestHeader(this.options["requestHeader"]);

  this.fileLoader = new FileLoader(this.options["manager"]);
  this.fileLoader.setResponseType('arraybuffer');

  if (this.options["crossOrigin"] == 'use-credentials') {
    this.fileLoader.setWithCredentials(true);
  }

  this.loadBufferView = loadBufferView2;
}