engine icon indicating copy to clipboard operation
engine copied to clipboard

Glb container parse event

Open pavle-goloskokovic opened this issue 2 years ago • 3 comments

This PR introduces change where parse event is fired on a container asset to indicate that data was downloaded and parsing is about to begin.

This functionality adds more control over loading process, where e.g. we can start loading low priority assets immediately after container asset has downloaded, without needing to wait for its parsing as well, in effect shortening total loading time.

pavle-goloskokovic avatar May 02 '23 13:05 pavle-goloskokovic

any thoughts on this one @slimbuck ?

mvaligursky avatar May 11 '23 11:05 mvaligursky

Isn't preprocess is suitable for this case?

Documentation

const containerAsset = new pc.Asset(filename, 'container', { url: url, filename: filename }, null, {
    global: {
        preprocess() { console.log("parsing is about to begin"); }
    },
});

querielo avatar May 19 '23 17:05 querielo

Isn't preprocess is suitable for this case?

Documentation

const containerAsset = new pc.Asset(filename, 'container', { url: url, filename: filename }, null, {
    global: {
        preprocess() { console.log("parsing is about to begin"); }
    },
});

Unfortunately not since preprocess callback is called within createResources method after parsing is already done: https://github.com/playcanvas/engine/blob/cee326b46c4025b16a3c301fd285c6319e5793a7/src/framework/parsers/glb-parser.js#L2470

pavle-goloskokovic avatar May 20 '23 11:05 pavle-goloskokovic