Hi, I’m trying to render a model in a HDR environment and capture a screen shot after the model is loaded. At first I used synchronous append function:
await new Promise((resolve) => {
SceneLoader.Append(modelRootPath, modelFileName, this[$scene], () => {
captureScreenShots(); // a capture screenshots function I wrote by myself
resolve();
});
});
I thought this should be correct because I call captureScreenshots() in the onSuccess() argument, which means it should be called when model has been loaded? But in fact captureScreenShots is called before the model is loaded, and the screenshot just has a environment in it. So I tried the async version of append function:
await SceneLoader.AppendAsync(modelRootPath, modelFileName, this[$scene]).then(()=>{
captureScreenShots();
})
But the result is still the same. I think the key is to know when SceneLoader.AppendAsync() has actually finished loading model. Thank you!
PS the model is rendered correctly, just the screenshot doesn’t have model in it.