Skip to main content

Function: usePointOfViewSnapshots()

function usePointOfViewSnapshots(
pointsOfView: PointOfViewTransform[],
options?: {
tileWidth?: number;
tileHeight?: number;
maxSimultaneousCaptures?: number;
},
): {
isPending: boolean;
images: (string | null)[];
};

Defined in: livelink.react/sources/hooks/usePointOfViewSnapshots.ts:67

Experimental

A hook that renders a small snapshot image for each given point of view, by driving temporary cameras through an offscreen surface packed as a grid so several are captured at once.

Already-captured points of view are cached in memory (keyed by position/orientation) for the life of the component, so only new or actually-changed points of view get re-captured.

Waits for the scene to finish loading (see Scene.waitForSceneLoaded) before capturing anything, so snapshots aren't taken of a still-streaming-in scene.

Generic — deals only in plain camera transforms, not labels or entities — so it's reusable for any point-of-view preview feature.

Must be used from a component rendered inside a <Canvas>, so the offscreen surface can be positioned to avoid overlapping the visible viewport.

Parameters

ParameterTypeDescription
pointsOfViewPointOfViewTransform[]The points of view to capture, in order.
options?{ tileWidth?: number; tileHeight?: number; maxSimultaneousCaptures?: number; }Options controlling the size and batching of the capture.
options.tileWidth?numberThe width in pixels of each snapshot. Default 320.
options.tileHeight?numberThe height in pixels of each snapshot. Default 180.
options.maxSimultaneousCaptures?numberThe maximum number of points of view captured at once, in a single grid. Default 2.

Returns

{
isPending: boolean;
images: (string | null)[];
}

The snapshots, as an array of data URLs in the same order as pointsOfView, null for entries not captured yet, and a flag indicating if the capture is still in progress.

NameType
isPendingboolean
images(string | null)[]