Model.fromGLTF JSON instead of url

I’m in the need to show gltf download progress, I do that manually when done, I have the gltf string how do I create a model using the JSON data instead of the url.

The API mentions: “An external glTF asset is created with Model.fromGltf. glTF JSON can also be created at runtime and passed to this constructor function”

But I can’t find any examples on how to do it.

Thanks

Hello,

Currently, the only way to add a model using the Entity API is to use a URI. However, you can add a model using a javascript object by creating a new Model and passing in the object. Here is an example:

var gltf = //my JSON data
var model = scene.primitives.add(new Cesium.Model({
gltf: gltf
}));

``

Best,

Hannah

Wow thanks for the quick response got it working thanks!