import * as THREE from "three"; import SceneObject from "./scene_object.js"; import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; import { Model } from "../../core/model.js"; /** * Shadow quality, lower values use lower resolution/faster settings, * higher values use high resolution/slower but more aesthetic settings. */ export declare const enum ShadowQuality { LOW = 0, MEDIUM = 1, HIGH = 2 } /** * The options for the simple viewer scene. */ export interface SimpleViewerSceneOptions { /** * Are shadows enabled? (defualt true) */ shadows?: boolean; /** * Is the directional light enabled? (default true) */ directionalLight?: boolean; /** * Should we setup an orbit control? (default true) */ orbitControl?: boolean; /** * Should we add an ambient light? (default true) * * Set to false if you load an environment map and don't want * an extra ambient light, as the environment map itself acts as an * ambient light. */ ambientLight?: boolean; /** * Should we initialise the camera to the model? (default true) */ initialiseCameraToModel?: boolean; /** * The shadow quality to use. (default ShadowQuality.HIGH) */ shadowQuality?: ShadowQuality; /** * Should we use variant shadow mapping? (default false) */ variantShadowMap?: boolean; /** * Should we enable HDR tone mapping? (default true) */ enableHDRToneMap?: boolean; /** * Should we use the filmic tone mapping? (default true) * * Enables using ACES filmic tone tapping, * otherwise neutral tonemapping will be used. */ filmicTonMap?: boolean; /** * The exposure for the tonemapping. (default 0.25) */ toneMapExposure?: number; /** * Is ambient occlusion enabled? (default true) */ ao?: boolean; /** * Should we limit the CSG depth? (default false) * * This is used to limit the depth of the CSG operations * to avoid very deep recursions. */ limitCSGDepth?: boolean; /** * The maximum CSG depth to use. (default 20) */ maxCSGDepth?: number; } /** * A default scene setup for three with a conway model that can be loaded. */ export declare class SimpleViewerScene { readonly renderer: THREE.WebGLRenderer; readonly scene: THREE.Scene; readonly camera: THREE.PerspectiveCamera | THREE.OrthographicCamera; readonly dimensionsFunction: () => [ number, number ]; private readonly options; private currentModelSceneObject_?; private currentModel_?; private currentRadius_; orbitControls: OrbitControls; readonly light: THREE.DirectionalLight; readonly ambient: THREE.HemisphereLight; private lightDir_; private rgbeLoader_?; private premGenerator_?; private composer_?; private ambientOclussion_; /** * Should we limit the CSG depth? Othwerwise we will only limit the depth * of memoization. */ limitCSGDepth: boolean; /** * The limit for CSG recursion depth (or memoization depth). */ maxCSGDepth: number; onload?: (scene: SimpleViewerScene, object: SceneObject) => void; /** * Get the current model scene object. * * @return {SceneObject | undefined} The current model scene object. */ get currentModelSceneObject(): SceneObject | undefined; /** * Get the current model. * * @return {Model | undefined} The current model. */ get currentModel(): Model | undefined; /** * Is ambient occlusion enabled? * * @return {boolean} True if ambient occlusion is enabled. */ get ambientOcclusion(): boolean; /** * Set if ambient occlusion is enabled. * * @param value True if ambient occlusion is enabled. */ set ambientOcclusion(value: boolean); /** * Does this scene have an ambient light in it? * * @return {boolean} True if the scene has an ambient light. */ get hasAmbientLight(): boolean; /** * Set if this scene has an ambient light. * * @param value True if the scene has an ambient light. */ set hasAmbientLight(value: boolean); /** * Load an equirectangular environment map in HDR format. * * @param url The URL to the HDR file. * @return {Promise< void >} A promise to await on for loading. */ loadEquirectangularEnvironmentMapHDR(url: string): Promise; /** * Set the current light direction. * * @param value The light direction (THREE.Vector3) */ set lightDirection(value: THREE.Vector3); /** * Get the current light direction. * * @return {THREE.Vector3} The current light direction. */ get lightDirection(): THREE.Vector3; /** * Update the shadow quality for this * * @param light * @param quality * @param vsm */ private updateShadowQuality; render(): void; /** * Are shadows enabled? * * @return {boolean} True if shadows are enabled. */ get shadowsEnabled(): boolean; /** * Are shadows enabled? * * @param value True if shadows are enabled. */ set shadowsEnabled(value: boolean); /** * Get the shadow quality for this. * * @return {ShadowQuality} The current shadow quality. */ get shadowQuality(): ShadowQuality; /** * Get the shadow quality for this. * * @param value The new shadow value. */ set shadowQuality(value: ShadowQuality); /** * Construct the simple viewer scene * * @param renderer * @param scene * @param camera * @param dimensionsFunction * @param options */ constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera | THREE.OrthographicCamera, dimensionsFunction: () => [ number, number ], options?: SimpleViewerSceneOptions); /** * Sets up ambient occlusion for the scene. * * @param width The width of the scene. * @param height The height of the scene. * @param pixelRatio The pixel ratio of the scene. */ private setupAO; /** * Load a new model, replacing any current model in the scene, * uses promises/exceptions for error handling * * @param model The model to add to the scene */ addModelToScene(model: SceneObject): void; /** * Load a new model, replacing any current model in the scene, * uses promises/exceptions for error handling * * @param buffer The buffer to load the model from * @return {Promise< void >} A promise to await on for loading. */ load(buffer: ArrayBuffer): Promise; /** * Create a simple viewer scene, including the required * threejs artefacts and attach it to a DOM element. * * @param element The element to attach to. * @param useElementDimensions If true use the width and height of the element, * if false use the window dimensions. * @param options The scene viewer options for attaching this element. * @return {SimpleViewerScene} The created scene. */ static createSceneAttachedToElement(element: HTMLElement, useElementDimensions?: boolean, options?: SimpleViewerSceneOptions): SimpleViewerScene; /** * Create a simple viewer scene, including the required * threejs artefacts and attach it to a DOM element. * * @param element The element to attach to. * @param useElementDimensions If true use the width and height of the element, * if false use the window dimensions. * @param height * @param width * @param context * @param options The scene viewer options for attaching this element. * @return {SimpleViewerScene} The created scene. */ static createSceneWithGLContext(context: WebGLRenderingContext, width?: number, height?: number, options?: SimpleViewerSceneOptions): SimpleViewerScene; } //# sourceMappingURL=simple_viewer_scene.d.ts.map