ReadonlycameraCamera of the offscreen previews (one camera, since three.js keeps some state per camera).
Camera direction of the mesh shape, from the centre of the geometry's bounds.
The distance is fitted to the bounds.
Returns a png data url of the material preview.
Without options.size, it renders to the canvas and reads the whole canvas, without tone mapping (the old behaviour).
Call it from preFrame, then viewer.setDirty().
With options.size, it renders offscreen like renderToCanvas and the canvas is not changed.
Optionalenvironment: ITexture<TextureEventMap> | nullOptionaloptions: Omit<MaterialPreviewOptions, "environment" | "shape">
preview options, size selects the offscreen render
Renders the material preview into a small offscreen target and returns its pixels (see snapObjectPixels).
The canvas and the main render are not changed, no viewer.setDirty() is needed.
Call it from preFrame or postFrame of the viewer.
the viewer's renderer (viewer.renderManager.renderer)
Renders the material preview offscreen (renderPixels) and draws it into a canvas (a new one, or canvas).
the viewer's renderer (viewer.renderManager.renderer)
Optionalcanvas: HTMLCanvasElement
canvas to draw into, it is resized to the preview size
Renders previews of materials on a shape (sphere, cube, cylinder) or a given geometry, with the viewer's renderer in a private scene (layer 7), so the previews share the shaders and textures of the viewport.
options.sizerenders to the canvas and reads the whole canvas (the old behaviour).For previews that are requested on every material change (an inspector), see MaterialPreviewPlugin.