Variable ScreenshotToolsConst
CreateScreenshot: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
successCallback?: (data: string) => void,
mimeType?: string,
forceDownload?: boolean,
quality?: number,
useFill?: boolean,
clearWithSceneColor?: boolean,
) => void;
CreateScreenshotAsync: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
quality?: number,
useFill?: boolean,
clearWithSceneColor?: boolean,
forceDownload?: boolean,
) => Promise<string>;
CreateScreenshotForFrameGraphAsync: (
frameGraph: FrameGraph,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
quality?: number,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
automaticDownload?: boolean,
numberOfFramesToRender?: number,
) => Promise<string | ArrayBuffer | null>;
CreateScreenshotUsingRenderTarget: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
successCallback?: (data: string) => void,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
renderSprites?: boolean,
enableStencilBuffer?: boolean,
useLayerMask?: boolean,
quality?: number,
customizeTexture?: (texture: RenderTargetTexture) => void,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
timeoutInMilliseconds?: number,
timeoutErrorCallback?: () => void,
) => void;
CreateScreenshotUsingRenderTargetAsync: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
renderSprites?: boolean,
enableStencilBuffer?: boolean,
useLayerMask?: boolean,
quality?: number,
customizeTexture?: (texture: RenderTargetTexture) => void,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
) => Promise<string>;
CreateScreenshotWithResizeAsync: (
engine: AbstractEngine,
camera: Camera,
width: number,
height: number,
mimeType?: string,
quality?: number,
useFill?: boolean,
) => Promise<void>;
} = ...
Type Declaration
-
CreateScreenshot: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
successCallback?: (data: string) => void,
mimeType?: string,
forceDownload?: boolean,
quality?: number,
useFill?: boolean,
clearWithSceneColor?: boolean,
) => voidCaptures a screenshot of the current rendering Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: camera
defines the source camera. If the camera is not the scene's active camera, CreateScreenshotUsingRenderTarget will be used instead, and
useFillwill be ignoredParam: size
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Param: successCallback
defines the callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
Param: mimeType
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter. -
CreateScreenshotAsync: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
quality?: number,
useFill?: boolean,
clearWithSceneColor?: boolean,
forceDownload?: boolean,
) => Promise<string>Captures a screenshot of the current rendering Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: camera
defines the source camera. If the camera is not the scene's active camera, CreateScreenshotUsingRenderTarget will be used instead, and
useFillwill be ignoredParam: size
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Param: mimeType
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter. -
CreateScreenshotForFrameGraphAsync: (
frameGraph: FrameGraph,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
quality?: number,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
automaticDownload?: boolean,
numberOfFramesToRender?: number,
) => Promise<string | ArrayBuffer | null>Generates an image screenshot from the specified frame graph and camera Please note:
- that the frame graph must write to the back buffer color for this to work! This is because the back buffer color is replaced by the texture of the screenshot during the operation.
- the camera is set as the camera for the main object renderer of the frame graph during the operation, and restored afterwards. This will only work if the frame graph has a main object renderer (isMainObjectRenderer is true for one of its object renderers)
- that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: size
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Param: mimeType
The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter.Param: customDumpData
The function to use to dump the data. If not provided, the default DumpData function will be used.
-
CreateScreenshotUsingRenderTarget: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
successCallback?: (data: string) => void,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
renderSprites?: boolean,
enableStencilBuffer?: boolean,
useLayerMask?: boolean,
quality?: number,
customizeTexture?: (texture: RenderTargetTexture) => void,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
timeoutInMilliseconds?: number,
timeoutErrorCallback?: () => void,
) => voidGenerates an image screenshot from the specified camera. Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: size
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Param: successCallback
The callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
Param: mimeType
The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter. -
CreateScreenshotUsingRenderTargetAsync: (
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
mimeType?: string,
samples?: number,
antialiasing?: boolean,
fileName?: string,
renderSprites?: boolean,
enableStencilBuffer?: boolean,
useLayerMask?: boolean,
quality?: number,
customizeTexture?: (texture: RenderTargetTexture) => void,
customDumpData?: (
width: number,
height: number,
data: ArrayBufferView,
successCallback?: (data: string | ArrayBuffer) => void,
mimeType?: string,
fileName?: string,
invertY?: boolean,
toArrayBuffer?: boolean,
quality?: number,
) => void,
) => Promise<string>Generates an image screenshot from the specified camera. Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: size
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
Param: mimeType
The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter. -
CreateScreenshotWithResizeAsync: (
engine: AbstractEngine,
camera: Camera,
width: number,
height: number,
mimeType?: string,
quality?: number,
useFill?: boolean,
) => Promise<void>Captures and automatically downloads a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize) If screenshot image data is needed, use CreateScreenshotAsync instead. Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.
Param: camera
defines the source camera. If the camera is not the scene's active camera, CreateScreenshotUsingRenderTarget will be used instead, and
useFillwill be ignoredParam: mimeType
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
Param: quality
The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter.
Class containing a set of static utilities functions for screenshots