useCaptureImage
useCaptureImage(): (
camera,options) =>Promise<string>
Takes a picture of the scene from a camera of the game’s own, as a JPEG data URL, in a target of its own the player never sees. The camera is a bookmarked view, or a three camera whose world transform, field of view or height, clip planes, zoom, layers and focus it takes as the camera stands when you ask, so one camera moved between asks gives each its own picture. Its own aspect gives way to the picture’s, and a projection matrix of its own, a film offset or a view offset does not carry. One picture a frame, each a whole frame after it was asked for, so what the game mounted for it has run its own frame callbacks and nothing on the page still loads, such as a model the game mounted for it. The picture is the engine’s draw of the scene through the mounted post-processing, as the canvas would show it from that camera, with the scene’s fog; gizmos and screen overlays stay out, and so does a frame a game draws its own way, such as a second scene or a render pipeline of its own. An ask waits while the tab is hidden or a headset presents, and rejects when this component unmounts, the canvas loses its context, or the draw or the read throws. A hook under the game’s canvas; the game keeps the pictures.
const capture = useCaptureImage();const picture = await capture( { eye: [0, 40, 60], target: [0, 0, 0], fov: 30 }, { width: 160, height: 120 },);Returns
Section titled “Returns”(camera, options) => Promise<string>