import { ConfigDialog } from '../interface/dialog'; import { CSS3DRenderer } from '../lib/CSS3DRenderer'; export interface AnglePreset { name?: string; id?: string; color?: string; condition?: ConditionResolvable; default?: true; position: ArrayVector3; target?: ArrayVector3; rotation?: ArrayVector3; projection: 'unset' | 'orthographic' | 'perspective'; zoom?: number; focal_length?: number; fov?: number; aspect_ratio?: number; locked_angle?: number; } export type PreviewAnnotation = { node: HTMLElement; object: THREE.Object3D; }; export type RaycastResult = { type: 'element' | 'keyframe' | 'vertex' | 'cube' | 'line' | 'none'; event: PointerEvent | MouseEvent | TouchEvent; cube?: Cube; intersects?: THREE.Intersection[]; intersect?: THREE.Intersection; face?: string; /** * Vertex key (on meshes) or ArrayVector3 */ vertex?: any; /** * Two vertex keys of a mesh edge */ vertices?: [string, string]; keyframe?: BBKeyframe; vertex_index?: number; element?: OutlinerElement; }; type SplitScreenMode = 'single' | 'double_horizontal' | 'double_vertical' | 'quad' | 'triple_left' | 'triple_right' | 'triple_top' | 'triple_bottom'; export declare const three_grid: import("three").Object3D; export declare const gizmo_colors: { r: import("three").Color; g: import("three").Color; b: import("three").Color; grid: import("three").Color; solid: import("three").Color; outline: import("three").Color; gizmo_hover: import("three").Color; spline_handle_aligned: import("three").Color; spline_handle_mirrored: import("three").Color; spline_handle_free: import("three").Color; u: import("three").Color; v: import("three").Color; w: import("three").Color; }; export declare const DefaultCameraPresets: AnglePreset[]; interface PreviewOptions { id: string; antialias?: boolean; offscreen?: boolean; } /** * Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media. */ export declare class Preview { id: string; canvas: HTMLCanvasElement; height: number; width: number; aspect_ratio?: number; node: HTMLElement; label: HTMLLabelElement; /** * True if the preview is in orthographic camera mode */ isOrtho: boolean; /** * Angle, when in a specific side view */ angle: null | string; default_angle: AnglePreset; camPers: THREE.PerspectiveCamera; camOrtho: THREE.OrthographicCamera & { axis: string; backgroundHandle: any; }; controls: any; annotations: Record; offscreen?: boolean; renderer: THREE.WebGLRenderer; css_renderer?: CSS3DRenderer; background: { name: string; image: any; size: number; x: number; y: number; lock: boolean; }; side_view_target: THREE.Vector3; raycaster: THREE.Raycaster; orbit_gizmo?: OrbitGizmo; selection: { box: HTMLElement; frustum: THREE.Frustum; activated: boolean; start_x: number; start_y: number; client_x: number; client_y: number; sr_move_f?: any; sr_stop_f?: any; click_target?: RaycastResult; old_selected?: OutlinerElement[]; old_mesh_selection?: any; old_spline_selection?: any; }; static_rclick: boolean; rclick_cooldown: any; event_start?: ArrayVector2; mouse: THREE.Vector2; constructor(options: PreviewOptions); /** * Set a size of the preview in pixels. With no arguments, and if the preview node is connected to the DOM, it will adjust to the size of the parent element */ resize(width?: number, height?: number): this; updateToneMapping(): void; raycast(event: MouseEvent, options?: { edges?: boolean; vertices?: boolean; }): false | RaycastResult; render(): void; get camera(): THREE.PerspectiveCamera | THREE.OrthographicCamera; setProjectionMode(orthographic: boolean, toggle?: boolean): this; setFOV(fov: number): void; setNormalCamera(): this; setLockedAngle(angle?: number): this; setDefaultAnglePreset(preset: AnglePreset): this; loadAnglePreset(preset: AnglePreset): this; /** * Opens a dialog to create and save a new angle preset */ newAnglePreset(): this; getFacingDirection(): 'north' | 'south' | 'east' | 'west'; getFacingHeight(): 'up' | 'middle' | 'down'; click(event?: PointerEvent): boolean; mousemove(event: MouseEvent): void; mouseup(event: MouseEvent): this; raycastMouseCoords(x: number, y: number): import("three").Vector3; vectorToScreenPosition(vector: any): { x: any; y: any; }; showContextMenu(event: MouseEvent): this; occupyTransformer(event?: MouseEvent | TouchEvent): this; calculateControlScale(position: THREE.Vector3): number; updateAnnotations(): void; addAnnotation(key: string, tag: PreviewAnnotation): void; removeAnnotation(key: any): void; startSelRect(event: PointerEvent): void; moveSelRect(event: MouseEvent): void; stopSelRect(event: any): void; loadBackground(): void; updateBackground(): void; copyView(preview: Preview): void; /** * Take a screenshot of the current view of the preview */ screenshot(options: ScreenshotOptions, callback: ScreenshotReturn): void; fullscreen(): this; toggleFullscreen(): void; delete(): void; /** * The last used preview */ static selected: Preview; /** * List of all previews */ static all: Preview[]; /** * Utility regarding split screen preview mode */ static split_screen: { /** * Whether the split screen is enabled */ enabled: boolean; /** * The current split screen mode */ mode: string; before: any; previews: Preview[]; lazyLoadPreview(index: number, camera_preset?: AnglePreset): Preview; /** * Set a split screen mode */ setMode(mode?: SplitScreenMode): void; /** * Update the size of the split screens */ updateSize(): void; }; menu: Menu; } export declare const ViewOptionsDialog: ConfigDialog; export declare function editCameraPreset(preset: any, presets: any): void; export declare class OrbitGizmo { preview: Preview; node: HTMLDivElement; lines: Record; sides: Record; constructor(preview: Preview, options?: {}); update(): void; hide(): void; unhide(): void; } export declare function setupPreviews(): void; export declare function animate(): void; declare const global: { main_preview: import("./preview").Preview; three_grid: import("three").Object3D; gizmo_colors: { r: import("three").Color; g: import("three").Color; b: import("three").Color; grid: import("three").Color; solid: import("three").Color; outline: import("three").Color; gizmo_hover: import("three").Color; spline_handle_aligned: import("three").Color; spline_handle_mirrored: import("three").Color; spline_handle_free: import("three").Color; u: import("three").Color; v: import("three").Color; w: import("three").Color; }; DefaultCameraPresets: AnglePreset[]; Preview: typeof import("./preview").Preview; ViewOptionsDialog: ConfigDialog; editCameraPreset: typeof import("./preview").editCameraPreset; OrbitGizmo: typeof import("./preview").OrbitGizmo; }; declare global { type Preview = import('./preview').Preview; const Preview: typeof global.Preview; type OrbitGizmo = import('./preview').OrbitGizmo; const OrbitGizmo: typeof global.OrbitGizmo; const three_grid: typeof global.three_grid; const gizmo_colors: typeof global.gizmo_colors; const DefaultCameraPresets: typeof global.DefaultCameraPresets; const ViewOptionsDialog: typeof global.ViewOptionsDialog; const editCameraPreset: typeof global.editCameraPreset; const updateShading: () => void; let MediaPreview: Preview; function animate(): void; interface BarItemRegistry { view_mode: BarSelect; preview_checkerboard: Toggle; uv_checkerboard: Toggle; toggle_shading: Toggle; toggle_all_grids: Toggle; toggle_ground_plane: Toggle; toggle_motion_trails: Toggle; pixel_grid: Toggle; split_screen: BarSelect; focus_on_selection: Action; toggle_camera_projection: Action; camera_initial: Action; camera_top: Action; camera_bottom: Action; camera_south: Action; camera_north: Action; camera_east: Action; camera_west: Action; } interface BlockbenchEventMap { canvas_select: RaycastResult; canvas_click: RaycastResult; } } export {};