Dear All!
I would like to add a glb/gltf model to my scene. Everything works fine when the model is on the same server than the app itself. But I wish to store the individual models on a different server. In this case, Cesium is unable to download the models and the corresponding textures.
If I simply insert the url into a new browser window, it is accessible with no problem. I guess this is because of CORS, but I have no idea how I could solve it.
My code looks like this:
var viewer = new Cesium.Viewer('cesiumContainer');
var czml = [
{
"id": "document",
"name": "CZML Model",
"version": "1.0"
},
{
"id": "varoshaz",
"name": "2534_1_Varoshaz_ter_9a_E94E_georef3",
"position": {
"cartographicDegrees": [20.775372, 48.102767, 0]
},
"model": {
"gltf": "https://myserver/models/collada/varoshaz.glb",
"scale": 1,
"minimumPixelSize": 128
}
}
];
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(dataSource){
viewer.zoomTo(dataSource);
}).otherwise(function(error){
window.alert(error);
});
I actually provided a solution, but it makes everything quite slow: I built a Java proxy for the glb file; in that case, the model is downloaded, but the textures are again not loaded. I had to modify the model itself, and the texture reference url-s were manually replaced to a proxied url. After that, the models could be downloaded, but so much slower than it was when the models were stored locally.
I would like to avoid proxying everything if it is possible in some ways.
Any help is highly appreciated!
Gergely