FBXLoader: Import inflate.min.js

Description of the problem

Error: FBXLoader: Import inflate.min.js from https://github.com/imaya/zlib.js
at BinaryParser.parseProperty (FBXLoader.js:4273)
at BinaryParser.parseNode (FBXLoader.js:3994)
at BinaryParser.parseNode (FBXLoader.js:4018)
at BinaryParser.parseNode (FBXLoader.js:4018)
at BinaryParser.parse (FBXLoader.js:3935)
at THREE.FBXLoader.parse (FBXLoader.js:95)
at FBXLoader.js:61
at XMLHttpRequest. (three.js:29871)

Three.js version
  • Dev
  • r85
Browser
  • [] All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • [] All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

4 thoughts on “FBXLoader: Import inflate.min.js

  1. BTW: I used the following threejs-example for reference (http://threejs.live/#/webgl_loader_fbx), but this example uses fbxloader2, which i couldn’t find anywhere in the web.

    Please don’t rely on this URL. It’s not maintained by the project. You can find the official list of examples with the latest three.js version right here:

    https://threejs.org/examples/

    Use the inflate.min.js version of the following example. It works with the latest version of FBXLoader.

  2. @Mugen87 Thanks, now it works!
    Althought I couldn’t get it running by loading libs via require, but it worked when I load it via scripttags in my template, like in the example you mentioned. 👍

  3. I managed to do it using what @yuanzhaokang like this:

    import { inflate } from 'zlib.es';

    And in the FBXloader (as a module)

    //   if (typeof Zlib === 'undefined') {
              //     console.error(
              //       'THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js'
              //     );
              //   }
    
              //   var inflate = Zlib.Inflate(new Uint8Array(reader.getArrayBuffer(compressedLength))); // eslint-disable-line no-undef
              var reader2 = new BinaryReader(
                inflate(new Uint8Array(reader.getArrayBuffer(compressedLength))).buffer
              );
    

Comments are closed.