Thank you for your answer.
So my problem was that i didn’t enable engine.enableOfflineSupport = true
Looks like it is must have property for feature.
I’ve tried to enable it in my project and got next results:
I added your code which overrides offline factory to disable manifest checks
.babylon files. engine.enableOfflineSupport = false; IDBStorageEnabled = false;
result: nothing cached. it’s expected because feature is disabled
.babylon files. engine.enableOfflineSupport = true; IDBStorageEnabled = false;
result: nothing cached. I assume it’s expected because the only offline provider indexedDB is disabled.
.babylon files. engine.enableOfflineSupport = false; IDBStorageEnabled = true;
result: nothing cached. I assume it’s expected because engine feature is disabled. Such combination can be in case i have 2 engines one with disabled feature and another with enabled.
.babylon files. engine.enableOfflineSupport = true; IDBStorageEnabled = true;
result: everything is cached. I have 10 meshes and all of them was cached. when i refresh page, I don’t see any requests for those meshes in network tab. expected result.
At the moment everything looks pretty good.
But now i will remove code which overrides offline factory. Results are strange:
.babylon files. engine.enableOfflineSupport = false; IDBStorageEnabled = false;
result: nothing cached. no manifest checks. it’s expected because feature is disabled
.babylon files. engine.enableOfflineSupport = true; IDBStorageEnabled = false;
result: nothing cached. no manifest checks. it’s expected because the only offline provider is disabled
.babylon files. engine.enableOfflineSupport = false; IDBStorageEnabled = true;
result: nothing cached. no manifest checks. it’s expected because feature is disabled. Such combination can be in case i have 2 engines one with disabled feature and another with enabled.
.babylon files. engine.enableOfflineSupport = true; IDBStorageEnabled = true;
result: only last loaded mesh was saved to cache(???). All meshes was manifest checked. After page refresh cached mesh was loaded from DB.
Do you have any thoughts?
I used next code:
private static fieldTypes = ['balanceField', 'balanceXField', 'forestField', 'forestXField', 'waterField', 'waterXField',
'mountainField', 'mountainXField', 'sandField', 'sandXField'];
this.battleFieldMeshContainers = new Map<string, BABYLON.AssetContainer>();
const meshPromises = [];
/* Loading of all fields meshes */
AppComponent.fieldTypes.forEach(fieldType => {
const promise = BABYLON.SceneLoader.LoadAssetContainerAsync(AppComponent.fieldsRootUrl,
fieldType + '.' + this.fileType, this._battleFieldScene);
meshPromises.push(promise);
promise.then(container => {
this.battleFieldMeshContainers.set(fieldType, container);
});
});
I’m loading meshes like that with idea to load all meshes and then to build battlefield with data which came from server(it can be different each time). UI can take meshes from map and clone them and put in right coordinates.
I wonder maybe manifest checks doesn’t combinable with async loading
Also I have question:
I found that babylon examples are using babylonbinarymeshdata format. Babylon docs doesn’t have any info about it. How can i get such binary format? Can babylon cache it? I assume no because it is binary like glb
Thanks