Load progress

1. Hi,

I’m loading a big (none tiled) gltf to my viewer. (60 M). I need to provide my users with indication on download and on rendering.

**Currently I’m flying the camera the the model position and after some time the model just appears. The download time may take a few seconds and the rendering time on my strong development computer is 15 seconds. I will build the floating loading indicator, but I need some callbacks: **

a) download progress

b) rendering progress (or at least - end rendering)

Is it Possible?

I’m using Trunk version of Cesium

Cesium doesn’t support loading progress for models right now. But models do have a readyPromise that lets you know when its finished: https://cesiumjs.org/Cesium/Build/Documentation/Model.html?classFilter=Model#readyPromise.

Thanks Sean,
The readyPromise belongs to Cesuim.Model.
But I'm adding my models as Entities. and the Entitiy's modelGraphic
doesn't expose this promise.
Is there a way to get the Entity underlying Model?

Dror

Oh ok, you’re right that it’s not available from the Entity API. A workaround is to add the entity and get the last primitive from viewer.scene.primitives.

Sean,
The scene.primitives collection does not contain the model until the model is loaded so this does not solve the issue.

This is what I did eventually:

function waitForLoading() {

setTimeout(function () {

// create a recursive loop.

var premCollection = viewer.scene.primitives;

var lastPrem = (premCollection._primitives.length) -1;

if(premCollection._primitives[lastPrem] instanceof Cesium.Model)

{

premCollection._primitives[lastPrem].readyPromise.then(function() {

document.getElementById(‘loadingpanel’).style.display = ‘none’;

document.getElementById(‘loading-image’).style.display = ‘none’;

});

}

else

{

waitForLoading();

}

}, 500);

}

Dor

Alright, sorry there isn’t a simpler solution for this.