Skip to content

ModelPreviews beta ​

Class of @v12-engine/client/lite-views

ts
export declare class ModelPreviews

Small pictures of models, for choosing between them, like the kinds of tree in the editor: each stood alone in a side view of the renderer, drawn once and read back, one at a time, and kept

Members ​

constructor ​

ts
constructor(renderer: Renderer, size?: number, 
    assets?: SceneryAssets);

Constructs a new instance of the ModelPreviews class

dispose ​

ts
dispose(): void;

Takes the previews' stages, their turning models and their models' files away

fileImage ​

ts
fileImage(url: string): Promise<string>;

A picture of a model file as it is, by its address, as a data URL

image ​

ts
image(model: PreviewModel): Promise<string>;

A picture of the model as a data URL

info ​

ts
info(url: string): Promise<ModelInfo>;

What there is in a model file: its triangles, meshes and bones, its animations by name, how big it is made

pixels ​

ts
pixels(model: PreviewModel, shot: PreviewShot): Promise<ImageData>;

The pixels of a shot of a model: the picture's rows from the top, four bytes a pixel. Taken in its turn

spin ​

ts
spin(canvas: HTMLCanvasElement, model: PreviewModel, options?: {
        speed?: number;
        every?: number;
        shot?: PreviewShot;
    }): Promise<SpunPreview>;

A model turning in a canvas of the page, at the canvas's own size: drawn straight onto it, every every frames of the renderer (1: each), until stop