EXT_meshopt_compression - How to?

Hi guys!
Has anyone a working example of using this extension in a standalone (not a PG) code? I couldn’t get it working.

What I already did:
Switched to ^5.0.0-alpha.36

import { GLTFLoader, IGLTFLoaderExtension } from '@babylonjs/loaders/glTF/2.0'
import { EXT_meshopt_compression } from '@babylonjs/loaders/glTF/2.0'
    EXT_meshopt_compression.DecoderPath = '/path/to/meshopt_decoder.js'
    GLTFLoader.RegisterExtension(
      'EXT_meshopt_compression',
      (loader) => {
        return new EXT_meshopt_compression(loader)
      }
    )

EDIT: Without errors, but no meshes. The glb files are packed using gltfpack with these two parameters -cc -tc.

Anyone? Thanks!

R.

Adding @bghgary who masters gltf

1 Like

I don’t think you want to do this. It may cause problems. This code should already exist as a side effect of the extension. Can you set up a repro on codepen.io or something similar so we can try to help?

Hi @bghgary!

So I don’t need to register this extension to deal with compressed glbs?
Thanks!

I don’t believe so. If you can look at the bundled result, it should already have this code in it.

You are right, it is working on 5.0.0.
Thank you!

Is there a way to use this extension with 4.2.0?

This extension was added after 4.2. It should be possible if you copy the code (including the wasm modules) and register the loader extension yourself in 4.2.

Thank you!

1 Like