After receiving the tile, I call the loadprogress method and locally on the computer I get the following picture (see screenshot 2)
I inserted the same code into the cesium sandbox and everything works there.
what is the problem? I don’t see any errors
Just to confirm: Can you try out this code, and see whether it works as expected:
You may also try adding the tileset to the viewer, which doesn’t seem to be done in your code, but … who knows, it’s not really code, it’s just an image of code…
sorry here is all the code that works in the sandbox but doesn’t work locally
class MapService {
constructor() {
this.viewer = new Cesium.Viewer(‘cesiumContainer’, {
timeline: false,
animation: false,
sceneModePicker: false,
baseLayerPicker: false,
});
this.viewer.scene.globe.show = false;
this.init();
}
async init() {
try {
const tileset = await Cesium.createGooglePhotorealistic3DTileset();
tileset.loadProgress.addEventListener(function (
numberOfPendingRequests,
numberOfTilesProcessing,
) {
if (numberOfPendingRequests === 0 && numberOfTilesProcessing === 0) {
console.log('Stopped loading');
return;
}
console.log(
`Loading: requests: ${numberOfPendingRequests}, processing: ${numberOfTilesProcessing}`,
);
});
if (this.viewer) {
console.log('++');
this.viewer.scene.primitives.add(tileset);
}
} catch (error) {
console.log(`Error loading Photorealistic 3D Tiles tileset.${error}`);
}
this.viewer.scene.camera.setView({
destination: new Cesium.Cartesian3(
-2693797.551060477,
-4297135.517094725,
3854700.7470414364,
),
orientation: new Cesium.HeadingPitchRoll(
4.6550106925119925,
-0.2863894863138836,
1.3561760425773173e-7,
),
});
}
}
new MapService();
@Marco13 your example also doesn’t work as expected, since the implementation via the class works in a sandbox. One more clarification - I’m using React
The code that you posted indeed seems to work in a Sandcastle.
If it does not work in your context:
What happens when you open the ‘Network’ tab in the Broswer debug window, and then start the example? Does it send out any requests, and could it be that some of these requests cause an error?
my Network.
As you can see, requests are not being fulfilled.
@Marco13
@Marco13 I get an error
Error loading Photorealistic 3D Tiles tileset.DeveloperError: primitive is required.
Error
** at new DeveloperError (DeveloperError.js:39:1)**
** at PrimitiveCollection.add (PrimitiveCollection.js:106:1)**
** at MapService.initDefault3DTile (MapService.ts:149:1)**