freetoplay

Using glTF extensions question

Recommended Posts

I want to load a file with the draco compression extension, I am doing something like this:

BABYLON.SceneLoader.Append("https://rawgit.com/KhronosGroup/glTF-Sample-Models/master/2.0/Duck/glTF-Draco/", "Duck.gltf", scene, function (scene) {
// do something
}

This works fine, but how do I know if the draco compression extension has been applied? The reason I am asking is the documentation for "append" accepts a parameter called pluginExtension, so I am not sure if I need to explicitly pass in the extension or it's done automatically.

Share this post


Link to post
Share on other sites

The draco compression extension is used automatically, if you have a v2 model. The loader v1 or v2 is chosen based on the file version:
https://doc.babylonjs.com/how_to/gltf#full-version

You can read more about the decoder here:
https://doc.babylonjs.com/api/classes/babylon.dracocompression

Use BABYLON.DracoCompression.DecoderAvailable to determine if the decoder is available for the current session.

 

16 minutes ago, freetoplay said:

The reason I am asking is the documentation for "append" accepts a parameter called pluginExtension

I think that's only if you want to override, because an appropriate loader will be used based on the file extension. ie: you can force a gltf loader on a file missing an extension:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Loading/babylon.sceneLoader.ts#L251

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.