Hi BabylonJS team
In current version 7.24 the type definition for CreateScreenshotUsingRenderTarget
(and CreateScreenshotUsingRenderTargetAsync
) is missing the last argument customizeTexture
-callback. Not sure how many versions that is affected.
My current workaround is to cast the screenshot function to any
before using it.
Here is a playground showing the problem
And here is the interesting code snippet from the playground:
// ***** This gives us Typescript errors ******* //
// BABYLON.Tools.CreateScreenshotUsingRenderTarget(engine, camera, {precision: 1.0}, undefined, undefined, undefined, false, undefined, false, false, true, undefined, (texture) => {
// texture.renderList = [ground];
// texture.useCameraPostProcesses = false;
// });
// ***** This works ****** //
const screenshotfunction_untyped = BABYLON.Tools.CreateScreenshotUsingRenderTarget as any
screenshotfunction_untyped(engine, camera, {precision: 1.0}, undefined, undefined, undefined, false, undefined, false, false, true, undefined, (texture) => {
texture.renderList = [ground];
texture.useCameraPostProcesses = false;
});