/*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. */ /// import { quat, vec3 } from "gl-matrix"; import { Config } from "./config.js"; import { DebugText } from "./debug.js"; import { RendererBase } from "./renderers/renderer.js"; import { PaletteResources } from "./palette.js"; import { CameraBase } from "./cameras/camera.js"; import { IFontRasterizerOptions, Font } from "./font.js"; import { Manipulator } from "./input/manipulator.js"; import { Manager } from "./input/manager.js"; import { Log } from "./log.js"; export interface ICoreOptions { container?: HTMLElement; useInputManager?: boolean; fontRasterizerOptions?: IFontRasterizerOptions; } export interface IPickItem { transitionBuffer: number; id: number; manipulator?: Manipulator; } export interface IPickAxesGrid { axes?: number; divisionX: number; divisionY: number; divisionZ: number; manipulator?: Manipulator; } export interface IPickAxesLabel { axes?: number; axis: number; label: number; manipulator?: Manipulator; } export interface IPickAxesTitle { axes?: number; axis: number; manipulator?: Manipulator; } export interface IPickAxesHeading { axes?: number; axis: number; manipulator?: Manipulator; } export interface IPickLabelSet { label: number; set?: number; manipulator?: Manipulator; } export interface IPickLasso { x0: number; y0: number; x1: number; y1: number; pickType: PickType; ids: Set[]; manipulator?: Manipulator; } export interface IManipulationOriginChanged { x: number; y: number; z: number; } export interface IWebXRInputSourceResponse { obj: string; texture: ImageData; } export declare class ModelView { position: vec3; manipulationOrigin: vec3; scale: number; rotation: quat; constructor(core: Core); } export declare class Core { private _vec3; private _quat; private _mat4; private _container; get container(): HTMLElement; private _windowAnimationFrame; private _started; get started(): boolean; private _debugText; get debugText(): DebugText; private _log; get log(): Log; updateCallback: (elapsedTime: number, xrFrame?: XRFrame) => void; afterRenderCallback: () => void; startCallback: () => void; stopCallback: () => void; manipulationOriginChangedCallback: (result: IManipulationOriginChanged) => void; webXRSupportedCallback: () => void; webXRSessionStartedCallback: () => void; webXRSessionEndedCallback: () => void; webXRInputSourceRequestCallback: (profiles: string[], handedness: string, completed: (result: IWebXRInputSourceResponse) => void, failed: (e: string) => void) => void; private _previousTime; private _fps; get totalFrames(): number; private _camera; get camera(): CameraBase; set camera(value: CameraBase); private _modelMMatrix; private _modelPosition; private _modelRotation; private _modelScale; private _modelManipulationOrigin; private _smoothedModelPosition; private _smoothedModelRotation; private _smoothedModelScale; getModelRotation(value: quat): void; setModelRotation(value: quat, isSmooth: boolean): void; getModelScale(): number; setModelScale(value: number, isSmooth: boolean): void; getModelManipulationOrigin(value: vec3): void; setModelManipulationOrigin(value: vec3): void; getModelPosition(value: vec3): void; setModelPosition(value: vec3, isSmooth: boolean): void; private _webXRSession; get webXRSession(): XRSession; private _renderer; get renderer(): RendererBase; set renderer(renderer: RendererBase); private _font; get font(): Font; private _paletteResources; get paletteResources(): PaletteResources; private _config; get config(): Config; private _inputManager; get inputManager(): Manager; constructor(options?: ICoreOptions); getView(view: ModelView): void; setView(view: ModelView, isSmooth: boolean): void; lerpView(from: ModelView, to: ModelView, time: number): void; resetModel(isSmooth: boolean): void; resetManipulationOrigin(): void; reset(isSmooth: boolean): void; start(): void; stop(): void; checkWebXRSupport(): void; requestWebXRSession(): void; private _webXRSessionStarted; private _webXRSessionEnded; private _webXRInputSourcesChanged; private _tick; update(elapsedTime: number, xrFrame?: XRFrame): void; render(elapsedTime: number, xrFrame?: XRFrame): Promise; private _syncSmooth; private _updateManipulationOrigin; pickLasso(x0: number, y0: number, x1: number, y1: number, pickType: PickType): Set[]; } export declare const CameraMode: { readonly orbit: "orbit"; readonly altAzimuth: "altAzimuth"; }; export type CameraMode = (typeof CameraMode)[keyof typeof CameraMode]; export declare const StereoMode: { readonly none: "none"; readonly split: "split"; readonly anaglyph: "anaglyph"; readonly left: "left"; readonly right: "right"; }; export type StereoMode = (typeof StereoMode)[keyof typeof StereoMode]; export declare const SelectionMode: { readonly new: "new"; readonly add: "add"; readonly subtract: "subtract"; readonly intersect: "intersect"; }; export type SelectionMode = (typeof SelectionMode)[keyof typeof SelectionMode]; export declare const FilterMode: { readonly isolate: "isolate"; readonly exclude: "exclude"; }; export type FilterMode = (typeof FilterMode)[keyof typeof FilterMode]; export declare const HorizontalAlignment: { readonly left: "left"; readonly center: "center"; readonly right: "right"; }; export type HorizontalAlignment = (typeof HorizontalAlignment)[keyof typeof HorizontalAlignment]; export declare const VerticalAlignment: { readonly top: "top"; readonly center: "center"; readonly bottom: "bottom"; }; export type VerticalAlignment = (typeof VerticalAlignment)[keyof typeof VerticalAlignment]; export declare const TextAlignment: { readonly left: "left"; readonly center: "center"; readonly right: "right"; }; export type TextAlignment = (typeof TextAlignment)[keyof typeof TextAlignment]; export declare const Orientation: { readonly horizontal: "horizontal"; readonly vertical: "vertical"; }; export type Orientation = (typeof Orientation)[keyof typeof Orientation]; export declare const AxesTextOrientation: { readonly parallel: "parallel"; readonly perpendicular: "perpendicular"; }; export type AxesTextOrientation = (typeof AxesTextOrientation)[keyof typeof AxesTextOrientation]; export declare const AxesVisibility: { readonly none: "none"; readonly current: "current"; readonly previous: "previous"; }; export type AxesVisibility = (typeof AxesVisibility)[keyof typeof AxesVisibility]; export declare const PickType: { readonly none: 0; readonly data: 1; readonly label: 2; readonly axesDivision: 3; readonly axesTitle: 4; readonly axesLabel: 5; readonly axesHeading: 6; }; export type PickType = (typeof PickType)[keyof typeof PickType]; export declare const Theme: { readonly dark: "dark"; readonly light: "light"; }; export type Theme = (typeof Theme)[keyof typeof Theme]; export declare const HighlightMode: { readonly luminance: "luminance"; readonly color: "color"; }; export type HighlightMode = (typeof HighlightMode)[keyof typeof HighlightMode]; export declare const UnitType: { readonly block: "block"; readonly blockSdf: "blockSdf"; readonly boxFrameSdf: "boxFrameSdf"; readonly sphere: "sphere"; readonly sphereSdf: "sphereSdf"; readonly cylinder: "cylinder"; readonly cylinderSdf: "cylinderSdf"; readonly hexPrism: "hexPrism"; readonly hexPrismSdf: "hexPrismSdf"; readonly sdf: "sdf"; readonly disk: "disk"; readonly ringSdf: "ringSdf"; readonly tubeSdf: "tubeSdf"; }; export type UnitType = (typeof UnitType)[keyof typeof UnitType]; export declare const SingleTouchAction: { readonly none: "none"; readonly translate: "translate"; readonly rotate: "rotate"; readonly lasso: "lasso"; }; export type SingleTouchAction = (typeof SingleTouchAction)[keyof typeof SingleTouchAction]; export declare const MouseWheelAction: { readonly none: "none"; readonly zoom: "zoom"; readonly rotateY: "rotateY"; }; export type MouseWheelAction = (typeof MouseWheelAction)[keyof typeof MouseWheelAction]; export declare const LogLevel: { readonly trace: 0; readonly debug: 1; readonly info: 2; readonly warn: 3; readonly error: 4; }; export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel]; export declare const Edge2D: { readonly top: 0; readonly right: 1; readonly bottom: 2; readonly left: 3; }; export type Edge2D = (typeof Edge2D)[keyof typeof Edge2D]; export declare const Face2D: { readonly front: 0; readonly back: 1; }; export type Face2D = (typeof Face2D)[keyof typeof Face2D]; export declare const Edge3D: { readonly topFront: 0; readonly topRight: 1; readonly topBack: 2; readonly topLeft: 3; readonly bottomFront: 4; readonly bottomRight: 5; readonly bottomBack: 6; readonly bottomLeft: 7; readonly frontRight: 8; readonly backRight: 9; readonly backLeft: 10; readonly frontLeft: 11; }; export type Edge3D = (typeof Edge3D)[keyof typeof Edge3D]; export declare const Face3D: { readonly top: 0; readonly right: 1; readonly bottom: 2; readonly left: 3; readonly front: 4; readonly back: 5; }; export type Face3D = (typeof Face3D)[keyof typeof Face3D]; export declare const HexOrientation: { readonly pointyTop: "pointyTop"; readonly flatTop: "flatTop"; }; export type HexOrientation = (typeof HexOrientation)[keyof typeof HexOrientation]; export declare const RenderMode: { readonly color: "color"; readonly hdr: "hdr"; readonly depth: "depth"; readonly normal: "normal"; readonly segment: "segment"; readonly edge: "edge"; }; export type RenderMode = (typeof RenderMode)[keyof typeof RenderMode];