import { ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader";
import { Scene } from "@babylonjs/core/scene";
/**
 * Defines the different behaviors supported by the camera system
 * for control when viewing a product.
 */
export enum ProductCameraRig {
    Orbit = 0,
    Pan = 1
}
/**
 * Details relating to a model for use in the preview.
 */
export type ModelDetails = {
    readonly model?: string;
    readonly contextService: RenderableContextService;
};
/**
 * Identical to CameraAnimation typing, however the
 * target is always available and hence is not optional.
 */
export type CameraPose = {
    readonly lonDeg: number;
    readonly radius: number;
    readonly latDeg: number;
    readonly target: {
        readonly x: number;
        readonly y: number;
        readonly z: number;
    };
};
export type ThreeDPreviewService = {
    /**
     * Allows listeners to be aware of the camera losing focus of the
     * main product.
     * @param listener A function to be called when focus is lost.
     */
    registerFocusLostListener(listener: () => void): void;
    /**
     * Removes a listener from the focusLost observers. The listener will
     * no longer be notified
     * @param listener The listener to remove.
     */
    unregisterFocusLostListener(listener: () => void): void;
    /**
     * Providers listeners with information about load progress when
     * the preview is loading scenes.
     * @param listener A function to get load progress updates
     */
    registerLoadProgressListener(listener: (e: LoadProgressEventData) => void): void;
    /**
     * Allows you to pass any function that originally called registerLoadProgressListener()
     * to have it excluded from load progress updates.
     * If the function was never registered this call has no effect.
     * @param listener The listener to exclude from load progress.
     */
    unregisterLoadProgressListener(listener: (e: LoadProgressEventData) => void): void;
    /**
     * Request that the scene renders to a given canvas
     * @param canvas The canvas we should render to.
     */
    registerView(canvas: HTMLCanvasElement): void;
    /**
     * Returns the number of active viewers of the scene. Useful for
     * avoiding unnecessary rendering when there are no active viewers.
     */
    getNumViewports(): number;
    /**
     * Tells babylon that we no longer want the given canvas to be rendered to.
     * @param canvas The canvas to be excluded from rendering.
     */
    unregisterView(canvas: HTMLCanvasElement): void;
    /**
     * Shutdown the preview engine. Noop if the engine is not initialized.
     */
    shutdown(): void;
    /**
     * Initialize the scene. Also initialize the engine, if it hasn't been done already.
     */
    initialize(src: string, contextService?: RenderableContextService): Promise<void>;
    /**
     * Executes an animation in the currently loaded scene.
     * @param animation The current animation track to run.
     */
    executeModelAnimation(animation: ModelAnimation): void;
    /**
     * Executes an animation of the camera.
     * @param animation The animation to execute.
     */
    executeCameraAnimation(animation: CameraAnimation): void;
    /**
     * Returns the values of the Arc Rotate Camera
     */
    getCameraPose(): CameraPose | undefined;
    /**
     * Sets the values of the Arc Rotate Camera
     */
    setCameraPose(cameraPose: CameraPose): void;
    /**
     * Applies a given material modifier to a target material in the scene.
     * @param targetMaterial The material to target.
     * @param key A unique key used to identify this action.
     * @param material The material modifier to apply.
     */
    applyMaterialVariant(targetMaterial: string, key: string, material: MaterialResource, removeWhenUndefined?: boolean): Promise<void>;
    /**
     * Applies a given model variant to the scene.
     * @param key A unique key used to identify this action.
     * @param model modelDetails -> An asset containing a model file to be loaded into the scene.
     * @param layouts modelDetails -> The layouts of the workflow, used for applying dynamic textures.
     */
    applyModelVariant(key: string, modelDetails: ModelDetails, replaceProductModel: boolean): Promise<void>;
    /**
     * Controls the current control state of the camera.
     * @param rigType The control type to use.
     */
    setCameraState(rigType: ProductCameraRig): void;
    /**
     * Restores the product camera to it's last set focus point. If the user has
     * been panning this will animate the camera to the original focus point. If the camera is still
     * focused on it's origin point this function is a noop.
     */
    animateToLastCameraFocus(): Promise<void>;
    /**
     * When configuration has allowed for auto rotation we
     * can pause the rotation via this function.
     * @param shouldAutoRotate When true rotation is running, paused otherwise.
     */
    setAutoRotation(shouldAutoRotate: boolean): void;
    /**
     * Get current load progress for the scene.
     */
    getSceneInitializationProgress(): number;
    /**
     * Returns the current configuration object applied to the scene.
     */
    getCurrentConfiguration(): PreviewOptions | undefined;
    /**
     * Takes a screenshot of the scene using a given
     * camera animation otherwise using the existing orientation
     * of the camera in the scene. A resolution must be provided
     * to render the scene at.
     */
    renderSceneScreenshot(resolution: number, cameraAnimation: CameraAnimation): Promise<string>;
    /**
     * Returns true when the current configuration allows the user
     * to rotate around the product.
     */
    orbitEnabled(): boolean;
    /**
     * When called will trigger the internal engine to match the current
     * canvas size. This ensures the image renders correctly in the view and
     * also prevents performance problems.
     */
    fireResizeEvent(): void;
    /**
     * A callback when the user clicks in the scene and a material is hit.
     */
    onMaterialSelected(cb: (material: MaterialHandle) => void): void;
    /**
     * Designed for use when utilizing the 3D preview in an editor format.
     * List named materials that are available in the scene.
     */
    listMaterials(): readonly MaterialHandle[];
    /**
     * Designed for use when utilizing the 3D preview in an editor format.
     * Given a list of material names, highlights the associated meshes in the scene.
     */
    setHighlights(materials: readonly MaterialHandle[], color?: readonly [number, number, number]): void;
};
/**
 * Represents a service capable of managing and returning contexts that
 * can be used for rendering to textures in the 3D preview.
 */
export type RenderableContextService = {
    /**
     * Returns all managed renderable contexts.
     */
    getAll(): ReadonlyMap<string, RenderableContext>;
};
/**
 * A renderable context represents the relationship of a texture in the 3D preview
 * with an external canvas. This context allows external clients to render to a texture
 * in the 3D preview with a simple interface.
 */
export type RenderableContext = {
    /**
     * A unique identifier for this renderable context.
     */
    getID(): string;
    /**
     * A name for this renderable.
     */
    getName(): string;
    /**
     * Sets the render context associated to this renderable.
     * @param ctx The context to use for rendering.
     */
    setStaticContext(ctx: CanvasRenderingContext2D): void;
    /**
     * Get the render context associated to this renderable.
     */
    getStaticContext(): CanvasRenderingContext2D | undefined;
    /**
     * Sets whether or not this renderable is dirty and will need re-rendering.
     * @param value The new value
     */
    setStaticContextDirty(value: boolean): void;
    /**
     * When this context has been set as dirty, returns true.
     */
    getStaticContextDirty(): boolean;
    /**
     * A timestamp for the last successful render of the context.
     */
    getLastCompletedStaticRender(): number | undefined;
};
export type LoadProgressEventData = {
    /**
     * The total load value of the scene, this is an average of all
     * 'in progress' loading events. when all events are fully loaded this value will be 100.
     */
    readonly loadValue: number;
    /**
     * This value is true when the base model and scene have been initialized.
     */
    readonly sceneInitialized: boolean;
};
/**
 * Used to specify the behavior of a material effect such as clearcoat, sheen and translucency.
 */
export enum MaterialEffectMode {
    /**
     * When a material variant effect specifies 'None' the effect doesn't change in any way. This is the default behavior.
     */
    None = "None",
    /**
     * When a material variant effect specifies 'RemoveWhenSelected' the effect is removed.
     */
    RemoveWhenSelected = "RemoveWhenSelected",
    /**
     * When a material variant effect specifies 'ApplyWhenSelected' the effect is enabled.
     */
    ApplyWhenSelected = "ApplyWhenSelected"
}
/**
 * Represents a material resource that can be additively applied to
 * a material targeted in the scene.
 */
export type MaterialResource = {
    /**
     * A unique identified for this material.
     */
    id: string;
    /**
     * The name of this material
     */
    name: string;
    /**
     * Defines the base color of a surface before any other calculations are made.
     */
    albedoMapKey?: string;
    albedoKey?: string;
    /**
     * Defines the transparency of a surface.
     */
    alphaMapKey?: string;
    alphaKey?: string;
    /**
     * Defines shadowing on a surface.
     */
    ambientMapKey?: string;
    ambientKey?: string;
    /**
     * Defines the amount of light being emitted from a surface.
     */
    emissionMapKey?: string;
    emissionKey?: string;
    /**
     * Identical to roughness.
     */
    metallicMapKey?: string;
    metallicKey?: string;
    /**
     * Defines the direction light will bounce in when it hits a point on a surface.
     */
    normalMapKey?: string;
    normalKey?: string;
    /**
     * Used to define how smooth a surface is.
     */
    roughnessMapKey?: string;
    roughnessKey?: string;
    /**
     * Used to define refreaction of light on a surface.
     */
    refractionMapKey?: string;
    refractionKey?: string;
    /**
     * The intensity of refraction, when refraction is enabled via a texture.
     */
    refractionIntensity?: number;
    /**
     * When enabled the material will be displayed with a clearcoat affect for simulating coated plastic surfaces.
     */
    clearCoat: MaterialEffectMode;
    /**
     * Index of refraction when clear coat is enabled.
     */
    clearCoatIOR?: number;
    /**
     * The date that this material resource was created
     */
    createdAt: string;
    /**
     * The date that this material resource was last updated.
     */
    updatedAt: string;
};
/**
 * Represents a handle to a material in the 3D scene. The underlying complexity of materials is abstracted
 * away so the client doesn't need to know anything more than the ID they're given and the name.
 */
export type MaterialHandle = {
    /**
     * The identifier for the material.
     */
    readonly id: string;
    /**
     * The human readable name for the material.
     */
    readonly name: string;
};
/**
 * Settings related to the 3D preview.
 */
export type PreviewOptions = {
    /**
     * The color expected to be seen in the background of the product. Expects a hexadecimal value.
     */
    readonly backgroundColor?: string;
    /**
     * Image to be used as a background when running withh transparency, the image
     * will be scaled and centered to fill the preview based on aspect ratio.
     */
    readonly backgroundImage?: string;
    /**
     * The closest zoom the camera can achieve to the product.
     */
    readonly maxZoomOverride?: number;
    /**
     * The furthest zoom the camera can achieve to the product.
     */
    readonly minZoomOverride?: number;
    /**
     * The environment file used to calculate product lighting.
     */
    readonly environmentFile?: string;
    /**
     * The lowest point, vertically, that the camera can rotate to.
     * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
     */
    readonly lowerBetaLimitDeg?: number;
    /**
     * The highest point, vertically, that the camera can rotate to.
     * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
     */
    readonly upperBetaLimitDeg?: number;
    /**
     * The leftmost point, horizontally, that the camera can rotate to.
     * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
     */
    readonly lowerAlphaLimitDeg?: number;
    /**
     * The rightmost point, horizontally, that the camera can rotate to.
     * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
     */
    readonly upperAlphaLimitDeg?: number;
    /**
     * When set the product while rotate slowly
     */
    readonly autoRotation?: boolean;
    /**
     * Time in milliseconds before the product starts rotating after a user input has taken control.
     */
    readonly idleTimeBeforeRotation?: number;
    /**
     * When set the 3D preview won't attempt to orient the product automatically to its front view at load.
     */
    readonly disableAutomaticOrientation?: boolean;
    /**
     * When true the action bar won't be displayed to the user.
     */
    readonly disableActionBar?: boolean;
    /**
     * When set, mousing over the model in this preview will highlight the associated mesh/material.
     * When layout contexts are provided, only the materials with matching names will highlight.
     */
    readonly highlightOnMaterialHover?: boolean;
    /**
     * Sets the color of highlights when enabled. Expects hexadecimal value.
     */
    readonly highlightColor?: string;
};
/**
 * Defines an animation to be play on a product.
 */
export type ModelAnimation = {
    /**
     * A value it seconds along the animation timeline to begin at.
     */
    readonly from: number;
    /**
     * A value in seconds along the animation timeline to end at.
     */
    readonly to?: number;
    /**
     * When true the animation will loop. The only behavior currently is to reset
     * back to from but we could have it bounce back and forth and/or follow a curve.
     */
    readonly loop: boolean;
};
/**
 * A CameraAnimation specifies a discrete state that the camera should
 * animate to. This state represents the final position of the camera after animations have run.
 */
export type CameraAnimation = {
    /**
     * The longitude in degrees the camera should animate to.
     */
    readonly lonDeg: number;
    /**
     * The latitude in degrees the camera should animate to.
     */
    readonly latDeg: number;
    /**
     * An optional target for the camera to focus on in the scene.
     */
    readonly target?: {
        readonly x: number;
        readonly y: number;
        readonly z: number;
    };
    /**
     * A value in scene units specifying camera distance from the target.
     */
    readonly radius?: number;
};
/**
 * Represents the dimensions of a texture, enforcing power of two numbers.
 */
type RenderDimensions = {
    readonly width: PowerOfTwoNumber;
    readonly height: PowerOfTwoNumber;
};
/**
 * A class containing largely static configuration information.
 */
export class RenderingConfiguration {
    /**
     * Returns the resolution expected for generated textures.
     */
    static getDynamicTextureResolution(): RenderDimensions;
    /**
     * Returns true when textures should generate mip maps
     */
    static shouldMipMap(): boolean;
    /**
     * Returns true when multithreaded rendering is supported.
     */
    static offscreenRenderingSupported(): boolean;
    /**
     * Returns the resolution expected for mirror textures.
     */
    static getMirrorTextureResolution(): PowerOfTwoNumber;
}
export const REFLECTION_PROBE_RESOLUTION = 128;
export type PowerOfTwoNumber = 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192;
/**
 * An example implementation of the ThreeDPreviewService interface. The inclusion of 3D previews
 * is designed to be optional, anyone can come along and implement their own 3D preview service or
 * they can use this one to get things running more quickly.
 */
export class SpiffCommerce3DPreviewService implements ThreeDPreviewService {
    constructor(canvas?: HTMLCanvasElement, options?: PreviewOptions);
    registerFocusLostListener(listener: () => void): void;
    unregisterFocusLostListener(listener: () => void): void;
    registerLoadProgressListener(listener: (e: LoadProgressEventData) => void): void;
    unregisterLoadProgressListener(listener: (e: LoadProgressEventData) => void): void;
    registerView(canvas: HTMLCanvasElement): void;
    getNumViewports(): number;
    unregisterView(canvas: HTMLCanvasElement): void;
    shutdown(): void;
    getSceneInitializationProgress(): number;
    initialize(src?: string, contextService?: RenderableContextService): Promise<void>;
    executeModelAnimation(animation: ModelAnimation): void;
    executeCameraAnimation(animation: CameraAnimation): void;
    getCameraPose(): CameraPose | undefined;
    setCameraPose(cameraPose: CameraPose): void;
    applyMaterialVariant(targetMaterial: string, key: string, material: MaterialResource, removeWhenUndefined?: boolean): Promise<void>;
    applyModelVariant(key: string, modelDetails: ModelDetails, replaceProductModel: boolean): Promise<void>;
    setCameraState(rigType: ProductCameraRig): void;
    animateToLastCameraFocus(): Promise<void>;
    setAutoRotation(shouldAutoRotate: boolean): void;
    getCurrentConfiguration(): PreviewOptions | undefined;
    renderSceneScreenshot(resolution: number, camAnim: CameraAnimation): Promise<string>;
    orbitEnabled(): boolean;
    fireResizeEvent(): void;
    onMaterialSelected(cb: (material: MaterialHandle) => void): void;
    listMaterials(): readonly MaterialHandle[];
    setHighlights(materials: readonly MaterialHandle[], color?: readonly [number, number, number]): void;
    initXRExperience(buttonEl: HTMLElement): void;
}
/**
 * Adds a tags a base mesh to the scene.
 * TODO: Move this to another file with other creation/initialization functionality?
 * @param src A url to a valid glb scene
 * @param progressHandler A handler for load progress events.
 */
export function createBaseModel(src: string, scene: Scene, progressHandler?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;

//# sourceMappingURL=types.d.ts.map
