export = vjmap3d; export as namespace vjmap3d; declare namespace vjmap3d { import { AnimationAction } from 'three'; import { AnimationActionLoopStyles } from 'three'; import { AnimationBlendMode } from 'three'; import { AnimationClip } from 'three'; import { AnimationMixer } from 'three'; import { AxesHelper } from 'three'; import { Blending } from 'three'; import { Box2 } from 'three'; import { Box3 } from 'three'; import { BoxGeometry } from 'three'; import { BufferAttribute } from 'three'; import { BufferGeometry } from 'three'; import { Camera } from 'three'; import { CanvasTexture } from 'three'; import { CatmullRomCurve3 } from 'three'; import { Clock } from 'three'; import { Color } from 'three'; import { ColorRepresentation } from 'three'; import { ColorSpace } from 'three'; import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js'; import { CSS2DParameters } from 'three/examples/jsm/renderers/CSS2DRenderer.js'; import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js'; import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer.js'; import { CSS3DParameters } from 'three/examples/jsm/renderers/CSS3DRenderer.js'; import { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer.js'; import { CSS3DSprite } from 'three/examples/jsm/renderers/CSS3DRenderer.js'; import { CubeTexture } from 'three'; import { DataTexture } from 'three'; import { DDSLoader } from 'three/examples/jsm/loaders/DDSLoader.js'; import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'; import { Euler } from 'three'; import { EulerOrder } from 'three/src/math/Euler'; import { EventDispatcher as EventDispatcher_2 } from 'three'; import { ExtrudeGeometryOptions } from 'three'; import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js'; import { FileLoader } from 'three'; import type { Float32BufferAttribute } from 'three'; import { Fog } from 'three'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; import { GridHelper } from 'three'; import { Group as Group_2 } from 'three'; import { ImageLoader } from 'three'; import { InstancedBufferGeometry } from 'three'; import { InstancedInterleavedBuffer } from 'three'; import { InstancedMesh } from 'three'; import { InterleavedBufferAttribute } from 'three'; import { InterpolationModes } from 'three'; import { Intersection } from 'three'; import { IUniform } from 'three'; import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js'; import { Layers } from 'three'; import { Light } from 'three'; import { Line3 } from 'three'; import { Line as Line_2 } from 'three'; import { LineBasicMaterial } from 'three'; import { LineBasicMaterialParameters } from 'three'; import { LineDashedMaterialParameters } from 'three'; import { LineMaterialParameters as LineMaterialParameters_2 } from 'three/examples/jsm/lines/LineMaterial.js'; import { LineSegments } from 'three'; import { LineSegments2 as LineSegments2_2 } from 'three/examples/jsm/lines/LineSegments2.js'; import { Loader } from 'three'; import { LoadingManager } from 'three'; import { Lut } from 'three/examples/jsm/math/Lut.js'; import { MagnificationTextureFilter } from 'three'; import { Material } from 'three'; import { MaterialParameters } from 'three'; import { Matrix3 } from 'three'; import { Matrix4 } from 'three'; import { Matrix4Tuple } from 'three'; import { Mesh } from 'three'; import { MeshBasicMaterial } from 'three'; import { MeshBasicMaterialParameters } from 'three'; import { MeshLambertMaterialParameters } from 'three'; import { MeshPhongMaterial } from 'three'; import { MeshPhysicalMaterial } from 'three'; import { MeshStandardMaterial } from 'three'; import { MeshStandardMaterialParameters } from 'three'; import { MinificationTextureFilter } from 'three'; import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader.js'; import { NormalBufferAttributes } from 'three'; import { Object3D } from 'three'; import { Object3DEventMap } from 'three'; import { ObjectLoader } from 'three'; import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js'; import { OrthographicCamera } from 'three'; import { ParametricGeometry } from 'three/examples/jsm/geometries/ParametricGeometry.js'; import { PerspectiveCamera } from 'three'; import { Plane } from 'three'; import { PlaneGeometry } from 'three'; import { Points } from 'three'; import { PointsMaterial } from 'three'; import { PointsMaterialParameters } from 'three'; import { Quaternion } from 'three'; import { RawShaderMaterial } from 'three'; import { Ray } from 'three'; import { Raycaster } from 'three'; import { RaycasterParameters } from 'three'; import { Renderer } from 'three'; import { RenderTargetOptions } from 'three'; import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js'; import { Scene } from 'three'; import { ShaderMaterial } from 'three'; import { ShaderMaterialParameters } from 'three'; import { Shape as Shape_2 } from 'three'; import { Side } from 'three'; import { Sphere } from 'three'; import { Spherical } from 'three'; import { Sprite } from 'three'; import { SpriteMaterial } from 'three'; import { SpriteMaterialParameters } from 'three'; import { SVGLoader } from 'three/examples/jsm/loaders/SVGLoader.js'; import { Texture } from 'three'; import { TextureDataType } from 'three'; import { TextureImageData } from 'three/src/textures/types'; import { Triangle } from 'three'; import { TrianglesDrawModes } from 'three'; import type { Uint16BufferAttribute } from 'three'; import { Uniform as Uniform_2 } from 'three'; import { UniformsLib } from 'three'; import { Usage } from 'three'; import { Vector2 } from 'three'; import { Vector3 } from 'three'; import { Vector3Tuple } from 'three'; import { Vector4 } from 'three'; import { WebGLMultipleRenderTargets } from 'three'; import { WebGLRenderer } from 'three'; import { WebGLRendererParameters } from 'three'; import { WebGLRenderTarget } from 'three'; import { Uniform, DepthPackingStrategies, DepthModes, Data3DTexture } from "three"; import { Timer as Timer3 } from "three/examples/jsm/misc/Timer.js"; /** * A color channel enumeration. * * @type {Object} * @property {Number} RED - Red. * @property {Number} GREEN - Green. * @property {Number} BLUE - Blue. * @property {Number} ALPHA - Alpha. */ export enum ColorChannel { RED, GREEN, BLUE, ALPHA, } /** * The Disposable contract. * * Implemented by objects that can free internal resources. * * @interface */ export interface Disposable { /** * Frees internal resources. */ dispose(): void; } /** * The initializable contract. * * Implemented by objects that can be initialized. * * @interface */ export interface Initializable { /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - A renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A Gauss kernel. * */ export class GaussKernel { /** * Constructs a new Gauss kernel. * * @param kernelSize - The kernel size. Should be an odd number in the range [3, 1020]. * @param [edgeBias=2] - Determines how many edge coefficients should be cut off for increased accuracy. */ constructor(kernelSize: number, edgeBias: number); } /** * An adaptive luminance shader material. */ export class AdaptiveLuminanceMaterial extends ShaderMaterial { /** * Constructs a new adaptive luminance material. */ constructor(); /** * The primary luminance buffer that contains the downsampled average luminance. * * @type {Texture} */ set luminanceBuffer0(arg: Texture); /** * Sets the primary luminance buffer that contains the downsampled average luminance. * * @deprecated Use luminanceBuffer0 instead. * @param {Texture} value - The buffer. */ setLuminanceBuffer0(value: Texture): void; /** * The secondary luminance buffer. * * @type {Texture} */ set luminanceBuffer1(arg: Texture); /** * Sets the secondary luminance buffer. * * @deprecated Use luminanceBuffer1 instead. * @param {Texture} value - The buffer. */ setLuminanceBuffer1(value: Texture): void; /** * The 1x1 mipmap level. * * This level is used to identify the smallest mipmap of the primary luminance buffer. * * @type {Number} */ set mipLevel1x1(arg: number); /** * Sets the 1x1 mipmap level. * * @deprecated Use mipLevel1x1 instead. * @param {Number} value - The level. */ setMipLevel1x1(value: number): void; /** * The delta time. * * @type {Number} */ set deltaTime(arg: number); /** * Sets the delta time. * * @deprecated Use deltaTime instead. * @param {Number} value - The delta time. */ setDeltaTime(value: number): void; set minLuminance(arg: number); /** * The lowest possible luminance value. * * @type {Number} */ get minLuminance(): number; /** * Returns the lowest possible luminance value. * * @deprecated Use minLuminance instead. * @return {Number} The minimum luminance. */ getMinLuminance(): number; /** * Sets the minimum luminance. * * @deprecated Use minLuminance instead. * @param {Number} value - The minimum luminance. */ setMinLuminance(value: number): void; set adaptationRate(arg: number); /** * The luminance adaptation rate. * * @type {Number} */ get adaptationRate(): number; /** * Returns the luminance adaptation rate. * * @deprecated Use adaptationRate instead. * @return {Number} The adaptation rate. */ getAdaptationRate(): number; /** * Sets the luminance adaptation rate. * * @deprecated Use adaptationRate instead. * @param {Number} value - The adaptation rate. */ setAdaptationRate(value: number): void; } /** * A bokeh disc blur material. * * This material should be applied twice in a row, with `fill` mode enabled for the second pass. Enabling the * `foreground` option causes the shader to combine the near and far CoC values around foreground objects. * * @implements {Resizable} */ export class BokehMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new bokeh material. * * @param {Boolean} [fill=false] - Enables or disables the bokeh highlight fill mode. * @param {Boolean} [foreground=false] - Determines whether this material will be applied to foreground colors. */ constructor(fill?: boolean, foreground?: boolean); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The buffer. */ setInputBuffer(value: Texture): void; /** * The circle of confusion buffer. * * @type {Texture} */ set cocBuffer(arg: Texture); /** * Sets the circle of confusion buffer. * * @deprecated Use cocBuffer instead. * @param {Texture} value - The buffer. */ setCoCBuffer(value: Texture): void; set scale(arg: number); /** * The blur scale. * * @type {Number} */ get scale(): number; /** * Returns the blur scale. * * @deprecated Use scale instead. * @return {Number} The scale. */ getScale(value: number): number; /** * Sets the blur scale. * * @deprecated Use scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * A Circle of Confusion shader material. */ export class CircleOfConfusionMaterial extends ShaderMaterial { /** * Constructs a new CoC material. * * @param {Camera} camera - A camera. */ constructor(camera: Camera); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; set focusDistance(arg: number); /** * The focus distance. Range: [0.0, 1.0]. * * @type {Number} */ get focusDistance(): number; /** * Returns the focus distance. * * @deprecated Use focusDistance instead. * @return {Number} The focus distance. */ getFocusDistance(value: number): number; /** * Sets the focus distance. * * @deprecated Use focusDistance instead. * @param {Number} value - The focus distance. */ setFocusDistance(value: number): void; set focalLength(arg: number); /** * The focal length. * * @deprecated Renamed to focusRange. * @type {Number} */ get focalLength(): number; /** * Returns the focal length. * * @deprecated Use focusRange instead. * @return {Number} The focal length. */ getFocalLength(value: number): number; /** * Sets the focal length. * * @deprecated Use focusRange instead. * @param {Number} value - The focal length. */ setFocalLength(value: number): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; /** * The focus distance in world units. * * @type {Number} */ get worldFocusDistance(): number; set worldFocusDistance(value: number); /** * The focus range. Range: [0.0, 1.0]. * * @type {Number} */ get focusRange(): number; set focusRange(value: number); /** * The focus range in world units. * * @type {Number} */ get worldFocusRange(): number; set worldFocusRange(value: number); } /** * A blur kernel size enumeration. * * @type {Object} * @property {Number} VERY_SMALL - A very small kernel that matches a 7x7 Gaussian blur kernel. * @property {Number} SMALL - A small kernel that matches a 15x15 Gaussian blur kernel. * @property {Number} MEDIUM - A medium sized kernel that matches a 23x23 Gaussian blur kernel. * @property {Number} LARGE - A large kernel that matches a 35x35 Gaussian blur kernel. * @property {Number} VERY_LARGE - A very large kernel that matches a 63x63 Gaussian blur kernel. * @property {Number} HUGE - A huge kernel that matches a 127x127 Gaussian blur kernel. */ export enum KernelSize { VERY_SMALL, SMALL, MEDIUM, LARGE, VERY_LARGE, HUGE, } /** * A simple copy shader material. */ export class CopyMaterial extends ShaderMaterial { /** * Constructs a new copy material. */ constructor(); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Number} value - The buffer. */ setInputBuffer(value: number): void; /** * Returns the opacity. * * @deprecated Use opacity instead. * @return {Number} The opacity. */ getOpacity(): number; /** * Sets the opacity. * * @deprecated Use opacity instead. * @param {Number} value - The opacity. */ setOpacity(value: number): void; } /** * A depth comparison shader material. */ export class DepthComparisonMaterial extends ShaderMaterial { /** * Constructs a new depth comparison material. * * @param {Texture} [depthTexture=null] - A depth texture. * @param {PerspectiveCamera} [camera] - A camera. */ constructor(depthTexture?: Texture, camera?: PerspectiveCamera); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=RGBADepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; } /** * An enumeration of depth copy modes. * * @type {Object} * @property {Number} FULL - Copies the full depth texture every frame. * @property {Number} SINGLE - Copies a single texel from the depth texture on demand. */ export enum DepthCopyMode { FULL, SINGLE, } /** * A depth copy shader material. */ export class DepthCopyMaterial extends ShaderMaterial { /** * Constructs a new depth copy material. */ constructor(); /** * The input depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The input depth packing strategy. * * @type {DepthPackingStrategies} */ set inputDepthPacking(arg: DepthPackingStrategies); set outputDepthPacking(arg: DepthPackingStrategies); /** * The output depth packing strategy. * * @type {DepthPackingStrategies} */ get outputDepthPacking(): DepthPackingStrategies; /** * Sets the input depth buffer. * * @deprecated Use depthBuffer and inputDepthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Returns the current input depth packing strategy. * * @deprecated * @return {DepthPackingStrategies} The input depth packing strategy. */ getInputDepthPacking(): DepthPackingStrategies; /** * Sets the input depth packing strategy. * * @deprecated Use inputDepthPacking instead. * @param {DepthPackingStrategies} value - The new input depth packing strategy. */ setInputDepthPacking(value: DepthPackingStrategies): void; /** * Returns the current output depth packing strategy. * * @deprecated Use outputDepthPacking instead. * @return {DepthPackingStrategies} The output depth packing strategy. */ getOutputDepthPacking(): DepthPackingStrategies; /** * Sets the output depth packing strategy. * * @deprecated Use outputDepthPacking instead. * @param {DepthPackingStrategies} value - The new output depth packing strategy. */ setOutputDepthPacking(value: DepthPackingStrategies): void; /** * The screen space position used for single-texel copy operations. * * @type {Vector2} */ get texelPosition(): Vector2; /** * Returns the screen space position used for single-texel copy operations. * * @deprecated Use texelPosition instead. * @return {Vector2} The position. */ getTexelPosition(): Vector2; /** * Sets the screen space position used for single-texel copy operations. * * @deprecated * @param {Vector2} value - The position. */ setTexelPosition(value: Vector2): void; set mode(arg: DepthCopyMode); /** * The depth copy mode. * * @type {DepthCopyMode} */ get mode(): DepthCopyMode; /** * Returns the depth copy mode. * * @deprecated Use mode instead. * @return {DepthCopyMode} The depth copy mode. */ getMode(): DepthCopyMode; /** * Sets the depth copy mode. * * @deprecated Use mode instead. * @param {DepthCopyMode} value - The new mode. */ setMode(value: DepthCopyMode): void; } /** * A depth downsampling shader material. * * * @implements {Resizable} */ export class DepthDownsamplingMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new depth downsampling material. */ constructor(); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * The normal buffer. * * @type {Texture} */ set normalBuffer(arg: Texture); /** * Sets the normal buffer. * * @deprecated Use normalBuffer instead. * @param {Texture} value - The normal buffer. */ setNormalBuffer(value: Texture): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * An enumeration of depth test strategies. * * @type {Object} * @property {Number} DEFAULT - Perform depth test only. * @property {Number} KEEP_MAX_DEPTH - Always keep max depth. * @property {Number} DISCARD_MAX_DEPTH - Always discard max depth. */ export enum DepthTestStrategy { DEFAULT, KEEP_MAX_DEPTH, DISCARD_MAX_DEPTH, } /** * A depth mask shader material. * * This material masks a color buffer by comparing two depth textures. */ export class DepthMaskMaterial extends ShaderMaterial { /** * Constructs a new depth mask material. */ constructor(); set depthMode(arg: DepthModes); /** * The depth mode. * * @type {DepthModes} */ get depthMode(): DepthModes; /** * The primary depth buffer. * * @type {Texture} */ set depthBuffer0(arg: Texture); /** * The primary depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking0(arg: DepthPackingStrategies); /** * Sets the base depth buffer. * * @deprecated Use depthBuffer0 and depthPacking0 instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer0( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * The secondary depth buffer. * * @type {Texture} */ set depthBuffer1(arg: Texture); /** * The secondary depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking1(arg: DepthPackingStrategies); /** * Sets the depth buffer that will be compared with the base depth buffer. * * @deprecated Use depthBuffer1 and depthPacking1 instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer1( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; set maxDepthStrategy(arg: DepthTestStrategy); /** * The strategy for handling maximum depth. * * @type {DepthTestStrategy} */ get maxDepthStrategy(): DepthTestStrategy; set keepFar(arg: boolean); /** * Indicates whether maximum depth values should be preserved. * * @type {Boolean} * @deprecated Use maxDepthStrategy instead. */ get keepFar(): boolean; /** * Returns the strategy for dealing with maximum depth values. * * @deprecated Use maxDepthStrategy instead. * @return {DepthTestStrategy} The strategy. */ getMaxDepthStrategy(): DepthTestStrategy; /** * Sets the strategy for dealing with maximum depth values. * * @deprecated Use maxDepthStrategy instead. * @param {DepthTestStrategy} value - The strategy. */ setMaxDepthStrategy(value: DepthTestStrategy): void; set epsilon(arg: number); /** * A small error threshold that is used for `EqualDepth` and `NotEqualDepth` tests. Default is `1e-5`. * * @type {Number} */ get epsilon(): number; /** * Returns the current error threshold for depth comparisons. Default is `1e-5`. * * @deprecated Use epsilon instead. * @return {Number} The error threshold. */ getEpsilon(): number; /** * Sets the depth comparison error threshold. * * @deprecated Use epsilon instead. * @param {Number} value - The new error threshold. */ setEpsilon(value: number): void; /** * Returns the current depth mode. * * @deprecated Use depthMode instead. * @return {DepthModes} The depth mode. Default is `LessDepth`. */ getDepthMode(): DepthModes; /** * Sets the depth mode. * * @deprecated Use depthMode instead. * @param {DepthModes} mode - The depth mode. */ setDepthMode(mode: DepthModes): void; } /** * An enumeration of edge detection modes. * * @type {Object} * @property {Number} DEPTH - Depth-based edge detection. * @property {Number} LUMA - Luminance-based edge detection. * @property {Number} COLOR - Chroma-based edge detection. */ export enum EdgeDetectionMode { DEPTH, LUMA, COLOR, } /** * An enumeration of predication modes. * * @type {Object} * @property {Number} DISABLED - No predicated thresholding. * @property {Number} DEPTH - Depth-based predicated thresholding. * @property {Number} CUSTOM - Predicated thresholding using a custom buffer. */ export enum PredicationMode { DISABLED, DEPTH, CUSTOM, } /** * An edge detection material. * * Mainly used for Subpixel Morphological Anti-Aliasing. * * @implements {Resizable} */ export class EdgeDetectionMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new edge detection material. * * TODO Remove parameters. * @param {Vector2} [texelSize] - The screen texel size. * @param {EdgeDetectionMode} [mode=EdgeDetectionMode.COLOR] - The edge detection mode. */ constructor(texelSize?: Vector2, mode?: EdgeDetectionMode); set edgeDetectionMode(arg: EdgeDetectionMode); /** * The edge detection mode. * * @type {EdgeDetectionMode} */ get edgeDetectionMode(): EdgeDetectionMode; /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Returns the edge detection mode. * * @deprecated Use edgeDetectionMode instead. * @return {EdgeDetectionMode} The mode. */ getEdgeDetectionMode(): EdgeDetectionMode; /** * Sets the edge detection mode. * * @deprecated Use edgeDetectionMode instead. * @param {EdgeDetectionMode} value - The edge detection mode. */ setEdgeDetectionMode(value: EdgeDetectionMode): void; set localContrastAdaptationFactor(arg: number); /** * The local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH. Default is 2.0. * * If a neighbor edge has _factor_ times bigger contrast than the current edge, the edge will be discarded. * * This allows to eliminate spurious crossing edges and is based on the fact that if there is too much contrast in a * direction, the perceptual contrast in the other neighbors will be hidden. * * @type {Number} */ get localContrastAdaptationFactor(): number; /** * Returns the local contrast adaptation factor. * * @deprecated Use localContrastAdaptationFactor instead. * @return {Number} The factor. */ getLocalContrastAdaptationFactor(): number; /** * Sets the local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH. * * @deprecated Use localContrastAdaptationFactor instead. * @param {Number} value - The local contrast adaptation factor. Default is 2.0. */ setLocalContrastAdaptationFactor(value: number): void; set edgeDetectionThreshold(arg: number); /** * The edge detection threshold. Range: [0.0, 0.5]. * * A lower value results in more edges being detected at the expense of performance. * * For luma- and chroma-based edge detection, 0.1 is a reasonable value and allows to catch most visible edges. 0.05 * is a rather overkill value that allows to catch 'em all. Darker scenes may require an even lower threshold. * * If depth-based edge detection is used, the threshold will depend on the scene depth. * * @type {Number} */ get edgeDetectionThreshold(): number; /** * Returns the edge detection threshold. * * @deprecated Use edgeDetectionThreshold instead. * @return {Number} The threshold. */ getEdgeDetectionThreshold(): number; /** * Sets the edge detection threshold. * * @deprecated Use edgeDetectionThreshold instead. * @param {Number} value - The edge detection threshold. Range: [0.0, 0.5]. */ setEdgeDetectionThreshold(value: number): void; set predicationMode(arg: PredicationMode); /** * The predication mode. * * Predicated thresholding allows to better preserve texture details and to improve edge detection using an additional * buffer such as a light accumulation or depth buffer. * * @type {PredicationMode} */ get predicationMode(): PredicationMode; /** * Returns the predication mode. * * @deprecated Use predicationMode instead. * @return {PredicationMode} The mode. */ getPredicationMode(): PredicationMode; /** * Sets the predication mode. * * @deprecated Use predicationMode instead. * @param {PredicationMode} value - The predication mode. */ setPredicationMode(value: PredicationMode): void; /** * The predication buffer. * * @type {Texture} */ set predicationBuffer(arg: Texture); /** * Sets a custom predication buffer. * * @deprecated Use predicationBuffer instead. * @param {Texture} value - The predication buffer. */ setPredicationBuffer(value: Texture): void; set predicationThreshold(arg: number); /** * The predication threshold. * * @type {Number} */ get predicationThreshold(): number; /** * Returns the predication threshold. * * @deprecated Use predicationThreshold instead. * @return {Number} The threshold. */ getPredicationThreshold(): number; /** * Sets the predication threshold. * * @deprecated Use predicationThreshold instead. * @param {Number} value - The threshold. */ setPredicationThreshold(value: number): void; set predicationScale(arg: number); /** * The predication scale. Range: [1.0, 5.0]. * * Determines how much the edge detection threshold should be scaled when using predication. * * @type {Number} */ get predicationScale(): number; /** * Returns the predication scale. * * @deprecated Use predicationScale instead. * @return {Number} The scale. */ getPredicationScale(): number; /** * Sets the predication scale. * * @deprecated Use predicationScale instead. * @param {Number} value - The scale. Range: [1.0, 5.0]. */ setPredicationScale(value: number): void; set predicationStrength(arg: number); /** * The predication strength. Range: [0.0, 1.0]. * * Determines how much the edge detection threshold should be decreased locally when using predication. * * @type {Number} */ get predicationStrength(): number; /** * Returns the predication strength. * * @deprecated Use predicationStrength instead. * @return {Number} The strength. */ getPredicationStrength(): number; /** * Sets the predication strength. * * @deprecated Use predicationStrength instead. * @param {Number} value - The strength. Range: [0.0, 1.0]. */ setPredicationStrength(value: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } export type ColorEdgesMaterial = EdgeDetectionMaterial; /** * An effect material for compound shaders. Supports dithering. * * @implements {Resizable} */ export class EffectMaterial extends ShaderMaterial implements Resizable { /** * An enumeration of shader code section placeholders used by the {@link EffectPass}. * * @type {Object} * @property {String} FRAGMENT_HEAD - A placeholder for function and variable declarations inside the fragment shader. * @property {String} FRAGMENT_MAIN_UV - A placeholder for UV transformations inside the fragment shader. * @property {String} FRAGMENT_MAIN_IMAGE - A placeholder for color calculations inside the fragment shader. * @property {String} VERTEX_HEAD - A placeholder for function and variable declarations inside the vertex shader. * @property {String} VERTEX_MAIN_SUPPORT - A placeholder for supporting calculations inside the vertex shader. */ static get Section(): { FRAGMENT_HEAD: string; FRAGMENT_MAIN_UV: string; FRAGMENT_MAIN_IMAGE: string; VERTEX_HEAD: string; VERTEX_MAIN_SUPPORT: string; }; /** * Constructs a new effect material. * * @param {Map} [shaderParts] - A collection of shader snippets. See {@link Section}. * @param {Map} [defines] - A collection of preprocessor macro definitions. * @param {Map} [uniforms] - A collection of uniforms. * @param {Camera} [camera] - A camera. * @param {Boolean} [dithering=false] - Whether dithering should be enabled. */ constructor( shaderParts?: Map, defines?: Map, uniforms?: Map, camera?: Camera, dithering?: boolean ); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set depthBuffer(arg: Texture); /** * The depth buffer. * * @type {Texture} */ get depthBuffer(): Texture; set depthPacking(arg: DepthPackingStrategies); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ get depthPacking(): DepthPackingStrategies; /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Sets the shader parts. * * @param {Map} shaderParts - A collection of shader snippets. See {@link Section}. * @return {EffectMaterial} This material. */ setShaderParts(shaderParts: Map): EffectMaterial; /** * Sets the shader macros. * * @param {Map} defines - A collection of preprocessor macro definitions. * @return {EffectMaterial} This material. */ setDefines(defines: Map): EffectMaterial; /** * Sets the shader uniforms. * * @param {Map} uniforms - A collection of uniforms. * @return {EffectMaterial} This material. */ setUniforms(uniforms: Map): EffectMaterial; /** * Sets the required shader extensions. * * @param {Set} extensions - A collection of extensions. * @return {EffectMaterial} This material. */ setExtensions(extensions: Set): EffectMaterial; set encodeOutput(arg: boolean); /** * Indicates whether output encoding is enabled. * * @type {Boolean} */ get encodeOutput(): boolean; /** * Indicates whether output encoding is enabled. * * @deprecated Use encodeOutput instead. * @return {Boolean} Whether output encoding is enabled. */ isOutputEncodingEnabled(): boolean; /** * Enables or disables output encoding. * * @deprecated Use encodeOutput instead. * @param {Boolean} value - Whether output encoding should be enabled. */ setOutputEncodingEnabled(value: boolean): void; set time(arg: number); /** * The time in seconds. * * @type {Number} */ get time(): number; /** * Sets the delta time. * * @deprecated Use time instead. * @param {Number} value - The delta time in seconds. */ setDeltaTime(value: number): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; /** * Sets the resolution. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * An enumeration of shader code placeholders used by the {@link EffectPass}. * @property FRAGMENT_HEAD - A placeholder for function and variable declarations inside the fragment shader. * @property FRAGMENT_MAIN_UV - A placeholder for UV transformations inside the fragment shader. * @property FRAGMENT_MAIN_IMAGE - A placeholder for color calculations inside the fragment shader. * @property VERTEX_HEAD - A placeholder for function and variable declarations inside the vertex shader. * @property VERTEX_MAIN_SUPPORT - A placeholder for supporting calculations inside the vertex shader. * @deprecated Use EffectMaterial.Section instead. */ export const Section: { FRAGMENT_HEAD: string; FRAGMENT_MAIN_UV: string; FRAGMENT_MAIN_IMAGE: string; VERTEX_HEAD: string; VERTEX_MAIN_SUPPORT: string; }; /** * A crepuscular rays shader material. * * @todo Remove dithering code from fragment shader. */ export class GodRaysMaterial extends ShaderMaterial { /** * Constructs a new god rays material. * * TODO Remove lightPosition param. * @param {Vector2} lightPosition - Deprecated. */ constructor(lightPosition: Vector2); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; /** * The screen space position of the light source. * * @type {Vector2} */ get lightPosition(): Vector2; /** * Returns the screen space position of the light source. * * @deprecated Use lightPosition instead. * @return {Vector2} The position. */ getLightPosition(): Vector2; /** * Sets the screen space position of the light source. * * @deprecated Use lightPosition instead. * @param {Vector2} value - The position. */ setLightPosition(value: Vector2): void; set density(arg: number); /** * The density. * * @type {Number} */ get density(): number; /** * Returns the density. * * @deprecated Use density instead. * @return {Number} The density. */ getDensity(): number; /** * Sets the density. * * @deprecated Use density instead. * @param {Number} value - The density. */ setDensity(value: number): void; set decay(arg: number); /** * The decay. * * @type {Number} */ get decay(): number; /** * Returns the decay. * * @deprecated Use decay instead. * @return {Number} The decay. */ getDecay(): number; /** * Sets the decay. * * @deprecated Use decay instead. * @param {Number} value - The decay. */ setDecay(value: number): void; set weight(arg: number); /** * The weight. * * @type {Number} */ get weight(): number; /** * Returns the weight. * * @deprecated Use weight instead. * @return {Number} The weight. */ getWeight(): number; /** * Sets the weight. * * @deprecated Use weight instead. * @param {Number} value - The weight. */ setWeight(value: number): void; set exposure(arg: number); /** * The exposure. * * @type {Number} */ get exposure(): number; /** * Returns the exposure. * * @deprecated Use exposure instead. * @return {Number} The exposure. */ getExposure(): number; /** * Sets the exposure. * * @deprecated Use exposure instead. * @param {Number} value - The exposure. */ setExposure(value: number): void; set maxIntensity(arg: number); /** * The maximum light intensity. * * @type {Number} */ get maxIntensity(): number; /** * Returns the maximum light intensity. * * @deprecated Use maxIntensity instead. * @return {Number} The maximum light intensity. */ getMaxIntensity(): number; /** * Sets the maximum light intensity. * * @deprecated Use maxIntensity instead. * @param {Number} value - The maximum light intensity. */ setMaxIntensity(value: number): void; set samples(arg: number); /** * The amount of samples per pixel. * * @type {Number} */ get samples(): number; /** * Returns the amount of samples per pixel. * * @deprecated Use samples instead. * @return {Number} The sample count. */ getSamples(): number; /** * Sets the amount of samples per pixel. * * @deprecated Use samples instead. * @param {Number} value - The sample count. */ setSamples(value: number): void; } /** * A box blur material. * * @implements {Resizable} */ export class BoxBlurMaterial extends ShaderMaterial {} /** * A box blur pass. */ export class BoxBlurPass extends Pass { /** * Constructs a new box blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=5] - The kernel size. * @param {Number} [options.iterations=1] - The amount of times the blur should be applied. * @param {Number} [options.bilateral=false] - Enables or disables bilateral blurring. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. */ constructor( { kernelSize, iterations, bilateral, resolutionScale, resolutionX, resolutionY }?: { kernelSize?: number; iterations?: number; bilateral?: boolean; resolutionScale?: number; resolutionX?: number; resolutionY?: number; } ); } /** * An optimized Gaussian convolution shader material. * @implements {Resizable} */ export class GaussianBlurMaterial extends ShaderMaterial { /** * Constructs a new convolution material. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=35] - The kernel size. */ constructor( { kernelSize }?: { kernelSize?: number; } ); } /** * A Gaussian blur pass. */ export class GaussianBlurPass extends Pass { /** * Constructs a new Gaussian blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=35] - The kernel size. Should be an odd number in the range [3, 1020]. * @param {Number} [options.iterations=1] - The amount of times the blur should be applied. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. */ constructor( { kernelSize, iterations, resolutionScale, resolutionX, resolutionY }?: { kernelSize?: number; iterations?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; } ); } /** * An optimised convolution shader material. * * @todo Remove dithering code from fragment shader. * @implements {Resizable} */ export class KawaseBlurMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new convolution material. * * TODO Remove texelSize param. * @param {Vector2} [texelSize] - Deprecated. */ constructor(texelSize?: Vector2); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set scale(arg: number); /** * The blur scale. * * @type {Number} */ get scale(): number; /** * Returns the blur scale. * * @deprecated Use scale instead. * @return {Number} The scale. */ getScale(): number; /** * Sets the blur scale. * * @deprecated Use scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; /** * Returns the kernel. * * @return {Float32Array} The kernel. * @deprecated Implementation detail, removed with no replacement. */ getKernel(): Float32Array; set kernel(arg: number); /** * The current kernel. * * @type {Number} */ get kernel(): number; /** * Sets the current kernel. * * @deprecated Use kernel instead. * @param {Number} value - The kernel. */ setKernel(value: number): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } export type ConvolutionMaterial2 = KawaseBlurMaterial; /** * A luminance shader material. * * This shader produces a greyscale luminance map that describes the absolute amount of light emitted by a scene. It can * also be configured to output colors that are scaled with their respective luminance value. Additionally, a range may * be provided to mask out undesired texels. * * The alpha channel always contains the luminance value. */ export class LuminanceMaterial extends ShaderMaterial { /** * Constructs a new luminance material. * * @param {Boolean} [colorOutput=false] - Defines whether the shader should output colors scaled with their luminance value. * @param {Vector2} [luminanceRange] - If provided, the shader will mask out texels that aren't in the specified luminance range. */ constructor(colorOutput?: boolean, luminanceRange?: Vector2); set colorOutput(arg: boolean); /** * Indicates whether color output is enabled. * * @type {Boolean} */ get colorOutput(): boolean; set luminanceRange(arg: boolean); /** * The luminance range. Set to null to disable. * * @type {Boolean} */ get luminanceRange(): boolean; /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set threshold(arg: number); /** * The luminance threshold. * * @type {Number} */ get threshold(): number; /** * Returns the luminance threshold. * * @deprecated Use threshold instead. * @return {Number} The threshold. */ getThreshold(): number; /** * Sets the luminance threshold. * * @deprecated Use threshold instead. * @param {Number} value - The threshold. */ setThreshold(value: number): void; set smoothing(arg: number); /** * The luminance threshold smoothing. * * @type {Number} */ get smoothing(): number; /** * Returns the luminance threshold smoothing factor. * * @deprecated Use smoothing instead. * @return {Number} The smoothing factor. */ getSmoothingFactor(): number; /** * Sets the luminance threshold smoothing factor. * * @deprecated Use smoothing instead. * @param {Number} value - The smoothing factor. */ setSmoothingFactor(value: number): void; set useThreshold(arg: boolean); /** * Indicates whether the luminance threshold is enabled. * * @type {Boolean} * @deprecated Adjust the threshold or smoothing factor instead. */ get useThreshold(): boolean; /** * Indicates whether color output is enabled. * * @deprecated Use colorOutput instead. * @return {Boolean} Whether color output is enabled. */ isColorOutputEnabled(): boolean; /** * Enables or disables color output. * * @deprecated Use colorOutput instead. * @param {Boolean} value - Whether color output should be enabled. */ setColorOutputEnabled(value: boolean): void; set useRange(arg: boolean); /** * Indicates whether luminance masking is enabled. * * @type {Boolean} * @deprecated */ get useRange(): boolean; /** * Returns the current luminance range. * * @deprecated Use luminanceRange instead. * @return {Vector2} The luminance range. */ getLuminanceRange(): Vector2; /** * Sets a luminance range. Set to null to disable. * * @deprecated Use luminanceRange instead. * @param {Vector2} value - The luminance range. */ setLuminanceRange(value: Vector2): void; } /** * A mask function enumeration. * * @type {Object} * @property {Number} DISCARD - Discards elements when the respective mask value is zero. * @property {Number} MULTIPLY - Multiplies the input buffer with the mask texture. * @property {Number} MULTIPLY_RGB_SET_ALPHA - Multiplies the input RGB values with the mask and sets alpha to the mask value. * @property {Number} MULTIPLY_RGB - Multiplies the input RGB values with the mask and keeps the original alpha. */ export enum MaskFunction { DISCARD, MULTIPLY, MULTIPLY_RGB_SET_ALPHA, MULTIPLY_RGB } /** * A mask shader material. * * This material applies a mask texture to a buffer. */ export class MaskMaterial extends ShaderMaterial { /** * Constructs a new mask material. * * @param {Texture} [maskTexture] - The mask texture. */ constructor(maskTexture?: Texture); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; /** * The mask texture. * * @type {Texture} */ set maskTexture(arg: Texture); /** * Sets the mask texture. * * @deprecated Use maskTexture instead. * @param {Texture} value - The texture. */ setMaskTexture(value: Texture): void; /** * Sets the color channel to use for masking. Default is `ColorChannel.RED`. * * @type {ColorChannel} */ set colorChannel(arg: ColorChannel); /** * Sets the color channel to use for masking. Default is `ColorChannel.RED`. * * @deprecated Use colorChannel instead. * @param {ColorChannel} value - The channel. */ setColorChannel(value: ColorChannel): void; /** * The masking technique. Default is `MaskFunction.DISCARD`. * * @type {MaskFunction} */ set maskFunction(arg: MaskFunction); /** * Sets the masking technique. Default is `MaskFunction.DISCARD`. * * @deprecated Use maskFunction instead. * @param {MaskFunction} value - The function. */ setMaskFunction(value: MaskFunction): void; set inverted(arg: boolean); /** * Indicates whether the masking is inverted. * * @type {Boolean} */ get inverted(): boolean; /** * Indicates whether the masking is inverted. * * @deprecated Use inverted instead. * @return {Boolean} Whether the masking is inverted. */ isInverted(): boolean; /** * Determines whether the masking should be inverted. * * @deprecated Use inverted instead. * @param {Boolean} value - Whether the masking should be inverted. */ setInverted(value: boolean): void; set strength(arg: number); /** * The current mask strength. * * Individual mask values will be clamped to [0.0, 1.0]. Has no effect when the mask function is set to `DISCARD`. * * @type {Number} */ get strength(): number; /** * Returns the current mask strength. * * @deprecated Use strength instead. * @return {Number} The mask strength. */ getStrength(): number; /** * Sets the mask strength. * * Has no effect when the mask function is set to `DISCARD`. * * @deprecated Use strength instead. * @param {Number} value - The mask strength. */ setStrength(value: number): void; } /** * An outline shader material. * * @implements {Resizable} */ export class OutlineMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new outline material. * * TODO Remove texelSize param. * @param {Vector2} [texelSize] - The screen texel size. */ constructor(texelSize?: Vector2); /** * The input buffer. * * @param {Texture} arg - The input buffer. */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * An outline shader material. */ export type OutlineEdgesMaterial = OutlineMaterial; /** * Subpixel Morphological Antialiasing. * * This material computes weights for detected edges. * * @implements {Resizable} */ export class SMAAWeightsMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new SMAA weights material. * * @param {Vector2} [texelSize] - The absolute screen texel size. * @param {Vector2} [resolution] - The resolution. */ constructor(texelSize?: Vector2, resolution?: Vector2); /** * The input buffer. * * @param {Texture} arg - The input buffer. */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set searchTexture(arg: Texture); /** * The search lookup texture. * * @type {Texture} */ get searchTexture(): Texture; set areaTexture(arg: Texture); /** * The area lookup texture. * * @type {Texture} */ get areaTexture(): Texture; /** * Sets the search and area lookup textures. * * @deprecated Use searchTexture and areaTexture instead. * @param {Texture} search - The search lookup texture. * @param {Texture} area - The area lookup texture. */ setLookupTextures(search: Texture, area: Texture): void; set orthogonalSearchSteps(arg: number); /** * The maximum amount of steps performed in the horizontal/vertical pattern searches, at each side of the pixel. * Range: [0, 112]. * * In number of pixels, it's actually the double. So the maximum line length perfectly handled by, for example 16, is * 64 (perfectly means that longer lines won't look as good, but are still antialiased). * * @type {Number} */ get orthogonalSearchSteps(): number; /** * Sets the maximum amount of steps performed in the horizontal/vertical pattern searches, at each side of the pixel. * * @deprecated Use orthogonalSearchSteps instead. * @param {Number} value - The search steps. Range: [0, 112]. */ setOrthogonalSearchSteps(value: number): void; set diagonalSearchSteps(arg: number); /** * The maximum steps performed in the diagonal pattern searches, at each side of the pixel. This search * jumps one pixel at a time. Range: [0, 20]. * * On high-end machines this search is cheap (between 0.8x and 0.9x slower for 16 steps), but it can have a * significant impact on older machines. * * @type {Number} */ get diagonalSearchSteps(): number; /** * Specifies the maximum steps performed in the diagonal pattern searches, at each side of the pixel. * * @deprecated Use diagonalSearchSteps instead. * @param {Number} value - The search steps. Range: [0, 20]. */ setDiagonalSearchSteps(value: number): void; set diagonalDetection(arg: boolean); /** * Indicates whether diagonal pattern detection is enabled. * * @type {Boolean} */ get diagonalDetection(): boolean; /** * Indicates whether diagonal pattern detection is enabled. * * @deprecated Use diagonalDetection instead. * @return {Boolean} Whether diagonal pattern detection is enabled. */ isDiagonalDetectionEnabled(): boolean; /** * Enables or disables diagonal pattern detection. * * @deprecated Use diagonalDetection instead. * @param {Boolean} value - Whether diagonal pattern detection should be enabled. */ setDiagonalDetectionEnabled(value: boolean): void; set cornerRounding(arg: number); /** * Specifies how much sharp corners will be rounded. Range: [0, 100]. * * @type {Number} */ get cornerRounding(): number; /** * Specifies how much sharp corners will be rounded. * * @deprecated Use cornerRounding instead. * @param {Number} value - The corner rounding amount. Range: [0, 100]. */ setCornerRounding(value: number): void; set cornerDetection(arg: number); /** * Indicates whether corner detection is enabled. * * @type {Number} */ get cornerDetection(): number; /** * Indicates whether corner rounding is enabled. * * @deprecated Use cornerDetection instead. * @return {Boolean} Whether corner rounding is enabled. */ isCornerRoundingEnabled(): boolean; /** * Enables or disables corner rounding. * * @deprecated Use cornerDetection instead. * @param {Boolean} value - Whether corner rounding should be enabled. */ setCornerRoundingEnabled(value: boolean): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * A Screen Space Ambient Occlusion (SSAO) shader material. * * @implements {Resizable} */ export class SSAOMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new SSAO material. * * @param {Camera} camera - A camera. */ constructor(camera: Camera); /** * The combined normal-depth buffer. * * @param {Texture} arg - The buffer. */ set normalDepthBuffer(arg: Texture); /** * Sets the combined normal-depth buffer. * * @deprecated Use normalDepthBuffer instead. * @param {Texture} value - The buffer. */ setNormalDepthBuffer(value: Texture): void; /** * The normal buffer. * * @param {Texture} arg - The buffer. */ set normalBuffer(arg: Texture); /** * Sets the normal buffer. * * @deprecated Use normalBuffer instead. * @param {Texture} value - The buffer. */ setNormalBuffer(value: Texture): void; /** * The depth buffer. * * @param {Texture} arg - The buffer. */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @param {DepthPackingStrategies} arg - The depth packing strategy. */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * The noise texture. * * @param {Texture} arg - The texture. */ set noiseTexture(arg: Texture); /** * Sets the noise texture. * * @deprecated Use noiseTexture instead. * @param {Texture} value - The texture. */ setNoiseTexture(value: Texture): void; set samples(arg: number); /** * The sample count. * * @type {Number} */ get samples(): number; /** * Returns the amount of occlusion samples per pixel. * * @deprecated Use samples instead. * @return {Number} The sample count. */ getSamples(): number; /** * Sets the amount of occlusion samples per pixel. * * @deprecated Use samples instead. * @param {Number} value - The sample count. */ setSamples(value: number): void; set rings(arg: number); /** * The sampling spiral ring count. * * @type {Number} */ get rings(): number; /** * Returns the amount of spiral turns in the occlusion sampling pattern. * * @deprecated Use rings instead. * @return {Number} The radius. */ getRings(): number; /** * Sets the amount of spiral turns in the occlusion sampling pattern. * * @deprecated Use rings instead. * @param {Number} value - The radius. */ setRings(value: number): void; /** * The intensity. * * @type {Number} * @deprecated Use SSAOEffect.intensity instead. */ get intensity(): number; set intensity(arg: number); /** * Returns the intensity. * * @deprecated Use intensity instead. * @return {Number} The intensity. */ getIntensity(): number; /** * Sets the intensity. * * @deprecated Use intensity instead. * @param {Number} value - The intensity. */ setIntensity(value: number): void; set fade(arg: number); /** * The depth fade factor. * * @type {Number} */ get fade(): number; /** * Returns the depth fade factor. * * @deprecated Use fade instead. * @return {Number} The fade factor. */ getFade(): number; /** * Sets the depth fade factor. * * @deprecated Use fade instead. * @param {Number} value - The fade factor. */ setFade(value: number): void; set bias(arg: number); /** * The depth bias. Range: [0.0, 1.0]. * * @type {Number} */ get bias(): number; /** * Returns the depth bias. * * @deprecated Use bias instead. * @return {Number} The bias. */ getBias(): number; /** * Sets the depth bias. * * @deprecated Use bias instead. * @param {Number} value - The bias. */ setBias(value: number): void; set minRadiusScale(arg: number); /** * The minimum radius scale for distance scaling. Range: [0.0, 1.0]. * * @type {Number} */ get minRadiusScale(): number; /** * Returns the minimum radius scale for distance scaling. * * @deprecated Use minRadiusScale instead. * @return {Number} The minimum radius scale. */ getMinRadiusScale(): number; /** * Sets the minimum radius scale for distance scaling. * * @deprecated Use minRadiusScale instead. * @param {Number} value - The minimum radius scale. */ setMinRadiusScale(value: number): void; set radius(arg: number); /** * The occlusion sampling radius. Range: [0.0, 1.0]. * * @type {Number} */ get radius(): number; /** * Returns the occlusion sampling radius. * * @deprecated Use radius instead. * @return {Number} The radius. */ getRadius(): number; /** * Sets the occlusion sampling radius. * * @deprecated Use radius instead. * @param {Number} value - The radius. Range [1e-6, 1.0]. */ setRadius(value: number): void; set distanceScaling(arg: boolean); /** * Indicates whether distance-based radius scaling is enabled. * * @type {Boolean} */ get distanceScaling(): boolean; /** * Indicates whether distance-based radius scaling is enabled. * * @deprecated Use distanceScaling instead. * @return {Boolean} Whether distance scaling is enabled. */ isDistanceScalingEnabled(): boolean; /** * Enables or disables distance-based radius scaling. * * @deprecated Use distanceScaling instead. * @param {Boolean} value - Whether distance scaling should be enabled. */ setDistanceScalingEnabled(value: boolean): void; set distanceThreshold(arg: number); /** * The occlusion distance threshold. Range: [0.0, 1.0]. * * @type {Number} */ get distanceThreshold(): number; /** * The occlusion distance falloff. * The occlusion distance threshold in world units. * * @type {Number} */ get worldDistanceThreshold(): number; set worldDistanceThreshold(value: number); set distanceFalloff(arg: number); /** * The occlusion distance falloff. Range: [0.0, 1.0]. * * @type {Number} */ get distanceFalloff(): number; /** * The occlusion distance falloff in world units. * * @type {Number} */ get worldDistanceFalloff(): number; set worldDistanceFalloff(value: number); /** * Sets the occlusion distance cutoff. * * @deprecated Use distanceThreshold and distanceFalloff instead. * @param {Number} threshold - The distance threshold. Range [0.0, 1.0]. * @param {Number} falloff - The falloff. Range [0.0, 1.0]. */ setDistanceCutoff(threshold: number, falloff: number): void; set proximityThreshold(arg: number); /** * The occlusion proximity threshold. Range: [0.0, 1.0]. * * @type {Number} */ get proximityThreshold(): number; /** * The occlusion proximity threshold in world units. * * @type {Number} */ get worldProximityThreshold(): number; set worldProximityThreshold(value: number); set proximityFalloff(arg: number); /** * The occlusion proximity falloff. Range: [0.0, 1.0]. * * @type {Number} */ get proximityFalloff(): number; /** * The occlusion proximity falloff in world units. * * @type {Number} */ get worldProximityFalloff(): number; set worldProximityFalloff(value: number); /** * Sets the occlusion proximity cutoff. * * @deprecated Use proximityThreshold and proximityFalloff instead. * @param {Number} threshold - The range threshold. Range [0.0, 1.0]. * @param {Number} falloff - The falloff. Range [0.0, 1.0]. */ setProximityCutoff(threshold: number, falloff: number): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * A resolution. */ export class Resolution extends EventDispatcher { /** * An auto sizing constant. * * Can be used to automatically calculate the width or height based on the original aspect ratio. * * @type {Number} */ static get AUTO_SIZE(): number; /** * Constructs a new resolution. * * TODO Remove resizable param. * @param {Resizable} resizable - A resizable object. * @param {Number} [width=Resolution.AUTO_SIZE] - The preferred width. * @param {Number} [height=Resolution.AUTO_SIZE] - The preferred height. * @param {Number} [scale=1.0] - A resolution scale. */ constructor( resizable: Resizable, width?: number, height?: number, scale?: number ); /** * A resizable object. * * @type {Resizable} * @deprecated Use an event listener for "change" events instead. */ resizable: Resizable; /** * The preferred resolution. * * @type {Vector2} * @deprecated Added for backward-compatibility. */ target: Vector2; set width(arg: number); /** * The effective width. * * If the preferred width and height are set to {@link Resizer.AUTO_SIZE}, the base width will be returned. * * @type {Number} */ get width(): number; set preferredWidth(arg: number); /** * The preferred width. * * @type {Number} */ get preferredWidth(): number; set height(arg: number); /** * The effective height. * * If the preferred width and height are set to {@link Resizer.AUTO_SIZE}, the base height will be returned. * * @type {Number} */ get height(): number; set preferredHeight(arg: number); /** * The preferred height. * * @type {Number} */ get preferredHeight(): number; /** * Returns the effective width. * * If the preferred width and height are set to {@link Resizer.AUTO_SIZE}, the base width will be returned. * * @deprecated Use width instead. * @return {Number} The effective width. */ getWidth(): number; /** * Returns the effective height. * * If the preferred width and height are set to {@link Resizer.AUTO_SIZE}, the base height will be returned. * * @deprecated Use height instead. * @return {Number} The effective height. */ getHeight(): number; set scale(arg: number); /** * The resolution scale. * * @type {Number} */ get scale(): number; /** * Returns the current resolution scale. * * @deprecated Use scale instead. * @return {Number} The scale. */ getScale(): number; /** * Sets the resolution scale. * * Also sets the preferred resolution to {@link Resizer.AUTO_SIZE}. * * @deprecated Use scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; set baseWidth(arg: number); /** * The base width. * * @type {Number} */ get baseWidth(): number; /** * Returns the base width. * * @deprecated Use baseWidth instead. * @return {Number} The base width. */ getBaseWidth(): number; /** * Sets the base width. * * @deprecated Use baseWidth instead. * @param {Number} value - The width. */ setBaseWidth(value: number): void; set baseHeight(arg: number); /** * The base height. * * @type {Number} */ get baseHeight(): number; /** * Returns the base height. * * @deprecated Use baseHeight instead. * @return {Number} The base height. */ getBaseHeight(): number; /** * Sets the base height. * * @deprecated Use baseHeight instead. * @param {Number} value - The height. */ setBaseHeight(value: number): void; /** * Sets the base size. * * @param {Number} width - The width. * @param {Number} height - The height. */ setBaseSize(width: number, height: number): void; /** * Returns the preferred width. * * @deprecated Use preferredWidth instead. * @return {Number} The preferred width. */ getPreferredWidth(): number; /** * Sets the preferred width. * * Use {@link Resizer.AUTO_SIZE} to automatically calculate the width based on the height and aspect ratio. * * @deprecated Use preferredWidth instead. * @param {Number} value - The width. */ setPreferredWidth(value: number): void; /** * Returns the preferred height. * * @deprecated Use preferredHeight instead. * @return {Number} The preferred height. */ getPreferredHeight(): number; /** * Sets the preferred height. * * Use {@link Resizer.AUTO_SIZE} to automatically calculate the height based on the width and aspect ratio. * * @deprecated Use preferredHeight instead. * @param {Number} value - The height. */ setPreferredHeight(value: number): void; /** * Sets the preferred size. * * @param {Number} width - The width. * @param {Number} height - The height. */ setPreferredSize(width: number, height: number): void; /** * Copies the given resolution. * * @param {Resolution} resolution - The resolution. */ copy(resolution: Resolution): void; } export type Resizer = Resolution; /** * An abstract pass. * * @implements {Initializable} * @implements {Resizable} * @implements {Disposable} */ export class Pass implements Initializable, Resizable, Disposable { /** * Constructs a new pass. * * @param {String} [name] - The name of this pass. Does not have to be unique. * @param {Scene} [scene] - The scene to render. The default scene contains a single mesh that fills the screen. * @param {Camera} [camera] - A camera. Fullscreen effect passes don't require a camera. */ constructor(name?: string, scene?: Scene, camera?: Camera); /** * The name of this pass. * * @type {String} */ name: string; /** * The renderer. * * @deprecated * @type {WebGLRenderer} * @protected */ protected renderer: WebGLRenderer; /** * The scene to render. * * @type {Scene} * @protected */ protected scene: Scene; /** * The camera. * * @type {Camera} * @protected */ protected camera: Camera; /** * Only relevant for subclassing. * * Indicates whether the {@link EffectComposer} should swap the frame buffers after this pass has finished * rendering. Set this to `false` if this pass doesn't render to the output buffer or the screen. Otherwise, the * contents of the input buffer will be lost. * * @type {Boolean} */ needsSwap: boolean; /** * Only relevant for subclassing. * * Indicates whether the {@link EffectComposer} should prepare a depth texture for this pass. * Set this to `true` if this pass relies on depth information from a preceding {@link RenderPass}. * * @type {Boolean} */ needsDepthTexture: boolean; /** * Indicates whether this pass is enabled. * * @type {Boolean} */ enabled: boolean; /** * Sets the render to screen flag. * * If this flag is changed, the fullscreen material will be updated as well. * * @type {Boolean} */ set renderToScreen(arg: boolean); /** * Indicates whether this pass should render to screen. * * @type {Boolean} */ get renderToScreen(): boolean; /** * Sets the main scene. * * @type {Scene} */ set mainScene(arg: Scene); /** * Sets the main camera. * * @type {Camera} */ set mainCamera(arg: Camera); /** * Sets the renderer * * @deprecated * @param {WebGLRenderer} renderer - The renderer. */ setRenderer(renderer: WebGLRenderer): void; /** * Indicates whether this pass is enabled. * * @deprecated Use enabled instead. * @return {Boolean} Whether this pass is enabled. */ isEnabled(): boolean; /** * Enables or disables this pass. * * @deprecated Use enabled instead. * @param {Boolean} value - Whether the pass should be enabled. */ setEnabled(value: boolean): void; set fullscreenMaterial(arg: Material); /** * The fullscreen material. * * @type {Material} */ get fullscreenMaterial(): Material; /** * Returns the current fullscreen material. * * @deprecated Use fullscreenMaterial instead. * @return {Material} The current fullscreen material, or null if there is none. */ getFullscreenMaterial(): Material; /** * Sets the fullscreen material. * * @deprecated Use fullscreenMaterial instead. * @protected * @param {Material} value - A fullscreen material. */ protected setFullscreenMaterial(value: Material): void; /** * Returns the current depth texture. * * @return {Texture} The current depth texture, or null if there is none. */ getDepthTexture(): Texture; /** * Sets the depth texture. * * This method will be called automatically by the {@link EffectComposer}. * You may override this method if your pass relies on the depth information of a preceding {@link RenderPass}. * * @param {Texture} depthTexture - A depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing. */ setDepthTexture( depthTexture: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Renders this pass. * * This is an abstract method that must be overridden. * * @abstract * @throws {Error} An error is thrown if the method is not overridden. * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; /** * Sets the size. * * You may override this method if you want to be informed about the size of the backbuffer/canvas. * This method is called before {@link initialize} and every time the size of the {@link EffectComposer} changes. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * This method is called when this pass is added to an {@link EffectComposer}. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; /** * Performs a shallow search for disposable properties and deletes them. * * The {@link EffectComposer} calls this method when it is being destroyed. You can use it independently to free * memory when you're certain that you don't need this pass anymore. */ dispose(): void; } /** * A pass that renders an adaptive luminance map. */ export class AdaptiveLuminancePass extends Pass { /** * Constructs a new adaptive luminance pass. * * @param {Texture} luminanceBuffer - A buffer that contains the current scene luminance. * @param {Object} [options] - The options. * @param {Number} [options.minLuminance=0.01] - The minimum luminance. * @param {Number} [options.adaptationRate=1.0] - The luminance adaptation rate. */ constructor( luminanceBuffer: Texture, { minLuminance, adaptationRate }?: { minLuminance?: number; adaptationRate?: number; } ); /** * The adaptive luminance texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the adaptive 1x1 luminance texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Sets the 1x1 mipmap level. * * This level is used to identify the smallest mipmap of the main luminance texture which contains the downsampled * average scene luminance. * * @type {Number} * @deprecated Use fullscreenMaterial.mipLevel1x1 instead. */ set mipLevel1x1(arg: number); /** * @type {Number} * @deprecated Use fullscreenMaterial.adaptationRate instead. */ set adaptationRate(arg: number); /** * The luminance adaptation rate. * * @type {Number} * @deprecated Use fullscreenMaterial.adaptationRate instead. */ get adaptationRate(): number; /** * Renders the scene normals. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A Kawase blur pass. */ export class KawaseBlurPass extends Pass { /** * An auto sizing flag. * * @type {Number} * @deprecated Use {@link Resolution.AUTO_SIZE} instead. */ static get AUTO_SIZE(): number; /** * Constructs a new Kawase blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.resolutionScale=0.5] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. * @param {KernelSize} [options.kernelSize=KernelSize.MEDIUM] - The blur kernel size. */ constructor({ resolutionScale, resolutionX, resolutionY, width, height, kernelSize }?: { resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; kernelSize?: KernelSize; }); resolution: Resolution; /** * The blur material. * * @type {KawaseBlurMaterial} */ blurMaterial: KawaseBlurMaterial; /** * Indicates whether dithering is enabled. * * @type {Boolean} * @deprecated */ dithering: boolean; /** * The kernel size. * * @type {KernelSize} */ kernelSize: KernelSize; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Sets the render width. * * @type {Number} * @deprecated Use resolution.preferredWidth instead. */ set width(arg: number); /** * The current width of the internal render targets. * * @type {Number} * @deprecated Use resolution.width instead. */ get width(): number; /** * Sets the render height. * * @type {Number} * @deprecated Use resolution.preferredHeight instead. */ set height(arg: number); /** * The current height of the internal render targets. * * @type {Number} * @deprecated Use resolution.height instead. */ get height(): number; set scale(arg: number); /** * The current blur scale. * * @type {Number} * @deprecated Use blurMaterial.scale instead. */ get scale(): number; /** * Returns the current blur scale. * * @deprecated Use blurMaterial.scale instead. * @return {Number} The scale. */ getScale(): number; /** * Sets the blur scale. * * This value influences the overall blur strength and should not be greater than 1. For larger blurs please increase * the kernel size via {@link setKernelSize}! * * Note that the blur strength is closely tied to the resolution. For a smooth transition from no blur to full blur, * set the width or the height to a high enough value. * * @deprecated Use blurMaterial.scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; /** * Returns the kernel size. * * @deprecated Use kernelSize instead. * @return {KernelSize} The kernel size. */ getKernelSize(): KernelSize; /** * Sets the kernel size. * * Larger kernels require more processing power but scale well with larger render resolutions. * * @deprecated Use kernelSize instead. * @param {KernelSize} value - The kernel size. */ setKernelSize(value: KernelSize): void; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution instead. */ setResolutionScale(scale: number): void; /** * Blurs the input buffer and writes the result to the output buffer. The input buffer remains intact, unless it's * also used as the output buffer. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that disables the stencil test. */ export class ClearMaskPass extends Pass { /** * Constructs a new clear mask pass. */ constructor(); /** * Disables the global stencil test. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that clears the input buffer or the screen. */ export class ClearPass extends Pass { /** * Constructs a new clear pass. * * @param {Boolean} [color=true] - Determines whether the color buffer should be cleared. * @param {Boolean} [depth=true] - Determines whether the depth buffer should be cleared. * @param {Boolean} [stencil=false] - Determines whether the stencil buffer should be cleared. */ constructor(color?: boolean, depth?: boolean, stencil?: boolean); /** * Indicates whether the color buffer should be cleared. * * @type {Boolean} * @deprecated Use setClearFlags() instead. */ color: boolean; /** * Indicates whether the depth buffer should be cleared. * * @type {Boolean} * @deprecated Use setClearFlags() instead. */ depth: boolean; /** * Indicates whether the stencil buffer should be cleared. * * @type {Boolean} * @deprecated Use setClearFlags() instead. */ stencil: boolean; /** * An override clear color. Default is null. * * @type {Color} */ overrideClearColor: Color; /** * An override clear alpha. Default is -1. * * @type {Number} */ overrideClearAlpha: number; /** * Sets the clear flags. * * @param {Boolean} color - Whether the color buffer should be cleared. * @param {Boolean} depth - Whether the depth buffer should be cleared. * @param {Boolean} stencil - Whether the stencil buffer should be cleared. */ setClearFlags(color: boolean, depth: boolean, stencil: boolean): void; /** * Returns the override clear color. Default is null. * * @deprecated Use overrideClearColor instead. * @return {Color} The clear color. */ getOverrideClearColor(): Color; /** * Sets the override clear color. * * @deprecated Use overrideClearColor instead. * @param {Color} value - The clear color. */ setOverrideClearColor(value: Color): void; /** * Returns the override clear alpha. Default is -1. * * @deprecated Use overrideClearAlpha instead. * @return {Number} The clear alpha. */ getOverrideClearAlpha(): number; /** * Sets the override clear alpha. * * @deprecated Use overrideClearAlpha instead. * @param {Number} value - The clear alpha. */ setOverrideClearAlpha(value: number): void; /** * Clears the input buffer or the screen. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that copies the contents of an input buffer to another render target. */ export class CopyPass extends Pass { /** * Constructs a new save pass. * * @param {WebGLRenderTarget} [renderTarget] - A render target. * @param {Boolean} [autoResize=true] - Whether the render target size should be updated automatically. */ constructor(renderTarget?: WebGLRenderTarget, autoResize?: boolean); /** * Enables or disables auto resizing of the render target. * * @type {Boolean} */ autoResize: boolean; set resize(arg: boolean); /** * Enables or disables auto resizing of the render target. * * @deprecated Use autoResize instead. * @type {Boolean} */ get resize(): boolean; /** * The output texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the output texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Enables or disables auto resizing of the render target. * * @deprecated Use autoResize instead. * @param {Boolean} value - Whether the render target size should be updated automatically. */ setAutoResizeEnabled(value: boolean): void; /** * Saves the input buffer. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } export type SavePass = CopyPass; /** * A pass that copies depth into a render target. */ export class DepthCopyPass extends Pass { /** * Constructs a new depth save pass. * * @param {Object} [options] - The options. * @param {DepthPackingStrategies} [options.depthPacking=RGBADepthPacking] - The output depth packing. */ constructor({ depthPacking }?: { depthPacking?: DepthPackingStrategies }); /** * The output depth texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the output depth texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * The output depth packing. * * @type {DepthPackingStrategies} */ get depthPacking(): DepthPackingStrategies; /** * Returns the output depth packing. * * @deprecated Use depthPacking instead. * @return {DepthPackingStrategies} The depth packing. */ getDepthPacking(): DepthPackingStrategies; /** * Copies depth from a depth texture. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that downsamples the scene depth by picking the most representative depth in 2x2 texel neighborhoods. If a * normal buffer is provided, the corresponding normals will be stored as well. * * This pass requires WebGL 2. */ export class DepthDownsamplingPass extends Pass { /** * Constructs a new depth downsampling pass. * * @param {Object} [options] - The options. * @param {Texture} [options.normalBuffer=null] - A texture that contains view space normals. See {@link NormalPass}. * @param {Number} [options.resolutionScale=0.5] - The resolution scale. * @param {Number} [options.width=Resolution.AUTO_SIZE] - The render width. * @param {Number} [options.height=Resolution.AUTO_SIZE] - The render height. */ constructor({ normalBuffer, resolutionScale, width, height }?: { normalBuffer?: Texture; resolutionScale?: number; width?: number; height?: number; }); resolution: Resolution; /** * The normal(RGB) + depth(A) texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the normal(RGB) + depth(A) texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Downsamples depth and scene normals. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that renders a given scene into the input buffer or to screen. * * This pass uses a {@link ClearPass} to clear the target buffer. */ export class RenderPass extends Pass { /** * Constructs a new render pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera to use to render the scene. * @param {Material} [overrideMaterial=null] - An override material. */ constructor(scene?: Scene, camera?: Camera, overrideMaterial?: Material); /** * A clear pass. * * @type {ClearPass} */ clearPass: ClearPass; /** * Indicates whether the scene background should be ignored. * * @type {Boolean} */ ignoreBackground: boolean; /** * Indicates whether the shadow map auto update should be skipped. * * @type {Boolean} */ skipShadowMapUpdate: boolean; /** * A selection of objects to render. * * @type {Selection} */ selection: Selection; set overrideMaterial(arg: Material); /** * The current override material. * * @type {Material} */ get overrideMaterial(): Material; /** * Returns the current override material. * * @deprecated Use overrideMaterial instead. * @return {Material} The material. */ getOverrideMaterial(): Material; /** * Sets the override material. * * @deprecated Use overrideMaterial instead. * @param {Material} value - The material. */ setOverrideMaterial(value: Material): void; set clear(arg: boolean); /** * Indicates whether the target buffer should be cleared before rendering. * * @type {Boolean} * @deprecated Use clearPass.enabled instead. */ get clear(): boolean; /** * Returns the selection. Default is `null` (no restriction). * * @deprecated Use selection instead. * @return {Selection} The selection. */ getSelection(): Selection; /** * Sets the selection. Set to `null` to disable. * * @deprecated Use selection instead. * @param {Selection} value - The selection. */ setSelection(value: Selection): void; /** * Indicates whether the scene background is disabled. * * @deprecated Use ignoreBackground instead. * @return {Boolean} Whether the scene background is disabled. */ isBackgroundDisabled(): boolean; /** * Enables or disables the scene background. * * @deprecated Use ignoreBackground instead. * @param {Boolean} value - Whether the scene background should be disabled. */ setBackgroundDisabled(value: boolean): void; /** * Indicates whether the shadow map auto update is disabled. * * @deprecated Use skipShadowMapUpdate instead. * @return {Boolean} Whether the shadow map update is disabled. */ isShadowMapDisabled(): boolean; /** * Enables or disables the shadow map auto update. * * @deprecated Use skipShadowMapUpdate instead. * @param {Boolean} value - Whether the shadow map auto update should be disabled. */ setShadowMapDisabled(value: boolean): void; /** * Returns the clear pass. * * @deprecated Use clearPass.enabled instead. * @return {ClearPass} The clear pass. */ getClearPass(): ClearPass; /** * Renders the scene. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that renders depth into an RGBA buffer. */ export class DepthPass extends Pass { /** * Constructs a new depth pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera to use to render the scene. * @param {Object} [options] - The options. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. * @param {WebGLRenderTarget} [options.renderTarget] - A custom render target. */ constructor( scene?: Scene, camera?: Camera, { resolutionScale, resolutionX, resolutionY, width, height, renderTarget }?: { resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; renderTarget?: WebGLRenderTarget; } ); resolution: Resolution; /** * The depth texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the depth texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution instead. */ setResolutionScale(scale: number): void; /** * Renders the scene depth. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A depth picking pass. */ export class DepthPickingPass extends DepthCopyPass { /** * Constructs a new depth picking pass. * * @param {Object} [options] - The options. * @param {DepthPackingStrategies} [options.depthPacking=RGBADepthPacking] - The depth packing. * @param {Number} [options.mode=DepthCopyMode.SINGLE] - The depth copy mode. */ constructor({ depthPacking, mode }?: { depthPacking?: DepthPackingStrategies; mode?: number; }); /** * Reads depth at a specific screen position. * * Only one depth value can be picked per frame. Calling this method multiple times per frame will overwrite the * picking coordinates. Unresolved promises will be abandoned. * * @example * const ndc = new Vector3(); * const clientRect = myViewport.getBoundingClientRect(); * const clientX = pointerEvent.clientX - clientRect.left; * const clientY = pointerEvent.clientY - clientRect.top; * ndc.x = (clientX / myViewport.clientWidth) * 2.0 - 1.0; * ndc.y = -(clientY / myViewport.clientHeight) * 2.0 + 1.0; * const depth = await depthPickingPass.readDepth(ndc); * ndc.z = depth * 2.0 - 1.0; * * const worldPosition = ndc.unproject(camera); * * @param {Vector2|Vector3} ndc - Normalized device coordinates. Only X and Y are relevant. * @return {Promise} A promise that returns the depth on the next frame. */ readDepth(ndc: Vector2 | Vector3): Promise; /** * Copies depth and resolves depth picking promises. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A blend function enumeration. * @type {Object} * @property {Number} SKIP - Deprecated. Use DST instead. Warning: This blend function does NOT fully disable the effect. * @property {Number} SET - Deprecated. Use SRC instead. * @property {Number} ADD - Additive blending. Fast, but may produce washed out results. * @property {Number} ALPHA - Alpha blending. Blends based on the alpha value of the new color. * @property {Number} AVERAGE - Calculates the avarage of the new color and the base color. * @property {Number} COLOR - Converts the colors to HSL and blends based on color. * @property {Number} COLOR_BURN - Color burn. * @property {Number} COLOR_DODGE - Color dodge. * @property {Number} DARKEN - Prioritize darker colors. * @property {Number} DIFFERENCE - Color difference. * @property {Number} DIVIDE - Color division. * @property {Number} DST - Overwrites the new color with the base color. Ignores opacity. * @property {Number} EXCLUSION - Color exclusion. * @property {Number} HARD_LIGHT - Hard light. * @property {Number} HARD_MIX - Hard mix. * @property {Number} HUE - Converts the colors to HSL and blends based on hue. * @property {Number} INVERT - Overwrites the base color with the inverted new color. * @property {Number} INVERT_RGB - Multiplies the new color with the inverted base color. * @property {Number} LIGHTEN - Prioritize lighter colors. * @property {Number} LINEAR_BURN - Linear burn. * @property {Number} LINEAR_DODGE - Same as ADD but limits the result to 1. * @property {Number} LINEAR_LIGHT - Linear light. * @property {Number} LUMINOSITY - Converts the colors to HSL and blends based on luminosity. * @property {Number} MULTIPLY - Color multiplication. * @property {Number} NEGATION - Negates the base color using the new color. * @property {Number} NORMAL - Overwrites the base color with the new one. * @property {Number} OVERLAY - Color overlay. * @property {Number} PIN_LIGHT - Pin light. * @property {Number} REFLECT - Color reflection. * @property {Number} SCREEN - Screen blending. The two colors are effectively projected on a white screen simultaneously. * @property {Number} SRC - Overwrites the base color with the new one. Ignores opacity. * @property {Number} SATURATION - Converts the colors to HSL and blends based on saturation. * @property {Number} SOFT_LIGHT - Soft light. * @property {Number} SUBTRACT - Subtracts the new color from the base color. * @property {Number} VIVID_LIGHT - Vivid light. */ export enum BlendFunction { SKIP, SET, ADD, ALPHA, AVERAGE, COLOR, COLOR_BURN, COLOR_DODGE, DARKEN, DIFFERENCE, DIVIDE, DST, EXCLUSION, HARD_LIGHT, HARD_MIX, HUE, INVERT, INVERT_RGB, LIGHTEN, LINEAR_BURN, LINEAR_DODGE, LINEAR_LIGHT, LUMINOSITY, MULTIPLY, NEGATION, NORMAL, OVERLAY, PIN_LIGHT, REFLECT, SATURATION, SCREEN, SOFT_LIGHT, SRC, SUBTRACT, VIVID_LIGHT } /** * A blend mode. */ export class BlendMode extends EventDispatcher { /** * Constructs a new blend mode. * * @param {BlendFunction} blendFunction - The blend function. * @param {Number} opacity - The opacity of the color that will be blended with the base color. */ constructor(blendFunction: BlendFunction, opacity?: number); /** * A uniform that controls the opacity of this blend mode. * * TODO Add opacity accessors for uniform value. * @type {Uniform} */ opacity: Uniform; /** * Returns the opacity. * * @return {Number} The opacity. */ getOpacity(): number; /** * Sets the opacity. * * @param {Number} value - The opacity. */ setOpacity(value: number): void; /** * Returns the blend function. * * @deprecated Use blendFunction instead. * @return {BlendFunction} The blend function. */ getBlendFunction(): BlendFunction; /** * Sets the blend function. * * @deprecated Use blendFunction instead. * @param {BlendFunction} value - The blend function. */ setBlendFunction(value: BlendFunction): void; /** * Returns the blend function shader code. * * @return {String} The blend function shader code. */ getShaderCode(): string; /** * The blend function. * * @type {BlendFunction} */ get blendFunction(): BlendFunction; set blendFunction(value: BlendFunction); } /** * An abstract effect. * * Effects can be combined using the {@link EffectPass}. * * @implements {Initializable} * @implements {Resizable} * @implements {Disposable} */ export class Effect extends EventDispatcher implements Initializable, Resizable, Disposable { /** * Constructs a new effect. * * @param {String} name - The name of this effect. Doesn't have to be unique. * @param {String} fragmentShader - The fragment shader. This shader is required. * @param {Object} [options] - Additional options. * @param {EffectAttribute} [options.attributes=EffectAttribute.NONE] - The effect attributes that determine the execution priority and resource requirements. * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function of this effect. * @param {Map} [options.defines] - Custom preprocessor macro definitions. Keys are names and values are code. * @param {Map} [options.uniforms] - Custom shader uniforms. Keys are names and values are uniforms. * @param {Set} [options.extensions] - WebGL extensions. * @param {String} [options.vertexShader=null] - The vertex shader. Most effects don't need one. */ constructor( name: string, fragmentShader: string, { attributes, blendFunction, defines, uniforms, extensions, vertexShader }?: { attributes?: EffectAttribute; blendFunction?: BlendFunction; defines?: Map; uniforms?: Map; extensions?: Set; vertexShader?: string; } ); /** * The name of this effect. * * @type {String} */ name: string; /** * The renderer. * * @type {WebGLRenderer} * @protected * @deprecated */ protected renderer: WebGLRenderer; /** * Preprocessor macro definitions. * * Call {@link Effect.setChanged} after changing macro definitions. * * @type {Map} */ readonly defines: Map; /** * Shader uniforms. * * Call {@link Effect.setChanged} after adding or removing uniforms. * * @type {Map} */ readonly uniforms: Map; /** * WebGL extensions that are required by this effect. * * Call {@link Effect.setChanged} after adding or removing extensions. * * @type {Set} */ readonly extensions: Set; /** * The blend mode of this effect. * * @type {BlendMode} */ readonly blendMode: BlendMode; /** * The input color space. * * @type {ColorSpace} * @experimental */ get inputColorSpace(): ColorSpace; /** * @type {ColorSpace} * @protected * @experimental */ protected set inputColorSpace(arg: ColorSpace); /** * The output color space. * * Should only be changed if this effect converts the input colors to a different color space. * * @type {ColorSpace} * @experimental */ get outputColorSpace(): ColorSpace; /** * @type {ColorSpace} * @protected * @experimental */ protected set outputColorSpace(arg: ColorSpace); /** * Sets the main scene. * * @type {Scene} */ set mainScene(arg: Scene); /** * Sets the main camera. * * @type {Camera} */ set mainCamera(arg: Camera); /** * Returns the name of this effect. * * @deprecated Use name instead. * @return {String} The name. */ getName(): string; /** * Sets the renderer. * * @deprecated * @param {WebGLRenderer} renderer - The renderer. */ setRenderer(renderer: WebGLRenderer): void; /** * Returns the preprocessor macro definitions. * * @deprecated Use defines instead. * @return {Map} The extensions. */ getDefines(): Map; /** * Returns the uniforms of this effect. * * @deprecated Use uniforms instead. * @return {Map} The extensions. */ getUniforms(): Map; /** * Returns the WebGL extensions that are required by this effect. * * @deprecated Use extensions instead. * @return {Set} The extensions. */ getExtensions(): Set; /** * Returns the blend mode. * * The result of this effect will be blended with the result of the previous effect using this blend mode. * * @deprecated Use blendMode instead. * @return {BlendMode} The blend mode. */ getBlendMode(): BlendMode; /** * Returns the effect attributes. * * @return {EffectAttribute} The attributes. */ getAttributes(): EffectAttribute; /** * Sets the effect attributes. * * Effects that have the same attributes will be executed in the order in which they were registered. Some attributes * imply a higher priority. * * @protected * @param {EffectAttribute} attributes - The attributes. */ protected setAttributes(attributes: EffectAttribute): void; /** * Returns the fragment shader. * * @return {String} The fragment shader. */ getFragmentShader(): string; /** * Sets the fragment shader. * * @protected * @param {String} fragmentShader - The fragment shader. */ protected setFragmentShader(fragmentShader: string): void; /** * Returns the vertex shader. * * @return {String} The vertex shader. */ getVertexShader(): string; /** * Sets the vertex shader. * * @protected * @param {String} vertexShader - The vertex shader. */ protected setVertexShader(vertexShader: string): void; /** * Informs the associated {@link EffectPass} that this effect requires a shader recompilation. * * Should be called after changing macros or extensions and after adding/removing uniforms. * * @protected */ protected setChanged(): void; /** * Sets the depth texture. * * You may override this method if your effect requires direct access to the depth texture that is bound to the * associated {@link EffectPass}. * * @param {Texture} depthTexture - A depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing. */ setDepthTexture( depthTexture: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Updates this effect by performing supporting operations. * * This method is called by the {@link EffectPass} right before the main fullscreen render operation, even if the * blend function is set to `SKIP`. * * You may override this method if you need to update custom uniforms or render additional off-screen textures. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of this effect. * * You may override this method if you want to be informed about the size of the backbuffer/canvas. * This method is called before {@link initialize} and every time the size of the {@link EffectComposer} changes. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * This method is called when the associated {@link EffectPass} is added to an {@link EffectComposer}. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. * @example if(!alpha && frameBufferType === UnsignedByteType) { this.myRenderTarget.texture.format = RGBFormat; } */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; /** * Performs a shallow search for properties that define a dispose method and deletes them. * * The {@link EffectComposer} calls this method when it is being destroyed. */ dispose(): void; } /** * An enumeration of effect attributes. * * Attributes can be concatenated using the bitwise OR operator. * * @type {Object} * @property {Number} NONE - No attributes. Most effects don't need to specify any attributes. * @property {Number} DEPTH - Describes effects that require a depth texture. * @property {Number} CONVOLUTION - Describes effects that fetch additional samples from the input buffer. There cannot be more than one effect with this attribute per {@link EffectPass}. * @example const attributes = EffectAttribute.CONVOLUTION | EffectAttribute.DEPTH; */ export enum EffectAttribute { CONVOLUTION, DEPTH, NONE, } /** * An enumeration of WebGL extensions. * * @type {Object} * @property {String} DERIVATIVES - Enables derivatives by adding the functions dFdx, dFdy and fwidth. * @property {String} FRAG_DEPTH - Enables gl_FragDepthEXT to set a depth value of a fragment from within the fragment shader. * @property {String} DRAW_BUFFERS - Enables multiple render targets (MRT) support. * @property {String} SHADER_TEXTURE_LOD - Enables explicit control of texture LOD. */ export enum WebGLExtension { DERIVATIVES = "derivatives", FRAG_DEPTH = "fragDepth", DRAW_BUFFERS = "drawBuffers", SHADER_TEXTURE_LOD = "shaderTextureLOD", } /** * An effect pass. * * Use this pass to combine {@link Effect} instances. */ export class EffectPass extends Pass { /** * Constructs a new effect pass. * * @param {Camera} camera - The main camera. * @param {...Effect} effects - The effects that will be rendered by this pass. */ constructor(camera?: Camera, ...effects: Effect[]); /** * The effects. * * Use `updateMaterial` or `recompile` after changing the effects and consider calling `dispose` to free resources * of unused effects. * * @type {Effect[]} * @protected */ private effects: Effect[]; /** * A time offset. * * Elapsed time will start at this value. * * @type {Number} * @deprecated */ minTime: number; /** * The maximum time. * * If the elapsed time exceeds this value, it will be reset. * * @type {Number} * @deprecated */ maxTime: number; set encodeOutput(arg: boolean); /** * Indicates whether this pass encodes its output when rendering to screen. * * @type {Boolean} * @deprecated Use fullscreenMaterial.encodeOutput instead. */ get encodeOutput(): boolean; set dithering(arg: boolean); /** * Indicates whether dithering is enabled. * * @type {Boolean} */ get dithering(): boolean; /** * Updates the compound shader material. */ protected updateMaterial(): void; /** * Rebuilds the shader material. */ recompile(): void; /** * Sets the effects. * * @param effects - The effects. */ protected setEffects(effects: Effect[]): void; /** * Returns the current depth texture. * @returns The current depth texture, or null if there is none. */ getDepthTexture(): Texture; /** * Sets the depth texture. * @param depthTexture - A depth texture. * @param [depthPacking = 0] - The depth packing. */ setDepthTexture(depthTexture: Texture, depthPacking?: number): void; /** * Renders the effect. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; /** * Updates the size of this pass. * @param width - The width. * @param height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * @param renderer - The renderer. * @param alpha - Whether the renderer uses the alpha channel or not. * @param frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; /** * Deletes disposable objects. * This pass will be inoperative after this method was called! */ dispose(): void; /** * Handles events. * * @param {Event} event - An event. */ handleEvent(event: Event): void; } /** * A pass that executes a given function. */ export class LambdaPass extends Pass { /** * Constructs a new lambda pass. * * @param {Function} f - A function. */ constructor(f: Function); } /** * A pass that renders luminance. */ export class LuminancePass extends Pass { /** * Constructs a new luminance pass. * * @param {Object} [options] - The options. See {@link LuminanceMaterial} for additional options. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. * @param {WebGLRenderTarget} [options.renderTarget] - A custom render target. */ constructor({ resolutionScale, resolutionX, resolutionY, width, height, renderTarget }?: { resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; renderTarget?: WebGLRenderTarget; }); resolution: Resolution; /** * The luminance texture. * * @type {Texture} */ get texture(): Texture; /** * Returns the luminance texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Renders the luminance. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A stencil mask pass. * * This pass requires that the input and output buffers have a stencil buffer. You can enable the stencil buffer via the * {@link EffectComposer} constructor. */ export class MaskPass extends Pass { /** * Constructs a new mask pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera to use. */ constructor(scene?: Scene, camera?: Camera); /** * A clear pass. * * @type {ClearPass} */ clearPass: ClearPass; /** * Inverse flag. * * @type {Boolean} * @deprecated Use inverted instead. */ inverse: boolean; set inverted(arg: boolean); /** * Indicates whether the mask should be inverted. * * @type {Boolean} */ get inverted(): boolean; set clear(arg: boolean); /** * Indicates whether this pass should clear the stencil buffer. * * @type {Boolean} * @deprecated Use clearPass.enabled instead. */ get clear(): boolean; /** * Returns the internal clear pass. * * @deprecated Use clearPass.enabled instead. * @return {ClearPass} The clear pass. */ getClearPass(): ClearPass; /** * Indicates whether the mask is inverted. * * @deprecated Use inverted instead. * @return {Boolean} Whether the mask is inverted. */ isInverted(): boolean; /** * Enables or disable mask inversion. * * @deprecated Use inverted instead. * @param {Boolean} value - Whether the mask should be inverted. */ setInverted(value: boolean): void; /** * Renders the effect. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A pass that renders the normals of a given scene. */ export class NormalPass extends Pass { /** * Constructs a new normal pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera to use to render the scene. * @param {Object} [options] - The options. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. * @param {WebGLRenderTarget} [options.renderTarget] - A custom render target. */ constructor( scene?: Scene, camera?: Camera, { resolutionScale, resolutionX, resolutionY, width, height, renderTarget }?: { resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; renderTarget?: WebGLRenderTarget; } ); resolution: Resolution; /** * The normal texture. * * @type {Texture} */ get texture(): Texture; /** * The normal texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution.preferredWidth or resolution.preferredHeight instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution.preferredWidth or resolution.preferredHeight instead. */ setResolutionScale(scale: number): void; /** * Renders the scene normals. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * A shader pass. * * Renders any shader material as a fullscreen effect. This pass should not be used to create multiple chained effects. * For a more efficient solution, please refer to the {@link EffectPass}. */ export class ShaderPass extends Pass { /** * Constructs a new shader pass. * * @param {ShaderMaterial} material - A shader material. * @param {String} [input="inputBuffer"] - The name of the input buffer uniform. */ constructor(material: ShaderMaterial, input?: string); /** * Sets the name of the input buffer uniform. * * Most fullscreen materials modify texels from an input texture. This pass automatically assigns the main input * buffer to the uniform identified by the given name. * * @param {String} input - The name of the input buffer uniform. */ setInput(input: string): void; /** * Renders the effect. * @param renderer - The renderer. * @param inputBuffer - A frame buffer that contains the result of the previous pass. * @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param [deltaTime] - The time between the last frame and the current one in seconds. * @param [stencilTest] - Indicates whether a stencil mask is active. */ render( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget | null, outputBuffer: WebGLRenderTarget | null, deltaTime?: number, stencilTest?: boolean ): void; } /** * The EffectComposer may be used in place of a normal WebGLRenderer. * * The auto clear behaviour of the provided renderer will be disabled to prevent unnecessary clear operations. * * It is common practice to use a {@link RenderPass} as the first pass to automatically clear the buffers and render a * scene for further processing. * * @implements {Resizable} * @implements {Disposable} */ export class EffectComposer implements Resizable, Disposable { /** * Constructs a new effect composer. * * @param {WebGLRenderer} renderer - The renderer that should be used. * @param {Object} [options] - The options. * @param {Boolean} [options.depthBuffer=true] - Whether the main render targets should have a depth buffer. * @param {Boolean} [options.stencilBuffer=false] - Whether the main render targets should have a stencil buffer. * @param {Boolean} [options.alpha] - Deprecated. Buffers are always RGBA since three r137. * @param {Number} [options.multisampling=0] - The number of samples used for multisample antialiasing. Requires WebGL 2. * @param {Number} [options.frameBufferType] - The type of the internal frame buffers. It's recommended to use HalfFloatType if possible. */ constructor( renderer?: WebGLRenderer, { depthBuffer, stencilBuffer, multisampling, frameBufferType }?: { depthBuffer?: boolean; stencilBuffer?: boolean; alpha?: boolean; multisampling?: number; frameBufferType?: number; } ); /** * The input buffer. * * Two identical buffers are used to avoid reading from and writing to the same render target. * * @type {WebGLRenderTarget} */ inputBuffer: WebGLRenderTarget; /** * The output buffer. * * @type {WebGLRenderTarget} */ outputBuffer: WebGLRenderTarget; /** * The passes. * * @type {Pass[]} */ passes: Pass[]; /** * Determines whether the last pass automatically renders to screen. * * @type {Boolean} */ autoRenderToScreen: boolean; /** * Sets the amount of MSAA samples. * * Requires WebGL 2. Set to zero to disable multisampling. * * @type {Number} */ set multisampling(arg: number); /** * The current amount of samples used for multisample anti-aliasing. * * @type {Number} */ get multisampling(): number; /** * Returns the internal timer. * * @return {Timer} The timer. */ getTimer(): Timer3; /** * Returns the renderer. * * @return {WebGLRenderer} The renderer. */ getRenderer(): WebGLRenderer; /** * Sets the renderer. * * @param {WebGLRenderer} renderer - The renderer. */ setRenderer(renderer: WebGLRenderer): void; /** * Replaces the current renderer with the given one. * * The auto clear mechanism of the provided renderer will be disabled. If the new render size differs from the * previous one, all passes will be updated. * * By default, the DOM element of the current renderer will automatically be removed from its parent node and the DOM * element of the new renderer will take its place. * * @deprecated Use setRenderer instead. * @param {WebGLRenderer} renderer - The new renderer. * @param {Boolean} updateDOM - Indicates whether the old canvas should be replaced by the new one in the DOM. * @return {WebGLRenderer} The old renderer. */ replaceRenderer( renderer: WebGLRenderer, updateDOM?: boolean ): WebGLRenderer; /** * Creates a new render target. * * @deprecated Create buffers manually via WebGLRenderTarget instead. * @param {Boolean} depthBuffer - Whether the render target should have a depth buffer. * @param {Boolean} stencilBuffer - Whether the render target should have a stencil buffer. * @param {Number} type - The frame buffer type. * @param {Number} multisampling - The number of samples to use for antialiasing. * @return {WebGLRenderTarget} A new render target that equals the renderer's canvas. */ createBuffer( depthBuffer: boolean, stencilBuffer: boolean, type: number, multisampling: number ): WebGLRenderTarget; /** * Can be used to change the main scene for all registered passes and effects. * * @param {Scene} scene - The scene. */ setMainScene(scene: Scene): void; /** * Can be used to change the main camera for all registered passes and effects. * * @param {Camera} camera - The camera. */ setMainCamera(camera: Camera): void; /** * Adds a pass, optionally at a specific index. * * @param {Pass} pass - A new pass. * @param {Number} [index] - An index at which the pass should be inserted. */ addPass(pass: Pass, index?: number): void; /** * Removes a pass. * * @param {Pass} pass - The pass. */ removePass(pass: Pass): void; /** * Removes all passes. */ removeAllPasses(): void; /** * Renders all enabled passes in the order in which they were added. * * @param {Number} [deltaTime] - The time since the last frame in seconds. */ render(deltaTime?: number): void; /** * Sets the size of the buffers, passes and the renderer. * * @param {Number} width - The width. * @param {Number} height - The height. * @param {Boolean} [updateStyle] - Determines whether the style of the canvas should be updated. */ setSize(width: number, height: number, updateStyle?: boolean): void; /** * Resets this composer by deleting all passes and creating new buffers. */ reset(): void; /** * Disposes this composer and all passes. */ dispose(): void; } /** * An override material manager. * * Includes a workaround that fixes override materials for skinned meshes and instancing. Doesn't fix uniforms such as * normal maps and displacement maps. Using the workaround may have a negative impact on performance if the scene * contains a lot of meshes. * * @implements {Disposable} */ export class OverrideMaterialManager implements Disposable { /** * Enables or disables the override material workaround globally. * * This only affects post processing passes and effects. * * @type {Boolean} */ static set workaroundEnabled(arg: boolean); /** * Indicates whether the override material workaround is enabled. * * @type {Boolean} */ static get workaroundEnabled(): boolean; /** * Constructs a new override material manager. * * @param {Material} [material=null] - An override material. */ constructor(material?: Material); /** * Sets the override material. * * @param {Material} material - The material. */ setMaterial(material: Material): void; /** * Performs cleanup tasks. */ dispose(): void; } /** * The Resizable contract. * * Implemented by objects that can be resized. * * @interface */ export interface Resizable { /** * Sets the size of this object. * * @param {number} width - The width. * @param {number} height - The height. */ setSize(width: number, height: number): void; } /** * A timer that provides read access to time data. * * @interface */ export interface ImmutableTimer { /** * The current delta time in seconds. * * @type {Number} */ getDelta(): number; /** * The elapsed time in seconds. * * @type {Number} */ getElapsed(): number; } /** * An object selection. * * Object selections use render layers to facilitate quick and efficient visibility changes. */ export class Selection extends Set { /** * Constructs a new selection. * * @param {Iterable} [iterable] - A collection of objects that should be added to this selection. * @param {Number} [layer=10] - A dedicated render layer for selected objects. */ constructor(iterable?: Iterable, layer?: number); /** * Controls whether objects that are added to this selection should be removed from all other layers. * * @type {Boolean} */ exclusive: boolean; set layer(arg: number); /** * The render layer for selected objects. * * @type {Number} */ get layer(): number; /** * Returns the current render layer for selected objects. * * The default layer is 10. If this collides with your own custom layers, please change it before rendering! * * @deprecated Use layer instead. * @return {Number} The layer. */ getLayer(): number; /** * Sets the render layer for selected objects. * * The current selection will be updated accordingly. * * @deprecated Use layer instead. * @param {Number} value - The layer. Range is [0, 31]. */ setLayer(value: number): void; /** * Indicates whether objects that are added to this selection will be removed from all other layers. * * @deprecated Use exclusive instead. * @return {Number} Whether this selection is exclusive. Default is false. */ isExclusive(): number; /** * Controls whether objects that are added to this selection should be removed from all other layers. * * @deprecated Use exclusive instead. * @param {Number} value - Whether this selection should be exclusive. */ setExclusive(value: number): void; /** * Clears this selection. * * @return {Selection} This selection. */ clear(): this; /** * Clears this selection and adds the given objects. * * @param {Iterable} objects - The objects that should be selected. * @return {Selection} This selection. */ set(objects: Iterable): this; /** * An alias for {@link has}. * * @param {Object3D} object - An object. * @return {Number} Returns 0 if the given object is currently selected, or -1 otherwise. * @deprecated Added for backward-compatibility. */ indexOf(object: Object3D): number; /** * Adds an object to this selection. * * If {@link exclusive} is set to `true`, the object will also be removed from all other layers. * * @param {Object3D} object - The object that should be selected. * @return {Selection} This selection. */ add(object: Object3D): this; /** * Removes an existing object from the selection. If the object doesn't exist it's added instead. * * @param {Object3D} object - The object. * @return {Boolean} Returns true if the object is added, false otherwise. */ toggle(object: Object3D): boolean; /** * Sets the visibility of all selected objects. * * This method enables or disables render layer 0 of all selected objects. * * @param {Boolean} visible - Whether the selected objects should be visible. * @return {Selection} This selection. */ setVisible(visible: boolean): this; } /** * A timer. * * Original implementation by Michael Herzog (Mugen87). * * @deprecated Use `three/addons/misc/Timer.js` instead. * @implements {Disposable} * @implements {EventListenerObject} */ export class Timer implements Disposable, EventListenerObject { handleEvent(object: Event): void; /** * The current delta time in seconds. */ get delta(): number; /** * The fixed delta time in seconds. */ get fixedDelta(): number; set fixedDelta(value: number); /** * The elapsed time in seconds. */ get elapsed(): number; /** * Determines whether this timer should use a fixed time step. */ useFixedDelta: boolean; /** * The timescale. */ timescale: number; /** * Enables or disables auto reset based on page visibility. * * If enabled, the timer will be reset when the page becomes visible. This effectively pauses the timer when the page * is hidden. Has no effect if the API is not supported. * */ get autoReset(): boolean; set autoReset(value: boolean); /** * Updates this timer. * * @param {Number} [timestamp] - The current time in milliseconds. */ update(timestamp?: number): void; /** * Resets this timer. * * @return {Timer} This timer. */ reset(): Timer; /** * Disposes this timer. */ dispose(): void; } export type BloomEffectOptions = { blendFunction?: BlendFunction; luminanceThreshold?: number; luminanceSmoothing?: number; mipmapBlur?: boolean; intensity?: number; radius?: number; levels?: number; kernelSize?: KernelSize; resolutionScale?: number; width?: number; height?: number; resolutionX?: number; resolutionY?: number; }; /** * A bloom effect. */ export class BloomEffect extends Effect { /** * Constructs a new bloom effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function of this effect. * @param {Number} [options.luminanceThreshold=0.9] - The luminance threshold. Raise this value to mask out darker elements in the scene. * @param {Number} [options.luminanceSmoothing=0.025] - Controls the smoothness of the luminance threshold. * @param {Boolean} [options.mipmapBlur=false] - Enables or disables mipmap blur. * @param {Number} [options.intensity=1.0] - The bloom intensity. * @param {Number} [options.radius=0.85] - The blur radius. Only applies to mipmap blur. * @param {Number} [options.levels=8] - The amount of MIP levels. Only applies to mipmap blur. * @param {KernelSize} [options.kernelSize=KernelSize.LARGE] - Deprecated. Use mipmapBlur instead. * @param {Number} [options.resolutionScale=0.5] - Deprecated. Use mipmapBlur instead. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead. */ constructor({ blendFunction, luminanceThreshold, luminanceSmoothing, mipmapBlur, intensity, radius, levels, kernelSize, resolutionScale, width, height, resolutionX, resolutionY }?: BloomEffectOptions); /** * A luminance shader pass. * * This pass can be disabled to skip luminance filtering. * * @type {LuminancePass} */ luminancePass: LuminancePass; /** * A blur pass. * * @type {KawaseBlurPass} */ blurPass: KawaseBlurPass; /** * A texture that contains the intermediate result of this effect. * * @type {Texture} */ get texture(): Texture; /** * Returns the generated bloom texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * The resolution of this effect. * * @type {Resolution} */ get resolution(): Resolution; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Returns the blur pass. * * @deprecated Use blurPass instead. * @return {KawaseBlurPass} The blur pass. */ getBlurPass(): KawaseBlurPass; /** * Returns the luminance pass. * * @deprecated Use luminancePass instead. * @return {LuminancePass} The luminance pass. */ getLuminancePass(): LuminancePass; /** * The luminance material. * * @type {LuminanceMaterial} */ get luminanceMaterial(): LuminanceMaterial; /** * Returns the luminance material. * * @deprecated Use luminanceMaterial instead. * @return {LuminanceMaterial} The material. */ getLuminanceMaterial(): LuminanceMaterial; set width(arg: number); /** * The current width of the internal render targets. * * @type {Number} * @deprecated Use resolution.width instead. */ get width(): number; set height(arg: number); /** * The current height of the internal render targets. * * @type {Number} * @deprecated Use resolution.height instead. */ get height(): number; set dithering(arg: boolean); /** * Indicates whether dithering is enabled. * * @type {Boolean} * @deprecated Use EffectPass.fullscreenMaterial.dithering instead. */ get dithering(): boolean; set kernelSize(arg: KernelSize); /** * The blur kernel size. * * @type {KernelSize} * @deprecated Use blurPass.kernelSize instead. */ get kernelSize(): KernelSize; set distinction(arg: number); /** * @type {Number} * @deprecated Use luminanceMaterial instead. */ get distinction(): number; set intensity(arg: number); /** * The bloom intensity. * * @type {Number} */ get intensity(): number; /** * The bloom intensity. * * @deprecated Use intensity instead. * @return {Number} The intensity. */ getIntensity(): number; /** * Sets the bloom intensity. * * @deprecated Use intensity instead. * @param {Number} value - The intensity. */ setIntensity(value: number): void; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution instead. */ setResolutionScale(scale: number): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A depth of field (bokeh) effect. * */ export class BokehEffect extends Effect { /** * Constructs a new bokeh effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.focus=0.5] - The focus distance ratio, ranging from 0.0 to 1.0. * @param {Number} [options.dof=0.02] - Depth of field. An area in front of and behind the focal point that still appears sharp. * @param {Number} [options.aperture=0.015] - Camera aperture scale. Bigger values for stronger blur and shallower depth of field. * @param {Number} [options.maxBlur=1.0] - The maximum blur strength. */ constructor({ blendFunction, focus, dof, aperture, maxBlur }?: { blendFunction?: BlendFunction; focus?: number; dof?: number; aperture?: number; maxBlur?: number; }); } /** * A brightness/contrast effect. * */ export class BrightnessContrastEffect extends Effect { /** * Constructs a new brightness/contrast effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.brightness=0.0] - The brightness factor, ranging from -1 to 1, where 0 means no change. * @param {Number} [options.contrast=0.0] - The contrast factor, ranging from -1 to 1, where 0 means no change. */ constructor({ blendFunction, brightness, contrast }?: { blendFunction?: BlendFunction; brightness?: number; contrast?: number; }); set brightness(arg: number); /** * The brightness. * * @type {Number} */ get brightness(): number; /** * Returns the brightness. * * @deprecated Use brightness instead. * @return {Number} The brightness. */ getBrightness(): number; /** * Sets the brightness. * * @deprecated Use brightness instead. * @param {Number} value - The brightness. */ setBrightness(value: number): void; set contrast(arg: number); /** * The contrast. * * @type {Number} */ get contrast(): number; /** * Returns the contrast. * * @deprecated Use contrast instead. * @return {Number} The contrast. */ getContrast(): number; /** * Sets the contrast. * * @deprecated Use contrast instead. * @param {Number} value - The contrast. */ setContrast(value: number): void; } /** * A chromatic aberration effect. */ export class ChromaticAberrationEffect extends Effect { /** * Constructs a new chromatic aberration effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Vector2} [options.offset] - The color offset. * @param {Boolean} [options.radialModulation=false] - Whether the effect should be modulated with a radial gradient. * @param {Number} [options.modulationOffset=0.15] - The modulation offset. Only applies if `radialModulation` is enabled. */ constructor({ blendFunction, offset, radialModulation, modulationOffset }?: { blendFunction?: BlendFunction; offset?: Vector2; radialModulation: boolean, modulationOffset: number }); set offset(arg: Vector2); /** * The color offset. * * @type {Vector2} */ get offset(): Vector2; /** * Indicates whether radial modulation is enabled. * * When enabled, the effect will be weaker in the middle and stronger towards the screen edges. * * @type {Boolean} */ get radialModulation(): boolean; set radialModulation(arg: boolean); /** * The modulation offset. * * @type {Number} */ get modulationOffset(): number; set modulationOffset(arg: number); /** * Returns the color offset vector. * * @deprecated Use offset instead. * @return {Vector2} The offset. */ getOffset(): Vector2; /** * Sets the color offset vector. * * @deprecated Use offset instead. * @param {Vector2} value - The offset. */ setOffset(value: Vector2): void; } /** * A fast greyscale effect. */ export class ColorAverageEffect extends Effect { /** * Constructs a new color average effect. * * @param {BlendFunction} [blendFunction=BlendFunction.NORMAL] - The blend function of this effect. */ constructor(blendFunction?: BlendFunction); } /** * A color depth effect. * * Simulates a hardware limitation to achieve a retro feel. The real color depth will not be altered by this effect. */ export class ColorDepthEffect extends Effect { /** * Constructs a new color depth effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.bits=16] - The color bit depth. */ constructor({ blendFunction, bits }?: { blendFunction?: BlendFunction; bits?: number; }); set bitDepth(arg: number); /** * The virtual amount of color bits. * * Each color channel effectively uses a fourth of the total amount of bits. Alpha remains unaffected. * * @type {Number} */ get bitDepth(): number; /** * Returns the current color bit depth. * * @return {Number} The bit depth. */ getBitDepth(): number; /** * Sets the virtual amount of color bits. * * @param {Number} value - The bit depth. */ setBitDepth(value: number): void; } /** * A depth visualization effect. * * Useful for debugging. */ export class DepthEffect extends Effect { /** * Constructs a new depth effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Boolean} [options.inverted=false] - Whether the depth should be inverted. */ constructor({ blendFunction, inverted }?: { blendFunction?: BlendFunction; inverted?: boolean; }); set inverted(arg: boolean); /** * Indicates whether depth should be inverted. * * @type {Boolean} */ get inverted(): boolean; /** * Indicates whether the rendered depth is inverted. * * @deprecated Use inverted instead. * @return {Boolean} Whether the rendered depth is inverted. */ isInverted(): boolean; /** * Enables or disables depth inversion. * * @deprecated Use inverted instead. * @param {Boolean} value - Whether depth should be inverted. */ setInverted(value: boolean): void; } /** * A depth of field effect. * */ export class DepthOfFieldEffect extends Effect { /** * Constructs a new depth of field effect. * * @param {Camera} camera - The main camera. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.worldFocusDistance] - The focus distance in world units. * @param {Number} [options.worldFocusRange] - The focus distance in world units. * @param {Number} [options.focusDistance=0.0] - The normalized focus distance. Range is [0.0, 1.0]. * @param {Number} [options.focalLength=0.1] - The focal length. Range is [0.0, 1.0]. * @param {Number} [options.focusRange=0.1] - The focus range. Range is [0.0, 1.0]. * @param {Number} [options.focalLength=0.1] - Deprecated. * @param {Number} [options.bokehScale=1.0] - The scale of the bokeh blur. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. */ constructor( camera?: Camera, { blendFunction, worldFocusDistance, worldFocusRange, focusDistance, focalLength, focusRange, bokehScale, resolutionScale, resolutionX, resolutionY, width, height }?: { blendFunction?: BlendFunction; worldFocusDistance?: number; worldFocusRange?: number; focusDistance?: number; focalLength?: number; focusRange?: number; bokehScale?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; } ); /** * This pass blurs the foreground CoC buffer to soften edges. * * @type {KawaseBlurPass} */ readonly blurPass: KawaseBlurPass; /** * A target position that should be kept in focus. Set to `null` to disable auto focus. * * @type {Vector3} */ target: Vector3; set bokehScale(arg: number); /** * The current bokeh scale. * * @type {Number} */ get bokehScale(): number; /** * The circle of confusion texture. * * @type {Texture} */ get cocTexture(): Texture; /** * The mask function. Default is `MULTIPLY_RGB`. * * @type {MaskFunction} */ get maskFunction(): MaskFunction; set maskFunction(arg: MaskFunction); /** * The circle of confusion material. * * @type {CircleOfConfusionMaterial} */ get cocMaterial(): CircleOfConfusionMaterial; /** * The circle of confusion material. * * @deprecated Use cocMaterial instead. * @type {CircleOfConfusionMaterial} */ get circleOfConfusionMaterial(): CircleOfConfusionMaterial; /** * Returns the circle of confusion material. * * @deprecated Use cocMaterial instead. * @return {CircleOfConfusionMaterial} The material. */ getCircleOfConfusionMaterial(): CircleOfConfusionMaterial; /** * Returns the pass that blurs the foreground CoC buffer to soften edges. * * @deprecated Use blurPass instead. * @return {KawaseBlurPass} The blur pass. */ getBlurPass(): KawaseBlurPass; /** * The resolution of this effect. * * @type {Resolution} */ get resolution(): Resolution; /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * Returns the current bokeh scale. * * @deprecated Use bokehScale instead. * @return {Number} The scale. */ getBokehScale(): number; /** * Sets the bokeh scale. * * @deprecated Use bokehScale instead. * @param {Number} value - The scale. */ setBokehScale(value: number): void; /** * Returns the current auto focus target. * * @deprecated Use target instead. * @return {Vector3} The target. */ getTarget(): Vector3; /** * Sets the auto focus target. * * @deprecated Use target instead. * @param {Vector3} value - The target. */ setTarget(value: Vector3): void; /** * Calculates the focus distance from the camera to the given position. * * @param {Vector3} target - The target. * @return {Number} The normalized focus distance. */ calculateFocusDistance(target: Vector3): number; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A dot screen effect. */ export class DotScreenEffect extends Effect { /** * Constructs a new dot screen effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.angle=1.57] - The angle of the dot pattern. * @param {Number} [options.scale=1.0] - The scale of the dot pattern. */ constructor({ blendFunction, angle, scale }?: { blendFunction?: BlendFunction; angle?: number; scale?: number; }); set angle(arg: number); /** * The angle. * * @type {Number} */ get angle(): number; /** * Returns the pattern angle. * * @deprecated Use angle instead. * @return {Number} The angle in radians. */ getAngle(): number; /** * Sets the pattern angle. * * @deprecated Use angle instead. * @param {Number} value - The angle in radians. */ setAngle(value: number): void; set scale(arg: number); /** * The scale. * * @type {Number} */ get scale(): number; } /** * A gamma correction effect. * * @deprecated Set WebGLRenderer.outputEncoding to sRGBEncoding instead. */ export class GammaCorrectionEffect extends Effect { /** * Constructs a new gamma correction effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.gamma=2.0] - The gamma factor. */ constructor({ blendFunction, gamma }?: { blendFunction?: BlendFunction; gamma?: number; }); } /** * A tilt shift effect. */ export class TiltShiftEffect extends Effect { /** * Constructs a new tilt shift Effect * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction] - The blend function of this effect. * @param {Number} [options.offset=0.0] - The relative offset of the focus area. * @param {Number} [options.rotation=0.0] - The rotation of the focus area in radians. * @param {Number} [options.focusArea=0.4] - The relative size of the focus area. * @param {Number} [options.feather=0.3] - The softness of the focus area edges. * @param {Number} [options.bias=0.06] - Deprecated. * @param {KernelSize} [options.kernelSize=KernelSize.MEDIUM] - The blur kernel size. * @param {Number} [options.resolutionScale=0.5] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. */ constructor({ blendFunction, offset, rotation, focusArea, feather, bias, kernelSize, resolutionScale, resolutionX, resolutionY }?: { blendFunction?: BlendFunction, offset?: number, rotation?: number, focusArea?: number, feather?: number, bias?: number, kernelSize?: KernelSize, resolutionScale?: number, resolutionX?: number, resolutionY?: number }); /** * A blur pass. * * @type {KawaseBlurPass} */ readonly blurPass: KawaseBlurPass; /** * The resolution. * * @type {Resolution} * @readonly */ get resolution(): Resolution; /** * The rotation of the focus area in radians. * * @type {Number} */ get rotation(): number; set rotation(arg: number); /** * The relative offset of the focus area. * * @type {Number} */ get offset(): number; set offset(arg: number); /** * The relative size of the focus area. * * @type {Number} */ get focusArea(): number; set focusArea(arg: number); /** * The softness of the focus area edges. * * @type {Number} */ get feather(): number; set feather(arg: number); /** * A blend bias. * * @type {Number} * @deprecated */ get bias(): number; set bias(arg: number); } /** * A glitch effect. * * This effect can be used in conjunction with the {@link ChromaticAberrationEffect}. * */ export class GlitchEffect extends Effect { /** * Constructs a new glitch effect. * * TODO Change ratio to 0.15. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Vector2} [options.chromaticAberrationOffset] - A chromatic aberration offset. If provided, the glitch effect will influence this offset. * @param {Vector2} [options.delay] - The minimum and maximum delay between glitch activations in seconds. * @param {Vector2} [options.duration] - The minimum and maximum duration of a glitch in seconds. * @param {Vector2} [options.strength] - The strength of weak and strong glitches. * @param {Texture} [options.perturbationMap] - A perturbation map. If none is provided, a noise texture will be created. * @param {Number} [options.dtSize=64] - The size of the generated noise map. Will be ignored if a perturbation map is provided. * @param {Number} [options.columns=0.05] - The scale of the blocky glitch columns. * @param {Number} [options.ratio=0.85] - The threshold for strong glitches. */ constructor({ blendFunction, chromaticAberrationOffset, delay, duration, strength, columns, ratio, perturbationMap, dtSize }?: { blendFunction?: BlendFunction; chromaticAberrationOffset?: Vector2; delay?: Vector2; duration?: Vector2; strength?: Vector2; perturbationMap?: Texture; dtSize?: number; columns?: number; ratio?: number; }); set perturbationMap(arg: Texture); /** * The perturbation map. * * @type {Texture} */ get perturbationMap(): Texture; /** * The minimum and maximum delay between glitch activations in seconds. * * @type {Vector2} * @deprecated Use minDelay and maxDelay instead. */ delay: Vector2; /** * The minimum and maximum duration of a glitch in seconds. * * @type {Vector2} * @deprecated Use minDuration and maxDuration instead. */ duration: Vector2; /** * The strength of weak and strong glitches. * * @type {Vector2} * @deprecated Use minStrength and maxStrength instead. */ strength: Vector2; /** * The effect mode. * * @type {GlitchMode} */ mode: GlitchMode; /** * The ratio between weak (0.0) and strong (1.0) glitches. Range is [0.0, 1.0]. * * This value is currently being treated as a threshold for strong glitches, i.e. it's inverted. * * TODO Resolve inversion. * @type {Number} */ ratio: number; /** * The chromatic aberration offset. * * @type {Vector2} */ chromaticAberrationOffset: Vector2; /** * Indicates whether the glitch effect is currently active. * * @type {Boolean} */ get active(): boolean; /** * Indicates whether the glitch effect is currently active. * * @deprecated Use active instead. * @return {Boolean} Whether the glitch effect is active. */ isActive(): boolean; set minDelay(arg: number); /** * The minimum delay between glitch activations. * * @type {Number} */ get minDelay(): number; /** * Returns the minimum delay between glitch activations. * * @deprecated Use minDelay instead. * @return {Number} The minimum delay in seconds. */ getMinDelay(): number; /** * Sets the minimum delay between glitch activations. * * @deprecated Use minDelay instead. * @param {Number} value - The minimum delay in seconds. */ setMinDelay(value: number): void; set maxDelay(arg: number); /** * The maximum delay between glitch activations. * * @type {Number} */ get maxDelay(): number; /** * Returns the maximum delay between glitch activations. * * @deprecated Use maxDelay instead. * @return {Number} The maximum delay in seconds. */ getMaxDelay(): number; /** * Sets the maximum delay between glitch activations. * * @deprecated Use maxDelay instead. * @param {Number} value - The maximum delay in seconds. */ setMaxDelay(value: number): void; set minDuration(arg: number); /** * The minimum duration of sporadic glitches. * * @type {Number} */ get minDuration(): number; /** * Returns the minimum duration of sporadic glitches. * * @deprecated Use minDuration instead. * @return {Number} The minimum duration in seconds. */ getMinDuration(): number; /** * Sets the minimum duration of sporadic glitches. * * @deprecated Use minDuration instead. * @param {Number} value - The minimum duration in seconds. */ setMinDuration(value: number): void; set maxDuration(arg: number); /** * The maximum duration of sporadic glitches. * * @type {Number} */ get maxDuration(): number; /** * Returns the maximum duration of sporadic glitches. * * @deprecated Use maxDuration instead. * @return {Number} The maximum duration in seconds. */ getMaxDuration(): number; /** * Sets the maximum duration of sporadic glitches. * * @deprecated Use maxDuration instead. * @param {Number} value - The maximum duration in seconds. */ setMaxDuration(value: number): void; set minStrength(arg: number); /** * The strength of weak glitches. * * @type {Number} */ get minStrength(): number; /** * Returns the strength of weak glitches. * * @deprecated Use minStrength instead. * @return {Number} The strength. */ getMinStrength(): number; /** * Sets the strength of weak glitches. * * @deprecated Use minStrength instead. * @param {Number} value - The strength. */ setMinStrength(value: number): void; set maxStrength(arg: number); /** * The strength of strong glitches. * * @type {Number} */ get maxStrength(): number; /** * Returns the strength of strong glitches. * * @deprecated Use maxStrength instead. * @return {Number} The strength. */ getMaxStrength(): number; /** * Sets the strength of strong glitches. * * @deprecated Use maxStrength instead. * @param {Number} value - The strength. */ setMaxStrength(value: number): void; /** * Returns the current glitch mode. * * @deprecated Use mode instead. * @return {GlitchMode} The mode. */ getMode(): GlitchMode; /** * Sets the current glitch mode. * * @deprecated Use mode instead. * @param {GlitchMode} value - The mode. */ setMode(value: GlitchMode): void; /** * Returns the glitch ratio. * * @deprecated Use ratio instead. * @return {Number} The ratio. */ getGlitchRatio(): number; /** * Sets the ratio of weak (0.0) and strong (1.0) glitches. * * @deprecated Use ratio instead. * @param {Number} value - The ratio. Range is [0.0, 1.0]. */ setGlitchRatio(value: number): void; set columns(arg: number); /** * The glitch column size. * * @type {Number} */ get columns(): number; /** * Returns the glitch column size. * * @deprecated Use columns instead. * @return {Number} The glitch column size. */ getGlitchColumns(): number; /** * Sets the glitch column size. * * @deprecated Use columns instead. * @param {Number} value - The glitch column size. */ setGlitchColumns(value: number): void; /** * Returns the chromatic aberration offset. * * @deprecated Use chromaticAberrationOffset instead. * @return {Vector2} The offset. */ getChromaticAberrationOffset(): Vector2; /** * Sets the chromatic aberration offset. * * @deprecated Use chromaticAberrationOffset instead. * @param {Vector2} value - The offset. */ setChromaticAberrationOffset(value: Vector2): void; /** * Returns the current perturbation map. * * @deprecated Use perturbationMap instead. * @return {Texture} The current perturbation map. */ getPerturbationMap(): Texture; /** * Replaces the current perturbation map with the given one. * * The current map will be disposed if it was generated by this effect. * * @deprecated Use perturbationMap instead. * @param {Texture} value - The new perturbation map. */ setPerturbationMap(value: Texture): void; /** * Generates a perturbation map. * * @deprecated Use NoiseTexture instead. * @param {Number} [value=64] - The texture size. * @return {DataTexture} The perturbation map. */ generatePerturbationMap(value?: number): DataTexture; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Deletes generated resources. */ dispose(): void; } /** * A glitch mode enumeration. * * @type {Object} * @property {Number} DISABLED - No glitches. * @property {Number} SPORADIC - Sporadic glitches. * @property {Number} CONSTANT_MILD - Constant mild glitches. * @property {Number} CONSTANT_WILD - Constant wild glitches. */ export enum GlitchMode { DISABLED, SPORADIC, CONSTANT_MILD, CONSTANT_WILD, } /** * A god rays effect. */ export class GodRaysEffect extends Effect { /** * Constructs a new god rays effect. * * @param {Camera} [camera] - The main camera. * @param {Mesh|Points} [lightSource] - The light source. Must not write depth and has to be flagged as transparent. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function of this effect. * @param {Number} [options.samples=60.0] - The number of samples per pixel. * @param {Number} [options.density=0.96] - The density of the light rays. * @param {Number} [options.decay=0.9] - An illumination decay factor. * @param {Number} [options.weight=0.4] - A light ray weight factor. * @param {Number} [options.exposure=0.6] - A constant attenuation coefficient. * @param {Number} [options.clampMax=1.0] - An upper bound for the saturation of the overall effect. * @param {Number} [options.resolutionScale=0.5] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. * @param {KernelSize} [options.kernelSize=KernelSize.SMALL] - The blur kernel size. Has no effect if blur is disabled. * @param {Boolean} [options.blur=true] - Whether the god rays should be blurred to reduce artifacts. */ constructor( camera?: Camera, lightSource?: Mesh | Points, { blendFunction, samples, density, decay, weight, exposure, clampMax, resolutionScale, resolutionX, resolutionY, width, height, kernelSize, blur }?: { blendFunction?: BlendFunction; samples?: number; density?: number; decay?: number; weight?: number; exposure?: number; clampMax?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; kernelSize?: KernelSize; blur?: boolean; } ); /** * A blur pass that reduces aliasing artifacts and makes the light softer. * * This pass can be disabled to improve performance. * * @type {KawaseBlurPass} */ blurPass: KawaseBlurPass; /** * Returns the blur pass that reduces aliasing artifacts and makes the light softer. * * @deprecated Use blurPass instead. * @return {KawaseBlurPass} The blur pass. */ getBlurPass(): KawaseBlurPass; /** * Sets the light source. * * @type {Mesh|Points} */ get lightSource(): Mesh | Points | null; set lightSource(value: Mesh | Points | null); /** * A texture that contains the intermediate result of this effect. * * @type {Texture} */ get texture(): Texture; /** * The depth mask material. * * @type {DepthMaskMaterial} */ get depthMaskMaterial(): DepthMaskMaterial; /** * Returns the god rays texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * The internal god rays material. * * @type {GodRaysMaterial} */ get godRaysMaterial(): GodRaysMaterial; /** * Returns the god rays material. * * @deprecated Use godRaysMaterial instead. * @return {GodRaysMaterial} The material. */ getGodRaysMaterial(): GodRaysMaterial; /** * The resolution of this effect. * * @type {Resolution} */ get resolution(): Resolution; /** * Returns the resolution of this effect. * * @deprecated Use resolution instead. * @return {GodRaysMaterial} The material. */ getResolution(): GodRaysMaterial; set width(arg: number); /** * The current width of the internal render targets. * * @type {Number} * @deprecated Use resolution.width instead. */ get width(): number; set height(arg: number); /** * The current height of the internal render targets. * * @type {Number} * @deprecated Use resolution.height instead. */ get height(): number; set dithering(arg: boolean); /** * Indicates whether dithering is enabled. * * @type {Boolean} * @deprecated */ get dithering(): boolean; set blur(arg: boolean); /** * Indicates whether the god rays should be blurred to reduce artifacts. * * @type {Boolean} * @deprecated Use blurPass.enabled instead. */ get blur(): boolean; set kernelSize(arg: KernelSize); /** * The blur kernel size. * * @type {KernelSize} * @deprecated Use blurPass.kernelSize instead. */ get kernelSize(): KernelSize; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution instead. */ setResolutionScale(scale: number): void; /** * A higher sample count improves quality at the cost of performance. * * @type {Number} * @deprecated Use godRaysMaterial.samples instead. */ set samples(arg: number); /** * The number of samples per pixel. * * @type {Number} * @deprecated Use godRaysMaterial.samples instead. */ get samples(): number; /** * Sets the depth texture. * * @param {Texture} depthTexture - A depth texture. * @param {Number} [depthPacking=BasicDepthPacking] - The depth packing. */ setDepthTexture(depthTexture: Texture, depthPacking?: number): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A grid effect. */ export class GridEffect extends Effect { /** * Constructs a new grid effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.OVERLAY] - The blend function of this effect. * @param {Number} [options.scale=1.0] - The scale of the grid pattern. * @param {Number} [options.lineWidth=0.0] - The line width of the grid pattern. */ constructor({ blendFunction, scale, lineWidth }?: { blendFunction?: BlendFunction; scale?: number; lineWidth?: number; }); set scale(arg: number); /** * The scale. * * @type {Number} */ get scale(): number; set lineWidth(arg: number); /** * The line width. * * @type {Number} */ get lineWidth(): number; /** * Returns the current grid scale. * * @deprecated Use scale instead. * @return {Number} The grid scale. */ getScale(): number; /** * Sets the grid scale. * * @deprecated Use scale instead. * @param {Number} value - The new grid scale. */ setScale(value: number): void; /** * Returns the current grid line width. * * @deprecated Use lineWidth instead. * @return {Number} The grid line width. */ getLineWidth(): number; /** * Sets the grid line width. * * @deprecated Use lineWidth instead. * @param {Number} value - The new grid line width. */ setLineWidth(value: number): void; /** * Updates the size of this pass. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * A hue/saturation effect. * */ export class HueSaturationEffect extends Effect { /** * Constructs a new hue/saturation effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.hue=0.0] - The hue in radians. * @param {Number} [options.saturation=0.0] - The saturation factor, ranging from -1 to 1, where 0 means no change. */ constructor({ blendFunction, hue, saturation }?: { blendFunction?: BlendFunction; hue?: number; saturation?: number; }); set hue(arg: number); /** * The hue. * * @type {Number} */ get hue(): number; set saturation(arg: number); /** * The saturation. * * @type {Number} */ get saturation(): number; /** * Returns the saturation. * * @deprecated Use saturation instead. * @return {Number} The saturation. */ getSaturation(): number; /** * Sets the saturation. * * @deprecated Use saturation instead. * @param {Number} value - The saturation. */ setSaturation(value: number): void; /** * Returns the hue. * * @deprecated Use hue instead. * @return {Number} The hue in radians. */ getHue(): number; /** * Sets the hue. * * @deprecated Use hue instead. * @param {Number} value - The hue in radians. */ setHue(value: number): void; } /** * A 1D LUT effect. */ export class LUT1DEffect extends Effect { /** * Constructs a new color grading effect. * * @param {Texture} lut - The lookup texture. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SET] - The blend function of this effect. */ constructor( lut: Texture, { blendFunction }?: { blendFunction?: BlendFunction; } ); } /** * A LUT effect. */ export class LUT3DEffect extends Effect { /** * Constructs a new color grading effect. * * @param {Texture} lut - The lookup texture. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SET] - The blend function of this effect. * @param {Boolean} [options.tetrahedralInterpolation=false] - Enables or disables tetrahedral interpolation. * @param {ColorSpace} [options.inputColorSpace=SRGBColorSpace] - The input color space. */ constructor( lut: Texture, { blendFunction, tetrahedralInterpolation, inputColorSpace }?: { blendFunction?: BlendFunction; tetrahedralInterpolation?: boolean; inputColorSpace?: ColorSpace; } ); /** * Indicates whether tetrahedral interpolation is enabled. Requires a 3D LUT, disabled by default. * * Tetrahedral interpolation produces highly accurate results but is slower than hardware interpolation. * * @type {Boolean} */ get tetrahedralInterpolation(): boolean; set tetrahedralInterpolation(arg: boolean); /** * The LUT. * * @type {Texture} */ get lut(): Texture; set lut(arg: Texture); /** * Returns the current LUT. * * @deprecated Use lut instead. * @return {Texture} The LUT. */ getLUT(): Texture; /** * Sets the LUT. * * @deprecated Use lut instead. * @param {Texture} value - The LUT. */ setLUT(value: Texture): void; /** * Enables or disables tetrahedral interpolation. * * @deprecated Use tetrahedralInterpolation instead. * @param {Boolean} value - Whether tetrahedral interpolation should be enabled. */ setTetrahedralInterpolationEnabled(value: boolean): void; } /** * A noise effect. */ export class NoiseEffect extends Effect { /** * Constructs a new noise effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function of this effect. * @param {Boolean} [options.premultiply=false] - Whether the noise should be multiplied with the input colors prior to blending. */ constructor({ blendFunction, premultiply }?: { blendFunction?: BlendFunction; premultiply?: boolean; }); set premultiply(arg: boolean); /** * Indicates whether noise will be multiplied with the input colors prior to blending. * * @type {Boolean} */ get premultiply(): boolean; /** * Indicates whether noise will be multiplied with the input colors prior to blending. * * @deprecated Use premultiply instead. * @return {Boolean} Whether noise is premultiplied. */ isPremultiplied(): boolean; /** * Controls whether noise should be multiplied with the input colors prior to blending. * * @deprecated Use premultiply instead. * @param {Boolean} value - Whether noise should be premultiplied. */ setPremultiplied(value: boolean): void; } /** * An outline effect. */ export class OutlineEffect extends Effect { /** * Constructs a new outline effect. * * @param {Scene} scene - The main scene. * @param {Camera} camera - The main camera. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function. Use `BlendFunction.ALPHA` for dark outlines. * @param {Texture} [options.patternTexture=null] - A pattern texture. * @param {Number} [options.patternScale=1.0] - The pattern scale. * @param {Number} [options.edgeStrength=1.0] - The edge strength. * @param {Number} [options.pulseSpeed=0.0] - The pulse speed. A value of zero disables the pulse effect. * @param {Number} [options.visibleEdgeColor=0xffffff] - The color of visible edges. * @param {Number} [options.hiddenEdgeColor=0x22090a] - The color of hidden edges. * @param {KernelSize} [options.kernelSize=KernelSize.VERY_SMALL] - The blur kernel size. * @param {Boolean} [options.blur=false] - Whether the outline should be blurred. * @param {Boolean} [options.xRay=true] - Whether occluded parts of selected objects should be visible. * @param {Number} [options.multisampling=0] - The number of samples used for multisample antialiasing. Requires WebGL 2. * @param {Number} [options.resolutionScale=0.5] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. */ constructor( scene?: Scene, camera?: Camera, { blendFunction, patternTexture, patternScale, edgeStrength, pulseSpeed, visibleEdgeColor, hiddenEdgeColor, multisampling, resolutionScale, resolutionX, resolutionY, width, height, kernelSize, blur, xRay }?: { blendFunction?: BlendFunction; patternTexture?: Texture; patternScale?: number; edgeStrength?: number; pulseSpeed?: number; visibleEdgeColor?: number; hiddenEdgeColor?: number; multisampling?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; kernelSize?: KernelSize; blur?: boolean; xRay?: boolean; } ); set patternTexture(arg: Texture); /** * The pattern texture. Set to `null` to disable. * * @type {Texture} */ get patternTexture(): Texture; set xRay(arg: boolean); /** * Indicates whether X-ray mode is enabled. * * @type {Boolean} */ get xRay(): boolean; /** * A blur pass. * * @type {KawaseBlurPass} */ blurPass: KawaseBlurPass; /** * A selection of objects that will be outlined. * * The default layer of this selection is 10. * * @type {Selection} */ selection: Selection; /** * The pulse speed. Set to 0 to disable. * * @type {Number} */ pulseSpeed: number; /** * The resolution of this effect. * * @type {Resolution} */ get resolution(): Resolution; /** * Returns the resolution. * * @return {Resizer} The resolution. */ getResolution(): Resizer; set patternScale(arg: number); /** * The pattern scale. * * @type {Number} */ get patternScale(): number; set edgeStrength(arg: number); /** * The edge strength. * * @type {Number} */ get edgeStrength(): number; set visibleEdgeColor(arg: Color); /** * The visible edge color. * * @type {Color} */ get visibleEdgeColor(): Color; set hiddenEdgeColor(arg: Color); /** * The hidden edge color. * * @type {Color} */ get hiddenEdgeColor(): Color; /** * The amount of MSAA samples. * * Requires WebGL 2. Set to zero to disable multisampling. * * @experimental Requires three >= r138. * @type {Number} */ get multisampling(): number; set multisampling(arg: number); /** * Returns the blur pass. * * @deprecated Use blurPass instead. * @return {KawaseBlurPass} The blur pass. */ getBlurPass(): KawaseBlurPass; /** * Returns the selection. * * @deprecated Use selection instead. * @return {Selection} The selection. */ getSelection(): Selection; /** * Returns the pulse speed. * * @deprecated Use pulseSpeed instead. * @return {Number} The speed. */ getPulseSpeed(): number; /** * Sets the pulse speed. Set to zero to disable. * * @deprecated Use pulseSpeed instead. * @param {Number} value - The speed. */ setPulseSpeed(value: number): void; set width(arg: number); /** * The current width of the internal render targets. * * @type {Number} * @deprecated Use resolution.width instead. */ get width(): number; set height(arg: number); /** * The current height of the internal render targets. * * @type {Number} * @deprecated Use resolution.height instead. */ get height(): number; set selectionLayer(arg: number); /** * The selection layer. * * @type {Number} * @deprecated Use selection.layer instead. */ get selectionLayer(): number; set dithering(arg: boolean); /** * Indicates whether dithering is enabled. * * @type {Boolean} * @deprecated */ get dithering(): boolean; set kernelSize(arg: KernelSize); /** * The blur kernel size. * * @type {KernelSize} * @deprecated Use blurPass.kernelSize instead. */ get kernelSize(): KernelSize; set blur(arg: boolean); /** * Indicates whether the outlines should be blurred. * * @type {Boolean} * @deprecated Use blurPass.enabled instead. */ get blur(): boolean; /** * Indicates whether X-ray mode is enabled. * * @deprecated Use xRay instead. * @return {Boolean} Whether X-ray mode is enabled. */ isXRayEnabled(): boolean; /** * Enables or disables X-ray outlines. * * @deprecated Use xRay instead. * @param {Boolean} value - Whether X-ray should be enabled. */ setXRayEnabled(value: boolean): void; /** * Sets the pattern texture. * * @deprecated Use patternTexture instead. * @param {Texture} value - The new texture. */ setPatternTexture(value: Texture): void; /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Use resolution instead. */ getResolutionScale(): number; /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Use resolution instead. */ setResolutionScale(scale: number): void; /** * Clears the current selection and selects a list of objects. * * @param {Object3D[]} objects - The objects that should be outlined. This array will be copied. * @return {OutlineEffect} This pass. * @deprecated Use selection.set() instead. */ setSelection(objects: Object3D[]): OutlineEffect; /** * Clears the list of selected objects. * * @return {OutlineEffect} This pass. * @deprecated Use selection.clear() instead. */ clearSelection(): OutlineEffect; /** * Selects an object. * * @param {Object3D} object - The object that should be outlined. * @return {OutlineEffect} This pass. * @deprecated Use selection.add() instead. */ selectObject(object: Object3D): OutlineEffect; /** * Deselects an object. * * @param {Object3D} object - The object that should no longer be outlined. * @return {OutlineEffect} This pass. * @deprecated Use selection.delete() instead. */ deselectObject(object: Object3D): OutlineEffect; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A pixelation effect. * * Warning: This effect cannot be merged with convolution effects. */ export class PixelationEffect extends Effect { /** * Constructs a new pixelation effect. * * @param {Number} [granularity=30.0] - The pixel granularity. */ constructor(granularity?: number); set granularity(arg: number); /** * The pixel granularity. * * A higher value yields coarser visuals. * * @type {Number} */ get granularity(): number; /** * Returns the pixel granularity. * * @deprecated Use granularity instead. * @return {Number} The granularity. */ getGranularity(): number; /** * Sets the pixel granularity. * * @deprecated Use granularity instead. * @param {Number} value - The new granularity. */ setGranularity(value: number): void; /** * Updates the granularity. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * Depth of Field shader v2.4. * * Yields more realistic results but is also more demanding. */ export class RealisticBokehEffect extends Effect { /** * Constructs a new bokeh effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.focus=1.0] - The focus distance in world units. * @param {Number} [options.focalLength=24.0] - The focal length of the main camera. * @param {Number} [options.fStop=0.9] - The ratio of the lens focal length to the diameter of the entrance pupil (aperture). * @param {Number} [options.luminanceThreshold=0.5] - A luminance threshold. * @param {Number} [options.luminanceGain=2.0] - A luminance gain factor. * @param {Number} [options.bias=0.5] - A blur bias. * @param {Number} [options.fringe=0.7] - A blur offset. * @param {Number} [options.maxBlur=1.0] - The maximum blur strength. * @param {Boolean} [options.rings=3] - The number of blur iterations. * @param {Boolean} [options.samples=2] - The amount of samples taken per ring. * @param {Boolean} [options.showFocus=false] - Whether the focal point should be highlighted. Useful for debugging. * @param {Boolean} [options.manualDoF=false] - Enables manual control over the depth of field. * @param {Boolean} [options.pentagon=false] - Enables pentagonal blur shapes. Requires a high number of rings and samples. */ constructor({ blendFunction, focus, focalLength, fStop, luminanceThreshold, luminanceGain, bias, fringe, maxBlur, rings, samples, showFocus, manualDoF, pentagon }?: { blendFunction?: BlendFunction; focus?: number; focalLength?: number; fStop?: number; luminanceThreshold?: number; luminanceGain?: number; bias?: number; fringe?: number; maxBlur?: number; rings?: boolean; samples?: boolean; showFocus?: boolean; manualDoF?: boolean; pentagon?: boolean; }); set rings(arg: number); /** * The amount of blur iterations. * * @type {Number} */ get rings(): number; set samples(arg: number); /** * The amount of blur samples per ring. * * @type {Number} */ get samples(): number; set showFocus(arg: boolean); /** * Indicates whether the focal point will be highlighted. * * @type {Boolean} */ get showFocus(): boolean; set manualDoF(arg: boolean); /** * Indicates whether the Depth of Field should be calculated manually. * * If enabled, the Depth of Field can be adjusted via the `dof` uniform. * * @type {Boolean} */ get manualDoF(): boolean; set pentagon(arg: boolean); /** * Indicates whether the blur shape should be pentagonal. * * @type {Boolean} */ get pentagon(): boolean; } /** * A scanline effect. * */ export class ScanlineEffect extends Effect { /** * Constructs a new scanline effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.OVERLAY] - The blend function of this effect. * @param {Number} [options.density=1.25] - The scanline density. */ constructor({ blendFunction, density }?: { blendFunction?: BlendFunction; density?: number; }); set density(arg: number); /** * The scanline density. * * @type {Number} */ get density(): number; /** * Returns the current scanline density. * * @deprecated Use density instead. * @return {Number} The scanline density. */ getDensity(): number; /** * Sets the scanline density. * * @deprecated Use density instead. * @param {Number} value - The new scanline density. */ setDensity(value: number): void; /** * Updates the size of this pass. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * The scanline scroll speed. Default is 0 (disabled). * * @type {Number} */ get scrollSpeed(): number; set scrollSpeed(value: number); } /** * A selective bloom effect. * * This effect applies bloom to selected objects only. */ export class SelectiveBloomEffect extends BloomEffect { /** * Constructs a new selective bloom effect. * * @param {Scene} scene - The main scene. * @param {Camera} camera - The main camera. * @param {BloomEffectOptions} [options] - The options. See {@link BloomEffect} for details. */ constructor(scene?: Scene, camera?: Camera, options?: BloomEffectOptions); /** * A selection of objects. * * The default layer of this selection is 11. * * @type {Selection} */ selection: Selection; /** * Returns the selection. * * @deprecated Use selection instead. * @return {Selection} The selection. */ getSelection(): Selection; set inverted(arg: boolean); /** * Indicates whether the selection should be considered inverted. * * @type {Boolean} */ get inverted(): boolean; /** * Indicates whether the mask is inverted. * * @deprecated Use inverted instead. * @return {Boolean} Whether the mask is inverted. */ isInverted(): boolean; /** * Enables or disable mask inversion. * * @deprecated Use inverted instead. * @param {Boolean} value - Whether the mask should be inverted. */ setInverted(value: boolean): void; set ignoreBackground(arg: boolean); /** * Indicates whether the background colors will be ignored. * * @type {Boolean} */ get ignoreBackground(): boolean; /** * Indicates whether the background is disabled. * * @deprecated Use ignoreBackground instead. * @return {Boolean} Whether the background is disabled. */ isBackgroundDisabled(): boolean; /** * Enables or disables the background. * * @deprecated Use ignoreBackground instead. * @param {Boolean} value - Whether the background should be disabled. */ setBackgroundDisabled(value: boolean): void; /** * Sets the depth texture. * * @param {Texture} depthTexture - A depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing. */ setDepthTexture( depthTexture: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A sepia effect. */ export class SepiaEffect extends Effect { /** * Constructs a new sepia effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Number} [options.intensity=1.0] - The intensity of the effect. */ constructor({ blendFunction, intensity }?: { blendFunction?: BlendFunction; intensity?: number; }); set intensity(arg: number); /** * The intensity. * * @deprecated Use blendMode.opacity instead. * @type {Number} */ get intensity(): number; /** * Returns the current sepia intensity. * * @deprecated Use blendMode.opacity instead. * @return {Number} The intensity. */ getIntensity(): number; /** * Sets the sepia intensity. * * @deprecated Use blendMode.opacity instead. * @param {Number} value - The intensity. */ setIntensity(value: number): void; } /** * A shock wave effect. */ export class ShockWaveEffect extends Effect { /** * Constructs a new shock wave effect. * * @param {Camera} camera - The main camera. * @param {Vector3} [position] - The world position of the shock wave. * @param {Object} [options] - The options. * @param {Number} [options.speed=2.0] - The animation speed. * @param {Number} [options.maxRadius=1.0] - The extent of the shock wave. * @param {Number} [options.waveSize=0.2] - The wave size. * @param {Number} [options.amplitude=0.05] - The distortion amplitude. */ constructor( camera?: Camera, position?: Vector3, { speed, maxRadius, waveSize, amplitude }?: { speed?: number; maxRadius?: number; waveSize?: number; amplitude?: number; } ); /** * The position of the shock wave. * * @type {Vector3} */ position: Vector3; /** * The speed of the shock wave animation. * * @type {Number} */ speed: number; set amplitude(arg: number); /** * The amplitude. * * @type {Number} */ get amplitude(): number; set waveSize(arg: number); /** * The wave size. * * @type {Number} */ get waveSize(): number; set maxRadius(arg: number); /** * The maximum radius. * * @type {Number} */ get maxRadius(): number; set epicenter(arg: Vector3); /** * The position of the shock wave. * * @type {Vector3} * @deprecated Use position instead. */ get epicenter(): Vector3; /** * Returns the position of the shock wave. * * @deprecated Use position instead. * @return {Vector3} The position. */ getPosition(): Vector3; /** * Sets the position of the shock wave. * * @deprecated Use position instead. * @param {Vector3} value - The position. */ setPosition(value: Vector3): void; /** * Returns the speed of the shock wave. * * @deprecated Use speed instead. * @return {Number} The speed. */ getSpeed(): number; /** * Sets the speed of the shock wave. * * @deprecated Use speed instead. * @param {Number} value - The speed. */ setSpeed(value: number): void; /** * Emits the shock wave. */ explode(): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [delta] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: number ): void; } /** * FXAAEffect */ export class FXAAEffect extends Effect { /** * Constructs a new FXAA effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.SRC] - The blend function of this effect. */ constructor({ blendFunction }?: { blendFunction?: BlendFunction }); /** * The minimum edge detection threshold. Range is [0.0, 1.0]. * * @type {Number} */ get minEdgeThreshold(): number; set minEdgeThreshold(arg: number); /** * The maximum edge detection threshold. Range is [0.0, 1.0]. * * @type {Number} */ get maxEdgeThreshold(): number; set maxEdgeThreshold(arg: number); /** * The subpixel blend quality. Range is [0.0, 1.0]. * * @type {Number} */ get subpixelQuality(): number; set subpixelQuality(arg: number); /** * The maximum amount of edge detection samples. * * @type {Number} */ get samples(): number; set samples(arg: number); } /** * Subpixel Morphological Antialiasing (SMAA). */ export class SMAAEffect extends Effect { /** * The SMAA search image, encoded as a base64 data URL. * * @type {String} * @deprecated */ static get searchImageDataURL(): string; /** * The SMAA area image, encoded as a base64 data URL. * * @type {String} * @deprecated */ static get areaImageDataURL(): string; /** * Constructs a new SMAA effect. * * @param {Object} [options] - The options. * @param {SMAAPreset} [options.preset=SMAAPreset.MEDIUM] - The quality preset. * @param {EdgeDetectionMode} [options.edgeDetectionMode=EdgeDetectionMode.COLOR] - The edge detection mode. * @param {PredicationMode} [options.predicationMode=PredicationMode.DISABLED] - The predication mode. */ constructor({ preset, edgeDetectionMode, predicationMode }?: { preset?: SMAAPreset; edgeDetectionMode?: EdgeDetectionMode; predicationMode?: PredicationMode; }); /** * The edges texture. * * @type {Texture} */ get edgesTexture(): Texture; /** * Returns the edges texture. * * @deprecated Use edgesTexture instead. * @return {Texture} The texture. */ getEdgesTexture(): Texture; /** * The edge weights texture. * * @type {Texture} */ get weightsTexture(): Texture; /** * Returns the edge weights texture. * * @deprecated Use weightsTexture instead. * @return {Texture} The texture. */ getWeightsTexture(): Texture; /** * The edge detection material. * * @type {EdgeDetectionMaterial} */ get edgeDetectionMaterial(): EdgeDetectionMaterial; /** * The edge detection material. * * @type {EdgeDetectionMaterial} * @deprecated Use edgeDetectionMaterial instead. */ get colorEdgesMaterial(): EdgeDetectionMaterial; /** * Returns the edge detection material. * * @deprecated Use edgeDetectionMaterial instead. * @return {EdgeDetectionMaterial} The material. */ getEdgeDetectionMaterial(): EdgeDetectionMaterial; /** * The edge weights material. * * @type {SMAAWeightsMaterial} */ get weightsMaterial(): SMAAWeightsMaterial; /** * Returns the edge weights material. * * @deprecated Use weightsMaterial instead. * @return {SMAAWeightsMaterial} The material. */ getWeightsMaterial(): SMAAWeightsMaterial; /** * Sets the edge detection sensitivity. * * See {@link EdgeDetectionMaterial#setEdgeDetectionThreshold} for more details. * * @deprecated Use edgeDetectionMaterial instead. * @param {Number} threshold - The edge detection sensitivity. Range: [0.05, 0.5]. */ setEdgeDetectionThreshold(threshold: number): void; /** * Sets the maximum amount of horizontal/vertical search steps. * * See {@link SMAAWeightsMaterial#setOrthogonalSearchSteps} for more details. * * @deprecated Use weightsMaterial instead. * @param {Number} steps - The search steps. Range: [0, 112]. */ setOrthogonalSearchSteps(steps: number): void; /** * Applies the given quality preset. * * @param {SMAAPreset} preset - The preset. */ applyPreset(preset: SMAAPreset): void; /** * Sets the depth texture. * * @param {Texture} depthTexture - A depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing. */ setDepthTexture( depthTexture: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Updates the size of internal render targets. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * Deletes internal render targets and textures. */ dispose(): void; } /** * An enumeration of SMAA presets. * * @type {Object} * @property {Number} LOW - Results in around 60% of the maximum quality. * @property {Number} MEDIUM - Results in around 80% of the maximum quality. * @property {Number} HIGH - Results in around 95% of the maximum quality. * @property {Number} ULTRA - Results in around 99% of the maximum quality. */ export enum SMAAPreset { LOW, MEDIUM, HIGH, ULTRA, } /** * A Screen Space Ambient Occlusion (SSAO) effect. * */ export class SSAOEffect extends Effect { /** * Constructs a new SSAO effect. * * @todo Move normalBuffer to options. * @param {Camera} [camera] - The main camera. * @param {Texture} [normalBuffer] - A texture that contains the scene normals. * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.MULTIPLY] - The blend function of this effect. * @param {Boolean} [options.distanceScaling=true] - Deprecated. * @param {Boolean} [options.depthAwareUpsampling=true] - Enables or disables depth-aware upsampling. Has no effect if WebGL 2 is not supported. * @param {Texture} [options.normalDepthBuffer=null] - Deprecated. * @param {Number} [options.samples=9] - The amount of samples per pixel. Should not be a multiple of the ring count. * @param {Number} [options.rings=7] - The amount of spiral turns in the occlusion sampling pattern. Should be a prime number. * @param {Number} [options.worldDistanceThreshold] - The world distance threshold at which the occlusion effect starts to fade out. * @param {Number} [options.worldDistanceFalloff] - The world distance falloff. Influences the smoothness of the occlusion cutoff. * @param {Number} [options.worldProximityThreshold] - The world proximity threshold at which the occlusion starts to fade out. * @param {Number} [options.worldProximityFalloff] - The world proximity falloff. Influences the smoothness of the proximity cutoff. * @param {Number} [options.distanceThreshold=0.97] - Deprecated. * @param {Number} [options.distanceFalloff=0.03] - Deprecated. * @param {Number} [options.rangeThreshold=0.0005] - Deprecated. * @param {Number} [options.rangeFalloff=0.001] - Deprecated. * @param {Number} [options.minRadiusScale=0.1] - The minimum radius scale. * @param {Number} [options.luminanceInfluence=0.7] - Determines how much the luminance of the scene influences the ambient occlusion. * @param {Number} [options.radius=0.1825] - The occlusion sampling radius, expressed as a scale relative to the resolution. Range [1e-6, 1.0]. * @param {Number} [options.intensity=1.0] - The intensity of the ambient occlusion. * @param {Number} [options.bias=0.025] - An occlusion bias. Eliminates artifacts caused by depth discontinuities. * @param {Number} [options.fade=0.01] - Influences the smoothness of the shadows. A lower value results in higher contrast. * @param {Color} [options.color=null] - The color of the ambient occlusion. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead. * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead. */ constructor( camera?: Camera, normalBuffer?: Texture, { blendFunction, distanceScaling, depthAwareUpsampling, normalDepthBuffer, samples, rings, worldDistanceThreshold, worldDistanceFalloff, worldProximityThreshold, worldProximityFalloff, distanceThreshold, distanceFalloff, rangeThreshold, rangeFalloff, minRadiusScale, luminanceInfluence, radius, intensity, bias, fade, color, resolutionScale, resolutionX, resolutionY, width, height }?: { blendFunction?: BlendFunction; distanceScaling?: boolean; depthAwareUpsampling?: boolean; normalDepthBuffer?: Texture; samples?: number; rings?: number; worldDistanceThreshold?: number; worldDistanceFalloff?: number; worldProximityThreshold?: number; worldProximityFalloff?: number; distanceThreshold?: number; distanceFalloff?: number; rangeThreshold?: number; rangeFalloff?: number; minRadiusScale?: number; luminanceInfluence?: number; radius?: number; intensity?: number; bias?: number; fade?: number; color?: Color; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; } ); resolution: Resolution; /** * Sets the normal buffer. * * @type {Texture} */ get normalBuffer(): Texture | null; set normalBuffer(value: Texture | null); /** * Indicates whether depth-aware upsampling is enabled. * * @type {Boolean} */ get depthAwareUpsampling(): boolean; set depthAwareUpsampling(arg: boolean); /** * The color of the ambient occlusion. Set to `null` to disable. * * @type {Color} */ get color(): Color; set color(arg: Color); /** * Returns the resolution settings. * * @deprecated Use resolution instead. * @return {Resolution} The resolution. */ getResolution(): Resolution; /** * The SSAO material. * * @type {SSAOMaterial} */ get ssaoMaterial(): SSAOMaterial; /** * Returns the SSAO material. * * @deprecated Use ssaoMaterial instead. * @return {SSAOMaterial} The material. */ getSSAOMaterial(): SSAOMaterial; /** * The amount of occlusion samples per pixel. * * @type {Number} * @deprecated Use ssaoMaterial.samples instead. */ get samples(): number; set samples(arg: number); /** * The amount of spiral turns in the occlusion sampling pattern. * * @type {Number} * @deprecated Use ssaoMaterial.rings instead. */ get rings(): number; set rings(arg: number); /** * The occlusion sampling radius. * * @type {Number} * @deprecated Use ssaoMaterial.radius instead. */ get radius(): number; set radius(arg: number); /** * The intensity. * * @type {Number} */ get intensity(): number; set intensity(arg: number); /** * Indicates whether depth-aware upsampling is enabled. * * @deprecated Use depthAwareUpsampling instead. * @return {Boolean} Whether depth-aware upsampling is enabled. */ isDepthAwareUpsamplingEnabled(): boolean; /** * Enables or disables depth-aware upsampling. * * @deprecated Use depthAwareUpsampling instead. * @param {Boolean} value - Whether depth-aware upsampling should be enabled. */ setDepthAwareUpsamplingEnabled(value: boolean): void; /** * Indicates whether distance-based radius scaling is enabled. * * @type {Boolean} * @deprecated Use ssaoMaterial.distanceScaling instead. */ get distanceScaling(): boolean; set distanceScaling(arg: boolean); /** * Returns the color of the ambient occlusion. * * @deprecated Use color instead. * @return {Color} The color. */ getColor(): Color; /** * Sets the color of the ambient occlusion. Set to `null` to disable colorization. * * @deprecated Use color instead. * @param {Color} value - The color. */ setColor(value: Color): void; /** * Sets the occlusion distance cutoff. * * @deprecated Use ssaoMaterial instead. * @param {Number} threshold - The distance threshold. Range [0.0, 1.0]. * @param {Number} falloff - The falloff. Range [0.0, 1.0]. */ setDistanceCutoff(threshold: number, falloff: number): void; /** * Sets the occlusion proximity cutoff. * * @deprecated Use ssaoMaterial instead. * @param {Number} threshold - The proximity threshold. Range [0.0, 1.0]. * @param {Number} falloff - The falloff. Range [0.0, 1.0]. */ setProximityCutoff(threshold: number, falloff: number): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Sets the size. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; /** * The luminance influence factor. Range: [0.0, 1.0]. * * @type {Boolean} */ get luminanceInfluence(): boolean; set luminanceInfluence(value: boolean); } /** * A texture effect. */ export class TextureEffect extends Effect { /** * Constructs a new texture effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Texture} [options.texture] - A texture. * @param {Boolean} [options.aspectCorrection=false] - Deprecated. Adjust the texture's offset, repeat and center instead. */ constructor({ blendFunction, texture, aspectCorrection }?: { blendFunction?: BlendFunction; texture?: Texture; aspectCorrection?: boolean; }); set texture(arg: Texture); /** * The texture. * * @type {Texture} */ get texture(): Texture; set aspectCorrection(arg: number); /** * Indicates whether aspect correction is enabled. * * @type {Number} * @deprecated Adjust the texture's offset, repeat, rotation and center instead. */ get aspectCorrection(): number; /** * Returns the texture. * * @deprecated Use texture instead. * @return {Texture} The texture. */ getTexture(): Texture; /** * Sets the texture. * * @deprecated Use texture instead. * @param {Texture} value - The texture. */ setTexture(value: Texture): void; set uvTransform(arg: boolean); /** * Indicates whether the texture UV coordinates will be transformed using the transformation matrix of the texture. * * @type {Boolean} * @deprecated Use texture.matrixAutoUpdate instead. */ get uvTransform(): boolean; /** * Sets the swizzles that will be applied to the components of a texel before it is written to the output color. * * @param {ColorChannel} r - The swizzle for the `r` component. * @param {ColorChannel} [g=r] - The swizzle for the `g` component. * @param {ColorChannel} [b=r] - The swizzle for the `b` component. * @param {ColorChannel} [a=r] - The swizzle for the `a` component. */ setTextureSwizzleRGBA( r: ColorChannel, g?: ColorChannel, b?: ColorChannel, a?: ColorChannel ): void; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: number ): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A tone mapping mode enumeration. * * @type {Object} * @property {Number} LINEAR - No tone mapping, only exposure. * @property {Number} REINHARD - Simple Reinhard tone mapping. * @property {Number} REINHARD2 - Modified Reinhard tone mapping. * @property {Number} REINHARD2_ADAPTIVE - Simulates the optic nerve responding to the amount of light it is receiving. * @property {Number} UNCHARTED2 - Uncharted 2 tone mapping. * @property {Number} OPTIMIZED_CINEON - Optimized filmic operator by Jim Hejl and Richard Burgess-Dawson. * @property {Number} ACES_FILMIC - ACES tone mapping with a scale of 1.0/0.6. * @property {Number} AGX - Filmic tone mapping. Requires three r160 or higher. * @property {Number} NEUTRAL - Neutral tone mapping by Khronos. Requires three r162 or higher. */ export enum ToneMappingMode { LINEAR, REINHARD, REINHARD2, REINHARD2_ADAPTIVE, UNCHARTED2, OPTIMIZED_CINEON, ACES_FILMIC, AGX, NEUTRAL } /** * A tone mapping effect. */ export class ToneMappingEffect extends Effect { /** * Constructs a new tone mapping effect. * * The additional parameters only affect the Reinhard2 operator. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {Boolean} [options.adaptive=false] - Deprecated. Use mode instead. * @param {ToneMappingMode} [options.mode=ToneMappingMode.ACES_FILMIC] - The tone mapping mode. * @param {Number} [options.resolution=256] - The resolution of the luminance texture. Must be a power of two. * @param {Number} [options.maxLuminance=4.0] - Deprecated. Same as whitePoint. * @param {Number} [options.whitePoint=4.0] - The white point. * @param {Number} [options.middleGrey=0.6] - The middle grey factor. * @param {Number} [options.minLuminance=0.01] - The minimum luminance. Prevents very high exposure in dark scenes. * @param {Number} [options.averageLuminance=1.0] - The average luminance. Used for the non-adaptive Reinhard operator. * @param {Number} [options.adaptationRate=1.0] - The luminance adaptation rate. */ constructor({ blendFunction, adaptive, mode, resolution, maxLuminance, whitePoint, middleGrey, minLuminance, averageLuminance, adaptationRate }?: { blendFunction?: BlendFunction; adaptive?: boolean; mode?: ToneMappingMode; resolution?: number; maxLuminance?: number; whitePoint?: number; middleGrey?: number; minLuminance?: number; averageLuminance?: number; adaptationRate?: number; }); set resolution(arg: number); /** * The resolution of the luminance texture. Must be a power of two. * * @type {Number} */ get resolution(): number; set mode(arg: ToneMappingMode); /** * The tone mapping mode. * * @type {ToneMappingMode} */ get mode(): ToneMappingMode; /** * The white point. Default is `16.0`. * * Only applies to Reinhard2 (Modified & Adaptive). * * @type {Number} */ get whitePoint(): number; /** * The middle grey factor. Default is `0.6`. * * Only applies to Reinhard2 (Modified & Adaptive). * * @type {Number} */ get middleGrey(): number; /** * The average luminance. * * Only applies to Reinhard2 (Modified). * * @type {Number} */ get averageLuminance(): number; /** * Returns the current tone mapping mode. * * @deprecated Use mode instead. * @return {ToneMappingMode} The tone mapping mode. */ getMode(): ToneMappingMode; /** * Sets the tone mapping mode. * * @deprecated Use mode instead. * @param {ToneMappingMode} value - The tone mapping mode. */ setMode(value: ToneMappingMode): void; /** * The adaptive luminance material. * * @type {AdaptiveLuminanceMaterial} */ get adaptiveLuminanceMaterial(): AdaptiveLuminanceMaterial; /** * Returns the adaptive luminance material. * * @deprecated Use adaptiveLuminanceMaterial instead. * @return {AdaptiveLuminanceMaterial} The material. */ getAdaptiveLuminanceMaterial(): AdaptiveLuminanceMaterial; /** * Returns the resolution of the luminance texture. * * @deprecated Use resolution instead. * @return {Number} The resolution. */ getResolution(): number; /** * Sets the resolution of the luminance texture. Must be a power of two. * * @deprecated Use resolution instead. * @param {Number} value - The resolution. */ setResolution(value: number): void; set adaptive(arg: boolean); /** * Indicates whether this pass uses adaptive luminance. * * @type {Boolean} * @deprecated Use mode instead. */ get adaptive(): boolean; set adaptationRate(arg: number); /** * The luminance adaptation rate. * * @type {Number} * @deprecated Use adaptiveLuminanceMaterial.adaptationRate instead. */ get adaptationRate(): number; set distinction(arg: number); /** * @type {Number} * @deprecated */ get distinction(): number; /** * Updates this effect. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. */ update( renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime?: number ): void; /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * An enumeration of Vignette techniques. * * @type {Object} * @property {Number} DEFAULT - Produces a dusty look. * @property {Number} ESKIL - Produces a burned look. */ export enum VignetteTechnique { DEFAULT, ESKIL, } /** * A Vignette effect. */ export class VignetteEffect extends Effect { /** * Constructs a new Vignette effect. * * @param {Object} [options] - The options. * @param {BlendFunction} [options.blendFunction=BlendFunction.NORMAL] - The blend function of this effect. * @param {VignetteTechnique} [options.technique=VignetteTechnique.DEFAULT] - The Vignette technique. * @param {Boolean} [options.eskil=false] - Deprecated. Use technique instead. * @param {Number} [options.offset=0.5] - The Vignette offset. * @param {Number} [options.darkness=0.5] - The Vignette darkness. */ constructor({ blendFunction, technique, eskil, offset, darkness }?: { blendFunction?: BlendFunction; technique?: VignetteTechnique; eskil?: boolean; offset?: number; darkness?: number; }); set technique(arg: VignetteTechnique); /** * The Vignette technique. * * @type {VignetteTechnique} */ get technique(): VignetteTechnique; /** * Indicates whether Eskil's Vignette technique is enabled. * * @type {Boolean} * @deprecated Use technique instead. */ set eskil(arg: boolean); /** * Indicates whether Eskil's Vignette technique is enabled. * * @type {Boolean} * @deprecated Use technique instead. */ get eskil(): boolean; /** * Returns the Vignette technique. * * @deprecated Use technique instead. * @return {VignetteTechnique} The technique. */ getTechnique(): VignetteTechnique; /** * Sets the Vignette technique. * * @deprecated Use technique instead. * @param {VignetteTechnique} value - The technique. */ setTechnique(value: VignetteTechnique): void; set offset(arg: number); /** * The Vignette offset. * * @type {Number} */ get offset(): number; /** * Returns the Vignette offset. * * @deprecated Use offset instead. * @return {Number} The offset. */ getOffset(): number; /** * Sets the Vignette offset. * * @deprecated Use offset instead. * @param {Number} value - The offset. */ setOffset(value: number): void; set darkness(arg: number); /** * The Vignette darkness. * * @type {Number} */ get darkness(): number; /** * Returns the Vignette darkness. * * @deprecated Use darkness instead. * @return {Number} The darkness. */ getDarkness(): number; /** * Sets the Vignette darkness. * * @deprecated Use darkness instead. * @param {Number} value - The darkness. */ setDarkness(value: number): void; } /** * An enumeration of LUT worker operations. * * @type {Object} * @property {String} SCALE_UP - Tetrahedral upscale operation. */ export enum LUTOperation { SCALE_UP = "lut.scaleup", } /** * A tetrahedral upscaler that can be used to augment 3D LUTs. * */ export class TetrahedralUpscaler { /** * Expands the given data to the target size. * * @param {ArrayBufferView} data - The input RGBA data. Assumed to be cubic. * @param {Number} size - The target size. * @return {ArrayBufferView} The new data. */ static expand(data: ArrayBufferView, size: number): ArrayBufferView; } /** * SMAA area image data. * * This texture allows to obtain the area for a certain pattern and distances to the left and right of identified lines. * */ export class SMAAAreaImageData { /** * Creates a new area image. * * @return {RawImageData} The generated image data. */ static generate(): RawImageData; } /** * An SMAA image generator. * * This class uses a worker thread to generate the search and area images. The generated data URLs will be cached using * localStorage, if available. To disable caching use {@link SMAAImageGenerator.setCacheEnabled}. */ export class SMAAImageGenerator { /** * Indicates whether data image caching is disabled. * * @type {Boolean} * @deprecated Use setCacheEnabled() instead. */ disableCache: boolean; /** * Enables or disables caching via localStorage. * * @param {Boolean} value - Whether the cache should be enabled. */ setCacheEnabled(value: boolean): void; /** * Generates the SMAA data images. * * @example * SMAAImageGenerator.generate().then(([search, area]) => { * const smaaEffect = new SMAAEffect(search, area); * }); * @return {Promise} A promise that returns the search image and area image as a pair. */ generate(): Promise< (new (width?: number, height?: number) => HTMLImageElement)[] >; } /** * SMAA search image data. * * This image stores information about how many pixels the line search algorithm must advance in the last step. */ export class SMAASearchImageData { /** * Creates a new search image. * * @return {RawImageData} The generated image data. */ static generate(): RawImageData; } /** * A 3D lookup texture (LUT). * * This texture can be used as-is in a WebGL 2 context. It can also be converted into a 2D texture. */ export class LookupTexture extends Data3DTexture { /** * Creates a new 3D LUT by copying a given LUT. * * Common image-based textures will be converted into 3D data textures. * * @param {Texture} texture - The LUT. Assumed to be cubic. * @return {LookupTexture} A new 3D LUT. */ static from(texture: Texture): LookupTexture; /** * Creates a neutral 3D LUT. * * @param {Number} size - The sidelength. * @return {LookupTexture} A neutral 3D LUT. */ static createNeutral(size: number): LookupTexture; /** * Constructs a cubic 3D lookup texture. * * @param {TypedArray} data - The pixel data. The default format is RGBA. * @param {Number} size - The sidelength. */ constructor(data: ArrayBufferView, size: number); /** * The lower bounds of the input domain. * * @type {Vector3} */ domainMin: Vector3; /** * The upper bounds of the input domain. * * @type {Vector3} */ domainMax: Vector3; /** * Indicates that this is an instance of LookupTexture3D. * * @type {Boolean} * @deprecated */ get isLookupTexture3D(): boolean; /** * Scales this LUT up to a given target size using tetrahedral interpolation. * * @param {Number} size - The target sidelength. * @param {Boolean} [transferData=true] - Extra fast mode. Set to false to keep the original data intact. * @return {Promise} A promise that resolves with a new LUT upon completion. */ scaleUp(size: number, transferData?: boolean): Promise; /** * Applies the given LUT to this one. * * @param {LookupTexture} lut - A LUT. Must have the same dimensions, type and format as this LUT. * @return {LookupTexture} This texture. */ applyLUT(lut: LookupTexture): LookupTexture; /** * Converts the LUT data into unsigned byte data. * * This is a lossy operation which should only be performed after all other transformations have been applied. * * @return {LookupTexture} This texture. */ convertToUint8(): LookupTexture; /** * Converts the LUT data into float data. * * @return {LookupTexture} This texture. */ convertToFloat(): LookupTexture; /** * Converts this LUT into RGBA data. * * @deprecated LUTs are RGBA by default since three r137. * @return {LookupTexture} This texture. */ convertToRGBA(): LookupTexture; /** * Converts the output of this LUT into sRGB color space. * * @return {LookupTexture} This texture. */ convertLinearToSRGB(): LookupTexture; /** * Converts the output of this LUT into linear color space. * * @return {LookupTexture} This texture. */ convertSRGBToLinear(): LookupTexture; /** * Converts this LUT into a 2D data texture. * * Please note that custom input domains are not carried over to 2D textures. * * @return {DataTexture} The texture. */ toDataTexture(): DataTexture; } export type LookupTexture3D = LookupTexture; /** * A simple noise texture. */ export class NoiseTexture extends DataTexture { /** * Constructs a new noise texture. * * The texture format can be either `LuminanceFormat` or `RGBAFormat`. Additionally, the formats `RedFormat` and * `RGFormat` can be used in a WebGL 2 context. * * @param {Number} width - The width. * @param {Number} height - The height. * @param {Number} [format=LuminanceFormat] - The texture format. * @param {Number} [type=UnsignedByteType] - The texture type. */ constructor(width: number, height: number, format?: number, type?: number); } /** * A container for raw RGBA image data. * * @implements {ImageData} */ export class RawImageData implements ImageData { /** * Creates a new image data container. * * @param {ImageData|Image} image - An image or plain image data. * @return {RawImageData} The image data. */ static from( image: | ImageData | (new (width?: number, height?: number) => HTMLImageElement) ): RawImageData; /** * Constructs a new image data container. * * @param {Number} [width=0] - The width of the image. * @param {Number} [height=0] - The height of the image. * @param {Uint8ClampedArray} [data=null] - The image data. */ constructor(width?: number, height?: number, data?: Uint8ClampedArray); colorSpace: PredefinedColorSpace; /** * The width of the image. * * @type {Number} */ width: number; /** * The height of the image. * * @type {Number} */ height: number; /** * The RGBA image data. * * @type {Uint8ClampedArray} */ data: Uint8ClampedArray; /** * Creates a canvas from this image data. * * @return {HTMLCanvasElement} The canvas, or null if it couldn't be created. */ toCanvas(): HTMLCanvasElement; } /** * An SMAA image loader. * * @experimental Added for testing, API might change in patch or minor releases. Requires three >= r108. */ export class SMAAImageLoader extends Loader { /** * Loads the SMAA data images. * * @param {Function} [onLoad] - A callback that receives the search image and area image as a pair. * @param {Function} [onError] - An error callback that receives the URL of the image that failed to load. * @return {Promise} A promise that returns the search image and area image as a pair. */ load( url?: string | null, onLoad?: Function, onError?: Function ): Promise<(new (width?: number, height?: number) => HTMLImageElement)[]>; } /** * A 3D LUT loader that supports the .cube file format. */ export class LUTCubeLoader extends Loader { /** * Loads a LUT. * * @param {String} url - The URL of the CUBE-file. * @param {Function} [onLoad] - A callback that receives the loaded lookup texture. * @param {Function} [onProgress] - A progress callback that receives the XMLHttpRequest instance. * @param {Function} [onError] - An error callback that receives the URL of the file that failed to load. * @return {Promise} A promise that returns the lookup texture. */ load( url: string, onLoad?: Function, onProgress?: Function, onError?: Function ): Promise; /** * Parses the given data. * * @param {String} input - The LUT data. * @return {LookupTexture} The lookup texture. * @throws {Error} Fails if the data is invalid. */ parse(input: string): LookupTexture; } /** * A 3D LUT loader that supports the .3dl file format. */ export class LUT3dlLoader extends Loader { /** * Loads a LUT. * * @param {String} url - The URL of the 3dl-file. * @param {Function} [onLoad] - A callback that receives the loaded lookup texture. * @param {Function} [onProgress] - A progress callback that receives the XMLHttpRequest instance. * @param {Function} [onError] - An error callback that receives the URL of the file that failed to load. * @return {Promise} A promise that returns the lookup texture. */ load( url: string, onLoad?: Function, onProgress?: Function, onError?: Function ): Promise; /** * Parses the given data. * * @param {String} input - The LUT data. * @return {LookupTexture} The lookup texture. * @throws {Error} Fails if the data is invalid. */ parse(input: string): LookupTexture; } /** * Determines the texture inline decoding. * * @param {Texture} texture - A texture. * @param {Boolean} isWebGL2 - Whether the context is WebGL 2. * @return {String} The decoding. * @ignore */ export function getTextureDecoding( texture: Texture, isWebGL2: boolean ): string; /** * Converts orthographic depth to view Z. * * @param {Number} depth - The linear clip Z. * @param {Number} near - The camera near plane. * @param {Number} far - The camera far plane. * @return {Number} The view Z. * @ignore */ export function orthographicDepthToViewZ( depth: number, near: number, far: number ): number; /** * Converts view Z to orthographic depth. * * @param {Number} viewZ - The view Z. Expected to be negative. * @param {Number} near - The camera near plane. * @param {Number} far - The camera far plane. * @return {Number} The depth. * @ignore */ export function viewZToOrthographicDepth( viewZ: number, near: number, far: number ): number; /** * A lens distortion effect. * */ export class LensDistortionEffect extends Effect { /** * Constructs a new lens distortion effect. * * @param {Object} [options] - The options. * @param {Vector2} [options.distortion] - The distortion value. * @param {Vector2} [options.principalPoint] - The center point. * @param {Vector2} [options.focalLength] - The focal length. * @param {Number} [options.skew=0] - The skew value. */ constructor({ distortion, principalPoint, focalLength, skew }?: { distortion: Vector2; principalPoint: Vector2; focalLength: Vector2; skew?: number; }); /** * The radial distortion coefficients. Default is (0, 0). * * @type {Vector2} */ get distortion(): Vector2; set distortion(value: Vector2); /** * The principal point. Default is (0, 0). * * @type {Vector2} */ get principalPoint(): Vector2; set principalPoint(value: Vector2); /** * The focal length. Default is (1, 1). * * @type {Vector2} */ get focalLength(): Vector2; set focalLength(value: Vector2); /** * The skew factor in radians. * * @type {Number} */ get skew(): number; set skew(value: number); } export const __buildDate: any; export const __buildVerNo: any; export const __buildVersion: any; export const __DEV: any; /** * Axis aligned bounding box class. */ class AABB { /** * The lower bound of the bounding box */ lowerBound: Vec3; /** * The upper bound of the bounding box */ upperBound: Vec3; constructor(options?: { /** * The lower bound of the bounding box */ upperBound?: Vec3; /** * The upper bound of the bounding box */ lowerBound?: Vec3; }); /** * Set the AABB bounds from a set of points. * @param points An array of Vec3's. * @return The self object */ setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion_2, skinSize?: number): AABB; /** * Copy bounds from an AABB to this AABB * @param aabb Source to copy from * @return The this object, for chainability */ copy(aabb: AABB): AABB; /** * Clone an AABB */ clone(): AABB; /** * Extend this AABB so that it covers the given AABB too. */ extend(aabb: AABB): void; /** * Returns true if the given AABB overlaps this AABB. */ overlaps(aabb: AABB): boolean; volume(): number; /** * Returns true if the given AABB is fully contained in this AABB. */ contains(aabb: AABB): boolean; getCorners(a: Vec3, b: Vec3, c: Vec3, d: Vec3, e: Vec3, f: Vec3, g: Vec3, h: Vec3): void; /** * Get the representation of an AABB in another frame. * @return The "target" AABB object. */ toLocalFrame(frame: Transform, target: AABB): AABB; /** * Get the representation of an AABB in the global frame. * @return The "target" AABB object. */ toWorldFrame(frame: Transform, target: AABB): AABB; /** * Check if the AABB is hit by a ray. */ overlapsRay(ray: Ray_2): boolean; } type AbortCallback = () => void; /** * Returns the number which is larger in absolute value. * @param a * @param b * * @category Maths */ export function absMax(a: number, b: number): number; export class AbstractDecoratorBehavior extends Behavior { protected __source: Behavior; constructor(); /** * * @return {Behavior} */ getSource(): Behavior; /** * * @param {Behavior} source */ setSource(source: Behavior): void; initialize(context: BehaviorContext): void; finalize(): void; } export function acceleratedRaycast(raycaster: any, intersects: any): void; function acceleratedRaycast_2(raycaster: Raycaster, intersects: Array): void; const ACTION: Readonly<{ readonly NONE: 0; readonly ROTATE: 1; readonly TRUCK: 2; readonly OFFSET: 4; readonly DOLLY: 8; readonly ZOOM: 16; readonly TOUCH_ROTATE: 32; readonly TOUCH_TRUCK: 64; readonly TOUCH_OFFSET: 128; readonly TOUCH_DOLLY: 256; readonly TOUCH_ZOOM: 512; readonly TOUCH_DOLLY_TRUCK: 1024; readonly TOUCH_DOLLY_OFFSET: 2048; readonly TOUCH_DOLLY_ROTATE: 4096; readonly TOUCH_ZOOM_TRUCK: 8192; readonly TOUCH_ZOOM_OFFSET: 16384; readonly TOUCH_ZOOM_ROTATE: 32768; }>; type ACTION = number; export class ActionBehavior extends Behavior { #private; __action: (context: { entity: Entity; timeDelta: number; elapsed: number; [key: string]: any; }) => BehaviorStatus | void | undefined; __context: any; /** * * @param {function(timeDelta:number)} func */ constructor(func: (context: { entity: Entity; timeDelta: number; elapsed: number; [key: string]: any; }) => BehaviorStatus | void | undefined, options?: { context?: any; isRepeat?: boolean; }); tick(timeDelta: number): BehaviorStatus; } export class Adapter { node: Node_2; isInput: boolean; paramIndex: number; type: NodeValueType; inputs: (Wire | undefined)[]; outputs: Wire[][]; constructor(type: NodeValueType, isInput: boolean, node: Node_2, paramIndex: number); } /** * 向量相加 */ function add(out: T, v1: VectorArray, v2: VectorArray): T; const ADDITION: CSGOperation; export class AddObject3DCommand extends BaseCommand { private object; constructor(object: Object3D); execute(): void; undo(): void; redo(): void; } /** * 增加资源引用次数。如果在对象dispose销毁前,资源引用次数为零。将调用资源的dispose进行资源回收 * resource 资源对象 * count 引用次数,默认1 */ export function addResourceRefCount(resource: Object3D | Material | Material[] | Texture | WebGLRenderTarget, count?: number): void; /** * 将脚本注入. * 脚本选项信息: * `strategy`: 用于运行 JavaScript 的策略。可以是`inject`、`eval` 或`href`。默认自动检测. * `injectLocation`: 用于注入资源的位置的 `document.querySelector` 参数。默认为 `head`. * `async`: 异步加载脚本 * `src`: 脚本的来源 * @method * @async * @param {typeof defaultOptions | Array} scripts - Options for a script * @return {Promise} * @example * // you can add multiple loads * awit addScript([{ * src: "https://code.jquery.com/jquery-3.5.0.js" * }, { * src: "https://code.jquery.com/jquery-3.2.0.js", * async: true * }, { * src: "https://code.jquery.com/jquery-3.3.0.js", * async: true, * injectLocation: '#main div.test', * }, { * src: "https://code.jquery.com/jquery-3.4.0.js", * strategy: 'eval', * }, { * // link tag * // css autodetected * src: "https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap-grid.min.css", * }]) */ export function addScript(scripts: ScriptDefaultOptions | ScriptDefaultOptions[]): Promise; /** * Decrypts ciphertext encrypted with aesGcmEncrypt() using supplied password. * (c) Chris Veness MIT Licence * * https://gist.github.com/chrisveness/43bcda93af9f646d083fad678071b90a * Modified to work with Uint8Array and string content. * * @param ciphertext - Ciphertext to be decrypted. * @param password - Password to use to decrypt ciphertext. * @returns Decrypted content. If ciphertext is a string, the plaintext is a string. If ciphertext is a Uint8Array, the plaintext is a new Uint8Array. * * @example * const plaintext = await aesGcmDecrypt(ciphertext, 'pw'); * aesGcmDecrypt(ciphertext, 'pw').then(function(plaintext) { console.log(plaintext); }); * * @category Encryption */ export function aesGcmDecrypt(ciphertext: T, password: string | Uint8Array): Promise; /** * Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). * (c) Chris Veness MIT Licence * https://gist.github.com/chrisveness/43bcda93af9f646d083fad678071b90a * Modified to work with Uint8Array and string content. * * @param content - Plaintext or Uint8 Buffer to be encrypted. * @param password - Plaintext or Uint8 Buffer Password to use to encrypt content. * @param prefix - Optional prefix to prepend to the ciphertext. * @returns Encrypted ciphertext. If content is a string, the ciphertext is a string. If content is a Uint8Array, the ciphertext is a new Uint8Array. * * * @example * const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); * aesGcmEncrypt('my secret text', 'pw').then(function(ciphertext) { console.log(ciphertext); }); * * @category Encryption */ export function aesGcmEncrypt(content: T, password: string | Uint8Array, prefix?: string | Uint8Array): Promise; namespace AlgorithmPluginType { export { getTriangleDefinitions, logTriangleDefinitions, generateRandomTriangleColors, computeMeshVolume, createProjectionTask, computeBoundsTree_2 as computeBoundsTree, disposeBoundsTree_2 as disposeBoundsTree, acceleratedRaycast_2 as acceleratedRaycast, estimateMemoryInBytes, getBVHExtremes, validateBounds, getJSONStructure, getTriangleHitPointInfo, mergeGeometries, mergeAttributes, interleaveAttributes, estimateBytesUsed, mergeVertices, toTrianglesDrawMode, computeMorphedAttributes, computeMikkTSpaceTangents, mergeGroups, toCreasedNormals, Brush, TypedAttributeData, CSGOperation, ADDITION, SUBTRACTION, REVERSE_SUBTRACTION, INTERSECTION, DIFFERENCE, HOLLOW_SUBTRACTION, HOLLOW_INTERSECTION, Evaluator, Operation, OperationGroup, CullableTriangle, TrianglePool, TriangleSplitter, HalfEdgeMap, GridMaterial, TriangleSetHelper, EdgesHelper, TriangleIntersectData, TriangleIntersectionSets, OperationDebugData, PointsHelper, HalfEdgeHelper, ProjectionGenerator, SilhouetteGenerator, SplitStrategy, CENTER, AVERAGE, SAH, ShapecastIntersection, NOT_INTERSECTED, INTERSECTED, CONTAINED, HitPointInfo, MeshBVHOptions, MeshBVHSerializeOptions, MeshBVHDeserializeOptions, MeshBVH, SerializedBVH, MeshBVHHelper, ExtremeInfo, TreeNode, HitTriangleInfo, MeshBVHUniformStruct, shaderStructs, shaderFunctions, ExtendedTriangle, OrientedBox, StaticGeometryGenerator, Delatin } } export { AlgorithmPluginType } /** * Make two bezier arrays aligns on structure. To have better animation. * * It will: * Make two bezier arrays have same number of subpaths. * Make each subpath has equal number of bezier curves. * * array is the convert result of pathToBezierCurves. */ function alignBezierCurves(array1: number[][], array2: number[][]): any[][]; export type AllowedTypes = number | Vector3 | Quaternion | Euler | ColorRepresentation; export type Anchor = 'center' /** 正中 */ | 'top' /** 上面居中 */ | 'bottom' /** 下面居中 */ | 'left' /** 左边居中 */ | 'right' /** 右边居中 */ | 'top-left' /** 左上 */ | 'top-right' /** 右上 */ | 'bottom-left' /** 左下 */ | 'bottom-right'; export type Anchor3d = "default" /** 模型默认位置 */ | 'front-center' /** 前面-正中 */ | 'front-top' /** 前面-上面居中 */ | 'front-bottom' /** 前面-下面居中 */ | 'front-left' /** 前面-左边居中 */ | 'front-right' /** 前面-右边居中 */ | 'front-top-left' /** 前面-左上 */ | 'front-top-right' /** 前面-右上 */ | 'front-bottom-left' /** 前面-左下 */ | 'front-bottom-right' /** 前面-右下 */ | 'middle-center' /** 中间-正中 */ | 'middle-top' /** 中间-上面居中 */ | 'middle-bottom' /** 中间-下面居中 */ | 'middle-left' /** 中间-左边居中 */ | 'middle-right' /** 中间-右边居中 */ | 'middle-top-left' /** 中间-左上 */ | 'middle-top-right' /** 中间-右上 */ | 'middle-bottom-left' /** 中间-左下 */ | 'middle-bottom-right' /** 中间-右下 */ | 'back-center' /** 后面-正中 */ | 'back-top' /** 后面-上面居中 */ | 'back-bottom' /** 后面-下面居中 */ | 'back-left' /** 后面-左边居中 */ | 'back-right' /** 后面-右边居中 */ | 'back-top-left' /** 后面-左上 */ | 'back-top-right' /** 后面-右上 */ | 'back-bottom-left' /** 后面-左下 */ | 'back-bottom-right'; export const anchorOrigin: { center: string; top: string; 'top-left': string; 'top-right': string; bottom: string; 'bottom-left': string; 'bottom-right': string; left: string; right: string; }; export const anchorTranslate: { center: string; top: string; 'top-left': string; 'top-right': string; bottom: string; 'bottom-left': string; 'bottom-right': string; left: string; right: string; }; export class AnimateMarkerBase { protected options: AnimateMarkerLayerOption; protected markersElement: any; protected features: FeatureCollection | { position: [number, number, number?]; text?: string; }; constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setFeatures(features: FeatureCollection): void; getMarkersElement(): any; getElement(index?: number): any; getPosition(index?: number): any; createMarker2d(options?: Marker2dOptions, index?: number): Marker2D; createMarker3d(options?: Marker3dOptions, index?: number): Marker3D; setMarkersTextField(textField: string): void; setMarkersText(text: string, index?: number): void; setMarkersTextFontSize(textFontSize: number, index?: number): void; setMarkersTextColor(textColor: string, index?: number): void; protected _getColorWithOpacity(color: string, opacity: string | number): string; protected _getTextContainer(feature: any, className: string): HTMLDivElement; set16ToRgb(str: string): string; getColorWithOpacity(color: string, opacity: string | number): string; } export interface AnimateMarkerLayerOption { /** 动画标记类型,默认为breathingAperture */ type?: AnimateMarkerType; /** 宽度 */ width?: number; /** 高度 */ height?: number; /** 颜色值 */ colors?: string[]; /** 字体大小 */ textFontSize?: number; /** 字体颜色 */ textColor?: string; /** 字段内容位于哪个属性数据中(默认为name属性中去获取) */ textField?: string; } /** * breathingAperture 呼吸的光圈. * rotatingAperture 旋转的光环 * haloRing 发光的光环 * diffusedAperture 扩散的点 * rotatingTextBorder 旋转的文本框 * fluorescence 荧光点 */ export type AnimateMarkerType = "breathingAperture" | 'rotatingAperture' | 'haloRing' | 'diffusedAperture' | 'rotatingTextBorder' | 'fluorescence'; /** 创建动画,对Tween的封装 */ export function animation>(props: { /** id */ id?: string; /** 分类 */ tag?: string; /** 开始值(默认{value: 0}) */ from?: T; /** 结束值(默认{value: 1) */ to?: T; /** 为true的时候,to的值为相对值 */ by?: boolean; /** 持续时长 */ duration: number; /** easing 默认 linear */ easing?: Easing; /** 是否往返循环 */ yoyoForever?: boolean; /** 往返次数 */ yoyoTimes?: number; /** 重复循环 */ repeatForever?: boolean; /** 重复次数 */ repeatTimes?: number; /** 延迟时长 */ delay?: number; /** 自动播放动画,默认是 */ autoPlay?: boolean; /** * A callback function to execute when the animation completes. * @param target - The target object that was tweened. */ onComplete?: (target: T, isEnd: boolean, isStop: boolean) => void; /** * A callback function to execute when the animation starts. * @param target - The target object that is being tweened. */ onStart?: (target: T) => void; /** * A callback function to be executed after each property has been updated. * @param target - The target object that is being tweened. */ onUpdate?: (target: T) => void; /** * A callback function to be executed before each property is updated. * @param target - The target object that is being tweened. * @param key - The key or property being animated. * @param start - The initial value of the animated property. * @param end - The final value of the animated property. * @param alpha - The current animation progress as a normalized value (0 to 1). * @returns If `false`, will not assign a new value to the property. */ onProgress?: (target: T, key: string, start: AllowedTypes, end: AllowedTypes, alpha: number, reversed: boolean) => boolean | void; }): Tween; /** * @example * const animation = new Animation(); * const obj = { * x: 100, * y: 100 * }; * animation.animate(node.position) * .when(1000, { * x: 500, * y: 500 * }) * .when(2000, { * x: 100, * y: 100 * }) * .start(); */ class Animation_2 extends Eventful { stage: Stage; private _head; private _tail; private _running; private _time; private _pausedTime; private _pauseStart; private _paused; constructor(opts?: AnimationOption); /** * Add clip */ addClip(clip: Clip): void; /** * Add animator */ addAnimator(animator: Animator_2): void; /** * Delete animation clip */ removeClip(clip: Clip): void; /** * Delete animation clip */ removeAnimator(animator: Animator_2): void; update(notTriggerFrameAndStageUpdate?: boolean): void; _startLoop(): void; /** * Start animation. */ start(): void; /** * Stop animation. */ stop(): void; /** * Pause animation. */ pause(): void; /** * Resume animation. */ resume(): void; /** * Clear animation. */ clear(): void; /** * Whether animation finished. */ isFinished(): boolean; /** * Creat animator for a target, whose props can be animated. */ animate(target: T, options: { loop?: boolean; }): Animator_2; } /** 创建动画,对Tween的封装,返回一个promise,动画结束后返回 */ export function animationAsync>(props: { /** id */ id?: string; /** 分类 */ tag?: string; /** 开始值(默认{value: 0}) */ from?: T; /** 结束值(默认{value: 1) */ to?: T; /** 为true的时候,to的值为相对值 */ by?: boolean; /** 持续时长 */ duration: number; /** easing 默认 linear */ easing?: Easing; /** 是否往返循环 */ yoyoForever?: boolean; /** 往返次数 */ yoyoTimes?: number; /** 重复循环 */ repeatForever?: boolean; /** 重复次数 */ repeatTimes?: number; /** 延迟时长 */ delay?: number; /** 自动播放动画,默认是 */ autoPlay?: boolean; /** * A callback function to execute when the animation completes. * @param target - The target object that was tweened. */ onComplete?: (target: T, isEnd: boolean, isStop: boolean) => void; /** * A callback function to execute when the animation starts. * @param target - The target object that is being tweened. */ onStart?: (target: T) => void; /** * A callback function to be executed after each property has been updated. * @param target - The target object that is being tweened. */ onUpdate?: (target: T) => void; /** * A callback function to be executed before each property is updated. * @param target - The target object that is being tweened. * @param key - The key or property being animated. * @param start - The initial value of the animated property. * @param end - The final value of the animated property. * @param alpha - The current animation progress as a normalized value (0 to 1). * @returns If `false`, will not assign a new value to the property. */ onProgress?: (target: T, key: string, start: AllowedTypes, end: AllowedTypes, alpha: number, reversed: boolean) => boolean | void; }): Promise; export class AnimationBehavior extends Behavior { animation: AnimationTrackPlayback; /** * * @param {AnimationTrackPlayback} animation */ constructor(animation: AnimationTrackPlayback); /** * * @param {number} timeDelta * @returns {BehaviorStatus} */ tick(timeDelta: any): BehaviorStatus.Running | BehaviorStatus.Succeeded; initialize(): void; } /** * 关键帧动画选项 */ export interface AnimationClipOptions { /** 动画名称 */ name?: string; /** 时长 */ duration?: number; /** 混合模式 */ blendMode?: AnimationBlendMode; /** uuid */ uuid?: number; /** 帧率 */ fps?: number; /** 关键帧数据 */ tracks: { /** 类型 */ type: "double" | "float" | "number" | "integer" | "vector" | "vector2" | "vector3" | "vector4" | "color" | "quaternion" | "bool" | "boolean" | "string"; /** 名称 */ name?: string; /** 时间 */ times: number[]; /** 值 */ values: any[]; /** 插值方法 */ interpolation?: InterpolationModes; }[]; } type AnimationEasing = keyof typeof easingFuncs | easingFunc; interface AnimationOption { stage?: Stage; } export class AnimationTrack { properties: String[]; propertyCount: number; keyValues: any; keyTimes: any; timeStart: number; timeEnd: number; transitionKeys: any[]; transitionFunctions: any[]; constructor(properties: String[]); optimize(): void; /** * * @param {number} keyTime * @param {number[]} values */ addKey(keyTime: number, values: number[]): void; /** * * @param {number} startKeyIndex * @param {function(number):number} transitionFunction */ addTransition(startKeyIndex: number, transitionFunction: (number: any) => number): void; /** * * @param {number} time * @returns {number} */ keyLowerBoundIndexAt(time: number): number; /** * * @param {number} time * @returns {number} */ transitionIndexAt(time: number): number; /** * * @param {number} keyIndex * @param {number[]} result */ readKeyValues(keyIndex: number, result: number[]): void; } /** * * @param {AnimationTrack} track * @param updateCallback * @param {Object} [updateTarget] * @constructor * @property {AnimationTrack} track * @property {number} position Current playback time */ export class AnimationTrackPlayback { track: AnimationTrack; position: number; updateCallback: any; updateTraget: any; __lastKeyIndex: number; __lastTransitionIndex: number; __nextKeyIndex: number; __nextKeyTime: number; __loop: boolean; __valueBuffer: any; on: { ended: any; }; constructor(track: AnimationTrack, updateCallback?: Function, updateTarget?: any); /** * * @returns {Promise} */ promiseEnded(): Promise; /** * * @param {boolean} v */ setLoop(v: any): void; isLoop(): boolean; reset(): void; /** * * @param {number} time */ setPosition(time: number): void; /** * * @returns {boolean} Indicated whenever or not a key was advanced, no advancement is possible past end of the sequence */ advanceKey(): boolean; /** * Advance animation by given time delta * @param {number} timeDelta */ advance(timeDelta: number): void; update(): void; /** * * @param {number[]} result */ readCurrentValues(result: number[]): void; } /** * 生成动画 */ export class Animator { #private; uiConfig: UiObjectConfig; animateMixer: AnimationMixer; animationClips: AnimationClip[]; isAnimator: boolean; signal: { onLoop: Signal; onFinished: Signal; }; constructor(options: AnimatorOptions); /** * 停止所有动作 */ stopAllAction(): AnimationMixer; /** * 获取所有关键动画帧名称 */ getClipNames(): string[]; /** * 设置时间 */ setTime(timeInSeconds: number): AnimationMixer; /** * 增加关键帧动画 * @param clip * @returns */ addAnimationClip(clip: AnimatorOptions | AnimationClip): AnimationClip; /** * 获取动画混合器 * @returns */ getAnimateMixer(): AnimationMixer; /** * 获取关键帧动画数组 * @returns */ getAnimationClips(): AnimationClip[]; /** * 获取关键帧动画 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ getClip(name: string | number | AnimationClip): AnimationClip; /** * 增加子裁剪关键帧动画 * @param sourceClip 源关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param startFrame 开始帧位置 * @param endFrame 结束帖位置 * @param subclipName 子帧名称 * @param fps 帖率 */ addAnimationSubclip(sourceClip: string | number | AnimationClip, startFrame: number, endFrame?: number, subclipName?: string, fps?: number): void; /** * 获取关键帧动画动作 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ getclipAction(name: string | number | AnimationClip): AnimationAction; /** * 播放关键帧动画 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 如果不输入,则指第1个动画 * @returns */ play(name?: string | number | AnimationClip): AnimationAction; /** * 停止关键帧动画 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 如果不输入,则指所有的动画名称 * @returns */ stop(name?: string | number | AnimationClip): AnimationAction; /** * 重置关键帧动画 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ reset(name: string | number | AnimationClip): AnimationAction; /** * 关键帧动画是否在运行 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ isRunning(name: string | number | AnimationClip): boolean; /** * 如果动作是在混合器中被激活的,返回true。这并不意味着动画正在执行中 (需要额外判断isRunning值) * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ isScheduled(name: string | number | AnimationClip): boolean; /** * 设置动画播放结束后是停在最后还是回到开始位置 * * @param {string} name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param {boolean} clampWhenFinished 如果 clampWhenFinished 值设为true, 那么动画将在最后一帧之后自动暂停 如果 clampWhenFinished 值为false, enabled 属性值将在动作的最后一次循环完成之后自动改为false, 那么这个动作以后就不会再执行 * @memberof Animation */ setClampWhenFinished(name: string | number | AnimationClip, clampWhenFinished: boolean): void; /** * 设置动画是否能用 * * @param {string} name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param {boolean} enabled 是否启用 * @memberof Animation */ setEnable(name: string | number | AnimationClip, enabled: boolean): void; /** * 动画开始时间 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param time 开始时间 * @returns */ startAt(name: string | number | AnimationClip, time: number): AnimationAction; /** * 设置动画循环参数 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param mode 循环状态 * @param repetitions 循环次数 * @returns mode 循环状态 */ setLoop(name: string | number | AnimationClip, mode: AnimationActionLoopStyles, repetitions: number): AnimationAction; /** * 设置权重以及停止所有淡入淡出 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param weight 权重值 * @returns */ setEffectiveWeight(name: string | number | AnimationClip, weight: number): AnimationAction; /** * 获取权重 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ getEffectiveWeight(name: string | number | AnimationClip): number; /** * 在传入的时间间隔内,逐渐将此动作的权重(weight)由0升到1 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param duration 持续时间 * @returns */ fadeIn(name: string | number | AnimationClip, duration: number): AnimationAction; /** * 在传入的时间间隔内,逐渐将此动作的权重(weight)由1降至0。 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param duration 持续时间 * @returns */ fadeOut(name: string | number | AnimationClip, duration: number): AnimationAction; /** * 在传入的时间段内,让此动作淡入(fade in),同时让另一个动作淡出。 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param fadeOutAction 淡出的另一个动作 * @param duration 持续时间 * @param warp 如值是true, 额外的 warping (时间比例的渐变)将会被应用。 * @returns */ crossFadeFrom(name: string | number | AnimationClip, fadeOutAction: AnimationAction, duration: number, warp: boolean): AnimationAction; /** * 在传入的时间段内, 让此动作淡出(fade out),同时让另一个动作淡入 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param fadeInAction 淡出的动作 * @param duration 持续时间 * @param warp 如值是true, 额外的 warping (时间比例的渐变)将会被应用。 * @returns */ crossFadeTo(name: string | number | AnimationClip, fadeInAction: AnimationAction, duration: number, warp: boolean): AnimationAction; /** * 停止动作中所有预定的淡入淡出(fading) * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ stopFading(name: string | number | AnimationClip): AnimationAction; /** * 设置时间比例(timeScale)以及停用所有的变形) * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param timeScale 时间比例 * @returns */ setEffectiveTimeScale(name: string | number | AnimationClip, timeScale: number): AnimationAction; /** * 获取时间比例 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ getEffectiveTimeScale(name: string | number | AnimationClip): number; /** * 设置单次循环的持续时间(通过调整时间比例(timeScale)以及停用所有的变形) * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ setDuration(name: string | number | AnimationClip, duration: number): AnimationAction; /** * 将此动作与传入的其它动作同步 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param action 需同步的动作 * @returns */ syncWith(name: string | number | AnimationClip, action: AnimationAction): AnimationAction; /** * 在传入的时间间隔内,通过从当前值开始逐渐降低时间比例(timeScale)使动画逐渐减速至0 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param duration 持续时间 * @returns */ halt(name: string | number | AnimationClip, duration: number): AnimationAction; /** * 在传入的事件间隔内,通过逐渐将时间比例timeScale由startTimeScale修改至endTimeScale来改变回放速度。 * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @param statTimeScale 开始时间比例 * @param endTimeScale 终止时间比例 * @param duration 持续时长 * @returns */ warp(name: string | number | AnimationClip, statTimeScale: number, endTimeScale: number, duration: number): AnimationAction; /** * 停用动作中所有预定的变形warping * @param name 关键帧动画名称或关键帧动画数组索引或关键帧动画对象 * @returns */ stopWarping(name: string | number | AnimationClip): AnimationAction; /** * 增加旋转动作 * @param period 周期时间 默认3s = 60 * 3 * @param axis 方向轴 默认绕y轴 "y" * @param name 动作名称 */ addRotationAnimation(period?: number, axis?: string, name?: any): AnimationClip; /** * 增加缩放动作 * @param period 周期时间 默认3s = 60 * 3 * @param axis 方向轴 默认绕y轴 "y" * @param name 动作名称 */ addScaleAxisAnimation(period?: number, axis?: string, name?: any): AnimationClip; /** * 增加晃动动作 * @param period 持继时间 默认3s = 60 * 3 * @param shakeScale 晃动比例 默认 1.2 * @param name 动作名称 */ addShakeAnimation(duration?: number, shakeScale?: Vector3 | number, name?: any): AnimationClip; /** * 增加脉动动作 * @param period 持继时间 默认3s = 60 * 3 * @param pulseScale 脉动比例 默认1.2 * @param name 动作名称 */ addPulsationAnimation(duration?: number, pulseScale?: number, name?: any): AnimationClip; /** * 增加闪烁动作 * @param period 持继时间 默认0.5 * @param name 动作名称 */ addVisibilityAnimation(duration?: number, name?: any): AnimationClip; /** * 增加颜色变化动作 * @param period 持继时间 3s = 60 * 3 * @param colors 颜色列表 * @param name 动作名称 */ addMaterialColorAnimation(duration?: number, colors?: { r: number; g: number; b: number; }[], name?: any): AnimationClip; update(delta: number): void; dispose(): void; /** * 主动添加加至应用中 * @param app * @param autoPlay 是否自动播放动画,默认是 * @returns */ addTo(app: App, autoPlay?: boolean): void; /** * 从应用中移除此动画 * @returns */ remove(): void; } class Animator_2 { animation?: Animation_2; targetName?: string; scope?: string; __fromStateTransition?: string; private _tracks; private _trackKeys; private _target; private _loop; private _delay; private _maxTime; /** * If force run regardless of empty tracks when duration is set. */ private _force; /** * If animator is paused * @default false */ private _paused; private _started; /** * If allow discrete animation * @default false */ private _allowDiscrete; private _additiveAnimators; private _doneCbs; private _onframeCbs; private _abortedCbs; private _clip; constructor(target: T, loop: boolean, allowDiscreteAnimation?: boolean, // If doing discrete animation on the values can't be interpolated additiveTo?: Animator_2[]); getMaxTime(): number; getDelay(): number; getLoop(): boolean; getTarget(): T; /** * Target can be changed during animation * For example if style is changed during state change. * We need to change target to the new style object. */ changeTarget(target: T): void; /** * Set Animation keyframe * @param time time of keyframe in ms * @param props key-value props of keyframe. * @param easing */ when(time: number, props: Dictionary, easing?: AnimationEasing): this; whenWithKeys(time: number, props: Dictionary, propNames: string[], easing?: AnimationEasing): this; pause(): void; resume(): void; isPaused(): boolean; /** * Set duration of animator. * Will run this duration regardless the track max time or if trackes exits. * @param duration * @returns */ duration(duration: number): this; private _doneCallback; private _abortedCallback; private _setTracksFinished; private _getAdditiveTrack; /** * Start the animation * @param easing * @return */ start(easing?: AnimationEasing): this; /** * Stop animation * @param {boolean} forwardToLast If move to last frame before stop */ stop(forwardToLast?: boolean): void; /** * Set when animation delay starts * @param time 单位ms */ delay(time: number): this; /** * 添加动画每一帧的回调函数 * @param callback */ during(cb: OnframeCallback_2): this; /** * Add callback for animation end * @param cb */ done(cb: DoneCallback): this; aborted(cb: AbortCallback): this; getClip(): Clip; getTrack(propName: string): Track; getTracks(): Track[]; /** * Return true if animator is not available anymore. */ stopTracks(propNames: string[], forwardToLast?: boolean): boolean; /** * Save values of final state to target. * It is mainly used in state mangement. When state is switching during animation. * We need to save final state of animation to the normal state. Not interpolated value. * * @param target * @param trackKeys * @param firstOrLast If save first frame or last frame */ saveTo(target: T, trackKeys?: readonly string[], firstOrLast?: boolean): void; __changeFinalValue(finalProps: Dictionary, trackKeys?: readonly string[]): void; } export const AnimatorFrameMaterial: (new (parameters?: ShaderMaterialParameters & Partial, uniforms?: Partial) => ShaderMaterial & AnimatorFrameMaterialProps) & { key: string; }; export type AnimatorFrameMaterialProps = { /** 颜色 */ color?: Color; /** 纹理宽 */ imageWidth: number; /** 纹理高 */ imageHeight: number; /** 精灵有多少行 */ rowCount: number; /** 精灵有多少列 */ colCount: number; /** 精灵子图片的总个数 不输入时自动计算 */ spriteCount?: number; /** 一个精灵宽 不输入时自动计算 */ spriteWidth?: number; /** 一个精灵高 不输入时自动计算 */ spriteHeight?: number; /** 当前运行时的帧数 */ curRunFrameCount?: number; /** 是否停止 */ isStop?: boolean; /** 停止时sprite的索引 默认0 */ stopSpriteIndex?: number; /** 时间变量 */ time?: Vector4 | { value: Vector4; }; /** Material side, default: BackSide */ side?: Side; /** Material depthWrite, default: false */ depthWrite?: boolean; /** 纹理 */ map?: Texture; [key: string]: any; }; /** * 动画模块 */ export class AnimatorModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; animators: Animator[]; constructor(entity: Entity, options?: AnimatorModuleOptions | Animator); setupUiConfig(): UiObjectConfig; /** * 根据索引获取动画库。默认是第0个 * @param index 增加一个动画库 */ getAnimator(index?: number): Animator; /** * 增加一个动画库 * @param index */ addAnimator(options: AnimatorOptions): Animator; /** * 删除一个动画库 * @param index */ removeAnimator(index: number | Animator): void; onAppUpdate(time: Time): void; } /** * 生成动画选项 */ export interface AnimatorModuleOptions { /** 关联动画的对象 */ object?: Object3D | Object3D[] | Entity | Entity[]; /** 动画剪辑 */ animations?: AnimationClip[] | AnimationClip | AnimationClipOptions | AnimationClipOptions[]; } /** * 生成动画选项 */ export interface AnimatorOptions { /** 关联动画的对象 */ object: Object3D | Object3D[] | Entity | Entity[]; /** 关键帧动画 */ animations?: AnimationClip[] | AnimationClip | AnimationClipOptions | AnimationClipOptions[]; } /** * Type for any function */ export type AnyFunction = (...args: any[]) => any; /** * Type for any object */ export type AnyOptions = Record; export class App extends AppBase implements IWebGLRendererModule, ISceneModule, ICameraModule, ICSS2DRendererModule, ICSS3DRendererModule, ICoordSystemModule, IEntityManagerModule, IEntityQueryModule, IStatModule, IInputModule, IOrbitControlModule, IPickModule, IRectCollideModule, IToolStateModule, ICommandModule, IParticleRenderModule, IPhysicsManagerModule, IUiModule, IPostProcessModule { #private; /** 渲染器 */ readonly renderer: WebGLRenderer; /** 2d渲染器 */ readonly css2dRenderer: CSS2DRenderer; /** 获取所有的marker2d */ getMarker2Ds: () => Marker2D[]; /**获取所有的popup2d */ getPopup2Ds: () => Popup2D[]; /** 全局的popup对象 */ readonly popup2d: Popup2D; /** css3d渲染器 */ readonly css3dRenderer: CSS3DRenderer; /** 能遮挡的css3d渲染器 */ readonly css3dOccludeRenderer: CSS3DRenderer; /** 设置3d物体能否被场景遮挡 */ setCss3dObjectCanOcclude: (object: CSS3DObject, canOcclude?: boolean) => void; /** 获取渲染截图 */ getScreenshot: (params?: Screenshot) => Promise; /** 地图模式 */ readonly isMapMode: boolean; readonly commonUniforms: { time: Uniform_2; resolution: Uniform_2; iGlobalTime: Uniform_2; iTime: Uniform_2; iTimeDelta: Uniform_2; iResolution: Uniform_2; iMouse: Uniform_2; iFrame: Uniform_2; iDate: Uniform_2; iSampleRate: Uniform_2; iChannelTime: Uniform_2<[number, number, number, number]>; }; /** 增加场景 */ addScene: (scene?: Scene, camera?: CameraOptions) => Scene; /** 切换场景 */ activeScene: (_scene: Scene) => Promise; /** 设置场景,(将删除之前场景,增加此场景此把此场景设置为当前场景) */ setScene: (scene?: Scene, camera?: CameraOptions) => Promise; /** 移除场景 */ removeScene: (_scene: Scene) => Promise; /** 初始化场景 */ initScene: (scene: Scene) => void; /** 清空所有场景 */ clearScenes: () => void; /** 场景实体 */ readonly sceneEntity: Entity; /** 增加缺省灯光 */ addDefaultLights: (scene?: Scene) => {}; /** 获取场景的统计数据 */ getSceneStatData: () => { /** 物体对象数 */ objects: number; /** 顶点数 */ vertices: number; /** 三角形数 */ triangles: number; }; /** 环境变量 */ readonly envConfig: EnvConfigOption & { [key: string]: any; }; /** 设置环境变量 */ setEnvConfig: (key: keyof EnvConfigOption | string, value: any) => void; /** 设置场景背景及环境参数 */ setBackgroundEnvironment: (options?: BackgroundEnvironmentOptions) => Promise; /** 获取焦点 */ setFocus: () => void; /** 加载资源数组 */ loadResources: (_resources: ResourceItem[], options?: loadResourcesOptions) => Promise; /** 获取通过loadResources已加载的资源 */ getLoadedResources: () => RosourceItemsReturnType; getEntities: () => Entity[]; getRayQueryEntities: () => Entity[]; addSelectedEntity: (ent: Entity) => {}; removeSelectEntity: (ent: Entity) => {}; getSelectObjects: () => Object3D[]; getSelectObjectsRef: () => ShallowReactive; addBloomEntity: (ent: Entity) => {}; removeBloomEntity: (ent: Entity) => {}; getBloomObjects: () => Object3D[]; getBloomObjectsRef: () => ShallowReactive; addOutlineEntity: (ent: Entity) => {}; removeOutlineEntity: (ent: Entity) => {}; getOutlineObjects: () => Object3D[]; getOutlineObjectsRef: () => ShallowReactive; setSelectBoomRefreshFlag: () => void; showStat: boolean; /**是否显示视角显示器 */ viewHelperEnable: boolean; /** * 设置相机朝向 * @param position 相机位置 * @param lookAt 朝向 * @param options 选项 */ setCameraLookAt: (position: Vector3, lookAt: Vector3, options?: boolean | Record) => void; /** 是否启用相机控制器 */ enableCameraControl: boolean; /** 相机控制器响应式对象 */ enableCameraControlRef: Ref; /** 当相机禁止时还允许滚轮进行缩放操作 */ enableWheelWhenCtrlDisabled: boolean; /** * 屏幕坐标转世界坐标 * @param x * @param y * @param opts (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 * @param retIntersectObject 如果需要返回与哪个实体相交而转化的世界坐标,可传入一个object对象 */ unproject: (x: number | Vector2, y?: number, opts?: UnProjectOpts, retIntersectObject?: {}) => Vector3 | undefined; /** * 屏幕坐标转世界坐标(同 unproject 函数,不同的地方是他支持通过后期处理的深度进行转换,是异步执行的) * @param x 屏幕坐标x * @param y 屏幕坐标y * @param opts (false 不用场景数据, true用场景数据) "depth" 后期处理的深度进行转换, 深度值 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 * @param retIntersectObject 如果需要返回与哪个实体相交而转化的世界坐标,可传入一个object对象 */ unprojectAsync: (x: number, y: number, opts?: UnProjectOpts | "depth", retIntersectObject?: {}) => Promise; /** * 世界坐标转屏幕坐标 */ project: (x: number | Vector3, y?: number, z?: number) => Vector2; /** * 屏幕坐标转NDC坐标 */ screenToNdc: (x: number | Vector2, y?: number) => Vector2; /** * NDC坐标转屏幕坐标 */ ndcToScreen: (x: number | Vector2, y?: number) => Vector2; /** * 设置的中心点坐标 */ centerOrigin: Vector3 | undefined; /** * 开始缩放比例,x,y,z方向都同比例缩放,默认1 */ scaleOrigin: number | undefined; /** * 当前应该是否处于自由状态 */ isFreeStatus: boolean; /** * 自由状态响应式对象 */ isFreeStatusRef: Ref; /** * 拾取一个点 */ pickPoint: (opts?: PickPointOptions) => Promise<{ cancel: boolean; point?: Vector3; reason?: string; intersectObject?: any; event?: InteractiveEvent; }>; /** * 拾取实体 */ pickEntity: (opts?: PickEntityOptions) => Promise<{ cancel: boolean; entities: Entity[]; reason?: string; clearHighlight: Function; }>; /** * 绘制一个选择框 */ drawSelectBox: (style?: Record) => Promise<{ cancel: boolean; reason?: string; } | [Vector2, Vector2]>; /** * 绘制一个点,获取点坐标 */ actionDrawPoint: (opts?: IDrawPointEnterOptions) => Promise<{ isCancel?: boolean; data: SymbolItemData; }>; /** * 绘制一条线,获取线坐标 */ actionDrawLineSting: (opts?: IDrawLineEnterOptions) => Promise<{ isCancel?: boolean; data: PolylineItemData; }>; /** * 绘制一个多边形,获取多边形坐标 */ actionDrawPolygon: (opts?: IDrawPolygonEnterOptions) => Promise<{ isCancel?: boolean; data: PolygonItemData; }>; actionDrawEdit: (opts?: IDrawEditEnterOptions) => Promise<{}>; /** 选中一个实体对象 */ actionPickSelect: (opts?: PickEnterOptions) => Promise<{ isCancel: boolean; info?: TLEventHandler; select?: InteractiveObject; }>; /** 通过图层名称获取当前绘图层的实体 */ getDrawLayer: (layerName?: string, noCreateStyle?: Record) => { symbol: () => SymbolEntity | undefined; polylines: () => PolylinesEntity | undefined; polygons: () => PolygonsEntity | undefined; addPointData: (data: SymbolItemData, addToCommand?: boolean) => SymbolEntity; addPolylineData: (data: PolylineItemData, addToCommand?: boolean) => PolylinesEntity; addPolygonData: (data: PolygonItemData, addToCommand?: boolean) => PolygonsEntity; updatePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; updatePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; updatePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; deletePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; deletePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; deletePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; }; addPointerEventsObject: (entity: Entity) => {}; removePointerEventsObject: (entity: Entity) => {}; Input: { /** 获取键是否开始按下 exam: getKeyDown("KeyW") */ getKeyDown: (keyCode: string) => boolean; /** 获取键是否按住 如 Space Enter ShiftLeft ControlLeft */ getKeyPressed: (keyCode: string) => boolean; /** 获取键是否松开 */ getKeyUp: (keyCode: string) => boolean; x: () => number; y: () => number; movementX: () => number; movementY: () => number; isMoving: () => boolean; isDragging: () => boolean; isLeftButtonDown: () => boolean; isLeftButtonPressed: () => boolean; isLeftButtonUp: () => boolean; isRightButtonDown: () => boolean; isRightButtonPressed: () => boolean; isRightButtonUp: () => boolean; isMidButtonDown: () => boolean; isMidButtonPressed: () => boolean; isMidButtonUp: () => boolean; enabled: () => boolean; setEnable: (b: boolean) => {}; /** 是否可用的响应式对象 */ enabledRef: () => Ref; /** 当前离鼠标最近的物体实体 */ closestObject: () => InteractiveObject | undefined | null; }; /** * 设置地图右键上下文菜单,运行时将触发 上下文菜单将要打开`contextMenuPreOpen`, 上下文菜单已打开`contextMenuOpened`, 上下文菜单打开无内容`contextMenuNoContent`事件 * @param menu 获取菜单的函数 * @param key 多次调用setMenu时,同样的key会覆盖之前的事件函数;有多个key时,调用次序为key的字母次序倒序;多次调用时,直到函数返回一个非null的ContextMenu为止 */ setMenu: (menu?: (event: InteractiveEvent | any, object?: InteractiveObject) => ContextMenu | null | undefined, key?: string) => void; /** * 通过相机查询实体 */ queryEntitiesByCamera: (option?: EntityQueryOption) => InteractiveObject; /** * 通过射线查询实体 */ queryEntitiesByRaycast: (ray: Ray, option?: EntityQueryOption) => InteractiveObject; /** * 通过屏幕像素坐标查询实体 */ queryEntitiesByScreenPos: (x: number, y: number, option?: EntityQueryOption) => InteractiveObject; /** * 通过框选查询实体 */ queryEntitiesByBox: (startPoint: Vector3, endPoint: Vector3, option?: EntityQueryOption, deep?: number) => InteractiveObject[]; /** * 通过屏幕坐标获取射线 */ getRayByScreenPos: (x: number, y: number, camera?: Camera) => Ray; /** * 获取查询的射线对象 */ getQueryRaycaster: () => Raycaster; /** 效果合成器 */ readonly composer: EffectComposer; /** 效果合成器是否可用 */ isComposerEnable: () => boolean; /** 设置效果合成器是否可用 */ setComposerEnable: (b: boolean) => void; /** 给效果合成器增加渲染通道 */ addEffectRenderPass: (pass: Pass, orderIndex?: number) => void; /** 给效果合成器移除渲染通道 */ removeEffectRenderPass: (pass: Pass) => void; /** 刷新渲染通道 foreceUpdate是否强制更新*/ refreshEffectRenderPass: (foreceUpdate?: boolean) => void; /** 根据屏幕坐标获取深度值 */ getDepth: (x: number, y: number) => Promise; /** OutlineEffect */ readonly outlineEffect: OutlineEffect; /** bloomEffect */ readonly bloomEffect: SelectiveBloomEffect; /** selectedEffect */ readonly selectedEffect: OutlineEffect; /** 后期处理是否空闲 */ readonly isPostProcessIdle: boolean; /** 增加碰撞检测的对象 */ addCollideRectObject: (item: IRectCollide) => void; /** 移除碰撞检测的对象 */ removeCollideRectObject: (item: IRectCollide) => void; /** 更新碰撞检测 */ updateCollideRect: () => void; /** 设置更新碰撞检测为脏数据,使其重新检测 */ setCollideRectDirty: () => void; readonly rootState: StateNode; getStatePath: () => string; stateIsIn: (path: string) => boolean; stateInAny: (...paths: string[]) => boolean; setCurrentTool: (id?: string, info?: Record) => App; getCurrentTool: () => StateNode; getCurrentToolId: () => string; getStateDescendant: (path: string) => T | undefined; addTool: (Tool: TLStateNodeConstructor) => void; removeTool: (Tool: TLStateNodeConstructor) => void; /** * 判断当前是否有工具处于运行中 */ isInActiveTool: () => boolean; /** * 是否正在交互 */ isInteracting: () => boolean; /** * 对一个物体进行变换控制器操作 */ transformObject: (options: TransformEnterOptions) => Promise; readonly commandHistory: CommandHistory; /** 清空命令 */ clearCommands: () => void; /** 执行命令,自动执行 */ executeCommand: (cmd: ICommand) => void; /** 执行所有命令,自动执行 */ executeAllCommands: (cmds: ICommand[]) => void; /** 执行多个命令,自动执行 */ executeManyCommands: (...cmds: ICommand[]) => void; /** 增加命令,不会自动执行 */ addCommand: (cmd: ICommand) => void; /** 增加所有命令,不会自动执行 */ addAllCommands: (cmds: ICommand[]) => void; /** 增加多个命令,不会自动执行 */ addManyCommands: (...cmds: ICommand[]) => void; /** 撤销 */ undo: () => any; /** 还原 */ redo: () => any; /** * 增加控件 (会调用 `control.onAdd(this)` ). * * @param control 需要增加的控件. * @param {string} [position] 位置. 'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'` */ addControl: (control: IControl, position?: ControlPosition) => App; /** * 移除控件. * * @param {IControl} control 要移除的控件. */ removeControl: (control: IControl) => App; /** * 是否有控件. * * @param {IControl} control 要查询的控件. */ hasControl: (control: IControl) => void; /** * 设置光标 * @param cur 光标名称 */ setCursor: (cur: string) => void; /** * 获取配置面板 */ getConfigPane: (opts?: { /** 是否清空,默认是 */ isReset?: boolean; /** 标题 */ title?: string; /** 样式 */ style?: Partial; }) => Promise<{ configPane: any; rootPane: any; element: HTMLElement; isInit: boolean; setVisible: (b: boolean) => void; isVisible: () => boolean; reset: () => void; appendChild: (config?: UiObjectConfig, params?: UiObjectConfig) => any; renderUiConfig: (uiConfig: UiObjectConfig) => void; renderUiObject: (uiConfig: UiObjectConfig, parent?: any) => any; }>; /** * 信息弹窗提示 * text(必填):需要输出的文本 * type(可选):输出类型 默认是 "log" * time(可选):停留时间 默认是 2500 */ logInfo: (text: string, type?: logInfoType | number, time?: number) => void; readonly particleRenderer: BatchedRenderer; /** * 增加粒子系统 * @param system 粒子系统参数 * @param parent parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 * @param disposeWhenEnd 当结束时自动删除,默认为true * @returns */ addParticleSystem: (system: IParticleSystem, parent?: Object3D, disposeWhenEnd?: boolean) => void; /** 增加粒子 */ addParticle: (opts: { /** 粒子系统参数 */ system: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; }) => ParticleEmitter; /** 从文件加载粒子场景 */ loadParticle: (url: string, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载完json的回调 可对json进行修改 */ onData?: (data: any) => any; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; crossOrigin?: string; withCredentials?: boolean; urlPath?: string; resourcePath?: string; requestHeader?: { [header: string]: string; }; }) => Promise>; /** 从JSON字符串加载粒子场景 */ loadParticleFromJson: (json: string | JSON, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; /** 加载数据完成回调 */ onData?: (data: any) => any; }) => ParticleEmitter; /** 从资源加载粒子场景 */ loadParticleFromRes: (obj: Object3D, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; }) => ParticleEmitter; /** 移除粒子系统 */ removeParticle: (obj: ParticleEmitter) => void; /** 是否能用物理引擎 */ physicsEnable: boolean; /** 得到物理引擎世界对象 */ readonly physicsWorld: World; /** 得到物理引擎对象 */ readonly physicsEngine: typeof CANNON; /** 启动物体引擎 */ enablePhysicsEngine: () => Promise; /** 增加物理刚体 */ addPhysicsBody: (phyObject: MeshPhysicsObjectParams) => MeshPhysicsObjectParams; /** 通过实体或对象移除物理刚体 */ removePhysicsObject: (object: Object3D | Entity) => void; /** 增加一个物理地面 */ addPhysicsGround: () => CANNON.Plane; /** 设置物理引擎调试 */ setPhysicsDebugger: (enable: boolean) => void; isApp: boolean; static defaultModules: Array; /** 注册的模块 */ static registerModules: Set; signal: { /** 物体选择信息改变事件 */ onSelectedChange: Signal; onEntitySelected: Signal; onEntityUnSelected: Signal; onBloomedChange: Signal; onEntityBloomed: Signal; onEntityUnBloomed: Signal; onOutlineChange: Signal; onEntityOutline: Signal; onEntityUnOutline: Signal; onMouseUp: Signal; onMouseMove: Signal; onMouseDown: Signal; onMousePreClick: Signal; onMouseClick: Signal; onMouseDblClick: Signal; onMouseOver: Signal; onMouseOut: Signal; onMouseEnter: Signal; onMouseLeave: Signal; onContextMenu: Signal; onPointerDown: Signal; onPointerMove: Signal; onPointerUp: Signal; /** 鼠标直接按下松开,没有拖动 */ onPointerDownUp: Signal; onPointerCancel: Signal; onMouseWheel: Signal; onKeyDown: Signal; onKeyUp: Signal; onAppBeforeUpdate: Signal; onAppUpdate: Signal; onAppAfterUpdate: Signal; onAppBeforeRender: Signal; onAppRender: Signal; onAppAfterRender: Signal; onAppBeforeAddEntity: Signal; onAppAddEntity: Signal; onAppBeforeRemoveObject: Signal; onAppRemoveObject: Signal; onAppBeforeRemoveEntity: Signal; onAppRemoveEntity: Signal; /** 窗口大小变化事件 */ onContainerSizeChange: Signal; /** 相机控件事件 */ onCameraControl: Signal; /** 相机更新事件 */ onCameraUpdate: Signal; /** 相机变化事件,当相机对象变化或远近裁剪面变化时触发 */ onCameraChange: Signal; /** 上下文菜单即将打开 */ contextMenuPreOpen: Signal; /** 没有上下文菜单 */ contextMenuOpened: Signal; /** 上下文菜单已打开 */ contextMenuNoContent: Signal; /** 上下文菜单取消 */ contextMenuCancel: Signal; /** 自定义事件 */ onCustomEvent: Signal; /** 新增场景 */ onAddScene: Signal; /** 把场景置为当前 */ onActiveScene: Signal; /** 移除场景 */ onRemoveScene: Signal; }; /** 三维场景中地图实体 */ mapViewEntity: MapViewEntity; svc: Service; constructor(svc: Service, options?: AppOptions); setupUiConfig(): UiObjectConfig; dispose(): void; fromJSON(json: Record): Promise; toJSON(): { metadata: {}; project: {}; camera: any; scene: any; entities: any[]; }; } export class AppBase extends EventDispatcher { #private; readonly _modules: ModuleBase[]; readonly options: AppBaseOptions; needRenderUpdate: boolean; readonly moduleManager: ModuleManager; data: ShallowReactive<{ container?: HTMLElement; domElement?: HTMLElement; camera?: Camera; scene?: Scene; [key: string]: any; }>; containerSize: { width: number; height: number; }; tweenManager: TweenManager; [key: string]: any; private _uiConfig; get uiConfig(): UiObjectConfig; constructor(param?: AppBaseOptions); private readonly _animate; get container(): HTMLElement; set container(value: HTMLElement); get domElement(): HTMLElement; set domElement(value: HTMLElement); get camera(): Camera; set camera(value: Camera); get scene(): Scene; set scene(value: Scene); get cameraControl(): CameraControls; /** * Whether the engine is paused. */ get isPaused(): boolean; /** * 在vSyncCount被设置为0时才能生效,而当其设置为大于0时,则不生效。 当vSyncCount为1时,游戏帧率会与设备的刷新帧率保持一致,例如一台设备刷新频率是60Hz则,此时其游戏帧率为60FPS 当vSyncCount为2时,游戏帧率会设置为刷新帧率的一半,例如一台设备刷新帧率是60Hz时,则游戏帧率为30FPS * @remarks 0 means that the vertical synchronization is turned off. */ get vSyncCount(): number; set vSyncCount(value: number); /** * The time information of the engine. */ get time(): Time; /** * Set the target frame rate you want to achieve. * @remarks * It only takes effect when vSyncCount = 0 (ie, vertical synchronization is turned off). * The larger the value, the higher the target frame rate, Number.POSITIVE_INFINITY represents the infinite target frame rate. */ get targetFrameRate(): number; set targetFrameRate(value: number); /** * 下帧回调 */ onNextFrame(callback: (app: AppBase) => void): void; /** * Pause the engine. */ pause(): void; /** * Resume the engine. */ resume(): void; /** * Execution engine loop. */ run(): void; /** * Update the engine loop manually. If you call engine.run(), you generally don't need to call this function. */ update(): void; /** * Indicates whether the engine is destroyed. */ get destroyed(): boolean; private _destroy; /** * Destroy engine. * @remarks If call during frame execution will delay until the end of the frame */ destroy(): void; /** * 增加模块,等同于this.add(xxx) */ addModule(type: new (app?: any, obj?: U) => T, params?: U): T; /** * 增加模块,等同于this.addModule(xxx) */ add(type: new (app?: any, obj?: U) => T, params?: U): T; getModule(type: new (app?: any, obj?: U) => T): T; removeModule(type: new (app?: any, obj?: U) => T): void; removeAllModules(): void; callModules(methodName: string, ...args: any): void; } export interface AppBaseOptions { /** 应用容器 */ container?: string | HTMLElement; /** 是否自动开始,默认true */ autoStart?: boolean; /** 启动tween管理 默认true*/ enableTweenManager?: boolean; /** 是否是临时创建的app对象 */ isTemp?: boolean; /** 离屏渲染画布参数 */ offscreenCanvas?: { width: number; height: number; }; } /** * Apply collision to particles from a physics resolver. */ export class ApplyCollision implements Simulation { resolver: PhysicsResolver; bounce: number; type: string; tempV: Vector3; constructor(resolver: PhysicsResolver, bounce: number); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } /** * Apply a global force to particles. */ export class ApplyForce implements Simulation { direction: Vector3; magnitude: ValueGenerator; type: string; magnitudeValue: number; constructor(direction: Vector3, magnitude: ValueGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export const applyMixins: (toClassInst: any, fromClasseInst: any, methodNames: string[]) => () => void; export class ApplyRoute implements Simulation { type: string; paths: [number, number, number][]; _allDistance: number; _segmentDist: number[]; _nextPoint: [number, number, number]; _time: number; _curtime: number; constructor(paths: [number, number, number][], time?: number); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } /** * Apply sequences to particles. * {@link Sequencer} */ export class ApplySequences implements Simulation { static BEZIER: Bezier; type: string; sequencers: Array<[IntervalValue, Sequencer]>; time: number; index: number; pCount: number; delay: number; tempV: Vector3; constructor(delayBetweenParticles: number); initialize(particle: Particle): void; reset(): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; appendSequencer(range: IntervalValue, sequencer: Sequencer): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; } /** * 矩阵左乘向量 */ function applyTransform(out: T, v: VectorArray, m: MatrixArray): T; export class AppModuleBase extends ModuleBase { constructor(app?: App); } export type AppModuleConstructor = new (obj: any) => AppModuleBase; /** * EntityBase. */ export abstract class AppObject extends EventDispatcher { #private; private static _instanceIdCounter; readonly instanceId: number; _app?: App; onSetApp: Signal; data: ShallowReactive<{ [key: string]: any; }>; extData: { [key: string]: any; }; private _uiConfig; get uiConfig(): UiObjectConfig; protected _destroyed: boolean; constructor(app?: App); get app(): App; set app(value: App); /** * Whether it has been destroyed. */ get destroyed(): boolean; /** * Destroy self. */ destroy(): void; effectScope(fn: () => any): void; applyMixinsTo(toClassInst: any, methodNames?: string[], addMethods?: string[], filterName?: string[]): void; addDispose(cb: Function): void; removeDispose(cb: Function): void; } export interface AppOptions extends AppBaseOptions { render?: WebGLRendererModuleOptions; control?: OrbitControlModuleOptions; camera?: CameraModuleOptions; input?: InputModuleOptions; stat?: StatModuleOptions; scene?: SceneModuleOptions; css2dRender?: CSS2DRendererModuleOptions; css3dRender?: CSS3DRendererModuleOptions; modules?: Array; postProcess?: PostProcessModuleOptions; coordSystem?: CoordSystemOption; entityOutline?: EntityOutlineModuleOptions; physics?: PhysicsManagerModuleOptions; ui?: UiModuleOptions; } export function approxArrayEquals(a: number[], b: number[], error?: number): boolean; /** 两数是否近似相等 */ export function approxEquals(a: number, b: number, error?: number): boolean; /** 是否近似为零 */ export function approxZero(number: number, error?: number): boolean; class Arc extends Path { shape: ArcShape; constructor(opts?: ArcProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): ArcShape; buildPath(ctx: CanvasRenderingContext2D, shape: ArcShape): void; } interface ArcProps extends PathProps { shape?: Partial; } class ArcShape { cx: number; cy: number; r: number; startAngle: number; endAngle: number; clockwise?: boolean; } /** * Convert an ArrayBuffer to Base64 string * @param buffer - ArrayBuffer to convert * @category ArrayBuffer */ export function arrayBufferToBase64(buffer: ArrayBuffer): string; /** * Collision "matrix". * It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step */ class ArrayCollisionMatrix { /** * The matrix storage. */ matrix: number[]; constructor(); /** * Get an element */ get(bi: Body_2, bj: Body_2): number; /** * Set an element */ set(bi: Body_2, bj: Body_2, value: boolean): void; /** * Sets all elements to zero */ reset(): void; /** * Sets the max number of objects */ setNumObjects(n: number): void; } /** * Not readonly ArrayLike * Include Array, TypedArray */ type ArrayLike_2 = { [key: number]: T; length: number; }; function assert(condition: any, message?: string): void; export type AtlasData = { data: Uint8ClampedArray; width: number; height: number; charInfo: Record; maxAscent: number; lineHeight: number; }; const AVERAGE: SplitStrategy; export class AxisAngleGenerator implements RotationGenerator { axis: Vector3; angle: FunctionValueGenerator | ValueGenerator; type: 'rotation'; constructor(axis: Vector3, angle: FunctionValueGenerator | ValueGenerator); genValue(quat: Quaternion, t?: number): Quaternion; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): AxisAngleGenerator; clone(): RotationGenerator; } export interface BackgroundEnvironmentOptions { /** 自动创建房间环境 */ roomEnvironment?: boolean; /** 背景 */ background?: ColorRepresentation | BackgroundTexture; /** 环境 */ environment?: BackgroundTexture; /** 背景模糊. (0-1) 缺省 0 */ backgroundBlurriness?: number; /** 背景增强 缺省1. */ backgroundIntensity?: number; /** 环境是否与背景一样 默认true*/ environmentSameAsBackground?: boolean; /** 绘制坐标轴辅助对象 */ showAxesHelper?: boolean; /** 坐标轴辅助对象大小 */ axesHelperSize?: number; defaultLights?: boolean; /** 网格 */ gridHelper?: GridHelperModuleOptions; } export interface BackgroundTexture { isHdr?: boolean; path?: string; texture?: DataTexture; url?: string | string[]; } /** * Convert a Base64 string to ArrayBuffer * @param base64 - Base64 string to convert * @category ArrayBuffer */ export function base64ToArrayBuffer(base64: string): ArrayBuffer | Uint8Array; export abstract class BaseCommand implements ICommand { app: App; /** 是否自动执行。默认是 */ autoExecute?: boolean; callbacks?: ICommandCallback; abstract execute(): void; abstract undo(): void; redo(): void; } abstract class BaseCompiler { static Instance: BaseCompiler; constructor(); visited: Set; debug: boolean; protected buildExecutionOrder(graph: NodeGraph, context: ExecutionContext): void; private _traverseWire; private _traverse; abstract run(graph: NodeGraph, context: ExecutionContext): void; abstract build(graph: NodeGraph, context: ExecutionContext): string; } type BaseTypes = string | number | boolean; export abstract class BaseUvAtlas { api: any; abstract init(onLoad: () => void, onProgress: (mode: any, progress: any) => void, wasmFilePath: string, workerFilePath?: string): void; } export abstract class BaseUVUnwrapper { THREE: { BufferAttribute: Class_2; }; packOptions: PackOptions; chartOptions: ChartOptions; useNormals: boolean; timeUnwrap: boolean; logProgress: boolean; private xAtlas; /** * * @param THREE - for reference to BufferAttribute * @param packOptions - options for packing * @param chartOptions - options for unwrapping * @param useNormals - If true, will use the normals to calculate the uv * @param timeUnwrap - Logs the time taken to unwrap geometries * @param logProgress - Logs the unwrapping progress */ constructor(THREE: { BufferAttribute: Class_2; }, packOptions?: PackOptions, chartOptions?: ChartOptions, useNormals?: boolean, timeUnwrap?: boolean, logProgress?: boolean); private _libraryLoaded; loadLibrary(onProgress?: (mode: any, progress: any) => void, wasmFilePath?: string, workerFilePath?: string): Promise; private _isUnwrapping; /** * Pack multiple geometry into a single atlas * @param nodeList - list of geometries to unwrap * @param outputUv - Attribute to write the output uv to * @param inputUv - Attribute to write the input uv to (if any) */ packAtlas(nodeList: BufferGeometry[], outputUv?: 'uv' | 'uv2', inputUv?: 'uv' | 'uv2'): Promise; /** * Unwraps a geometry to generate uv * @param geometry * @param outputUv * @param inputUv */ unwrapGeometry(geometry: BufferGeometry, outputUv?: 'uv' | 'uv2', inputUv?: 'uv' | 'uv2'): Promise[]>; protected abstract _createUvAtlas(): any; } /** * the class represents the batch renderer. a three.js scene should only have one batchedRenderer * It keeps references of all particle systems and rendering batch. * It batches all particle systems that has the same rendering pipeline to a single VFXBatch. */ export class BatchedRenderer extends Object3D { /** * Batches for rendering. * @type {Array} */ batches: Array; /** * Map of systems to batch indices. * @type {Map} */ systemToBatchIndex: Map; type: string; /** * Depth texture. * @type {Texture | null} */ depthTexture: Texture | null; constructor(); private static equals; /** * Adds a particle system to a batch. * @param {IParticleSystem} system - The particle system to add. */ addSystem(system: IParticleSystem): void; /** * Deletes a particle system from its batch. * @param {IParticleSystem} system - The particle system to delete. */ deleteSystem(system: IParticleSystem): void; /** * Sets the depth texture for all batches. it will be used for soft particles. * @param {Texture | null} depthTexture - The depth texture to set. */ setDepthTexture(depthTexture: Texture | null): void; /** * Updates a particle system when the particle system has changed requires reloading. * @param {IParticleSystem} system - The particle system to update. */ updateSystem(system: IParticleSystem): void; /** * Updates all batches. * @param {number} delta - The time delta for the update. */ update(delta: number): void; } type BBox = BBox2d | BBox3d; /** * Bounding box * * https://tools.ietf.org/html/rfc7946#section-5 * A GeoJSON object MAY have a member named 'bbox' to include information on the coordinate range for its Geometries, Features, or FeatureCollections. * The value of the bbox member MUST be an array of length 2*n where n is the number of dimensions represented in the contained geometries, * with all axes of the most southwesterly point followed by all axes of the more northeasterly point. * The axes order of a bbox follows the axes order of geometries. */ type BBox2d = [number, number, number, number]; type BBox3d = [number, number, number, number, number, number]; /** * Base class of behavior tree implementation */ export class Behavior { /** * Any internal state used by the behavior * This provides a way to interact with the outside as well as to pass data between themselves */ context: BehaviorContext; /** * Dispatched after initialization is complete * @readonly */ onInitialized: Signal; /** * Dispatched after finalization is complete * @readonly */ onFinalized: Signal; isBehavior: boolean; typeName: string; /** * Main update function. Every behavior executes some logic, some behaviors are long-running and some are instantaneous * @param {number} timeDelta time step in seconds * @returns {BehaviorStatus} signals status of the behavior, "success" or "failure" are used to signal completion of the behavior */ tick(timeDelta: number): BehaviorStatus; /** * Called before behavior gets executed via tick for the first time * Used to prepare the behavior for execution * You can think of it as "start" */ initialize(context: BehaviorContext): void; /** * Called when behavior is finished, or interrupted * Used to clean up any resources * You can think of it as "stop" */ finalize(): void; } export interface BehaviorContext { entity: Entity; } export class BehaviorModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; behaviors: Behavior[]; ids: string[]; constructor(entity: Entity, behavior?: Behavior | Behavior[]); addBehavior(behavior: Behavior, id?: string): string; addAction(func: (context: { entity: Entity; timeDelta: number; elapsed: number; [key: string]: any; }) => BehaviorStatus | void | undefined, id?: string): string; removeBehavior(behavior: Behavior): void; removeBehaviorByTypeName(typename: string): void; removeBehaviorById(id: string): void; getBehaviorById(id: string): Behavior; getBehaviors(): Behavior[]; onAppUpdate(time: Time): void; setupUiConfig(): UiObjectConfig; } /** * * @enum {number} */ export enum BehaviorStatus { Initial = 0, Running = 1, Succeeded = 2, Failed = 3, Suspended = 4, Invalid = 5 } export class BetterRaycastingPoints extends Points { isMapMode: boolean; raycast(raycaster: Raycaster, intersects: Intersection[]): void; } export class Bezier { p: number[]; constructor(p1: number, p2: number, p3: number, p4: number); genValue(t: number): number; derivativeCoefficients(points: number[]): number[][]; getSlope(t: number): number; controlCurve(d0: number, d1: number): void; hull(t: number): any[]; split(t: number): { left: Bezier; right: Bezier; span: any[]; }; clone(): Bezier; toJSON(): { p0: number; p1: number; p2: number; p3: number; }; static fromJSON(json: { p0: number; p1: number; p2: number; p3: number; }): Bezier; } class BezierCurve extends Path { shape: BezierCurveShape; constructor(opts?: BezierCurveProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): BezierCurveShape; buildPath(ctx: CanvasRenderingContext2D, shape: BezierCurveShape): void; /** * Get point at percent */ pointAt(t: number): number[]; /** * Get tangent at percent */ tangentAt(t: number): number[]; } interface BezierCurveProps extends PathProps { shape?: Partial; } class BezierCurveShape { x1: number; y1: number; x2: number; y2: number; cpx1: number; cpy1: number; cpx2?: number; cpy2?: number; percent: number; } export class BidirectionalMap { fwdMap: { [sid: string]: number; }; revMap: { [index: number]: string; }; constructor(map: { [key: string]: number; }); get(key: string): number | undefined; getByValue(value: number): string; add(sid: string, index: number): void; remove(sid: string): void; removeByValue(index: number): void; } export const Billboard: ({ object, follow, lockX, lockY, lockZ, baseOnPreRotation, }: BillboardProps) => BillboardType; /** * 实体公告板模块 */ export class BillboardModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; options: BillboardProps; billboard: BillboardType; constructor(entity: Entity, options?: BillboardProps); setupUiConfig(): UiObjectConfig; onAppUpdate(time: Time): void; } export type BillboardProps = { object?: Object3D; /** * @default true */ follow?: boolean; /** * @default false */ lockX?: boolean; /** * @default false */ lockY?: boolean; /** * @default false */ lockZ?: boolean; /** * 在原来的旋转基础上再面向相机 * @default false */ baseOnPreRotation?: boolean; }; export interface BillBoardSettings { } export type BillboardType = { object: Object3D; /** * Should called every frame to update the billboard */ update: (camera: Camera) => void; dispose: () => void; updateProps: (newProps: Partial) => void; }; const bind: FunctionBind; type Bind1 = F extends (this: Ctx, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Bind2 = F extends (this: Ctx, a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Bind3 = F extends (this: Ctx, a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Bind4 = F extends (this: Ctx, a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Bind5 = F extends (this: Ctx, a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown; /** * Given an array of member function names as strings, replace all of them * with bound versions that will always refer to `context` as `this`. This * is useful for classes where otherwise event bindings would reassign * `this` to the evented object or some other value: this lets you ensure * the `this` value always. * * @param fns list of member function names * @param context the context value * @example * function MyClass() { * bindAll(['ontimer'], this); * this.name = 'Tom'; * } * MyClass.prototype.ontimer = function() { * alert(this.name); * }; * var myClass = new MyClass(); * setTimeout(myClass.ontimer, 100); * @private */ export function bindAll(fns: string[], context: Object): void; type BindFunc = (this: Ctx, ...arg: any[]) => any; /** * Dynamically sized bit field * @constructor */ export function BitSet(): void; export namespace BitSet { var fixedSize: (x: any) => any; } /** * Convert a blob to a data url. * @param blob - blob to convert * @category Browser */ export function blobToDataURL(blob: Blob): Promise; class BlurPass { renderTargetA: WebGLRenderTarget; renderTargetB: WebGLRenderTarget; convolutionMaterial: ConvolutionMaterial; scene: Scene; camera: Camera; screen: Mesh; renderToScreen: boolean; constructor({ gl, resolution, width, height, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, }: BlurPassProps); render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget): void; } interface BlurPassProps { gl: WebGLRenderer; resolution: number; width?: number; height?: number; minDepthThreshold?: number; maxDepthThreshold?: number; depthScale?: number; depthToBlurRatioBias?: number; } /** * Base class for all body types. * @example * const shape = new CANNON.Sphere(1) * const body = new CANNON.Body({ * mass: 1, * shape, * }) * world.addBody(body) */ class Body_2 extends EventTarget_2 { static idCounter: number; /** * Dispatched after two bodies collide. This event is dispatched on each * of the two bodies involved in the collision. * @event collide * @param body The body that was involved in the collision. * @param contact The details of the collision. */ static COLLIDE_EVENT_NAME: string; /** * A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass. */ static DYNAMIC: 1; /** * A static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies. */ static STATIC: 2; /** * A kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies. */ static KINEMATIC: 4; /** * AWAKE */ static AWAKE: 0; /** * SLEEPY */ static SLEEPY: 1; /** * SLEEPING */ static SLEEPING: 2; /** * Dispatched after a sleeping body has woken up. * @event wakeup */ static wakeupEvent: { type: string; }; /** * Dispatched after a body has gone in to the sleepy state. * @event sleepy */ static sleepyEvent: { type: string; }; /** * Dispatched after a body has fallen asleep. * @event sleep */ static sleepEvent: { type: string; }; /** * Identifier of the body. */ id: number; /** * Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix. */ index: number; /** * Reference to the world the body is living in. */ world: World | null; vlambda: Vec3; /** * The collision group the body belongs to. * @default 1 */ collisionFilterGroup: number; /** * The collision group the body can collide with. * @default -1 */ collisionFilterMask: number; /** * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered. */ collisionResponse: boolean; /** * World space position of the body. */ position: Vec3; previousPosition: Vec3; /** * Interpolated position of the body. */ interpolatedPosition: Vec3; /** * Initial position of the body. */ initPosition: Vec3; /** * World space velocity of the body. */ velocity: Vec3; /** * Initial velocity of the body. */ initVelocity: Vec3; /** * Linear force on the body in world space. */ force: Vec3; /** * The mass of the body. * @default 0 */ mass: number; invMass: number; /** * The physics material of the body. It defines the body interaction with other bodies. */ material: Material_2 | null; /** * How much to damp the body velocity each step. It can go from 0 to 1. * @default 0.01 */ linearDamping: number; /** * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`. */ type: BodyType; /** * If true, the body will automatically fall to sleep. * @default true */ allowSleep: boolean; /** * Current sleep state. */ sleepState: BodySleepState; /** * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy. * @default 0.1 */ sleepSpeedLimit: number; /** * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping. * @default 1 */ sleepTimeLimit: number; timeLastSleepy: number; wakeUpAfterNarrowphase: boolean; /** * World space rotational force on the body, around center of mass. */ torque: Vec3; /** * World space orientation of the body. */ quaternion: Quaternion_2; /** * Initial quaternion of the body. */ initQuaternion: Quaternion_2; previousQuaternion: Quaternion_2; /** * Interpolated orientation of the body. */ interpolatedQuaternion: Quaternion_2; /** * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates. */ angularVelocity: Vec3; /** * Initial angular velocity of the body. */ initAngularVelocity: Vec3; /** * List of Shapes that have been added to the body. */ shapes: Shape[]; /** * Position of each Shape in the body, given in local Body space. */ shapeOffsets: Vec3[]; /** * Orientation of each Shape, given in local Body space. */ shapeOrientations: Quaternion_2[]; /** * The inertia of the body. */ inertia: Vec3; invInertia: Vec3; invInertiaWorld: Mat3; invMassSolve: number; invInertiaSolve: Vec3; invInertiaWorldSolve: Mat3; /** * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation. * @default false */ fixedRotation: boolean; /** * How much to damp the body angular velocity each step. It can go from 0 to 1. * @default 0.01 */ angularDamping: number; /** * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none. */ linearFactor: Vec3; /** * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none. */ angularFactor: Vec3; /** * World space bounding box of the body and its shapes. */ aabb: AABB; /** * Indicates if the AABB needs to be updated before use. */ aabbNeedsUpdate: boolean; /** * Total bounding radius of the Body including its shapes, relative to body.position. */ boundingRadius: number; wlambda: Vec3; /** * When true the body behaves like a trigger. It does not collide * with other bodies but collision events are still triggered. * @default false */ isTrigger: boolean; entity?: Entity; object3d?: Object3D; constructor(options?: { /** * The collision group the body belongs to. * @default 1 */ collisionFilterGroup?: number; /** * The collision group the body can collide with. * @default -1 */ collisionFilterMask?: number; /** * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered. */ collisionResponse?: boolean; /** * World space position of the body. */ position?: Vec3; /** * World space velocity of the body. */ velocity?: Vec3; /** * The mass of the body. * @default 0 */ mass?: number; /** * The physics material of the body. It defines the body interaction with other bodies. */ material?: Material_2; /** * How much to damp the body velocity each step. It can go from 0 to 1. * @default 0.01 */ linearDamping?: number; /** * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`. */ type?: BodyType; /** * If true, the body will automatically fall to sleep. * @default true */ allowSleep?: boolean; /** * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy. * @default 0.1 */ sleepSpeedLimit?: number; /** * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping. * @default 1 */ sleepTimeLimit?: number; /** * World space orientation of the body. */ quaternion?: Quaternion_2; /** * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates. */ angularVelocity?: Vec3; /** * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation. * @default false */ fixedRotation?: boolean; /** * How much to damp the body angular velocity each step. It can go from 0 to 1. * @default 0.01 */ angularDamping?: number; /** * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none. */ linearFactor?: Vec3; /** * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none. */ angularFactor?: Vec3; /** * Add a Shape to the body. */ shape?: Shape; /** * When true the body behaves like a trigger. It does not collide * with other bodies but collision events are still triggered. * @default false */ isTrigger?: boolean; }); /** * Wake the body up. */ wakeUp(): void; /** * Force body sleep */ sleep(): void; /** * Called every timestep to update internal sleep timer and change sleep state if needed. * @param time The world time in seconds */ sleepTick(time: number): void; /** * If the body is sleeping, it should be immovable / have infinite mass during solve. We solve it by having a separate "solve mass". */ updateSolveMassProperties(): void; /** * Convert a world point to local body frame. */ pointToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; /** * Convert a world vector to local body frame. */ vectorToLocalFrame(worldVector: Vec3, result?: Vec3): Vec3; /** * Convert a local body point to world frame. */ pointToWorldFrame(localPoint: Vec3, result?: Vec3): Vec3; /** * Convert a local body point to world frame. */ vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; /** * Add a shape to the body with a local offset and orientation. * @return The body object, for chainability. */ addShape(shape: Shape, _offset?: Vec3, _orientation?: Quaternion_2): Body_2; /** * Remove a shape from the body. * @return The body object, for chainability. */ removeShape(shape: Shape): Body_2; /** * Update the bounding radius of the body. Should be done if any of the shapes are changed. */ updateBoundingRadius(): void; /** * Updates the .aabb */ updateAABB(): void; /** * Update `.inertiaWorld` and `.invInertiaWorld` */ updateInertiaWorld(force?: boolean): void; /** * Apply force to a point of the body. This could for example be a point on the Body surface. * Applying force this way will add to Body.force and Body.torque. * @param force The amount of force to add. * @param relativePoint A point relative to the center of mass to apply the force on. */ applyForce(force: Vec3, relativePoint?: Vec3): void; /** * Apply force to a local point in the body. * @param force The force vector to apply, defined locally in the body frame. * @param localPoint A local point in the body to apply the force on. */ applyLocalForce(localForce: Vec3, localPoint?: Vec3): void; /** * Apply torque to the body. * @param torque The amount of torque to add. */ applyTorque(torque: Vec3): void; /** * Apply impulse to a point of the body. This could for example be a point on the Body surface. * An impulse is a force added to a body during a short period of time (impulse = force * time). * Impulses will be added to Body.velocity and Body.angularVelocity. * @param impulse The amount of impulse to add. * @param relativePoint A point relative to the center of mass to apply the force on. */ applyImpulse(impulse: Vec3, relativePoint?: Vec3): void; /** * Apply locally-defined impulse to a local point in the body. * @param force The force vector to apply, defined locally in the body frame. * @param localPoint A local point in the body to apply the force on. */ applyLocalImpulse(localImpulse: Vec3, localPoint?: Vec3): void; /** * Should be called whenever you change the body shape or mass. */ updateMassProperties(): void; /** * Get world velocity of a point in the body. * @param worldPoint * @param result * @return The result vector. */ getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3; /** * Move the body forward in time. * @param dt Time step * @param quatNormalize Set to true to normalize the body quaternion * @param quatNormalizeFast If the quaternion should be normalized using "fast" quaternion normalization */ integrate(dt: number, quatNormalize: boolean, quatNormalizeFast: boolean): void; } /** * BODY_SLEEP_STATES */ const BODY_SLEEP_STATES: { /** AWAKE */ readonly AWAKE: 0; /** SLEEPY */ readonly SLEEPY: 1; /** SLEEPING */ readonly SLEEPING: 2; }; /** * BODY_TYPES */ const BODY_TYPES: { /** DYNAMIC */ readonly DYNAMIC: 1; /** STATIC */ readonly STATIC: 2; /** KINEMATIC */ readonly KINEMATIC: 4; }; type BodyOptions = ConstructorParameters[0]; /** * BodySleepState */ type BodySleepState = typeof BODY_SLEEP_STATES[keyof typeof BODY_SLEEP_STATES]; /** * BodyType */ type BodyType = typeof BODY_TYPES[keyof typeof BODY_TYPES]; class BoundingRect { x: number; y: number; width: number; height: number; constructor(x: number, y: number, width: number, height: number); union(other: BoundingRect): void; applyTransform(m: matrix.MatrixArray): void; calculateTransform(b: RectLike): matrix.MatrixArray; intersect(b: RectLike, mtv?: PointLike): boolean; contain(x: number, y: number): boolean; clone(): BoundingRect; /** * Copy from another rect */ copy(other: RectLike): void; plain(): RectLike; /** * If not having NaN or Infinity with attributes */ isFinite(): boolean; isZero(): boolean; static create(rect: RectLike): BoundingRect; static copy(target: RectLike, source: RectLike): void; static applyTransform(target: RectLike, source: RectLike, m: matrix.MatrixArray): void; } /** * A 3d box shape. * @example * const size = 1 * const halfExtents = new CANNON.Vec3(size, size, size) * const boxShape = new CANNON.Box(halfExtents) * const boxBody = new CANNON.Body({ mass: 1, shape: boxShape }) * world.addBody(boxBody) */ class Box extends Shape { /** * The half extents of the box. */ halfExtents: Vec3; /** * Used by the contact generator to make contacts with other convex polyhedra for example. */ convexPolyhedronRepresentation: ConvexPolyhedron; constructor(halfExtents: Vec3); /** * Updates the local convex polyhedron representation used for some collisions. */ updateConvexPolyhedronRepresentation(): void; /** * Calculate the inertia of the box. */ calculateLocalInertia(mass: number, target?: Vec3): Vec3; static calculateInertia(halfExtents: Vec3, mass: number, target: Vec3): void; /** * Get the box 6 side normals * @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in. * @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame. */ getSideNormals(sixTargetVectors: Vec3[], quat: Quaternion_2): Vec3[]; /** * Returns the volume of the box. */ volume(): number; /** * updateBoundingSphereRadius */ updateBoundingSphereRadius(): void; /** * forEachWorldCorner */ forEachWorldCorner(pos: Vec3, quat: Quaternion_2, callback: (x: number, y: number, z: number) => void): void; /** * calculateWorldAABB */ calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; } export class BoxHelper extends Group_2 { lineSegs: LineSegments; object: Object3D; mesh: Mesh; options: BoxHelperOptions; box3: Box3; constructor(object: Object3D | Box3, options?: BoxHelperOptions); update(): void; setFromObject(object: Object3D): this; copy(source: any, recursive: any): this; dispose(): void; } export interface BoxHelperOptions { /** 边框线颜色 */ lineColor?: ColorRepresentation; /** 填充线颜色 */ fillColor?: ColorRepresentation; /** 填充线透明度,为零时不显示填充 */ fillOpacity?: number; /** 线材质 */ lineMaterialParam?: LineBasicMaterialParameters; /** 填充材质 */ fillMaterialParam?: MeshBasicMaterialParameters; } export type BoxParameters = { x: number; y: number; z: number; }; /** * Utility behavior that works just like an IF/ELSE statement * If you are not sure if this is the right behavior for your use-case, consider using a selector behavior instead, * as selector is a more commonly applicable behavior type */ export class BranchBehavior extends Behavior { #private; constructor(); /** * * @param {Behavior} condition * @param {Behavior} successBranch * @param {Behavior} failureBranch */ static from(condition: Behavior, successBranch?: Behavior, failureBranch?: Behavior): BranchBehavior; initialize(context: BehaviorContext): void; tick(timeDelta: number): any; finalize(): void; } /** * 呼吸的光圈. */ export class BreathingApertureMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); _createMarker(): void; private _createMakerElement; setMarkersWidth(width: number, index?: number): void; private _setBreathingApertureWidth; setDotSize(size: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; } /** * Base class for broadphase implementations * @author schteppe */ class Broadphase { /** * The world to search for collisions in. */ world: World | null; /** * If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres. */ useBoundingBoxes: boolean; /** * Set to true if the objects in the world moved. */ dirty: boolean; constructor(); /** * Get the collision pairs from the world * @param world The world to search in * @param p1 Empty array to be filled with body objects * @param p2 Empty array to be filled with body objects */ collisionPairs(world: World, p1: Body_2[], p2: Body_2[]): void; /** * Check if a body pair needs to be intersection tested at all. */ needBroadphaseCollision(bodyA: Body_2, bodyB: Body_2): boolean; /** * Check if the bounding volumes of two bodies intersect. */ intersectionTest(bodyA: Body_2, bodyB: Body_2, pairs1: Body_2[], pairs2: Body_2[]): void; /** * Check if the bounding spheres of two bodies are intersecting. * @param pairs1 bodyA is appended to this array if intersection * @param pairs2 bodyB is appended to this array if intersection */ doBoundingSphereBroadphase(bodyA: Body_2, bodyB: Body_2, pairs1: Body_2[], pairs2: Body_2[]): void; /** * Check if the bounding boxes of two bodies are intersecting. */ doBoundingBoxBroadphase(bodyA: Body_2, bodyB: Body_2, pairs1: Body_2[], pairs2: Body_2[]): void; /** * Removes duplicate pairs from the pair arrays. */ makePairsUnique(pairs1: Body_2[], pairs2: Body_2[]): void; /** * To be implemented by subcasses */ setWorld(world: World): void; /** * Check if the bounding spheres of two bodies overlap. */ static boundingSphereCheck(bodyA: Body_2, bodyB: Body_2): boolean; /** * Returns all the bodies within the AABB. */ aabbQuery(world: World, aabb: AABB, result: Body_2[]): Body_2[]; } class Brush extends Mesh { isBrush: boolean; markUpdated(): void; isDirty(): boolean; prepareGeometry(): void; disposeCacheData(): void; } export class BufferShader { width: number; height: number; common: string; outputBuffer: WebGLRenderTarget; readBuffer: WebGLRenderTarget; opacityColor?: Color; materialParameters?: MaterialParameters; uniformsDefs: string; hsbExpr: string; iChannel: (Texture | BufferShader)[]; uniforms: { iChannel0: { value: Texture; }; iChannel1: { value: Texture; }; iChannel2: { value: Texture; }; iChannel3: { value: Texture; }; }; camera: OrthographicCamera; scene: Scene; enabled: boolean; plane: Mesh; set shader(value: string); constructor(width: number, height: number, opacityColor?: Color, materialParameters?: MaterialParameters, renderTargetOptions?: RenderTargetOptions, uniformsDefs?: string, hsbExpr?: string); swap(): void; private getIChannel; render(renderer: WebGLRenderer): void; } /** * 根据传入的路线线生成Topo */ export function buildPathTubeTopo(input: { /** 路径点 */ paths: [number, number, number][]; /** 禁止该路径合并节点 默认false */ disableMergeNode?: boolean; /** 其他属性数据 */ [key: string]: any; }[], opts?: { /** 以为是同一个节点的小数位置精度默认6 */ decimalPrecision?: number; /** 建立拓扑关系策略(默认nodeIntersect) nodeIntersect 一条管道的始末节点与另一条相交时,自动把另一条拆成多段建立拓扑。nodeEqual 一条管道的始末节点与另一条管道的始末节点相等时建立拓扑,不会自动拆分 */ topoStrategy?: "nodeIntersect" | "nodeEqual"; }): { inputData: { [key: string]: any; /** 路径点 */ paths: [number, number, number][]; /** 禁止该路径合并节点 默认false */ disableMergeNode?: boolean; }[]; topo: { /** 管道数据 */ tubes: { /** 管道ID */ tubeIndex: number; /** 管道数据 */ data: Record; /** 管道开始点ID */ startNodeId: string; /** 管道结束点ID */ endNodeId: string; }[]; /** 节点数据 <节点ID, 节点相关联的管道索引数组> */ nodes: Map; }; }; /** * 根据多条多段线,建立topo * @param lines 坐标,请转成几何坐标,再传入 * @param precision 误差,小数点后几位, 以为相同, 如果两个点的坐标距离小于此值,则认为是同一个节点 * @param hasDirection 是否考虑方向 * @return {{topo: any, graph: {topologicalSort: (sourceNodes?: NodeId[], includeSourceNodes?: boolean) => NodeId[], addNode: (node: NodeId) => {topologicalSort: (sourceNodes?: NodeId[], includeSourceNodes?: boolean) => ...[], addNode: (node: NodeId) => any, lowestCommonAncestors: (node1: NodeId, node2: NodeId) => ...[], shortestPath: (source: NodeId, destination: NodeId) => ... & ..., setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => any, adjacent: (node: NodeId) => NodeId[], depthFirstSearch: (sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => ...[], hasCycle: () => boolean, getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight, serialize: () => Serialized, removeEdge: (u: NodeId, v: NodeId) => any, ...}, lowestCommonAncestors: (node1: NodeId, node2: NodeId) => NodeId[], shortestPath: (source: NodeId, destination: NodeId) => NodeId[] & {weight?: EdgeWeight}, setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => {topologicalSort: (sourceNodes?: NodeId[], includeSourceNodes?: boolean) => ...[], addNode: (node: NodeId) => any, lowestCommonAncestors: (node1: NodeId, node2: NodeId) => ...[], shortestPath: (source: NodeId, destination: NodeId) => ... & ..., setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => any, adjacent: (node: NodeId) => NodeId[], depthFirstSearch: (sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => ...[], hasCycle: () => boolean, getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight, serialize: () => Serialized, removeEdge: (u: NodeId, v: NodeId) => any, ...}, adjacent: (node: NodeId) => NodeId[], depthFirstSearch: (sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => NodeId[], hasCycle: () => boolean, getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight, serialize: () => Serialized, removeEdge: (u: NodeId, v: NodeId) => {topologicalSort: (sourceNodes?: NodeId[], includeSourceNodes?: boolean) => ...[], addNode: (node: NodeId) => any, lowestCommonAncestors: (node1: NodeId, node2: NodeId) => ...[], shortestPath: (source: NodeId, destination: NodeId) => ... & ..., setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => any, adjacent: (node: NodeId) => NodeId[], depthFirstSearch: (sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => ...[], hasCycle: () => boolean, getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight, serialize: () => Serialized, removeEdge: (u: NodeId, v: NodeId) => any, ...}, ...}}} */ export function buildTopoGraph(lines: Array<{ points: GeoPoint[]; id?: string; weight?: number; }>, precision?: number, hasDirection?: boolean): { graph: { addNode: (node: string) => any; removeNode: (node: string) => any; nodes: () => string[]; adjacent: (node: string) => string[]; addEdge: (u: string, v: string, weight?: number) => any; removeEdge: (u: string, v: string) => any; hasEdge: (u: string, v: string) => boolean; setEdgeWeight: (u: string, v: string, weight: number) => any; getEdgeWeight: (u: string, v: string) => number; indegree: (node: string) => number; outdegree: (node: string) => number; depthFirstSearch: (sourceNodes?: string[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => string[]; hasCycle: () => boolean; lowestCommonAncestors: (node1: string, node2: string) => string[]; topologicalSort: (sourceNodes?: string[], includeSourceNodes?: boolean) => string[]; shortestPath: (source: string, destination: string) => string[] & { weight?: number; }; serialize: () => Serialized; deserialize: (serialized: Serialized) => any; }; topo: any; }; type Builtin = Primitive | Function | Date | Error | RegExp; type BuiltinTextPosition = 'left' | 'right' | 'top' | 'bottom' | 'inside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideTopRight' | 'insideBottomLeft' | 'insideBottomRight'; export interface BurstParameters { time: number; count: ValueGenerator | FunctionValueGenerator; cycle: number; interval: number; probability: number; } /** * Interface representing the JSON parameters for a burst. */ export interface BurstParametersJSON { /** * The time of the burst. */ time: number; /** * The count of particles to emit, can be a number or a function. */ count: FunctionJSON | number; /** * The cycle of the burst. */ cycle: number; /** * The interval between bursts. */ interval: number; /** * The probability of the burst occurring. */ probability: number; } /** 按钮组控件 */ export class ButtonGroupControl { app: App; container: HTMLElement; style: Record; panel: HTMLElement; options: ButtonGroupControlOptions; constructor(options: ButtonGroupControlOptions); _insertControl(): void; onAdd(app: any): HTMLElement; onRemove(): void; setTheme(isLightTheme?: boolean): void; getDefaultPosition(): string; } export interface ButtonGroupControlOptions { buttons: { id: string; /** 图标 */ icon?: string; /** html (icon为空时有效)*/ html?: string; /** 提示 */ title?: string; /** 是否选中开关 */ toggle?: boolean; /** 点击事件回调 */ onclick?: Function; /** 类名 */ classList?: string[]; /** 是否选中 */ checked?: boolean; /** 圆角 */ round?: boolean; /** 样式 */ style?: Partial; }[]; direction?: "row" | "column"; lightTheme?: boolean; barSelectMode?: boolean; barCurSelectId?: string; } export class CallFunctionCommand extends BaseCommand { private target; private executeFn; private executeArgs; private undoFn?; private undoArgs?; constructor(target: T, executeFn: (this: T, ...args: any[]) => void, executeArgs: any[], undoFn?: (this: T, ...args: any[]) => void, undoArgs?: any[]); execute(): void; undo(): void; redo(): void; } export class CameraControls extends EventDispatcher { #private; static install(): void; /** * list all ACTIONs * @category Statics */ static get ACTION(): typeof ACTION; /** * Minimum vertical angle in radians. * The angle has to be between `0` and `.maxPolarAngle` inclusive. * The default value is `0`. * * e.g. * ``` * cameraControls.maxPolarAngle = 0; * ``` * @category Properties */ minPolarAngle: number; /** * Maximum vertical angle in radians. * The angle has to be between `.maxPolarAngle` and `Math.PI` inclusive. * The default value is `Math.PI`. * * e.g. * ``` * cameraControls.maxPolarAngle = Math.PI; * ``` * @category Properties */ maxPolarAngle: number; /** * Minimum horizontal angle in radians. * The angle has to be less than `.maxAzimuthAngle`. * The default value is `- Infinity`. * * e.g. * ``` * cameraControls.minAzimuthAngle = - Infinity; * ``` * @category Properties */ minAzimuthAngle: number; /** * Maximum horizontal angle in radians. * The angle has to be greater than `.minAzimuthAngle`. * The default value is `Infinity`. * * e.g. * ``` * cameraControls.maxAzimuthAngle = Infinity; * ``` * @category Properties */ maxAzimuthAngle: number; /** * Minimum distance for dolly. The value must be higher than `0`. Default is `Number.EPSILON`. * PerspectiveCamera only. * @category Properties */ minDistance: number; /** * Maximum distance for dolly. The value must be higher than `minDistance`. Default is `Infinity`. * PerspectiveCamera only. * @category Properties */ maxDistance: number; /** * `true` to enable Infinity Dolly for wheel and pinch. Use this with `minDistance` and `maxDistance` * If the Dolly distance is less (or over) than the `minDistance` (or `maxDistance`), `infinityDolly` will keep the distance and pushes the target position instead. * @category Properties */ infinityDolly: boolean; /** * Minimum camera zoom. * @category Properties */ minZoom: number; /** * Maximum camera zoom. * @category Properties */ maxZoom: number; /** * Approximate time in seconds to reach the target. A smaller value will reach the target faster. * @category Properties */ smoothTime: number; /** * the smoothTime while dragging * @category Properties */ draggingSmoothTime: number; /** * Max transition speed in unit-per-seconds * @category Properties */ maxSpeed: number; /** * Speed of azimuth (horizontal) rotation. * @category Properties */ azimuthRotateSpeed: number; /** * Speed of polar (vertical) rotation. * @category Properties */ polarRotateSpeed: number; /** * Speed of mouse-wheel dollying. * @category Properties */ dollySpeed: number; /** * `true` to invert direction when dollying or zooming via drag * @category Properties */ dollyDragInverted: boolean; /** * Speed of drag for pan and pedestal. * @category Properties */ truckSpeed: number; /** * `true` to enable Dolly-in to the mouse cursor coords. * @category Properties */ dollyToCursor: boolean; /** * @category Properties */ dragToOffset: boolean; /** * if true, pan in screen-space * @category Properties */ verticalDragToForward: boolean; /** * Friction ratio of the boundary. * @category Properties */ boundaryFriction: number; /** * Controls how soon the `rest` event fires as the camera slows. * @category Properties */ restThreshold: number; /** * An array of Meshes to collide with camera. * Be aware colliderMeshes may decrease performance. The collision test uses 4 raycasters from the camera since the near plane has 4 corners. * @category Properties */ colliderMeshes: Object3D[]; /** * User's mouse input config. * * | button to assign | behavior | * | --------------------- | -------- | * | `mouseButtons.left` | `CameraControls.ACTION.ROTATE`* \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.right` | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK`* \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.wheel` ¹ | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.middle` ² | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY`* \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * * 1. Mouse wheel event for scroll "up/down" on mac "up/down/left/right" * 2. Mouse click on wheel event "button" * - \* is the default. * - The default of `mouseButtons.wheel` is: * - `DOLLY` for Perspective camera. * - `ZOOM` for Orthographic camera, and can't set `DOLLY`. * @category Properties */ mouseButtons: MouseButtons; /** * User's touch input config. * * | fingers to assign | behavior | * | --------------------- | -------- | * | `touches.one` | `CameraControls.ACTION.TOUCH_ROTATE`* \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.DOLLY` | `CameraControls.ACTION.ZOOM` | `CameraControls.ACTION.NONE` | * | `touches.two` | `ACTION.TOUCH_DOLLY_TRUCK` \| `ACTION.TOUCH_DOLLY_OFFSET` \| `ACTION.TOUCH_DOLLY_ROTATE` \| `ACTION.TOUCH_ZOOM_TRUCK` \| `ACTION.TOUCH_ZOOM_OFFSET` \| `ACTION.TOUCH_ZOOM_ROTATE` \| `ACTION.TOUCH_DOLLY` \| `ACTION.TOUCH_ZOOM` \| `CameraControls.ACTION.TOUCH_ROTATE` \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.NONE` | * | `touches.three` | `ACTION.TOUCH_DOLLY_TRUCK` \| `ACTION.TOUCH_DOLLY_OFFSET` \| `ACTION.TOUCH_DOLLY_ROTATE` \| `ACTION.TOUCH_ZOOM_TRUCK` \| `ACTION.TOUCH_ZOOM_OFFSET` \| `ACTION.TOUCH_ZOOM_ROTATE` \| `CameraControls.ACTION.TOUCH_ROTATE` \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.NONE` | * * - \* is the default. * - The default of `touches.two` and `touches.three` is: * - `TOUCH_DOLLY_TRUCK` for Perspective camera. * - `TOUCH_ZOOM_TRUCK` for Orthographic camera, and can't set `TOUCH_DOLLY_TRUCK` and `TOUCH_DOLLY`. * @category Properties */ touches: Touches; dblClickSetToCenter: boolean; /** * Force cancel user dragging. * @category Methods */ cancel: () => void; /** * Still an experimental feature. * This could change at any time. * @category Methods */ lockPointer: () => void; /** * Still an experimental feature. * This could change at any time. * @category Methods */ unlockPointer: () => void; protected _enabled: boolean; enableWheelWhenCtrlDisabled: boolean; eventFromInputModule: boolean; protected _camera: PerspectiveCamera | OrthographicCamera; protected _yAxisUpSpace: Quaternion; protected _yAxisUpSpaceInverse: Quaternion; protected _state: ACTION; protected _domElement?: HTMLElement; protected _viewport: Vector4 | null; protected _target: Vector3; protected _targetEnd: Vector3; protected _focalOffset: Vector3; protected _focalOffsetEnd: Vector3; protected _spherical: Spherical; protected _sphericalEnd: Spherical; protected _lastDistance: number; protected _zoom: number; protected _zoomEnd: number; protected _lastZoom: number; protected _cameraUp0: Vector3; protected _target0: Vector3; protected _position0: Vector3; protected _zoom0: number; protected _focalOffset0: Vector3; protected _dollyControlCoord: Vector2; protected _changedDolly: number; protected _changedZoom: number; protected _nearPlaneCorners: [Vector3, Vector3, Vector3, Vector3]; protected _hasRested: boolean; protected _boundary: Box3; protected _boundaryEnclosesCamera: boolean; protected _needsUpdate: boolean; protected _updatedLastTime: boolean; protected _elementRect: DOMRect; protected _isDragging: boolean; protected _activePointers: PointerInput[]; protected _lockedPointer: PointerInput | null; protected _interactiveArea: DOMRect; protected _isUserControllingRotate: boolean; protected _isUserControllingDolly: boolean; protected _isUserControllingTruck: boolean; protected _isUserControllingOffset: boolean; protected _isUserControllingZoom: boolean; protected _lastDollyDirection: DOLLY_DIRECTION; protected _thetaVelocity: RefTypeValue; protected _phiVelocity: RefTypeValue; protected _radiusVelocity: RefTypeValue; protected _targetVelocity: Vector3; protected _focalOffsetVelocity: Vector3; protected _zoomVelocity: RefTypeValue; protected _targetMarker: Marker2D; app: App; /** * Creates a `CameraControls` instance. * * Note: * You **must install** three.js before using camera-controls. see [#install](#install) * Not doing so will lead to runtime errors (`undefined` references to THREE). * * e.g. * ``` * CameraControls.install( { THREE } ); * const cameraControls = new CameraControls( camera, domElement ); * ``` * * @param camera A `PerspectiveCamera` or `OrthographicCamera` to be controlled. * @param domElement A `HTMLElement` for the draggable area, usually `renderer.domElement`. * @category Constructor */ constructor(app: App, domElement?: HTMLElement, eventFromInputModule?: boolean); /** * The camera to be controlled * @category Properties */ get camera(): PerspectiveCamera | OrthographicCamera; set camera(camera: PerspectiveCamera | OrthographicCamera); /** * Whether or not the controls are enabled. * `false` to disable user dragging/touch-move, but all methods works. * @category Properties */ get enabled(): boolean; set enabled(enabled: boolean); /** * Returns `true` if the controls are active updating. * readonly value. * @category Properties */ get active(): boolean; /** * Getter for the current `ACTION`. * readonly value. * @category Properties */ get currentAction(): ACTION; /** * get/set Current distance. * @category Properties */ get distance(): number; set distance(distance: number); /** * get/set the azimuth angle (horizontal) in radians. * Every 360 degrees turn is added to `.azimuthAngle` value, which is accumulative. * @category Properties */ get azimuthAngle(): number; set azimuthAngle(azimuthAngle: number); /** * get/set the polar angle (vertical) in radians. * @category Properties */ get polarAngle(): number; set polarAngle(polarAngle: number); /** * Whether camera position should be enclosed in the boundary or not. * @category Properties */ get boundaryEnclosesCamera(): boolean; set boundaryEnclosesCamera(boundaryEnclosesCamera: boolean); /** * Set drag-start, touches and wheel enable area in the domElement. * each values are between `0` and `1` inclusive, where `0` is left/top and `1` is right/bottom of the screen. * e.g. `{ x: 0, y: 0, width: 1, height: 1 }` for entire area. * @category Properties */ set interactiveArea(interactiveArea: DOMRect | { x: number; y: number; width: number; height: number; }); /** * Adds the specified event listener. * Applicable event types (which is `K`) are: * | Event name | Timing | * | ------------------- | ------ | * | `'controlstart'` | When the user starts to control the camera via mouse / touches. ¹ | * | `'control'` | When the user controls the camera (dragging). | * | `'controlend'` | When the user ends to control the camera. ¹ | * | `'transitionstart'` | When any kind of transition starts, either user control or using a method with `enableTransition = true` | * | `'update'` | When the camera position is updated. | * | `'wake'` | When the camera starts moving. | * | `'rest'` | When the camera movement is below `.restThreshold` ². | * | `'sleep'` | When the camera end moving. | * * 1. `mouseButtons.wheel` (Mouse wheel control) does not emit `'controlstart'` and `'controlend'`. `mouseButtons.wheel` uses scroll-event internally, and scroll-event happens intermittently. That means "start" and "end" cannot be detected. * 2. Due to damping, `sleep` will usually fire a few seconds after the camera _appears_ to have stopped moving. If you want to do something (e.g. enable UI, perform another transition) at the point when the camera has stopped, you probably want the `rest` event. This can be fine tuned using the `.restThreshold` parameter. See the [Rest and Sleep Example](https://yomotsu.github.io/camera-controls/examples/rest-and-sleep.html). * * e.g. * ``` * cameraControl.addEventListener( 'controlstart', myCallbackFunction ); * ``` * @param type event name * @param listener handler function * @category Methods */ addEventListener(type: K, listener: (event: CameraControlsEventMap[K]) => any): void; /** * Removes the specified event listener * e.g. * ``` * cameraControl.addEventListener( 'controlstart', myCallbackFunction ); * ``` * @param type event name * @param listener handler function * @category Methods */ removeEventListener(type: K, listener: (event: CameraControlsEventMap[K]) => any): void; /** * Rotate azimuthal angle(horizontal) and polar angle(vertical). * Every value is added to the current value. * @param azimuthAngle Azimuth rotate angle. In radian. * @param polarAngle Polar rotate angle. In radian. * @param enableTransition Whether to move smoothly or immediately * @category Methods */ rotate(azimuthAngle: number, polarAngle: number, enableTransition?: boolean): Promise; /** * Rotate azimuthal angle(horizontal) to the given angle and keep the same polar angle(vertical) target. * * e.g. * ``` * cameraControls.rotateAzimuthTo( 30 * MathUtils.DEG2RAD, true ); * ``` * @param azimuthAngle Azimuth rotate angle. In radian. * @param enableTransition Whether to move smoothly or immediately * @category Methods */ rotateAzimuthTo(azimuthAngle: number, enableTransition?: boolean): Promise; /** * Rotate polar angle(vertical) to the given angle and keep the same azimuthal angle(horizontal) target. * * e.g. * ``` * cameraControls.rotatePolarTo( 30 * MathUtils.DEG2RAD, true ); * ``` * @param polarAngle Polar rotate angle. In radian. * @param enableTransition Whether to move smoothly or immediately * @category Methods */ rotatePolarTo(polarAngle: number, enableTransition?: boolean): Promise; /** * Rotate azimuthal angle(horizontal) and polar angle(vertical) to the given angle. * Camera view will rotate over the orbit pivot absolutely: * * azimuthAngle * ``` * 0º * \ * 90º -----+----- -90º * \ * 180º * ``` * | direction | angle | * | --------- | ---------------------- | * | front | 0º | * | left | 90º (`Math.PI / 2`) | * | right | -90º (`- Math.PI / 2`) | * | back | 180º (`Math.PI`) | * * polarAngle * ``` * 180º * | * 90º * | * 0º * ``` * | direction | angle | * | -------------------- | ---------------------- | * | top/sky | 180º (`Math.PI`) | * | horizontal from view | 90º (`Math.PI / 2`) | * | bottom/floor | 0º | * * @param azimuthAngle Azimuth rotate angle to. In radian. * @param polarAngle Polar rotate angle to. In radian. * @param enableTransition Whether to move smoothly or immediately * @category Methods */ rotateTo(azimuthAngle: number, polarAngle: number, enableTransition?: boolean): Promise; /** * Dolly in/out camera position. * @param distance Distance of dollyIn. Negative number for dollyOut. * @param enableTransition Whether to move smoothly or immediately. * @category Methods */ dolly(distance: number, enableTransition?: boolean): Promise; /** * Dolly in/out camera position to given distance. * @param distance Distance of dolly. * @param enableTransition Whether to move smoothly or immediately. * @category Methods */ dollyTo(distance: number, enableTransition?: boolean): Promise; protected _dollyToNoClamp(distance: number, enableTransition?: boolean): Promise; /** * Dolly in, but does not change the distance between the target and the camera, and moves the target position instead. * Specify a negative value for dolly out. * @param distance Distance of dolly. * @param enableTransition Whether to move smoothly or immediately. * @category Methods */ dollyInFixed(distance: number, enableTransition?: boolean): Promise; /** * Zoom in/out camera. The value is added to camera zoom. * Limits set with `.minZoom` and `.maxZoom` * @param zoomStep zoom scale * @param enableTransition Whether to move smoothly or immediately * @category Methods */ zoom(zoomStep: number, enableTransition?: boolean): Promise; /** * Zoom in/out camera to given scale. The value overwrites camera zoom. * Limits set with .minZoom and .maxZoom * @param zoom * @param enableTransition * @category Methods */ zoomTo(zoom: number, enableTransition?: boolean): Promise; /** * pan and pedestal camera using current azimuthal angle * @param x Horizontal translate amount * @param y Vertical translate amount * @param enableTransition Whether to move smoothly or immediately * @category Methods */ pan(x: number, y: number, enableTransition?: boolean): Promise; /** * Move forward / backward. * @param distance Amount to move forward / backward. Negative value to move backward * @param enableTransition Whether to move smoothly or immediately * @category Methods */ forward(distance: number, enableTransition?: boolean): Promise; /** * Move up / down. * @param height Amount to move up / down. Negative value to move down * @param enableTransition Whether to move smoothly or immediately * @category Methods */ elevate(height: number, enableTransition?: boolean): Promise; /** * Move target position to given point. * @param x x coord to move center position * @param y y coord to move center position * @param z z coord to move center position * @param enableTransition Whether to move smoothly or immediately * @category Methods */ moveTo(x: number, y: number, z: number, enableTransition?: boolean): Promise; /** * Look in the given point direction. * @param x point x. * @param y point y. * @param z point z. * @param enableTransition Whether to move smoothly or immediately. * @returns Transition end promise * @category Methods */ lookInDirectionOf(x: number, y: number, z: number, enableTransition?: boolean): Promise; /** * Fit the viewport to the box or the bounding box of the object, using the nearest axis. paddings are in unit. * set `cover: true` to fill enter screen. * e.g. * ``` * cameraControls.fitToBox( myMesh ); * ``` * @param box3OrObject Axis aligned bounding box to fit the view. * @param enableTransition Whether to move smoothly or immediately. * @param options | `` { cover: boolean, paddingTop: number, paddingLeft: number, paddingBottom: number, paddingRight: number } * @returns Transition end promise * @category Methods */ fitToBox(box3OrObject: Box3 | Object3D, enableTransition: boolean, { cover, paddingLeft, paddingRight, paddingBottom, paddingTop }?: Partial): Promise; /** * Fit the viewport to the sphere or the bounding sphere of the object. * @param sphereOrMesh * @param enableTransition * @category Methods */ fitToSphere(sphereOrMesh: Sphere | Object3D, enableTransition: boolean): Promise; fitToRect(rect: { width: number; height: number; center: [number, number, number]; normal: [number, number, number]; }): void; /** * Look at the `target` from the `position`. * @param positionX * @param positionY * @param positionZ * @param targetX * @param targetY * @param targetZ * @param enableTransition * @category Methods */ setLookAt(positionX: number, positionY: number, positionZ: number, targetX: number, targetY: number, targetZ: number, enableTransition?: boolean): Promise; /** * Similar to setLookAt, but it interpolates between two states. * @param positionAX * @param positionAY * @param positionAZ * @param targetAX * @param targetAY * @param targetAZ * @param positionBX * @param positionBY * @param positionBZ * @param targetBX * @param targetBY * @param targetBZ * @param t * @param enableTransition * @category Methods */ lerpLookAt(positionAX: number, positionAY: number, positionAZ: number, targetAX: number, targetAY: number, targetAZ: number, positionBX: number, positionBY: number, positionBZ: number, targetBX: number, targetBY: number, targetBZ: number, t: number, enableTransition?: boolean): Promise; /** * Set angle and distance by given position. * An alias of `setLookAt()`, without target change. Thus keep gazing at the current target * @param positionX * @param positionY * @param positionZ * @param enableTransition * @category Methods */ setPosition(positionX: number, positionY: number, positionZ: number, enableTransition?: boolean): Promise; /** * Set the target position where gaze at. * An alias of `setLookAt()`, without position change. Thus keep the same position. * @param targetX * @param targetY * @param targetZ * @param enableTransition * @category Methods */ setTarget(targetX: number, targetY: number, targetZ: number, enableTransition?: boolean): Promise; /** * Set focal offset using the screen parallel coordinates. z doesn't affect in Orthographic as with Dolly. * @param x * @param y * @param z * @param enableTransition * @category Methods */ setFocalOffset(x: number, y: number, z: number, enableTransition?: boolean): Promise; /** * Set orbit point without moving the camera. * SHOULD NOT RUN DURING ANIMATIONS. `setOrbitPoint()` will immediately fix the positions. * @param targetX * @param targetY * @param targetZ * @category Methods */ setOrbitPoint(targetX: number, targetY: number, targetZ: number): void; /** * Set the boundary box that encloses the target of the camera. box3 is in Box3 * @param box3 * @category Methods */ setBoundary(box3?: Box3): void; /** * Set (or unset) the current viewport. * Set this when you want to use renderer viewport and .dollyToCursor feature at the same time. * @param viewportOrX * @param y * @param width * @param height * @category Methods */ setViewport(viewportOrX: Vector4 | number | null, y: number, width: number, height: number): void; /** * Calculate the distance to fit the box. * @param width box width * @param height box height * @param depth box depth * @returns distance * @category Methods */ getDistanceToFitBox(width: number, height: number, depth: number, cover?: boolean): number; /** * Calculate the distance to fit the sphere. * @param radius sphere radius * @returns distance * @category Methods */ getDistanceToFitSphere(radius: number): number; /** * Returns the orbit center position, where the camera looking at. * @param out The receiving Vector3 instance to copy the result * @param receiveEndValue Whether receive the transition end coords or current. default is `true` * @category Methods */ getTarget(out: Vector3, receiveEndValue?: boolean): Vector3; /** * Returns the camera position. * @param out The receiving Vector3 instance to copy the result * @param receiveEndValue Whether receive the transition end coords or current. default is `true` * @category Methods */ getPosition(out: Vector3, receiveEndValue?: boolean): Vector3; /** * Returns the spherical coordinates of the orbit. * @param out The receiving Spherical instance to copy the result * @param receiveEndValue Whether receive the transition end coords or current. default is `true` * @category Methods */ getSpherical(out: Spherical, receiveEndValue?: boolean): Spherical; /** * Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates. * @param out The receiving Vector3 instance to copy the result * @param receiveEndValue Whether receive the transition end coords or current. default is `true` * @category Methods */ getFocalOffset(out: Vector3, receiveEndValue?: boolean): Vector3; /** * Normalize camera azimuth angle rotation between 0 and 360 degrees. * @category Methods */ normalizeRotations(): void; /** * Reset all rotation and position to defaults. * @param enableTransition * @category Methods */ reset(enableTransition?: boolean): Promise; /** * Set current camera position as the default position. * @category Methods */ saveState(): CameraState; /** * load current camera position */ loadState(state: CameraState, enableTransition?: boolean): void; /** * load current camera position */ loadStateAsync(state: CameraState, duration?: number, opts?: { /** id */ id?: string; /** 分类 */ tag?: string; /** easing */ easing?: Easing; /** 往返次数 */ yoyoTimes?: number; /** 重复次数 */ repeatTimes?: number; }): Promise; /** * Sync camera-up direction. * When camera-up vector is changed, `.updateCameraUp()` must be called. * @category Methods */ updateCameraUp(): void; /** * Apply current camera-up direction to the camera. * The orbit system will be re-initialized with the current position. * @category Methods */ applyCameraUp(): void; /** * Update camera position and directions. * This should be called in your tick loop every time, and returns true if re-rendering is needed. * @param delta * @returns updated * @category Methods */ update(delta: number): boolean; dispatchEvent(event: string, ...data: any): void; /** * Get all state in JSON string * @category Methods */ toJSON(): string; /** * Reproduce the control state with JSON. enableTransition is where anim or not in a boolean. * @param json * @param enableTransition * @category Methods */ fromJSON(json: string, enableTransition?: boolean): void; /** * Attach all internal event handlers to enable drag control. * @category Methods */ connect(domElement: HTMLElement): void; /** * Detach all internal event handlers to disable drag control. */ disconnect(): void; /** * Dispose the cameraControls instance itself, remove all eventListeners. * @category Methods */ dispose(): void; protected _getTargetDirection(out: Vector3): Vector3; protected _getCameraDirection(out: Vector3): Vector3; protected _findPointerById(pointerId: number): PointerInput | undefined; protected _findPointerByMouseButton(mouseButton: MOUSE_BUTTON): PointerInput | undefined; protected _disposePointer(pointer: PointerInput): void; protected _encloseToBoundary(position: Vector3, offset: Vector3, friction: number): Vector3; protected _updateNearPlaneCorners(): void; protected _truckInternal: (deltaX: number, deltaY: number, dragToOffset: boolean) => void; protected _rotateInternal: (deltaX: number, deltaY: number) => void; protected _dollyInternal: (delta: number, x: number, y: number) => void; protected _zoomInternal: (delta: number, x: number, y: number) => void; protected _collisionTest(): number; /** * Get its client rect and package into given `DOMRect` . */ protected _getClientRect(target: DOMRect): DOMRect | undefined; protected _createOnRestPromise(resolveImmediately: boolean): Promise; protected _addAllEventListeners(_domElement: HTMLElement): void; protected _removeAllEventListeners(): void; static createBoundingSphere(object3d: Object3D, out?: Sphere): Sphere; /** * 对状态进行设置,采用堆栈方案,会保存之前的状态,退出时还原之前的状态 * @param enabledControl 是否启用 默认false * @param enableWheelWhenCtrlDisabled 是否滚轮缩放 默认true * @returns */ getStatus(enabledControl?: boolean, enableWheelWhenCtrlDisabled?: boolean): { push: () => void; pop: () => void; }; /** * 相机抖动 * @param duration 每次持续时长 (ms) 默认 1000 * @param frequency 抖动频率 默认 10 * @param strength 强度 默认 1 * @param isLoop 是否循环抖动 默认 false */ shake(duration?: number, frequency?: number, strength?: number, isLoop?: boolean): { cancelShake: () => boolean; }; } interface CameraControlsEventMap { update: { type: 'update'; }; wake: { type: 'wake'; }; rest: { type: 'rest'; }; sleep: { type: 'sleep'; }; transitionstart: { type: 'transitionstart'; }; controlstart: { type: 'controlstart'; }; control: { type: 'control'; }; controlend: { type: 'controlend'; }; } /** * 通过距相机的投影平面距离获取深度z值 (需在相机远近裁剪面之间)) */ export function cameraDistance2NdcZ(camera: PerspectiveCamera, dist: number): number; export class CameraModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: CameraModuleOptions; viewHelper: ViewHelper; constructor(app?: App, options?: CameraModuleOptions); onAwake(): void; /** * 设置相机朝向 * @param position 相机位置 * @param lookAt 朝向 * @param enableTransition 启用平滑过渡 默认true */ setCameraLookAt(position: Vector3, lookAt: Vector3, enableTransition?: boolean): void; get viewHelperEnable(): boolean; set viewHelperEnable(b: boolean); onAppAfterRender(): void; updateSceneBox(): void; setupUiConfig(): UiObjectConfig; } export interface CameraModuleOptions extends CameraOptions { autoNearFar?: number | boolean; viewHelper?: { enable?: boolean; position?: "leftTop" | "rightTop" | "leftBottom" | "rightBottom"; size?: number; }; } export interface CameraOptions { fov?: number; /** 缺省 容器宽 / 容器高 */ aspect?: number; near?: number; far?: number; left?: number; right?: number; top?: number; bottom?: number; isOrthographicCamera?: boolean; /** 相机位置,不填默认 [0, 10, 10] */ position?: Vector3 | [number, number, number]; lookAt?: Vector3 | [number, number, number]; } export interface CameraState { cameraUp?: Vector3; cameraTarget: Vector3; cameraPosition: Vector3; cameraZoom?: number; cameraFocalOffset?: Vector3; } /** 得到应用的相机世界方向 */ export const cameraWorldDirection: (app?: App, camera?: Camera) => Vector3; /** * Cancelable promises extend base promises and provide a cancel functionality than can be used to cancel the execution or task of the promise. * * These type of promises can be used to prevent additional processing when the data is not longer required (e.g. HTTP request for data that is not longer necessary) */ export class CancelablePromise { onResolve: (value: any) => void; onReject: (error: any) => void; onCancel: () => void; /** * Flag to indicate if the promise has been fulfilled. * * Promise has ben fulfilled when value/error is set. */ fulfilled: boolean; /** * Flag to indicate if the promise was rejected. * * Only set when the promise is fulfilled. */ rejected: boolean; /** * Flag set true when the resolve or reject method are called. */ called: boolean; /** * Output value of the promise. * * Set with the output value if promise was fulfilled and not rejected. * * Stores the error value if the promise was rejected. */ value: T; constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void); /** * Request to cancel the promise execution. * * @returns True if the promise is canceled successfully, false otherwise. */ cancel(): boolean; /** * Executed after the promise is fulfilled. * * @param callback - Callback to receive the value. * @returns Promise for chainning. */ then(callback: (value: any) => void): CancelablePromise; /** * Catch any error that occurs in the promise. * * @param callback - Method to catch errors. * @returns Promise for chainning. */ catch(callback: (error: any) => void): CancelablePromise; /** * Finally callback * * @param callback - Method to be called. * @returns Promise for chainning. */ finally(callback: Function): CancelablePromise; /** * Create a resolved promise. * * @param val - Value to pass. * @returns Promise created with resolve value. */ static resolve(val: T): CancelablePromise; /** * Create a rejected promise. * * @param reason - Reason to reject the promise. * @returns Promise created with rejection reason. */ static reject(reason: any): CancelablePromise; /** * Wait for a set of promises to finish, creates a promise that waits for all running promises. * * If any of the promises fail it will reject altough some of them may have been completed with success. * * @param promises - List of promisses to syncronize. * @returns Promise that will resolve when all of the running promises are fullfilled. */ static all(promises: CancelablePromise[]): CancelablePromise; } export class CancelledCommandException { constructor(command: any); toString(): string; } namespace CANNON { export { AABB, ArrayCollisionMatrix, Body_2 as Body, BODY_SLEEP_STATES, BODY_TYPES, BodyOptions, BodySleepState, BodyType, Box, Broadphase, COLLISION_TYPES, CollisionType, ConeEquation, ConeTwistConstraint, ConeTwistConstraintOptions, Constraint, ConstraintOptions, ContactEquation, ContactMaterial, ContactMaterialOptions, ConvexPolyhedron, ConvexPolyhedronContactPoint, Cylinder, DistanceConstraint, Equation, EventTarget_2, FrictionEquation, GridBroadphase, GSSolver, Heightfield, HeightfieldOptions, HeightfieldPillar, HingeConstraint, HingeConstraintOptions, JacobianElement, LockConstraint, LockConstraintOptions, Mat3, Material_2 as Material, MaterialOptions, NaiveBroadphase, Narrowphase, ObjectCollisionMatrix, Octree, OctreeNode, OverlapKeeper, Particle2, Plane_2 as Plane, PointToPointConstraint, Pool, Quaternion_2 as Quaternion, Ray_2 as Ray, RAY_MODES, RaycastCallback, RaycastResult, RaycastVehicle, RaycastVehicleOptions, RayMode, RayOptions, RigidVehicle, RigidVehicleOptions, RotationalEquation, RotationalEquationOptions, RotationalMotorEquation, SAPBroadphase, Shape, SHAPE_TYPES, ShapeOptions2, ShapeType, Solver, Sphere_2 as Sphere, SPHSystem, SplitSolver, SplitSolverNode, Spring, SpringOptions, Transform, TransformOptions, Trimesh, TupleDictionary, Vec3, Vec3Pool, WheelInfo, WheelInfoOptions, WheelRaycastResult, World, WorldOptions } } export { CANNON } /** * Returns a new canvas with the image/canvas-content flipped vertically. * Useful for putImageData(as it does not respect scale and translate) and WebGL textures, which are flipped vertically. * @param canvas */ export function canvasFlipY(canvas: Exclude): HTMLCanvasElement; /** * Contains utils to handle canvas element manipulation and common canvas operations. */ export class CanvasUtils { /** * Create a offscreen canvas, used to draw content that will not be displayed using DOM. * * If OffscreenCanvas object is no available creates a regular DOM canvas object instead. * * @param width - Width of the canvas in pixels. * @param height - Height of the canvas in pixels. */ static createOffscreenCanvas(width: number, height: number): (HTMLCanvasElement | OffscreenCanvas); } type CbThis = unknown extends Ctx ? Impl : Ctx; type CbThis_2 = unknown extends Ctx ? Impl : Ctx; const CENTER: SplitStrategy; function centroid(array: number[]): number[]; export type ChangeArgs = [ChangeEvent, ...any[]] | never[]; /** * Change the emit direction of particles. */ export class ChangeEmitDirection implements Simulation { angle: ValueGenerator; type: string; _temp: Vector3; _q: Quaternion; constructor(angle: ValueGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export interface ChangeEvent { target?: UiObjectConfig; type: 'change'; last?: boolean; config?: UiObjectConfig; configPath?: UiObjectConfig[]; value?: any; } export type CharInfo = { atlasX: number; atlasY: number; width: number; height: number; yOffset: number; xAdvance: number; }; export type CharLayoutInfo = { left: number; top: number; width: number; height: number; xAdvance: number; boxTop: number; boxHeight: number; atlasX: number; atlasY: number; }; export interface ChartOptions { maxIterations?: number; straightnessWeight?: number; textureSeamWeight?: number; useInputMeshUvs?: boolean; maxChartArea?: number; normalDeviationWeight?: number; maxCost?: number; roundnessWeight?: number; maxBoundaryLength?: number; normalSeamWeight?: number; fixWinding?: boolean; } class Circle extends Path { shape: CircleShape; constructor(opts?: CircleProps); getDefaultShape(): CircleShape; buildPath(ctx: CanvasRenderingContext2D, shape: CircleShape): void; } /** * a particle emitter that emits particles from a circle. */ export class CircleEmitter implements EmitterShape { type: string; radius: number; arc: number; thickness: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; private currentValue; constructor(parameters?: CircleEmitterParameters); update(system: ParticleSystem, delta: number): void; initialize(p: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; static fromJSON(json: any): CircleEmitter; clone(): EmitterShape; } /** * Interface representing the parameters for a circle emitter. */ export interface CircleEmitterParameters { /** * The radius of the circle. */ radius?: number; /** * The arc of the circle. */ arc?: number; /** * The thickness of the ring. * 1 is a full circle, 0 is a ring with 0 radius. */ thickness?: number; /** * The mode of the emitter. * {@link EmitterMode} */ mode?: EmitterMode; /** * The length of segment of which emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ spread?: number; /** * The speed of the emitter start point travels when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ speed?: ValueGenerator | FunctionValueGenerator; } interface CircleProps extends PathProps { shape?: Partial; } class CircleShape { cx: number; cy: number; r: number; } /** 返回最小值和最大值区间的值 */ export function clamp(value: number, min: number, max: number): number; /** * Generic type for class. * @example * ```ts * interface A { * a: number * } * class B implements A { * a = 1 * } * * // Store class in variable * const c: Class = B * console.log(typeof c === Class) // true * * // Passing class to function * function f(p: Class) { * console.log(p) * } * f(B) // ok * ``` * * */ export type Class = new (...args: any[]) => T; type Class_2 = new (...args: any[]) => T; /** * Clears the bit at the given position. * @param number - the number to update * @param bitPosition - the bit position to update from the least significant bit (0) to most significant bit (31) */ export function clearBit(number: number, bitPosition: number): number; class Clip { private _life; private _delay; private _inited; private _startTime; private _pausedTime; private _paused; animation: Animation_2; loop: boolean; easing: AnimationEasing; easingFunc: (p: number) => number; next: Clip; prev: Clip; onframe: OnframeCallback; ondestroy: ondestroyCallback; onrestart: onrestartCallback; constructor(opts: ClipProps); step(globalTime: number, deltaTime: number): boolean; pause(): void; resume(): void; setEasing(easing: AnimationEasing): void; } interface ClipProps { life?: number; delay?: number; loop?: boolean; easing?: AnimationEasing; onframe?: OnframeCallback; ondestroy?: ondestroyCallback; onrestart?: onrestartCallback; } /** * Clone a new matrix. */ function clone(a: MatrixArray): MatrixArray; /** * 克隆一个向量 */ function clone_2(v: VectorArray): VectorArray; /** * Those data types can be cloned: * Plain object, Array, TypedArray, number, string, null, undefined. * Those data types will be assgined using the orginal data: * BUILTIN_OBJECT * Instance of user defined class will be cloned to a plain object, without * properties in prototype. * Other data types is not supported (not sure what will happen). * * Caution: do not support clone Date, for performance consideration. * (There might be a large number of date in `series.data`). * So date should not be modified in and out of . */ function clone_3(source: T): T; /** * Deep clone of object. * * Like `JSON.parse(JSON.stringify(obj))`, but supports basic javascript types (string, number, * object), `Date` and `RegExp`s and cycles. * * Throws error if enounters object with `prototype` assuming that in general class instances * cannot be reliably cloned by generic algorithm. */ export function cloneDeep(obj: T): T; /** * 克隆材质 * @param material */ export const cloneMaterial: (material: Mesh | Material | Material[]) => any; /** * Clone a path. */ function clonePath(sourcePath: Path, opts?: { /** * If bake global transform to path. */ bakeTransform?: boolean; /** * Convert global transform to local. */ toLocal?: boolean; }): Path; /** * 点到多段线的最近点 * @param p * @param points */ export function closestPointOnPolyline(p: GeoPoint, points: GeoPoint[]): { closestLength: number; closestPoint: GeoPoint; closestIndex: number; closestPrePointDist: number; }; /** * 点到多条线的最近点 * @param p * @param lines */ export function closestPointOnPolylines(p: GeoPoint, lines: GeoPoint[][]): { closestLength: number; closestPoint: GeoPoint; closestIndex: number; closestPointIndex: number; closestPrePointDist: number; }; /** * 点到线段的最近点 * @param p * @param p1 * @param p2 * @return {GeoPoint} */ export function closestPointOnSegment(p: GeoPoint, p1: GeoPoint, p2: GeoPoint): GeoPoint; /** * 点到3d线段的最近点 * @param p * @param p1 * @param p2 * @return {GeoPoint} */ export function closestToSegment3d(point: GeoPoint, segmentStart: GeoPoint, segmentEnd: GeoPoint): GeoPoint; type CollectionTypes = IterableCollections | WeakCollections; const COLLISION_TYPES: { sphereSphere: 1; spherePlane: 3; boxBox: 4; sphereBox: 5; planeBox: 6; convexConvex: 16; sphereConvex: 17; planeConvex: 18; boxConvex: 20; sphereHeightfield: 33; boxHeightfield: 36; convexHeightfield: 48; sphereParticle: 65; planeParticle: 66; boxParticle: 68; convexParticle: 80; cylinderCylinder: 128; sphereCylinder: 129; planeCylinder: 130; boxCylinder: 132; convexCylinder: 144; heightfieldCylinder: 160; particleCylinder: 192; sphereTrimesh: 257; planeTrimesh: 258; }; type CollisionType = typeof COLLISION_TYPES[keyof typeof COLLISION_TYPES]; /** * Color particles by their speed. */ export class ColorBySpeed implements Simulation { color: FunctionColorGenerator | MemorizedFunctionColorGenerator; speedRange: IntervalValue; type: string; constructor(color: FunctionColorGenerator | MemorizedFunctionColorGenerator, speedRange: IntervalValue); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export interface ColorGenerator { type: 'value'; genColor(color: Vector4): Vector4; toJSON(): FunctionJSON; clone(): ColorGenerator; } export function ColorGeneratorFromJSON(json: FunctionJSON): RandomColor | ColorRange | Gradient | RandomColorBetweenGradient | ConstantColor; /** * Color particles by their life. */ export class ColorOverLife implements Simulation { color: FunctionColorGenerator | MemorizedFunctionColorGenerator; type: string; constructor(color: FunctionColorGenerator | MemorizedFunctionColorGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export class ColorRange implements ColorGenerator { a: Vector4; b: Vector4; constructor(a: Vector4, b: Vector4); genColor(color: Vector4, t?: number): Vector4; type: 'value'; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): ColorRange; clone(): ColorGenerator; } /** * Creates an image data url from a color string. * @param color - color string (css compatible color) * @param width - width of the image (default: 1) * @param height - height of the image (default: 1) * @return {string} - data url */ export function colorToDataUrl(color: string, width?: number, height?: number): string; namespace colorTool { export { parse, lift, toHex, fastLerp, lerp_3 as lerp, modifyHSL, modifyAlpha, stringify, lum, random, liftColor, fastMapToColor, mapToColor } } interface CombineConfig extends ElementAnimateConfig { /** * Transform of returned will be ignored. */ dividePath?: DividePath; /** * delay of each individual. * Because individual are sorted on z-order. The index is also sorted top-left / right-down. */ individualDelay?: IndividualDelay; } /** * Make combine morphing from many paths to one. * Will return a group to replace the original path. */ function combineMorph(fromList: (CombineMorphingPath | Path)[], toPath: Path, animationOpts: CombineConfig): { fromIndividuals: Path[]; toIndividuals: any[]; count: number; }; interface CombineMorphingPath extends Path { childrenRef(): (CombineMorphingPath | Path)[]; __isCombineMorphing: boolean; } export class CommandHistory { #private; app: App; private undos; private redos; MaxHistroyLength: number; constructor(app: App); get debug(): boolean; set debug(d: boolean); clear(): void; execute(cmd: ICommand): void; executeAll(cmds: ICommand[]): void; executeMany(...cmds: ICommand[]): void; undo(): void; redo(): any; } export class CommandModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: CommandModuleOptions; constructor(app?: App, options?: CommandModuleOptions); get commandHistory(): CommandHistory; onAwake(): void; clearCommands(): void; addCommand(cmd: ICommand): void; executeCommand(cmd: ICommand): void; executeAllCommands(cmds: ICommand[]): void; addAllCommands(cmds: ICommand[]): void; executeManyCommands(...cmds: ICommand[]): void; addManyCommands(...cmds: ICommand[]): void; undo(): void; redo(): any; setupUiConfig(): UiObjectConfig; } export interface CommandModuleOptions { maxHistroyLength?: number; debugInfo?: boolean; autoListenKeyToUnRedo?: boolean; autoListenKeyToUiConfig?: boolean; } interface CommonStyleProps { shadowBlur?: number; shadowOffsetX?: number; shadowOffsetY?: number; shadowColor?: string; opacity?: number; /** * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation */ blend?: string; } /** * Abstract class */ export class CompositeBehavior extends Behavior { __children: Behavior[]; constructor(); /** * * @param {Behavior} child */ addChild(child: Behavior): void; /** * * @param {Behavior[]} children */ addChildren(children: Behavior[]): void; /** * NOTE: do not modify obtained value * @return {Behavior[]} */ getChildren(): Behavior[]; /** * * @param {Behavior} child * @returns {boolean} */ removeChild(child: Behavior): boolean; clearChildren(): void; } class CompoundPath extends Path { type: string; shape: CompoundPathShape; private _updatePathDirty; beforeBrush(): void; buildPath(ctx: PathProxy | CanvasRenderingContext2D, shape: CompoundPathShape): void; afterBrush(): void; getBoundingRect(): any; } interface CompoundPathShape { paths: Path[]; } export function computeBoundsTree(options: any): any; function computeBoundsTree_2(options?: MeshBVHOptions): MeshBVH; /** * Takes a getter function and returns a readonly reactive ref object for the * returned value from the getter. It can also take an object with get and set * functions to create a writable ref object. * * @example * ```js * // Creating a readonly computed ref: * const count = ref(1) * const plusOne = computed(() => count.value + 1) * * console.log(plusOne.value) // 2 * plusOne.value++ // error * ``` * * ```js * // Creating a writable computed ref: * const count = ref(1) * const plusOne = computed({ * get: () => count.value + 1, * set: (val) => { * count.value = val - 1 * } * }) * * plusOne.value = 1 * console.log(count.value) // 0 * ``` * * @param getter - Function that produces the next value. */ function computed(getter: ComputedGetter, debugOptions?: any): ComputedRef; function computed(options: WritableComputedOptions, debugOptions?: any): WritableComputedRef; type ComputedGetter = (...args: any[]) => T; interface ComputedRef extends WritableComputedRef { readonly value: T; [ComputedRefSymbol]: true; } const ComputedRefSymbol: unique symbol; type ComputedSetter = (v: T) => void; function computeMeshVolume(mesh: Mesh | BufferGeometry): Number; function computeMikkTSpaceTangents(geometry: BufferGeometry, MikkTSpace: unknown, negateSign?: boolean): BufferGeometry; function computeMorphedAttributes(object: Mesh | Line_2 | Points): object; function concatArray(a: ArrayLike_2, b: ArrayLike_2): ArrayLike_2; export class ConditionalBehavior extends AbstractDecoratorBehavior { condition: Behavior; constructor(); /** * * @param {Behavior} behavior */ setCondition(behavior: Behavior): void; tick(timeDelta: number): BehaviorStatus; finalize(): void; /** * * @param {Behavior} condition * @param {Behavior} source * @return {ConditionalBehavior} */ static from(condition: Behavior, source: Behavior): ConditionalBehavior; } export class ConditionBehavior extends Behavior { __accessor: Function; /** * * @param {function():boolean} accessor */ constructor(accessor: any); tick(timeDelta: number): BehaviorStatus.Succeeded | BehaviorStatus.Failed; } export class ConeEmitter implements EmitterShape { type: string; radius: number; arc: number; thickness: number; angle: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; private currentValue; constructor(parameters?: ConeEmitterParameters); update(system: ParticleSystem, delta: number): void; initialize(p: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; static fromJSON(json: ShapeJSON): ConeEmitter; clone(): EmitterShape; } /** * Interface representing the parameters for a cone emitter. */ export interface ConeEmitterParameters { /** * The radius of the cone base. */ radius?: number; /** * The arc of the cone. */ arc?: number; /** * The thickness of the cone. 1 is a full cone, 0 is a cone with 0 thickness. */ thickness?: number; /** * The angle of the cone, ranging from 0 to Math.PI / 2. */ angle?: number; /** * The mode of the emitter. * {@link EmitterMode} */ mode?: EmitterMode; /** * The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ spread?: number; /** * The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ speed?: ValueGenerator | FunctionValueGenerator; } /** * Cone equation. Works to keep the given body world vectors aligned, or tilted within a given angle from each other. */ class ConeEquation extends Equation { /** * Local axis in A */ axisA: Vec3; /** * Local axis in B */ axisB: Vec3; /** * The "cone angle" to keep */ angle: number; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * @default 1e6 */ maxForce?: number; axisA?: Vec3; axisB?: Vec3; angle?: number; }); computeB(h: number): number; } /** * A Cone Twist constraint, useful for ragdolls. */ class ConeTwistConstraint extends PointToPointConstraint { /** * The axis direction for the constraint of the body A. */ axisA: Vec3; /** * The axis direction for the constraint of the body B. */ axisB: Vec3; /** * The aperture angle of the cone. */ angle: number; /** * The twist angle of the joint. */ twistAngle: number; coneEquation: ConeEquation; twistEquation: RotationalEquation; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * The pivot point for bodyA. */ pivotA?: Vec3; /** * The pivot point for bodyB. */ pivotB?: Vec3; /** * The axis direction for the constraint of the body A. */ axisA?: Vec3; /** * The axis direction for the constraint of the body B. */ axisB?: Vec3; /** * The aperture angle of the cone. * @default 0 */ angle?: number; /** * The twist angle of the joint. * @default 0 */ twistAngle?: number; /** * The maximum force that should be applied to constrain the bodies. * @default 1e6 */ maxForce?: number; /** * Wether to collide the connected bodies or not. * @default false */ collideConnected?: boolean; }); update(): void; } type ConeTwistConstraintOptions = ConstructorParameters[2]; export interface Config { url?: string; method: keyof Methods; data?: Document | BodyInit; headers: { [key: string]: string; }; dump: (data: T) => string; load: (str: string) => T; xmlHttpRequest: () => XMLHttpRequest; promise: (fn: () => Promise) => Promise; abort?: any; params?: string[][] | Record | string | URLSearchParams; withCredentials: boolean; raw?: boolean; events?: { [key: string]: () => void; }; } export class ConstantColor implements ColorGenerator { color: Vector4; constructor(color: Vector4); genColor(color: Vector4): Vector4; type: 'value'; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): ConstantColor; clone(): ColorGenerator; } export class ConstantValue implements ValueGenerator { value: number; type: "value"; constructor(value: number); genValue(): number; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): ConstantValue; clone(): ValueGenerator; } export interface ConstInput { getValue(context: ExecutionContext): any; } /** * Constraint base class */ class Constraint { /** * Equations to be solved in this constraint. */ equations: Equation[]; /** * Body A. */ bodyA: Body_2; /** * Body B. */ bodyB: Body_2; id: number; /** * Set to false if you don't want the bodies to collide when they are connected. */ collideConnected: boolean; static idCounter: number; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * Set to false if you don't want the bodies to collide when they are connected. * @default true */ collideConnected?: boolean; /** * Set to false if you don't want the bodies to wake up when they are connected. * @default true */ wakeUpBodies?: boolean; }); /** * Update all the equations with data. */ update(): void; /** * Enables all equations in the constraint. */ enable(): void; /** * Disables all equations in the constraint. */ disable(): void; } type ConstraintOptions = ConstructorParameters[2]; export interface Constructable { new (...args: any): T; } /** * Contact/non-penetration constraint equation */ class ContactEquation extends Equation { /** * "bounciness": u1 = -e*u0 */ restitution: number; /** * World-oriented vector that goes from the center of bi to the contact point. */ ri: Vec3; /** * World-oriented vector that starts in body j position and goes to the contact point. */ rj: Vec3; /** * Contact normal, pointing out of body i. */ ni: Vec3; constructor(bodyA: Body_2, bodyB: Body_2, maxForce?: number); computeB(h: number): number; /** * Get the current relative velocity in the contact point. */ getImpactVelocityAlongNormal(): number; } /** * Defines what happens when two materials meet. * @todo Refactor materials to materialA and materialB */ class ContactMaterial { /** * Identifier of this material. */ id: number; /** * Participating materials. */ materials: [Material_2, Material_2]; /** * Friction coefficient. * @default 0.3 */ friction: number; /** * Restitution coefficient. * @default 0.3 */ restitution: number; /** * Stiffness of the produced contact equations. * @default 1e7 */ contactEquationStiffness: number; /** * Relaxation time of the produced contact equations. * @default 3 */ contactEquationRelaxation: number; /** * Stiffness of the produced friction equations. * @default 1e7 */ frictionEquationStiffness: number; /** * Relaxation time of the produced friction equations * @default 3 */ frictionEquationRelaxation: number; static idCounter: number; constructor(m1: Material_2, m2: Material_2, options: { /** * Friction coefficient. * @default 0.3 */ friction?: number; /** * Restitution coefficient. * @default 0.3 */ restitution?: number; /** * Stiffness of the produced contact equations. * @default 1e7 */ contactEquationStiffness?: number; /** * Relaxation time of the produced contact equations. * @default 3 */ contactEquationRelaxation?: number; /** * Stiffness of the produced friction equations. * @default 1e7 */ frictionEquationStiffness?: number; /** * Relaxation time of the produced friction equations * @default 3 */ frictionEquationRelaxation?: number; }); } type ContactMaterialOptions = ConstructorParameters[2]; const CONTAINED: ShapecastIntersection; /** * 是否包含骨骼 * @param object3D */ export function containSkeleton(object3D: Object3D): boolean; /** * 上下文菜单. * **/ export class ContextMenu { private options; private menuControl; private position; /** * Creates a new ContextMenu menu * @param {object} opts options which build the menu e.g. position and items * @param {number} opts.width sets the width of the menu including children * @param {object} opts.event 事件对象 * @param {theme} opts.theme 自定义的样式主题,支持dark和light,默认dark * @param {boolean} opts.isSticky sets how the menu apears, follow the mouse or sticky * @param {Array} opts.items sets the default items in the menu */ constructor(opts: ContextMenuOptions); /** * Adds item to this ContextMenu menu instance * @param {ContextMenuItem} item item to add to the ContextMenu menu */ add(item: any): void; /** * Makes this ContextMenu menu visible */ show(): void; /** * Hides this ContextMenu menu */ hide(): void; /** * Toggle visibility of menu */ toggle(): void; } /** * 上下文菜单选项. * **/ export interface ContextMenuOptions { /** 事件对象. */ event?: Event; /** 菜单宽度(包括子菜单),像素,默认150px. */ width?: string; /** 菜单主题色.(dark和light,默认dark)*/ theme?: string; /** 菜单外面容器的内部宽,用于菜单超时范围时自动调位置,默认是window大小宽 可通过 map.getContainer().getBoundingClientRect().width来设置 */ innerWidth?: number; /** 菜单外面容器的内部宽,用于菜单超时范围时自动调位置,默认是window大小高 可通过 map.getContainer().getBoundingClientRect().height来设置 */ innerHeight?: number; /** 子项 */ items: ContextMenuSubItemOptions[]; /** 弹出位置,如果不默认,则是event中的位置 . */ position?: [number, number]; } /** * 上下文菜单子项选项. * **/ export interface ContextMenuSubItemOptions { /** 子菜单类型. */ type?: "custom" | "multi" | "Button" | "seperator" | "submenu" | "hovermenu" | "normal"; /** 类型为'custom'时的自定义html内容 */ markup?: string; /** 类型为'multi'时子菜单项*/ items?: ContextMenuSubItemOptions[]; /** 点击事件*/ onClick?: Function; /** 菜单名称*/ label?: string; /** 快捷菜单*/ shortcut?: string; /** 是否能用*/ enabled?: boolean; /** css图标*/ cssIcon?: string; /** 图标 如果设置为"checked"将用默认选中图标*/ icon?: string; } class ContinuousLinearFunction | number> { keys: Array<[T, number]>; type: 'function'; subType: 'Number' | 'Vector3' | 'Vector4' | 'Color'; constructor(keys: Array<[T, number]>, subType: 'Number' | 'Vector3' | 'Vector4' | 'Color'); findKey(t: number): number; getStartX(index: number): number; getEndX(index: number): number; genValue(value: T, t: number): T; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): ContinuousLinearFunction; clone(): ContinuousLinearFunction; } class Controller { isController: boolean; object: object; property: string; callback?: Function; _defaultValue?: any; _label?: string; _type?: string; _bounds?: [number, number]; value?: any; getValue?: () => any; setValue?: (value: any, ...args: ChangeArgs) => void; hidden?: ValOrFunc; disabled?: ValOrFunc; readOnly?: ValOrFunc; tags?: ValOrArr; onClick?: (...args: any[]) => void; bounds?: ValOrFunc; stepSize?: ValOrFunc; expanded?: ValOrFunc; onExpand?: (c: UiObjectConfig) => void; inlinePicker?: ValOrFunc; children?: Array>>; constructor(object: object, property: string); onChange(callback: Function): this; on(eventName: any, callback: Function): this; defaultValue(v: any): this; label(val: string): this; name(val: string): this; type(val: string): this; options(val: any[]): this; min(min: number): this; max(max: number): this; step(step: number): this; toJson(): { type: string; label: string; property: (string | object)[]; onChange: Function; value: any; getValue: () => any; setValue: (value: any, ...args: ChangeArgs) => void; hidden: ValOrFunc; disabled: ValOrFunc; readOnly: ValOrFunc; tags: ValOrArr; onClick: (...args: any[]) => void; bounds: ValOrFunc; stepSize: ValOrFunc; expanded: ValOrFunc; onExpand: (c: UiObjectConfig) => void; inlinePicker: ValOrFunc; children: (UiObjectConfig | Fof>>)[]; }; } export interface ControlMarginOptions { /** 控件左上角时x边距,默认 0 */ posTopLeftMarginX?: number; /** 控件左上角时y边距,默认 0 */ posTopLeftMarginY?: number; /** 控件右上角时x边距,默认 0 */ posTopRightMarginX?: number; /** 控件右上角时y边距,默认 0 */ posTopRightMarginY?: number; /** 控件左下角时x边距,默认 0 */ posBottomLeftMarginX?: number; /** 控件左下角时y边距,默认 0 */ posBottomLeftMarginY?: number; /** 控件右下角时x边距,默认 0 */ posBottomRightMarginX?: number; /** 控件右下角时y边距,默认 0 */ posBottomRightMarginY?: number; } export type ControlPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right"; /** * transform * * @param {geojson|GeoPointLike|GeoPointLike[]|string} input * @returns {geojson|GeoPointLike | GeoPointLike[]} output */ function convert(input: T | string, crsFrom: ((pt: GeoPoint) => GeoPoint) | CRSTypes, crsTo?: CRSTypes): T; export const convertToMaterialParameters: (params: any, material?: any) => any; /** * A set of polygons describing a convex shape. * * The shape MUST be convex for the code to work properly. No polygons may be coplanar (contained * in the same 3D plane), instead these should be merged into one polygon. * * @author qiao / https://github.com/qiao (original author, see https://github.com/qiao/three.js/commit/85026f0c769e4000148a67d45a9e9b9c5108836f) * @author schteppe / https://github.com/schteppe * @see https://www.altdevblogaday.com/2011/05/13/contact-generation-between-3d-convex-meshes/ * * @todo Move the clipping functions to ContactGenerator? * @todo Automatically merge coplanar polygons in constructor. * @example * const convexShape = new CANNON.ConvexPolyhedron({ vertices, faces }) * const convexBody = new CANNON.Body({ mass: 1, shape: convexShape }) * world.addBody(convexBody) */ class ConvexPolyhedron extends Shape { /** vertices */ vertices: Vec3[]; /** * Array of integer arrays, indicating which vertices each face consists of */ faces: number[][]; /** faceNormals */ faceNormals: Vec3[]; /** worldVertices */ worldVertices: Vec3[]; /** worldVerticesNeedsUpdate */ worldVerticesNeedsUpdate: boolean; /** worldFaceNormals */ worldFaceNormals: Vec3[]; /** worldFaceNormalsNeedsUpdate */ worldFaceNormalsNeedsUpdate: boolean; /** * If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check. */ uniqueAxes: Vec3[] | null; /** uniqueEdges */ uniqueEdges: Vec3[]; /** * @param vertices An array of Vec3's * @param faces Array of integer arrays, describing which vertices that is included in each face. */ constructor(props?: { /** An array of Vec3's */ vertices?: Vec3[]; /** Array of integer arrays, describing which vertices that is included in each face. */ faces?: number[][]; /** normals */ normals?: Vec3[]; /** axes */ axes?: Vec3[]; /** boundingSphereRadius */ boundingSphereRadius?: number; }); /** * Computes uniqueEdges */ computeEdges(): void; /** * Compute the normals of the faces. * Will reuse existing Vec3 objects in the `faceNormals` array if they exist. */ computeNormals(): void; /** * Compute the normal of a face from its vertices */ getFaceNormal(i: number, target: Vec3): void; /** * Get face normal given 3 vertices */ static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; /** * @param minDist Clamp distance * @param result The an array of contact point objects, see clipFaceAgainstHull */ clipAgainstHull(posA: Vec3, quatA: Quaternion_2, hullB: ConvexPolyhedron, posB: Vec3, quatB: Quaternion_2, separatingNormal: Vec3, minDist: number, maxDist: number, result: ConvexPolyhedronContactPoint[]): void; /** * Find the separating axis between this hull and another * @param target The target vector to save the axis in * @return Returns false if a separation is found, else true */ findSeparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion_2, posB: Vec3, quatB: Quaternion_2, target: Vec3, faceListA?: number[] | null, faceListB?: number[] | null): boolean; /** * Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one. * @return The overlap depth, or FALSE if no penetration. */ testSepAxis(axis: Vec3, hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion_2, posB: Vec3, quatB: Quaternion_2): number | false; /** * calculateLocalInertia */ calculateLocalInertia(mass: number, target: Vec3): void; /** * @param face_i Index of the face */ getPlaneConstantOfFace(face_i: number): number; /** * Clip a face against a hull. * @param worldVertsB1 An array of Vec3 with vertices in the world frame. * @param minDist Distance clamping * @param Array result Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates. */ clipFaceAgainstHull(separatingNormal: Vec3, posA: Vec3, quatA: Quaternion_2, worldVertsB1: Vec3[], minDist: number, maxDist: number, result: ConvexPolyhedronContactPoint[]): void; /** * Clip a face in a hull against the back of a plane. * @param planeConstant The constant in the mathematical plane equation */ clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3[]; /** * Updates `.worldVertices` and sets `.worldVerticesNeedsUpdate` to false. */ computeWorldVertices(position: Vec3, quat: Quaternion_2): void; computeLocalAABB(aabbmin: Vec3, aabbmax: Vec3): void; /** * Updates `worldVertices` and sets `worldVerticesNeedsUpdate` to false. */ computeWorldFaceNormals(quat: Quaternion_2): void; /** * updateBoundingSphereRadius */ updateBoundingSphereRadius(): void; /** * calculateWorldAABB */ calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; /** * Get approximate convex volume */ volume(): number; /** * Get an average of all the vertices positions */ getAveragePointLocal(target?: Vec3): Vec3; /** * Transform all local points. Will change the .vertices */ transformAllPoints(offset: Vec3, quat: Quaternion_2): void; /** * Checks whether p is inside the polyhedra. Must be in local coords. * The point lies outside of the convex hull of the other points if and only if the direction * of all the vectors from it to those other points are on less than one half of a sphere around it. * @param p A point given in local coordinates */ pointIsInside(p: Vec3): 1 | -1 | false; /** * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis. * Results are saved in the array maxmin. * @param result result[0] and result[1] will be set to maximum and minimum, respectively. */ static project(shape: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion_2, result: number[]): void; } /** ConvexPolyhedronContactPoint */ type ConvexPolyhedronContactPoint = { point: Vec3; normal: Vec3; depth: number; }; export type ConvexPolyhedronParameters = { vertices: Float32Array; faces: number[][]; }; export class ConvolutionMaterial extends ShaderMaterial { readonly kernel: Float32Array; constructor(texelSize?: Vector2); setTexelSize(x: number, y: number): void; setResolution(resolution: Vector2): void; } export class CoordSystemModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: CoordSystemOption; constructor(app?: App, options?: CoordSystemOption); onAwake(): void; get centerOrigin(): Vector3; set centerOrigin(v: Vector3); get scaleOrigin(): number; set scaleOrigin(v: number); /** * 屏幕坐标转世界坐标(同 unproject 函数,不同的地方是他支持通过后期处理的深度进行转换,是异步执行的) * @param x 屏幕坐标x * @param y 屏幕坐标y * @param opts (false 不用场景数据, true用场景数据) "depth" 后期处理的深度进行转换, 深度值 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 * @param retIntersectObject 如果需要返回与哪个实体相交而转化的世界坐标,可传入一个object对象 */ unprojectAsync(x: number, y: number, opts?: UnProjectOpts | "depth", retIntersectObject?: {}): Promise; /** * 屏幕坐标转世界坐标 * @param x 屏幕坐标x * @param y 屏幕坐标y * @param opts (false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 * @param retIntersectObject 如果需要返回与哪个实体相交而转化的世界坐标,可传入一个object对象 */ unproject(x: number | Vector2, y?: number, opts?: UnProjectOpts, retIntersectObject?: {}): any; /** * 世界坐标转屏幕坐标 */ project(x: number | Vector3, y?: number, z?: number): Vector2; /** * 屏幕坐标转NDC坐标 */ screenToNdc(x: number | Vector2, y?: number): Vector2; /** * NDC坐标转屏幕坐标 */ ndcToScreen(x: number | Vector2, y?: number): Vector2; setupUiConfig(): UiObjectConfig; } /** * 坐标系统模块参数 */ export interface CoordSystemOption { centerOrigin?: Vector3; scaleOrigin?: number; } /** * 复制矩阵 */ function copy(out: MatrixArray, m: MatrixArray): MatrixArray; /** * 复制向量数据 */ function copy_2(out: T, v: VectorArray): T; /** * Copy properties from source to dest. Similar to Object.assign, but only copies properties that exist in source, dest and propList. * @param source - source object * @param dest - destination object * @param propList - list of properties to copy * * @category JS Object */ export function copyProps(source: Record, dest: T, propList: Array): T; /** * 创建测量标尺 */ export const creataMeasureRuler: (app: App, opts: MeasureRulerOptions) => Entity; /** * Create a identity matrix. */ function create(): MatrixArray; /** * 创建一个向量 */ function create_2(x?: number, y?: number): VectorArray; export const createAnimatorFrameSpriteMaterial: (props: SpriteMaterialParameters & AnimatorFrameMaterialProps, app: App) => SpriteMaterial; const createCanvas: () => HTMLCanvasElement; /** * Creates a HTML canvas element. * @category DOM */ export function createCanvasElement(): HTMLCanvasElement; export const createDefaultMarkerElement: (options?: { /** 对齐 */ anchor?: Anchor; /** html元素 */ element?: HTMLElement; /** 偏移像素量 */ offset?: [number, number]; /** 旋转角度(0-360) */ rotation?: number; /** 颜色 */ color?: string; /** 缩放比例 */ scale?: number; }) => HTMLElement; /** * Creates a HTML div element. * @param innerHTML - HTML string to add to the div * @param id - id of the div * @param classList - list of classes to add to the div * @param addToBody - add the div to the body * @param elementTag - tag of the element to create (default: div) * * @category DOM */ export function createDiv({ innerHTML, id, classList, addToBody, elementTag }: Partial & { id?: string; classList?: string[]; addToBody?: boolean; elementTag?: T; }): HTMLElementTagNameMap[T]; /** * 创建一个流动的渐变材质 */ export const createFlowGradientMaterial: (app: App, options: { /** 关联的物体,用来计算坐标min和max */ object?: Object3D; /** 物体坐标最小值 */ min?: Vector3; /** 物体坐标最大值 */ max?: Vector3; /** 动画线宽占整个高度的比例值(如为负数,表示是宽度绝对值,不是比例) */ lightScale?: number; /** 动画时间速度 */ circleTime?: number; /** 颜色 */ color?: ColorRepresentation; /** 透明度 */ opacity?: number; /** 动画线颜色 */ lightColor?: ColorRepresentation; /** 物体上部颜色,使用渐变时有效 */ topColor?: ColorRepresentation; /** 颜色是否随高度渐变 */ gradient?: boolean; /** 高度比例,用来计算渐变色用 */ heightScale?: number; /** 高度便宜值,用来计算渐变色用 */ heightOffset?: number; /** 透明度随高度渐变,顶部的透明度值 */ topOpacity?: number; /** 动画线数量 */ uLightCount?: number; /** 物体向上的方向轴 */ axis?: "X" | "Y" | "Z"; /** 计算物体坐标时, 是否用局部坐标 */ boxinLocalSpace?: boolean; } & MaterialParameters) => CustomShaderMaterial; export const createFlyline: (opts?: { /** 开始点位置 */ source?: [number, number, number] | Vector3; /** 目标点位置 */ target?: [number, number, number] | Vector3; /** 高度 */ height?: number; /** 粒子大小 */ size?: number; /** 颜色1 */ color: ColorRepresentation; /** 颜色2 */ color2: ColorRepresentation; /** 粒子总数 */ count?: number; /** 显示当前范围的个数 */ range?: number; /** 速度 */ speed?: number; /** 透明度 */ opacity?: number; }, app?: App) => Entity; /** * Create a Path object from path string data * http://www.w3.org/TR/SVG/paths.html#PathData * @param opts Other options */ function createFromString(str: string, opts?: SVGPathOption): SVGPath; function createHashMap(obj?: HashMap | { [key in KEY]?: T; } | KEY[]): HashMap; /** * Creates a HTML image element from a url. * @param url - url of the image * * @category DOM */ export function createImage(url: string): Promise; /** 创建一个文本 */ export const createLabel: (opts: LabelOptions) => Label; export function createMapApp(map: any, options?: AppOptions): App; function createObject(proto?: object, properties?: T): T; function createPathGetter(ctx: any, path: string): () => any; function createProjectionTask({ model, silhouette, outlines, updateProgressCb, updateVisible, ANGLE_THRESHOLD }?: any): { onUpdate: () => void; cancel: () => boolean; promise: (tm?: any) => Promise; }; /** 创建镜面反射的mesh */ export function createReflectorShaderMesh(geomerty?: TGeometry | null, materialOptions?: { /** 默认 ReflectorMaterial */ reflectorMaterialType?: "ReflectorMaterial" | "ReflectorDudvMaterial"; color?: Color; map?: Texture | string; normalMap?: Texture | string; normalScale?: Vector2; reflectivity?: number; mirror?: number; mixStrength?: number; fog?: Fog; dithering?: boolean; } & MaterialParameters, ignoreObjects?: Object3D[], includeObjects?: Object3D[]): { mesh: any; material: any; attachMesh: (mesh: Mesh, useMeshMap?: boolean) => void; detachMesh: (mesh: any) => void; }; /** * 创建2d绘图渲染材质 * @param elements 或绘制的元素,元素组或渲染对象 * @param autoCanvasSize 是否根据绘制的内容计算渲染的大小 */ export const createRender2dTexture: (opts: Render2dTextureOptions) => { texture: (param?: { copyData?: boolean; outputImageDebug?: boolean; dispose?: boolean; expandRect?: number | [number, number, number, number]; }) => Texture; update: (cb: (context: { group: render2d.Group; render: render2d.Render2dType; canvas: HTMLCanvasElement; }) => boolean) => boolean; dispatchEvent: (eventName: "mousemove" | "mouseout" | "click" | "mousedown" | "mouseup" | "mousewheel" | "dblclick" | "contextmenu", x?: number | Vector2, y?: number) => void; dispose: () => void; render: render2d.Render2dType; }; export const createRenderElementFlowMaterial: (app: App, options: RenderElementFlowMaterialOptions) => ShaderMaterial & FlowMaterialProps; /** 创建一个屏幕位置空间的实体对象 */ export const createScreenSpaceEntity: (app?: App) => { /** 实体 */ entity: Entity; /** 实体下面的组对象 */ group: Group_2; /** 屏幕像素位置转坐标 */ pixelToPosition: (pixel: any) => Vector3; /** 屏幕像素高度转长度 */ pixelHeightToLength: (pixelHeight: number) => number; /** 增加一个对象 */ addObject: (obj: Object3D, pixel?: [number, number]) => void; /** 销毁 */ dispose: () => void; }; /** * Creates a HTML script element from a url. * @param url - url of the script * @param root - root element to add the script to (default: head) * * @category DOM */ export function createScriptFromURL(url: string, root?: HTMLHeadElement): Promise; export const createSpriteAnimator: ({ startFrame, endFrame, fps, frameName, textureDataURL, textureImageURL, loop, numberOfFrames, autoPlay, animationNames, onStart, onEnd, onLoopEnd, onFrame, play, pause, flipX, alphaTest, asSprite, }: SpriteAnimatorProps) => SpriteAnimatorType; /** * Creates a HTML style element with the given styles. * @param styles - CSS string * @param root - root element to add the style to (default: head) * * @category DOM */ export function createStyles(styles: string, root?: Element | undefined): HTMLStyleElement; export const createSymbolMaterial: (props: SymbolMaterialProps) => PointsMaterial; export const createTextFlowMaterial: (app: App, options: TextFlowMaterialOptions) => ShaderMaterial & FlowMaterialProps; export const createTextMesh: ({ sdfGlyphSize, anchorX, anchorY, fontSize, ...restProps }: TextProps) => Promise; export const createUnProjectMenu: (e: MouseEvent, obj: { UnProjectOpts: UnProjectOpts | "depth"; }, opts?: { /** 菜单宽度(包括子菜单),像素,默认150px. */ width?: string; /** 菜单主题色.(dark和light,默认dark)*/ theme?: string; /** 菜单外面容器的内部宽,用于菜单超时范围时自动调位置,默认是window大小宽 可通过 map.getContainer().getBoundingClientRect().width来设置 */ innerWidth?: number; /** 菜单外面容器的内部宽,用于菜单超时范围时自动调位置,默认是window大小高 可通过 map.getContainer().getBoundingClientRect().height来设置 */ innerHeight?: number; /** 子项 */ items: ContextMenuSubItemOptions[]; /** 弹出位置,如果不默认,则是event中的位置 . */ position?: [number, number]; }, app?: App) => ContextMenu; /** 给定坐标和高度,创建一面墙的几何坐标 */ export const createWallBufferGeometry: (opts: { /** 坐标数组 */ points: [number, number][]; /** 高度 */ height: number; /** 是否闭合 */ isClose?: boolean; /** 坐标轴朝上的方向 */ axisUp?: "x" | "y" | "z"; /** 是否用中心点坐标, 默认是 */ isUseCenter?: boolean; }) => { geometry: BufferGeometry; center: [number, number, number]; }; export function createWorker(obj: Function | string, funcContext?: Record): Worker; export function createWorkerWrap(obj: Function | string, funcContext?: Record, target?: any): { worker: Worker; wrap: any; }; enum CRSTypes { WGS84 = "WGS84", WGS1984 = "WGS84", EPSG4326 = "WGS84", GCJ02 = "GCJ02", AMap = "GCJ02", BD09 = "BD09", BD09LL = "BD09", Baidu = "BD09", BMap = "BD09", BD09MC = "BD09MC", BD09Meter = "BD09MC", EPSG3857 = "EPSG3857", EPSG900913 = "EPSG3857", EPSG102100 = "EPSG3857", WebMercator = "EPSG3857", WM = "EPSG3857" } enum CSGOperation { } /** * A template literal tag that does nothing. Useful for syntax highlighting of CSS code. * * @example * ```js * const vertexShader = css` * .my-class { * color: red; * } * ` * ``` * @category Template Literals */ export const css: (strings: any, ...rest: any[]) => string; export class CSS2DRendererModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: CSS2DRendererModuleOptions; _popup2d: Popup2D; constructor(app?: App, options?: CSS2DRendererModuleOptions); get popup2d(): Popup2D; get css2dRenderer(): CSS2DRenderer; getMarker2Ds(): Marker2D[]; getPopup2Ds(): Popup2D[]; onAwake(): void; updateMarker2d(): void; onAppRender(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface CSS2DRendererModuleOptions extends CSS2DParameters { /** 刷新marker透明度防抖或节流时间毫秒,默认500 */ refreshMarkerOpacityTimeout?: number; /** 遮挡距离误差值 默认0 */ occlusionDistanceDelta?: number; /** 应用popup2d打开样式 */ popup2dStyle?: PopupOptions; /** 要关联的元素 */ parent?: HTMLElement; } export class CSS3DRendererModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: CSS3DRendererModuleOptions; constructor(app?: App, options?: CSS3DRendererModuleOptions); get css3dRenderer(): CSS3DRenderer; get css3dOccludeRenderer(): CSS3DRenderer; onAwake(): void; getMarker3Ds(): unknown[]; setCss3dObjectCanOcclude(object: CSS3DObject, canOcclude?: boolean): void; updateMarker3d(): void; onAppRender(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface CSS3DRendererModuleOptions extends CSS3DParameters { pixelRatio?: number; className?: string; style?: Partial; parent?: HTMLElement; /** 刷新marker透明度防抖或节流时间毫秒,默认500 */ refreshMarkerOpacityTimeout?: number; } export class CubeEmitter implements EmitterShape { type: string; width: number; height: number; thickness: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; emissionState: EmissionState; constructor(parameters?: CubeEmitterParameters); private currentValue; update(system: ParticleSystem, delta: number): void; initialize(p: Particle): void; toJSON(): ShapeJSON; static fromJSON(json: any): CubeEmitter; clone(): EmitterShape; } export interface CubeEmitterParameters { width?: number; height?: number; thickness?: number; mode?: EmitterMode; spread?: number; speed?: ValueGenerator | FunctionValueGenerator; emissionState?: EmissionState; } class CullableTriangle extends Triangle { initFrom(other: Triangle): void; updateSide(plane: Plane, triangle: Triangle, coplanarIndex: number): void; } function curry[0]>(func: F, a: T1): Curry1; function curry[0], T2 extends Parameters[1]>(func: F, a: T1, b: T2): Curry2; function curry[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, a: T1, b: T2, c: T3): Curry3; function curry[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, a: T1, b: T2, c: T3, d: T4): Curry4; type Curry1 = F extends (a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Curry2 = F extends (a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Curry3 = F extends (a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown; type Curry4 = F extends (a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown; type CurryFunc = (...arg: any[]) => any; /** * Creates a customized ref with explicit control over its dependency tracking * and updates triggering. * * @param factory - The function that receives the `track` and `trigger` callbacks. */ function customRef(factory: CustomRefFactory): Ref; type CustomRefFactory = (track: () => void, trigger: () => void) => { get: () => T; set: (value: T) => void; }; export class CustomShaderMaterial extends Material { uniforms: Uniform; private __csm; constructor({ baseMaterial, // fragmentShader, vertexShader, uniforms, patchMap, cacheKey, silent, ...opts }: iCSMParams); /** * * Update the material with new arguments. * TODO: Fix memory leak. * * @param opts Options to update the material with. * * @deprecated This method leaks memory. */ update(opts?: iCSMUpdateParams): void; /** * Returns a new instance of this material with the same options. * * @returns A clone of this material. */ clone(): this; /** * Internally calculates the cache key for this instance of CSM. * If no specific CSM inputs are provided, the cache key is the same as the default * cache key, i.e. `baseMaterial.onBeforeCompile.toString()`. Not meant to be called directly. * * This method is quite expensive owing to the hashing function and string manip. * * TODO: * - Optimize string manip. * - Find faster hash function * * @returns {string} A cache key for this instance of CSM. */ private _getCacheHash; /** * Does the internal shader generation. Not meant to be called directly. * * @param fragmentShader * @param vertexShader * @param uniforms */ private _generateMaterial; /** * Patches input shader with custom shader. Not meant to be called directly. * @param customShader * @param shader * @param isFrag * @returns */ private _patchShader; /** * Gets the material type as a string. Not meant to be called directly. * @returns */ private _getMaterialDefine; /** * Gets the right patch map for the material. Not meant to be called directly. * @returns */ private _getPatchMapForMaterial; } /** * Cylinder class. * @example * const radiusTop = 0.5 * const radiusBottom = 0.5 * const height = 2 * const numSegments = 12 * const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments) * const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape }) * world.addBody(cylinderBody) */ class Cylinder extends ConvexPolyhedron { /** The radius of the top of the Cylinder. */ radiusTop: number; /** The radius of the bottom of the Cylinder. */ radiusBottom: number; /** The height of the Cylinder. */ height: number; /** The number of segments to build the cylinder out of. */ numSegments: number; /** * @param radiusTop The radius of the top of the Cylinder. * @param radiusBottom The radius of the bottom of the Cylinder. * @param height The height of the Cylinder. * @param numSegments The number of segments to build the cylinder out of. */ constructor(radiusTop?: number, radiusBottom?: number, height?: number, numSegments?: number); } export type CylinderParameters = { radiusTop: number; radiusBottom: number; height: number; segments: number; }; interface Debounce { (fn: (...args: Args) => Result, timeout?: number, edge?: "leading" | "both"): (...args: Args) => Result; (fn: (...args: Args) => Result, timeout?: number, edge?: "trailing"): (...args: Args) => Result | undefined; (fn: (...args: Args) => Result, timeout?: number, edge?: "trailingPromise"): (...args: Args) => Promise; } export const debounce: Debounce; export function decryptFromBase64(str: string): string; /** * Access property in an object using a string path. Similar to lodash.get * @param access - path to access * @param tar - target object * @param throwOnInvalid - throw error if invalid access or property is undefined. Default is false * * @example * ```js * const obj = {a: {b: {c: 1}}} * const c = deepAccessObject(['a', 'b', 'c'], obj) * console.log(c) // 1 * ``` * * @category JS Object */ export function deepAccessObject(access: string | string[], tar: any, throwOnInvalid?: boolean): any; type DeepReadonly = T extends Builtin ? T : T extends Map ? ReadonlyMap, DeepReadonly> : T extends ReadonlyMap ? ReadonlyMap, DeepReadonly> : T extends WeakMap ? WeakMap, DeepReadonly> : T extends Set ? ReadonlySet> : T extends ReadonlySet ? ReadonlySet> : T extends WeakSet ? WeakSet> : T extends Promise ? Promise> : T extends Ref ? Readonly>> : T extends {} ? { readonly [K in keyof T]: DeepReadonly; } : Readonly; /** The default easing function used when no easing is specified. */ export let DEFAULT_EASING: string; type DefaultEventDefinition = Dictionary>; function defaults, S extends Dictionary>(target: T, source: S, overlay?: boolean): T & S; type DefaultTextStyle = Pick & { autoStroke?: boolean; }; export class DefaultTool extends StateNode { static id: string; static initial: string; static children: () => (typeof Idle)[]; } function deferredComputed(getter: () => T): ComputedRef; export const DEG2RAD: number; export function degToRad(degrees: number): number; class Delatin { data: number[]; width: number; height: number; coords: any[]; triangles: any[]; _halfedges: any[]; _candidates: any[]; _queueIndices: any[]; _queue: any[]; _errors: any[]; _rms: any[]; _pending: any[]; _pendingLen: number; _rmsSum: number; constructor(data: number[], width: number, height: number); run(maxError?: number): void; refine(): void; getMaxError(): any; getRMSD(): number; heightAt(x: any, y: any): number; } /** * Wait for a certain amount of time */ export class DelayBehavior extends Behavior { value: number; elapsed: number; constructor(); fromJSON({ value, elapsed }: { value: any; elapsed?: number; }): void; /** * * @param json * @return {DelayBehavior} */ static fromJSON(json: { value: number; elapsed?: number; }): DelayBehavior; /** * * @param {number} seconds in seconds * @return {DelayBehavior} */ static from(seconds: number): DelayBehavior; initialize(ctx: BehaviorContext): void; tick(timeDelta: number): BehaviorStatus.Running | BehaviorStatus.Succeeded; } export function deleteArrItem(arr: T[], item: T): void; type Dep = Set & TrackedMarkers; export class DependencyError extends Error { constructor(classInstance: any, message: any, activeModule: any, dependencyModule?: boolean); } export class DestoryBehavior extends Behavior { constructor(); static create(): DestoryBehavior; tick(timeDelta: number): BehaviorStatus; } type Dictionary = { [key: string]: T; }; const DIFFERENCE: CSGOperation; /** * 扩散的点. */ export class DiffusedApertureMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setMarkersWidth(width: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; _createMarker(): void; } /** * 对物体禁用曝光 */ export function disableBloom(object: Object3D, enable?: boolean): void; /** * 对物体禁用曝光、禁用选择、禁用选择 */ export function disableBloomSelectedRayQuery(object: Object3D, enable?: boolean, excludeObjs?: Object3D[]): void; /** * 对物体禁用描边 */ export function disableOutline(object: Object3D, enable?: boolean): void; /** * 对物体拾取时禁用射线查询 */ export function disableRayQuery(object: Object3D, enable?: boolean): void; /** * 对物体禁用选择 */ export function disableSelected(object: Object3D, enable?: boolean): void; function disableUserSelect(dom: HTMLElement): void; export class DispatchEvent { type: string; cancelBubble: boolean; data: Record; constructor(type: string); stopPropagation(): void; } /** * * @param {SignalHandler[]} handlers * @param {Array} [args] */ export function dispatchViaProxy(handlers: any, args: any): void; interface Displayable { animate(key?: '', loop?: boolean): Animator_2; animate(key: 'style', loop?: boolean): Animator_2; getState(stateName: string): DisplayableState; ensureState(stateName: string): DisplayableState; states: Dictionary; stateProxy: (stateName: string) => DisplayableState; } class Displayable extends Element_2 { /** * Whether the displayable object is visible. when it is true, the displayable object * is not drawn, but the mouse event can still trigger the object. */ invisible: boolean; z: number; z2: number; /** * The z level determines the displayable object can be drawn in which layer canvas. */ zlevel: number; /** * If enable culling */ culling: boolean; /** * Mouse cursor when hovered */ cursor: string; /** * If hover area is bounding rect */ rectHover: boolean; /** * For increamental rendering */ incremental: boolean; /** * Never increase to target size */ ignoreCoarsePointer?: boolean; style: Dictionary; protected _normalState: DisplayableState; protected _rect: BoundingRect; protected _paintRect: BoundingRect; protected _prevPaintRect: BoundingRect; dirtyRectTolerance: number; /************* Properties will be inejected in other modules. *******************/ useHoverLayer?: boolean; __hoverStyle?: CommonStyleProps; __clipPaths?: Path[]; __canvasFillGradient: CanvasGradient; __canvasStrokeGradient: CanvasGradient; __canvasFillPattern: CanvasPattern; __canvasStrokePattern: CanvasPattern; __svgEl: SVGElement; constructor(props?: Props); protected _init(props?: Props): void; beforeBrush(): void; afterBrush(): void; innerBeforeBrush(): void; innerAfterBrush(): void; shouldBePainted(viewWidth: number, viewHeight: number, considerClipPath: boolean, considerAncestors: boolean): boolean; /** * If displayable element contain coord x, y */ contain(x: number, y: number): boolean; traverse(cb: (this: Context, el: this) => void, context?: Context): void; /** * If bounding rect of element contain coord x, y */ rectContain(x: number, y: number): boolean; getPaintRect(): BoundingRect; setPrevPaintRect(paintRect: BoundingRect): void; getPrevPaintRect(): BoundingRect; /** * Alias for animate('style') * @param loop */ animateStyle(loop: boolean): Animator_2; updateDuringAnimation(targetKey: string): void; attrKV(key: DisplayableKey, value: DisplayablePropertyType): void; setStyle(obj: Props['style']): this; setStyle(obj: T, value: Props['style'][T]): this; dirtyStyle(notRedraw?: boolean): void; dirty(): void; /** * Is style changed. Used with dirtyStyle. */ styleChanged(): boolean; /** * Mark style updated. Only useful when style is used for caching. Like in the text. */ styleUpdated(): void; /** * Create a style object with default values in it's prototype. */ createStyle(obj?: Props['style']): Props["style"]; /** * Replace style property. * It will create a new style if given obj is not a valid style object. */ useStyle(obj: Props['style']): void; /** * Determine if an object is a valid style object. * Which means it is created by `createStyle.` * * A valid style object will have all default values in it's prototype. * To avoid get null/undefined values. */ isStyleObject(obj: Props['style']): any; protected _innerSaveToNormal(toState: DisplayableState): void; protected _applyStateObj(stateName: string, state: DisplayableState, normalState: DisplayableState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void; protected _mergeStates(states: DisplayableState[]): DisplayableState; protected _mergeStyle(targetStyle: CommonStyleProps, sourceStyle: CommonStyleProps): CommonStyleProps; getAnimationStyleProps(): MapToType; /** * The string value of `textPosition` needs to be calculated to a real postion. * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]` * by default. See `contain/text.js#calculateTextPosition` for more details. * But some coutom shapes like "pin", "flag" have center that is not exactly * `[width/2, height/2]`. So we provide this hook to customize the calculation * for those shapes. It will be called if the `style.textPosition` is a string. * @param out Prepared out object. If not provided, this method should * be responsible for creating one. * @param style * @param rect {x, y, width, height} * @return out The same as the input out. * { * x: number. mandatory. * y: number. mandatory. * textAlign: string. optional. use style.textAlign by default. * textVerticalAlign: string. optional. use style.textVerticalAlign by default. * } */ protected static initDefaultProps: void; } type DisplayableKey = keyof DisplayableProps; type DisplayablePropertyType = PropType; interface DisplayableProps extends ElementProps { style?: Dictionary; zlevel?: number; z?: number; z2?: number; culling?: boolean; cursor?: string; rectHover?: boolean; progressive?: boolean; incremental?: boolean; ignoreCoarsePointer?: boolean; batch?: boolean; invisible?: boolean; } type DisplayableState = Pick & ElementCommonState; type DisplayableStatePropNames = ElementStatePropNames | 'style' | 'z' | 'z2' | 'invisible'; /** * Dispose render2d instance */ function dispose(zr: Render2D): void; /** * Dispose all render2d instances */ function disposeAll(): void; export function disposeBoundsTree(): void; function disposeBoundsTree_2(): void; /** * 销毁材质 * @param material */ export const disposeMaterial: (material: Mesh | Material | Material[]) => any; /** * 销毁物体对象 * @param object3D */ export function disposeObject3D(object3D: Object3D): boolean; const dist: typeof distance; /** 两个点之间的二维距离 */ export function dist2d(coord1: [number, number], coord2: [number, number]): number; /** * 计算向量间距离 */ function distance(v1: VectorArray, v2: VectorArray): number; /** * Constrains two bodies to be at a constant distance from each others center of mass. */ class DistanceConstraint extends Constraint { /** * The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB */ distance: number; distanceEquation: ContactEquation; /** * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB. * @param maxForce The maximum force that should be applied to constrain the bodies. */ constructor(bodyA: Body_2, bodyB: Body_2, distance?: number, maxForce?: number); /** * update */ update(): void; } /** * 向量距离平方 */ function distanceSquare(v1: VectorArray, v2: VectorArray): number; const distSquare: typeof distanceSquare; /** * 向量除法 */ function div(out: T, v1: VectorArray, v2: VectorArray): T; interface DividePath { (params: DividePathParams): Path[]; } interface DividePathParams { path: Path; count: number; } const DOLLY_DIRECTION: { readonly NONE: 0; readonly IN: 1; readonly OUT: -1; }; type DOLLY_DIRECTION = typeof DOLLY_DIRECTION[keyof typeof DOLLY_DIRECTION]; export class DOM { static create(tagName: string, className?: string, container?: HTMLElement): HTMLElement; static createNS(namespaceURI: string, tagName: string): Element; static isMobile(): boolean; static setTransform(el: HTMLElement, value: string): void; static remove(node: HTMLElement): void; /** 通过html和css内容创建div */ static createStyledDiv(htmlContent: string, cssString?: string): HTMLDivElement; } type DoneCallback = () => void; export class DonutEmitter implements EmitterShape { type: string; radius: number; donutRadius: number; arc: number; thickness: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; constructor(parameters?: DonutEmitterParameters); private currentValue; update(system: ParticleSystem, delta: number): void; initialize(p: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; static fromJSON(json: any): DonutEmitter; clone(): EmitterShape; } /** * Interface representing the parameters for a donut emitter. */ export interface DonutEmitterParameters { /** * The radius of the donut. */ radius?: number; /** * The arc of the donut. */ arc?: number; /** * The thickness of the ring. 1 is a full donut, 0 is a ring with 0 radius. */ thickness?: number; /** * The radius of the hole in the center of the donut. */ donutRadius?: number; /** * The mode of the emitter. * {@link EmitterMode} */ mode?: EmitterMode; /** * The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ spread?: number; /** * The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ speed?: ValueGenerator | FunctionValueGenerator; } /** * 向量点乘 */ function dot(v1: VectorArray, v2: VectorArray): number; /** * Download a blob as a file in the browser. * @param b - blob to download * @param name - name of the file * @category Browser */ export function downloadBlob(b: Blob | string, name: string, options?: BlobPropertyBag): void; /** * Download a file in the browser. * @param b - file to download * @param name - name of the file (optional) * @category Browser */ export function downloadFile(b: File, name?: string): void; class DrawLine extends StateNode { #private; static id: string; polylines: PolylinesEntity; data: PolylineItemData; drawOptions?: Record; highLightSymbolEntity: SymbolEntity; snapSymbolEntity: SymbolEntity; snapSymbolData: SymbolItemData[]; onPointerUp: (info: TLEventHandler) => Promise; onPointerMove: (info: TLEventHandler) => Promise; onMouseDblClick: (info: TLEventHandler) => void; onKeyUp: (info: TLEventHandler) => void; onContextMenu: (info: TLEventHandler) => ContextMenu; onEnter: (info: any) => void; onExit: (info: TLEventType, from: string) => void; complete(isDblClick?: boolean): void; } class DrawPoint extends StateNode { #private; static id: string; symbol: SymbolEntity; data: SymbolItemData; drawOptions?: Record; highLightSymbolEntity: SymbolEntity; snapSymbolEntity: SymbolEntity; snapSymbolData: SymbolItemData[]; onPointerUp: (info: TLEventHandler) => Promise; onPointerMove: (info: TLEventHandler) => Promise; onKeyUp: (info: TLEventHandler) => void; onContextMenu: (info: TLEventHandler) => ContextMenu; onEnter: (info: any) => void; onExit: (info: TLEventType, from: string) => void; complete(isDblClick?: boolean): void; } class DrawPolygon extends StateNode { #private; static id: string; polygons: PolygonsEntity; polyEdge: PolylinesEntity; data: PolygonItemData; drawOptions?: Record; highLightSymbolEntity: SymbolEntity; snapSymbolEntity: SymbolEntity; snapSymbolData: SymbolItemData[]; onPointerUp: (info: TLEventHandler) => Promise; onPointerMove: (info: TLEventHandler) => Promise; onMouseDblClick: (info: TLEventHandler) => void; onKeyUp: (info: TLEventHandler) => void; onContextMenu: (info: TLEventHandler) => ContextMenu; onEnter: (info: any) => void; onExit: (info: TLEventType, from: string) => void; complete(isDblClick?: boolean): void; } export class DrawShapeTool extends StateNode { static id: string; static initial: string; static children: () => (typeof DrawLine | typeof DrawPoint | typeof DrawPolygon | typeof Edit | typeof Idle_2)[]; onExit: () => void; } class Droplet extends Path { shape: DropletShape; constructor(opts?: DropletProps); getDefaultShape(): DropletShape; buildPath(ctx: CanvasRenderingContext2D, shape: DropletShape): void; } interface DropletProps extends PathProps { shape?: Partial; } class DropletShape { cx: number; cy: number; width: number; height: number; } export interface DynamicEnvConfig { envmap1: Texture; envmap2: Texture; } /** 动态环境切换 */ export class DynamicEnvironment { #private; app: App; fbo: any; material: ShaderMaterial; quad: FullScreenQuad; constructor(app: App, config?: Partial); dispose(): void; update(): void; get texture(): any; setWeight(value: number): void; setIntensity(value: number): void; lerpWeight(value: number, duration: number): void; lerpIntensity(value: number, duration: number): void; } export class DynamicInstancedMesh extends InstancedMesh { maxCapacity: number; constructor(geometry: any, material: any, count: any); addInstance(matrix4: any, color: any, computeBoundingSphere?: boolean): number; removeInstance(i: any, computeBoundingSphere?: boolean): boolean; } /** * 数组或对象遍历 */ function each | any[] | readonly any[] | ArrayLike_2, Context>(arr: I, cb: (this: Context, value: I extends (infer T)[] | readonly (infer T)[] | ArrayLike_2 ? T : I extends Dictionary ? I extends Record ? T : unknown : unknown, index?: I extends any[] | readonly any[] | ArrayLike_2 ? number : keyof I & string, // keyof Dictionary will return number | string arr?: I) => void, context?: Context): void; /** Type representing an easing type, which can be either a predefined easing function or a custom easing function. */ export type Easing = keyof Easings | EasingFunction | 'linear' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInQuint' | 'easeOutQuint' | 'easeInOutQuint' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc' | 'easeInBack' | 'easeOutBack' | 'easeInOutBack' | 'easeInElastic' | 'easeOutElastic' | 'easeInOutElastic' | 'easeInBounce' | 'easeOutBounce' | 'easeInOutBounce'; type easingFunc = (percent: number) => number; const easingFuncs: { /** * @param {number} k * @return {number} */ linear(k: number): number; /** * @param {number} k * @return {number} */ quadraticIn(k: number): number; /** * @param {number} k * @return {number} */ quadraticOut(k: number): number; /** * @param {number} k * @return {number} */ quadraticInOut(k: number): number; /** * @param {number} k * @return {number} */ cubicIn(k: number): number; /** * @param {number} k * @return {number} */ cubicOut(k: number): number; /** * @param {number} k * @return {number} */ cubicInOut(k: number): number; /** * @param {number} k * @return {number} */ quarticIn(k: number): number; /** * @param {number} k * @return {number} */ quarticOut(k: number): number; /** * @param {number} k * @return {number} */ quarticInOut(k: number): number; /** * @param {number} k * @return {number} */ quinticIn(k: number): number; /** * @param {number} k * @return {number} */ quinticOut(k: number): number; /** * @param {number} k * @return {number} */ quinticInOut(k: number): number; /** * @param {number} k * @return {number} */ sinusoidalIn(k: number): number; /** * @param {number} k * @return {number} */ sinusoidalOut(k: number): number; /** * @param {number} k * @return {number} */ sinusoidalInOut(k: number): number; /** * @param {number} k * @return {number} */ exponentialIn(k: number): number; /** * @param {number} k * @return {number} */ exponentialOut(k: number): number; /** * @param {number} k * @return {number} */ exponentialInOut(k: number): number; /** * @param {number} k * @return {number} */ circularIn(k: number): number; /** * @param {number} k * @return {number} */ circularOut(k: number): number; /** * @param {number} k * @return {number} */ circularInOut(k: number): number; /** * @param {number} k * @return {number} */ elasticIn(k: number): number; /** * @param {number} k * @return {number} */ elasticOut(k: number): number; /** * @param {number} k * @return {number} */ elasticInOut(k: number): number; /** * @param {number} k * @return {number} */ backIn(k: number): number; /** * @param {number} k * @return {number} */ backOut(k: number): number; /** * @param {number} k * @return {number} */ backInOut(k: number): number; /** * @param {number} k * @return {number} */ bounceIn(k: number): number; /** * @param {number} k * @return {number} */ bounceOut(k: number): number; /** * @param {number} k * @return {number} */ bounceInOut(k: number): number; }; /** Type representing an easing function that takes a single numeric parameter and returns a numeric result. */ export type EasingFunction = (x: number) => number; /** * Class that provides various easing functions for tweening animations. * For more info on these easing functions, check https://easings.net. */ export class Easings { static linear(x: number): number; static easeInSine(x: number): number; static easeOutSine(x: number): number; static easeInOutSine(x: number): number; static easeInQuad(x: number): number; static easeOutQuad(x: number): number; static easeInOutQuad(x: number): number; static easeInCubic(x: number): number; static easeOutCubic(x: number): number; static easeInOutCubic(x: number): number; static easeInQuart(x: number): number; static easeOutQuart(x: number): number; static easeInOutQuart(x: number): number; static easeInQuint(x: number): number; static easeOutQuint(x: number): number; static easeInOutQuint(x: number): number; static easeInExpo(x: number): number; static easeOutExpo(x: number): number; static easeInOutExpo(x: number): number; static easeInCirc(x: number): number; static easeOutCirc(x: number): number; static easeInOutCirc(x: number): number; static easeInBack(x: number): number; static easeOutBack(x: number): number; static easeInOutBack(x: number): number; static easeInElastic(x: number): number; static easeOutElastic(x: number): number; static easeInOutElastic(x: number): number; static easeInBounce(x: number): number; static easeOutBounce(x: number): number; static easeInOutBounce(x: number): number; } class EdgesHelper extends LineSegments { constructor(edges?: Line3[]); setEdges(edges: Line3[]): void; } type EdgeWeight = number; class Edit extends StateNode { #private; static id: string; editOptions?: Record; queryEntities(info: TLEventHandler, ents?: Entity[]): InteractiveObject; onPointerDown: (info: TLEventHandler) => void; onPointerMove: (info: TLEventHandler) => void; onKeyUp: (info: TLEventHandler) => void; onContextMenu: (info: TLEventHandler) => void; complete(delay?: boolean): void; onPointerUp: (info: TLEventHandler) => void; onMouseDblClick: (info: TLEventHandler) => void; onEnter: (info: TLEventType) => void; clearSelection(isGotoChildEdit?: boolean): void; onExit: (info: TLEventType, from: string) => void; } /** * Registers the given function to track reactive updates. * * The given function will be run once immediately. Every time any reactive * property that's accessed within it gets updated, the function will run again. * * @param fn - The function that will track reactive updates. * @param options - Allows to control the effect's behaviour. * @returns A runner that can be used to control the effect after creation. */ function effect(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner; type EffectScheduler = (...args: any[]) => any; class EffectScope { detached: boolean; constructor(detached?: boolean); get active(): boolean; run(fn: () => T): T | undefined; stop(fromParent?: boolean): void; } /** * Creates an effect scope object which can capture the reactive effects (i.e. * computed and watchers) created within it so that these effects can be * disposed together. For detailed use cases of this API, please consult its * * @param detached - Can be used to create a "detached" effect scope. */ function effectScope(detached?: boolean): EffectScope; interface Element_2 extends Transformable, Eventful<{ [key in ElementEventName]: (e: ElementEvent) => void | boolean; } & { [key in string]: (...args: any) => void | boolean; }>, ElementEventHandlerProps { } class Element_2 { id: number; /** * Element type */ type: string; /** * Element name */ name: string; /** * If ignore drawing and events of the element object */ ignore: boolean; /** * Whether to respond to mouse events. */ silent: boolean; /** * 是否是 Group */ isGroup: boolean; /** * Whether it can be dragged. */ draggable: boolean | 'horizontal' | 'vertical'; /** * Whether is it dragging. */ dragging: boolean; parent: Group; animators: Animator_2[]; /** * If ignore clip from it's parent or hosts. * Applied on itself and all it's children. * * NOTE: It won't affect the clipPath set on the children. */ ignoreClip: boolean; /** * If element is used as a component of other element. */ __hostTarget: Element_2; /** * Render2D instance will be assigned when element is associated with render2d */ __zr: Render2dType; /** * Dirty bits. * From which painter will determine if this displayable object needs brush. */ __dirty: number; /** * If element was painted on the screen */ __isRendered: boolean; /** * If element has been moved to the hover layer. * * If so, dirty will only trigger the render2d refresh hover layer */ __inHover: boolean; /** * path to clip the elements and its children, if it is a group. * @see http://www.w3.org/TR/2dcontext/#clipping-region */ private _clipPath?; /** * Attached text element. * `position`, `style.textAlign`, `style.textVerticalAlign` * of element will be ignored if textContent.position is set */ private _textContent?; /** * Text guide line. */ private _textGuide?; /** * Config of textContent. Inlcuding layout, color, ...etc. */ textConfig?: ElementTextConfig; /** * Config for guide line calculating. * * NOTE: This is just a property signature. READ and WRITE are all done in . */ textGuideLineConfig?: ElementTextGuideLineConfig; /** * Id for mapping animation */ anid: string; extra: Dictionary; currentStates?: string[]; prevStates?: string[]; /** * Store of element state. * '__normal__' key is preserved for default properties. */ states: Dictionary; /** * Animation config applied on state switching. */ stateTransition: ElementAnimateConfig; /** * Proxy function for getting state with given stateName. * Render2D will first try to get with stateProxy. Then find from states if stateProxy returns nothing * * targetStates will be given in useStates */ stateProxy?: (stateName: string, targetStates?: string[]) => ElementState; protected _normalState: ElementState; private _innerTextDefaultStyle; constructor(props?: Props); protected _init(props?: Props): void; /** * Drift element * @param {number} dx dx on the global space * @param {number} dy dy on the global space */ drift(dx: number, dy: number, e?: ElementEvent): void; /** * Hook before update */ beforeUpdate(): void; /** * Hook after update */ afterUpdate(): void; /** * Update each frame */ update(): void; updateInnerText(forceUpdate?: boolean): void; protected canBeInsideText(): boolean; protected getInsideTextFill(): string | undefined; protected getInsideTextStroke(textFill: string): string | undefined; protected getOutsideFill(): string | undefined; protected getOutsideStroke(textFill: string): string; traverse(cb: (this: Context, el: Element_2) => void, context?: Context): void; protected attrKV(key: string, value: unknown): void; /** * Hide the element */ hide(): void; /** * Show the element */ show(): void; attr(keyOrObj: Props): this; attr(keyOrObj: T, value: Props[T]): this; saveCurrentToNormalState(toState: ElementState): void; protected _innerSaveToNormal(toState: ElementState): void; protected _savePrimaryToNormal(toState: Dictionary, normalState: Dictionary, primaryKeys: readonly string[]): void; /** * If has any state. */ hasState(): boolean; /** * Get state object */ getState(name: string): ElementState; /** * Ensure state exists. If not, will create one and return. */ ensureState(name: string): ElementState; /** * Clear all states. */ clearStates(noAnimation?: boolean): void; /** * Use state. State is a collection of properties. * Will return current state object if state exists and stateName has been changed. * * @param stateName State name to be switched to * @param keepCurrentState If keep current states. * If not, it will inherit from the normal state. */ useState(stateName: string, keepCurrentStates?: boolean, noAnimation?: boolean, forceUseHoverLayer?: boolean): any; /** * Apply multiple states. * @param states States list. */ useStates(states: string[], noAnimation?: boolean, forceUseHoverLayer?: boolean): void; /** * Return if el.silent or any ancestor element has silent true. */ isSilent(): boolean; /** * Update animation targets when reference is changed. */ private _updateAnimationTargets; /** * Remove state * @param state State to remove */ removeState(state: string): void; /** * Replace exists state. * @param oldState * @param newState * @param forceAdd If still add when even if replaced target not exists. */ replaceState(oldState: string, newState: string, forceAdd: boolean): void; /** * Toogle state. */ toggleState(state: string, enable: boolean): void; protected _mergeStates(states: ElementState[]): ElementState; protected _applyStateObj(stateName: string, state: ElementState, normalState: ElementState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void; /** * Component is some elements attached on this element for specific purpose. * Like clipPath, textContent */ private _attachComponent; private _detachComponent; /** * Get clip path */ getClipPath(): Path; /** * Set clip path * * clipPath can't be shared between two elements. */ setClipPath(clipPath: Path): void; /** * Remove clip path */ removeClipPath(): void; /** * Get attached text content. */ getTextContent(): ZRText; /** * Attach text on element */ setTextContent(textEl: ZRText): void; /** * Set layout of attached text. Will merge with the previous. */ setTextConfig(cfg: ElementTextConfig): void; /** * Remove text config */ removeTextConfig(): void; /** * Remove attached text element. */ removeTextContent(): void; getTextGuideLine(): Polyline; setTextGuideLine(guideLine: Polyline): void; removeTextGuideLine(): void; /** * Mark element needs to be repainted */ markRedraw(): void; /** * Besides marking elements to be refreshed. * It will also invalid all cache and doing recalculate next frame. */ dirty(): void; private _toggleHoverLayerFlag; /** * Add self from render2d instance. * Not recursively because it will be invoked when element added to storage. */ addSelfToZr(zr: Render2dType): void; /** * Remove self from render2d instance. * Not recursively because it will be invoked when element added to storage. */ removeSelfFromZr(zr: Render2dType): void; /** * 动画 * * @param path The key to fetch value from object. Mostly style or shape. * @param loop Whether to loop animation. * @param allowDiscreteAnimation Whether to allow discrete animation * @example: * el.animate('style', false) * .when(1000, {x: 10} ) * .done(function(){ // Animation done }) * .start() */ animate(key?: string, loop?: boolean, allowDiscreteAnimation?: boolean): Animator_2; addAnimator(animator: Animator_2, key: string): void; updateDuringAnimation(key: string): void; /** * 停止动画 * @param {boolean} forwardToLast If move to last frame before stop */ stopAnimation(scope?: string, forwardToLast?: boolean): this; /** * @param animationProps A map to specify which property to animate. If not specified, will animate all. * @example * // Animate position * el.animateTo({ * position: [10, 10] * }, { done: () => { // done } }) * * // Animate shape, style and position in 100ms, delayed 100ms, with cubicOut easing * el.animateTo({ * shape: { * width: 500 * }, * style: { * fill: 'red' * } * position: [10, 10] * }, { * duration: 100, * delay: 100, * easing: 'cubicOut', * done: () => { // done } * }) */ animateTo(target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType): void; /** * Animate from the target state to current state. * The params and the value are the same as `this.animateTo`. */ animateFrom(target: Props, cfg: ElementAnimateConfig, animationProps?: MapToType): void; protected _transitionState(stateName: string, target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType): void; /** * Interface of getting the minimum bounding box. */ getBoundingRect(): BoundingRect; getPaintRect(): BoundingRect; /** * The string value of `textPosition` needs to be calculated to a real postion. * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]` * by default. See `contain/text.js#calculateTextPosition` for more details. * But some coutom shapes like "pin", "flag" have center that is not exactly * `[width/2, height/2]`. So we provide this hook to customize the calculation * for those shapes. It will be called if the `style.textPosition` is a string. * @param {Obejct} [out] Prepared out object. If not provided, this method should * be responsible for creating one. * @param {module:render2d/graphic/Style} style * @param {Object} rect {x, y, width, height} * @return {Obejct} out The same as the input out. * { * x: number. mandatory. * y: number. mandatory. * align: string. optional. use style.textAlign by default. * verticalAlign: string. optional. use style.textVerticalAlign by default. * } */ calculateTextPosition: ElementCalculateTextPosition; protected static initDefaultProps: void; } interface ElementAnimateConfig { duration?: number; delay?: number; easing?: AnimationEasing; during?: (percent: number) => void; done?: Function; aborted?: Function; scope?: string; /** * If force animate * Prevent stop animation and callback * immediently when target values are the same as current values. */ force?: boolean; /** * If use additive animation. */ additive?: boolean; /** * If set to final state before animation started. * It can be useful if something you want to calcuate depends on the final state of element. * Like bounding rect for text layouting. * * Only available in animateTo */ setToFinal?: boolean; } type ElementCalculateTextPosition = (out: TextPositionCalculationResult, style: ElementTextConfig, rect: RectLike) => TextPositionCalculationResult; type ElementCommonState = { hoverLayer?: boolean; }; interface ElementEvent { type: ElementEventName; event: ZRRawEvent; target: Element_2; topTarget: Element_2; cancelBubble: boolean; offsetX: number; offsetY: number; gestureEvent: string; pinchX: number; pinchY: number; pinchScale: number; wheelDelta: number; zrByTouch: boolean; which: number; stop: (this: ElementEvent) => void; } type ElementEventCallback = (this: CbThis, e: ElementEvent) => boolean | void; interface ElementEventHandlerProps { onclick: ElementEventCallback; ondblclick: ElementEventCallback; onmouseover: ElementEventCallback; onmouseout: ElementEventCallback; onmousemove: ElementEventCallback; onmousewheel: ElementEventCallback; onmousedown: ElementEventCallback; onmouseup: ElementEventCallback; oncontextmenu: ElementEventCallback; ondrag: ElementEventCallback; ondragstart: ElementEventCallback; ondragend: ElementEventCallback; ondragenter: ElementEventCallback; ondragleave: ElementEventCallback; ondragover: ElementEventCallback; ondrop: ElementEventCallback; } type ElementEventName = 'click' | 'dblclick' | 'mousewheel' | 'mouseout' | 'mouseover' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu' | 'drag' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'drop' | 'globalout'; interface ElementProps extends Partial, Partial> { name?: string; ignore?: boolean; isGroup?: boolean; draggable?: boolean | 'horizontal' | 'vertical'; silent?: boolean; ignoreClip?: boolean; globalScaleRatio?: number; textConfig?: ElementTextConfig; textContent?: ZRText; clipPath?: Path; drift?: Element_2['drift']; extra?: Dictionary; anid?: string; } type ElementSSRData = zrUtil.HashMap; type ElementSSRDataGetter = (el: Element_2) => zrUtil.HashMap; type ElementState = Pick & ElementCommonState; type ElementStatePropNames = (typeof PRIMARY_STATES_KEYS)[number] | 'textConfig'; interface ElementTextConfig { /** * Position relative to the element bounding rect * @default 'inside' */ position?: BuiltinTextPosition | (number | string)[]; /** * Rotation of the label. */ rotation?: number; /** * Rect that text will be positioned. * Default to be the rect of element. */ layoutRect?: RectLike; /** * Offset of the label. * The difference of offset and position is that it will be applied * in the rotation */ offset?: number[]; /** * Origin or rotation. Which is relative to the bounding box of the attached element. * Can be percent value. Relative to the bounding box. * If specified center. It will be center of the bounding box. * * Only available when position and rotation are both set. */ origin?: (number | string)[] | 'center'; /** * Distance to the rect * @default 5 */ distance?: number; /** * If use local user space. Which will apply host's transform * @default false */ local?: boolean; /** * `insideFill` is a color string or left empty. * If a `textContent` is "inside", its final `fill` will be picked by this priority: * `textContent.style.fill` > `textConfig.insideFill` > "auto-calculated-fill" * In most cases, "auto-calculated-fill" is white. */ insideFill?: string; /** * `insideStroke` is a color string or left empty. * If a `textContent` is "inside", its final `stroke` will be picked by this priority: * `textContent.style.stroke` > `textConfig.insideStroke` > "auto-calculated-stroke" * * The rule of getting "auto-calculated-stroke": * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`) * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`) * "auto-calculated-stroke" will be null. * Otherwise, "auto-calculated-stroke" will be the same as `fill` of this element if possible, or null. * * The reason of (A) is not decisive: * 1. If users specify `fill` in style and still use "auto-calculated-stroke", the effect * is not good and unexpected in some cases. It not easy and seams uncessary to auto calculate * a proper `stroke` for the given `fill`, since they can specify `stroke` themselve. * 2. Backward compat. */ insideStroke?: string; /** * `outsideFill` is a color string or left empty. * If a `textContent` is "inside", its final `fill` will be picked by this priority: * `textContent.style.fill` > `textConfig.outsideFill` > #000 */ outsideFill?: string; /** * `outsideStroke` is a color string or left empth. * If a `textContent` is not "inside", its final `stroke` will be picked by this priority: * `textContent.style.stroke` > `textConfig.outsideStroke` > "auto-calculated-stroke" * * The rule of getting "auto-calculated-stroke": * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`) * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`) * "auto-calculated-stroke" will be null. * Otherwise, "auto-calculated-stroke" will be a neer white color to distinguish "front end" * label with messy background (like other text label, line or other graphic). */ outsideStroke?: string; /** * Tell render2d I can sure this text is inside or not. * In case position is not using builtin `inside` hints. */ inside?: boolean; } interface ElementTextGuideLineConfig { /** * Anchor for text guide line. * Notice: Won't work */ anchor?: Point; /** * If above the target element. */ showAbove?: boolean; /** * Candidates of connectors. Used when autoCalculate is true and anchor is not specified. */ candidates?: ('left' | 'top' | 'right' | 'bottom')[]; } class Ellipse extends Path { shape: EllipseShape; constructor(opts?: EllipseProps); getDefaultShape(): EllipseShape; buildPath(ctx: CanvasRenderingContext2D, shape: EllipseShape): void; } interface EllipseProps extends PathProps { shape?: Partial; } class EllipseShape { cx: number; cy: number; rx: number; ry: number; } /** * Find all URLs in svg, download them and replace with the URL in svg with the downloaded data URLs. * @param str - string * @param downloader - function to download the URLs in svg and return the data URL * * @category HTML To Image */ export function embedUrlRefs(str: string, downloader?: (p: string) => Promise): Promise; export interface EmissionState { burstIndex: number; burstWaveIndex: number; burstParticleIndex: number; burstParticleCount: number; isBursting: boolean; time: number; waitEmiting: number; travelDistance: number; previousWorldPos?: Vector3; } interface EmissionState_2 { time: number; } /** * Emit a sub particle system from particles. */ export class EmitSubParticleSystem implements Simulation { private particleSystem; useVelocityAsBasis: boolean; subParticleSystem: ParticleEmitter | undefined; mode: SubParticleEmitMode; emitProbability: number; type: string; private q_; private v_; private v2_; private subEmissions; constructor(particleSystem: ParticleSystem, useVelocityAsBasis: boolean, subParticleSystem: ParticleEmitter | undefined, mode?: SubParticleEmitMode, emitProbability?: number); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; private emit; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any, particleSystem: ParticleSystem): Simulation; clone(): Simulation; reset(): void; private setMatrixFromParticle; } export function EmitterFromJSON(json: ShapeJSON, meta: JsonMetaData): EmitterShape; /** * Enum representing the emitter modes for particles. */ export enum EmitterMode { /** * Emit particles randomly over the specified duration. */ Random = 0, /** * Emit particles in a continuous loop. */ Loop = 1, /** * Emit particles back and forth in a ping-pong manner. */ PingPong = 2, /** * Emit particles in bursts. */ Burst = 3 } export interface EmitterShape { type: string; initialize(particle: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; update(system: ParticleSystem, delta: number): void; clone(): EmitterShape; } export interface EmitterShapeParticlePlugin { type: string; constructor: Constructable; params: ParameterPair[]; loadJSON: (json: any, meta: JsonMetaData) => EmitterShape; } export const EmitterShapes: { [key: string]: EmitterShapeParticlePlugin; }; /** * 能使材质使用顶点透明度属性 * @param material */ export const enableMaterialVerticeOpacity: (material: Material) => void; /** 开启真实渲染 */ export const enableRealisticRender: (renderer: WebGLRenderer) => void; /** 开启阴影 */ export const enableShadow: (renderer: WebGLRenderer) => void; /** 开启sRGB颜色空间 */ export const enableSRGBColorSpace: (renderer: WebGLRenderer) => void; /** * Re-enables effect tracking (if it was paused). */ function enableTracking(): void; export function encryptToBase64(str: string): string; export class Entity extends EntityBase { #private; static defaultModules: Array; /** * 实体类型 */ entityType: string; isEntity: boolean; _node: Object3D; _pointerEventsRef: Ref; options: EntityOptions; _childrens: Entity[]; _ownerScene?: Scene; _sceneData?: Record; _boxHelperObject: BoxHelper; /** 位置响应式对象 */ _positionRef: Vector3; /** 旋转响应式对象 */ _rotationRef: Euler; /** 四元数响应式对象 */ _quaternionRef: Quaternion; /** 缩放响应式对象 */ _scaleRef: Vector3; /** 本地矩阵响应式对象 */ _matrixRef: Matrix4; /** 世界矩阵响应式对象 */ _matrixWorldRef: Matrix4; /** 可视响应式对象 */ _visualRef: Ref; /** 是否选中 */ _selectedRef: Ref; /** 是否描边效果 */ _outlineRef: Ref; /** 是否辉光 */ _bloomRef: Ref; /** 是否显示包围盒 */ _boxHelperRef: Ref; /** 拾取时是否遍历子对象 默认为true*/ _rayIntersectRecursive?: boolean; /** 射线查询类型 默认为1*/ _rayQueryType?: RayQueryType; /** 是否已销毁*/ _isDisposed?: boolean; /** 拾取时实体对象,默认为entity.node */ rayIntersectObject?: Object3D; signal: { onBeforeAdd: Signal; onAdd: Signal; onBeforeRemove: Signal; onRemove: Signal; onRayIntersect: Signal; onMouseUp: Signal; onMouseMove: Signal; onMouseDown: Signal; onMouseClick: Signal; onMouseDblClick: Signal; onMouseOver: Signal; onMouseOut: Signal; onMouseEnter: Signal; onMouseLeave: Signal; onPointerDown: Signal; onPointerMove: Signal; onPointerUp: Signal; /** 鼠标直接按下松开,没有拖动 */ onPointerDownUp: Signal; onPointerCancel: Signal; onMouseWheel: Signal; onKeyDown: Signal; onKeyUp: Signal; }; constructor(options?: EntityOptions); /** 创建一个新的实体对象 */ static create(options?: EntityOptions): Entity; /** 基于模块创建一个新的实体对象 */ static fromModule(mod: EntityModuleConstructor | Array, options?: any): Entity; /** 通过一个或多个object3d对象创建一个实体 */ static fromObject3d: (objs: Object3D | Object3D[]) => Entity; /** 通过一个或多个object3d对象和模块创建一个实体 */ static fromObjectModule: (objs: Object3D | Object3D[], mod: EntityModuleConstructor | Array, options?: any) => Entity; /** * 通过一个obejct获取所属的实体 * @param object 物体对象 * @param canChildEntity 是否获取到子实体。默认false. false的话表示获取的是最上级的实体对象。true获取的是所属的子实体对象 */ static getOwerEntity(object: Object3D, canChildEntity?: boolean): Entity | undefined; get isDisposed(): boolean; get visibleRef(): Ref; get visible(): boolean; set visible(val: boolean); get selectedRef(): Ref; get selected(): boolean; set selected(val: boolean); get bloomRef(): Ref; get bloom(): boolean; set bloom(val: boolean); get outlineRef(): Ref; get outline(): boolean; set outline(val: boolean); get boxHelperRef(): Ref; get boxHelper(): boolean | BoxHelperOptions; set boxHelper(val: boolean | BoxHelperOptions); get castShadow(): boolean; set castShadow(val: boolean); get receiveShadow(): boolean; set receiveShadow(val: boolean); get frustumCulled(): boolean; set frustumCulled(val: boolean); get position(): Vector3; get scale(): Vector3; get rotation(): Euler; get quaternion(): Quaternion; get matrix(): Matrix4; get matrixWorld(): Matrix4; get parent(): Entity | undefined; set parent(val: Entity | undefined); get pointerEvents(): boolean; get pointerEventsRef(): Ref; set pointerEvents(b: boolean); get node(): Object3D; set node(obj: Object3D); get rayIntersectRecursive(): boolean; set rayIntersectRecursive(b: boolean); get rayQueryType(): RayQueryType; set rayQueryType(b: RayQueryType); onEntityAwake(callback: (app: App) => void): void; tween(id?: string): Tween; addObjects(objs: Object3D | Object3D[]): void; removeObjects(objs: Object3D | Object3D[]): void; addChildEntity(ent: Entity): void; removeChildEntity(ent: Entity): void; addTo(target?: App | Entity | Object3D, app?: App): this; /** * 给一个已加入场景中的对象关联一个实体 * @param obj 已加入场景中的对象 * @param splitSubEntity 是否把子对象拆成子实体 (默认false) * @param overwriteEntity 当有关联的实体时,重新再生成一个实体相关联 (默认false) * @param app 应用对象,默认用当前的 * @returns */ static attchObject(obj: Object3D, splitSubEntity?: boolean, overwriteEntity?: boolean, app?: App): Entity; remove(): void; get childrens(): Entity[]; set childrens(child: Entity[]); traverse(callback: (ent: Entity) => any, filter?: (ent: Entity) => boolean): void; traverseVisible(callback: (ent: Entity) => any, filter?: (ent: Entity) => boolean): void; getObjectByName(name: string): Object3D; getObjectById(id: string): Object3D; getObjectByUuid(uuid: string): Object3D; getObjectsByName(name: string): Object3D[]; getObjectByProperty(name: string, value: string): Object3D; getObjectsByProperty(name: string, value: string): Object3D[]; getEntityByName(name: string): Entity; getEntityById(id: string): Entity; getEntityByUuid(uuid: string): Entity; getMeshEntityByProperty(name: string, value: string): MeshEntity | undefined; getMeshEntityByName(name: string): MeshEntity | undefined; getMeshEntityById(id: string): MeshEntity | undefined; getMeshEntityByUuid(uuid: string): MeshEntity | undefined; getEntitiesByName(name: string): Entity[]; getEntityByProperty(name: string, value: string): Entity; getEntitiesByProperty(name: string, value: string): Entity[]; getObjectPropertyValueCount(name: string): Map; getEntitiesByModule(module: EntityModuleConstructor | EntityModuleConstructor[]): Entity[]; /** 判断实体是否是mesh实体或包含mesh实体模块 */ isLikeMeshEntity(): boolean; /** 获取所有Mesh实体 */ getMeshEntities(): MeshEntity[]; /** 获取所有叶子实体 */ getLeafEntities(): Entity[]; /** 获取有事件的所有字实体 */ getPointerEventsEntities(leafEventNode?: boolean): Entity[]; /** * 增加模型边框线 * @param option * @param isHideMesh 是否隐藏mesh本身(默认false) */ addEdges(option?: LineBasicMaterialParameters, isHideMesh?: boolean): void; /** * 移除模型边框线 */ clearEdges(): void; /** * 替换材质 */ replaceMaterial(material: Material | Material[]): void; /** * 恢复材质 */ resetMaterial(): void; /** * 是否高亮 */ isHighlight(): boolean; /** * 设置高亮 */ setHighlight(color?: ColorRepresentation, opacity?: number): void; /** * 清除高亮 */ clearHighlight(): void; /** * 设置透明度 * @param opacity 透明度0(完全透明)-1(不透明) * @param isAccOpacity 是否累加透明度(ture和之前透明度相乘,false直接设置透明度) */ setOpacity(opacity: number, isAccOpacity?: boolean): void; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件。默认false不再触发 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; /** * 获取物体的外包盒 * @param inLocalSpace 局部空间 * @param mapModeSceneSpace 地图模式下返回场景空间坐标 */ getBoundingBox(inLocalSpace?: boolean, mapModeSceneSpace?: boolean): Box3; /** * 增加一个自定义动作脚本 * @param func 脚本函数 * @param id 脚本id */ addAction(func: (context: { entity: Entity; timeDelta: number; elapsed: number; [key: string]: any; }) => BehaviorStatus | void | undefined, id?: string): () => void; /** * 移除一个自定义动作脚本 * @param id 脚本id */ removeAction(id: string): void; /** * 增加一个自定义动画动作脚本 * @param func 脚本函数 * @param id 脚本id */ addAnimationAction(opts: { /** 持续时长 */ duration: number; /** easing 默认 linear */ easing?: Easing; /** 是否往返循环 */ yoyoForever?: boolean; /** 往返次数 */ yoyoTimes?: number; /** 重复循环 */ repeatForever?: boolean; /** 重复次数 */ repeatTimes?: number; /** 延迟时长 */ delay?: number; }, func: (context: { entity: Entity; alpha: number; reversed: boolean; isComplete: boolean; isEnd: boolean; isStop: boolean; [key: string]: any; }) => void, id?: string): { stop: () => void; animation: typeof animation; }; toJSON(): any; static fromJSON(json: Record, objects: Map): Entity; setupUiConfig(): any; } export class EntityBase extends AppObject implements IEntityModuleBase { #private; options: EntityBaseOptions; uuid: string; readonly moduleManager: ModuleManager; constructor(options?: EntityBaseOptions); get modules(): EntityModuleBase[]; /** * 增加模块,如果模块已存在,则返回之前的模型,等同于this.add(xxx) * @param type 模块类 * @param params 参数 */ addModule(type: new (entity?: any, obj?: U) => T, params?: U): T; /** * 增加模块,如果模块已存在,则返回之前的模型,等同于this.addModule(xxx) */ add(type: new (entity?: any, obj?: U) => T, params?: U): T; /** * 获取模块 * @param type 模型类型 * @returns */ getModule(type: new (entity?: any, obj?: U) => T): T; /** * 移除模块 * @param type 模型类型 * @returns */ removeModule(type: new (entity?: any, obj?: U) => T): void; /** * 移除所有模块 * @returns */ removeAllModules(): void; /** * 调用模块中的函数 * @returns */ callModules(methodName: string, ...args: any): void; } export interface EntityBaseOptions { app?: App; parent?: EntityBase; } export class EntityManagerModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; selectObjects: ShallowReactive; bloomObjects: ShallowReactive; outlineObjects: ShallowReactive; constructor(app?: App); getEntities(): Entity[]; getRayQueryEntities(): any[]; onAwake(): void; onAppAddEntity(ent: Entity): void; onAppRemoveEntity(ent: Entity): void; addSelectedEntity(ent: Entity): void; removeSelectEntity(ent: Entity): void; getSelectObjects(): ShallowReactive[]>; getSelectObjectsRef(): ShallowReactive[]>; addBloomEntity(ent: Entity): void; removeBloomEntity(ent: Entity): void; getBloomObjects(): ShallowReactive[]>; getBloomObjectsRef(): ShallowReactive[]>; addOutlineEntity(ent: Entity): void; removeOutlineEntity(ent: Entity): void; getOutlineObjects(): ShallowReactive[]>; getOutlineObjectsRef(): ShallowReactive[]>; setSelectBoomRefreshFlag(): void; onAppBeforeUpdate(): void; setupUiConfig(): UiObjectConfig; } export class EntityModuleBase extends ModuleBase { entity: Entity; constructor(entity: Entity); } export type EntityModuleConstructor = new (obj: any) => EntityModuleBase; export interface EntityOptions extends EntityBaseOptions { node?: Object3D; pointerEvents?: boolean; parent?: EntityBase; modules?: Array; object3ds?: Object3D | Object3D[]; } /** * 实体选中描边模块,默认为地图模式有效。如果需要自定义不同的颜色,可在实体自定义数据中设置 ent.data._outline_config = {...} */ export class EntityOutlineModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: EntityOutlineModuleOptions; constructor(app?: App, options?: EntityOutlineModuleOptions); onAwake(): void; } export interface EntityOutlineModuleOptions extends OutlinesProps { enable?: boolean; } export class EntityQueryModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; constructor(app?: App); /** * 获取查询的射线对象 */ getQueryRaycaster(): Raycaster; onAwake(): void; /** * 通过相机查询实体 */ queryEntitiesByCamera(option?: EntityQueryOption): InteractiveObject; /** * 通过射线查询实体 */ queryEntitiesByRaycast(ray: Ray, option?: EntityQueryOption): InteractiveObject; /** * 通过屏幕像素坐标查询实体 */ queryEntitiesByScreenPos(x: number, y: number, option?: EntityQueryOption): InteractiveObject; /** * 通过框选查询实体 */ queryEntitiesByBox(startPoint: Vector3, endPoint: Vector3, option?: EntityQueryOption, deep?: number): InteractiveObject[]; /** * 通过屏幕坐标获取射线 */ getRayByScreenPos(x: number, y: number, camera?: Camera): Ray; } /** * 查询实体参数 */ export interface EntityQueryOption { entities?: Entity[]; filter?: (ent: Entity) => boolean; camera?: Camera; raycasterParameters?: RaycasterParameters; } export interface EnvConfigOption { /** 取消选中模式(默认clickOtherPosition) none 不主动取消,需要调用代码取消选中; clickOtherPosition 点击其他位置(不在此实体上面时)取消选中; clickOtherEntity 点击选中其他实体时,取消选中 */ cancelSelectMode?: "none" | "clickOtherPosition" | "clickOtherEntity"; /** 取消高亮模式(默认clickOtherPosition) none 不主动取消,需要调用代码取消高亮; clickOtherPosition 点击其他位置(不在此实体上面时)取消高亮; clickOtherEntity 点击选中其他实体时,取消高亮 */ cancelHighlight?: "none" | "clickOtherPosition" | "clickOtherEntity"; /** 高亮颜色 */ highlightColor?: ColorRepresentation; /** 高亮透明度 */ highlightOpacity?: number; /** 弹出框默认背景色 */ popupBackgroundColor?: string; /** 弹出框默认关闭按钮颜色 */ popupButtonColor?: string; /** 包围盒显示设置 */ boxHelper?: BoxHelperOptions; /** 切换场景有动画 */ activeScreenEnableTransition?: boolean; /** 场景退出时模糊时间(毫秒) */ sceneExitBlurTime?: number; /** unProject屏幕坐标转世界坐标时,如果投影方式为undefined时,按不同的快捷键切换不同的投影方式 键值为键组合,如 "ShiftLeft + KeyR" , "none"表示无按键默认处理情况 */ unProjectOptions?: Record; } /** 环境贴图类 */ export class Environment { #private; fbo: any; cubeCamera: any; virtualScene: any; ignoreObjects: any; app: App; constructor(app: any, config?: { resolution?: number; near?: number; far?: number; scene?: Scene | Object3D[]; renderOptions?: RenderTargetOptions; textureType: TextureDataType; ignoreObjects?: Object3D[]; }); pause(): void; start(): void; update(): void; add(obj: any): void; get texture(): any; dispose(): void; } enum EpsgCrsTypes { Beijing54 = "Beijing54", Xian80 = "Xian80", CGCS2000 = "CGCS2000", Wgs84 = "Wgs84", Merc3857 = "Merc3857", NewBeijing54 = "NewBeijing54" } /** * Whether is exactly NaN. Notice isNaN('a') returns true. */ function eqNaN(value: any): boolean; /** * Equation base class. * * `a`, `b` and `eps` are {@link https://www8.cs.umu.se/kurser/5DV058/VT15/lectures/SPOOKlabnotes.pdf SPOOK} parameters that default to `0.0`. See {@link https://github.com/schteppe/cannon.js/issues/238#issuecomment-147172327 this exchange} for more details on Cannon's physics implementation. */ class Equation { id: number; /** * Minimum (read: negative max) force to be applied by the constraint. */ minForce: number; /** * Maximum (read: positive max) force to be applied by the constraint. */ maxForce: number; bi: Body_2; bj: Body_2; si: Shape; sj: Shape; /** * SPOOK parameter */ a: number; /** * SPOOK parameter */ b: number; /** * SPOOK parameter */ eps: number; jacobianElementA: JacobianElement; jacobianElementB: JacobianElement; enabled: boolean; /** * A number, proportional to the force added to the bodies. */ multiplier: number; static idCounter: number; constructor(bi: Body_2, bj: Body_2, minForce?: number, maxForce?: number); /** * Recalculates a, b, and eps. * * The Equation constructor sets typical SPOOK parameters as such: * * `stiffness` = 1e7 * * `relaxation` = 4 * * `timeStep`= 1 / 60, _note the hardcoded refresh rate._ */ setSpookParams(stiffness: number, relaxation: number, timeStep: number): void; /** * Computes the right hand side of the SPOOK equation */ computeB(a: number, b: number, h: number): number; /** * Computes G*q, where q are the generalized body coordinates */ computeGq(): number; /** * Computes G*W, where W are the body velocities */ computeGW(): number; /** * Computes G*Wlambda, where W are the body velocities */ computeGWlambda(): number; /** * Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies. */ computeGiMf(): number; /** * Computes G*inv(M)*G' */ computeGiMGt(): number; /** * Add constraint velocity to the bodies. */ addToWlambda(deltalambda: number): void; /** * Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps */ computeC(): number; } /** * Escape a string for use in a regular expression * @param str * * @category Text */ export function escapeRegExp(str: string): string; function estimateBytesUsed(geometry: BufferGeometry): number; function estimateMemoryInBytes(bvh: MeshBVH): number; export class EulerGenerator implements RotationGenerator { angleX: FunctionValueGenerator | ValueGenerator; angleY: FunctionValueGenerator | ValueGenerator; angleZ: FunctionValueGenerator | ValueGenerator; type: 'rotation'; eular: Euler; constructor(angleX: FunctionValueGenerator | ValueGenerator, angleY: FunctionValueGenerator | ValueGenerator, angleZ: FunctionValueGenerator | ValueGenerator, eulerOrder?: EulerOrder); genValue(quat: Quaternion, t?: number): Quaternion; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): EulerGenerator; clone(): RotationGenerator; } class Evaluator { attributes: String[]; useGroups: boolean; consolidateMaterials: boolean; debug: OperationDebugData; evaluate(a: Brush, b: Brush, operation: CSGOperation, targetBrush?: Brush): Brush; evaluate(a: Brush, b: Brush, operations: CSGOperation[], targetBrushes: Brush[]): Brush[]; evaluateHierarchy(root: Operation, target?: Brush): Brush; } type EventCallback = EvtParams extends any[] ? (...args: EvtParams) => boolean | void : never; /** * 事件派发管理 */ export class EventDispatcher { private _events; private _eventCount; private readonly _dispatchingListeners; /** * 确定是否存在事件侦听 * @param event 事件名 * @returns 返回是否存在相应的事件 */ hasEvent(event: string): boolean; /** * 返回注册的所有事件名. * @returns 所有事件名 */ eventNames(): string[]; /** * 返回具有指定事件名称的侦听总数. * @param event - Event name * @returns The count of listeners */ listenerCount(event: string): number; /** * 触发指定事件名称. * @param event - Event name * @param data - Data * @returns - Whether the dispatching is successful */ dispatch(event: string, ...data: any): boolean; /** * 增加监听 * @param event - Event name * @param fn - Function * @returns This */ on(event: string, fn: Function): EventDispatcher; /** * 只监听一次. * @param event - Event name * @param fn - Function * @returns This */ once(event: string, fn: Function): EventDispatcher; /** * 移除监听. * @param event - Event name * @param fn - Function, If is undefined, delete all corresponding event listeners. */ off(event: string, fn?: Function): EventDispatcher; /** * 通过事件名移除所有监听. * @param event - Event name, delete all events if not passed */ removeAllEventListeners(event?: string): void; private _addEventListener; private _clearEvent; } /** * Event dispatcher. * * Event can be defined in EvtDef to enable type check. For example: * ```ts * interface FooEvents { * // key: event name, value: the first event param in `trigger` and `callback`. * myevent: { * aa: string; * bb: number; * }; * } * class Foo extends Eventful { * fn() { * // Type check of event name and the first event param is enabled here. * this.trigger('myevent', {aa: 'xx', bb: 3}); * } * } * let foo = new Foo(); * // Type check of event name and the first event param is enabled here. * foo.on('myevent', (eventParam) => { ... }); * ``` * * @param eventProcessor The object eventProcessor is the scope when * `eventProcessor.xxx` called. * @param eventProcessor.normalizeQuery * param: {string|Object} Raw query. * return: {string|Object} Normalized query. * @param eventProcessor.filter Event will be dispatched only * if it returns `true`. * param: {string} eventType * param: {string|Object} query * return: {boolean} * @param eventProcessor.afterTrigger Called after all handlers called. * param: {string} eventType */ class Eventful { private _$handlers; protected _$eventProcessor: EventProcessor; constructor(eventProcessors?: EventProcessor); on(event: EvtNm, handler: WithThisType>, context?: Ctx): this; on(event: EvtNm, query: EventQuery, handler: WithThisType>, context?: Ctx): this; /** * Whether any handler has bound. */ isSilent(eventName: keyof EvtDef): boolean; /** * Unbind a event. * * @param eventType The event name. * If no `event` input, "off" all listeners. * @param handler The event handler. * If no `handler` input, "off" all listeners of the `event`. */ off(eventType?: keyof EvtDef, handler?: Function): this; /** * Dispatch a event. * * @param {string} eventType The event name. */ trigger(eventType: EvtNm, ...args: Parameters): this; /** * Dispatch a event with context, which is specified at the last parameter. * * @param {string} type The event name. */ triggerWithContext(type: keyof EvtDef, ...args: any[]): this; } /** 获取事件的键盘code */ export function eventKeyCode(event?: any): number | undefined; /** * 事件模块 */ export class EventModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; constructor(entity: Entity, options?: EventModuleOptions); /** * 增加事件回调 * @param options * @returns 事件id,可通过removeEvent删除事件 */ addEvent(options: EventModuleOptions): number; /** * 删除事件回调 * @param options * @returns */ removeEvent(eventId?: number): void; } /** * 事件选项 */ export interface EventModuleOptions { onBeforeAdd?: (parent: Entity, self: Entity) => void; onAdd?: (parent: Entity, self: Entity) => void; onBeforeRemove?: (self: Entity) => void; onRemove?: (self: Entity) => void; onRayIntersect?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseUp?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseMove?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseDown?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseClick?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseDblClick?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseOver?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseOut?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseEnter?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseLeave?: (event: InteractiveEvent, object: InteractiveObject) => void; onPointerDown?: (event: InteractiveEvent, object: InteractiveObject) => void; onPointerMove?: (event: InteractiveEvent, object: InteractiveObject) => void; onPointerUp?: (event: InteractiveEvent, object: InteractiveObject) => void; onMouseWheel?: (event: InteractiveEvent, object: InteractiveObject) => void; onKeyDown?: (event: InteractiveEvent, object: InteractiveObject) => void; onKeyUp?: (event: InteractiveEvent, object: InteractiveObject) => void; /** 高亮模式是否用外包盒的方式 默认false*/ highlightUseBoxHelper?: boolean; /** 是否点击选中 */ clickSelect?: boolean; /** 取消选中模式(默认inherit) none 不主动取消,需要调用代码取消选中; inherit 继承,跟随系统设置; clickOtherPosition 点击其他位置(不在此实体上面时)取消选中; clickOtherEntity 点击选中其他实体时,取消选中 */ cancelSelectMode?: "none" | "inherit" | "clickOtherPosition" | "clickOtherEntity"; /** 是否点击高亮 */ clickHighlight?: boolean; /** 取消高亮模式(默认inherit) none 不主动取消,需要调用代码取消高亮; inherit 继承,跟随系统设置; clickOtherPosition 点击其他位置(不在此实体上面时)取消高亮; clickOtherEntity 点击选中其他实体时,取消高亮 */ cancelHighlight?: "none" | "inherit" | "clickOtherPosition" | "clickOtherEntity"; /** 悬浮时设置为选中状态 */ hoverSelect?: boolean; /** 悬浮时设置为高亮状态 */ hoverHighlight?: boolean; /** 高亮颜色 */ highlightColor?: ColorRepresentation; /** 高亮透明度 */ highlightOpacity?: number; /** 点击时显示的文本内容 */ clickHtmlText?: string | ((ent: Entity) => Promise); /** 点击时显示的文本内容 */ hoverHtmlText?: string | ((ent: Entity) => Promise); /** 当前工具运行时,响应事件,默认false */ enableWhenActiveTool?: boolean; /** 显示文本时弹出框选项 */ popupOptions?: PopupOptions; /** 显示文本时弹出框锚位于实体的位置 (默认'middle-top' 中间-上面居中 ) */ popupAnchor?: Anchor3d; /** popup弹出时作为实体的子节点,默认true */ popupAsEntityChild?: boolean; /** popup弹出前回调 如果返回 Object3D 将把此Object3d做为popup的父节点 */ popupCallback?: (entity: Entity, popup: Popup2D, isHover: boolean, object: InteractiveObject) => Object3D | Entity | undefined; /** 点击回调 */ clickCallback?: (entity: Entity, isClick: boolean, object: InteractiveObject) => void; /** 高亮回调 */ hoverCallback?: (entity: Entity, isHover: boolean, object: InteractiveObject) => void; } interface EventProcessor { normalizeQuery?: (query: EventQuery) => EventQuery; filter?: (eventType: keyof EvtDef, query: EventQuery) => boolean; afterTrigger?: (eventType: keyof EvtDef) => void; } type EventQuery = string | Object; /** * Base class for objects that dispatches events. */ class EventTarget_2 { private _listeners; /** * Add an event listener * @return The self object, for chainability. */ addEventListener(type: string, listener: Function): EventTarget_2; /** * Check if an event listener is added */ hasEventListener(type: string, listener: Function): boolean; /** * Check if any event listener of the given type is added */ hasAnyEventListener(type: string): boolean; /** * Remove an event listener * @return The self object, for chainability. */ removeEventListener(type: string, listener: Function): EventTarget_2; /** * Emit an event. * @return The self object, for chainability. */ dispatchEvent(event: any): EventTarget_2; } export function eventXY(event?: any): Vector2; export interface ExecutionContext { inputs?: NodeValue[]; outputs?: NodeValue[]; particle?: IParticle; [key: string]: any; } /** * 根据线的坐标扩展左右边 . * @param line 线的坐标 * @param lineWidth 线的总宽度或左右宽数组 */ export function expandLine(line: [number, number, number?][], lineWidth: number | [number, number][]): { offsetPoints: any[]; leftPoints: any[]; rightPoints: any[]; expandPoints: any[]; }; /** 对物体进行爆炸分解 */ export const explodeGroup: (group: Object3D) => { /** 爆炸分解 */ explode: (opts?: { /** 动画时长 */ time?: number; /** 爆炸分解分解距离 */ distance?: number; /** 允许旋转 */ enableRotation?: boolean; /** 动画类型 */ easing?: Easing; }) => Promise; /** 还原 */ reset: (opts?: { /** 动画时长 */ time?: number; /** 允许旋转 */ enableRotation?: boolean; /** 动画类型 */ easing?: Easing; }) => Promise; }; /** * Exports a render target to a blob. The type is automatically picked from exr to png based on the render target. * @param target - render target to export * @param mimeType - mime type to use. * If auto (default), then it will be picked based on the render target type. * @param textureIndex - index of the texture to use in the render target (only in case of multiple render target) */ export function exportRenderTarget(renderer: WebGLRenderer, target: WebGLMultipleRenderTargets | WebGLRenderTarget, mimeType?: string, textureIndex?: number): Blob; /** * Given a destination object and optionally many source objects, * copy all properties from the source objects into the destination. * The last source object given overrides properties from previous * source objects. * * @param dest destination object * @param sources sources from which properties are pulled * @private */ export function extend(dest: Object, ...sources: Object[]): Object; function extend_2, S extends Dictionary>(target: T, source: S): T & S; interface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D { dpr?: number; } class ExtendedTriangle extends Triangle { needsUpdate: boolean; intersectsTriangle(other: Triangle, target?: Line3): boolean; intersectsSphere(sphere: Sphere): boolean; closestPointToSegment(segment: Line3, target1?: Vector3, target2?: Vector3): number; distanceToPoint(point: Vector3): number; distanceToTriangle(tri: Triangle): number; } /** * Create a Path class from path string data * @param str * @param opts Other options */ function extendFromString(str: string, defaultOpts?: SVGPathOption): typeof SVGPath; interface ExtremeInfo { nodeCount: number; leafNodeCount: number; surfaceAreaScore: number; depth: { min: number; max: number; }; tris: { min: number; max: number; }; splits: [number, number, number]; } /** * * @param {Object} geojson * @param {Object} [opts] * @param {number} opts.depth * @param {number} [opts.bevelSize = 0] * @param {number} [opts.bevelSegments = 2] * @param {number} [opts.simplify = 0] * @param {boolean} [opts.smoothSide = 'auto'] * @param {boolean} [opts.smoothSideThreshold = 0.9] // Will not smooth sharp side. * @param {boolean} [opts.smoothBevel = false] * @param {boolean} [opts.excludeBottom = false] * @param {boolean} [opts.lineWidth = 1] * @param {boolean} [opts.miterLimit = 2] * @param {Object} [opts.fitRect] translate and scale will be ignored if fitRect is set * @param {Array} [opts.translate] * @param {Array} [opts.scale] * @param {Object} [opts.boundingRect] * @return {Object} {polyline: {indices, position, uv, normal}, polygon: {indices, position, uv, normal}} */ export function extrudeGeoJSON(geojson: any, opts?: { depth?: ((idx: number) => number) | number; bevelSize?: number; bevelSegments?: number; simplify?: number; smoothSide?: boolean; smoothBevel?: boolean; excludeBottom?: boolean; /** default 0.9 */ smoothSideThreshold?: number; /** default 1 */ lineWidth?: number; /** default 2 */ miterLimit?: number; fitRect?: { x?: number; y?: number; width?: number; height?: number; }; translate?: ArrayLike; scale?: ArrayLike; isMapMode?: boolean; boundingRect?: { x: number; y: number; width: number; height: number; }; }): { polyline: { position: Float32Array; indices: Uint16Array | Uint32Array; uv: Float32Array; normal: Float32Array; boundingRect: { x: number; y: number; width: number; height: number; }; geometry: BufferGeometry; }; polygon: { position: Float32Array; indices: Uint16Array | Uint32Array; uv: Float32Array; normal: Float32Array; boundingRect: { x: number; y: number; width: number; height: number; }; geometry: BufferGeometry; }; }; /** * 挤出模型 * * @export * @class ExtrudeMesh * @extends {Mesh} */ export class ExtrudeMesh extends Mesh { static temp1Vector2: Vector2; static temp2Vector2: Vector2; static temp3Vector2: Vector2; static tempVector3: Vector3; static temp1Vector3: Vector3; static temp2Vector3: Vector3; static temp3Vector3: Vector3; static temp1Matrix4: Matrix4; static temp2Matrix4: Matrix4; static temp3Matrix4: Matrix4; constructor(props: ExtrudeMeshProps, material?: Material); pointerWidthRadius: Array<{ vector3: [number, number, number]; matrix: [ number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number ]; }>; computerMatrix(vector1: [number, number, number], vector2: [number, number, number], scale: [number, number, number]): Matrix4Tuple; /** * @计算渐变值 computerGradient([2,1,3], 0.3); * @渐变区间 values:number[] * @百分比 percentage:number */ computerGradient(values: number[], percentage: number): number; computerPointerWidthRadius(paths: Array, closed: boolean): void; computerPathLength(points: [number, number, number][]): number; setExtrudeMesh(startP: [number, number, number], // 起点位置 startMatrix4: [ number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number ], // 起点位置的矩阵 endP: [number, number, number], // 终点位置 endMatrix4: [ number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number ], // 终点位置的矩阵 uvx: number, // uv.x 的起始位置 shapePath: Array<[number, number]>): { geometryPoint: number[]; uvPoint: number[]; }; updateGeometry(props: ExtrudeMeshProps): void; } /** 挤出 */ export interface ExtrudeMeshProps { /** 自动生成路径的 */ paths: Array; /** 被拉伸成模型的平面路径 */ shapePath: Array<[number, number]>; /** 是否闭合路径 */ closed: boolean; isMapMode?: boolean; } export type ExtrudePath = { vector3: [number, number, number]; /** 圆角半径 */ radius: number; /** 圆角分段 */ segments: number; /** 当前位置对shape的缩放 */ scale: { x: number; y: number; }; /** 备注名字 */ name: string; }; /** * * @param {Array} polygons Polygons array that match GeoJSON MultiPolygon geometry. * @param {Object} [opts] * @param {number|Function} [opts.depth] * @param {number} [opts.bevelSize = 0] * @param {number} [opts.bevelSegments = 2] * @param {number} [opts.simplify = 0] * @param {boolean} [opts.smoothSide = 'auto'] * @param {boolean} [opts.smoothSideThreshold = 0.9] // Will not smooth sharp side. * @param {boolean} [opts.smoothBevel = false] * @param {boolean} [opts.excludeBottom = false] * @param {Object} [opts.fitRect] translate and scale will be ignored if fitRect is set * @param {Array} [opts.translate] * @param {Array} [opts.scale] * * @return {Object} {indices, position, uv, normal, boundingRect} */ export function extrudePolygon(polygons: any[], opts?: { depth?: ((idx: number) => number) | number; bevelSize?: number; bevelSegments?: number; simplify?: number; smoothSide?: boolean; smoothBevel?: boolean; excludeBottom?: boolean; fitRect?: { x?: number; y?: number; width?: number; height?: number; }; translate?: ArrayLike; scale?: ArrayLike; removeIntersections?: boolean; removeIntersectionsHole?: boolean; isMapMode?: boolean; boundingRect?: { x: number; y: number; width: number; height: number; }; }): { position: Float32Array; indices: Uint16Array | Uint32Array; uv: Float32Array; normal: Float32Array; boundingRect: { x: number; y: number; width: number; height: number; }; geometry: BufferGeometry; }; /** * * @param {Array} polylines Polylines array that match GeoJSON MultiLineString geometry. * @param {Object} [opts] * @param {number} [opts.depth] * @param {number} [opts.bevelSize = 0] * @param {number} [opts.bevelSegments = 2] * @param {number} [opts.simplify = 0] * @param {boolean} [opts.smoothSide = 'auto'] * @param {boolean} [opts.smoothSideThreshold = 0.9] // Will not smooth sharp side. * @param {boolean} [opts.smoothBevel = false] * @param {boolean} [opts.excludeBottom = false] * @param {boolean} [opts.lineWidth = 1] * @param {boolean} [opts.miterLimit = 2] * @param {Object} [opts.fitRect] translate and scale will be ignored if fitRect is set * @param {Array} [opts.translate] * @param {Array} [opts.scale] * @param {Object} [opts.boundingRect] * @return {Object} {indices, position, uv, normal, boundingRect} */ export function extrudePolyline(polylines: any[], opts?: { depth?: ((idx: number) => number) | number; /** default 0 */ bevelSize?: number; /** default 2 */ bevelSegments?: number; /** default 0 */ simplify?: number; /** default 'auto' */ smoothSide?: boolean; /** default 0.9 */ smoothSideThreshold?: number; /** default false */ smoothBevel?: boolean; /** default false */ excludeBottom?: boolean; /** default 1 */ lineWidth?: number; /** default 2 */ miterLimit?: number; fitRect?: { x?: number; y?: number; width?: number; height?: number; }; translate?: ArrayLike; scale?: ArrayLike; removeIntersections?: boolean; isMapMode?: boolean; boundingRect?: { x: number; y: number; width: number; height: number; }; }): { position: Float32Array; indices: Uint16Array | Uint32Array; uv: Float32Array; normal: Float32Array; boundingRect: { x: number; y: number; width: number; height: number; }; geometry: BufferGeometry; }; export class FailingBehavior extends Behavior { delayTicks: number; static typeName: string; constructor(delayTicks?: number); tick(td: any): BehaviorStatus.Running | BehaviorStatus.Failed; static INSTANCE: FailingBehavior; } /** * Map value to color. Faster than lerp methods because color is represented by rgba array. * @param normalizedValue A float between 0 and 1. * @param colors List of rgba color array * @param out Mapped gba color array * @return will be null/undefined if input illegal. */ function fastLerp(normalizedValue: number, colors: number[][], out?: number[]): number[]; /** * @deprecated */ const fastMapToColor: typeof fastLerp; export interface FBOConfig { width: number; height: number; samples: number; options: RenderTargetOptions; } type FBOSettings = { /** Defines the count of MSAA samples. Can only be used with WebGL 2. Default: 0 */ samples?: number; /** If set, the scene depth will be rendered into buffer.depthTexture. Default: false */ depth?: boolean; } & RenderTargetOptions; /** * Feature * * https://tools.ietf.org/html/rfc7946#section-3.2 * A Feature object represents a spatially bounded thing. * Every Feature object is a GeoJSON object no matter where it occurs in a GeoJSON text. */ interface Feature extends GeoJSONObject { type: "Feature"; geometry: G; /** * A value that uniquely identifies this feature in a * https://tools.ietf.org/html/rfc7946#section-3.2. */ id?: Id; /** * Properties associated with this feature. */ properties: P; } /** * Feature Collection * * https://tools.ietf.org/html/rfc7946#section-3.3 * A GeoJSON object with the type 'FeatureCollection' is a FeatureCollection object. * A FeatureCollection object has a member with the name 'features'. * The value of 'features' is a JSON array. Each element of the array is a Feature object as defined above. * It is possible for this array to be empty. */ interface FeatureCollection extends GeoJSONObject { type: "FeatureCollection"; features: Array>; } export type FieldType = 'vec3' | 'value' | 'number' | 'range' | 'colorFunc' | 'valueFunc' | 'rotationFunc' | 'radian' | 'mesh' | 'particleSystem' | 'boolean' | 'geometry' | 'emitterMode'; export interface FillExtrusionItemData { /** id */ id?: string; /** 坐标 */ coordinates: [number, number][][] | [number, number][]; /** 颜色 */ color?: ColorRepresentation; /** 颜色2 顶部的颜色。默认和底部color一样 */ color2?: ColorRepresentation; /** 透明度(0-1) */ opacity?: number; /** 边框线颜色 */ borderColor?: ColorRepresentation; /** 边框颜色2 顶部的线颜色。默认和底部边框线颜色一样 */ borderColor2?: ColorRepresentation; /** 是否显示边框 */ showBorder?: boolean; /** 拉伸参数 */ extrude?: ExtrudeGeometryOptions; /** 是否显示顶点 */ showVertex?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 基准高 */ baseHeight?: boolean; /** 自定义数据 */ [key: string]: any; } /** * 拉伸实体 */ export class FillExtrusionsEntity extends Entity { constructor(options: FillExtrusionsEntityOptions); /** * 获取拉伸对象 */ getFillExtrusions: () => Mesh; /** * 获取拉伸边框对象 */ getBorderPolyline: () => LineSegments2_2; /** * 更新样式 */ updateStyle: (style: MeshBasicMaterialParameters) => void; /** * 获取顶点对象 */ getVertexSymbol: () => SymbolEntity; /** * 是否显示顶点 */ isShowVertex: () => boolean; /** * 获取顶点数据 */ getVertexData: (isGetAll?: boolean) => SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex: (show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }) => void; /** * 更新高亮样式 */ updateHightStyle: (style: MeshBasicMaterialParameters) => void; /** * 修改数据 */ setData: (data: FillExtrusionItemData[]) => void; /** * 获取数据 */ getData: () => FillExtrusionItemData[]; /** * 通过faceIndex获取 * @param faceIndex 索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex: (faceIndex: number, isRefData?: boolean) => { positionIndex: number; } & FillExtrusionItemData; /** * 刷新高亮数据 */ refreshHighlight: () => void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight: (id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean) => void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight: (id: string) => boolean; /** * 清除所有高亮 * @returns */ clearHighlight: () => void; /** * 设置每项的拉伸后的深度、颜色、透明度值 * @returns */ setDepths: (data: { index: number; depth?: number; color2?: ColorRepresentation; opacity?: number; }[]) => void; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type FillExtrusionsEntityOptions = EntityOptions & FillExtrusionsModuleOption; /** * 多边形模块,用来绘制批量多边形 */ export class FillExtrusionsModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; fillExtrusions: Mesh; data: FillExtrusionItemData[]; style: MeshLambertMaterialParameters; highlightFillExtrusions: Mesh; highlightData: FillExtrusionItemData[]; highlightIndexMap: Map; highlightStyle: MeshLambertMaterialParameters; facePosIndex: Map; isXYPlane: boolean; borderStyle: LineMaterialParameters_2; showBorder: boolean; useBvh: boolean; borderPolyline: LineSegments2_2; vertexEntity: SymbolEntity; showVertex: boolean; vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; constructor(entity: Entity, options?: FillExtrusionsModuleOption); setupUiConfig(): UiObjectConfig; /** * 获取多边形对象 */ getFillExtrusions(): Mesh, Material | Material[], Object3DEventMap>; /** * 获取顶点对象 */ getVertexSymbol(): SymbolEntity; /** * 获取多边形边框对象 */ getBorderPolyline(): LineSegments2_2; /** * 更新样式 */ updateStyle(style: MeshLambertMaterialParameters): void; /** * 更新高亮样式 */ updateHightStyle(style: MeshLambertMaterialParameters): void; /** * 修改数据 */ setData(data: FillExtrusionItemData[]): void; /** * 获取数据 */ getData(): FillExtrusionItemData[]; /** * 是否显示顶点 */ isShowVertex(): boolean; /** * 获取顶点数据 */ getVertexData(isGetAll?: boolean): SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex(show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }): void; /** * 通过faceIndex获取 * @param faceIndex 索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex(faceIndex: number, isRefData?: boolean): { data: FillExtrusionItemData; face: [number, number, number]; } | { face: number[]; /** id */ id?: string; /** 坐标 */ coordinates: [number, number][] | [number, number][][]; /** 颜色 */ color?: ColorRepresentation; /** 颜色2 顶部的颜色。默认和底部color一样 */ color2?: ColorRepresentation; /** 透明度(0-1) */ opacity?: number; /** 边框线颜色 */ borderColor?: ColorRepresentation; /** 边框颜色2 顶部的线颜色。默认和底部边框线颜色一样 */ borderColor2?: ColorRepresentation; /** 是否显示边框 */ showBorder?: boolean; /** 拉伸参数 */ extrude?: ExtrudeGeometryOptions; /** 是否显示顶点 */ showVertex?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 基准高 */ baseHeight?: boolean; data?: undefined; }; /** * 设置每项的拉伸后的深度、颜色、透明度值 * @returns */ setDepths(data: { index: number; depth?: number; color2?: ColorRepresentation; opacity?: number; }[]): void; /** * 刷新高亮数据 * @returns */ refreshHighlight(): void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight(id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean): void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight(id: string): boolean; /** * 清除所有高亮 * @returns */ clearHighlight(): void; } export interface FillExtrusionsModuleOption { /** 数据 */ data: FillExtrusionItemData[]; /** 样式 */ style?: MeshLambertMaterialParameters; /** 高亮样式 */ highlightStyle?: MeshLambertMaterialParameters; /** 边框样式 */ borderStyle?: LineMaterialParameters_2; /** 是否显示边框 */ showBorder?: boolean; /** 数据是否在xy平面,默认为xz 平面 */ isXYPlane?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; /** 是否显示顶点(全局控制显示) */ showVertex?: boolean; /** 顶点样式 */ vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; } /** * Array filtering. * @return Must be an array. */ function filter(arr: readonly T[], cb: (this: Context, value: T, index: number, arr: readonly T[]) => boolean, context?: Context): T[]; export class FilterBehavior extends SequenceBehavior { constructor(); /** * * @param {Behavior[]} conditions * @param {Behavior[]} actions * @returns {FilterBehavior} */ static from(conditions: Behavior[], actions?: Behavior[]): FilterBehavior; addChild(child: Behavior): void; /** * * @param {Behavior} condition */ addCondition(condition: Behavior): void; /** * * @param {Behavior} action */ addAction(action: Behavior): void; } export interface FilterColorOptions { /** 是否反色 */ inVerseColor?: boolean; /** 单色*/ monochromeColor?: ColorRepresentation; /** 亮度 (1 不变; < 1 亮度变暗; 1 变亮度亮)*/ bright?: number; /** 对比度 (1 不变; < 1 对比度减弱 1 对比度增强) */ contrast?: number; /** 饱和度 (1 不变; < 1 饱和度减弱 1 饱和度增强))*/ saturation?: number; } export type FilteredType = PickType>, AllowedTypes>; /** * 数组项查找 */ function find(arr: readonly T[], cb: (this: Context, value: T, index?: number, arr?: readonly T[]) => boolean, context?: Context): T; /** * 给定所有路线、起始点、终点生成最短路径 * @param startPoint 起点 * @param endPoint 终点 * @param lines 坐标,请转成几何坐标,再传入 * @param precision 误差,小数点后几位, 以为相同, 如果两个点的坐标距离小于此值,则认为是同一个节点 * @param hasDirection 是否考虑方向 */ export function findShortestPath(startPoint: [number, number, number], endPoint: [number, number, number], lines: Array<{ points: [number, number, number][]; id?: string; weight?: number; }>, precision?: number, hasDirection?: boolean): { startPoint: { closestLength: number; closestPoint: GeoPoint; closestIndex: number; closestPointIndex: number; closestPrePointDist: number; }; endPoint: { closestLength: number; closestPoint: GeoPoint; closestIndex: number; closestPointIndex: number; closestPrePointDist: number; }; route: any[][]; routeDetail: any[]; error?: undefined; } | { error: any; startPoint?: undefined; endPoint?: undefined; route?: undefined; routeDetail?: undefined; }; /** * * @param {SignalHandler[]} handlers * @param {function} f * @param thisArg * @returns {number} index of the handler, or -1 if not found */ export function findSignalHandlerIndexByHandle(handlers: any, f: any, thisArg?: any): number; /** * * @param {SignalHandler[]} handlers * @param {function} f * @param {*} ctx * @returns {number} index of the handler, or -1 if not found */ export function findSignalHandlerIndexByHandleAndContext(handlers: any, f: any, ctx: any): number; interface FitToOptions { cover: boolean; paddingLeft: number; paddingRight: number; paddingBottom: number; paddingTop: number; } /** * 像素空间中输入网格坐标的材质,与相机无关 */ export class FixedSizeMeshMaterial extends ShaderMaterial { constructor({ color, canvasSize, ...params }: { color: ColorRepresentation; canvasSize: Uniform_2; } & MaterialParameters); } /** * 遍历模型,使其扁平化 * @param model 模型 * @param debugOutputModelName 不为空时将调试输出模型数组名称 * @returns */ export const flatModel: (model: Object3D | Entity, debugOutputModelName?: string) => Object3D[]; export const FlowMaterial: (new (parameters?: ShaderMaterialParameters & Partial, uniforms?: Partial) => ShaderMaterial & FlowMaterialProps) & { key: string; }; export type FlowMaterialProps = { /** 颜色 */ color?: Color; /** 纹理开始位置 ,默认(0,0) */ uvBegin?: Vector2; /** 纹理偏移 ,默认(0,0) */ uvOffset?: Vector2; /** 纹理缩放比例 ,默认(1,1) */ uvScale?: Vector2; /** 透明度 */ opacity?: number; /** 时间变量 */ time?: Vector4 | { value: Vector4; }; /** Material side, default: BackSide */ side?: Side; /** Material depthWrite, default: false */ depthWrite?: boolean; /** 纹理 */ map?: Texture; [key: string]: any; }; /** * 荧光点. */ export class FluorescenceMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setMarkersWidth(width: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; _createMarker(): void; private _setFluorescenceWidth; private _setFluorescenceColor; } /** * FoF - Short for `Function of` - a generic type for function */ export type Fof = (...args: TArgs) => TReturn; /** * Manages the creation of a Signed Distance Field (SDF) font atlas, and performs text layout to * generate attributes for rendering text using the atlas. */ export class FontManager extends EventDispatcher_2<{ atlasChange: object; }> { options: FontManagerOptions; private alphabet; atlasData: AtlasData; constructor(options?: FontManagerOptions); update(newChars: string): void; layout(text: string): LayoutInfo; } export type FontManagerOptions = { fontFamily?: string; fontSize?: number; }; type FontStyle = 'normal' | 'italic' | 'oblique'; type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | number; /** * Apply a force to particles over their life. */ export class ForceOverLife implements Simulation { x: FunctionValueGenerator | ValueGenerator; y: FunctionValueGenerator | ValueGenerator; z: FunctionValueGenerator | ValueGenerator; type: string; _temp: Vector3; ps: IParticleSystem; initialize(particle: Particle, particleSystem: ParticleSystem): void; constructor(x: FunctionValueGenerator | ValueGenerator, y: FunctionValueGenerator | ValueGenerator, z: FunctionValueGenerator | ValueGenerator); update(particle: Particle, delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; _tempScale: Vector3; _tempQ: Quaternion; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } /** * apply tile number of particle texture by particles' life. */ export class FrameOverLife implements Simulation { frame: FunctionValueGenerator; type: string; constructor(frame: FunctionValueGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } /** * Constrains the slipping in a contact along a tangent */ class FrictionEquation extends Equation { ri: Vec3; rj: Vec3; t: Vec3; /** * @param slipForce should be +-F_friction = +-mu * F_normal = +-mu * m * g */ constructor(bodyA: Body_2, bodyB: Body_2, slipForce: number); computeB(h: number): number; } /** * 世界坐标距离长度转几何坐标距离长度. * @param dist 距离值 * @param isMap2dHeightMeter 是否以米为单位,默认false以地图单位 * @param app 应用 * @param mapView */ export function fromDist(dist: number, isMap2dHeightMeter?: boolean, app?: App, mapView?: MapViewEntity): number; /** * 世界坐标转几何坐标 . */ export function fromWorld(vec3: [number, number, number?], app?: App, mapView?: MapViewEntity): [number, number, number]; /** 全屏控件 */ export class FullscreenControl implements IControl { _app: App; _controlContainer: HTMLElement; _fullscreen: boolean; _fullscreenchange: string; _fullscreenButton: HTMLElement; _container: HTMLElement; constructor(options?: FullscreenControlOptions); onAdd(app: App): HTMLElement; onRemove(): void; _checkFullscreenSupport(): boolean; _setupUI(): void; _updateTitle(): void; _getTitle(): "退出全屏" | "进入全屏"; _isFullscreen(): boolean; _changeIcon(): void; _onClickFullscreen(): void; } export interface FullscreenControlOptions { container?: HTMLElement; } export class FullScreenQuad { camera: OrthographicCamera; geometry: PlaneGeometry; mesh: Mesh; constructor(material: any); get material(): Material | Material[]; set material(value: Material | Material[]); dispose(): void; render(renderer: any): void; } interface FunctionBind { , Ctx>(func: F, ctx: Ctx): Bind1; , Ctx, T1 extends Parameters[0]>(func: F, ctx: Ctx, a: T1): Bind2; , Ctx, T1 extends Parameters[0], T2 extends Parameters[1]>(func: F, ctx: Ctx, a: T1, b: T2): Bind3; , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3): Bind4; , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3, d: T4): Bind5; } export interface FunctionColorGenerator { type: 'function'; genColor(color: Vector4, t: number): Vector4; toJSON(): FunctionJSON; clone(): FunctionColorGenerator; } export type FunctionJSON = { [a: string]: any; }; export interface FunctionValueGenerator { type: 'function'; genValue(t: number): number; toJSON(): FunctionJSON; clone(): FunctionValueGenerator; } export const genDefaultForNodeValueType: (type: NodeValueType) => any; function generateRandomTriangleColors(geometry: BufferGeometry): void; /** * 根据一个object对象生成ui配置参数值 * @param obj object对象 * @param propItems 对象中的属性值,可选项 * @returns */ export function generateUiConfig(obj: any, propItems?: ({ prop?: string; label?: string; value?: any; [key: string]: any; } | UiObjectConfig | Fof>)[]): UiObjectConfig[]; export function generateUiFolder(label: string, obj: any, params?: any, type?: string): UiObjectConfig; export function generateUUID(): string; export function GeneratorFromJSON(json: FunctionJSON): FunctionValueGenerator | ValueGenerator | RotationGenerator; /** * `GeoBounds` 地理范围. */ export class GeoBounds { min: GeoPoint; max: GeoPoint; constructor(min?: GeoPoint, max?: GeoPoint); /** * 根据数组创建 `GeoBounds`. * * Example: * ```typescript * const b = GeoBounds.fromArray([left, bottom, right, top]); * ``` */ static fromArray(input: [number, number, number, number]): GeoBounds; /** * 根据数组创建 `GeoBounds`. * * Example: * ```typescript * const b = GeoBounds.fromString("[1,2,3,4]"); * ``` */ static fromString(input: string): GeoBounds; /** * 根据数据范围来生成bounds * @param input * @return {GeoBounds} */ static fromDataExtent(input: GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]): GeoBounds; /** * 根据中心点和长,宽生成bounds * @return {GeoBounds} * @param center 中心点 * @param width 宽 * @param height 高,不输入时与宽一样 */ static fromCenterWH(center: GeoPointLike, width: number, height?: number): GeoBounds; /** * 设置包围盒范围 * * @param min 最小值 * @param max 最大值 */ set(min: GeoPoint, max: GeoPoint): void; /** * 得到中心点 * @return {GeoPoint} */ center(): GeoPoint; /** * 得到左上角 * @return {GeoPoint} */ leftTop(): GeoPoint; /** * 得到左下角 * @return {GeoPoint} */ leftBottom(): GeoPoint; /** * 得到右上角 * @return {GeoPoint} */ rightTop(): GeoPoint; /** * 得到右下角 * @return {GeoPoint} */ rightBottom(): GeoPoint; /** * 生成一个随机点 * @return {GeoPoint} * @param xRatio x轴范围比例 缺省 0.6 * @param yRatio y轴范围比例 缺省 0.6 */ randomPoint(xRatio?: number, yRatio?: number): GeoPoint; /** * 生成一个随机点序列 * @return {GeoPoint} * @param xRatio x轴范围比例 缺省 0.6 * @param yRatio y轴范围比例 缺省 0.6 * @param minPointCount 最少的点数 * @param maxPointCount 最多的点数 */ randomPoints(minPointCount: number, maxPointCount: number, xRatio?: number, yRatio?: number): GeoPoint[]; /** * 生成一个随机geojson点集合 * @return {GeoPoint} * @param xRatio x轴范围比例 缺省 0.6 * @param yRatio y轴范围比例 缺省 0.6 * @param count 点的数目 * @param propertiesCb 属性回调函数 */ randomGeoJsonPointCollection(count: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object): GeoJsonGeomertry; /** * 生成一个随机geojson线集合 * @return {GeoPoint} * @param xRatio x轴范围比例 缺省 0.6 * @param yRatio y轴范围比例 缺省 0.6 * @param maxLineCount 最多线的数目 * @param maxPointCount 每条线最多的点的数目 * @param propertiesCb 属性回调函数 * @param minLineCount 最少线的数目(缺省为1) * @param minPointCount 每条线最少的点的数目(缺省为2) */ randomGeoJsonLineCollection(maxLineCount: number, maxPointCount: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object, minLineCount?: number, minPointCount?: number): GeoJsonGeomertry; /** * 生成一个随机geojson多边形集合 * @return {GeoPoint} * @param xRatio x轴范围比例 缺省 0.6 * @param yRatio y轴范围比例 缺省 0.6 * @param maxPolygonCount 最多多边形的数目 * @param maxPointCount 每条线最多的点的数目 * @param propertiesCb 属性回调函数 * @param minPolygonCount 最少多边形的数目(缺省为1) * @param minPointCount 每条线最少的点的数目(缺省为3) */ randomGeoJsonPolygonCollection(maxPolygonCount: number, maxPointCount: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object, minPolygonCount?: number, minPointCount?: number): GeoJsonGeomertry; /** * 返回数组 * * @returns {Array} The coordinates represented as a array of the format `[minx, miny, maxx, maxy]'`. * */ toArray(): number[]; /** * 返回点数组,包括四个顶点 * * @returns {Array} The coordinates represented as a array of the format `[[minx,maxy], [maxx,maxy], [maxx,miny], [minx,miny]]'`. * */ toPointArray(): Array<[number, number]>; /** * 返回字符串. * * @returns {string} The coordinates represented as a string of the format `minx, miny, maxx, maxy'`. * */ toString(fixed?: number): string; /** * 克隆 * */ clone(): GeoBounds; /** * 变成正方形,使宽高相等 * @param isMinValue 是否取宽高的最小值或最大值,默认最大值 * @return{GeoBounds} */ square(isMinValue?: boolean): GeoBounds; /** * 获取宽度 * */ width(): number; /** * 获取高度 * */ height(): number; /** * 按照比例扩大/缩小出一个新的 GeoBounds。 * @param ratio 比例 * @param origin 扩大时的基准点,默认为当前 bounds 的中心点 */ scale(ratio: number, origin?: GeoPoint | null): GeoBounds; /** * 按照XY比例扩大/缩小出一个新的 GeoBounds。 * @param ratioX X比例 * @param ratioY Y比例 * @param origin 扩大时的基准点,默认为当前 bounds 的中心点 */ scaleXY(ratioX: number, ratioY: number, origin?: GeoPoint | null): GeoBounds; /** * 位移包围盒 * @param dx * @param dy */ translate(dx: number, dy: number): void; /** * 更新包围盒 * @param vertices */ update(vertices: GeoPoint[]): void; /** * 根据子包围盒更新包围盒 * @param bounds */ updateByBounds(bounds: GeoBounds[] | GeoBounds): void; /** * 两包围盒求交集 * @param b */ intersect(b: GeoBounds): GeoBounds | null; /** * 求多个包围盒的并集 * @param bound */ union(bound: GeoBounds): GeoBounds; /** * 判断与另一个包围盒是否相交 * @param bound */ isIntersect(bound: GeoBounds): boolean; /** * 求一个包围盒是否包含另一个包围盒 * @param bound */ isContains(bound: GeoBounds): boolean; /** * 查看点是否在包围盒中 * @param point */ contains(point: GeoPoint): boolean; /** * Returns the value in the interval that is nearest to `targetValue`. * * @ignore * @param interval The interval to find the value within. * @param targetValue The value to get nearest to. * @param includeInterior If false, the value will either be [[min]] or [[max]]. * If true, the value may be any number between [[min]] and [[max]]. */ private closestInterval; /** * 查找边界框上最近的点并返回该点. * @param testPoint 点. * @param includeInterior 如果为true,则最近的点可以位于边界框内。如果为false,则最近的点只能位于边界框的外边缘上. */ closestPoint(testPoint: GeoPoint, includeInterior?: boolean): GeoPoint; } /** * new一个GeoBounds实例 * @param min * @param max */ export function geoBounds(min?: GeoPoint, max?: GeoPoint): GeoBounds; /** * GeoJSON * * All GeoJSON objects */ type GeoJsonGeomertry = Feature | FeatureCollection | Geometry | GeometryCollection; /** * GeoJSON Object * * https://tools.ietf.org/html/rfc7946#section-3 * The GeoJSON specification also allows [foreign members](https://tools.ietf.org/html/rfc7946#section-6.1) * Developers should use '&' type in TypeScript or extend the interface to add these foreign members. */ interface GeoJSONObject { /** * Specifies the type of GeoJSON object. */ type: string; /** * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. * https://tools.ietf.org/html/rfc7946#section-5 */ bbox?: BBox; } /** * Geometry * * https://tools.ietf.org/html/rfc7946#section-3 */ interface Geometry extends GeoJSONObject { coordinates: Position | Position[] | Position[][] | Position[][][]; } /** * GeometryCollection * * https://tools.ietf.org/html/rfc7946#section-3.1.8 * * A GeoJSON object with type 'GeometryCollection' is a Geometry object. * A GeometryCollection has a member with the name 'geometries'. * The value of 'geometries' is an array. Each element of this array is a GeoJSON Geometry object. * It is possible for this array to be empty. */ interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; geometries: Array; } /** * Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3 */ interface GeometryObject extends GeoJSONObject { type: GeometryTypes; } /** * Point Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.2 */ interface GeometryPoint extends GeometryObject { type: "GeometryPoint"; coordinates: Position; } /** * GeometryTypes * * https://tools.ietf.org/html/rfc7946#section-1.4 * The valid values for the 'type' property of GeoJSON geometry objects. */ type GeometryTypes = "GeometryPoint" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | "GeometryCollection"; /** * `GeoPoint` 地理坐标. */ export class GeoPoint { /** * 根据不同的类型创建地理坐标 {@link GeoPoint} . * * Example: * ```typescript * const p1 = GeoPoint.convert(new GeoPoint(x, y, z)); * const p2 = GeoPoint.convert([x, y]); * const p3 = GeoPoint.convert([x, y, z]); * const p4 = GeoPoint.convert(lng: -73.9749, lat: 40.7736}); * const p5 = GeoPoint.convert(lon: -73.9749, lat: 40.7736}); * ``` * * @param input - Either [[GeoPointLike]], {@link GeoPointLike} * or {@link GeoPointLike} object literal. */ static convert(input: GeoPointLike): GeoPoint; /** * 根据字符串创建 `GeoPoint`. * * Example: * ```typescript * const b = GeoPoint.fromString("1,2"); * ``` */ static fromString(input: string): GeoPoint; /** 坐标X. */ x: number; /** 坐标y. */ y: number; /** 坐标z(可选). */ z?: number; /** * `GeoPoint` 构造函数 * * @param x - x坐标. * @param y - y坐标. * @param z - z坐标(可选). */ constructor(x: number, y: number, z?: number); /** * 克隆一个坐标 * */ clone(): GeoPoint; private _add; /** * 返回数组 * * @returns {Array} The coordinates represeted as an array of x and y. * ```typescript * var ll = new vjmap.GeoPoint(-73.9749, 40.7736); * ll.toArray(); // = [-73.9749, 40.7736] * ``` */ toArray(): number[]; /** * 返回字符串. * @param fixed * @returns {string} The coordinates represented as a string of the format `'x, y, z?'`. * ```typescript * var ll = new vjmap.GeoPoint(-73.9749, 40.7736); * ll.toString(); // = "GeoPoint(-73.9749, 40.7736)" * ``` */ toString(fixed?: number): string; /** * 后小数点几位取整 * @param fixed * @return {GeoPoint} */ round(fixed?: number): GeoPoint; roundStr(fixed?: number): string; /** * 两个点相加. * * @param p - 要相加的点. */ add(p: GeoPoint): GeoPoint; private _sub; /** * 两个点相减. * * @param p - 要相减的点. */ sub(p: GeoPoint): GeoPoint; lengthSq(): number; private _multByPoint; /** * 两个点相乘. * * @param p - 要相乘的点. */ multByPoint(p: GeoPoint): GeoPoint; private _divByPoint; /** * 两个点相除. * * @param p - 要相除的点. */ divByPoint(p: GeoPoint): GeoPoint; dot(p: GeoPoint): number; lerp(v: GeoPoint, alpha: number): this; private _mult; /** * 乘一个系数. * * @param k - 系数. */ mult(k: number): GeoPoint; private _div; /** * 除一个系数. * * @param k - 系数. */ div(k: number): GeoPoint; private _rotate; /** * 旋转. * * @param angle - 弧度. */ rotate(angle: number): GeoPoint; private _rotateAround; /** * 绕一个点旋转. * * @param angle - 弧度. * @param p - 围绕的点. */ roateAround(angle: number, p: GeoPoint): GeoPoint; private _matMult; /** * 乘一个矩阵. * * @param m - 矩阵值. */ matMult(m: number[]): GeoPoint; private _unit; /** * 单位长度. * */ unit(): GeoPoint; private _perp; /** * 投影 [x,y] = [-y, x]. * */ perp(): GeoPoint; private _round; /** * 四舍五入取整. * */ roundInt(): GeoPoint; /** * 长度. * */ mag(): number; /** * 判断是否相等 * @param other 另外一个点 * @param dotErr 允许误差的小数点后几位,默认8位 * @return {boolean} */ equals(other: GeoPoint, dotErr?: number): boolean; /** * 是否相等(判断z). * */ equalsZ(other: GeoPoint): boolean; /** * 两点之间距离. * */ distanceTo(p: GeoPoint): number; /** * 两点之间距离平方. * */ distSqr(p: GeoPoint): number; /** * 角度. * */ angle(): number; /** * 距一个点的角度 * */ angleTo(b: GeoPoint): number; /** * 距一个点的interiorAngle * */ angleWith(b: GeoPoint): number; /** * 距一个点的interiorAngle * */ angleWithSep(x: number, y: number): number; /** * 对一个点围绕一个基点进行缩放旋转平移操作. * @param basePt 围绕的基点坐标 * @param destPt 要平移至的目的地坐标 * @param scale 缩放比例,默认1.0 * @param angle 旋转角度,逆时针,默认0 * @return {GeoPoint} * */ transform(basePt: GeoPoint, destPt: GeoPoint, scale?: number, angle?: number): this; } /** * new一个GeoPoint实例 * @param input * @return {GeoPoint} */ export function geoPoint(input: GeoPointLike): GeoPoint; export type GeoPointLike = [number, number] | [number, number, number] | GeoPoint | { x: number; y: number; z?: number; } | { lng: number; lat: number; } | { lon: number; lat: number; }; /** * `GeoProjection` 地理坐标投影. * * Example: * ```typescript * const mapExtent = new GeoBounds(new GeoPoint(10, 20), new GeoPoint(80, 90)); * const prj = new GeoProjection(mapExtent); * const pt = [30, 30]; * const latlng = prj.toLngLat(pt); * const pt_geo = prj.fromLngLat(latlng); * const mkt = prj.toMercator(pt); * const pt_mkt = prj.fromMercator(mkt); * ``` */ export class GeoProjection extends Projection { /** 地图地理范围. */ mapExtent: GeoBounds; private _ratio_x; private _ratio_y; /** * `GeoBounds` 构造函数 * * @extent extent - 地图地理范围. */ constructor(extent: GeoBounds); /** * 设置地图范围 * * @extent extent - 地图地理范围. */ setExtent(extent: GeoBounds): void; /** * 坐标转墨卡托(epsg:3857) * @param input 坐标点 * @return {[number, number]} */ toMercator(input: GeoPointLike): [number, number]; /** * 墨卡托(epsg:3857)转坐标 * @param input 墨卡托坐标点 * @return {[number, number]} */ fromMercator(input: GeoPointLike): [number, number]; /** * 地图地理坐标转经纬度 * @param input 地理坐标点 * @return {[number, number]} */ toLngLat(input: GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]): [number, number]; /** * 经纬度转地图地理坐标 * @param input 经纬度坐标点 * @return {GeoPoint} */ fromLngLat(input: GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]): GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]; /** * 得到地图范围 * @return {GeoBounds} */ getMapExtent(): GeoBounds; /** * 把距离转化为米 * @param dist */ toMeter(dist: number): number; /** * 把米转化为距离 * @param meter */ fromMeter(meter: number): number; } /** * 通过3dtiles的boundingVolume和transform获取经纬度 * @param box 3dtiles里面boundingVolume.box的值,默认取中心点。也可以直接传一个坐标[number,number,number] */ function get3dTilesLngLatHeight(box: number[], matrix?: number[]): [number, number, number]; export const getAlignOfNodeValueType: (type: NodeValueType) => number; /** * 获取物体的外包盒 * @param object 物体 * @param inLocalSpace 局部空间 * @param app 应用 * @param mapModeSceneSpace 地图模式下返回场景空间坐标 */ export function getBoundingBox(object: Object3D, inLocalSpace?: boolean, app?: App, mapModeSceneSpace?: boolean): Box3; function getBVHExtremes(bvh: MeshBVH): Array; /** * Returns the current active effect scope if there is one. * */ function getCurrentScope(): EffectScope; function getElementSSRData(el: Element_2): ElementSSRData; export function getEmptyMeta(res?: any): { geometries: any; materials: any; textures: any; images: any; shapes: any; skeletons: any; animations: any; extras: any; _context: {}; }; /** 获取实体所所有的父对象 */ export const getEntityParents: (ent: Entity) => Entity[]; /** 从hdr贴图中提取envmap */ export const getEnvmapFromHDRTexture: (renderer: WebGLRenderer, texture: Texture) => Texture; /** 从场景中提取envmap */ export const getEnvmapFromScene: (renderer: WebGLRenderer, scene: Scene) => Texture; /** * 根据坐标来获取epsg代号 * @param coordinate 坐标,如果有带号的坐标x,输入x的前两位,否则可输入投影坐标[x,y]或经纬度[lng,lat] * @param crs 投影坐标类型 用来过滤结果, 不填默认全部 * @param is3DegreeBelt 是否是三度带,用来过滤结果, 不填默认全部 * @returns */ function getEpsgCode(coordinate: number | [number, number], crs?: EpsgCrsTypes, is3DegreeBelt?: boolean): any[]; /** * 根据带号和坐标系来得到proj4的参数 * @param crs 投影坐标类型 * @param lon 如果为北京54,西安80,2000坐标,需要传入8位的经度坐标,或者带系前两位。如果是wgs84或3857,则不需要传入 * @returns {null | {epsg: string, proj: string}} */ function getEpsgParam(crs: EpsgCrsTypes, lon?: number): { epsg: string; proj: string; }; /** * Get the filename from a path, similar to PHP's basename() * @param url * * @category Text */ export function getFilenameFromPath(url: string): string; /** * 根据过滤的参数获取颜色变化的矩形 * @returns */ export function getFilterColorMatrix(filter: FilterColorOptions): Matrix4; export function getFrustum(camera: any, offsetZ?: number): { width: number; height: number; }; export function getFrustumFromHeight(camera: any, height: any, offsetZ?: number): number; export function getFullscreenTriangle(): BufferGeometry; /** * Get render2d instance by id */ function getInstance(id: number): Render2D; function getJSONStructure(bvh: MeshBVH): TreeNode; /** * Find the key of an object with a given value. * @param object - object to search * @param value - value to search for * * @category JS Object */ export function getKeyByValue(object: Record, value: any): string | undefined; /** * 根据锚获取物体的外包盒的点 * object 物体或包围盒 * anchor 锚位置 * inLocalSpace 局部空间坐标 */ export function getObjectAnchorPoint(object: Object3D | Box3, anchor: Anchor3d, inLocalSpace?: boolean, app?: App): Vector3; /** * 获取物体所对应的实体对象 * @param object 要查找的实体对象 * @param isRootEntity 是否查找为根节点下面的实体,默认false * @returns */ export const getObjectOwnerEntity: (object: Object3D, isRootEntity?: boolean) => Entity | undefined; export const getObjectRefCount: (obj: any) => boolean; /** * Get value, but if it is a function, call it with args * @param s - value or function * @param args - arguments to pass to function * * @category JS Object */ export function getOrCall(s: ValOrFunc, ...args: any[]): T | undefined; /** 得到实体拥有的场景对象 */ export function getOwerScene(ent: Entity | Object3D): Scene | undefined; export function getPhysicsResolver(): PhysicsResolver; /** * Get property descriptor from object or its prototype chain * @param obj * @param prop * * @category JS Object */ export function getPropertyDescriptor(obj: T, prop: keyof T): PropertyDescriptor | undefined; export function getScreenSpaceBox(mesh: any, camera: any): Box2; /** * Given a THREE.Object3D instance, creates parameters for a CANNON shape. */ export const getShapeParameters: (object: Object3D, options?: ShapeOptions) => ShapeParameters | null; export const getSizeOfNodeValueType: (type: NodeValueType) => number; export function getSphericalCube(radius: any, segments: any): BoxGeometry; function getTriangleDefinitions(...triangles: Triangle[]): String[]; function getTriangleHitPointInfo(point: Vector3, geometry: BufferGeometry, triangleIndex: number, target?: HitTriangleInfo): HitTriangleInfo; /** * Create a typed array from an ArrayBuffer by name * @param type - Name of the typed array constructor * @param buffer - ArrayBuffer to use * @category ArrayBuffer */ export function getTypedArray(type: keyof typeof TYPED_ARRAYS, buffer: ArrayBuffer): Float32Array | Uint8Array | Int8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float64Array; /** * Get URL query parameter. If not found, return default value. Similar to PHP's $_GET * @param p - parameter name to get * @param def - default value if parameter not found * * @category URL */ export function getUrlQueryParam(p: string, def?: any): any; export function getValueFromEmitterMode(mode: EmitterMode, currentValue: number, spread: number, emissionState: EmissionState): number; export interface GlLineItemData { /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 是否显示顶点 */ showVertex?: boolean; /** 自定义数据 */ [key: string]: any; } /** * 多段线实体(glline一个像素线宽) */ export class GlLinesEntity extends Entity { constructor(options: GlLinesEntityOptions); /** * 获取线对象 */ getGlLines: () => Line_2; /** * 更新样式 */ updateStyle: (style: LineDashedMaterialParameters | LineBasicMaterialParameters) => void; /** * 更新高亮样式 */ updateHightStyle: (style: LineDashedMaterialParameters | LineBasicMaterialParameters) => void; /** * 修改数据 */ setData: (data: GlLineItemData[]) => void; /** * 获取数据 */ getData: () => GlLineItemData[]; /** * 获取顶点对象 */ getVertexSymbol: () => SymbolEntity; /** * 是否显示顶点 */ isShowVertex: () => boolean; /** * 获取顶点数据 */ getVertexData: (isGetAll?: boolean) => SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex: (show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }) => void; /** * 通过索引获取数据 * @param index 索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByIndex: (index: number, isRefData?: boolean) => { positionIndex: number; } & GlLineItemData; /** * 刷新高亮数据 */ refreshHighlight: () => void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight: (id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean) => void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight: (id: string) => boolean; /** * 清除所有高亮 * @returns */ clearHighlight: () => void; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type GlLinesEntityOptions = EntityOptions & GlLinesModuleOption; /** * webgl线模块,用来绘制批量线(没有线宽) */ export class GlLinesModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; gllines: Line_2; data: GlLineItemData[]; style: LineDashedMaterialParameters | LineBasicMaterialParameters; highlightGlLines: Line_2; highlightData: GlLineItemData[]; highlightStyle: LineDashedMaterialParameters | LineBasicMaterialParameters; highlightIndexMap: Map; posIndex: Map; vertexEntity: SymbolEntity; showVertex: boolean; vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; constructor(entity: Entity, options?: GlLinesModuleOption); setupUiConfig(): UiObjectConfig; /** * 获取线对象 */ getGlLines(): Line_2, Material | Material[], Object3DEventMap>; /** * 获取顶点对象 */ getVertexSymbol(): SymbolEntity; /** * 更新样式 */ updateStyle(style: LineDashedMaterialParameters | LineBasicMaterialParameters): void; /** * 更新高亮样式 */ updateHightStyle(style: LineDashedMaterialParameters | LineBasicMaterialParameters): void; /** * 修改数据 */ setData(data: GlLineItemData[]): void; /** * 是否显示顶点 */ isShowVertex(): boolean; /** * 获取顶点数据 */ getVertexData(isGetAll?: boolean): SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex(show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }): void; /** * 获取数据 */ getData(): GlLineItemData[]; /** * 通过Index获取 * @param index 索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByIndex(index: number, isRefData?: boolean): { data: GlLineItemData; positionIndex: number; } | { positionIndex: number; /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 是否显示顶点 */ showVertex?: boolean; data?: undefined; }; /** * 刷新高亮数据 * @returns */ refreshHighlight(): void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight(id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean): void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight(id: string): boolean; /** * 清除所有高亮 * @returns */ clearHighlight(): void; } export interface GlLinesModuleOption { /** 数据 */ data: GlLineItemData[]; /** 样式 */ style?: LineDashedMaterialParameters | LineBasicMaterialParameters; /** 高亮样式 */ highlightStyle?: LineDashedMaterialParameters | LineBasicMaterialParameters; /** 是否使用虚线 */ dashed?: boolean; /** 是否显示顶点(全局控制显示) */ showVertex?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 顶点样式 */ vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; } /** * A template literal tag that does nothing. Useful for syntax highlighting of GLSL code. * * @example * ```js * const vertexShader = glsl` * void main() {} * ` * ``` * @category Template Literals */ export const glsl: (strings: any, ...rest: any[]) => string; export class Gradient implements FunctionColorGenerator { type: 'function'; color: ContinuousLinearFunction; alpha: ContinuousLinearFunction; constructor(color?: Array<[Vector3, number]>, alpha?: Array<[number, number]>); genColor(color: Vector4, t: number): Vector4; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): Gradient; clone(): FunctionColorGenerator; } class Gradient_2 { id?: number; type: string; colorStops: GradientColorStop[]; global: boolean; constructor(colorStops: GradientColorStop[]); addColorStop(offset: number, color: string): void; } interface GradientColorStop { offset: number; color: string; } interface GradientObject { id?: number; type: string; colorStops: GradientColorStop[]; global?: boolean; } /** * 具有深度优先搜索和拓扑排序的图数据结构。 * * @example * var graph = Graph() * .addEdge("s", "t", 10) * .addEdge("s", "y", 5) * .addEdge("s", "y", 4) * .addEdge("t", "y", 2) * .addEdge("y", "t", 3) * .addEdge("t", "x", 1) * .addEdge("y", "x", 9) * .addEdge("y", "z", 2) * .addEdge("x", "z", 4) * .addEdge("z", "x", 6); * var res = graph.shortestPath("s", "z") */ export function Graph(serialized?: Serialized): { addNode: (node: NodeId) => any; removeNode: (node: NodeId) => any; nodes: () => NodeId[]; adjacent: (node: NodeId) => NodeId[]; addEdge: (u: NodeId, v: NodeId, weight?: EdgeWeight) => any; removeEdge: (u: NodeId, v: NodeId) => any; hasEdge: (u: NodeId, v: NodeId) => boolean; setEdgeWeight: (u: NodeId, v: NodeId, weight: EdgeWeight) => any; getEdgeWeight: (u: NodeId, v: NodeId) => EdgeWeight; indegree: (node: NodeId) => number; outdegree: (node: NodeId) => number; depthFirstSearch: (sourceNodes?: NodeId[], includeSourceNodes?: boolean, errorOnCycle?: boolean) => string[]; hasCycle: () => boolean; lowestCommonAncestors: (node1: NodeId, node2: NodeId) => string[]; topologicalSort: (sourceNodes?: NodeId[], includeSourceNodes?: boolean) => string[]; shortestPath: (source: NodeId, destination: NodeId) => string[] & { weight?: EdgeWeight; }; serialize: () => Serialized; deserialize: (serialized: Serialized) => any; }; export class GraphNodeType extends NodeDef { nodeGraph: NodeGraph; constructor(nodeGraph: NodeGraph); } /** * Apply a gravity force to particles. * the gravity force is calculated as: * F = G * m1 * m2 / r^2 */ export class GravityForce implements Simulation { center: Vector3; magnitude: number; type: string; temp: Vector3; constructor(center: Vector3, magnitude: number); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export const Grid: ({ args, cellColor, sectionColor, cellSize, sectionSize, followCamera, infiniteGrid, fadeDistance, fadeStrength, cellThickness, sectionThickness, axisThickness, side, depthWrite, }?: GridProps) => GridType; /** * Axis aligned uniform grid broadphase. * @todo Needs support for more than just planes and spheres. */ class GridBroadphase extends Broadphase { /** * Number of boxes along x */ nx: number; /** * Number of boxes along y */ ny: number; /** * Number of boxes along z */ nz: number; /** * aabbMin */ aabbMin: Vec3; /** * aabbMax */ aabbMax: Vec3; /** * bins */ bins: Body_2[][]; /** * binLengths */ binLengths: number[]; /** * @param nx Number of boxes along x. * @param ny Number of boxes along y. * @param nz Number of boxes along z. */ constructor(aabbMin?: Vec3, aabbMax?: Vec3, nx?: number, ny?: number, nz?: number); /** * Get all the collision pairs in the physics world */ collisionPairs(world: World, pairs1: Body_2[], pairs2: Body_2[]): void; } export class GridEmitter implements EmitterShape { type: string; width: number; height: number; column: number; row: number; constructor(parameters?: GridEmitterParameters); initialize(p: Particle): void; toJSON(): ShapeJSON; static fromJSON(json: any): GridEmitter; clone(): EmitterShape; update(system: ParticleSystem, delta: number): void; } /** * Interface representing the parameters for a grid emitter. */ export interface GridEmitterParameters { /** * The width of the grid. */ width?: number; /** * The height of the grid. */ height?: number; /** * The number of columns in the grid. */ column?: number; /** * The number of rows in the grid. */ row?: number; } export class GridHelperModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; grid: GridType; gridLineHelper: GridHelper; constructor(entity: Entity, options?: GridHelperModuleOptions); getVisible(isUseGridLine?: boolean): boolean; setVisible(visible: boolean, isUseGridLine?: boolean): void; onAppUpdate(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface GridHelperModuleOptions extends GridProps { polygonOffset?: boolean; polygonOffsetFactor?: number; polygonOffsetUnits?: number; /** 绘制网格线 */ drawGridLine?: boolean; /** 网格线大小 */ gridLineSize?: number; /** 网格线分割数 */ gridLineDivisions?: number; /** 网格线中心线的颜色 */ gridLineColor1?: Color; /** 网格线线条的颜色 */ gridLineColor2?: Color; } class GridMaterial extends MeshPhongMaterial { enableGrid: boolean; } export type GridProps = { /** plane-geometry size, default: [100, 100] */ args?: Array; /** Cell size, default: 1 */ cellSize?: number; /** Cell thickness, default: 0.8 */ cellThickness?: number; /** Cell color, default: rgb(50,55,72) */ cellColor?: Color; /** Section size, default: 10 */ sectionSize?: number; /** Section thickness, default: 1 */ sectionThickness?: number; /** axisThickness thickness, default: 1.8 */ axisThickness?: number; /** Section color, default: rgb(73,79,105) */ sectionColor?: Color; /** Follow camera, default: false */ followCamera?: boolean; /** Display the grid infinitely, default: false */ infiniteGrid?: boolean; /** Fade distance, default: 1000 */ fadeDistance?: number; /** Fade strength, default: 1 */ fadeStrength?: number; /** Material side, default: BackSide */ side?: Side; /** Material depthWrite, default: false */ depthWrite?: boolean; /** visible, default: true */ visible?: boolean; }; export type GridType = { mesh: Mesh; update: (camera: Camera) => void; }; class Group extends Element_2 { readonly isGroup = true; private _children; constructor(opts?: GroupProps); /** * Get children reference. */ childrenRef(): Element_2[]; /** * Get children copy. */ children(): Element_2[]; /** * 获取指定 index 的儿子节点 */ childAt(idx: number): Element_2; /** * 获取指定名字的儿子节点 */ childOfName(name: string): Element_2; childCount(): number; /** * 添加子节点到最后 */ add(child: Element_2): Group; /** * 添加子节点在 nextSibling 之前 */ addBefore(child: Element_2, nextSibling: Element_2): this; replace(oldChild: Element_2, newChild: Element_2): this; replaceAt(child: Element_2, index: number): this; _doAdd(child: Element_2): void; /** * Remove child * @param child */ remove(child: Element_2): this; /** * Remove all children */ removeAll(): this; /** * 遍历所有子节点 */ eachChild(cb: (this: Context, el: Element_2, index?: number) => void, context?: Context): this; /** * Visit all descendants. * Return false in callback to stop visit descendants of current node */ traverse(cb: (this: T, el: Element_2) => boolean | void, context?: T): this; addSelfToZr(zr: Render2dType): void; removeSelfFromZr(zr: Render2dType): void; getBoundingRect(includeChildren?: Element_2[]): BoundingRect; } interface GroupLike extends Element_2 { childrenRef(): Element_2[]; } interface GroupProps extends ElementProps { } /** * Constraint equation Gauss-Seidel solver. * @todo The spook parameters should be specified for each constraint, not globally. * @see https://www8.cs.umu.se/kurser/5DV058/VT09/lectures/spooknotes.pdf */ class GSSolver extends Solver { /** * The number of solver iterations determines quality of the constraints in the world. * The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations. */ iterations: number; /** * When tolerance is reached, the system is assumed to be converged. */ tolerance: number; /** * @todo remove useless constructor */ constructor(); /** * Solve * @return number of iterations performed */ solve(dt: number, world: World): number; } /** * Generate unique id */ function guid(): number; class HalfEdgeHelper extends EdgesHelper { constructor(geometry?: BufferGeometry, halfEdges?: HalfEdgeMap); setHalfEdges(geometry: BufferGeometry, halfEdges: HalfEdgeMap): void; } class HalfEdgeMap { constructor(geometry?: BufferGeometry); getSiblingTriangleIndex(triIndex: number, edgeIndex: number): number; getSiblingEdgeIndex(triIndex: number, edgeIndex: number): number; updateFrom(geomtry: BufferGeometry): void; } /** * 发光的光环. */ export class HaloRingMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setMarkersWidth(width: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; _createMarker(): void; private _createMakerElement; } class Handler extends Eventful { storage: Storage_2; painter: PainterBase; painterRoot: HTMLElement; proxy: HandlerProxyInterface; private _hovered; private _gestureMgr; private _draggingMgr; private _pointerSize; _downEl: Element_2; _upEl: Element_2; _downPoint: [number, number]; constructor(storage: Storage_2, painter: PainterBase, proxy: HandlerProxyInterface, painterRoot: HTMLElement, pointerSize: number); setHandlerProxy(proxy: HandlerProxyInterface): void; mousemove(event: ZRRawEvent): void; mouseout(event: ZRRawEvent): void; /** * Resize */ resize(): void; /** * Dispatch event */ dispatch(eventName: HandlerName, eventArgs?: any): void; /** * Dispose */ dispose(): void; /** * 设置默认的cursor style * @param cursorStyle 例如 crosshair,默认为 'default' */ setCursorStyle(cursorStyle: string): void; /** * 事件分发代理 * * @private * @param {Object} targetInfo {target, topTarget} 目标图形元素 * @param {string} eventName 事件名称 * @param {Object} event 事件对象 */ dispatchToElement(targetInfo: { target?: Element_2; topTarget?: Element_2; }, eventName: ElementEventName, event: ZRRawEvent): void; findHover(x: number, y: number, exclude?: Displayable): HoveredResult; processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change'): void; click: (event: ZRRawEvent) => void; mousedown: (event: ZRRawEvent) => void; mouseup: (event: ZRRawEvent) => void; mousewheel: (event: ZRRawEvent) => void; dblclick: (event: ZRRawEvent) => void; contextmenu: (event: ZRRawEvent) => void; } type HandlerName = 'click' | 'dblclick' | 'mousewheel' | 'mouseout' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu'; interface HandlerProxyInterface extends Eventful { handler: Handler; dispose: () => void; setCursor: (cursorStyle?: string) => void; } /** * @constructor * @param {Object} obj */ class HashMap { data: MapInterface; constructor(obj?: HashMap | { [key in KEY]?: T; } | KEY[]); hasKey(key: KEY): boolean; get(key: KEY): T; set(key: KEY, value: T): T; each(cb: (this: Context, value?: T, key?: KEY) => void, context?: Context): void; keys(): KEY[]; removeKey(key: KEY): void; } function hasOwn(own: object, prop: string): boolean; class Heart extends Path { shape: HeartShape; constructor(opts?: HeartProps); getDefaultShape(): HeartShape; buildPath(ctx: CanvasRenderingContext2D, shape: HeartShape): void; } interface HeartProps extends PathProps { shape?: Partial; } class HeartShape { cx: number; cy: number; width: number; height: number; } /** 热力图 */ export class Heatmap { #private; options: HeatmapOptions; heatmap: any; mesh: Mesh; h337: any; size: [number, number]; bounds: GeoBounds; texture: Texture; constructor(options: HeatmapOptions); /** 创建 */ create(): Promise>; /** 设置数据 */ setData(opts: { /** 边界范围 [[minx, minz],[maxx, maxz]]*/ bounds?: [number, number][]; boundScale?: number; /** 数据项 */ data: { /** 点坐标 x,z*/ point: [number, number]; /** 值 */ value: number; }[]; max?: number; min?: number; /** 裁剪多边形 */ clipPolygon?: [number, number][]; }): void; /** 通过uv值获取所在的值 */ getValueByUV(uv: [number, number]): any; /** 通过坐标值获取所在的值 */ getValueByCoord(pt: [number, number]): any; } /** 热力图参数 */ export interface HeatmapOptions { /** 3d热力图模式 */ mode3D?: boolean; /** 3d热力图时高度比例 默认10 */ heightRatio?: number; /** 3d热力图平面分割数 默认50 */ segment?: number; /** 边界范围 [[minx, minz],[maxx, maxz]]*/ bounds?: [[number, number], [number, number]]; /** 裁剪多边形 */ clipPolygon?: [number, number][]; boundScale?: number; /** 数据项 */ data: { /** 点坐标 x,z*/ point: [number, number]; /** 值 */ value: number; }[]; max?: number; min?: number; /** 画布大小 */ canvasSize?: number; /** 样式 */ style?: { /** * A background color string in form of hexcode, color name, or rgb(a) */ backgroundColor?: string; /** * The blur factor that will be applied to all datapoints. The higher the * blur factor is, the smoother the gradients will be * Default value: 0.85 */ blur?: number; /** * An object that represents the gradient. * Syntax: {[key: number in range [0,1]]: color} * Default value: { 0.25: "rgb(0,0,255)", 0.55: "rgb(0,255,0)", 0.85: "yellow", 1.0: "rgb(255,0,0)"} */ gradient?: { [key: string]: string; }; /** * The maximal opacity the highest value in the heatmap will have. (will be * overridden if opacity set) * Default value: 0.6 */ maxOpacity?: number; /** * The minimum opacity the lowest value in the heatmap will have (will be * overridden if opacity set) */ minOpacity?: number; /** * A global opacity for the whole heatmap. This overrides maxOpacity and * minOpacity if set * Default value: 0.6 */ opacity?: number; /** * The radius each datapoint will have (if not specified on the datapoint * itself) * Default value: 40 */ radius?: number; /** * Scales the radius based on map zoom. */ scaleRadius?: boolean; }; } /** * Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance. * @todo Should be possible to use along all axes, not just y * @todo should be possible to scale along all axes * @todo Refactor elementSize to elementSizeX and elementSizeY * * @example * // Generate some height data (y-values). * const data = [] * for (let i = 0; i < 1000; i++) { * const y = 0.5 * Math.cos(0.2 * i) * data.push(y) * } * * // Create the heightfield shape * const heightfieldShape = new CANNON.Heightfield(data, { * elementSize: 1 // Distance between the data points in X and Y directions * }) * const heightfieldBody = new CANNON.Body({ shape: heightfieldShape }) * world.addBody(heightfieldBody) */ class Heightfield extends Shape { /** * An array of numbers, or height values, that are spread out along the x axis. */ data: number[][]; /** * Max value of the data points in the data array. */ maxValue: number | null; /** * Minimum value of the data points in the data array. */ minValue: number | null; /** * World spacing between the data points in X and Y direction. * @todo elementSizeX and Y * @default 1 */ elementSize: number; /** * @default true */ cacheEnabled: boolean; pillarConvex: ConvexPolyhedron; pillarOffset: Vec3; private _cachedPillars; /** * @param data An array of numbers, or height values, that are spread out along the x axis. */ constructor(data: number[][], options?: { /** * Max value of the data points in the data array. * Will be computed automatically if not given. */ maxValue?: number | null; /** * Minimum value of the data points in the data array. * Will be computed automatically if not given. */ minValue?: number | null; /** * World spacing between the data points in X direction. */ elementSize?: number; }); /** * Call whenever you change the data array. */ update(): void; /** * Update the `minValue` property */ updateMinValue(): void; /** * Update the `maxValue` property */ updateMaxValue(): void; /** * Set the height value at an index. Don't forget to update maxValue and minValue after you're done. */ setHeightValueAtIndex(xi: number, yi: number, value: number): void; /** * Get max/min in a rectangle in the matrix data * @param result An array to store the results in. * @return The result array, if it was passed in. Minimum will be at position 0 and max at 1. */ getRectMinMax(iMinX: number, iMinY: number, iMaxX: number, iMaxY: number, result?: number[]): void; /** * Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1. * @param result Two-element array * @param clamp If the position should be clamped to the heightfield edge. */ getIndexOfPosition(x: number, y: number, result: number[], clamp: boolean): boolean; getTriangleAt(x: number, y: number, edgeClamp: boolean, a: Vec3, b: Vec3, c: Vec3): boolean; getNormalAt(x: number, y: number, edgeClamp: boolean, result: Vec3): void; /** * Get an AABB of a square in the heightfield * @param xi * @param yi * @param result */ getAabbAtIndex(xi: number, yi: number, { lowerBound, upperBound }: AABB): void; /** * Get the height in the heightfield at a given position */ getHeightAt(x: number, y: number, edgeClamp: boolean): number; getCacheConvexTrianglePillarKey(xi: number, yi: number, getUpperTriangle: boolean): string; getCachedConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): HeightfieldPillar; setCachedConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean, convex: ConvexPolyhedron, offset: Vec3): void; clearCachedConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): void; /** * Get a triangle from the heightfield */ getTriangle(xi: number, yi: number, upper: boolean, a: Vec3, b: Vec3, c: Vec3): void; /** * Get a triangle in the terrain in the form of a triangular convex shape. */ getConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): void; calculateLocalInertia(mass: number, target?: Vec3): Vec3; volume(): number; calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; updateBoundingSphereRadius(): void; /** * Sets the height values from an image. Currently only supported in browser. */ setHeightsFromImage(image: HTMLImageElement, scale: Vec3): void; } type HeightfieldOptions = ConstructorParameters[1]; type HeightfieldPillar = { convex: any; offset: any; }; export class HemisphereEmitter implements EmitterShape { type: string; radius: number; arc: number; thickness: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; constructor(parameters?: HemisphereEmitterParameters); private currentValue; update(system: ParticleSystem, delta: number): void; initialize(p: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; static fromJSON(json: any): HemisphereEmitter; clone(): EmitterShape; } /** * Interface representing the parameters for a hemisphere emitter. */ export interface HemisphereEmitterParameters { /** * The radius of the hemisphere. */ radius?: number; /** * The arc of the hemisphere. */ arc?: number; /** * The thickness of the hemisphere. 1 is a full hemisphere, 0 is a thin shell. */ thickness?: number; /** * The mode of the emitter. * {@link EmitterMode} */ mode?: EmitterMode; /** * The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ spread?: number; /** * The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ speed?: ValueGenerator | FunctionValueGenerator; } /** * 高亮材质 * @param props */ export const highlightMaterial: (opts: HighlightMaterialOption) => any; export interface HighlightMaterialOption { material: Material | Material[]; highlightOpacity?: IUniformN; highlightColor: IUniformColor; } /** * Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation. */ class HingeConstraint extends PointToPointConstraint { /** * Rotation axis, defined locally in bodyA. */ axisA: Vec3; /** * Rotation axis, defined locally in bodyB. */ axisB: Vec3; rotationalEquation1: RotationalEquation; rotationalEquation2: RotationalEquation; motorEquation: RotationalMotorEquation; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * A point defined locally in bodyA. This defines the offset of axisA. */ pivotA?: Vec3; /** * A point defined locally in bodyB. This defines the offset of axisB. */ pivotB?: Vec3; /** * An axis that bodyA can rotate around, defined locally in bodyA. */ axisA?: Vec3; /** * An axis that bodyB can rotate around, defined locally in bodyB. */ axisB?: Vec3; /** * Wheter to collide the connected bodies or not. * @default false */ collideConnected?: boolean; /** * The maximum force that should be applied to constrain the bodies. * @default 1e6 */ maxForce?: number; }); /** * enableMotor */ enableMotor(): void; /** * disableMotor */ disableMotor(): void; /** * setMotorSpeed */ setMotorSpeed(speed: number): void; /** * setMotorMaxForce */ setMotorMaxForce(maxForce: number): void; /** * update */ update(): void; } type HingeConstraintOptions = ConstructorParameters[2]; interface HitPointInfo { point: Vector3; distance: number; faceIndex: number; } interface HitTriangleInfo { face: { a: number; b: number; c: number; materialIndex: number; normal: Vector3; }; uv: Vector2; } const HOLLOW_INTERSECTION: CSGOperation; const HOLLOW_SUBTRACTION: CSGOperation; export class HolographicMaterial extends ShaderMaterial { /** * Create a HolographicMaterial. * * @param {Object} parameters - The parameters to configure the material. * @param {number} [parameters.time=0.0] - The time uniform representing animation time. * @param {number} [parameters.fresnelOpacity=1.0] - The opacity for the fresnel effect. * @param {number} [parameters.fresnelAmount=1.0] - The strength of the fresnel effect. * @param {number} [parameters.scanlineSize=15.0] - The size of the scanline effect. * @param {number} [parameters.hologramBrightness=1.0] - The brightness of the hologram. * @param {number} [parameters.signalSpeed=1.0] - The speed of the signal effect. * @param {Color} [parameters.hologramColor=new Color('#00d5ff')] - The color of the hologram. * @param {boolean} [parameters.enableBlinking=true] - Enable/disable blinking effect. * @param {boolean} [parameters.blinkFresnelOnly=false] - Enable blinking only on the fresnel effect. * @param {number} [parameters.hologramOpacity=1.0] - The opacity of the hologram. * @param {number} [parameters.blendMode=NormalBlending] - The blending mode. Use `THREE.NormalBlending` or `THREE.AdditiveBlending`. * @param {number} [parameters.side=FrontSide] - The rendering side. Use `THREE.FrontSide`, `THREE.BackSide`, or `THREE.DoubleSide`. * @param {Boolean} [parameters.depthTest=true] - Enable or disable depthTest. */ constructor(app: App, parameters?: { /** The time uniform representing animation time. default 0 */ time?: number; /** The opacity for the fresnel effect. default 1 */ fresnelOpacity?: number; /** The strength of the fresnel effect. default 1 */ fresnelAmount?: number; /** The size of the scanline effect. default 15 */ scanlineSize?: number; /** The brightness of the hologram. default 1 */ hologramBrightness?: number; /** The speed of the signal effect. default 1 */ signalSpeed?: number; /** The color of the hologram. default new Color('#00d5ff') */ hologramColor?: ColorRepresentation; /** Enable/disable blinking effect. default true */ enableBlinking?: boolean; /** Enable blinking only on the fresnel effect.. default false */ blinkFresnelOnly?: boolean; /** The opacity of the hologram. default 1 */ hologramOpacity?: number; /** The blending mode. Use `THREE.NormalBlending` or `THREE.AdditiveBlending`. default NormalBlending */ blendMode?: Blending; /** The rendering side. Use `THREE.FrontSide`, `THREE.BackSide`, or `THREE.DoubleSide`.. default FrontSide */ side?: Side; /** Enable or disable depthTest.. default true */ depthTest?: boolean; }); } class HoveredResult { x: number; y: number; target: Displayable; topTarget: Displayable; constructor(x?: number, y?: number); } /** * A template literal tag that does nothing. Useful for syntax highlighting of HTML code. * * @example * ```js * const vertexShader = html` *
*

Some text

*
* ` * ``` * @category Template Literals */ export const html: (strings: any, ...rest: any[]) => string; /** * Renders an HTML string to a canvas. This is done by first embedding HTML into a svg and then rendering the svg to a canvas. * @param html - HTML string * @param style - CSS string * @param options - options for rendering the canvas * @returns HTML canvas element * * @category HTML To Image */ export function htmlToCanvas(html: string | Node, style: string, options: ImageCanvasOptions): Promise; /** * Renders an HTML string to a png. This is done by first embedding HTML into a svg and then rendering the svg to a png. * @param html * @param style * @param options * @returns png as data url * * @category HTML To Image */ export function htmlToPng(html: string, style: string, options: ImageCanvasOptions): Promise; /** * Embeds an HTML string into a svg tag and converts to svg string or svg as data url * @param html - HTML string * @param style - CSS string * @param width - width of the svg * @param height - height of the svg * @param toDataUrl - if true, returns a data url, otherwise returns the svg string * @returns svg string or svg as data url * * @category HTML To Image */ export function htmlToSvg(html: string, style: string, { width, height }: { width: number; height: number; }, toDataUrl?: boolean): string; export const httpHelper: { configure: (opts: Partial) => void; event: { READY_STATE_CHANGE: string; LOAD_START: string; PROGRESS: string; ABORT: string; ERROR: string; LOAD: string; TIMEOUT: string; LOAD_END: string; }; methods: Methods; rqeust: (args: Partial) => Promise; get: (url: string, params?: Record, args?: Partial) => Promise; put: (url: string, data: any, args?: Partial) => Promise; post: (url: string, data: any, args?: Partial) => Promise; patch: (url: string, data: any, args?: Partial) => Promise; del: (url: string, args?: Partial) => Promise; options: (url: string, args?: Partial) => Promise; }; export class HyperbolicHelicoidGeometry extends ParametricGeometry { constructor(slices?: number, stacks?: number); } export interface IAppModuleBase extends IModuleBase { onAppBeforeUpdate?: (time: Time) => any; onAppUpdate?: (time: Time) => any; onAppAfterUpdate?: (time: Time) => any; onAppBeforeRender?: (time: Time) => any; onAppRender?: (time: Time) => any; onAppAfterRender?: (time: Time) => any; onAppBeforeAddEntity?: (obj: Entity) => any; onAppAddEntity?: (obj: Entity) => any; onAppBeforeRemoveObject?: (obj: Object3D) => any; onAppRemoveObject?: (obj: Object3D) => any; onAppBeforeRemoveEntity?: (ent: Entity) => any; onAppRemoveEntity?: (ent: Entity) => any; } export interface ICameraModule { /**是否显示视角显示器 */ viewHelperEnable: boolean; /** * 设置相机朝向 * @param position 相机位置 * @param lookAt 朝向 * @param options 选项 */ setCameraLookAt: (position: Vector3, lookAt: Vector3, options?: boolean | Record) => void; } export interface ICommand { app: App; /** 命令所在的场景 */ owerScene?: Scene; /** 是否自动执行。默认是 */ autoExecute?: boolean; callbacks?: ICommandCallback; execute(): void; undo(): void; redo(): void; } export interface ICommandCallback { onExecute(): void; onUndo(): void; onRedo(): void; } export interface ICommandModule { readonly commandHistory: CommandHistory; /** 清空命令 */ clearCommands: () => void; /** 执行命令,自动执行 */ executeCommand: (cmd: ICommand) => void; /** 执行所有命令,自动执行 */ executeAllCommands: (cmds: ICommand[]) => void; /** 执行多个命令,自动执行 */ executeManyCommands: (...cmds: ICommand[]) => void; /** 增加命令,不会自动执行 */ addCommand: (cmd: ICommand) => void; /** 增加所有命令,不会自动执行 */ addAllCommands: (cmds: ICommand[]) => void; /** 增加多个命令,不会自动执行 */ addManyCommands: (...cmds: ICommand[]) => void; /** 撤销 */ undo: () => any; /** 还原 */ redo: () => any; } /** * 组合新地图参数 */ export interface IComposeNewMap { /** 地图ID. */ mapid: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 地图裁剪范围,范围如[x1,y1,x2,y2], 为空的话,表示不裁剪 */ clipbounds?: [number, number, number, number]; /** 选择是包含还是相交(默认false表示包含,true相交) */ selByCrossing?: boolean; /** 四参数(x偏移,y偏移,缩放,旋转弧度),可选,对坐标最后进行修正*/ fourParameter?: [number, number, number, number]; /** 是否用上面的四参数进行反算,默认false*/ isInverseFourParamter?: boolean; /** 要显示的图层名称,为空的时候,表示全部图层 */ layers?: string[]; /** 生新成图的图层名称前缀,如果设置为null将不会有默认的图层前缀。如果没有前缀,不同的图有图层重名时,如果设置了随层属性有可能会导致绘制的不一样 */ layerPrefix?: string; /** 生新成图的图层名称后缀 */ layerSuffix?: string; /** 保存的文件名称,为空的时候,自根据参数自动生成 */ savefilename?: string; /** 生成后清理图形数据以减少dwg文件大小 */ purge?: boolean; /** 来源于其他图的实体时,如果块定义重复,则自动重命名 ,默认true */ isRenameBlockNameIfExist?: boolean; /** 是不是创建完缩放至全图 默认false (如果有多个图合并,只需设置第一个图的) */ isZoomExtents?: boolean; /** 导出的CAD版本号。如果为*表示为当前CAD图的版本 */ cadVersion?: string | "*" | "cad2000" | "cad2004" | "cad2007" | "cad2010" | "cad2013" | "cad2018"; } /** * 条件查询实体参数 */ export interface IConditionQueryFeatures extends IQueryBaseFeatures { /** 条件. */ condition: string; /** 范围. */ bounds?: [number, number, number, number]; /** 记录开始位置. */ beginpos?: number; /** 是否返回几何数据,为了性能问题,realgeom为false时,如果返回条数大于1.只会返回每个实体的外包矩形,如果条数为1的话,会返回此实体的真实geojson;realgeom为true时每条都会返回实体的geojson */ includegeom?: boolean; /** 是否返回真实实体几何geojson.与 includegeom参数,结合使用。参考includegeom的用法*/ realgeom?: boolean; /** 是否为包含关系, true为包含关系,false为相交关系,默认false. (传入了bounds进行范围查询时有效)*/ isContains?: boolean; } export type IControl = { onAdd(app: App): HTMLElement; onRemove(app: App): void; getDefaultPosition?: () => ControlPosition | string; }; export interface ICoordSystemModule { /** * 屏幕坐标转世界坐标 * @param x * @param y * @param opts (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 */ unproject: (x: number | Vector2, y?: number, opts?: UnProjectOpts) => Vector3 | undefined; /** * 屏幕坐标转世界坐标(同 unproject 函数,不同的地方是他支持通过后期处理的深度进行转换,是异步执行的) * @param x 屏幕坐标x * @param y 屏幕坐标y * @param opts (false 不用场景数据, true用场景数据) "depth" 后期处理的深度进行转换, 深度值 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面(默认xz平面) 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 * @param retIntersectObject 如果需要返回与哪个实体相交而转化的世界坐标,可传入一个object对象 */ unprojectAsync: (x: number, y: number, opts?: UnProjectOpts | "depth", retIntersectObject?: {}) => Promise; /** * 世界坐标转屏幕坐标 */ project: (x: number | Vector3, y?: number, z?: number) => Vector2; /** * 屏幕坐标转NDC坐标 */ screenToNdc: (x: number | Vector2, y?: number) => Vector2; /** * NDC坐标转屏幕坐标 */ ndcToScreen: (x: number | Vector2, y?: number) => Vector2; /** * 设置的中心点坐标 */ centerOrigin: Vector3 | undefined; /** * 开始缩放比例,x,y,z方向都同比例缩放,默认1 */ scaleOrigin: number | undefined; } /** * 获取创建实体的几何数据 */ export interface ICreateEntitiesGeomData { /** 文件文档. */ filedoc: string; /** 图形范围.如果不填的话,则使用全图范围 */ mapBounds?: [number, number, number, number]; /** 渲染精度,默认1,有时候图形特别大导致圆或圆弧精度不够时,不够光滑,可以先清空之前的缓存数据,再重新上传时,改变渲染精度来使圆或圆弧光滑些。注:提高精度会导致空间数据文件增大,渲染性能下降 */ renderAccuracy?: number; /** 返回的数据中排除属性数据( 默认true) */ excludeAttribute?: boolean; /** 返回的数据是否启用zip压缩( 默认true) */ useZip?: boolean; } export interface iCSMInternals { patchMap: iCSMPatchMap; fragmentShader: string; vertexShader: string; cacheKey: (() => string) | undefined; baseMaterial: T | InstanceType; instanceID: string; type: string; isAlreadyExtended: boolean; cacheHash: string; silent?: boolean; } export type iCSMParams = { baseMaterial: T | InstanceType; vertexShader?: string; fragmentShader?: string; cacheKey?: () => string; patchMap?: iCSMPatchMap; silent?: boolean; uniforms?: { [key: string]: IUniform; }; } & (MaterialParams extends undefined ? any : MaterialParams); export interface iCSMPatchMap { [keyword: string]: { [toReplace: string]: string; }; } export interface iCSMShader { defines: string; header: string; main: string; } export type iCSMUpdateParams = Partial, 'baseMaterial'>>; export interface ICSS2DRendererModule { /**渲染器 */ readonly css2dRenderer: CSS2DRenderer; /**获取所有的marker2d */ getMarker2Ds: () => Marker2D[]; /**获取所有的popup2d */ getPopup2Ds: () => Popup2D[]; /** 全局的popup对象 */ readonly popup2d: Popup2D; } export interface ICSS3DRendererModule { /**css3d渲染器 */ readonly css3dRenderer: CSS3DRenderer; /**能遮挡的css3d渲染器 */ readonly css3dOccludeRenderer: CSS3DRenderer; /** 设置3d物体能否被场景遮挡 */ setCss3dObjectCanOcclude: (object: CSS3DObject, canOcclude?: boolean) => void; } /** * Id * * https://tools.ietf.org/html/rfc7946#section-3.2 * If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of * the Feature object with the name 'id', and the value of this member is either a JSON string or number. */ type Id = string | number; /** * 清空地图缓存接口 */ export interface IDeleteCache { /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本, 如清空所有版本缓存,输入"*"号). */ version?: string; /** 匹配的键值. */ key?: string; } /** * 删除地图样式接口 */ export interface IDeleteStyle { /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本, 如删除所有版本,输入"*"号). */ version?: string; /** 样式名称.如删除所有样式,输入"*"号; 删除所有系统产生的样式,输入 "a*";内存打开的样式,输入"m*";几何打开的样式输入 "s*"*/ styleid: string; /** 是否只清空数据, false 删除表和数据; true 只删除数据. */ onlycleardata: boolean; } /** * 设置矩阵为单位矩阵 */ function identity(out: MatrixArray): MatrixArray; /** * Disposable interface for objects that can be disposed. Has a single method `dispose` */ export interface IDisposable { dispose(): void; } class Idle extends StateNode { static id: string; } class Idle_2 extends StateNode { static id: string; onPointerDown: (info: TLEventHandler) => void; onEnter: () => void; } class Idle_3 extends StateNode { static id: string; info: TransformEnterOptions; onPointerDownUp: (info: TLEventHandler) => void; onEnter: (info: TransformEnterOptions) => void; onKeyUp: (info: TLEventHandler) => void; } class Idle_4 extends StateNode { static id: string; info: PickEnterOptions; onPointerDownUp: (info: TLEventHandler) => void; onEnter: (info: PickEnterOptions) => void; onKeyUp: (info: TLEventHandler) => void; } export interface IDrawEditEnterOptions { /** 允许编辑的实体,默认绘制了的所有实体 */ queryEntities?: Entity[]; /** 进入时的编辑实体 */ editEntity?: Entity; /** 编辑实体的索引 */ editIndex?: number; /** 点击编辑时不显示顶点,默认false */ editShowVertex?: boolean; /** 平移时使用TransformControl控件,默认(false,需要按shift点击才显示) */ useTransformControl?: boolean; /** 顶点平移时使用TransformControl控件,默认(false,需要按shift点击才显示) */ useVertTransformControl?: boolean; /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 双击退出编辑,默认是 */ dblClickExitEdit?: boolean; /** 要编辑的绘图图层名称 默认为 draw */ drawLayerName?: string; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 开始选择一个实体 返回true将不允许选中编辑*/ onBeforeSelectEntity?: (info: InteractiveObject) => boolean; /** 开始编辑一个实体 */ onBeginEditEntity?: (entity: Entity, entIndex?: number, faceIndex?: number) => void; /** 取消编辑一个实体 */ onUnEditEntity?: (entity: Entity, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; /** 准备删除一个实体,如果返回为true将不会删除 */ onBeforeDeleteEntity?: (entity: Entity, data: any) => boolean; /** 删除一个实体 */ onDeleteEntity?: (entity: Entity, data: any, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; /** 准备移动一个实体,如果返回为true将不会移动 */ onBeforeMoveEntity?: (entity: Entity, data: any, offset: { dx: number; dy: number; dz: number; }) => boolean; /** 移动一个实体 */ onMoveEntity?: (entity: Entity, data: any, offset: { dx: number; dy: number; dz: number; }, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; /** 准备移动一个顶点,如果返回为true将不会移动 */ onBeforeMoveVertex?: (entity: Entity, data: any, newPoint: Vector3, entIndex: number, ptIndex: number) => boolean; /** 移动一个顶点 */ onMoveVertex?: (entity: Entity, data: any, newPoint: Vector3, entIndex: number, ptIndex: number, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; /** 完成回调 */ onComplete?: (info: TLEventType, from: string) => void; /** 键盘事件 */ onKeyUp?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; /** 右键上下文菜单回调 */ onContextMenu?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; }) => void; } export interface IDrawLineEnterOptions { /** 颜色 */ color?: ColorRepresentation; /** 透明度(0-1) */ opacity?: number; /** 是否显示顶点 */ showVertex?: boolean; /** 是否是虚线 */ dashed?: boolean; /** 线宽 */ lineWidth?: number; /** 虚线偏移量 */ dashOffset?: number; /** 虚线缩放量 */ dashScale?: number; /** 虚线尺寸 */ dashSize?: number; /** 间隙尺寸 */ gapSize?: number; /** 是否加入应用中,默认false */ isAddToApp?: boolean; /** 是否捕捉,默认是 */ isSnap?: boolean; /** 是否捕捉绘制图层上面的点,默认是 */ snapDrawLayerPoint?: boolean; /** 是否捕捉绘制的点,默认是 */ snapDrawPoint?: boolean; /** 自定义要加的捕捉的数据 */ snapData?: [number, number, number][]; /** 要捕捉的点默认透明度,默认0, 不可见,调试时,可将此值调高 */ snapStylePointOpacity?: number; /** 捕捉时像素大小,默认5 */ snapStylePixelSize?: number; /** 当达到这么多点的个数时自动完成退出 */ pointMaxCount?: number; /** 是否自动闭合 */ isClosed?: boolean; /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 右键时是否禁止弹出默认的屏幕空间至世界坐标的投影右键菜单设置 默认 false*/ disableUnProjectMenu?: boolean; /** 要绘制的绘图图层名称 默认为 draw */ drawLayerName?: string; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 按回车键完成 默认是 */ enterKeyComplete?: boolean; /** 按esc键取消 默认是 */ escKeyCancel?: boolean; /** 退出时直接退出至缺省工具,默认false */ isExitToDefaultTool?: boolean; /** 按delete键删除上一个点 默认是 */ deleteKeyDelPoint?: boolean; /** 键盘事件 */ onKeyUp?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => Promise; delPoint: () => void; /** 当前数据 */ data: PolylineItemData; /** 当前实体 */ polylines: PolylinesEntity; }) => void; /** 右键上下文菜单回调 */ onContextMenu?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => Promise; delPoint: () => void; /** 当前数据 */ data: PolylineItemData; /** 当前实体 */ polylines: PolylinesEntity; }) => void; /** 坐标更新前回调 */ beforeUpdateCoordinate?: (point: Vector3, isMoveing: boolean, info: TLEventHandler, isSnapPoint?: boolean) => Promise; /** 更新坐标回调 */ updateCoordinate?: (point: Vector3, isMoveing: boolean, data: PolylineItemData, polylines?: PolylinesEntity) => void; /** 完成回调 */ onComplete?: (isCancel: boolean, data: PolylineItemData) => void; } export interface IDrawPointEnterOptions { /** 顶点颜色 */ color?: ColorRepresentation; /** 顶点边框颜色 */ borderColor?: ColorRepresentation; /** 点大小 */ size?: number; /** 是否加入应用中,默认false */ isAddToApp?: boolean; /** 是否捕捉,默认是 */ isSnap?: boolean; /** 是否捕捉绘制图层上面的点,默认是 */ snapDrawLayerPoint?: boolean; /** 是否捕捉绘制的点,默认是 */ snapDrawPoint?: boolean; /** 自定义要加的捕捉的数据 */ snapData?: [number, number, number][]; /** 要捕捉的点默认透明度,默认0, 不可见,调试时,可将此值调高 */ snapStylePointOpacity?: number; /** 捕捉时像素大小,默认5 */ snapStylePixelSize?: number; /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 右键时是否禁止弹出默认的屏幕空间至世界坐标的投影右键菜单设置 默认 false*/ disableUnProjectMenu?: boolean; /** 要绘制的绘图图层名称 默认为 draw */ drawLayerName?: string; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 按esc键取消 默认是 */ escKeyCancel?: boolean; /** 退出时直接退出至缺省工具,默认false */ isExitToDefaultTool?: boolean; /** 键盘事件 */ onKeyUp?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => Promise; /** 当前数据 */ data: SymbolItemData; /** 当前实体 */ symbol: SymbolEntity; }) => void; /** 右键上下文菜单回调 */ onContextMenu?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => Promise; /** 当前数据 */ data: SymbolItemData; /** 当前实体 */ symbol: SymbolEntity; }) => void; /** 坐标更新前回调 */ beforeUpdateCoordinate?: (point: Vector3, isMoveing: boolean, info: TLEventHandler, isSnapPoint?: boolean) => Promise; /** 更新坐标回调 */ updateCoordinate?: (point: Vector3, isMoveing: boolean, data: SymbolItemData, symbol?: SymbolEntity) => void; /** 完成回调 */ onComplete?: (isCancel: boolean, data: SymbolItemData) => void; /** 增加完数据回调 返回false的话,将不加入地图中*/ /** 增加数据回调,如果返回false,将不会加入地图中 */ onAddData?: (data: SymbolItemData) => boolean; } export interface IDrawPolygonEnterOptions { /** 颜色 */ color?: ColorRepresentation; /** 透明度(0-1) */ opacity?: number; /** 颜色 */ borderColor?: ColorRepresentation; /** 是否显示顶点 */ showVertex?: boolean; /** 是否是虚线 */ dashed?: boolean; /** 是否加入应用中,默认false */ isAddToApp?: boolean; /** 是否捕捉,默认是 */ isSnap?: boolean; /** 是否捕捉绘制图层上面的点,默认是 */ snapDrawLayerPoint?: boolean; /** 是否捕捉绘制的点,默认是 */ snapDrawPoint?: boolean; /** 自定义要加的捕捉的数据 */ snapData?: [number, number, number][]; /** 要捕捉的点默认透明度,默认0, 不可见,调试时,可将此值调高 */ snapStylePointOpacity?: number; /** 捕捉时像素大小,默认5 */ snapStylePixelSize?: number; /** 当达到这么多点的个数时自动完成退出 */ pointMaxCount?: number; /** 绘制时显示边框线,默认是 */ showEdge?: boolean; /** 绘制边框线时样式 */ edgeStyle?: PolylineItemData; /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 右键时是否禁止弹出默认的屏幕空间至世界坐标的投影右键菜单设置 默认 false*/ disableUnProjectMenu?: boolean; /** 要绘制的绘图图层名称 默认为 draw */ drawLayerName?: string; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 按回车键完成 默认是 */ enterKeyComplete?: boolean; /** 按esc键取消 默认是 */ escKeyCancel?: boolean; /** 退出时直接退出至缺省工具,默认false */ isExitToDefaultTool?: boolean; /** 按delete键删除上一个点 默认是 */ deleteKeyDelPoint?: boolean; /** 键盘事件 */ onKeyUp?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => void; delPoint: () => void; /** 当前数据 */ data: PolygonItemData; /** 当前实体 */ polygon: PolygonsEntity; }) => void; /** 右键上下文菜单回调 */ onContextMenu?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: () => void; /** 如需要取消时调用 */ cancel: () => void; addPoint: (worldPos: Vector3, info?: TLEventHandler, isSnapPoint?: boolean, snapData?: SymbolItemData[]) => void; delPoint: () => void; /** 当前数据 */ data: PolygonItemData; /** 当前实体 */ polygon: PolygonsEntity; }) => void; /** 坐标更新前回调 */ beforeUpdateCoordinate?: (point: Vector3, isMoveing: boolean, info: TLEventHandler, isSnapPoint?: boolean) => Promise; /** 更新坐标回调 */ updateCoordinate?: (point: Vector3, isMoveing: boolean, data: PolygonItemData, polygon?: PolygonsEntity) => void; /** 完成回调 */ onComplete?: (isCancel: boolean, data: PolygonItemData) => void; } export interface IEntityManagerModule { getEntities: () => Entity[]; getRayQueryEntities: () => Entity[]; addSelectedEntity: (ent: Entity) => {}; removeSelectEntity: (ent: Entity) => {}; getSelectObjects: () => Object3D[]; getSelectObjectsRef: () => ShallowReactive; addBloomEntity: (ent: Entity) => {}; removeBloomEntity: (ent: Entity) => {}; getBloomObjects: () => Object3D[]; getBloomObjectsRef: () => ShallowReactive; addOutlineEntity: (ent: Entity) => {}; removeOutlineEntity: (ent: Entity) => {}; getOutlineObjects: () => Object3D[]; getOutlineObjectsRef: () => ShallowReactive; setSelectBoomRefreshFlag: () => void; } export interface IEntityModuleBase extends IAppModuleBase { onBeforeAdd?: () => any; onAdd?: () => any; onBeforeRemove?: () => any; onRemove?: () => any; onRayIntersect?: (ray: Raycaster) => Intersection[]; onMouseUp?: (event: InteractiveEvent) => any; onMouseMove?: (event: InteractiveEvent) => any; onMouseDown?: (event: InteractiveEvent) => any; onMouseClick?: (event: InteractiveEvent) => any; onMouseDblClick?: (event: InteractiveEvent) => any; onMouseOver?: (event: InteractiveEvent) => any; onMouseOut?: (event: InteractiveEvent) => any; onMouseEnter?: (event: InteractiveEvent) => any; onMouseLeave?: (event: InteractiveEvent) => any; onPointerDown?: (event: InteractiveEvent) => any; onPointerMove?: (event: InteractiveEvent) => any; onPointerUp?: (event: InteractiveEvent) => any; /** 鼠标直接按下松开,没有拖动 */ onPointerDownUp?: (event: InteractiveEvent) => any; onPointerCancel?: (event: InteractiveEvent) => any; onMouseWheel?: (event: InteractiveEvent) => any; onKeyDown?: (event: InteractiveEvent) => any; onKeyUp?: (event: InteractiveEvent) => any; setupUiConfig?: () => UiObjectConfig; } export interface IEntityQueryModule { /** * 通过相机查询实体 */ queryEntitiesByCamera: (option?: EntityQueryOption) => InteractiveObject; /** * 通过射线查询实体 */ queryEntitiesByRaycast: (ray: Ray, option?: EntityQueryOption) => InteractiveObject; /** * 通过屏幕像素坐标查询实体 */ queryEntitiesByScreenPos: (x: number, y: number, option?: EntityQueryOption) => InteractiveObject; /** * 通过框选查询实体 */ queryEntitiesByBox: (startPoint: Vector3, endPoint: Vector3, option?: EntityQueryOption, deep?: number) => InteractiveObject[]; /** * 通过屏幕坐标获取射线 */ getRayByScreenPos: (x: number, y: number, camera?: Camera) => Ray; /** * 获取查询的射线对象 */ getQueryRaycaster: () => Raycaster; } /** * A simple event interface with typed event types. */ export interface IEvent { type: T; target?: any; [attachment: string]: any; } /** * A simple event dispatcher interface with {@link IEvent} as event type. */ export interface IEventDispatcher { /** * Adds a listener to an event type. * @param type The type of event to listen to. * @param listener The function that gets called when the event is fired. */ addEventListener(type: T, listener: (event: IEvent) => void): void; /** * Checks if listener is added to an event type. * @param type The type of event to listen to. * @param listener The function that gets called when the event is fired. */ hasEventListener(type: T, listener: (event: IEvent) => void): boolean; /** * Removes a listener from an event type. * @param type The type of the listener that gets removed. * @param listener The listener function that gets removed. */ removeEventListener(type: T, listener: (event: IEvent) => void): void; /** * Fire an event type. * @param event.type The type of event that gets fired. */ dispatchEvent(event: IEvent): void; } /** * 导出布局空间为dwg图 */ export interface IExportLayout { /** 地图ID. */ mapid: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 布局索引,layoutIndex和layoutName只要输入一个就行,layoutIndex优先。如果都为空,则使用dwg当前的布局空间. */ layoutIndex?: string; /** 布局名称. layoutIndex和layoutName只要输入一个就行,layoutIndex优先。如果都为空,则使用dwg当前的布局空间. */ layoutName?: string; } /** * 表达式查询实体参数 */ export interface IExprQueryFeatures extends IQueryBaseFeatures { /** 表达式. */ expr: string; /** 记录开始位置. */ beginpos?: number; } /** * 自动提取图中表格参数 */ export interface IExtractTable { /** 地图ID. */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 图层样式名.为空时,将由选择的实体的图层来决定 */ layer?: string; /** 范围 [x1,y1,x2,y1] 为空表示此个图,否则为指定区域查询提取. */ bounds?: string; /** 查询条件(默认为所有线). */ condition?: string; /** 是否输出调试数据. */ debug?: boolean; /** 小数点计算精度. 正数表示精度为小数点后几位,负数表示精度为小数点前几位 默认为4 */ digit?: number; /** 误差值. 正数表示距离小于这个误差值就以为是直线(为零的话表示自动求误差值),负数表示自动获取的误差值比例倍数大小 默认为0自动*/ tol?: number; /** 表格边框最少点. 如果表格边框点数小于这个数将排查此表格. 默认 12*/ tableEdgeMinPoint?: number; /** 表格文本最少数. 如果表格中所有文本个数小于这个数将排查此表格. 默认 4*/ tableTextMinCount?: number; /** 单元格最大面积比.单元格面积占整体表格面积的比例不能超过这值,超过了此值,将不获取内容 . 默认 90*/ cellMaxArea?: number; /** 空值所占最小比例. 空值占所有表格的比例超过此值将排查此表格. 默认 90*/ cellEmptyRatio?: number; /** 单元格最大个数 允许的单元格最大个数,超过这值将排查此表格 . 默认 100000 */ tableMaxCellCount?: number; /** 线段中允许折线段数 默认情况下只提取水平线或垂直线,如果要允许折线,设置允许线段中折线的段数(非水平和垂直线段) . 默认 0 */ noHvLineSegCount?: number; /** 表格数据允许重复. 表格数据允许重复会尽可能搜索多的表格,但同一份数据可能在不同的表格中 默认false */ seachTableMost?: boolean; /** 查找子图范围 默认false */ findChildMapRects?: boolean; } type IfAny = 0 extends 1 & T ? Y : N; export class IgnoreFailureBehavior extends AbstractDecoratorBehavior { IgnoreFailureBehavior(): void; /** * * @param {Behavior} source * @return {IgnoreFailureBehavior} */ static from(source: Behavior): IgnoreFailureBehavior; tick(timeDelta: number): BehaviorStatus.Initial | BehaviorStatus.Running | BehaviorStatus.Succeeded | BehaviorStatus.Suspended | BehaviorStatus.Invalid; } export interface IHasDataEntity extends Entity { setData(data: any): void; getData(): any; } export interface IHasUpdate { update(): void; } export interface IInputModule { addPointerEventsObject: (entity: Entity) => {}; removePointerEventsObject: (entity: Entity) => {}; /** * 设置地图右键上下文菜单,运行时将触发 上下文菜单将要打开`contextMenuPreOpen`, 上下文菜单已打开`contextMenuOpened`, 上下文菜单打开无内容`contextMenuNoContent`事件 * @param menu 获取菜单的函数 * @param key 多次调用setMenu时,同样的key会覆盖之前的事件函数;有多个key时,调用次序为key的字母次序倒序;多次调用时,直到函数返回一个非null的ContextMenu为止 */ setMenu: (menu?: (event: InteractiveEvent | any, object?: InteractiveObject) => ContextMenu | null, key?: string) => void; Input: { /** 获取键是否开始按下 exam: getKeyDown("KeyW") */ getKeyDown: (keyCode: string) => boolean; /** 获取键是否按住 如 Space Enter ShiftLeft */ getKeyPressed: (keyCode: string) => boolean; /** 获取键是否松开 */ getKeyUp: (keyCode: string) => boolean; x: () => number; y: () => number; movementX: () => number; movementY: () => number; isMoving: () => boolean; isDragging: () => boolean; isLeftButtonDown: () => boolean; isLeftButtonPressed: () => boolean; isLeftButtonUp: () => boolean; isRightButtonDown: () => boolean; isRightButtonPressed: () => boolean; isRightButtonUp: () => boolean; isMidButtonDown: () => boolean; isMidButtonPressed: () => boolean; isMidButtonUp: () => boolean; enabled: () => boolean; setEnable: (b: boolean) => {}; /** 是否可用的响应式对象 */ enabledRef: () => Ref; /** 当前离鼠标最近的物体实体 */ closestObject: () => InteractiveObject | undefined | null; }; } /** * Interface for objects that can be serialized to JSON, with to and from JSON methods */ export interface IJSONSerializable { toJSON(meta?: TM): T; fromJSON(data: T, meta?: TM): this | null | Promise; } /** * 加载模型文件选项 */ export interface ILoadModelOption { /** 文件类型,默认通过文件后缀自动判断 */ fileType?: string; /** 是否使用缓存(默认否),是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 */ useCache?: boolean; /** 指定模型新的位置 */ position?: [number, number, number] | Vector3; /** 位置对齐 */ anchor?: Anchor3d; /** 当需要对齐时,模型的中心点位置 ,不设置将根据范围中心点计算*/ modelCenter?: Vector3; /** 位置偏移 */ offset?: [number, number, number] | Vector3; /** 指定模型大小值 */ size?: number; /** 缩放,如有size时,以size计算出的缩放为主 */ scale?: [number, number, number] | Vector3 | number; /** 旋转 */ rotation?: [number, number, number] | Vector3; /** 是否按组拆分成一个个子字体 */ splitSubEntity?: boolean; /** 如果满足条件时(根节点为group,下面只有一个子节点并且是mesh对象)是否自动转为mesh实体 (默认false) splitSubEntity为false时有效 */ autoAsMeshEntity?: boolean; /** 加载完回调 */ onLoad?: (data: any) => any; /** 自动转成实体对象,默认是 */ toEntity?: boolean; /** 地图模式下自动绕x轴旋转90度 (因为地图模式下是xy平面,而模型一般是xz平面绘制) */ isMapMode?: boolean; /** toEntity 为true时,做为一个group对象加入模型 */ asEntityGroup?: boolean; } /** * Convert an image {@link ImageBitmap} or {@link CanvasImageSource} to a base64 data url. * @param bitmap - image to convert * @param maxWidth - maximum width of the image (default: 8192). Images larger than this will be scaled down. This is because strings can get too long. * @param detachBitmap - detach the bitmap after conversion (default: false). This will free up bitmap memory if you don't need it anymore. * * See also {@link imageUrlToImageData} * * @category Images */ export function imageBitmapToBase64(bitmap: ImageBitmap | CanvasImageSource, maxWidth?: number, detachBitmap?: boolean): string; /** * Options for {@link imageToCanvas}. */ export interface ImageCanvasOptions { width: number; height: number; backgroundColor?: string; scale?: number; } /** * Converts an {@link ImageData} to a canvas. This creates a new canvas element and draws the image data on it. * Image Data can be created from image pixels like from gl.readPixels * This can be used to convert a WebGL texture/render target to a canvas/data url. * Note: if the output is flipped, use {@link canvasFlipY} after this, like `canvasFlipY(imageDataToCanvas(imageData))` * @param data - image data to convert */ export function imageDataToCanvas(data: ImageData): HTMLCanvasElement; type ImageLike = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement; interface ImagePatternObject extends PatternObjectBase { image: ImageLike | string; repeat?: ImagePatternRepeat; /** * Width and height of image. * `imageWidth` and `imageHeight` are only used in svg-ssr renderer. * Because we can't get the size of image in svg-ssr renderer. * They need to be give explictly. */ imageWidth?: number; imageHeight?: number; } type ImagePatternRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'; interface ImageProps extends DisplayableProps { style?: ImageStyleProps; onload?: (image: ImageLike) => void; } type ImageState = Pick & ElementCommonState; interface ImageStyleProps extends CommonStyleProps { image?: string | ImageLike; x?: number; y?: number; width?: number; height?: number; sx?: number; sy?: number; sWidth?: number; sHeight?: number; } /** * Converts an HTML image to a canvas. This creates a new canvas element and draws the image on it. * @param image - image to convert * @param backgroundColor - background color of the canvas * @param scale - scale of the canvas * @param width - width of the canvas * @param height - height of the canvas * @returns a new canvas element * * @category Images */ export function imageToCanvas(image: HTMLImageElement, { backgroundColor, scale, width, height }: ImageCanvasOptions): HTMLCanvasElement; /** * Downloads/parse the image from an url/data url and draw to an {@link ImageData} object. * @param url - url or data url of the image * @returns ImageData object * * See also {@link imageBitmapToBase64} * * @category Images */ export function imageUrlToImageData(url: string): Promise; /** * 比较地图不同 */ export interface IMapDiff { /** 地图一ID. */ mapid1: string; /** 地图一版本(为空时采用当前打开的地图版本). */ version1?: string; /** 地图一样式图层. */ layer1?: string; /** 地图二ID. */ mapid2: string; /** 地图二版本(为空时采用当前打开的地图版本). */ version2?: string; /** 地图二样式图层. */ layer2?: string; /** 不比较新增部分. */ noCompareNew?: boolean; /** 不比较删除部分. */ noCompareDelete?: boolean; /** 比较大小. */ size?: number; /** 比较单元大小. */ cellsize?: number; /** 不同的像素最小值. */ diffMinPixel?: number; /** 不同的透明最小值. */ diffMinAlpha?: number; /** 不同的颜色最小值. */ diffMinColor?: number; } /** * 地图图层 */ export interface IMapLayer { /** 图层名称. */ name: string; /** 颜色. */ color: string; /** 图层索引. */ index: number; /** 是否冻结. */ isFrozen: boolean; /** 是否锁定. */ isLocked: boolean; /** 图层是否关闭. */ isOff: boolean; /** 线宽. */ lineWeight: number; /** 线型. */ linetype: number; } /** * 地图样式参数参数 */ export interface IMapStyleParam { /** 样式名称. */ name?: string; /** 要开的图层索引列表,格式如[0,1,3]. */ layeron?: string | number[]; /** 要关的图层索引列表,格式如[2,4]. layeron与layeroff只要输入一个即可*/ layeroff?: string | number[]; /** 地图裁剪范围,范围如[x1,y1,x2,y2].如果只需入了数值的话,表示是缩放倍数 */ clipbounds?: [number, number, number, number] | number; /** 颜色. */ backcolor?: number; /** 线宽,格式如[1,1,1,1,0].表式第1,2,3,4级线宽开,第5级线宽关,大于第5级的,以最后设置的级别状态为主,所以也是关。如为空,则和原图线宽显示状态相同 */ lineweight?: string | number[]; /** 表达式. */ expression?: string; } /** * 目标匹配 */ export interface IMatchObject { /** 地图ID. */ mapid: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 图层样式名.为空时,将由选择的实体的图层来决定 */ layer?: string; /** 目标匹配的地图范围,默认为全图的数据范围. */ mapBounds?: string; /** 目标匹配的实体objectid数组,用||隔开. */ objectIds?: string; /** 目标匹配的实体范围 */ objectBounds: string; /** 目标匹配的地图打开的图层 */ layeron?: string; /** 匹配时的图像尺寸,默认10000 */ size?: number; /** 方法. 默认 matchPattern */ method?: "matchTemplate" | "matchPattern"; /** 允许返回的最大条数. 默认 200 */ maxCount?: number; /** 分数,小于此分类将不显示 (0 -1),默认 0.6 . */ score?: number; /** 金字塔大小 范围(64-2048).默认256, 方法为matchPattern有效*/ minReduceArea?: number; /** 允许重叠 (默认false). */ canOverlap?: boolean; /** 重叠比例 范围(0-0.8),默认 0.3. */ maxOverlap?: number; /** 角度范围(-180, 180)有旋转的时候需要。方法为matchPattern有效. 默认180*/ toleranceAngle?: number; /** 是否使用角度区间范围,默认false. 方法为matchPattern有效*/ useToleranceRange?: boolean; /** 角度区间1开始角度. 方法为matchPattern有效*/ tolerance1?: number; /** 角度区间1结束角度. 方法为matchPattern有效*/ tolerance2?: number; /** 角度区间2开始角度. 方法为matchPattern有效*/ tolerance3?: number; /** 角度区间2结束角度. 方法为matchPattern有效*/ tolerance4?: number; } export const iMaterialUI: { base: (material: any) => UiObjectConfig[]; blending: (material: any) => UiObjectConfig; polygonOffset: (material: any) => UiObjectConfig; aoLightMap: (material: any) => UiObjectConfig; misc: (material: any) => UiObjectConfig[]; roughMetal: (material: any) => UiObjectConfig; bumpNormal: (material: any) => UiObjectConfig; emission: (material: any) => UiObjectConfig; transmission: (material: any) => UiObjectConfig; clearcoat: (material: any) => UiObjectConfig; iridescence: (material: any) => UiObjectConfig; sheen: (material: any) => UiObjectConfig; }; export interface IModuleBase { onAwake?: (app?: any) => any; onEnable?: () => any; onDisable?: () => any; onDestroy?: () => any; [key: string]: any; } /** * Returns true if the array includes all the elements of the sub array * @param arr * @param subArr */ export function includesAll(arr: any[], subArr: IterableIterator): boolean; class IncrementalDisplayable extends Displayable { notClear: boolean; incremental: boolean; private _displayables; private _temporaryDisplayables; private _cursor; traverse(cb: (this: T, el: this) => void, context: T): void; useStyle(): void; getCursor(): number; innerAfterBrush(): void; clearDisplaybles(): void; clearTemporalDisplayables(): void; addDisplayable(displayable: Displayable, notPersistent?: boolean): void; addDisplayables(displayables: Displayable[], notPersistent?: boolean): void; getDisplayables(): Displayable[]; getTemporalDisplayables(): Displayable[]; eachPendingDisplayable(cb: (displayable: Displayable) => void): void; update(): void; getBoundingRect(): BoundingRect; contain(x: number, y: number): boolean; } /** * 查询数组中元素的index */ function indexOf(array: T[] | readonly T[] | ArrayLike_2, value: T): number; interface IndividualDelay { (index: number, count: number, fromPath: Path, toPath: Path): number; } export function infinityToMaxNumber(value: number): number; /** * 构造类继承关系 * * @param clazz 源类 * @param baseClazz 基类 */ function inherits(clazz: Function, baseClazz: Function): void; /** * Initializing a render2d instance * * @param dom Not necessary if using SSR painter like svg-ssr */ function init(dom?: HTMLElement | null, opts?: Render2DInitOpt): Render2D; class InputImpl { manager: InteractionManager; constructor(manager?: InteractionManager); getKeyDown(keyCode: any): boolean; getKeyPressed(keyCode: any): boolean; getKeyUp(keyCode: any): boolean; x(): number; y(): number; movementX(): number; movementY(): number; isMoving(): boolean; isDragging(): boolean; isLeftButtonDown(): boolean; isLeftButtonPressed(): boolean; isLeftButtonUp(): boolean; isRightButtonDown(): boolean; isRightButtonPressed(): boolean; isRightButtonUp(): boolean; isMidButtonDown(): boolean; isMidButtonPressed(): boolean; isMidButtonUp(): boolean; enabled(): boolean; setEnable(b: any): any; enabledRef(): Ref; closestObject(): InteractiveObject; } export class InputModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: InputModuleOptions; manager: InteractionManager; constructor(app?: App, options?: InputModuleOptions); setupUiConfig(): UiObjectConfig; addPointerEventsObject(entity: Entity): void; removePointerEventsObject(entity: Entity): void; onAwake(): void; get Input(): InputImpl; onAppAfterRender(): void; onAppAddEntity(ent: Entity): void; onAppRemoveEntity(ent: Entity): void; /** * 设置地图右键上下文菜单,运行时将触发 上下文菜单将要打开`contextMenuPreOpen`, 上下文菜单已打开`contextMenuOpened`, 上下文菜单打开无内容`contextMenuNoContent`事件 * @param menu 获取菜单的函数 * @param key 多次调用setMenu时,同样的key会覆盖之前的事件函数;有多个key时,调用次序为key的字母次序倒序;多次调用时,直到函数返回一个非null的ContextMenu为止 */ setMenu(menu?: (event: InteractiveEvent, object?: InteractiveObject) => ContextMenu | null | undefined, key?: string): void; } export interface InputModuleOptions { /** 在Body元素上绑定mousemove事件 默认 false */ bindEventsOnBodyElement?: boolean; clickTolerance?: number; /** 用于交互的地图对象 */ interactiveMapObject?: any; /** 禁止向地图往下传递事件的class名称 默认包含 mapstopprop*/ stopPropagationClassList?: string[]; /** 移动端长按3000ms,发送上下文菜单事件,如设置为0,则取消 */ longTouchMillSecond?: number; } /** * 实例化mesh实体 */ export class InstancedMeshEntity extends Entity { /** * 增加实例化对象,如果id为空,则自动增加,如存在,则修改 */ addInstance: (opts: { id: string; position?: Vector3; rotation?: Vector3; scale?: number | Vector3; color?: Color; computeBoundingSphere?: boolean; }) => string; /** * 根据id设置实例化对象属性,如不存在,则新增,如果id为空,则自动增加 */ setInstance: (opts: { id: string; position?: Vector3 | null; rotation?: Vector3 | null; scale?: number | Vector3 | null; color?: Color | null; computeBoundingSphere?: boolean; }) => string; /** * 根据一个id删除实例化对象 */ removeInstance: (id: string, computeBoundingSphere?: boolean) => void; /** * 获取实体化mesh列表 */ getInstancedMeshList: () => DynamicInstancedMesh[]; /** * 获取实体化的组对象 */ getGroup: () => Object3D; /** * 通过id获取索引 */ getIdByIndex: (index: number) => string; /** * 通过索引获取id */ getIndexById: (id: string) => number; /** * 设置实例高亮与否 * @param id id * @param highlightColor 高亮颜色,如果为null,则表示取消高亮 * @returns */ setInstanceHighlight: (id: string, highlightColor?: ColorRepresentation) => void; /** * 实例是否高亮 * @param id id * @returns */ isInstanceHighlight: (id: string) => boolean; /** * 清除所有实例高亮 * @param id id */ clearInstanceHighlight: () => void; /** * 获取实例属性 * @param id id * @returns */ getInstanceAttr: (id: string, key: string) => void; /** * 设置实例属性 * @param id id * @returns */ setInstanceAttr: (id: string, key: string, value: any) => void; /** * 获取实例的外包盒 * @param id id * @returns */ getInstanceBox3: (id: string) => Box3 | null; /** * 设置实例选择与否 */ setInstanceSelected: (id: string, isSelected?: boolean) => void; /** * 实例是否选中 * @param id id */ isInstanceSelected: (id: string) => boolean; /** * 清除所有实例选择 * @param id id * @returns */ clearInstanceSelected: () => void; /** * 设置实例辉光与否 */ setInstanceBloom: (id: string, isSelected?: boolean) => void; /** * 实例是否辉光 * @param id id */ isInstanceBloom: (id: string) => boolean; /** * 清除所有实例辉光 * @param id id * @returns */ clearInstanceBloom: () => void; /** * 设置实例描边与否 */ setInstanceOutline: (id: string, isSelected?: boolean) => void; /** * 实例是否描边 * @param id id */ isInstanceOutline: (id: string) => boolean; /** * 清除所有实例描边 * @returns */ clearInstanceOutline: () => void; constructor(options: InstancedMeshEntityOptions); /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type InstancedMeshEntityOptions = EntityOptions & InstancedMeshModuleOption; /** * 实例化mesh模块 */ export class InstancedMeshModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; meshList: Mesh[]; uuidList: string[]; matrixWorldList: Matrix4[]; instancedMeshList: DynamicInstancedMesh[]; instConfig: Record; idIndexMap: BidirectionalMap; onInstanceTransformChangedSignal: Signal; constructor(entity: Entity, options?: InstancedMeshModuleOption); /** * 增加实例化对象,如果id为空,则自动增加,如存在,则修改 * @returns */ addInstance(opts: { id: string; position?: Vector3; rotation?: Vector3; scale?: number | Vector3; color?: Color; computeBoundingSphere?: boolean; }): any; /** * 根据id设置实例化对象属性,如不存在,则新增,如果id为空,则自动增加 * @returns */ setInstance(opts: { id: string; position?: Vector3 | null; rotation?: Vector3 | null; scale?: number | Vector3 | null; color?: Color | null; computeBoundingSphere?: boolean; }): any; /** * 根据一个id删除实例化对象 * @returns */ removeInstance(id: string, computeBoundingSphere?: boolean): void; /** * 获取实体化mesh列表 * @returns */ getInstancedMeshList(): DynamicInstancedMesh[]; /** * 获取实体化的组对象 * @returns */ getGroup(): Group_2; /** * 通过id获取索引 * @returns */ getIdByIndex(index: number): string; /** * 通过索引获取id * @returns */ getIndexById(id: string): number; /** * 设置实例选择与否 * @param id id * @returns */ setInstanceSelected(id: string, isSelected?: boolean): void; /** * 实例是否选中 * @param id id * @returns */ isInstanceSelected(id: string): any; /** * 清除所有实例选择 * @returns */ clearInstanceSelected(): void; /** * 设置实例辉光与否 * @param id id * @returns */ setInstanceBloom(id: string, isBloom?: boolean): void; /** * 设置实例描边与否 * @param id id * @returns */ setInstanceOutline(id: string, isOutline?: boolean): void; /** * 清除所有实例描边 * @param id id * @returns */ clearInstanceOutline(): void; /** * 实例是否辉光 * @param id id * @returns */ isInstanceBloom(id: string): any; /** * 实例是否描边 * @param id id * @returns */ isInstanceOutline(id: string): any; /** * 清除所有实例辉光 * @returns */ clearInstanceBloom(): void; /** * 设置实例高亮与否 * @param id id * @param highlightColor 高亮颜色,如果为null,则表示取消高亮 * @returns */ setInstanceHighlight(id: string, highlightColor?: ColorRepresentation): void; /** * 实例是否高亮 * @param id id * @returns */ isInstanceHighlight(id: string): any; /** * 清除所有实例高亮 * @returns */ clearInstanceHighlight(): void; /** * 获取实例属性 * @param id id * @returns */ getInstanceAttr(id: string, key: string): any; /** * 设置实例属性 * @param id id * @returns */ setInstanceAttr(id: string, key: string, value: any): void; /** * 获取实例的外包盒 * @param id id * @returns */ getInstanceBox3(id: string): Box3; } export interface InstancedMeshModuleOption { mesh: Mesh | Group_2; maxCapacity?: number; instances: { id?: string; position?: Vector3; rotation?: Vector3; scale?: number | Vector3; color?: Color; [key: string]: any; }[]; } class InteractionManager { #private; renderer: Renderer; camera: Camera; domElement: HTMLElement; cameraControl: CameraControls; app: App; interactiveMapObject: any; bindEventsOnBodyElement: boolean; autoAdd: boolean; mouse: Vector2; supportsPointerEvents: boolean; allInteractiveObjects: InteractiveObject[]; interactiveObjects: InteractiveObject[]; closestObject: InteractiveObject | null; raycaster: Raycaster; treatTouchEventsAsMouseEvents: boolean; upKeys: Record; downKeys: Record; pressedKeys: Record; constructor(app: App, renderer: Renderer, camera: Camera, domElement: HTMLElement, interactiveMapObject?: any, cameraControl?: CameraControls, options?: InteractionManagerOptions); dispose: () => void; add: (object: Entity) => void; remove: (object: Entity) => void; updateInteractiveObjects(): void; _onRemoveScene(scene: any): void; update: () => void; onDocumentMouseMove: (mouseEvent: MouseEvent) => void; onDocumentPointerMove: (pointerEvent: PointerEvent) => void; onTouchMove: (touchEvent: TouchEvent) => void; onMouseClick: (mouseEvent: MouseEvent) => void; onMouseDblClick: (mouseEvent: MouseEvent) => void; onMouseDown: (mouseEvent: MouseEvent) => void; onContextMenu: (mouseEvent: MouseEvent) => void; onPointerDown: (pointerEvent: PointerEvent) => void; onPointerCancel: (pointerEvent: PointerEvent) => void; onTouchStart: (touchEvent: TouchEvent) => void; onMouseUp: (mouseEvent: MouseEvent) => void; onMouseWheel: (mouseEvent: MouseEvent) => void; onKeyDown: (keyboradEvent: KeyboardEvent) => void; onKeyUp: (keyboradEvent: KeyboardEvent) => void; onPointerUp: (pointerEvent: PointerEvent) => void; onTouchEnd: (touchEvent: TouchEvent) => void; dispatch: (object: InteractiveObject, event: InteractiveEvent) => void; sendEvent(object: InteractiveObject, event: InteractiveEvent): void; mapPositionToPoint: (point: Vector2, x: number, y: number) => void; setMouseMovement(evt: any): void; resetMouseMovement(): void; get x(): number; get y(): number; get movementX(): number; get movementY(): number; get isMoving(): boolean; get isDragging(): boolean; get isLeftButtonDown(): boolean; get isLeftButtonPressed(): boolean; get isLeftButtonUp(): boolean; get isRightButtonDown(): boolean; get isRightButtonPressed(): boolean; get isRightButtonUp(): boolean; get isMidButtonDown(): boolean; get isMidButtonPressed(): boolean; get isMidButtonUp(): boolean; get buttonDown(): any; get buttonPressed(): boolean; get buttonUp(): any; get enabled(): boolean; set enabled(value: boolean); get enabledRef(): Ref; } class InteractionManagerOptions { bindEventsOnBodyElement: boolean; clickTolerance?: number; /** 禁止向地图往下传递事件的class名称 默认包含 mapstopprop*/ stopPropagationClassList?: string[]; /** 移动端长按3000ms,发送上下文菜单事件,如设置为0,则取消 */ longTouchMillSecond?: number; constructor(options: { bindEventsOnBodyElement?: boolean | undefined; clickTolerance?: number; stopPropagationClassList?: string[]; }); } export class InteractiveEvent { type: string; cancelBubble: boolean; originalEvent: Event | null | MouseEvent; /** 地图原始事件 */ originMapEvent?: { lngLat: { lng: number; lat: number; }; originalEvent: Event | null; point: { x: number; y: number; }; target: any; type: string; }; coords: Vector2; distance: number; intersected: boolean; entity: Entity; intersection?: Intersection; [key: string]: any; constructor(type: string, originalEvent?: Event | null, originMapEvent?: any); stopPropagation(): void; } export class InteractiveObject { target: Entity; intersected?: boolean; wasIntersected?: boolean; distance?: number; intersection?: Intersection; constructor(target: Entity); } function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute; /** * 通过比例(0-1)的值,得到坐标序列的点坐标的值 * @param points 坐标序列 * @param ratio 比例 * @param options 选项 */ export function interpolatePointsByRatio(points: Array<[number, number, number]>, ratio: number, options?: { nextPoint?: [number, number, number]; remainingPoints?: [number, number, number][]; curRetIndex?: number; distance?: number; segmentDist?: number[]; }): [number, number, number][]; /** 插值类 */ export class Interpolation { options: InterpolationOptions; variogram: any; constructor(options: InterpolationOptions); invDist(x: number, y: number, z: number): number; /** 预测值 */ predict(x: number, y: number, z: number): number; /** 预测多个值 */ predicts(data: { x: number; y: number; z: number; }[]): number[]; variance(x: number, y: number, z: number): number; /** * search array max value * @param source */ max(source: number[]): number; /** * search array min value * @param source */ min(source: number[]): number; /** * get mean value from array number * @param source */ mean(source: number[]): number; /** * fill array with number * @param source * @param n */ rep(source: number, n: number): number[]; matrixDiag(c: number, n: number): number[]; matrixTranspose(X: any[], n: number, m: number): any[]; matrixAdd(X: number[], Y: number[], n: number, m: number): number[]; matrixMultiply(X: number[], Y: number[], n: number, m: number, p: number): number[]; matrixChol(X: number[], n: number): boolean; matrixChol2inv(X: number[], n: number): void; matrixSolve(X: number[], n: number): boolean; variogramGaussian(h: number, nugget: number, range: number, sill: number, A: number): number; variogramExponential(h: number, nugget: number, range: number, sill: number, A: number): number; variogramSpherical(h: number, nugget: number, range: number, sill: number): number; variogramCircle(h: number, nugget: number, range: number, sill: number): number; variogramLinear(h: number, nugget: number, range: number, sill: number): number; train(t: number[], x: number[], y: number[], z: number[], model?: "gaussian" | "exponential" | "spherical" | "circle" | "linear", sigma2?: any, alpha?: number): { t: number[]; x: number[]; y: number[]; z: number[]; nugget: number; range: number; sill: number; A: number; n: number; model: (h: number, nugget: number, range: number, sill: number, A: number) => number; K: any[]; M: any[]; }; _predict(x: number, y: number, z: number, variogram: { n: number; model: (arg0: number, arg1: any, arg2: any, arg3: any, arg4: any) => void; x: number[]; y: number[]; z: number[]; nugget: any; range: any; sill: any; A: any; M: number[]; }): number; _variance(x: number, y: number, z: number, variogram: { n: number; model: { (arg0: number, arg1: any, arg2: any, arg3: any, arg4: any): void; (arg0: number, arg1: any, arg2: any, arg3: any, arg4: any): number; }; x: number[]; y: number[]; z: number[]; nugget: any; range: any; sill: any; A: any; K: number[]; }): any; } export interface InterpolationOptions { /** 值数组 */ t: number[]; /** x数组 */ x: number[]; /** y数组 */ y: number[]; /** z数组 */ z: number[]; /** 使用反距离权重插值法 */ useInvDistWeight?: boolean; /** 反距离幂指数,用于控制距离和权重之间的关系 缺省值2 */ power?: number; /** 模型 */ model?: "gaussian" | "exponential" | "spherical" | "circle" | "linear"; /** sigma2是σ²,对应高斯过程的方差参数,也就是这组数据z的距离,方差参数σ²的似然性反映了高斯过程中的误差,并应手动设置。一般设置为 0 ,其他数值设了可能会出空白图 */ sigma2?: number; /** Alpha α对应方差函数的先验值,此参数可能控制钻孔扩散范围,越小范围越大,少量点效果明显,但点多了且分布均匀以后改变该数字即基本无效果了,默认设置为100 */ alpha?: number; } export class Interpreter extends BaseCompiler { constructor(); private executeCompiledGraph; run(graph: NodeGraph, context: ExecutionContext): void; build(graph: NodeGraph, context: ExecutionContext): string; } const INTERSECTED: ShapecastIntersection; const INTERSECTION: CSGOperation; /** * 两条三维线相交,求出最近的相交线坐标 * @param p1 * @param p2 * @param p3 * @param p4 * @param epsilon * @returns */ export const intersectLine3D: (p1: any, p2: any, p3: any, p4: any, epsilon: any) => Vector3[]; export class IntervalValue implements ValueGenerator { a: number; b: number; constructor(a: number, b: number); genValue(): number; type: 'value'; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): IntervalValue; clone(): ValueGenerator; } /** * 求逆矩阵 */ function invert(out: MatrixArray, a: MatrixArray): MatrixArray | null; /** * Inverts result of the source behavior, success becomes failure, failure becomes success */ export class InvertStatusBehavior extends AbstractDecoratorBehavior { /** * * @param {Behavior} source */ constructor(source: Behavior); /** * * @param {Behavior} source * @return {InvertStatusBehavior} */ static from(source: Behavior): InvertStatusBehavior; tick(timeDelta: number): BehaviorStatus; } /** * 地图打开参数 */ export interface IOpenMapBaseParam { /** 地图ID. */ mapid: string; /** 地图打开方式(缺省: GeomRender) . */ mapopenway?: MapOpenWay; /** 文件唯一ID. 地图ID第一次打开时,需传递fileid */ fileid?: string; /** 文件文档. */ filedoc?: string; /** 文件名称. */ filename?: string; /** 上传时的文件名. */ uploadname?: string; /** 秘钥(第一次上传打开图时有效,表示此图需要密码保护). */ secretKey?: string; /** 访问权限的key,权限小于secretKey,不能对图进行删除等操作. */ accessKey?: string; /** 要求输入密码回调. */ cbInputPassword?: (param: { mapid: string; isPasswordError: boolean; tryPasswordCount: number; result: any; }) => Promise; /** 地图来源参数. */ mapfrom?: string; /** 地图依赖项. */ mapdependencies?: string; /** 地图来源参数(这是子项的设置,与mapfrom不同的是,这个没有转化为基础图形,有可能还有依赖关系).如与mapfrom一样的话,则为空 */ subfrom?: string; /** 地图依赖项(这是子项的设置,与mapdependencies不同的是,这个没有转化为基础图形,有可能还有依赖关系).如与mapdependencies一样的话,则为空 */ subdependencies?: string; /** 渲染精度,默认1,有时候图形特别大导致圆或圆弧精度不够时,不够光滑,可以先清空之前的缓存数据,再重新上传时,改变渲染精度来使圆或圆弧光滑些。注:提高精度会导致空间数据文件增大,渲染性能下降 */ renderAccuracy?: number; /** 样式. */ style?: IMapStyleParam; /** 不使用缺省的字体文件,将使用缺省的型文件来代替字体文件. */ notUseDefaultTtfFont?: boolean; /** 不使用缺省的型文字文件,将使用缺省的字体来代替型文件. */ notUseDefaultShxFont?: boolean; /** 不自动替换线型. */ notReplaceLineType?: boolean; /** 字符替换规则. openMap返回的字段findFonts为系统查找的字体替换规则。如需修改默认的话,请传入替换的字体规则,如fontReplaceRule: {"tssdeng.shx_1": "_default_.ttc"}*/ fontReplaceRule?: Record | string; /** 图像左上角坐标x 第一次打开图像类型时有效*/ imageLeft?: number; /** 图像左上角坐标y 第一次打开图像类型时有效*/ imageTop?: number; /** 图像分辨率 第一次打开图像类型时有效, 一个像素单位代表多少地理长度,计算公式为 真实坐标长度 / 图像像素宽 */ imageResolution?: number; /** 判断是否打开或更新成功重试间隔(秒)。默认 5s 一次 */ openFinishTryInterval?: number; /** 判断是否打开或更新成功重试最大次数。默认 120 次 */ openFinishMaxTryCount?: number; /** 新建地图有fileDoc时有效 */ cadVersion?: string; /** 使用post方式打开 (默认使用get)*/ httpUsePost?: boolean; /** 使用3d视图打开 (默认自动)*/ open3dview?: boolean; /** 自定义扩展参数 */ extData?: Record; } /** * 地图打开参数 */ export interface IOpenMapParam extends IOpenMapBaseParam { /** 版本号(缺省: "" ). */ version?: string; /** 图层名称,组合图层用英文逗号分开 */ layer?: string; /** 布局索引 (从1开始),默认为0,表示是模型空间 */ layoutIndex?: number; } /** * 地图打开返回成功参数 */ export interface IOpenMapResponse { /** 地图ID. */ mapid?: string; /** 版本号(缺省: "" ). */ version?: string; /** 图层名称 */ layer?: string; /** 地图打开方式(缺省: GeomRender) . */ mapopenway?: MapOpenWay; /** DbID. */ dbid?: string; /** 文件唯一ID. */ fileid?: string; /** 文件名称. */ filename?: string; /** 地图范围(如果通过clipBounds打开,则是clipBounds的范围). */ bounds?: GeoBounds; /** 地图范围(地图的范围,如果没有通过clipBounds打开,则为空). */ mapBounds?: GeoBounds; /** 数据库地图范围*/ dbBounds?: GeoBounds; /** 图形中有数据的范围(此范围是非精确值,精确的数据范围需调用cmdGetDrawBounds去获取)*/ drawBounds?: GeoBounds; /** 图层样式. */ styles?: any; /** 图层列表. */ layers?: any; /** 地图类型. 为空时表示是cad类型,image表示是图像 */ maptype?: string; /** 状态. */ status?: string; /** 暗黑模式(背景色为黑时). */ darkMode?: boolean; /** 类型. */ type?: string; /** ucs基点坐标. */ ucsorg?: string; /** 上传的文件名. */ uploadname?: string; /** 描述. */ description?: string; /** 默认是否显示线宽. */ lineWidthDisplay?: boolean; /** 所有布局. */ layouts?: string[]; /** 地图来源参数. */ mapfrom?: string; /** 地图依赖项. */ mapdependencies?: string; /** 地图来源参数(这是子项的设置,与mapfrom不同的是,这个没有转化为基础图形,有可能还有依赖关系).如与mapfrom一样的话,则为空 */ subfrom?: string; /** 地图依赖项(这是子项的设置,与mapdependencies不同的是,这个没有转化为基础图形,有可能还有依赖关系).如与mapdependencies一样的话,则为空 */ subdependencies?: string; /** 渲染精度,默认1,有时候图形特别大导致圆或圆弧精度不够时,不够光滑,可以先清空之前的缓存数据,再重新上传时,改变渲染精度来使圆或圆弧光滑些。注:提高精度会导致空间数据文件增大,渲染性能下降 */ renderAccuracy?: number; /** 初始视图缩放倍数,bounds * initViewScale = dbBounds */ initViewScale?: number; /** 初始视图. */ view?: { /** 初始视图中心点. */ center?: [number, number]; /** 初始视图级别. */ zoom?: number; /** 初始视图方位角. */ bearing?: number; }; /** 图像类型时最大级别 */ maxzoom?: number; /** 图像类型时图像像素宽 */ imageWidth?: number; /** 图像类型时图像像素高 */ imageHeight?: number; /** 图像左上角坐标x */ imageLeft?: number; /** 图像左上角坐标y */ imageTop?: number; /** 图像分辨率 一个像素单位代表多少地理长度,计算公式为 真实坐标长度 / 图像像素宽 */ imageResolution?: number; /** 是否是3d地图 */ isMap3d?: boolean; /** 创建时间 */ createTime?: string; /** 空间数据记录条数 */ geomRecordCount?: string; } export interface IOrbitControlModule { /** 相机控制器 */ readonly cameraControl: CameraControls; /** 是否启用相机控制器 */ enableCameraControl: boolean; /** 相机控制器响应式对象 */ enableCameraControlRef: Ref; /** 当相机禁止时还允许滚轮进行缩放操作 */ enableWheelWhenCtrlDisabled: boolean; } export interface IParticle { /** * Position of the particle. * @type {Vector3} */ position: Vector3; /** * Velocity of the particle. * @type {Vector3} */ velocity: Vector3; /** * Age of the particle. * @type {number} */ age: number; /** * Life duration of the particle. * @type {number} */ life: number; /** * Size of the particle. * @type {number} */ size: number; /** * Rotation of the particle. * @type {number | Quaternion} */ rotation?: number | Quaternion; /** * UV tile index. * @type {number} */ uvTile: number; /** * Color of the particle. * @type {Vector4} */ color: Vector4; /** * Indicates if the particle has died. * @type {boolean} */ get died(): boolean; } export interface IParticleRenderModule { readonly particleRenderer: BatchedRenderer; /** * 增加粒子系统 * @param system 粒子系统参数 * @param parent parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 * @param disposeWhenEnd 当结束时自动删除,默认为true * @returns */ addParticleSystem: (system: IParticleSystem, parent?: Object3D, disposeWhenEnd?: boolean) => void; /** 增加粒子 */ addParticle: (opts: { /** 粒子系统参数 */ system: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; }) => ParticleEmitter; /** 从文件加载粒子场景 */ loadParticle: (url: string, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 加载完json的回调 可对json进行修改 */ onData?: (data: any) => any; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; crossOrigin?: string; withCredentials?: boolean; urlPath?: string; resourcePath?: string; requestHeader?: { [header: string]: string; }; }) => Promise>; /** 从JSON字符串加载粒子场景 */ loadParticleFromJson: (json: string | JSON, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; /** 加载数据完成回调 */ onData?: (data: any) => any; }) => ParticleEmitter; /** 从资源加载粒子场景 */ loadParticleFromRes(obj: Object3D, opts?: { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** parent 为null时,将不加入场景,如不填或undefined,则加入场景,如指定parent,则加至此parent节点中 */ parent?: Object3D; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; }): ParticleEmitter; removeParticle(obj: ParticleEmitter): any; } export interface IParticleSystem { /** * Whether the system is in world space. * @type {boolean} */ worldSpace: boolean; /** * Number of particles. * @type {number} */ particleNum: number; /** * Duration of the system. * @type {number} */ duration: number; /** * Whether the system is looping. * @type {boolean} */ looping: boolean; /** * Array of particles. * @type {Array} */ particles: Array; /** * Emitter for the particles. * @type {ParticleEmitter} */ emitter: ParticleEmitter; /** * Optional renderer. * @type {BatchedRenderer} */ _renderer?: BatchedRenderer; instancingGeometry: BufferGeometry; rendererEmitterSettings: RendererEmitterSettings; getRendererSettings(): VFXBatchSettings; paused: boolean; pause(): void; play(): void; restart(): void; clone(): IParticleSystem; toJSON(metaData: any, options: SerializationOptions): any; signal: { onRestart: Signal; onPlay: Signal; onPause: Signal; onEnd: Signal; }; dispose(): void; } export interface IPhysicsManagerModule { /** 是否能用物理引擎 */ physicsEnable: boolean; /** 得到物理引擎世界对象 */ readonly physicsWorld: World; /** 得到物理引擎对象 */ readonly physicsEngine: typeof CANNON; /** 启动物体引擎 */ enablePhysicsEngine(): Promise; /** 增加物理碰撞体 */ addPhysicsBody(phyObject: MeshPhysicsObjectParams): MeshPhysicsObjectParams; /** 通过实体或对象移除物理刚体 */ removePhysicsObject(object: Object3D | Entity): any; /** 增加一个物理地面 */ addPhysicsGround(): CANNON.Plane; /** 设置物理引擎调试 */ setPhysicsDebugger(enable: boolean): void; } export interface IPickModule { /** * 当前应该是否处于自由状态 */ isFreeStatus: boolean; /** * 自由状态响应式对象 */ isFreeStatusRef: Ref; /** * 拾取一个点 */ pickPoint: (opts?: PickPointOptions) => Promise<{ cancel: boolean; point?: Vector3; reason?: string; intersectObject?: any; event?: InteractiveEvent; }>; /** * 拾取实体 */ pickEntity: (opts?: PickEntityOptions) => Promise<{ cancel: boolean; entities: Entity[]; reason?: string; clearHighlight: Function; }>; /** * 绘制一个选择框 */ drawSelectBox: (style?: Record) => Promise<{ cancel: boolean; reason?: string; } | [Vector2, Vector2]>; /** * 绘制一个点,获取点坐标 */ actionDrawPoint: (opts?: IDrawPointEnterOptions) => Promise<{ isCancel?: boolean; data: SymbolItemData; }>; /** * 绘制一条线,获取线坐标 */ actionDrawLineSting: (opts?: IDrawLineEnterOptions) => Promise<{ isCancel?: boolean; data: PolylineItemData; }>; /** * 绘制一个多边形,获取多边形坐标 */ actionDrawPolygon: (opts?: IDrawPolygonEnterOptions) => Promise<{ isCancel?: boolean; data: PolygonItemData; }>; actionDrawEdit: (opts?: IDrawEditEnterOptions) => Promise<{}>; /** 选中一个实体对象 */ actionPickSelect: (opts?: PickEnterOptions) => Promise<{ isCancel: boolean; info?: TLEventHandler; select?: InteractiveObject; }>; /** 通过图层名称获取当前绘图层的实体 */ getDrawLayer: (layerName?: string, noCreateStyle?: Record) => { symbol: () => SymbolEntity | undefined; polylines: () => PolylinesEntity | undefined; polygons: () => PolygonsEntity | undefined; addPointData: (data: SymbolItemData, addToCommand?: boolean) => SymbolEntity; addPolylineData: (data: PolylineItemData, addToCommand?: boolean) => PolylinesEntity; addPolygonData: (data: PolygonItemData, addToCommand?: boolean) => PolygonsEntity; updatePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; updatePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; updatePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; deletePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; deletePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; deletePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; }; } /** * 点查询实体参数 */ export interface IPointQueryFeatures extends IQueryBaseFeatures { /** 查询的坐标X. */ x: number; /** 查询的坐标Y. */ y: number; /** 像素大小. */ pixelsize?: number; /** 条件. */ condition?: string; /** 返回最大的几何字节数. */ maxGeomBytesSize?: number; /** 当前一个像素表示多少几何长度,如果输入了此值,则为此值为主,否则,根据输入的zoom值后台自动计算. */ pixelToGeoLength?: number; } export interface IPostProcessModule { /**效果合成器 */ readonly composer: EffectComposer; /**效果合成器是否可用 */ isComposerEnable: () => boolean; /** 设置效果合成器是否可用 */ setComposerEnable: (b: boolean) => void; /** 给效果合成器增加渲染通道 */ addEffectRenderPass(pass: Pass, orderIndex?: number): any; /** 给效果合成器移除渲染通道 */ removeEffectRenderPass(pass: Pass): any; /** 刷新渲染通道 foreceUpdate是否强制更新*/ refreshEffectRenderPass(foreceUpdate?: boolean): any; /** 根据屏幕坐标获取深度值 */ getDepth: (x: number, y: number) => Promise; /** OutlineEffect */ readonly outlineEffect: OutlineEffect; /** bloomEffect */ readonly bloomEffect: BloomEffect; /** selectedEffect */ readonly selectedEffect: OutlineEffect; } /** * 查询实体参数 */ export interface IQueryBaseFeatures { /** 当前级别. */ zoom?: number; /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 图层名称(为空时采用当前打开的地图图层名称). */ layer?: string; /** 返回最多的记录条数. */ limit?: number; /** 是返回的字段列表,多个之是用逗号,分开,如. "name,objectid" */ fields?: string; /** 是否为几何图形查询. */ geom?: boolean; /** GeoJSON几何数据简化墨托卡距离,默认为零,不简化。例如允许10级别以上一个像素级别的误差,可用 map.pixelToGeoLength(1, 10) * vjmap.Projection.EQUATORIAL_SEMIPERIMETER * 2 / map.getGeoBounds(1.0).width() */ simplifyTolerance?: boolean; /** 启动cache(内存打开的图形有效). */ useCache?: boolean; /** 查询返回的坐标默认为墨卡托坐标,返回会程序会自动转化为cad坐标,如果要直接返回cad地图坐标,需要把toMapCoordinate设置为true. */ toMapCoordinate?: boolean; } export interface IRectCollide { getBoundingRect: () => { /** 像素左上角x */ x1: number; /** 像素左上角y */ y1: number; /** 像素右上角x */ x2: number; /** 像素右上角y */ y2: number; /** 像素旋转中心点x */ cx: number; /** 像素旋转中心点y */ cy: number; /** 旋转角度(0-360) */ rotation: number; /** 坐标位置 */ position: Vector3; /** 排序index(越大越在上面) */ zIndex?: number; /** 同一个id会一起显示和隐藏 */ id?: string; /** 组名 会对同一个组名内的进行碰撞检测 */ groupName?: string; /** 显示隐藏对象回调函数 */ setVisible: (b: boolean) => any; } | null; } export interface IRectCollideModule { /** 增加碰撞检测的对象 */ addCollideRectObject: (item: IRectCollide) => void; /** 移除碰撞检测的对象 */ removeCollideRectObject: (item: IRectCollide) => void; /** 更新碰撞检测 */ updateCollideRect: () => void; /** 设置更新碰撞检测为脏数据,使其重新检测 */ setCollideRectDirty: () => void; } /** * 矩形查询实体参数 */ export interface IRectQueryFeatures extends IQueryBaseFeatures { /** 查询的坐标X1. (如果x1,y1,x2,y2同时不输的话,表示是查询整个图的范围 */ x1?: number; /** 查询的坐标Y1. */ y1?: number; /** 查询的坐标X2. */ x2?: number; /** 查询的坐标Y2. */ y2?: number; /** 条件. */ condition?: string; /** 返回最大的几何字节数. */ maxGeomBytesSize?: number; } export interface IRequest { get: (url: string, params?: Record, args?: Partial) => Promise; put: (url: string, data: any, args?: Partial) => Promise; post: (url: string, data: any, args?: Partial) => Promise; patch: (url: string, data: any, args?: Partial) => Promise; del: (url: string, args?: Partial) => Promise; options: (url: string, args?: Partial) => Promise; } export function isAltKeyDown(event?: any): boolean; function isArray(value: any): value is any[]; /** * Consider typed array. * @param data */ function isArrayLike(data: any): data is ArrayLike_2; function isBuiltInObject(value: any): boolean; export interface ISceneModule { /** 增加场景 */ addScene: (scene?: Scene, camera?: CameraOptions) => Scene; /** 切换场景 */ activeScene: (_scene: Scene) => Promise; /** 设置场景,(将删除之前场景,增加此场景此把此场景设置为当前场景) */ setScene: (scene?: Scene, camera?: CameraOptions) => Promise; /** 移除场景 */ removeScene: (_scene: Scene) => Promise; /** 初始化场景 */ initScene(scene: Scene): any; /** 清空所有场景 */ clearScenes(): any; /** 场景实体 */ readonly sceneEntity: Entity; /** 增加缺省灯光 */ addDefaultLights: (scene?: Scene) => {}; /** 获取场景的统计数据 */ getSceneStatData: () => { /** 物体对象数 */ objects: number; /** 顶点数 */ vertices: number; /** 三角形数 */ triangles: number; }; /** 环境变量 */ readonly envConfig: EnvConfigOption & { [key: string]: any; }; /** 设置环境变量 */ setEnvConfig: (key: keyof EnvConfigOption | string, value: any) => void; /** 设置场景背景及环境参数 */ setBackgroundEnvironment: (options?: BackgroundEnvironmentOptions) => Promise; /** 获取焦点 */ setFocus: () => void; /** 加载资源数组 */ loadResources: (_resources: ResourceItem[], options?: loadResourcesOptions) => Promise; /** 获取通过loadResources已加载的资源 */ getLoadedResources: () => RosourceItemsReturnType; } function isCombineMorphing(path: Element_2): path is CombineMorphingPath; export function isCtrlKeyDown(event?: any): boolean; export function isDeleteKey(event?: any): boolean; function isDom(value: any): value is HTMLElement; export function isEnterKey(event?: any): boolean; export function isEscKey(event?: any): boolean; function isFunction(value: any): value is Function; /** * A {@link GeoPointLike} object, an array of two numbers representing longitude and latitude, * or an object with `lng` and `lat` or `lon` and `lat` properties. * * Example: * ```typescript * const center = { lat: 53.3, lng: 13.4 }; * mapView.geoCenter = GeoCoordinates.fromLatLng(center); * ``` */ export function isGeoPointLike(geoPoint: any): geoPoint is GeoPointLike; function isGradientObject(value: any): value is GradientObject; function isImagePatternObject(value: any): value is ImagePatternObject; export function isLeftButton(event?: any): boolean; /** * 获取图片切片缓存级别 */ export interface ISliceCacheZoom { /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 图层名称(为空时采用当前打开的地图图层名称) */ layer?: string; /** 是否是矢量切片,如果否则为栅格瓦片切片 */ ismvt: boolean; } /** * 对图层进行切片 */ export interface ISliceLayer { /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 图层名称(为空时采用当前打开的地图图层名称).如果为数组时,表示对多个图层进行切片 */ layer: string | string[]; /** 级别(切的第几级), 如果为数组时,layer也必须是数组,一一对应 */ zoom: number | number[]; /** 是否是矢量切片,如果否则为栅格瓦片切片. 如果为数组时,layer也必须是数组,一一对应 */ ismvt: boolean | boolean[]; /** 是否取消对此图层的切片(正在切时有效). */ iscancel?: boolean; /** 是否取消所有的切片(正在切时有效). */ isAllCancel?: boolean; /** 批处理的条数(默认10000). */ batchNum?: number; /** 空闲一次批处理等待时间(默认1ms). */ idleBatchSleepMs?: number; /** 繁忙时一次批处理等待时间(默认10000ms). */ busyBatchSleepMs?: number; } export const isMapMode: (app?: App) => boolean; export function isMiddleButton(event?: any): boolean; function isMorphing(el: Element_2): boolean; function isNumber(value: any): value is number; function isObject(value: T): value is (object & T); /** * 物体是否在相机后面 */ export function isObjectBehindCamera(el: Object3D, camera: Camera, isMapMode?: boolean): boolean; /** * 物体是否被遮挡 */ export function isObjectOcclude(el: Object3D, camera: Camera, raycaster: Raycaster, occlude: Object3D[]): boolean; class Isogon extends Path { shape: IsogonShape; constructor(opts?: IsogonProps); getDefaultShape(): IsogonShape; buildPath(ctx: CanvasRenderingContext2D, shape: IsogonShape): void; } interface IsogonProps extends PathProps { shape?: Partial; } class IsogonShape { x: number; y: number; r: number; n: number; } /** * 拆分子图参数 */ export interface ISplitChildMaps { /** 地图ID. */ mapid?: string; /** 文件ID. (有mapid,优先使用mapid,没有mapid,使用fileid) */ fileid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 每个子图拆分后是否全图. 默认false */ isFullExtent?: boolean; /** 子图范围数组. ["x1,y1,x2,y2", "x1,y1,x2,y2", ...] */ clipBounds: string[]; /** 方法 cloneObjects 通过深度克隆实体,效率最快(默认), cloneDb 通过克隆文档数据库,效率较快;cloneMap 通过克隆图,效率较慢,但最能保持原样*/ method?: "cloneObjects" | "cloneDb" | "cloneMap"; /** 是否启动新进程处理(不影响主进程,看初始速度慢些) 默认true */ startNewProcess?: boolean; } /** * 判断点是否在多边形内。 * @param pos 点 * @param polygon 多边形坐标 * @return {boolean} */ export const isPointInPolygon: (pos: GeoPoint, polygon: GeoPoint[]) => boolean; function isPrimitive(obj: any): boolean; /** * Check if property is writable in object or its prototype chain * @param object - object to check * @param prop - property to check * @param allowWritable - allow writable properties without setter * @param allowAny - allow any property (even if it doesn't exist) * * @category JS Object */ export function isPropertyWritable(object: T, prop: keyof T, allowWritable?: boolean, allowAny?: boolean): boolean; /** * Checks if an object is a proxy created by {@link reactive}, * {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}. * * @param value - The value to check. */ function isProxy(value: unknown): boolean; /** * Checks if an object is a proxy created by {@link reactive()} or * {@link shallowReactive()} (or {@link ref()} in some cases). * * @example * ```js * isReactive(reactive({})) // => true * isReactive(readonly(reactive({}))) // => true * isReactive(ref({}).value) // => true * isReactive(readonly(ref({})).value) // => true * isReactive(ref(true)) // => false * isReactive(shallowRef({}).value) // => false * isReactive(shallowReactive({})) // => true * ``` * * @param value - The value to check. */ function isReactive(value: unknown): boolean; /** * Checks whether the passed value is a readonly object. The properties of a * readonly object can change, but they can't be assigned directly via the * passed object. * * The proxies created by {@link readonly()} and {@link shallowReadonly()} are * both considered readonly, as is a computed ref without a set function. * * @param value - The value to check. */ function isReadonly(value: unknown): boolean; /** * Checks if a value is a ref object. * * @param r - The value to inspect. */ function isRef(r: Ref | unknown): r is Ref; function isRegExp(value: unknown): value is RegExp; export function isRightButton(event?: any): boolean; function isShallow(value: unknown): boolean; export function isShiftKeyDown(event?: any): boolean; function isString(value: any): value is string; function isStringSafe(value: any): value is string; export interface IStatModule { /** 是否显示统计 */ showStat: boolean; } function isTypedArray(value: any): boolean; /** * Check if the browser supports exporting to webp, with the canvas.toDataURL('image/webp') method. */ export function isWebpExportSupported(): boolean; type IterableCollections = Map | Set; const ITERATE_KEY: unique symbol; /** * 地图瓦片参数 */ export interface ITileUrlParam { /** 地图ID. */ mapid?: string; /** 版本号. */ version?: string; /** 图层名称. */ layer?: string; /** 文件唯一ID. */ fileid?: string; } export interface IToolStateModule { readonly rootState: StateNode; getStatePath: () => string; stateIsIn: (path: string) => boolean; stateInAny: (...paths: string[]) => boolean; setCurrentTool: (id?: string, info?: Record) => App; getCurrentTool: () => StateNode; getCurrentToolId: () => string; getStateDescendant: (path: string) => T | undefined; addTool: (Tool: TLStateNodeConstructor) => void; removeTool: (Tool: TLStateNodeConstructor) => void; /** * 判断当前是否有工具处于运行中 */ isInActiveTool: () => boolean; /** * 是否正在交互 */ isInteracting(): boolean; /** * 对一个物体进行变换控制器操作 */ transformObject: (options: TransformEnterOptions) => Promise; } export interface IUiConfigContainer { uiConfig?: UiObjectConfig; } export interface IUiModule { /** * 增加控件 (会调用 `control.onAdd(this)` ). * * @param control 需要增加的控件. * @param {string} [position] 位置. 'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'` */ addControl: (control: IControl, position?: ControlPosition) => App; /** * 移除控件. * * @param {IControl} control 要移除的控件. */ removeControl: (control: IControl) => App; /** * 是否有控件. * * @param {IControl} control 要查询的控件. */ hasControl: (control: IControl) => void; /** * 设置光标 * @param cur 光标名称 */ setCursor: (cur: string) => void; /** * 获取配置面板 */ getConfigPane: (opts?: { /** 是否清空,默认是 */ isReset?: boolean; /** 标题 */ title?: string; /** 样式 */ style?: Partial; }) => Promise<{ configPane: any; rootPane: any; element: HTMLElement; isInit: boolean; setVisible: (b: boolean) => void; isVisible: () => boolean; reset: () => void; appendChild: (config?: UiObjectConfig, params?: UiObjectConfig) => any; renderUiConfig: (uiConfig: UiObjectConfig) => void; renderUiObject: (uiConfig: UiObjectConfig, parent?: any) => any; }>; /** * 信息弹窗提示 * text(必填):需要输出的文本 * type(可选):输出类型 默认是 "log" * time(可选):停留时间 默认是 2500 */ logInfo: (text: string, type?: logInfoType | number, time?: number) => void; } export interface IUniformB { value: boolean; } export interface IUniformColor { value: Color; } export interface IUniformN { value: number; } export interface IUniformNArray { value: number[]; } export interface IUniformTexture { value: Texture | null; } export interface IUniformV2 { value: Vector2; } export interface IUniformV3 { value: Vector3; } export interface IUniformV3Array { value: Vector3[]; } /** * 更新地图参数 */ export interface IUpdateMapParam extends IOpenMapBaseParam { /** 是否删除老版本(缺省: false ). */ deleteOldVersion?: boolean; } /** * 更新样式接口 */ export interface IUpdateStyle { /** 地图ID(为空时采用当前打开的mapid). */ mapid?: string; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string; /** 样式名称. */ name?: string; /** 要开的图层索引列表,格式如[0,1,3]. */ layeron?: string | number[]; /** 要关的图层索引列表,格式如[2,4]. layeron与layeroff只要输入一个即可*/ layeroff?: string | number[]; /** 地图裁剪范围,范围如[x1,y1,x2,y2].如果只有数字的话,表示是缩放系数 */ clipbounds?: [number, number, number, number] | number; /** 颜色. */ backcolor?: number; /** 线宽,格式如[1,1,1,1,0].表式第1,2,3,4级线宽开,第5级线宽关,大于第5级的,以最后设置的级别状态为主,所以也是关。如为空,则和原图线宽显示状态相同 */ lineweight?: string | number[]; /** 表达式. */ expression?: string; } export interface IWebGLRendererModule { /** 渲染器 */ readonly renderer: WebGLRenderer; /** 获取渲染截图 */ getScreenshot: (params?: Screenshot) => Promise; /** 地图模式 */ readonly isMapMode: boolean; readonly commonUniforms: { time: { value: Vector4; }; resolution: { value: Vector2; }; }; } /** * wms服务url地址接口 */ export interface IWmsTileUrl { /** 地图ID(为空时采用当前打开的mapid), 为数组时表时同时请求多个. */ mapid?: string | string[]; /** 地图版本(为空时采用当前打开的地图版本). */ version?: string | string[]; /** 图层名称(为空时采用当前打开的地图图层名称). */ layers?: string | string[]; /** 范围,缺省{bbox-epsg-3857}. (如果要获取地图cad一个范围的wms数据无需任何坐标转换,将此范围填cad范围,srs,crs,mapbounds填为空).*/ bbox?: string; /** 当前坐标系,缺省(EPSG:3857). */ srs?: string; /** cad图的坐标系,为空的时候由元数据坐标系决定. 也可直接输入proj4字符串*/ crs?: string | string[]; /** 地理真实范围,如有值时,srs将不起作用 */ mapbounds?: string; /** 宽. */ width?: number; /** 高. */ height?: number; /** 是否透明. */ transparent?: boolean; /** 不透明时的背景颜色,默认为白色。格式必须为rgb(r,g,b)或rgba(r,g,b,a),a不透明应该是255. */ backgroundColor?: string; /** 四参数(x偏移,y偏移,缩放,旋转弧度),可选,对坐标最后进行修正*/ fourParameter?: string | string[]; /** 是否用上面的四参数进行反算,默认false*/ isInverseFourParamter?: boolean | boolean[]; /** 是否是矢量瓦片. */ mvt?: boolean; /** 是否考虑旋转,在不同坐标系中转换是需要考虑。默认自动考虑是否需要旋转. */ useImageRotate?: boolean; /** 旋转时图像处理算法. 1或2,默认自动选择(旋转时有用)*/ imageProcessAlg?: number; /** 当前互联网底图地图类型 WGS84(84坐标,如天地图,osm), GCJ02(火星坐标,如高德,腾讯地图), BD09LL(百度经纬度坐标,如百度地图), BD09MC(百度墨卡托米制坐标,如百度地图)*/ webMapType?: "WGS84" | "GCJ02" | "BD09LL" | "BD09MC"; } /** * 工作区(工作区主要用来对图纸进行分类管理。不同工作区的图纸存在的位置不同,查看不同工作区的图纸,需要切换到相应工作区才能查看) */ export interface IWorkspace { /** 工作区名称(英文名称,不要有特殊字符,用于做为键值和路由). */ name: string; /** 工作区别名(可以是中文). */ alias?: string; /** 工作区目录,如果是相对于工作区路径的一个路径或绝对路径,如为空的话,则用工作区名称做为工作目录. */ workDir?: string; /** 是否公开(不公开的话,无法通过获取工作区功能来获取到此工作区信息). */ isPublic?: boolean; } /** * An element containing 6 entries, 3 spatial and 3 rotational degrees of freedom. */ class JacobianElement { /** * spatial */ spatial: Vec3; /** * rotational */ rotational: Vec3; constructor(); /** * Multiply with other JacobianElement */ multiplyElement(element: JacobianElement): number; /** * Multiply with two vectors */ multiplyVectors(spatial: Vec3, rotational: Vec3): number; } export interface JsonMetaData { textures: { [uuid: string]: Texture; }; geometries: { [uuid: string]: BufferGeometry; }; } type Keyframe_2 = { time: number; value: unknown; percent: number; rawValue: unknown; easing?: AnimationEasing; easingFunc?: (percent: number) => number; additiveValue?: unknown; }; type KeyOfDistributive = T extends unknown ? keyof T : never; /** * Get all object keys * * Will return an empty array if obj is null/undefined */ function keys(obj: T): (KeyOfDistributive & string)[]; export class Label extends Object3D { #private; labelPool: LabelPool; text: string; mesh: InstancedMesh; geometry: InstancedBufferGeometry; material: LabelMaterial; pickingMaterial: LabelMaterial; instanceAttrData: Float32Array; instanceAttrBuffer: InstancedInterleavedBuffer; instanceBoxPosition: InterleavedBufferAttribute; instanceCharPosition: InterleavedBufferAttribute; instanceUv: InterleavedBufferAttribute; instanceBoxSize: InterleavedBufferAttribute; instanceCharSize: InterleavedBufferAttribute; lineHeight: number; constructor(labelPool: LabelPool); private _handleAtlasChange; dispose(): void; private reallocateAttributeBufferIfNeeded; setText(text: string): void; private _needsUpdateLayout; private _updateLayoutIfNeeded; /** Values should be in working (linear-srgb) color space */ setColor(r: number, g: number, b: number, a?: number): void; /** Values should be in working (linear-srgb) color space */ setBackgroundColor(r: number, g: number, b: number, a?: number): void; setBillboard(billboard: boolean): void; /** * Enable or disable size attenuation. Setting this to `false` also requires that billboarding is * enabled. */ setSizeAttenuation(sizeAttenuation: boolean): void; setAnchorPoint(x: number, y: number): void; setLineHeight(lineHeight: number): void; } export class LabelMaterial extends RawShaderMaterial { picking: boolean; constructor(params: { atlasTexture?: Texture; picking?: boolean; }); } export interface LabelOptions { /** 位置 */ position?: Vector3; /** 文字内容 */ text: string; /** 颜色 */ color?: ColorRepresentation; /** 背景色 */ backgroundColor?: ColorRepresentation; /** 背景透明度 */ backgroundOpacity?: number; /** 是否为公告板模式 */ billboard?: boolean; /** 锚点 */ anchorPoint?: [number, number]; /** 高度 */ lineHeight?: number; /** 大小是否会受相机影响 */ sizeAttenuation?: boolean; /** 背景是否透明 */ transparent?: boolean; /** 文本池 */ labelPool?: LabelPool; } export class LabelPool extends EventDispatcher_2<{ scaleFactorChange: object; atlasChange: object; }> { atlasTexture: DataTexture; private availableLabels; private disposed; static QUAD_POINTS: Vector3Tuple[]; static QUAD_POSITIONS: BufferAttribute; static QUAD_UVS: BufferAttribute; fontManager: FontManager; scaleFactor: number; setScaleFactor(scaleFactor: number): void; constructor(options?: FontManagerOptions); updateAtlas(text: string): void; private _updateAtlasTexture; acquire(): Label; release(label: Label): void; dispose(): void; } interface LayerConfig { clearColor?: string | GradientObject | ImagePatternObject; motionBlur?: boolean; lastFrameAlpha?: number; } export type LayoutInfo = { width: number; height: number; chars: CharLayoutInfo[]; }; /** * 向量长度 */ function len(v: VectorArray): number; const length_2: typeof len; const lengthSquare: typeof lenSquare; /** * 向量长度平方 */ function lenSquare(v: VectorArray): number; /** 比例插值 */ export function lerp(x: number, y: number, t: number): number; /** * 插值两个点 */ function lerp_2(out: T, v1: VectorArray, v2: VectorArray, t: number): T; /** * @param normalizedValue A float between 0 and 1. * @param colors Color list. * @param fullOutput Default false. * @return Result color. If fullOutput, return {color: ..., leftIndex: ..., rightIndex: ..., value: ...}, */ function lerp_3(normalizedValue: number, colors: string[], fullOutput: boolean): LerpFullOutput; function lerp_3(normalizedValue: number, colors: string[]): string; export function lerpCameras(camera1: any, camera2: any, alpha: any): void; /** * 给定坐标数组,和要插值的距离比例计算出比例所在的坐标值 * @param coordinates 坐标数组 * @param t 比例值0-1 * @returns */ export function lerpCoordinates(coordinates: Vector3[] | [number, number, number][], t: number): Vector3; /** 欧拉角比例插值 */ export function lerpEuler(e1: Euler, e2: Euler, t: number): Euler; type LerpFullOutput = { color: string; leftIndex: number; rightIndex: number; value: number; }; function lift(color: string, level: number): string; function liftColor(color: GradientObject): GradientObject; function liftColor(color: string): string; /** * Limit the speed of particles over their life. */ export class LimitSpeedOverLife implements Simulation { speed: FunctionValueGenerator; dampen: number; type: string; initialize(particle: Particle): void; constructor(speed: FunctionValueGenerator, dampen: number); update(particle: Particle, delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } class Line extends Path { shape: LineShape; constructor(opts?: LineProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): LineShape; buildPath(ctx: CanvasRenderingContext2D, shape: LineShape): void; /** * Get point at percent */ pointAt(p: number): VectorArray; } export class Line2 extends LineSegments2 { constructor(geometry?: LineGeometry, material?: LineMaterial); } /** * 三维线被另外一条三维线分开多条线段,返回新的线段 * @param line * @param splitLine * @param epsilon 允许误差,默认1e-6 */ export function line3dSplit(line: Vector3[], splitLine: Vector3[], epsilon?: number): Vector3[][]; /** * x, y, x2, y2 are all percent from 0 to 1 when globalCoord is false */ class LinearGradient extends Gradient_2 { type: 'linear'; x: number; y: number; x2: number; y2: number; constructor(x: number, y: number, x2: number, y2: number, colorStops?: GradientColorStop[], globalCoord?: boolean); } interface LinearGradientObject extends GradientObject { type: 'linear'; x: number; y: number; x2: number; y2: number; } /** * Converts a single color channel from the linear color space to sRGB. * @param c - The color channel to be converted. * @category Color */ export function LinearToSRGB(c: number): number; export function lineDistance(points: [number, number, number][] | Vector3[]): number; export class LineGeometry extends LineSegmentsGeometry { constructor(); setPositions(array: any): this; setColors(array: any): this; setLinewidths(array: number[]): this; setLineOpacitys(array: number[]): this; setDashArguments(array: number[]): this; fromLine(line: any): this; } export function lineIntersection(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, out?: number[], writeOffset?: number): number; export class LineMaterial extends ShaderMaterial { constructor(parameters: any); get color(): any; set color(value: any); get worldUnits(): boolean; set worldUnits(value: boolean); get linewidth(): any; set linewidth(value: any); get dashed(): boolean; set dashed(value: boolean); get dashScale(): any; set dashScale(value: any); get dashSize(): any; set dashSize(value: any); get dashOffset(): any; set dashOffset(value: any); get gapSize(): any; set gapSize(value: any); get opacity(): any; set opacity(value: any); get resolution(): any; set resolution(value: any); get alphaToCoverage(): boolean; set alphaToCoverage(value: boolean); } export type LineMaterialParameters = { worldUnits?: boolean; color?: number; linewidth?: number; dashed?: boolean; dashScale?: number; dashSize?: number; dashOffset?: number; gapSize?: number; resolution?: Vector2; } & ShaderMaterialParameters; interface LineProps extends PathProps { shape?: Partial; } export class LineSegments2 extends Mesh { constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); computeLineDistances(): this; raycast(raycaster: any, intersects: any): void; } export class LineSegmentsGeometry extends InstancedBufferGeometry { constructor(); applyMatrix4(matrix: any): this; setPositions(array: any): this; setColors(array: any): this; setLinewidths(linewidthArray: Float32Array | number[]): this; setLineOpacitys(lineOpacityArray: Float32Array | number[]): this; /** * 设置dash相关的参数 * @param dashArgsArr */ setDashArguments(dashArgsArr: Float32Array | number[]): this; fromWireframeGeometry(geometry: any): this; fromEdgesGeometry(geometry: any): this; fromMesh(mesh: any): this; fromLineSegments(lineSegments: any): this; computeBoundingBox(): void; computeBoundingSphere(): void; toJSON(): void; applyMatrix(matrix: any): this; } class LineShape { x1: number; y1: number; x2: number; y2: number; percent: number; } /** * 切分线段 * @param cs 要切分的线段坐标 * @param lineChunkLength 要切分的段数,默认10 */ export function lineSlice(cs: Array<[number, number, number]>, lineChunkLength?: number): any[]; /** * 线被另外一条线分开多条线段,返回新的线段 * @param line * @param splitLine * @param dotErr 允许误差的小数点后几位,默认6位 * @return {any[] | GeoPoint[][]} */ export function lineSplit(line: GeoPoint[], splitLine: GeoPoint[], dotErr?: number): GeoPoint[][]; /** * LineString Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.4 */ interface LineString extends GeometryObject { type: "LineString"; coordinates: Position[]; } class LinkedList { length: number; head: LinkedListNode | null; tail: LinkedListNode | null; constructor(); isEmpty(): boolean; clear(): void; front(): T | null; back(): T | null; /** * remove at head in O(1) */ dequeue(): T | undefined; /** * remove at tail in O(1) */ pop(): T | undefined; /** * add at head in O(1) */ queue(data: T): void; /** * add at tail in O(1) */ push(data: T): void; insertBefore(node: LinkedListNode, data: T): void; remove(data: T): void; /** * Returns an iterator over the values */ values(): Generator; } class LinkedListNode { data: T; next: LinkedListNode | null; prev: LinkedListNode | null; constructor(data: T); hasPrev(): boolean; hasNext(): boolean; } export interface LoadDetail { url: string; progress: number; error: boolean; message: string; } export class LoaderManager { private readonly resourceMap; private loaderMap; private readonly loadDetailMap; private path; loaderUrlPath: string; signal: { beforeLoad: Signal; loading: Signal; detailLoading: Signal; detailLoaded: Signal; loaded: Signal; }; imageLoader: ImageLoader; videoLoader: VideoLoader; gltfLoader: GLTFLoader; objLoader: OBJLoader; mtlLoader: MTLLoader; videlLoader: VideoLoader; hdrLoader: RGBELoader; fbxLoader: FBXLoader; ddsLoader: DDSLoader; dracoLoader: DRACOLoader; ktx2Loader: KTX2Loader; svgLoader: SVGLoader; fileLoader: FileLoader; particleLoader: ParticleLoader; constructor(parameters?: LoaderManagerOptions); /** * 设置统一资源路径前缀 * @param path * @returns */ setPath(path: string): this; /** * 设置请求头 * @param headers * @returns this */ setRequestHeader(headers: Record): this; /** * 设置响应类型 * @param responseType * @returns this */ setResponseType(responseType: string): this; /** * 获取加载器 * @param ext 资源类型 * @returns */ getLoader(ext: string): Loader | null; /** * 加载资源 * @param urls * @param useCache 是否使用缓存,是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @returns this */ load(urls: LoadUnit[] | LoadUnit, useCache: boolean, onLoad: (resource: any) => void, onProgress?: (event: ProgressEvent | ProgressEvent[]) => void, onError?: (event: ErrorEvent | string | string[] | ErrorEvent[]) => void, fileType?: string[] | string): this; /** * 注册loader * @param ext 文件格式: jpg * @param loader extend THREE.Loader * @returns this */ register(ext: string, loader: Loader): this; hasLoaded(url: string): boolean; /** * 获取url的资源 * @param url * @returns */ getResource(url: string): any; /** * 获取url的资源状态 * @param url * @returns */ getResourceStatus(url: string): ResStatus; /** * 获取详细资源信息 * @returns */ getLoadDetail(url: string): LoadDetail; /** * 获取详细资源信息 * @returns */ getLoadDetailMap(): { [key: string]: LoadDetail; }; setLoaderPath(urlPath: string): void; /** * 清空缓存 * @returns */ dispose(): this; /** * 加载扩展的loader库 */ loadExtensionLoader(): Promise; /** * 加载扩展的IfcLoader库 */ loadExtensionIfcLoader(options?: { setupOptionalCategoriesOpts?: Record; applyWebIfcConfigOpts?: Record; }): Promise; } export interface LoaderManagerOptions { /**加载器拓展 */ loaderExtends: { [key: string]: Loader; }; } /** * 加载图片 */ export const loadImage: (src: string) => Promise; export const LoadManager: LoaderManager; export function loadParticlePlugin(plugin: ParticlePlugin): void; /** 启用物理引擎 */ export function loadPhysicsEngine(): Promise; /** 加载3dtiles插件库 */ export const loadPlugin3dtiles: () => Promise; /** 加载algorithm插件库 */ export const loadPluginAlgorithm: () => Promise; export interface LoadPluginOpts { /** 是否是绝对位置 */ isAbsPath?: boolean; /** 用于运行 JavaScript 的策略。可以是`inject`、`eval` 或`href`。默认自动检测. */ strategy?: "inject" | "eval" | `href`; /** 用于注入资源的位置的 `document.querySelector` 参数。*/ injectLocation?: string; /** 异步加载脚本 */ async?: boolean; /** 沙箱运行时设置globalThis为undefined */ globalThisUndefined?: boolean; /** globalThis为undefined时有效,进行替换 */ globalThisReplace?: boolean; /** 沙箱运行时上下文 */ context?: any; /** 请求配置参数 */ reqConfig?: Partial; } export interface loadResourcesOptions { /** 是否显示loading界面 默认true*/ showLoading?: boolean; /** 是否显示背景 默认 true*/ showShadertoy?: boolean; /** 是否html的div进度要 默认false */ showHtml?: boolean; /** 材质参数选顶 */ shadertoyMaterial?: Partial & { hsbOffsetDelta?: [number, number, number]; hsbOffsetMax?: [number, number, number]; }; /** 背景随进度透明度变小 */ ShadertoyProgressOpacity?: boolean; /** 显示webgl进度条标签 默认 false */ showGlLabel?: boolean; /** 显示div进度条标签 默认 true */ showDivLabel?: boolean; /** 标签选项 text默认为 loading... {{percentage}} */ labelOptions?: Partial & { /** 文字像素位置 */ position?: [number, number]; /** 文字像素高度 */ height?: number; }; /** 禁用相机控件 默认false */ enableCameraControl?: boolean; /** 进度条回调 */ progressCb?: (percentage: number, error?: any) => void; /** 使用html div做为进度条 */ html?: { /** div的内容 */ div: string; /** css的内容 */ css?: string; /** 进度文本div 类别 */ textDivClassName?: string; }; /** 自动隐藏场景中其他实体 默认true */ autoHiddenSceneObjects?: boolean; } export type LoadUnit = string | { url: string; ext: string; }; /** * Lock constraint. Will remove all degrees of freedom between the bodies. */ class LockConstraint extends PointToPointConstraint { xA: Vec3; xB: Vec3; yA: Vec3; yB: Vec3; zA: Vec3; zB: Vec3; rotationalEquation1: RotationalEquation; rotationalEquation2: RotationalEquation; rotationalEquation3: RotationalEquation; motorEquation?: RotationalMotorEquation; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * The maximum force that should be applied to constrain the bodies. * @default 1e6 */ maxForce?: number; }); /** * update */ update(): void; } type LockConstraintOptions = ConstructorParameters[2]; /** * LOD control objects define how the map tiles are subsivided or simplified. */ export interface LODControl { /** * Update LOD of the MapView and Camera position on the world. * * @param view - Map view for wich the LOD will be updated. * @param camera - Camera used to view the scene. * @param renderer - Renderer object. * @param scene - Scene that compose the mapview. */ updateLOD(view: MapView, camera: Camera, renderer: WebGLRenderer, scene: Object3D): void; } /** * Use random raycasting to randomly pick n objects to be tested on screen space. * * Overall the fastest solution but does not include out of screen objects. */ export class LODRaycast implements LODControl { /** * Number of rays used to test nodes and subdivide the map. * * N rays are cast each frame dependeing on this value to check distance to the visible map nodes. A single ray should be enough for must scenarios. */ subdivisionRays: number; /** * Threshold to subdivide the map tiles. * * Lower value will subdivide earlier (less zoom required to subdivide). */ thresholdUp: number; /** * Threshold to simplify the map tiles. * * Higher value will simplify earlier. */ thresholdDown: number; /** * Raycaster object used to cast rays into the world and check for hits. */ raycaster: Raycaster; /** * Normalized mouse coordinates. */ mouse: Vector2; /** * Consider the distance powered to level of the node. */ powerDistance: boolean; /** * Consider the scale of the node when calculating the distance. * * If distance is not considered threshold values should be absolute distances. */ scaleDistance: boolean; updateLOD(view: MapView, camera: Camera, renderer: WebGLRenderer, scene: Object3D): void; } function logError(...args: any[]): void; export const Logger: { debug: (message?: any, ...optionalParams: any[]) => void; info: (message?: any, ...optionalParams: any[]) => void; warn: (message?: any, ...optionalParams: any[]) => void; error: (message?: any, ...optionalParams: any[]) => void; isEnabled: boolean; /** Turn on log */ enable(): void; /** Turn off log */ disable(): void; }; export type logInfoType = "log" | "warn" | "error" | "info" | "success"; /** * Prints given message into the console */ export class LogMessageBehavior extends Behavior { message: string; constructor(message?: string); /** * * @param {String} message * @return {LogMessageBehavior} */ static from(message: string): LogMessageBehavior; tick(timeDelta: number): BehaviorStatus; } function logTriangleDefinitions(...triangles: Triangle[]): void; /** * Find the longest common prefix in an array of strings * https://stackoverflow.com/questions/68702774/longest-common-prefix-in-javascript * @param words */ export function longestCommonPrefix(words: string[]): string; /** * Calculate luminance. It will include alpha. */ function lum(color: string, backgroundLum: number): number; export function makeBasicMaterialUiConfig(mat: MeshBasicMaterial): UiObjectConfig; export function makeCameraUiConfig(camera: Camera): UiObjectConfig; /** * Returns a data url for a 16x16 svg rectangle with the given color. * @param c - color * * @category SVGs */ export const makeColorSvg: (c: string) => string; /** * Returns a data url for a 16x16 svg circle with the given color. * @param c - color * * @category SVGs */ export const makeColorSvgCircle: (c: string) => string; export function makeGeomertyUiConfig(geom: BufferGeometry): UiObjectConfig; export function makeLightUiConfig(light: Light): UiObjectConfig | undefined; export function makeMaterialUiConfig(mat: Material, object?: Object3D): UiObjectConfig; export function makeObject3DUiConfig(obj: Object3D, isMesh?: boolean): UiObjectConfig; export function makePhongMaterialUiConfig(mat: MeshPhongMaterial): UiObjectConfig; export function makePhysicalMaterialUiConfig(mat: MeshPhysicalMaterial): UiObjectConfig; export function makeSamplerUi(mat: any, map: any): UiObjectConfig; /** * Returns a data url for a svg with the given text. * @param text * * @category SVGs */ export const makeTextSvg: (text: string) => string; /** * Array mapping. * @typeparam T Type in Array * @typeparam R Type Returned * @return Must be an array. */ function map(arr: readonly T[], cb: (this: Context, val: T, index?: number, arr?: readonly T[]) => R, context?: Context): R[]; export class map2dUtils { static WorldResolution: number; static makePerspectiveMatrix(fovy: any, aspect: any, near: any, far: any): Matrix4; static makeOrthographicMatrix(left: any, right: any, top: any, bottom: any, near: any, far: any): Matrix4; /** 2d经纬度坐标转3d中世界坐标 */ static projectToWorld(coords: [number, number, number?]): Vector3; /** 根据纬度获取该纬度每米分辨值 */ static projectedUnitsPerMeter(latitude: any): number; /** 获取摩卡托坐标z值 */ static mercatorZfromAltitude(altitude: any, lat: any): number; /** 把3d中世界坐标转2d经纬度坐标 */ static unprojectFromWorld(world: { x: number; y: number; z: number; } | Vector3): number[]; /** * 定位到三维场景中的一个实体 */ static fitToObject(map: any, object: Sphere | Object3D, opts?: Record): void; /** 三维场景中的场景坐标转世界坐标 */ static scene2World(pt: Vector3, app?: App): Vector3; /** 三维场景中的场景坐标转世界坐标 */ static world2Scene(pt: Vector3, app?: App): Vector3; } /** * Represents a height map tile node that can be subdivided into other height nodes. * * Its important to update match the height of the tile with the neighbors nodes edge heights to ensure proper continuity of the surface. * * The height node is designed to use MapBox elevation tile encoded data as described in https://www.mapbox.com/help/access-elevation-data/ */ export class MapHeightNode extends MapNode { /** * Flag indicating if the tile height data was loaded. */ heightLoaded: boolean; /** * Flag indicating if the tile texture was loaded. */ textureLoaded: boolean; /** * Original tile size of the images retrieved from the height provider. */ static tileSize: number; /** * Size of the grid of the geometry displayed on the scene for each tile. */ geometrySize: number; /** * If true the tiles will compute their normals. */ geometryNormals: boolean; /** * Map node plane geometry. */ static geometry: BufferGeometry; /** * Base geometry shared across all the nodes. */ static baseGeometry: BufferGeometry; /** * Map height node constructor. * * @param parentNode - The parent node of this node. * @param mapView - Map view object where this node is placed. * @param location - Position in the node tree relative to the parent. * @param level - Zoom level in the tile tree of the node. * @param x - X position of the node in the tile tree. * @param y - Y position of the node in the tile tree. * @param material - Material used to render this height node. * @param geometry - Geometry used to render this height node. */ constructor(parentNode?: MapHeightNode, mapView?: MapView, location?: number, level?: number, x?: number, y?: number, geometry?: BufferGeometry, material?: Material); initialize(): Promise; /** * Load tile texture from the server. * * Aditionally in this height node it loads elevation data from the height provider and generate the appropiate maps. */ loadData(): Promise; /** * Load height texture from the server and create a geometry to match it. * * @returns Returns a promise indicating when the geometry generation has finished. */ loadHeightGeometry(): Promise; createChildNodes(): void; /** * Overrides normal raycasting, to avoid raycasting when isMesh is set to false. */ raycast(raycaster: Raycaster, intersects: Intersection[]): void; } interface MapInterface { delete(key: KEY): boolean; has(key: KEY): boolean; get(key: KEY): T | undefined; set(key: KEY, value: T): this; keys(): KEY[]; forEach(callback: (value: T, key: KEY) => void): void; } /** * Represents a map tile node inside of the tiles quad-tree * * Each map node can be subdivided into other nodes. * * It is intended to be used as a base class for other map node implementations. */ export abstract class MapNode extends Mesh { /** * Default texture used when texture fails to load. */ static defaultTexture: Texture; static defaultTransparentTexture: Texture; /** * The map view object where the node is placed. */ mapView: MapView; /** * Parent node (from an upper tile level). */ parentNode: MapNode; /** * Index of the map node in the quad-tree parent node. * * Position in the tree parent, can be topLeft, topRight, bottomLeft or bottomRight. */ location: number; /** * Tile level of this node. */ level: number; /** * Tile x position. */ x: number; /** * Tile y position. */ y: number; /** * Variable to check if the node is subdivided. * * To avoid bad visibility changes on node load. */ subdivided: boolean; /** * Flag to indicate if the map node was disposed. * * When a map node is disposed its resources are dealocated to save memory. */ disposed: boolean; /** * Indicates how many children nodes are loaded. * * The child on become visible once all of them are loaded. */ nodesLoaded: number; /** * Cache with the children objects created from subdivision. * * Used to avoid recreate object after simplification and subdivision. * * The default value is null. Only used if "cacheTiles" is set to true. */ childrenCache: Object3D[]; /** * Base geometry is attached to the map viewer object. * * It should have the full size of the world so that operations over the MapView bounding box/sphere work correctly. */ static baseGeometry: BufferGeometry; /** * How many children each branch of the tree has. * * For a quad-tree this value is 4. */ static childrens: number; /** * Flag to check if the node is a mesh by the renderer. * * Used to toggle the visibility of the node. The renderer skips the node rendering if this is set false. */ isMesh: true; constructor(parentNode?: MapNode, mapView?: MapView, location?: number, level?: number, x?: number, y?: number, geometry?: BufferGeometry, material?: Material); /** * Initialize resources that require access to data from the MapView. * * Called automatically by the constructor for child nodes and MapView when a root node is attached to it. */ initialize(): Promise; /** * Create the child nodes to represent the next tree level. * * These nodes should be added to the object, and their transformations matrix should be updated. */ createChildNodes(): void; /** * Subdivide node,check the maximum depth allowed for the tile provider. * * Uses the createChildNodes() method to actually create the child nodes that represent the next tree level. */ subdivide(): void; /** * Simplify node, remove all children from node, store them in cache. * * Reset the subdivided flag and restore the visibility. * * This base method assumes that the node implementation is based off Mesh and that the isMesh property is used to toggle visibility. */ simplify(): void; /** * Load tile texture from the server. * * This base method assumes the existence of a material attribute with a map texture. */ loadData(): Promise; /** * Increment the child loaded counter. * * Should be called after a map node is ready for display. */ nodeReady(): void; /** * Dispose the map node and its resources. * * Should cancel all pending processing for the node. */ dispose(): void; } /** * Map node geometry is a geometry used to represent the map nodes. * * Consists of a XZ plane with normals facing +Y. * * The geometry points start in XZ plane that can be manipulated for example for height adjustment. * * Geometry can also include skirts to mask off missalignments between tiles. */ export class MapNodeGeometry extends BufferGeometry { /** * Map node geometry constructor. * * @param width - Width of the node. * @param height - Height of the node. * @param widthSegments - Number of subdivisions along the width. * @param heightSegments - Number of subdivisions along the height. * @param skirt - Skirt around the plane to mask gaps between tiles. */ constructor(width?: number, height?: number, widthSegments?: number, heightSegments?: number, skirt?: boolean, skirtDepth?: number); static buildPlane(width: number, height: number, widthSegments: number, heightSegments: number, indices: number[], vertices: number[], normals: number[], uvs: number[]): void; static buildSkirt(width: number, height: number, widthSegments: number, heightSegments: number, skirtDepth: number, indices: number[], vertices: number[], normals: number[], uvs: number[]): void; } export class MapNodeHeightGeometry extends BufferGeometry { /** * Map node geometry constructor. * * @param width - Width of the node. * @param height - Height of the node. * @param widthSegments - Number of subdivisions along the width. * @param heightSegments - Number of subdivisions along the height. * @param skirt - Skirt around the plane to mask gaps between tiles. */ constructor(width?: number, height?: number, widthSegments?: number, heightSegments?: number, skirt?: boolean, skirtDepth?: number, imageData?: ImageData, calculateNormals?: boolean, heightScale?: number); /** * Compute normals for the height geometry. * * Only computes normals for the surface of the map geometry. Skirts are not considered. * * @param widthSegments - Number of segments in width. * @param heightSegments - Number of segments in height. */ computeNormals(widthSegments: number, heightSegments: number): void; } export enum MapOpenWay { /** 内存模式. */ Memory = "Memory", /** 存储为几何数据再渲染模式 */ GeomRender = "GeomRender" } /** * Represents a basic plane tile node. */ export class MapPlaneNode extends MapNode { constructor(parentNode?: any, mapView?: any, location?: number, level?: number, x?: number, y?: number); /** * Map node plane geometry. */ static geometry: BufferGeometry; static baseGeometry: BufferGeometry; initialize(): Promise; createChildNodes(): void; /** * Overrides normal raycasting, to avoid raycasting when isMesh is set to false. */ raycast(raycaster: Raycaster, intersects: Intersection[]): void; } /** * A map provider is a object that handles the access to map tiles of a specific service. * * They contain the access configuration and are responsible for handling the map theme size etc. * * MapProvider should be used as a base for all the providers. */ export class MapProvider { /** * Name of the map provider */ mapView: MapView; /** * Name of the map provider */ name: string; /** * Minimum tile level. */ minZoom: number; /** * Maximum tile level. */ maxZoom: number; /** * Map bounds. */ bounds?: Box2; layers: MapProviderLayer[]; options?: MapProviderParameters; constructor(layers: MapProviderLayer | MapProviderLayer[], options?: MapProviderParameters); /** * Get a tile for the x, y, zoom based on the provider configuration. * * The tile should be returned as a image object, compatible with canvas context 2D drawImage() and with webgl texImage2D() method. * * @param zoom - Zoom level. * @param x - Tile x. * @param y - Tile y. * @returns Promise with the image obtained for the tile ready to use. */ fetchTile(zoom: number, x: number, y: number): { promise: Promise; layers: MapProviderLayer[]; }; } interface MapProviderLayer { /** * Name of the map provider */ name?: string; /** * Minimum tile level. */ minZoom?: number; /** * Maximum tile level. */ maxZoom?: number; /** * Map bounds. */ bounds?: [number, number, number, number]; opacity?: number; url?: string; tileUrl?: string; fetchTile?: (zoom: number, x: number, y: number) => Promise; } interface MapProviderParameters extends MeshBasicMaterialParameters { /** 最开始的[瓦片缩级别,行,列], 默认为[0, 0, 0] */ rootTile?: [number, number, number]; /** 背景颜色 */ backColor?: ColorRepresentation; /** 材质属性 */ texture?: { magFilter?: MagnificationTextureFilter; minFilter?: MinificationTextureFilter; [key: string]: any; }; /** 颜色滤镜 */ colorFilter?: FilterColorOptions; } type MapSources = { [K in keyof T]: T[K] extends WatchSource ? Immediate extends true ? V | undefined : V : T[K] extends object ? Immediate extends true ? T[K] | undefined : T[K] : never; }; export class MapThreeLayer { #private; map: any; options: MapThreeLayerOptions; app: App; world: any; worldEntity: Entity; cameraSync: any; scene: Scene; constructor(map: any, options?: MapThreeLayerOptions); init(map: any, options: any): void; update(): void; repaint(): void; onRemove(map: any, gl: any): void; } export interface MapThreeLayerOptions extends AppOptions { passiveRendering?: boolean; } /** * @deprecated */ const mapToColor: typeof lerp_3; type MapToType, S> = { [P in keyof T]: T[P] extends Dictionary ? MapToType : S; }; export class MapUtils { /** The equatorial semi perimeter in meters. */ static EQUATORIAL_SEMIPERIMETER: number; /** The equatorial semi perimeter in meters. */ static EARTH_BOUNDS: [number, number, number, number]; /** * 经纬度转墨卡托 . * @param pt 经纬度 * @param isMercatorNormalize 是否对输出的墨卡托坐标归一化,到0-1区间 */ static lngLatToMercator(pt: [number, number], isMercatorNormalize?: boolean): [number, number]; /** * 墨卡托转经纬度 . * @param pt 墨卡托坐标 * @param isMercatorNormalize 输入的的墨卡托坐标是否是归一化的坐标 */ static mercatorToLngLat(pt: [number, number], isMercatorNormalize?: boolean): [number, number]; /** * 归一化坐标,默认是墨卡托坐标范围 * @param pt 要归一化的坐标 * @param mapBounds 地图范围,不填默认为墨卡托坐标范围 */ static toNormalize(pt: [number, number], mapBounds?: [number, number, number, number]): [number, number]; /** * 归一化的墨卡托坐标还原成真实的墨卡托坐标 .,默认是墨卡托坐标范围 * @param pt 归一化的坐标 * @param mapBounds 地图范围,不填默认为墨卡托坐标范围 */ static fromNormalize(pt: [number, number], mapBounds?: [number, number, number, number]): [number, number]; /** * 自定义坐标系坐标转墨卡托(epsg:3857) * @param pt 坐标点 * @param mapBounds 地图范围 [minx, miny,maxx, maxy] * @param isMercatorNormalize 是否对输出的墨卡托坐标归一化,到0-1区间 * @return {[number, number]} */ static toMercator(pt: [number, number], mapBounds: [number, number, number, number], isMercatorNormalize?: boolean): [number, number]; /** * 墨卡托(epsg:3857)转自定义坐标系坐标 * @param pt 墨卡托坐标点 * @param mapBounds 地图范围 [minx, miny,maxx, maxy] * @param isMercatorNormalize 输入的的墨卡托坐标是否是归一化的坐标 * @return {[number, number]} */ static fromMercator(pt: [number, number], mapBounds: [number, number, number, number], isMercatorNormalize?: boolean): [number, number]; /** * 互联网坐标类型 */ static WebMapCoordType: { unknown: number; LngLat: number; Mercator: number; NormalizeMercator: number; }; /** * 根据值获取可能的互联网坐标类型,经纬度坐标, 墨卡托坐标,0-1区间的归一化的墨卡托坐标 */ static getLikeCoordType(pt: [number, number] | [number, number][]): number; /** * getTileBBox * * @param {Number} x Tile coordinate x * @param {Number} y Tile coordinate y * @param {Number} z Tile zoom * @returns {String} String of the bounding box */ static getTileBBox(x: any, y: any, z: any): string; /** * 获取瓦片的墨托卡坐标范围 * * @param {Number} x Tile coordinate x * @param {Number} y Tile coordinate y * @param {Number} z Tile zoom * @returns {String} String of the bounding box */ static getTileMercator(x: any, y: any, z: any): [number, number, number, number]; /** * getMercCoords * * @param {Number} x Pixel coordinate x * @param {Number} y Pixel coordinate y * @param {Number} z Tile zoom * @returns {Array} [x, y] */ static getMercCoords(x: any, y: any, z: any): number[]; static fetchDebugTile(zoom: number, x: number, y: number, startColor?: ColorRepresentation, endColor?: ColorRepresentation, borderColor?: ColorRepresentation, resolution?: number): Promise; } /** * Map viewer is used to read and display map tiles from a server. * * It was designed to work with a OpenMapTiles but can also be used with another map tiles. * * The map is drawn in plane map nodes using a quad tree that is subdivided as necessary to guaratee good map quality. */ export class MapView extends Mesh { #private; /** * Planar map projection. */ static PLANAR: number; /** * Spherical map projection. */ /** * Planar map projection with height deformation. */ static HEIGHT: number; /** * Planar map projection with height deformation using the GPU for height generation. */ static HEIGHT_SHADER: number; /** * RTIN map mode. */ static MARTINI: number; /** * Map of the map node types available. */ static mapModes: Map; /** * LOD control object used to defined how tiles are loaded in and out of memory. */ lod: LODControl; /** * Map tile color layer provider. */ provider: MapProvider; /** * Map height (terrain elevation) layer provider. * * Only used for HEIGHT, HEIGHT_SHADER and MARTINI map modes. */ heightProvider: MapProvider; /** * Define the type of map node in use, defined how the map is presented. * * Should only be set on creation. */ root: MapNode; /** * Indicate if the nodes should cache its children when it is simplified. Nodes that are no longer in use should be kept in memory. * * Usefull for fast moving scenarios to prevent reparsing data in fast moving scenes. * * Should only be used if the child generation process is time consuming. Should be kept off unless required. */ cacheTiles: boolean; scheduler: Scheduler; useScheduler: boolean; isClip?: boolean; options: MapViewOption; /** * Constructor for the map view objects. * * @param root - Map view node modes can be HEIGHT or PLANAR. PLANAR is used by default. Can also be a custom MapNode instance. * @param provider - Map color tile provider by default a OSM maps provider is used if none specified. * @param heightProvider - Map height tile provider, by default no height provider is used. */ constructor(options: MapViewOption); /** * Ajust node configuration depending on the camera distance. * * Called everytime automatically before render by the renderer. */ onBeforeRender: (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group_2) => void; /** * 地图坐标转局部世界坐标 */ mapToLocal(point: [number, number]): Vector3; /** * 局部世界坐标转地图坐标 */ localToMap(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 地图坐标转世界坐标 */ mapToWorld(lngLat: [number, number]): Vector3; /** * 世界坐标转地图坐标 */ worldToMap(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转局部世界坐标 */ lngLatToLocal(lngLat: [number, number]): Vector3; /** * 局部世界坐标转经纬度 */ localToLngLat(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转世界坐标 */ lngLatToWorld(lngLat: [number, number]): Vector3; /** * 世界坐标转经纬度 */ worldToLngLat(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转归一化的坐标, 先会把经纬度转墨卡托,然后根据最开始的[瓦片缩级别,行,列]rootTile的范围,归一化到0-1范围区间 */ lngLatToNormalize(lngLat: [number, number]): [number, number]; getMapBounds(): [number, number, number, number]; worldResolution(): number; /** * 是否为互联网地图底图 (选项中设置了mapBounds的为cad底图,没设置mapBounds的为互联网底图) */ isWebBaseMap(): boolean; clip(): void; /** * Set the root of the map view. * * Is set by the constructor by default, can be changed in runtime. * * @param root - Map node to be used as root. */ setRoot(root: (MapNode | number)): void; /** * Pre-subdivide map tree to create nodes of levels not available in the provider. * * Checks for the minimum zoom level in the providers attached to the map view. */ preSubdivide(): void; /** * Change the map provider of this map view. * * Will discard all the tiles already loaded using the old provider. */ setProvider(provider: MapProvider): void; /** * Change the map height provider of this map view. * * Will discard all the tiles already loaded using the old provider. */ setHeightProvider(heightProvider: MapProvider): void; /** * Clears all tiles from memory and reloads data. Used when changing the provider. * * Should be called manually if any changed to the provider are made without setting the provider. */ clear(): any; /** * Get the minimum zoom level available in the providers attached to the map view. * * @returns Minimum zoom level available. */ minZoom(): number; /** * Get the maximum zoom level available in the providers attached to the map view. * * @returns Maximum zoom level available. */ maxZoom(): number; raycast(raycaster: Raycaster, intersects: any[]): boolean; } /** * 地图对象实体 */ export class MapViewEntity extends MeshEntity { map: MapView; constructor(mapOptions: MapViewOption, meshOptions?: MapViewEntityOptions); /** * 地图坐标转局部世界坐标 */ mapToLocal(point: [number, number]): Vector3; /** * 局部世界坐标转地图坐标 */ localToMap(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 地图坐标转世界坐标 */ mapToWorld(lngLat: [number, number]): Vector3; /** * 世界坐标转地图坐标 */ worldToMap(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转局部世界坐标 */ lngLatToLocal(lngLat: [number, number]): Vector3; /** * 局部世界坐标转经纬度 */ localToLngLat(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转世界坐标 */ lngLatToWorld(lngLat: [number, number]): Vector3; /** * 世界坐标转经纬度 */ worldToLngLat(world: [number, number] | [number, number, number] | Vector3): [number, number]; /** * 经纬度转归一化的坐标, 先会把经纬度转墨卡托,然后根据最开始的[瓦片缩级别,行,列]rootTile的范围,归一化到0-1范围区间 */ lngLatToNormalize(lngLat: [number, number]): [number, number]; getMapBounds(): [number, number, number, number]; worldResolution(): number; /** * 是否为互联网地图底图 (选项中设置了mapBounds的为cad底图,没设置mapBounds的为互联网底图) */ isWebBaseMap(): boolean; clip(): void; /** * Set the root of the map view. * * Is set by the constructor by default, can be changed in runtime. * * @param root - Map node to be used as root. */ setRoot(root: (MapNode | number)): void; /** * Pre-subdivide map tree to create nodes of levels not available in the provider. * * Checks for the minimum zoom level in the providers attached to the map view. */ preSubdivide(): void; /** * Change the map provider of this map view. * * Will discard all the tiles already loaded using the old provider. */ setProvider(provider: MapProvider): void; /** * Change the map height provider of this map view. * * Will discard all the tiles already loaded using the old provider. */ setHeightProvider(heightProvider: MapProvider): void; /** * Clears all tiles from memory and reloads data. Used when changing the provider. * * Should be called manually if any changed to the provider are made without setting the provider. */ clear(): any; /** * Get the minimum zoom level available in the providers attached to the map view. * * @returns Minimum zoom level available. */ minZoom(): number; /** * Get the maximum zoom level available in the providers attached to the map view. * * @returns Maximum zoom level available. */ maxZoom(): number; } interface MapViewEntityOptions extends MeshEntityOptions { /** 自动把设置当前地图 默认true*/ autoSetAppCurrentMapView?: boolean; /** 禁止射线查询 默认true*/ disableRayQuery?: boolean; } interface MapViewOption { root?: number | MapNode; provider: MapProvider; heightProvider?: MapProvider; heightScale?: number; skirtDepthScale?: number; baseScale?: number; mapBounds?: [number, number, number, number]; clipPolygon?: [number, number][] | Shape_2; isUseClipOuter?: boolean; isAfterRenderClearStencil?: boolean; lod?: { subdivisionRays?: number; /** * Threshold to subdivide the map tiles. 缺省 0.6 * * Lower value will subdivide earlier (less zoom required to subdivide). */ thresholdUp?: number; /** * Threshold to simplify the map tiles. 缺省 0.15 * * Higher value will simplify earlier. */ thresholdDown?: number; /** * Consider the distance powered to level of the node. 缺省false */ powerDistance?: boolean; /** * Consider the scale of the node when calculating the distance.. 缺省false * * If distance is not considered threshold values should be absolute distances. */ scaleDistance?: boolean; }; useScheduler?: boolean; polygonOffset?: boolean; polygonOffsetFactor?: number; polygonOffsetUnits?: number; } /** * 2d的html的标记 */ export class Marker2D extends CSS2DObject { #private; app: App; _anchor: Anchor; _offset: [number, number]; _element: HTMLElement; _color?: string; _scale: number; _defaultMarker: boolean; _draggable: boolean; _rotation: number; _clickTolerance: number; _isDragging: boolean; _state: 'inactive' | 'pending' | 'active'; _pointerdownPos?: Vector2; _unProjectOpts: UnProjectOpts; _allowOverlap: boolean; _options: Marker2dOptions; _opacity: string; _occlusion: boolean; _popup?: Popup2D; _originalTabIndex?: string; signal: { dragstart: Signal; drag: Signal; dragend: Signal; click: Signal; occlusion: Signal; elementSizeReady: Signal; onAdd: Signal; onRemove: Signal; }; isMarker2D: boolean; constructor(options?: Marker2dOptions); isShow(): boolean; show(): void; hide(): void; /** * 获取位置 * */ getPosition(): Vector3; /** * 设置位置 * */ setPosition(pos: Vector3 | [number, number, number] | number, y?: number, z?: number): void; _onKeyPress(e: KeyboardEvent): void; togglePopup(): this; setPopup(popup?: Popup2D): this; /** * 增加至应用或实体中 * */ addTo(app: App | Entity | Object3D, curApp?: App): this; /** * 获取元素对象 * */ getElement(): Element; /** * 得到透明度 * */ getOpacity(): number; /** * 设置透明度 * */ setOpacity(opacity: string | number): void; _onMapClick(e: InteractiveEvent): void; _onMove(e: InteractiveEvent): void; _onUp(): void; _addDragHandler(e: InteractiveEvent): void; /** * 设置是否允许重叠 */ setAllowOverlap(allowOverlap: boolean): void; getBoundingRect(): { x1: number; y1: number; x2: number; y2: number; cx: number; cy: number; rotation: number; position: Vector3; zIndex: number; id: string; groupName: string; setVisible: (visible: any) => void; }; /** * 是否允许重叠 */ isAllowOverlap(): boolean; /** * 设置是否可拖动 * */ setDraggable(shouldBeDraggable: boolean): this; /** * 是否可拖动 * */ isDraggable(): boolean; /** * 移除 * */ remove(...object: Object3D[]): this; /** * 设置动画 * @param animationType * MAP_ANIMATION_NONE 无动画 * MAP_ANIMATION_BOUNCE 弹跳 * MAP_ANIMATION_DROP 坠落 */ setAnimation(animationType: "MAP_ANIMATION_NONE" | "MAP_ANIMATION_BOUNCE" | "MAP_ANIMATION_DROP" | ""): void; /** * 设置光标 * @param cur 光标名称 */ setCursor(cur: string): void; } export interface Marker2dOptions { /** html元素 */ element?: HTMLElement; /** 图片 element为空时有效*/ image?: { /** 图像地址,可以是svg */ src: string; /** 宽 */ width?: number; /** 高 */ height?: number; }; /** 偏移像素量 */ offset?: [number, number]; /** 位置 */ position?: [number, number, number] | Vector3; /** 对齐方式 */ anchor?: Anchor; /** 颜色 */ color?: string; /** 缩放比例 */ scale?: number; /** 是否可拖动 默认xz平面(地图模式xy平面), 按shift键捕捉到实体 按ctrl键垂直于相机平面的位置点 */ draggable?: boolean; /** 旋转角度(0-360) */ rotation?: number; /** 点击拖动时超过此距离即以为是开始拖动 */ clickTolerance?: number; /** 是否允许重叠 默认是 */ allowOverlap?: boolean; /** 碰撞检测时的zindex,值越大,越往上 */ collideZIndex?: number; /** 同一个id会一起显示和隐藏 */ collideId?: string; /** 碰撞监测组名 会对同一个组名内的进行碰撞检测 */ collideGroupName?: string; /** 碰撞检测时,如果有弹出信息框也包括信息框的范围 默认是 */ collideIncludePopup?: boolean; /** 拖动时位置投影选项 */ dragUnProjectOpts?: UnProjectOpts; /** 透明度随相机距离大小 */ fadeDistance?: number; /** 遮挡时的透明度 */ occlusionOpacity?: number; /** 当透明度小于这个值时不响应事件 默认0.1 */ disableOpacity?: number; /** 拖动变化是否以命令执行(可撤销重做) 默认是 */ dragAsCommand?: boolean; /** 开始时隐藏 */ isHide?: boolean; } /** * 3d的html的标记 */ export class Marker3D extends Object3D { #private; private _defaultMarker; pixelWidth: number; pixelHeight: number; _options: Marker3dOptions; app: App; css3dObject: CSS3DObject | CSS3DSprite; maskMesh: Mesh | Sprite; _popup?: Popup2D; _originalTabIndex?: string; _opacity: string; _occlusion: boolean; signal: { click: Signal; occlusion: Signal; elementSizeReady: Signal; onAdd: Signal; onRemove: Signal; }; isMarker3D: boolean; constructor(options?: Marker3dOptions); isShow(): boolean; show(): void; hide(): void; getElement(): HTMLElement; updateSize(w?: number, h?: number): void; /** * 获取位置 * */ getPosition(): Vector3; /** * 设置位置 * */ setPosition(pos: Vector3 | [number, number, number] | number, y?: number, z?: number): void; /** * 更新弹出框信息窗口位置 * */ updatePopupPosition(): void; /** * 增加至应用中 * */ addTo(app: App | Entity | Object3D, curApp?: App): void; isCss3dSprite(): boolean; togglePopup(): this; /** * 得到透明度 * */ getOpacity(): number; /** * 设置透明度 * */ setOpacity(opacity: string | number): void; _onMapClick(e: InteractiveEvent): void; _onKeyPress(e: KeyboardEvent): void; setPopup(popup?: Popup2D): this; /** * 移除 * */ remove(...object: Object3D[]): this; /** * 设置动画 * @param animationType * MAP_ANIMATION_NONE 无动画 * MAP_ANIMATION_BOUNCE 弹跳 * MAP_ANIMATION_DROP 坠落 */ setAnimation(animationType: "MAP_ANIMATION_NONE" | "MAP_ANIMATION_BOUNCE" | "MAP_ANIMATION_DROP" | ""): void; /** * 设置光标 * @param cur 光标名称 */ setCursor(cur: string): void; } export interface Marker3dOptions { element?: HTMLElement; /** 图片 element为空时有效*/ image?: { /** 图像地址,可以是svg */ src: string; /** 宽 */ width?: number; /** 高 */ height?: number; }; color?: string; width?: number; height?: number; pixelWidth?: number; pixelHeight?: number; asSprite?: boolean; anchor?: Anchor; popupAnchor?: Anchor; popupOffset?: PopopOffset; rotation?: [number, number, number]; occlude?: boolean; occludeMaterial?: Record; createMaskObject?: boolean; disableOpacity?: number; fadeDistance?: number; occlusionOpacity?: number; /** 开始时隐藏 */ isHide?: boolean; } /** * Marks an object so that it will never be converted to a proxy. Returns the * object itself. * * @example * ```js * const foo = markRaw({}) * console.log(isReactive(reactive(foo))) // false * * // also works when nested inside other reactive objects * const bar = reactive({ foo }) * console.log(isReactive(bar.foo)) // false * ``` * * **Warning:** `markRaw()` together with the shallow APIs such as * {@link shallowReactive()} allow you to selectively opt-out of the default * deep reactive/readonly conversion and embed raw, non-proxied objects in your * state graph. * * @param value - The object to be marked as "raw". */ function markRaw(value: T): Raw; /** * A 3x3 matrix. * Authored by {@link http://github.com/schteppe/ schteppe} */ class Mat3 { /** * A vector of length 9, containing all matrix elements. */ elements: number[]; /** * @param elements A vector of length 9, containing all matrix elements. */ constructor(elements?: number[]); /** * Sets the matrix to identity * @todo Should perhaps be renamed to `setIdentity()` to be more clear. * @todo Create another function that immediately creates an identity matrix eg. `eye()` */ identity(): void; /** * Set all elements to zero */ setZero(): void; /** * Sets the matrix diagonal elements from a Vec3 */ setTrace(vector: Vec3): void; /** * Gets the matrix diagonal elements */ getTrace(target?: Vec3): Vec3; /** * Matrix-Vector multiplication * @param v The vector to multiply with * @param target Optional, target to save the result in. */ vmult(v: Vec3, target?: Vec3): Vec3; /** * Matrix-scalar multiplication */ smult(s: number): void; /** * Matrix multiplication * @param matrix Matrix to multiply with from left side. */ mmult(matrix: Mat3, target?: Mat3): Mat3; /** * Scale each column of the matrix */ scale(vector: Vec3, target?: Mat3): Mat3; /** * Solve Ax=b * @param b The right hand side * @param target Optional. Target vector to save in. * @return The solution x * @todo should reuse arrays */ solve(b: Vec3, target?: Vec3): Vec3; /** * Get an element in the matrix by index. Index starts at 0, not 1!!! * @param value If provided, the matrix element will be set to this value. */ e(row: number, column: number): number; e(row: number, column: number, value: number): void; /** * Copy another matrix into this matrix object. */ copy(matrix: Mat3): Mat3; /** * Returns a string representation of the matrix. */ toString(): string; /** * reverse the matrix * @param target Target matrix to save in. * @return The solution x */ reverse(target?: Mat3): Mat3; /** * Set the matrix from a quaterion */ setRotationFromQuaternion(q: Quaternion_2): Mat3; /** * Transpose the matrix * @param target Optional. Where to store the result. * @return The target Mat3, or a new Mat3 if target was omitted. */ transpose(target?: Mat3): Mat3; } /** * Defines a physics material. */ class Material_2 { /** * Material name. * If options is a string, name will be set to that string. * @todo Deprecate this */ name: string; /** Material id. */ id: number; /** * Friction for this material. * If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ friction: number; /** * Restitution for this material. * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ restitution: number; static idCounter: number; constructor(options?: { /** * Friction for this material. * If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ friction?: number; /** * Restitution for this material. * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ restitution?: number; } | string); } export type MaterialConstructor = new (opts: { [key: string]: any; }) => Material; type MaterialOptions = ConstructorParameters[0]; type MaterialParams = ConstructorParameters[0]; namespace matrix { export { create, identity, copy, mul, translate, rotate, scale, invert, clone, MatrixArray } } type MatrixArray = number[]; /** * 求两个向量最大值 */ function max(out: T, v1: VectorArray, v2: VectorArray): T; /** * * Returns highest value out of 2 supplied * @param {number} a * @param {number} b * @returns {number} */ export function max2(a: any, b: any): any; /** * Returns highest value out of 3 supplied * @param {number} a * @param {number} b * @param {number} c * @returns {number} */ export function max3(a: any, b: any, c: any): any; export function maxNumberToInfinity(value: number): number; /** 求一个数组的最大值 */ export function maxValue(arr: number[]): number; type MaybeRef = T | Ref; type MaybeRefOrGetter = MaybeRef | (() => T); /** * 测量要绘制元素的矩形大小 * @param element 要绘制元素 * @param maxSize 最大的大小,默认20000 * @returns */ const measureBoundingRect: (element: Element_2 | Element_2[], maxSize?: number) => BoundingRect; export interface MeasureRulerOptions { /** 标尺起始点 */ startPoint: Vector3 | [number, number, number]; /** 标尺结束点 */ endPoint: Vector3 | [number, number, number]; /** 标尺所在平面的另外一点,默认原心(0,0,0) */ planePoint?: Vector3 | [number, number, number]; /** 标尺线样式 */ rulerLineStyle?: LineMaterialParameters_2; /**两侧线样式 */ sideLineStyle?: LineMaterialParameters_2; /** 两侧线长度, 为零不显示 */ sideLineLength?: number; /** 箭头样式 */ arrowStyle?: { /** 颜色 */ color?: ColorRepresentation; /** 透明度(0-1) */ opacity?: number; }; /** 箭头长度, 为零不显示 */ arrowLineLength?: number; /** 箭头高度, 为零不显示 */ arrowLineHeight?: number; /** 文本 */ textStyle?: LabelOptions; /** 小数点位数,默认2 */ fractionDigits?: number; /** 自动求坐标的相对于线长度的比例 默认 1/ 15*/ distRatio?: number; /** 自动转换为地图坐标 默认true */ autoFromWorld?: boolean; /** 显示文字回调 */ showTextCb?: (ptStart: Vector3, ptEnd: Vector3, dist: number, fractionDigits: number) => string; /** 设置文字旋转回调 */ textAngleCb?: (ptStart: Vector3, ptEnd: Vector3, quat: Quaternion) => [ { axis: Vector3 | "x" | "y" | "z"; angle: number; } ] | undefined; } export interface MemorizedFunctionColorGenerator { type: 'memorizedFunction'; startGen(memory: any): void; genColor(color: Vector4, t: number, memory: any): Vector4; toJSON(): FunctionJSON; clone(): MemorizedFunctionColorGenerator; } function merge, S extends Dictionary>(target: T, source: S, overwrite?: boolean): T & S; function merge(target: T, source: S, overwrite?: boolean): T | S; /** * @param targetAndSources The first item is target, and the rests are source. * @param overwrite * @return Merged result */ function mergeAll(targetAndSources: any[], overwrite?: boolean): any; function mergeAttributes(attributes: BufferAttribute[]): BufferAttribute; function mergeGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry; function mergeGroups(geometry: BufferGeometry): BufferGeometry; /** * Merge multiple paths */ function mergePath(pathEls: Path[], opts: PathProps): Path; function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry; class MeshBVH { readonly geometry: BufferGeometry; static serialize(bvh: MeshBVH, options?: MeshBVHSerializeOptions): SerializedBVH; static deserialize(data: SerializedBVH, geometry: BufferGeometry, options?: MeshBVHDeserializeOptions): MeshBVH; constructor(geometry: BufferGeometry, options?: MeshBVHOptions); raycast(ray: Ray, materialOrSide: Side | Array | Material): Array; raycastFirst(ray: Ray, materialOrSide: Side | Array | Material): Intersection; intersectsSphere(sphere: Sphere): boolean; intersectsBox(box: Box3, boxToMesh: Matrix4): boolean; intersectsGeometry(geometry: BufferGeometry, geometryToBvh: Matrix4): boolean; closestPointToPoint(point: Vector3, target?: HitPointInfo, minThreshold?: number, maxThreshold?: number): HitPointInfo | null; closestPointToGeometry(geometry: BufferGeometry, geometryToBvh: Matrix4, target1?: HitPointInfo, target2?: HitPointInfo, minThreshold?: number, maxThreshold?: number): HitPointInfo | null; shapecast(callbacks: { intersectsBounds: (box: Box3, isLeaf: boolean, score: number | undefined, depth: number, nodeIndex: number) => ShapecastIntersection | boolean; boundsTraverseOrder?: (box: Box3) => number; } & ({ intersectsRange: (triangleOffset: number, triangleCount: number, contained: boolean, depth: number, nodeIndex: number, box: Box3) => boolean; } | { intersectsTriangle: (triangle: ExtendedTriangle, triangleIndex: number, contained: boolean, depth: number) => boolean | void; })): boolean; bvhcast(otherBVH: MeshBVH, matrixToLocal: Matrix4, callbacks: ({ intersectsRanges: (offset1: number, count1: number, offset2: number, count2: number, depth1: number, index1: number, depth2: number, index2: number) => boolean; } | { intersectsTriangles: (triangle1: ExtendedTriangle, triangle2: ExtendedTriangle, i1: number, i2: number, depth1: number, index1: number, depth2: number, index2: number) => boolean; })): boolean; traverse(callback: (depth: number, isLeaf: boolean, boundingData: ArrayBuffer, offsetOrSplit: number, count: number) => void, rootIndex?: number): void; refit(nodeIndices?: Array | Set): void; getBoundingBox(target: Box3): Box3; } interface MeshBVHDeserializeOptions { setIndex?: boolean; } class MeshBVHHelper extends Group_2 { opacity: number; depth: number; displayParents: boolean; displayEdges: boolean; edgeMaterial: LineBasicMaterial; meshMaterial: MeshBasicMaterial; constructor(mesh: Mesh, depth?: number); update(): void; get color(): Color; } interface MeshBVHOptions { strategy?: SplitStrategy; maxDepth?: number; maxLeafTris?: number; setBoundingBox?: boolean; useSharedArrayBuffer?: boolean; verbose?: boolean; onProgress?: (progress: number) => void; } interface MeshBVHSerializeOptions { cloneBuffers?: boolean; } class MeshBVHUniformStruct { updateFrom(bvh: MeshBVH): void; dispose(): void; } /** * mesh实体 */ export class MeshEntity extends Entity { /** * mesh对象 */ mesh: Mesh; /** * 获取最开始的原生材质,为空表示没有修改过 */ nativeMaterial: () => Material | Material[]; /** * 获取替换后的正使用的材质,为空表示没有修改过 */ useMaterial: () => Material | Material[]; /** * 获取可修改的材质对象 */ readonly material: Material | Material[]; /** * 增加模型边框线 * @param option * @param isHideMesh 是否隐藏mesh本身(默认false) */ addEdges: (option?: LineBasicMaterialParameters, isHideMesh?: boolean) => void; /** * 移除模型边框线 */ clearEdges: () => void; /** * 获取模型边框线 */ getEdges: () => any; /** * 替换材质 */ replaceMaterial: (material: Material | Material[]) => void; /** * 恢复材质 */ resetMaterial: () => void; /** 设置热力图数据分析材质 */ setHeatmapDataMaterial: (options: { /** 数据 */ data: { x: number; y: number; z: number; /** 值 */ value: number; }[]; /** x轴分段数 默认20 */ segmentX?: number; /** y轴分段数 默认20 */ segmentY?: number; /** z轴分段数 默认20 */ segmentZ?: number; /** 数据最大值 */ dataMax?: number; /** 数据最小值 */ dataMin?: number; /** 颜色表[值(0-1),颜色],默认为 [[ 0.0, 0x0000FF ], [ 0.2, 0x00FFFF ], [ 0.5, 0x00FF00 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFF0000 ]] */ colorMap?: [number, number][]; /** 颜色表分的总数 默认100 */ colorCount?: number; /** 插值选项 */ interpolation?: { /** 使用反距离权重插值法 */ useInvDistWeight?: boolean; /** 反距离幂指数,用于控制距离和权重之间的关系 缺省值2 */ power?: number; /** 模型 默认 exponential*/ model?: "gaussian" | "exponential" | "spherical" | "circle" | "linear"; /** sigma2是σ²,对应高斯过程的方差参数,也就是这组数据z的距离,方差参数σ²的似然性反映了高斯过程中的误差,并应手动设置。一般设置为 0 ,其他数值设了可能会出空白图 */ sigma2?: number; /** Alpha α对应方差函数的先验值,此参数可能控制钻孔扩散范围,越小范围越大,少量点效果明显,但点多了且分布均匀以后改变该数字即基本无效果了,默认设置为100 */ alpha?: number; }; }) => Promise<{ lut: Lut; material: ShaderMaterial; reset: () => void; }>; /** * 是否高亮 */ isHighlight: () => boolean; /** * 设置高亮 */ setHighlight: (color: ColorRepresentation, opacity: number) => {}; /** * 清除高亮 */ clearHighlight: () => void; /** * 获取高亮材质 */ highlightMaterial: () => Material | Material[]; /** * 设置透明度 * @param opacity 透明度0(完全透明)-1(不透明) * @param isAccOpacity 是否累加透明度(ture和之前透明度相乘,false直接设置透明度) */ setOpacity: (opacity: number, isAccOpacity?: boolean) => void; /** * 获取透明度材质 */ opacityMaterial: () => Material | Material[]; constructor(mesh: Mesh, options?: MeshEntityOptions); } export interface MeshEntityOptions extends EntityOptions { selected?: boolean; bloom?: boolean; outline?: boolean; } export class MeshLine extends Mesh { readonly isMeshLine = true; readonly type = "MeshLine"; raycast(raycaster: Raycaster, intersects: Intersection[]): void; } export class MeshLineGeometry extends BufferGeometry { #private; readonly isMeshLineGeometry = true; readonly type = "MeshLineGeometry"; /** * A callback to be called for each point to determine the width of the line * at that point. Although `setPoints` accepts this function as an argument, * this has to be a public property so it can be used as a prop in * react-three-fiber. */ widthCallback: ((point: number, index: number) => number) | null; smooth?: boolean; curvePointNum?: number; curvePointPosRatio?: number; attributes: Partial<{ position: Float32BufferAttribute; previous: Float32BufferAttribute; next: Float32BufferAttribute; side: Float32BufferAttribute; width: Float32BufferAttribute; uv: Float32BufferAttribute; counters: Float32BufferAttribute; index: Uint16BufferAttribute; }>; /** * As an alternative to meshLine.setPoints(points), we can set * meshLine.points = points. This was added for and is public for use as a * prop in react-three-fiber. */ get points(): Vector3[] | WritableArrayLike; set points(value: Vector3[] | WritableArrayLike); setPoints(points: Array | WritableArrayLike, widthCallback?: ((point: number, index: number) => number) | null, smooth?: boolean, updateBounds?: boolean): void; /** * Fast method to advance the line by one position. The oldest position is removed. */ advance(position: Vector3): void; } export class MeshLineMaterial extends ShaderMaterial { readonly isMeshLineMaterial = true; readonly type = "MeshLineMaterial"; uniforms: (typeof UniformsLib)['fog'] & { lineWidth: IUniform; map: IUniform; useMap: IUniform; alphaMap: IUniform; useAlphaMap: IUniform; color: IUniform; opacity: IUniform; resolution: IUniform; sizeAttenuation: IUniform; dashArray: IUniform; dashOffset: IUniform; dashRatio: IUniform; useDash: IUniform; visibility: IUniform; alphaTest: IUniform; repeat: IUniform; offset: IUniform; time: IUniform; speed: IUniform; }; constructor(parameters: ShaderMaterialParameters & MeshLineMaterial); copy(source: MeshLineMaterial): this; } export interface MeshLineMaterial { fogColor: Color; fogDensity: number; fogNear: number; fogFar: number; lineWidth: number; map: Texture; useMap: boolean; alphaMap: Texture; useAlphaMap: boolean; color: Color; opacity: number; resolution?: Vector2 | { value: Vector2; }; sizeAttenuation: boolean; dashArray: number; dashOffset: number; dashRatio: number; useDash: boolean; visibility: number; alphaTest: number; repeat: Vector2; offset: Vector2; time?: Vector4 | { value: Vector4; }; speed: Vector2; } /** * mesh模块 */ export class MeshModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; constructor(entity: Entity, options?: MeshModuleOption); /** * mesh对象 */ get mesh(): Mesh, Material | Material[], Object3DEventMap>; /** * 获取最开始的原生材质,为空表示没有修改过 */ rawMaterial(): any; /** * 获取替换后的正使用的材质,为空表示没有修改过 */ useMaterial(): any; /** * 获取可修改的材质对象 */ get material(): any; /** * 增加模型边框线 * @param option * @param isHideMesh 是否隐藏mesh本身(默认false) */ addEdges(option?: LineBasicMaterialParameters, isHideMesh?: boolean): void; /** * 移除模型边框线 */ clearEdges(): void; /** * 获取模型边框线 */ getEdges(): any; /** * 替换材质 */ replaceMaterial(material: Material | Material[]): void; /** * 恢复材质 */ resetMaterial(): void; /** 设置热力图数据分析材质 */ setHeatmapDataMaterial(options: { /** 数据 */ data: { x: number; y: number; z: number; /** 值 */ value: number; }[]; /** x轴分段数 默认10 */ segmentX?: number; /** y轴分段数 默认10 */ segmentY?: number; /** z轴分段数 默认10 */ segmentZ?: number; /** 数据最大值 */ dataMax?: number; /** 数据最小值 */ dataMin?: number; /** 颜色表[值(0-1),颜色],默认为 [[ 0.0, 0x0000FF ], [ 0.2, 0x00FFFF ], [ 0.5, 0x00FF00 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFF0000 ]] */ colorMap?: [number, number][]; /** 颜色表分的总数 默认100 */ colorCount?: number; /** 插值选项 */ interpolation?: { /** 使用反距离权重插值法 */ useInvDistWeight?: boolean; /** 反距离幂指数,用于控制距离和权重之间的关系 缺省值2 */ power?: number; /** 模型 默认 exponential*/ model?: "gaussian" | "exponential" | "spherical" | "circle" | "linear"; /** sigma2是σ²,对应高斯过程的方差参数,也就是这组数据z的距离,方差参数σ²的似然性反映了高斯过程中的误差,并应手动设置。一般设置为 0 ,其他数值设了可能会出空白图 */ sigma2?: number; /** Alpha α对应方差函数的先验值,此参数可能控制钻孔扩散范围,越小范围越大,少量点效果明显,但点多了且分布均匀以后改变该数字即基本无效果了,默认设置为100 */ alpha?: number; }; /** 材质参数 */ MaterialParameters?: ShaderMaterialParameters; }): Promise<{ lut: Lut; material: ShaderMaterial; reset: () => void; }>; /** * 是否高亮 */ isHighlight(): boolean; /** * 设置高亮 */ setHighlight(color?: ColorRepresentation, opacity?: number): void; /** * 清除高亮 */ clearHighlight(): void; /** * 获取高亮材质 */ highlightMaterial(): any; /** * 设置透明度 * @param opacity 透明度0(完全透明)-1(不透明) * @param isAccOpacity 是否累加透明度(ture和之前透明度相乘,false直接设置透明度) */ setOpacity(opacity: number, isAccOpacity?: boolean): void; /** * 获取透明度材质 */ opacityMaterial(): any; onDestroy(): void; toJSON(): { mesh: { uuid: string; }; }; fromJSON(data: Record, objects: Map): void; setupUiConfig(): UiObjectConfig; } export interface MeshModuleOption { mesh: Mesh; } export interface MeshPhysicsObject { body?: CANNON.Body | PhysicsBodyOption; type?: ShapeType2; copyPosition?: boolean; copyQuaternion?: boolean; } export interface MeshPhysicsObjectParams extends MeshPhysicsObject { mesh: Object3D | Entity; } /** * A material for reflection, which has blur support. */ export class MeshReflectorMaterial { app: App; parent: Mesh; material: MeshReflectorMaterialImpl; virtualCamera: PerspectiveCamera; fbo1: WebGLRenderTarget; fbo2: WebGLRenderTarget; blurpass: BlurPass; hasBlur: boolean; ignoreObjects: Object3D[]; beforeRender: () => void; constructor(app: App, parent: Mesh, config?: Partial); update(): void; } export interface MeshReflectorMaterialConfig { resolution: number; mixBlur: number; mixStrength: number; blur: [number, number] | number; mirror: number; ignoreObjects: Object3D[]; } class MeshReflectorMaterialImpl extends MeshStandardMaterial { _tDepth: UninitializedUniform; _distortionMap: UninitializedUniform; _tDiffuse: UninitializedUniform; _tDiffuseBlur: UninitializedUniform; _textureMatrix: UninitializedUniform; _hasBlur: { value: boolean; }; _mirror: { value: number; }; _mixBlur: { value: number; }; _blurStrength: { value: number; }; _minDepthThreshold: { value: number; }; _maxDepthThreshold: { value: number; }; _depthScale: { value: number; }; _depthToBlurRatioBias: { value: number; }; _distortion: { value: number; }; _mixContrast: { value: number; }; constructor(parameters?: {}); onBeforeCompile(shader: any): void; get tDiffuse(): Texture | null; set tDiffuse(v: Texture | null); get tDepth(): Texture | null; set tDepth(v: Texture | null); get distortionMap(): Texture | null; set distortionMap(v: Texture | null); get tDiffuseBlur(): Texture | null; set tDiffuseBlur(v: Texture | null); get textureMatrix(): Matrix4 | null; set textureMatrix(v: Matrix4 | null); get hasBlur(): boolean; set hasBlur(v: boolean); get mirror(): number; set mirror(v: number); get mixBlur(): number; set mixBlur(v: number); get mixStrength(): number; set mixStrength(v: number); get minDepthThreshold(): number; set minDepthThreshold(v: number); get maxDepthThreshold(): number; set maxDepthThreshold(v: number); get depthScale(): number; set depthScale(v: number); get depthToBlurRatioBias(): number; set depthToBlurRatioBias(v: number); get distortion(): number; set distortion(v: number); get mixContrast(): number; set mixContrast(v: number); } export interface MeshSettings { /** * Rotation axis. * @type {Vector3} */ rotationAxis?: Vector3; /** * Initial rotation around the X-axis. * @type {ValueGenerator | FunctionValueGenerator} */ startRotationX: ValueGenerator | FunctionValueGenerator; /** * Initial rotation around the Y-axis. * @type {ValueGenerator | FunctionValueGenerator} */ startRotationY: ValueGenerator | FunctionValueGenerator; /** * Initial rotation around the Z-axis. * @type {ValueGenerator | FunctionValueGenerator} */ startRotationZ: ValueGenerator | FunctionValueGenerator; } /** * A particle emitter that emits particles from the surface of a mesh uniformly. */ export class MeshSurfaceEmitter implements EmitterShape { type: string; private _triangleIndexToArea; private _geometry?; get geometry(): BufferGeometry | undefined; set geometry(geometry: BufferGeometry | undefined); constructor(geometry?: BufferGeometry); private _tempA; private _tempB; private _tempC; initialize(p: Particle): void; toJSON(): ShapeJSON; static fromJSON(json: any, meta: JsonMetaData): MeshSurfaceEmitter; clone(): EmitterShape; update(system: ParticleSystem, delta: number): void; } /** * Reference: https://blog.maximeheckel.com/posts/refraction-dispersion-and-other-shader-light-effects/ */ export class MeshTransmissionMaterial { fbo: WebGLRenderTarget; fboBack: WebGLRenderTarget; material: ShaderMaterial; parent: Mesh; backside: boolean; background: Texture | Color | null; oldBg: Texture | Color | null; app: App; constructor(app: App, parent: Mesh, config?: Partial); update(): void; } export interface MeshTransmissionMaterialConfig { backside: boolean; samples: number; background: Texture | Color | null; chromaticAberration: number; refraction: number; saturation: number; lightPosition: Vector3; diffuse: number; specular: number; fresnel: number; fresnelColor: Color; } /** * Interface representing metadata used in Threejs object toJSON method. */ export interface MetaData { geometries: { [key: string]: any; }; materials: { [key: string]: any; }; textures: { [key: string]: any; }; images: { [key: string]: any; }; shapes: { [key: string]: any; }; skeletons: { [key: string]: any; }; animations: { [key: string]: any; }; nodes: { [key: string]: any; }; } interface Methods { GET: "GET"; POST: "POST"; PUT: "PUT"; DELETE: "DELETE"; PATCH: "PATCH"; OPTIONS: "OPTIONS"; HEAD: "HEAD"; } /** * 求两个向量最小值 */ function min(out: T, v1: VectorArray, v2: VectorArray): T; /** * Returns lowest value out of 2 supplied * @param {number} a * @param {number} b * @returns {number} */ export function min2(a: any, b: any): any; /** * Returns lowest value out of 3 supplied * @param {number} a * @param {number} b * @param {number} c * @returns {number} */ export function min3(a: any, b: any, c: any): any; /** 小地图控件 */ export class MiniMapControl { private container; private panel; private app; private readonly style; options: MiniMapControlOption; private _miniMapRenderer; private mapRotateZ; private _miniMapDomEl; private _miniMapCamera; private mapSyncRotateZ; private followTarget; constructor(options?: MiniMapControlOption); setFollowTarget(followTarget: Object3D): void; insertControl(): void; updateCamera(): void; onAdd(app: App): HTMLElement; onUpdate(): void; onRemove(): void; getDefaultPosition(): string; } export interface MiniMapControlOption { /** 背景样式 */ bkDivStyle?: { border: string; backgroundColor: string; }; /** 背景样式 */ mapDivStyle?: Partial; /** 节流时间 ms*/ throttleTime?: number; /** 主场景 默认用应用的场景 */ scene?: Scene; /** 主场景 地图以之为中心点的3D目标 */ followTarget?: Object3D; /** 跟随目标时相机高度 默认10*/ followTargetCameraHeight?: number; /** 决定了摄像机看到的内容大小,默认10 */ mapSize?: number; /** 决定了小地图2D平面的大小,默认200 */ mapRenderSize?: number; /** 小地图沿着Z轴(垂直屏幕)旋转角度,默认0 */ mapRotateZ?: number; /** 小地图沿着Z轴(垂直屏幕)是否跟着一同target旋转,默认false */ mapSyncRotateZ?: boolean; /** 渲染参数 */ rendererParameters?: WebGLRendererParameters; /** 是否可使用阴影 默认是*/ shadowMapEnabled?: boolean; /** 相机选项,默认正交相机 */ cameraOption?: CameraOptions; /** 相机更新回调 如果返回true将不调用默认的行为 */ cameraUpdate?: (camera: Camera, target?: Object3D, context?: any) => boolean; } /** 求一个数组的最小值 */ export function minValue(arr: number[]): number; function mixin(target: T | Function, source: S | Function, override?: boolean): void; /** * Check if the browser is running on a mobile or tablet device. */ export function mobileAndTabletCheck(): boolean; /** * 模型模块 */ export class ModelModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; modelEntity: Entity; signal: { onLoad: Signal; onError: Signal; }; constructor(entity: Entity, options?: ModelModuleOptions); /** 获取所有Mesh实体 */ getMeshEntities(): any[]; } /** * 模型选项 */ export interface ModelModuleOptions extends ILoadModelOption { url: string; } /** * @param color * @param alpha 0 ~ 1 * @return Color string in rgba format. * @memberOf module:render2d/util/color */ function modifyAlpha(color: string, alpha?: number): string; /** * @param color * @param h 0 ~ 360, ignore when null. * @param s 0 ~ 1, ignore when null. * @param l 0 ~ 1, ignore when null. * @return Color string in rgba format. * @memberOf module:render2d/util/color */ function modifyHSL(color: string, h?: number, s?: number, l?: number): string; export class ModuleBase extends AppObject { private _awoken; private _phasedActive; private _enabled; appRenderIndex: number; static moduleName: string; /** * Indicates whether the component is enabled. */ get enabled(): boolean; set enabled(value: boolean); } /** * 模块管理 */ export class ModuleManager { modules: Map; private readonly _isApp; private readonly _orderDirty; constructor(isApp?: boolean); addModule(module: ModuleBase): void; getModules(methodName: string): ModuleBase[]; callModules(methodName: string, ...args: any): void; removeModule(module: ModuleBase): void; } /** * Morphing from old path to new path. */ function morphPath(fromPath: Path, toPath: Path, animationOpts: ElementAnimateConfig): Path; namespace morphPathTool { export { alignBezierCurves, centroid, isCombineMorphing, isMorphing, morphPath, combineMorph, separateMorph, CombineMorphingPath, DividePathParams, DividePath, IndividualDelay, CombineConfig, SeparateConfig, split as defaultDividePath } } export type Motion = { [key in keyof FilteredType]: FilteredType[key]; }; /** * Interface for configuring motion animations in a Tween. * You can specify easing, callback functions, and progress tracking functions. * @template T - The type of the target object being tweened. */ export interface MotionConfig { /** The easing function to control the animation's progression. */ easing?: Easing; /** * A callback function to execute when the animation completes. * @param target - The target object that was tweened. * @param isEnd 是否整个动画都结束了 * @param isStop 是否强制终止了 */ onComplete?: (target: T, isEnd: boolean, isStop: boolean) => void; /** * A callback function to execute when the animation starts. * @param target - The target object that is being tweened. */ onStart?: (target: T) => void; /** * A callback function to be executed after each property has been updated. * @param target - The target object that is being tweened. */ onUpdate?: (target: T) => void; /** * A callback function to be executed before each property is updated. * @param target - The target object that is being tweened. * @param key - The key or property being animated. * @param start - The initial value of the animated property. * @param end - The final value of the animated property. * @param alpha - The current animation progress as a normalized value (0 to 1). * @param reversed - 是否反向 * @returns If `false`, will not assign a new value to the property. */ onProgress?: (target: T, key: string, start: AllowedTypes, end: AllowedTypes, alpha: number, reversed: boolean) => boolean | void; } const MOUSE_BUTTON: { readonly LEFT: 1; readonly RIGHT: 2; readonly MIDDLE: 4; }; type MOUSE_BUTTON = typeof MOUSE_BUTTON[keyof typeof MOUSE_BUTTON]; type mouseButtonAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE; interface MouseButtons { left: mouseButtonAction; middle: mouseButtonAction; right: mouseButtonAction; wheel: mouseWheelAction; } /** 鼠标位置控件 */ export class MousePositionControl { #private; private readonly digits; private readonly trackCenter; private readonly labelFormat; private container; private panel; private app; private readonly style; private unProjectModes?; constructor(options?: MousePositionControlOption); insertControl(): void; defaultLabelFormat(x: number, y: number, z: number): string; onMouseMove(evt?: any): Promise; onAdd(app: App): HTMLElement; onRemove(): void; getDefaultPosition(): string; } export interface MousePositionControlOption { digits?: number; trackCenter?: boolean; labelFormat?: (x: number, y: number, z: number, context: MousePositionControl, retIntersectObject?: any) => string; style?: { border: string; backgroundColor: string; }; UnProjectModes?: (UnProjectOpts | "depth")[]; } type mouseWheelAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE; /** * 矩阵相乘 */ function mul(out: MatrixArray, m1: MatrixArray, m2: MatrixArray): MatrixArray; /** * 向量乘法 */ function mul_2(out: T, v1: VectorArray, v2: VectorArray): T; export class MultiCmdsCommand extends BaseCommand { private commands; constructor(commands: ICommand[]); execute(): void; undo(): void; redo(): void; addCommand(cmd: ICommand | ICommand[]): void; execCommand(cmd: ICommand | ICommand[]): void; getCommands(): ICommand[]; } /** * 多条三维线之间根据交点相互分开,返回相交后的所有线段,请确保每条线段不要自相交 * @param lines * @param epsilon 允许误差,默认1e-6 */ export function multiLine3dSplit(lines: Vector3[][], epsilon?: number): { status: boolean; error: string; lines?: undefined; indexs?: undefined; } | { status: boolean; lines: Vector3[][]; indexs: any[]; error?: undefined; }; /** * 多条线之间根据交点相互分开,返回相交后的所有线段 * @param lines 输入的线段集合 * @param dotErr 允许误差的小数点后几位,默认6位 * @param isGetLineIndex 获取结果中是否返回原来线的索引, 默认false */ export function multiLineSplit(lines: GeoPoint[][], dotErr?: number, isGetLineIndex?: boolean): GeoPoint[][] | { newLines: GeoPoint[][]; newLineIndexs: number[]; }; /** * MultiLineString Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.5 */ interface MultiLineString extends GeometryObject { type: "MultiLineString"; coordinates: Position[][]; } /** * MultiPoint Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.3 */ interface MultiPoint extends GeometryObject { type: "MultiPoint"; coordinates: Position[]; } /** * MultiPolygon Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.7 */ interface MultiPolygon extends GeometryObject { type: "MultiPolygon"; coordinates: Position[][][]; } type multiTouchAction = typeof ACTION.TOUCH_DOLLY_ROTATE | typeof ACTION.TOUCH_DOLLY_TRUCK | typeof ACTION.TOUCH_DOLLY_OFFSET | typeof ACTION.TOUCH_ZOOM_ROTATE | typeof ACTION.TOUCH_ZOOM_TRUCK | typeof ACTION.TOUCH_ZOOM_OFFSET | typeof ACTION.TOUCH_DOLLY | typeof ACTION.TOUCH_ZOOM | typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.NONE; type MultiWatchSources = Array | object>; /** * Naive broadphase implementation, used in lack of better ones. * * The naive broadphase looks at all possible pairs without restriction, therefore it has complexity N^2 _(which is bad)_ */ class NaiveBroadphase extends Broadphase { /** * @todo Remove useless constructor */ constructor(); /** * Get all the collision pairs in the physics world */ collisionPairs(world: World, pairs1: Body_2[], pairs2: Body_2[]): void; /** * Returns all the bodies within an AABB. * @param result An array to store resulting bodies in. */ aabbQuery(world: World, aabb: AABB, result?: Body_2[]): Body_2[]; } /** * Helper class for the World. Generates ContactEquations. * @todo Sphere-ConvexPolyhedron contacts * @todo Contact reduction * @todo should move methods to prototype */ class Narrowphase { /** * Internal storage of pooled contact points. */ contactPointPool: ContactEquation[]; frictionEquationPool: FrictionEquation[]; result: ContactEquation[]; frictionResult: FrictionEquation[]; /** * Pooled vectors. */ v3pool: Vec3Pool; world: World; currentContactMaterial: ContactMaterial; enableFrictionReduction: boolean; get [COLLISION_TYPES.sphereSphere](): (si: Sphere_2, sj: Sphere_2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => boolean | void; get [COLLISION_TYPES.spherePlane](): (si: Sphere_2, sj: Plane_2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.boxBox](): (si: Box, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.sphereBox](): (si: Sphere_2, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.planeBox](): (si: Plane_2, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.convexConvex](): (si: ConvexPolyhedron, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean, faceListA?: number[], faceListB?: number[]) => true | void; get [COLLISION_TYPES.sphereConvex](): (si: Sphere_2, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.planeConvex](): (planeShape: Plane_2, convexShape: ConvexPolyhedron, planePosition: Vec3, convexPosition: Vec3, planeQuat: Quaternion_2, convexQuat: Quaternion_2, planeBody: Body_2, convexBody: Body_2, si?: Shape, sj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.boxConvex](): (si: Box, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.sphereHeightfield](): (sphereShape: Sphere_2, hfShape: Heightfield, spherePos: Vec3, hfPos: Vec3, sphereQuat: Quaternion_2, hfQuat: Quaternion_2, sphereBody: Body_2, hfBody: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.boxHeightfield](): (si: Box, sj: Heightfield, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.convexHeightfield](): (convexShape: ConvexPolyhedron, hfShape: Heightfield, convexPos: Vec3, hfPos: Vec3, convexQuat: Quaternion_2, hfQuat: Quaternion_2, convexBody: Body_2, hfBody: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.sphereParticle](): (sj: Sphere_2, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.planeParticle](): (sj: Plane_2, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.boxParticle](): (si: Box, sj: Particle2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.convexParticle](): (sj: ConvexPolyhedron, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.cylinderCylinder](): (si: ConvexPolyhedron, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean, faceListA?: number[], faceListB?: number[]) => true | void; get [COLLISION_TYPES.sphereCylinder](): (si: Sphere_2, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.planeCylinder](): (planeShape: Plane_2, convexShape: ConvexPolyhedron, planePosition: Vec3, convexPosition: Vec3, planeQuat: Quaternion_2, convexQuat: Quaternion_2, planeBody: Body_2, convexBody: Body_2, si?: Shape, sj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.boxCylinder](): (si: Box, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.convexCylinder](): (si: ConvexPolyhedron, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean, faceListA?: number[], faceListB?: number[]) => true | void; get [COLLISION_TYPES.heightfieldCylinder](): (hfShape: Heightfield, convexShape: Cylinder, hfPos: Vec3, convexPos: Vec3, hfQuat: Quaternion_2, convexQuat: Quaternion_2, hfBody: Body_2, convexBody: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.particleCylinder](): (si: Particle2, sj: Cylinder, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.sphereTrimesh](): (sphereShape: Sphere_2, trimeshShape: Trimesh, spherePos: Vec3, trimeshPos: Vec3, sphereQuat: Quaternion_2, trimeshQuat: Quaternion_2, sphereBody: Body_2, trimeshBody: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; get [COLLISION_TYPES.planeTrimesh](): (planeShape: Plane_2, trimeshShape: Trimesh, planePos: Vec3, trimeshPos: Vec3, planeQuat: Quaternion_2, trimeshQuat: Quaternion_2, planeBody: Body_2, trimeshBody: Body_2, rsi?: Shape, rsj?: Shape, justTest?: boolean) => true | void; constructor(world: World); /** * Make a contact object, by using the internal pool or creating a new one. */ createContactEquation(bi: Body_2, bj: Body_2, si: Shape, sj: Shape, overrideShapeA?: Shape | null, overrideShapeB?: Shape | null): ContactEquation; createFrictionEquationsFromContact(contactEquation: ContactEquation, outArray: FrictionEquation[]): boolean; /** * Take the average N latest contact point on the plane. */ createFrictionFromAverage(numContacts: number): void; /** * Generate all contacts between a list of body pairs * @param p1 Array of body indices * @param p2 Array of body indices * @param result Array to store generated contacts * @param oldcontacts Optional. Array of reusable contact objects */ getContacts(p1: Body_2[], p2: Body_2[], world: World, result: ContactEquation[], oldcontacts: ContactEquation[], frictionResult: FrictionEquation[], frictionPool: FrictionEquation[]): void; sphereSphere(si: Sphere_2, sj: Sphere_2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): boolean | void; spherePlane(si: Sphere_2, sj: Plane_2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; boxBox(si: Box, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; sphereBox(si: Sphere_2, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; planeBox(si: Plane_2, sj: Box, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; convexConvex(si: ConvexPolyhedron, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean, faceListA?: number[] | null, faceListB?: number[] | null): true | void; sphereConvex(si: Sphere_2, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; planeConvex(planeShape: Plane_2, convexShape: ConvexPolyhedron, planePosition: Vec3, convexPosition: Vec3, planeQuat: Quaternion_2, convexQuat: Quaternion_2, planeBody: Body_2, convexBody: Body_2, si?: Shape, sj?: Shape, justTest?: boolean): true | void; boxConvex(si: Box, sj: ConvexPolyhedron, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; sphereHeightfield(sphereShape: Sphere_2, hfShape: Heightfield, spherePos: Vec3, hfPos: Vec3, sphereQuat: Quaternion_2, hfQuat: Quaternion_2, sphereBody: Body_2, hfBody: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; boxHeightfield(si: Box, sj: Heightfield, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; convexHeightfield(convexShape: ConvexPolyhedron, hfShape: Heightfield, convexPos: Vec3, hfPos: Vec3, convexQuat: Quaternion_2, hfQuat: Quaternion_2, convexBody: Body_2, hfBody: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; sphereParticle(sj: Sphere_2, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; planeParticle(sj: Plane_2, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; boxParticle(si: Box, sj: Particle2, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; convexParticle(sj: ConvexPolyhedron, si: Particle2, xj: Vec3, xi: Vec3, qj: Quaternion_2, qi: Quaternion_2, bj: Body_2, bi: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; heightfieldCylinder(hfShape: Heightfield, convexShape: Cylinder, hfPos: Vec3, convexPos: Vec3, hfQuat: Quaternion_2, convexQuat: Quaternion_2, hfBody: Body_2, convexBody: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; particleCylinder(si: Particle2, sj: Cylinder, xi: Vec3, xj: Vec3, qi: Quaternion_2, qj: Quaternion_2, bi: Body_2, bj: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; sphereTrimesh(sphereShape: Sphere_2, trimeshShape: Trimesh, spherePos: Vec3, trimeshPos: Vec3, sphereQuat: Quaternion_2, trimeshQuat: Quaternion_2, sphereBody: Body_2, trimeshBody: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; planeTrimesh(planeShape: Plane_2, trimeshShape: Trimesh, planePos: Vec3, trimeshPos: Vec3, planeQuat: Quaternion_2, trimeshQuat: Quaternion_2, planeBody: Body_2, trimeshBody: Body_2, rsi?: Shape | null, rsj?: Shape | null, justTest?: boolean): true | void; } const nativeSlice: (start?: number, end?: number) => any[]; /** * 求负向量 */ function negate(out: T, v: VectorArray): T; class Node_2 { id: string; inputs: (Wire | ConstInput | Adapter | undefined)[]; outputs: Wire[][]; definition: NodeDef; signatureIndex: number; data: NodeData; position: Vector2; outputValues: any[]; constructor(definition: NodeDef, signatureIndex?: number, data?: NodeData); get inputTypes(): NodeValueType[]; get outputTypes(): NodeValueType[]; func(context: ExecutionContext, inputs: any[], outputs: any[]): void; } export { Node_2 as Node } export type NodeData = { [key: string]: any; }; export class NodeDef { name: string; type: NodeType; nodeTypeSignatures: NodeTypeSignature[]; constructor(name: string, type: NodeType); addSignature(inputTypes: NodeValueType[], outputTypes: NodeValueType[], func: NodeExecFunction): void; } type NodeExecFunction = (context: ExecutionContext, data: NodeData, inputs: NodeValue[], outputs: NodeValue[]) => void; export class NodeGraph { uuid: string; name: string; version: string; revision: number; inputNodes: Node_2[]; outputNodes: Node_2[]; allNodes: Map; wires: Wire[]; compiled: boolean; nodesInOrder: Array; constructor(name: string); addWire(wire: Wire): void; addNode(node: Node_2): void; getNode(id: string): Node_2 | undefined; deleteNode(node: Node_2): void; deleteWire(wire: Wire): void; toJSON(): any; clone(): NodeGraph; } type NodeId = string; /** * Particle implementation for node-based particle systems. */ export class NodeParticle implements IParticle { /** * Position of the particle. * @type {Vector3} */ position: Vector3; /** * Velocity of the particle. * @type {Vector3} */ velocity: Vector3; /** * Age of the particle. * @type {number} */ age: number; /** * Life duration of the particle. * @type {number} */ life: number; /** * Size of the particle. * @type {number} */ size: number; /** * Angular velocity of the particle. * @type {number | Quaternion} */ angularVelocity?: number | Quaternion; /** * Rotation of the particle. * @type {number | Quaternion} */ rotation: number | Quaternion; /** * Color of the particle. * @type {Vector4} */ color: Vector4; /** * UV tile index. * @type {number} */ uvTile: number; /** * Indicates if the particle has died. * @type {boolean} */ get died(): boolean; /** * Resets the particle properties to initial values. */ reset(): void; } export enum NodeType { Variable = 0, Expression = 1, Storage = 2, Function = 3 } export const NodeTypes: { [key: string]: NodeDef; }; export interface NodeTypeSignature { inputTypes: NodeValueType[]; outputTypes: NodeValueType[]; func: NodeExecFunction; } type NodeValue = number | boolean | Vector2 | Vector3 | Vector4 | Array; export enum NodeValueType { Number = 0, Vec2 = 1, Vec3 = 2, Vec4 = 3, Boolean = 4, AnyType = 5, NullableAnyType = 6, EventStream = 7 } /** * NodeVFX represents a node graph based visual effect * * @class */ export class NodeVFX implements IParticleSystem { signal: { onRestart: Signal; onPlay: Signal; onPause: Signal; onEnd: Signal; }; emissionGraph: NodeGraph; updateGraph: NodeGraph; interpreter: Interpreter; /** * Determines whether the ParticleSystem should be automatically disposed when it finishes emitting particles. * * @type {boolean} */ autoDestroy: boolean; /** * Determines whether a looping ParticleSystem should prewarm, i.e., the Particle System looks like it has already simulated for one loop when first becoming visible. * * @type {boolean} */ prewarm: boolean; /** * Determines whether the ParticleSystem should loop, i.e., restart emitting particles after the duration of the particle system is expired. * * @type {boolean} */ looping: boolean; /** * The duration of the ParticleSystem in seconds. * * @type {number} */ duration: number; /** * The number of particles in the ParticleSystem. * * @type {number} */ particleNum: number; /** * Determines whether the ParticleSystem is paused. * * @type {boolean} */ paused: boolean; /** * All the particles in the ParticleSystem. * * @type {Array} */ particles: Array; /** * the emitter object that should be added in the scene. * * @type {ParticleEmitter} */ emitter: ParticleEmitter; /** * the VFX renderer settings for the batch renderer * * @type {VFXBatchSettings} */ rendererSettings: VFXBatchSettings; /** * whether needs to update renderer settings for the batch renderer * * @type {boolean} */ neededToUpdateRender: boolean; rendererEmitterSettings: {}; worldSpace: boolean; private prewarmed; private emissionState; private emitEnded; private markForDestroy; private previousWorldPos?; private temp; private travelDistance; private normalMatrix; set time(time: number); get time(): number; get layers(): Layers; get texture(): Texture; set texture(texture: Texture); get material(): Material; set material(material: Material); get instancingGeometry(): BufferGeometry; set instancingGeometry(geometry: BufferGeometry); get renderMode(): RenderMode; set renderMode(renderMode: RenderMode); get renderOrder(): number; set renderOrder(renderOrder: number); get blending(): Blending; set blending(blending: Blending); constructor(parameters: VFXParameters); pause(): void; play(): void; private spawn; endEmit(): void; dispose(): void; restart(): void; private update; emit(delta: number, emissionState: EmissionState_2, emitterMatrix: Matrix4): void; toJSON(meta: any, options?: SerializationOptions): any; getRendererSettings(): VFXBatchSettings; clone(): IParticleSystem; speedFactor: number; } /** * Apply noise to particles. */ export class Noise implements Simulation { frequency: FunctionValueGenerator | ValueGenerator; power: FunctionValueGenerator | ValueGenerator; positionAmount: FunctionValueGenerator | ValueGenerator; rotationAmount: FunctionValueGenerator | ValueGenerator; type: string; duration: number; constructor(frequency: FunctionValueGenerator | ValueGenerator, power: FunctionValueGenerator | ValueGenerator, positionAmount?: FunctionValueGenerator | ValueGenerator, rotationAmount?: FunctionValueGenerator | ValueGenerator); initialize(particle: Particle): void; update(particle: Particle, _: number): void; toJSON(): any; frameUpdate(delta: number): void; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } function noop(): void; /** * 向量归一化 */ function normalize(out: T, v: VectorArray): T; /** * Normalize css liked array configuration * e.g. * 3 => [3, 3, 3, 3] * [4, 2] => [4, 2, 4, 2] * [4, 3, 2] => [4, 3, 2, 3] */ function normalizeCssArray(val: number | number[]): number[]; const NOT_INTERSECTED: ShapecastIntersection; /** * Returns the current time in milliseconds. If performance.now() is available, it is used, otherwise Date.now() is used. * * @category Time */ export function now(): number; /** * object3d对象转实体对象 * @param object object3d对象 * @param splitSubEntity 是否按组拆分成一个个子字体 * @param autoAsMeshEntity 如果满足条件时是否自动转为mesh实体 (默认false) splitSubEntity为false时有效 */ export function object2Entity(object: Object3D, splitSubEntity?: boolean, autoAsMeshEntity?: boolean): Entity; /** * Records what objects are colliding with each other */ class ObjectCollisionMatrix { /** * The matrix storage. */ matrix: Record; /** * @todo Remove useless constructor */ constructor(); /** * get */ get(bi: Body_2, bj: Body_2): boolean; /** * set */ set(bi: Body_2, bj: Body_2, value: boolean): void; /** * Empty the matrix */ reset(): void; /** * Set max number of objects */ setNumObjects(n: number): void; } /** * Check if an object has a property. * @param o * @param v */ export function objectHasOwn(o: object, v: PropertyKey): boolean; /** * 物体变化参数 */ export interface ObjectTransform { position?: Vector3; rotation?: Vector3; scale?: number | Vector3; } /** * 物体平移变化参数转成矩阵 */ export function objectTransformToMatrix(tf: ObjectTransform): Matrix4; interface ObjectValueType { copy(value: T): ObjectValueType; lerp(value: T, pos: number): ObjectValueType; clone(): ObjectValueType; } /** * Octree */ class Octree extends OctreeNode { /** * Maximum subdivision depth * @default 8 */ maxDepth: number; /** * @param aabb The total AABB of the tree */ constructor(aabb?: AABB, options?: { /** * Maximum subdivision depth * @default 8 */ maxDepth?: number; }); } /** * OctreeNode */ class OctreeNode { /** The root node */ root: OctreeNode | null; /** Boundary of this node */ aabb: AABB; /** Contained data at the current node level */ data: number[]; /** Children to this node */ children: OctreeNode[]; constructor(options?: { /** The root node */ root?: Octree | null; /** Boundary of this node */ aabb?: AABB; }); /** * reset */ reset(): void; /** * Insert data into this node * @return True if successful, otherwise false */ insert(aabb: AABB, elementData: number, level?: number): boolean; /** * Create 8 equally sized children nodes and put them in the `children` array. */ subdivide(): void; /** * Get all data, potentially within an AABB * @return The "result" object */ aabbQuery(aabb: AABB, result: number[]): number[]; /** * Get all data, potentially intersected by a ray. * @return The "result" object */ rayQuery(ray: Ray_2, treeTransform: Transform, result: number[]): number[]; /** * removeEmptyNodes */ removeEmptyNodes(): void; } /** 对一组坐标,给定一个偏移量,获取偏移后的坐标 * @param paths 坐标序列 * @param offset 偏移量 */ export function offsetCoords(paths: [number, number, number?][], offset: number): [number, number, number?][]; export function offsetPolygon(vertices: number[], holes?: number[], offset?: number, miterLimit?: number, close?: boolean, removeIntersections?: boolean, removeIntersectionsHole?: boolean): any[] | Float32Array; export type Omitype = { [P in keyof T as T[P] extends U ? never : P]: T[P]; }; /** * Decorator that redefines a property with getter and setter, and calls a function when the property is changed. * Parameters passed to the function are the property key and the new value. * @note - Does not work with "target": "esnext" in tsconfig.json * @note - Requires "experimentalDecorators": true in tsconfig.json * @todo add example. * @param fnKey - use: `.prototype.` or define an arrow function: `(key, value, oldValue) => {}`. * @param paramType - * if param, the function is called with 3 parameters: `key, value, oldValue`, default for {@link onChange} * if object, the function is called with an object parameter: `{key, value, oldValue}`, default for {@link onChange3} * if void then no params are passed. {@link onChange2} * Default: false. * * @category Decorators */ export function onChange(fnKey: string | ((key: string, value: any, oldValue: any) => void), paramType?: "param" | "object" | "void"): PropertyDecorator; /** * Similar to {@link onChange}, but accepts any function and paramType defaults to 'void'. The function is called with no parameters. if 'void' * @param fnKey * @param paramType */ export function onChange2(fnKey: string | AnyFunction, paramType?: "param" | "object" | "void"): PropertyDecorator; /** * Similar to {@link onChange}, but accepts any function and paramType defaults to 'object'. The function is called with an object parameter: `{key, value, oldValue}`. * @param fnKey * @param paramType */ export function onChange3(fnKey: string | ((obj: { key: string; value: any; oldValue: any; }) => void), paramType?: "object" | "void"): PropertyDecorator; type OnCleanup = (cleanupFn: () => void) => void; type ondestroyCallback = () => void; type OnframeCallback = (percent: number) => void; type OnframeCallback_2 = (target: T, percent: number) => void; type onrestartCallback = () => void; /** * Registers a dispose callback on the current active effect scope. The * callback will be invoked when the associated effect scope is stopped. * * @param fn - The callback function to attach to the scope's cleanup. */ function onScopeDispose(fn: () => void): void; /** * 打开地图的深色背景样式,值为 {backcolor: 0} */ export function openMapDarkStyle(): IMapStyleParam; /** * 打开地图的浅色色背景样式,值为 {backcolor: 0xFFFFFF} */ export function openMapLightStyle(): IMapStyleParam; class Operation extends Brush { isOperation: boolean; markUpdated(): void; isDirty(): boolean; insertBefore(brush: Brush): void; insertAfter(brush: Brush): void; } class OperationDebugData { intersectionEdges: Line3[]; enabled: boolean; addIntersectingTriangles(ia: number, triA: Triangle, ib: number, triB: Triangle): void; addEdge(edge: Line3): void; reset(): void; } class OperationGroup extends Group_2 { isOperatioinGroup: boolean; markUpdated(): void; isDirty(): boolean; } /** 优化模型渲染 */ export const optimizeModelRender: (renderer: WebGLRenderer) => void; interface Opts { style?: { backgroundColor?: string; color?: string; }; autoHideDelay?: number; } export class OrbitControlModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: OrbitControlModuleOptions; constructor(app?: App, options?: OrbitControlModuleOptions); get cameraControl(): CameraControls; get enableCameraControlRef(): Ref; get enableCameraControl(): boolean; set enableCameraControl(v: boolean); get enableWheelWhenCtrlDisabled(): any; set enableWheelWhenCtrlDisabled(v: any); onAwake(): void; onAppRender(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface OrbitControlModuleOptions { /** * target */ target?: [number, number, number] | Vector3; /** * Minimum vertical angle in radians. * The angle has to be between `0` and `.maxPolarAngle` inclusive. * The default value is `0`. * * e.g. * ``` * cameraControl.maxPolarAngle = 0; * ``` */ minPolarAngle?: number; /** * Maximum vertical angle in radians. * The angle has to be between `.maxPolarAngle` and `Math.PI` inclusive. * The default value is `Math.PI`. * * e.g. * ``` * cameraControl.maxPolarAngle = Math.PI; * ``` */ maxPolarAngle?: number; /** * Minimum horizontal angle in radians. * The angle has to be less than `.maxAzimuthAngle`. * The default value is `- Infinity`. * * e.g. * ``` * cameraControl.minAzimuthAngle = - Infinity; * ``` */ minAzimuthAngle?: number; /** * Maximum horizontal angle in radians. * The angle has to be greater than `.minAzimuthAngle`. * The default value is `Infinity`. * * e.g. * ``` * cameraControl.maxAzimuthAngle = Infinity; * ``` */ maxAzimuthAngle?: number; /** * Minimum distance for dolly. The value must be higher than `0`. Default is `Number.EPSILON`. * PerspectiveCamera only. */ minDistance?: number; /** * Maximum distance for dolly. The value must be higher than `minDistance`. Default is `Infinity`. * PerspectiveCamera only. */ maxDistance?: number; /** * `true` to enable Infinity Dolly for wheel and pinch. Use this with `minDistance` and `maxDistance` * If the Dolly distance is less (or over) than the `minDistance` (or `maxDistance`), `infinityDolly` will keep the distance and pushes the target position instead. */ infinityDolly?: boolean; /** * Minimum camera zoom. Default is `0.01`. */ minZoom?: number; /** * Maximum camera zoom.Default is `Infinity`. */ maxZoom?: number; /** * Approximate time in seconds to reach the target. A smaller value will reach the target faster.Default is `0.25`. */ smoothTime?: number; /** * the smoothTime while draggingDefault is `0.125`. */ draggingSmoothTime?: number; /** * Max transition speed in unit-per-seconds. Default is `Infinity`. */ maxSpeed?: number; /** * Speed of azimuth (horizontal) rotation. Default is `1.0`. */ azimuthRotateSpeed?: number; /** * Speed of polar (vertical) rotation. Default is `1.0`. */ polarRotateSpeed?: number; /** * Speed of mouse-wheel dollying. Default is `1.0`. */ dollySpeed?: number; /** * `true` to invert direction when dollying or zooming via drag Default is `false`. */ dollyDragInverted?: boolean; /** * Speed of drag for pan and pedestal. Default is `2.0`. */ truckSpeed?: number; /** * `true` to enable Dolly-in to the mouse cursor coords. Default is `false`. */ dollyToCursor?: boolean; /** * Properties Default is `false`. */ dragToOffset?: boolean; /** * if true, pan in screen-space default true */ verticalDragToForward?: boolean; /** * Friction ratio of the boundary..Default is `0.0`. */ boundaryFriction?: number; /** * Controls how soon the `rest` event fires as the camera slows. .Default is `0.01`. */ restThreshold?: number; /** * An array of Meshes to collide with camera. * Be aware colliderMeshes may decrease performance. The collision test uses 4 raycasters from the camera since the near plane has 4 corners. */ colliderMeshes?: Object3D; /** * User's mouse input config. * * | button to assign | behavior | * | --------------------- | -------- | * | `mouseButtons.left` | `CameraControls.ACTION.ROTATE`* \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.right` | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK`* \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.wheel` ¹ | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY` \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * | `mouseButtons.middle` ² | `CameraControls.ACTION.ROTATE` \| `CameraControls.ACTION.TRUCK` \| `CameraControls.ACTION.OFFSET` \| `CameraControls.ACTION.DOLLY`* \| `CameraControls.ACTION.ZOOM` \| `CameraControls.ACTION.NONE` | * * 1. Mouse wheel event for scroll "up/down" on mac "up/down/left/right" * 2. Mouse click on wheel event "button" * - \* is the default. * - The default of `mouseButtons.wheel` is: * - `DOLLY` for Perspective camera. * - `ZOOM` for Orthographic camera, and can't set `DOLLY`. */ mouseButtons?: MouseButtons; /** * User's touch input config. * * | fingers to assign | behavior | * | --------------------- | -------- | * | `touches.one` | `CameraControls.ACTION.TOUCH_ROTATE`* \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.DOLLY` | `CameraControls.ACTION.ZOOM` | `CameraControls.ACTION.NONE` | * | `touches.two` | `ACTION.TOUCH_DOLLY_TRUCK` \| `ACTION.TOUCH_DOLLY_OFFSET` \| `ACTION.TOUCH_DOLLY_ROTATE` \| `ACTION.TOUCH_ZOOM_TRUCK` \| `ACTION.TOUCH_ZOOM_OFFSET` \| `ACTION.TOUCH_ZOOM_ROTATE` \| `ACTION.TOUCH_DOLLY` \| `ACTION.TOUCH_ZOOM` \| `CameraControls.ACTION.TOUCH_ROTATE` \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.NONE` | * | `touches.three` | `ACTION.TOUCH_DOLLY_TRUCK` \| `ACTION.TOUCH_DOLLY_OFFSET` \| `ACTION.TOUCH_DOLLY_ROTATE` \| `ACTION.TOUCH_ZOOM_TRUCK` \| `ACTION.TOUCH_ZOOM_OFFSET` \| `ACTION.TOUCH_ZOOM_ROTATE` \| `CameraControls.ACTION.TOUCH_ROTATE` \| `CameraControls.ACTION.TOUCH_TRUCK` \| `CameraControls.ACTION.TOUCH_OFFSET` \| `CameraControls.ACTION.NONE` | * * - \* is the default. * - The default of `touches.two` and `touches.three` is: * - `TOUCH_DOLLY_TRUCK` for Perspective camera. * - `TOUCH_ZOOM_TRUCK` for Orthographic camera, and can't set `TOUCH_DOLLY_TRUCK` and `TOUCH_DOLLY`. * @category Properties */ touches?: Touches; /** 开启双击定位到中心点,默认是 */ dblClickSetToCenter?: boolean; /** 双击定位时屏幕坐标转世界坐标使用深度,默认是 */ unProjectUseDepth?: boolean; /** 双击定位时把当前坐标用Marker调试输出,默认false */ dblClickAddDebugMarker?: boolean; /** 是否启用 */ enable?: boolean; /** 允许更新 */ disableUpdate?: boolean; /** 事件来源于输入模块 */ eventFromInputModule?: boolean; /** 左键用于平移 (同时右键将用于旋转)*/ leftButtonPan?: boolean; /** 旋转时显示旋转中心点坐标位置图标(默认是) */ rotateShowTargetMarker?: boolean; /** 缩放时显示旋转中心点坐标位置图标(默认是) */ zoomShowTargetMarker?: boolean; /** 旋转中心点坐标位置图标 */ targetMarkerImage?: string; /** 旋转中心点坐标位置图标颜色,默认 #d4237a */ targetMarkerColor?: string; /** 旋转中心点坐标位置图标大小 */ targetMarkerSize?: number; /** 旋转中心点坐标位置图标透明度(0-1) */ targetMarkerOpacity?: number; /** 初始状态 */ initState?: CameraState & { enableTransition?: boolean; }; } /** * Orbit particles around an axis over their life. */ export class OrbitOverLife implements Simulation { orbitSpeed: FunctionValueGenerator | ValueGenerator; axis: Vector3; type: string; rotation: Quaternion; line: Line3; temp: Vector3; constructor(orbitSpeed: FunctionValueGenerator | ValueGenerator, axis?: Vector3); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export enum OrderIndex { StartMost = -1000000, Start = -1000, Normal = 0, End = 1000, EndMost = 1000000 } class OrientedBoundingRect { private _corners; private _axes; private _origin; constructor(rect?: BoundingRect, transform?: MatrixArray); fromBoundingRect(rect: BoundingRect, transform?: MatrixArray): void; /** * If intersect with another OBB * @param other Bounding rect to be intersected with * @param mtv Calculated . * If it's not overlapped. it means needs to move given rect with Maximum Translation Vector to be overlapped. * Else it means needs to move given rect with Minimum Translation Vector to be not overlapped. */ intersect(other: OrientedBoundingRect, mtv?: PointLike): boolean; private _intersectCheckOneSide; private _getProjMinMaxOnAxis; } class OrientedBox { min: Vector3; max: Vector3; matrix: Matrix4; needsUpdate: boolean; constructor(min: Vector3, max: Vector3); set(min: Vector3, max: Vector3, matrix: Matrix4): OrientedBox; intersectsBox(box: Box3): boolean; intersectsTriangle(tri: Triangle): boolean; closestPointToPoint(point: Vector3, target?: Vector3): number; distanceToPoint(point: Vector3): number; distanceToBox(box: Box3, threshold?: number, target1?: Vector3, target2?: Vector3): number; } /** * 实体描边模块 */ export class OutlineModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; options: OutlinesProps; outlines: OutlinesType[]; constructor(entity: Entity, options?: OutlinesProps); onAppUpdate(time: Time): void; } export function Outlines({ color, opacity, transparent, thickness, angle, }?: Partial): OutlinesType; export type OutlinesProps = { /** Outline color, default: black */ color?: Color; /** Outline opacity, default: 1 */ opacity?: number; /** Outline transparency, default: false */ transparent?: boolean; /** Outline thickness, default 0.05 */ thickness?: number; /** Geometry crease angle (0 === no crease), default: Math.PI */ angle?: number; pulsePeriod?: number; }; export type OutlinesType = { group: Group_2; updateProps: (props: Partial) => void; /** * **Note**: Call this method to generate the outline mesh */ generate: () => void; dispose: () => void; }; export const OutputNodeTypeNames: Set; class OverlapKeeper { current: number[]; previous: number[]; /** * @todo Remove useless constructor */ constructor(); /** * getKey */ getKey(i: number, j: number): number; /** * set */ set(i: number, j: number): void; /** * tick */ tick(): void; /** * getDiff */ getDiff(additions: number[], removals: number[]): void; } export class PackedMipMapGenerator { _swapTarget: any; _copyQuad: any; _mipQuad: any; _mipMaterials: any; constructor(mipmapLogic?: string); update(texture: any, target: any, renderer: any, forcePowerOfTwo?: boolean): number; dispose(): void; } export interface PackOptions { maxChartSize?: number; padding?: number; bilinear?: boolean; createImage?: boolean; rotateCharts?: boolean; rotateChartsToAxis?: boolean; blockAlign?: boolean; resolution?: number; bruteForce?: boolean; texelsPerUnit?: number; } interface PainterBase { type: string; root?: HTMLElement; ssrOnly?: boolean; resize(width?: number | string, height?: number | string): void; refresh(): void; clear(): void; renderToString?(): string; getType: () => string; getWidth(): number; getHeight(): number; dispose(): void; getViewportRoot: () => HTMLElement; getViewportRootOffset: () => { offsetLeft: number; offsetTop: number; }; refreshHover(): void; configLayer(zlevel: number, config: Dictionary): void; setBackgroundColor(backgroundColor: string | GradientObject | PatternObject): void; } type PainterBaseCtor = { new (dom: HTMLElement, storage: Storage_2, ...args: any[]): PainterBase; }; /** * Executes all contained behaviors in parallel */ export class ParallelBehavior extends CompositeBehavior { successPolicy: ParallelBehaviorPolicy; failurePolicy: ParallelBehaviorPolicy; activeSet: any; successCount: number; failureCount: number; /** * * @param {ParallelBehaviorPolicy} successPolicy * @param {ParallelBehaviorPolicy} failurePolicy */ constructor(successPolicy: any, failurePolicy: any); /** * * @return {ParallelBehaviorPolicy} */ getSuccessPolicy(): ParallelBehaviorPolicy; /** * * @param policy */ setSuccessPolicy(policy: ParallelBehaviorPolicy): void; /** * * @return {ParallelBehaviorPolicy} */ getFailurePolicy(): ParallelBehaviorPolicy; /** * * @param policy */ setFailurePolicy(policy: ParallelBehaviorPolicy): void; /** * * @param {number} timeDelta * @returns {BehaviorStatus|number} */ tick(timeDelta: number): BehaviorStatus.Running | BehaviorStatus.Succeeded | BehaviorStatus.Failed; initialize(context: any): void; /** * * @private */ __finalizeActiveChildren(): void; finalize(): void; /** * * @param {Behavior[]} elements * @param {ParallelBehaviorPolicy} success how should successful completion be determined? * @param {ParallelBehaviorPolicy} failure how should failing completion be determined * @returns {ParallelBehavior} */ static from(elements: Behavior[], success?: ParallelBehaviorPolicy, failure?: ParallelBehaviorPolicy): ParallelBehavior; } /** * * @enum {number} */ export enum ParallelBehaviorPolicy { RequireOne = 0, RequireAll = 1 } export type ParameterPair = [string, ParameterType]; export type ParameterType = FieldType | 'self'; function parse(colorStr: string, rgbaArr?: number[]): number[]; /** * Parse a file extension from a path * @param path - The path to parse * @returns file extension without the dot (e.g. 'png') * * @category Text */ export function parseFileExtension(path: string): string; function parseSVG(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult; /** * Partial pick type with all keys optional */ export type PartialPick = Partial & Pick; /** * Partial record type with all keys optional * @example * ```ts * type T = PartialRecord<'a' | 'b', number> * // T = {a?: number, b?: number} * ``` */ export type PartialRecord = { [P in K]?: T; }; export interface Particle extends IParticle { /** * Speed modifier of the particle. * @type {number} */ speedModifier: number; /** * Emission state of the particle. * @type {EmissionState} */ emissionState?: EmissionState; /** * Parent matrix for transformation. * @type {Matrix4} */ parentMatrix?: Matrix4; /** * Initial speed of the particle. * @type {number} */ startSpeed: number; /** * Initial color of the particle. * @type {Vector4} */ startColor: Vector4; /** * Initial size of the particle. * @type {number} */ startSize: number; } /** * Particle2 shape. * @example * const particleShape = new CANNON.Particle2() * const particleBody = new CANNON.Body({ mass: 1, shape: particleShape }) * world.addBody(particleBody) */ class Particle2 extends Shape { constructor(); /** * calculateLocalInertia */ calculateLocalInertia(mass: number, target?: Vec3): Vec3; volume(): number; updateBoundingSphereRadius(): void; calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; } /** * Class representing a three.Particle particle emitter. particle emitter is a node in the three.js scene graph * every particle emitter only associates with a particle system. * particle system * @extends Object3D * @template E - Type of the event map. */ export class ParticleEmitter extends Object3D { type: string; system: IParticleSystem; /** * Creates an instance of ParticleEmitter. * @param {IParticleSystem} system - The particle system to be used. */ constructor(system: IParticleSystem); /** * Clones the particle emitter. * @returns {ParticleEmitter} A new instance of ParticleEmitter. */ clone(): any; /** * Disposes the particle emitter. */ dispose(): void; /** * Extracts data from the cache. * @param {any} cache - The cache to extract data from. * @returns {any[]} An array of extracted data without metadata. */ extractFromCache(cache: any): any[]; /** * Converts the particle emitter to JSON. * @param {MetaData} [meta] - Optional metadata. * @param {SerializationOptions} [options={}] - Optional serialization options. * @returns {any} The JSON representation of the particle emitter. */ toJSON(meta?: MetaData, options?: SerializationOptions): any; } /** * Loader for Particle particle system. */ export class ParticleLoader extends ObjectLoader { onData?: (data: any) => any; constructor(opts?: { manager?: LoadingManager; onData?: (data: any) => any; }); /** * Links the references of the particle system. * It's used to link the references of sub particle systems. * @param object the target object to link the references. */ linkReference(object: Object3D): void; /** * Parses the json data to create a Particle particle system. * @param json the json data to parse. * @param onLoad the callback function to be called after the object is loaded. */ parse(json: any, onLoad?: (object: Object3D) => void): T; parseObject(data: any, geometries: { [uuid: string]: BufferGeometry; }, materials: { [uuid: string]: Material; }, textures: { [uuid: string]: Texture; }, animations: AnimationClip[]): Object3D; } /** * 粒子模块 */ export class ParticleModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; constructor(entity: Entity, options?: ParticleModuleOption | ParticleModuleOption[]); /** * 增加粒子 * @param particle */ getParticles(name?: string): ParticleEmitter[]; /** * 增加粒子 * @param particle */ addParticle(particle: ParticleModuleOption): void; /** * 移除粒子 * @param particle */ removeParticle(name?: string): void; } export interface ParticleModuleOption { /** 粒子系统参数 */ system?: ParticleSystemParameters; /** 粒子模拟行为 */ simulations?: Simulation | Simulation[]; /** 名称 */ name?: string; /** 位置 */ position?: Vector3 | [number, number, number]; /** 旋转 */ rotation?: Vector3 | [number, number, number]; /** 缩放 */ scale?: Vector3 | [number, number, number] | number; /** 加载粒子资源 */ resource?: Object3D; /** 克隆资源 默认是 */ isCloneRes?: boolean; /** 当结束时自动删除,默认为true */ disposeWhenEnd?: boolean; /** 加载粒子系统前回调 */ onAddSystem?: (object: Object3D, system: IParticleSystem) => any; } export interface ParticlePlugin { id: string; initialize: () => void; emitterShapes: Array; simulations: Array; } export const ParticlePlugins: Array; /** * 粒子系统模块 */ export class ParticleRenderModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: ParticleRenderModuleOptions; enable?: boolean; batchRendererSet: Map; constructor(app?: App, options?: ParticleRenderModuleOptions); get batchRenderer(): BatchedRenderer; get particleRenderer(): BatchedRenderer; onAwake(): void; onAppRender(time: Time): void; addParticleSystem(system: IParticleSystem, parent?: Object3D, disposeWhenEnd?: boolean): void; addParticle(opts: { system: ParticleSystemParameters; simulations?: Simulation | Simulation[]; name?: string; position?: Vector3 | [number, number, number]; rotation?: Vector3 | [number, number, number]; scale?: Vector3 | [number, number, number] | number; parent?: Object3D; disposeWhenEnd?: boolean; }): ParticleEmitter; removeParticle(obj: ParticleEmitter): void; loadParticle(url: string, opts?: { system?: ParticleSystemParameters; simulations?: Simulation | Simulation[]; name?: string; position?: Vector3 | [number, number, number]; rotation?: Vector3 | [number, number, number]; scale?: Vector3 | [number, number, number] | number; parent?: Object3D; disposeWhenEnd?: boolean; onData?: (data: any) => any; onAddSystem?: (object: Object3D, system: IParticleSystem) => any; crossOrigin?: string; withCredentials?: boolean; urlPath?: string; resourcePath?: string; requestHeader?: { [header: string]: string; }; }): Promise; loadParticleFromJson(json: string | JSON, opts?: { system?: ParticleSystemParameters; simulations?: Simulation | Simulation[]; name?: string; position?: Vector3 | [number, number, number]; rotation?: Vector3 | [number, number, number]; scale?: Vector3 | [number, number, number] | number; parent?: Object3D; disposeWhenEnd?: boolean; onAddSystem?: (object: Object3D, system: IParticleSystem) => any; onData?: (data: any) => any; }): Object3D; loadParticleFromRes(obj: Object3D, opts?: { system?: ParticleSystemParameters; simulations?: Simulation | Simulation[]; name?: string; position?: Vector3 | [number, number, number]; rotation?: Vector3 | [number, number, number]; scale?: Vector3 | [number, number, number] | number; parent?: Object3D; disposeWhenEnd?: boolean; onAddSystem?: (object: Object3D, system: IParticleSystem) => any; }): Object3D; setupUiConfig(): UiObjectConfig; } export interface ParticleRenderModuleOptions { /** 是否启动。默认true */ enable?: boolean; } /** * ParticleSystem represents a system that generates and controls particles with similar attributes. * * @class */ export class ParticleSystem implements IParticleSystem { signal: { onRestart: Signal; onPlay: Signal; onPause: Signal; onEnd: Signal; }; /** * Determines whether the ParticleSystem should be automatically disposed when it finishes emitting particles. * * @type {boolean} */ autoDestroy: boolean; /** * Determines whether a looping ParticleSystem should prewarm, i.e., the Particle System looks like it has already simulated for one loop when first becoming visible. * * @type {boolean} */ prewarm: boolean; /** * Determines whether the ParticleSystem should loop, i.e., restart emitting particles after the duration of the particle system is expired. * * @type {boolean} */ looping: boolean; /** * The duration of the ParticleSystem in seconds. * * @type {number} */ duration: number; /** * The value generator or function value generator for the starting life of particles. * * @type {ValueGenerator | FunctionValueGenerator} */ startLife: ValueGenerator | FunctionValueGenerator; /** * The value generator or function value generator for the starting speed of particles. * * @type {ValueGenerator | FunctionValueGenerator} */ startSpeed: ValueGenerator | FunctionValueGenerator; /** * The value generator or function value generator or rotation generator for the starting rotation of particles. * * @type {ValueGenerator | FunctionValueGenerator | RotationGenerator} */ startRotation: ValueGenerator | FunctionValueGenerator | RotationGenerator; /** * The value generator or function value generator for the starting size of particles. * * @type {ValueGenerator | FunctionValueGenerator} */ startSize: ValueGenerator | FunctionValueGenerator; /** * The color generator or function color generator for the starting color of particles. * * @type {ColorGenerator | FunctionColorGenerator} */ startColor: ColorGenerator | FunctionColorGenerator | MemorizedFunctionColorGenerator; /** * The value generator for the starting tile index of particles. * * @type {ValueGenerator} */ startTileIndex: ValueGenerator; /** * The renderer emitter settings for the ParticleSystem. * * @type {TrailSettings | MeshSettings | BillBoardSettings | StretchedBillBoardSettings} */ rendererEmitterSettings: RendererEmitterSettings; /** * The value generator or function value generator for the emission rate of particles over time. * * @type {ValueGenerator | FunctionValueGenerator} */ emissionOverTime: ValueGenerator | FunctionValueGenerator; /** * The value generator or function value generator for the emission rate of particles over distance. * * @type {ValueGenerator | FunctionValueGenerator} */ emissionOverDistance: ValueGenerator | FunctionValueGenerator; /** * An array of burst parameters for the ParticleSystem. * * @type {Array} */ emissionBursts: Array; /** * Determines whether the ParticleSystem is only used by other ParticleSystems. * * @type {boolean} */ onlyUsedByOther: boolean; /** * Determines whether the ParticleSystem is in world space or local space. * * @type {boolean} */ worldSpace: boolean; /** * The number of particles in the ParticleSystem. * * @type {number} */ particleNum: number; /** * Determines whether the ParticleSystem is paused. * * @type {boolean} */ paused: boolean; /** * All the particles in the ParticleSystem. * * @type {Array} */ particles: Array; /** * the shape of the emitter. * * @type {EmitterShape} */ emitterShape: EmitterShape; /** * the emitter object that should be added in the scene. * * @type {ParticleEmitter} */ emitter: ParticleEmitter; /** * the VFX renderer settings for the batch renderer * * @type {VFXBatchSettings} */ rendererSettings: VFXBatchSettings; /** * whether needs to update renderer settings for the batch renderer * * @type {boolean} */ neededToUpdateRender: boolean; /** * a list of particle simulations in the particle system * * @type {Array} */ simulations: Array; emissionState: EmissionState; private prewarmed; private emitEnded; private markForDestroy; private previousWorldPos?; private temp; private travelDistance; private normalMatrix; /** * set the time of the playback of the particle system * @param time */ set time(time: number); /** * get the current time of the playback of the particle system */ get time(): number; /** * layers control visibility of the object. * currently if you change the layers setting, you need manually set this.neededToUpdateRender = true; * @type {Layers} * @see {@link https://threejs.org/docs/index.html#api/en/core/Layers | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js | Source} */ get layers(): Layers; /** * get the texture of the particle system */ get texture(): Texture | null; /** * Set the texture of the particle system * It will rebuild the material */ set texture(texture: Texture | null); /** * Get the material of the particle system */ get material(): Material; /** * Set the material of the particle system * It will rebuild the material */ set material(material: Material); /** * Get the number of horizontal tiles in the texture. */ get uTileCount(): number; /** * Set the number of horizontal tiles in the texture. * @param u */ set uTileCount(u: number); /** * Get the number of vertical tiles in the texture. */ get vTileCount(): number; /** * Set the number of vertical tiles in the texture. * @param v */ set vTileCount(v: number); /** * get whether the particle texture blends tile transitions */ get blendTiles(): boolean; /** * Set whether the particle texture blends tile transitions * @param v */ set blendTiles(v: boolean); /** * Get whether the particle system uses soft particles. * Soft particles are particles that fade out when they are close to geometry. */ get softParticles(): boolean; /** * Set whether the particle system uses soft particles. * Soft particles are particles that fade out when they are close to geometry. * @param v */ set softParticles(v: boolean); get softNearFade(): number; set softNearFade(v: number); get softFarFade(): number; set softFarFade(v: number); /** * Get the instancing geometry of the particle system. * @param geometry */ get instancingGeometry(): BufferGeometry; /** * Set the instancing geometry of the particle system. * @param geometry */ set instancingGeometry(geometry: BufferGeometry); /** * Get the render mode of the particle system. * {@link RenderMode} */ get renderMode(): RenderMode; /** * Set the render mode of the particle system. * {@link RenderMode} */ set renderMode(renderMode: RenderMode); /** * get the render order of the particle system in render pipeline. * the higher the value, the later the particle system is rendered. */ get renderOrder(): number; /** * set the render order of the particle system in render pipeline. * the higher the value, the later the particle system is rendered. */ set renderOrder(renderOrder: number); /** * get which blending to use. * @default THREE.NormalBlending */ get blending(): Blending; /** * Set which blending to use. * @default THREE.NormalBlending */ set blending(blending: Blending); constructor(parameters: ParticleSystemParameters); pause(): void; play(): void; private spawn; /** * Stops emitting particles */ endEmit(): void; /** * remove the particle system's emitter from the scene */ dispose(): void; restart(): void; private firstTimeUpdate; /** * Update the particle system per frame * @param delta * @private */ private update; /** * Emit particles * @param delta the duration of the frame * @param emissionState the state of the emission * @param emitterMatrix the matrix of the emitter */ emit(delta: number, emissionState: EmissionState, emitterMatrix: Matrix4): void; /** * output the particle system to JSON * @param meta serialization meta data * @param options serialization options */ toJSON(meta: MetaData, options?: SerializationOptions): ParticleSystemJSONParameters; /** * Create a ParticleSystem from JSON * @param json the JSON data * @param meta serialization meta data * @param dependencies the dependencies of the particle system */ static fromJSON(json: ParticleSystemJSONParameters, meta: { textures: { [uuid: string]: Texture; }; materials: { [uuoid: string]: Material; }; geometries: { [uuid: string]: BufferGeometry; }; }, dependencies: { [uuid: string]: Simulation; }): ParticleSystem; /** * Add a simulation to the particle system * @param simulation */ addSimulation(simulation: Simulation): void; /** * Remove a simulation from the particle system */ getRendererSettings(): VFXBatchSettings; /** * Clone the particle system */ clone(): ParticleSystem; } export interface ParticleSystemJSONParameters { version: string; autoDestroy: boolean; looping: boolean; prewarm: boolean; duration: number; shape: ShapeJSON; startLife: FunctionJSON; startSpeed: FunctionJSON; startRotation: FunctionJSON; startSize: FunctionJSON; startColor: FunctionJSON; emissionOverTime: FunctionJSON; emissionOverDistance: FunctionJSON; emissionBursts?: Array; onlyUsedByOther: boolean; rendererEmitterSettings: RendererEmitterSettings; instancingGeometry?: any; renderMode: number; renderOrder?: number; speedFactor?: number; texture?: string; material: string; layers?: number; startTileIndex: FunctionJSON | number; uTileCount: number; vTileCount: number; blendTiles?: boolean; softParticles?: boolean; softFarFade?: number; softNearFade?: number; blending?: Blending; transparent?: boolean; simulations: Array; worldSpace: boolean; } /** * Interface representing the parameters for a particle system. */ export interface ParticleSystemParameters { /** * Whether the particle system auto-destroys. */ autoDestroy?: boolean; /** * Whether the particle system loops. */ looping?: boolean; /** * Whether the particle system prewarms. */ prewarm?: boolean; /** * The duration of the particle system. */ duration?: number; /** * The shape of the emitter. */ shape?: EmitterShape; /** * The initial life of particles. */ startLife?: ValueGenerator | FunctionValueGenerator; /** * The initial speed of particles. */ startSpeed?: ValueGenerator | FunctionValueGenerator; /** * The initial rotation of particles. */ startRotation?: ValueGenerator | FunctionValueGenerator | RotationGenerator; /** * The initial size of particles. */ startSize?: ValueGenerator | FunctionValueGenerator; /** * The initial length of particles. */ startLength?: ValueGenerator | FunctionValueGenerator; /** * The initial color of particles. */ startColor?: ColorGenerator | FunctionColorGenerator | MemorizedFunctionColorGenerator; /** * The emission rate over time. */ emissionOverTime?: ValueGenerator | FunctionValueGenerator; /** * The emission rate over distance. */ emissionOverDistance?: ValueGenerator | FunctionValueGenerator; /** * The burst parameters for emission. */ emissionBursts?: Array; /** * Whether the particle system is only used by others. */ onlyUsedByOther?: boolean; /** * The simulations of the particle system. */ simulations?: Array; /** * The instancing geometry of the particle system. */ instancingGeometry?: BufferGeometry; /** * The render mode of the particle system. */ renderMode?: RenderMode; /** * The renderer emitter settings. */ rendererEmitterSettings?: RendererEmitterSettings; /** * The speed factor of the particle system. */ speedFactor?: number; /** * The material of the particle system. */ material: Material; /** * The layers of the particle system. */ layers?: Layers; /** * The initial tile index for particles. */ startTileIndex?: ValueGenerator; /** * The number of tiles in the u direction. */ uTileCount?: number; /** * The number of tiles in the v direction. */ vTileCount?: number; /** * Whether to blend tiles. */ blendTiles?: boolean; /** * Whether to use soft particles. */ softParticles?: boolean; /** * The far fade distance for soft particles. */ softFarFade?: number; /** * The near fade distance for soft particles. */ softNearFade?: number; /** * The render order of the particle system. */ renderOrder?: number; /** * Whether the particle system uses world space. */ worldSpace?: boolean; } interface Path { animate(key?: '', loop?: boolean): Animator_2; animate(key: 'style', loop?: boolean): Animator_2; animate(key: 'shape', loop?: boolean): Animator_2; getState(stateName: string): PathState; ensureState(stateName: string): PathState; states: Dictionary; stateProxy: (stateName: string) => PathState; } class Path extends Displayable { path: PathProxy; strokeContainThreshold: number; segmentIgnoreThreshold: number; subPixelOptimize: boolean; style: PathStyleProps; /** * If element can be batched automatically */ autoBatch: boolean; private _rectStroke; protected _normalState: PathState; protected _decalEl: Path; shape: Dictionary; constructor(opts?: Props); update(): void; getDecalElement(): Path; protected _init(props?: Props): void; protected getDefaultStyle(): Props['style']; protected getDefaultShape(): {}; protected canBeInsideText(): boolean; protected getInsideTextFill(): "#333" | "#ccc" | "#eee"; protected getInsideTextStroke(textFill?: string): string; buildPath(ctx: PathProxy | CanvasRenderingContext2D, shapeCfg: Dictionary, inBatch?: boolean): void; pathUpdated(): void; getUpdatedPathProxy(inBatch?: boolean): PathProxy; createPathProxy(): void; hasStroke(): boolean; hasFill(): boolean; getBoundingRect(): BoundingRect; contain(x: number, y: number): boolean; /** * Shape changed */ dirtyShape(): void; dirty(): void; /** * Alias for animate('shape') * @param {boolean} loop */ animateShape(loop: boolean): Animator_2; updateDuringAnimation(targetKey: string): void; attrKV(key: PathKey, value: PathPropertyType): void; setShape(obj: Props['shape']): this; setShape(obj: T, value: Props['shape'][T]): this; /** * If shape changed. used with dirtyShape */ shapeChanged(): boolean; /** * Create a path style object with default values in it's prototype. * @override */ createStyle(obj?: Props['style']): Props["style"]; protected _innerSaveToNormal(toState: PathState): void; protected _applyStateObj(stateName: string, state: PathState, normalState: PathState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void; protected _mergeStates(states: PathState[]): PathState; getAnimationStyleProps(): MapToType; /** * If path shape is zero area */ isZeroArea(): boolean; /** * 扩展一个 Path element, 比如星形,圆等。 * Extend a path element * @DEPRECATED Use class extends * @param props * @param props.type Path type * @param props.init Initialize * @param props.buildPath Overwrite buildPath method * @param props.style Extended default style config * @param props.shape Extended default shape config */ static extend>(defaultProps: { type?: string; shape?: Shape; style?: PathStyleProps; beforeBrush?: Displayable['beforeBrush']; afterBrush?: Displayable['afterBrush']; getBoundingRect?: Displayable['getBoundingRect']; calculateTextPosition?: Element_2['calculateTextPosition']; buildPath(this: Path, ctx: CanvasRenderingContext2D | PathProxy, shape: Shape, inBatch?: boolean): void; init?(this: Path, opts: PathProps): void; }): { new (opts?: PathProps & { shape: Shape; }): Path; }; protected static initDefaultProps: void; } /** * 路径动画模块 */ export class PathAnimateModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; options: PathAnimateModuleOptions; tween: Tween; constructor(entity: Entity, options?: PathAnimateModuleOptions); /** 开始动画 */ start(options?: PathAnimateModuleOptions): Promise<{ target: any; isEnd: boolean; isStop: boolean; error: boolean; }>; lookAt(point: Vector3, pointNext: Vector3, model?: Object3D, opts?: { tPosition?: number; tQuat?: number; euler?: Euler; offsetAngle?: number; followDist?: number; followAngle?: number; cameraFollow?: boolean; }): void; setupUiConfig(): UiObjectConfig; } export interface PathAnimateModuleOptions { /** 路径点坐标 */ paths: Vector3[] | [number, number, number][]; /** 路径离散的点数 默认 300 */ discretePointsNum?: number; /** 模型转弯时方向平滑值 0-1 默认1 */ quatLerpT?: number; /** 模型朝向偏移角度 默认0 */ offsetAngle?: number; /** 模型朝向偏移欧拉角,如果上面的 offsetAngle 不能满足时,可用这个 */ euler?: Euler; /** 是否相机跟随 */ cameraFollow?: boolean; /** 相机跟随时距离模型距离, 输入值为正数是表示距离,负数表示是模型高度的倍数。 默认模型高度的5倍 */ followDist?: number; /** 相机跟随时距离模型角度 默认 35*/ followAngle?: number; /** 运行的目标对象,默认当前实体 */ target?: Object3D; /** 动画往返运行时模型是否自动改变方向 默认true */ isAutoChangeDir?: boolean; /** 退出模块时自动完成动画 默认false */ autoCompleteWhenExit?: boolean; /** 动画模块索引 如果有动画模块时,默认为0*/ animatorIndex?: number; /** 停止时动画名称 为空时停止所有动作 */ stopAimatorClipName?: string; /** 运行时动画名称 为空时停止所有动作 */ startAimatorClipName?: string; /** 动画属性 */ animation?: { /** id */ id?: string; /** 分类 */ tag?: string; /** 持续时长 默认5000 五秒*/ duration: number; /** easing 默认 linear */ easing?: Easing; /** 是否往返循环 */ yoyoForever?: boolean; /** 往返次数 */ yoyoTimes?: number; /** 重复循环 */ repeatForever?: boolean; /** 重复次数 */ repeatTimes?: number; /** 延迟时长 */ delay?: number; /** 自动播放动画,默认是 */ autoPlay?: boolean; /** * 动画完成回调. * @param target 对象. * @param isEnd 是否整个动画都结束了 * @param isStop 是否强制终止了 */ onComplete?: (target: any, isEnd: boolean, isStop: boolean) => void; onStart?: (target: any) => void; onUpdate?: (target: any) => void; onProgress?: (target: any, key: string, start: AllowedTypes, end: AllowedTypes, alpha: number, reversed: boolean) => boolean | void; }; } export class PathEmitter implements EmitterShape { type: string; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; paths: [number, number, number][]; constructor(parameters: PathEmitterParameters); update(system: ParticleSystem, delta: number): void; initialize(p: Particle): void; toJSON(): ShapeJSON; static fromJSON(json: any): PathEmitter; clone(): EmitterShape; } export interface PathEmitterParameters { paths?: [number, number, number][]; mode?: EmitterMode; spread?: number; speed?: ValueGenerator | FunctionValueGenerator; } /** * PathGeometry */ export class PathGeometry extends BufferGeometry { /** * @param {Object|Number} initData - If initData is number, geometry init by empty data and set it as the max vertex. If initData is Object, it contains pathPointList and options. * @param {Boolean} [generateUv2=false] */ constructor(initData?: { pathPointList: PathPointList; options: Record; usage: Usage; } | Number, generateUv2?: Boolean); _initByMaxVertex(maxVertex: any, generateUv2: any): void; _initByData(pathPointList: any, options: {}, usage: any, generateUv2: any): void; /** * Update geometry by PathPointList instance * @param {PathPointList} pathPointList * @param {Object} options * @param {Number} [options.width=0.1] * @param {Number} [options.progress=1] * @param {Boolean} [options.arrow=true] * @param {String} [options.side='both'] - "left"/"right"/"both" */ update(pathPointList: PathPointList, options?: { width?: number; progress?: number; arrow?: Boolean; side?: "left" | "right" | "both"; }): void; _resizeAttribute(name: any, len: any): void; _resizeIndex(len: any): void; _updateAttributes(position: any, normal: any, uv: any, uv2: any, indices: any): void; } /** * Join path parts with separator. Similar to PHP's pathJoin * @param parts - path parts * @param separator - separator, default '/' */ export function pathJoin(parts: string[], separator?: string): string; type PathKey = keyof PathProps; /** * PathPointList * input points to generate a PathPoint list */ export class PathPointList { array: any[]; count: number; constructor(); /** * Set points * @param {Vector3[]} points key points array * @param {number} cornerRadius? the corner radius. set 0 to disable round corner. default is 0.1 * @param {number} cornerSplit? the corner split. default is 10. * @param {number} up? force up. default is auto up (calculate by tangent). * @param {boolean} close? close path. default is false. */ set(points: any, cornerRadius?: number, cornerSplit?: number, up?: any, close?: boolean): void; /** * Get distance of this path * @return {number} */ distance(): any; _getByIndex(index: any): any; _start(current: any, next: any, up: any): void; _end(current: any): void; _corner(current: any, next: any, cornerRadius: any, cornerSplit: any, up: any): void; _sharpCorner(current: any, next: any, up: any, dirType?: number, sharp?: boolean): void; } type PathPropertyType = PropType; interface PathProps extends DisplayableProps { strokeContainThreshold?: number; segmentIgnoreThreshold?: number; subPixelOptimize?: boolean; style?: PathStyleProps; shape?: Dictionary; autoBatch?: boolean; __value?: (string | number)[] | (string | number); buildPath?: (ctx: PathProxy | CanvasRenderingContext2D, shapeCfg: Dictionary, inBatch?: boolean) => void; } class PathProxy { dpr: number; data: number[] | Float32Array; /** * Version is for tracking if the path has been changed. */ private _version; /** * If save path data. */ private _saveData; /** * If the line segment is too small to draw. It will be added to the pending pt. * It will be added if the subpath needs to be finished before stroke, fill, or starting a new subpath. */ private _pendingPtX; private _pendingPtY; private _pendingPtDist; private _ctx; private _xi; private _yi; private _x0; private _y0; private _len; private _pathSegLen; private _pathLen; private _ux; private _uy; static CMD: { M: number; L: number; C: number; Q: number; A: number; Z: number; R: number; }; constructor(notSaveData?: boolean); increaseVersion(): void; /** * Version can be used outside for compare if the path is changed. * For example to determine if need to update svg d str in svg renderer. */ getVersion(): number; /** * @readOnly */ setScale(sx: number, sy: number, segmentIgnoreThreshold?: number): void; setDPR(dpr: number): void; setContext(ctx: ExtendedCanvasRenderingContext2D): void; getContext(): ExtendedCanvasRenderingContext2D; beginPath(): this; /** * Reset path data. */ reset(): void; moveTo(x: number, y: number): this; lineTo(x: number, y: number): this; bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): this; quadraticCurveTo(x1: number, y1: number, x2: number, y2: number): this; arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise?: boolean): this; arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this; rect(x: number, y: number, w: number, h: number): this; closePath(): this; fill(ctx: CanvasRenderingContext2D): void; stroke(ctx: CanvasRenderingContext2D): void; len(): number; setData(data: Float32Array | number[]): void; appendPath(path: PathProxy | PathProxy[]): void; /** * 填充 Path 数据。 * 尽量复用而不申明新的数组。大部分图形重绘的指令数据长度都是不变的。 */ addData(cmd: number, a?: number, b?: number, c?: number, d?: number, e?: number, f?: number, g?: number, h?: number): void; private _drawPendingPt; private _expandData; /** * Convert dynamic array to static Float32Array * * It will still use a normal array if command buffer length is less than 10 * Because Float32Array itself may take more memory than a normal array. * * 10 length will make sure at least one M command and one A(arc) command. */ toStatic(): void; getBoundingRect(): BoundingRect; private _calculateLength; /** * Rebuild path from current data * Rebuild path will not consider javascript implemented line dash. * @param {CanvasRenderingContext2D} ctx */ rebuildPath(ctx: PathRebuilder, percent: number): void; clone(): PathProxy; private static initDefaultProps; } interface PathRebuilder { moveTo(x: number, y: number): void; lineTo(x: number, y: number): void; bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number): void; quadraticCurveTo(x: number, y: number, x2: number, y2: number): void; arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean): void; ellipse(cx: number, cy: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise: boolean): void; rect(x: number, y: number, width: number, height: number): void; closePath(): void; } type PathState = Pick & { hoverLayer?: boolean; }; type PathStatePropNames = DisplayableStatePropNames | 'shape'; interface PathStyleProps extends CommonStyleProps { fill?: string | PatternObject | LinearGradientObject | RadialGradientObject; stroke?: string | PatternObject | LinearGradientObject | RadialGradientObject; decal?: PatternObject; /** * Still experimental, not works weel on arc with edge cases(large angle). */ strokePercent?: number; strokeNoScale?: boolean; fillOpacity?: number; strokeOpacity?: number; /** * `true` is not supported. * `false`/`null`/`undefined` are the same. * `false` is used to remove lineDash in some * case that `null`/`undefined` can not be set. * (e.g., emphasis.lineStyle in ) */ lineDash?: false | number[] | 'solid' | 'dashed' | 'dotted'; lineDashOffset?: number; lineWidth?: number; lineCap?: CanvasLineCap; lineJoin?: CanvasLineJoin; miterLimit?: number; /** * Paint order, if do stroke first. Similar to SVG paint-order * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/paint-order */ strokeFirst?: boolean; } namespace pathTool { export { createFromString, extendFromString, mergePath, clonePath } } /** 路径管道实体类 */ export class PathTubeEntities { #private; options: PathTubeEntitiesOptions; entity: Entity; /** 拓扑关系 */ topo: { /** 管道数据 */ tubes: { /** 管道ID */ tubeIndex: number; /** 管道数据 */ data: Record; /** 管道开始点ID */ startNodeId: string; /** 管道结束点ID */ endNodeId: string; }[]; /** 节点数据 <节点ID, 节点相关联的管道索引数组> */ nodes: Map; }; /** 数据 */ data: { sect: PathTubeGeometryOptions; pathPointList: PathPointList; mesh: Mesh; box3d: Box3; /** 其他属性数据 */ [key: string]: any; }[]; inputData: { [key: string]: any; /** 路径点 */ paths: [number, number, number][]; /** 禁止该路径合并节点 默认false */ disableMergeNode?: boolean; }[]; geometries: PathTubeGeometry[]; constructor(options: PathTubeEntitiesOptions); coordHash(pt: [number, number, number]): string; getAngleWithXYPlane(start: Vector3, end: Vector3): number; /** 更新 */ update(): void; addTo(target?: App | Entity): void; /** * 根据管道上的一个点,获取这个点所在的断面参数 * @param point 点的坐标 * @param index 点所在数据中的索引位置 (如果不输入的话,则自动计算出一个最近的) * @returns */ getSectPoints(point: [number, number, number], index?: number): { points: Vector3[]; posBase: Vector3; posLeft: Vector3; posRight: Vector3; posTop: Vector3; posLeftTop: Vector3; posRightTop: Vector3; data: any; }; /** * 显示边框线坐标 */ showEdgeLine(opts: { /** 获取下面线的点 默认true */ bottom?: boolean; /** 获取上面线的点 默认true */ top?: boolean; /** 获取中心线的点 默认 false */ center?: boolean; /** 颜色 */ color?: ColorRepresentation; /** 对边框线拾取时禁用射线查询 默认true */ disableRayQuery?: boolean; }, app?: App): { lineEntity: GlLinesEntity; coordinates: [number, number, number][][]; }; /** * 移除边框线坐标 */ removeEdgeLine(): void; /** * 获取边框线坐标 */ getEdgeLines(opts: { /** 获取下面线的点 默认true */ bottom?: boolean; /** 获取上面线的点 默认true */ top?: boolean; /** 获取中心线的点 默认 false */ center?: boolean; }): [number, number, number][][]; remove(): void; } export interface PathTubeEntitiesOptions { /** 数据 */ data: { /** 路径点 */ paths: [number, number, number][]; /** 禁止该路径合并节点 默认false */ disableMergeNode?: boolean; /** 开始点禁止该路径合并节点 默认false */ startDisableMergeNode?: boolean; /** 结束点禁止该路径合并节点 默认false */ endDisableMergeNode?: boolean; /** 开始点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点, 默认45度*/ startNodeAutoAddNodeMaxPitch?: number; /** 结束点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点, 默认45度*/ endNodeAutoAddNodeMaxPitch?: number; /** 开始点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点的距离为半径大小的比例大小,默认为2.0(距离为节点半径nodeRadius大小)*/ startAutoAddNodeRadiusRatio?: number; /** 结束点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点的距离为半径大小的比例大小,默认为2.0(距离为节点半径nodeRadius大小)*/ endAutoAddNodeRadiusRatio?: number; /** 开始点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点后,是否保持原来的倾斜角度, 默认false*/ startAutoAddNodeKeepPitch?: boolean; /** 结束点当管道倾斜角度大于多少度时,自动在节点旁边增加一个点后,是否保持原来的倾斜角度, 默认false*/ endAutoAddNodeKeepPitch?: boolean; /** 其他属性数据 */ [key: string]: any; }[]; /** 断面选项 */ sect?: PathTubeGeometryOptions; /** 节点半径大小 默认 0.3 */ nodeRadius?: number; /** 外部材质 */ outerMaterial?: Material; /** 内部材质如不填,则使用和外部一样的材质 */ innerSideMaterial?: Material; /** 节点外部材质(不填默认与 outerMaterial 一样 ) */ nodeOuterMaterial?: Material; /** 节点内部材质(不填默认与 innerSideMaterial 一样 ) */ nodeInnerSideMaterial?: Material; /** 以为是同一个节点的小数位置精度默认6 */ decimalPrecision?: number; /** 是否是地图模式 */ isMapMode?: boolean; /** 是否做为实体增加 默认true */ asEntity?: boolean; /** 内存分配方式 */ usage?: Usage; /** 节点y方向缩放 默认1 */ nodeWidthScaleY?: number; /** 拐角拆分段数,默认10 */ cornerSplit?: number; /** 绘制规则角度小于多少度时,节点半径放大多少倍. 中间会进行线性插值 [角度1,倍数, 角度2, 倍数...] (角度按从小到大排序), 默认 [15, 4, 25, 3, 50, 1]*/ drawRules?: number[]; /** 节点所占用的半径长度与管道的长度最大的允许比例,默认0.5 */ maxNodeRadiusRatio?: number; /** 垂直时绘制的形状参数 默认 {shape: "circle"} */ verticalShape?: PathTubeGeometryOptions | { clipRadius?: number; }; /** 禁止该路径合并节点 全局设置 默认false */ disableMergeNode?: boolean; /** 当管道倾斜角度大于多少度时,自动在节点旁边增加一个点, 默认45度, 为零时将禁止*/ autoAddNodeMaxPitch?: number; /** 当管道倾斜角度大于多少度时,自动在节点旁边增加一个点的距离为半径大小的比例大小,默认为2.0(距离为节点半径nodeRadius大小)*/ autoAddNodeRadiusRatio?: number; /** 当管道倾斜角度大于多少度时,自动在节点旁边增加一个点后,是否保持原来的倾斜角度, 默认false*/ autoAddNodeKeepPitch?: boolean; /** 建立拓扑关系策略(默认nodeIntersect) nodeIntersect 一条管道的始末节点与另一条相交时,自动把另一条拆成多段建立拓扑。nodeEqual 一条管道的始末节点与另一条管道的始末节点相等时建立拓扑,不会自动拆分 */ topoStrategy?: "nodeIntersect" | "nodeEqual"; } /** * PathTubeGeometry */ export class PathTubeGeometry extends PathGeometry { options: any; /** * @param {Object|Number} initData - If initData is number, geometry init by empty data and set it as the max vertex. If initData is Object, it contains pathPointList and options. * @param {Boolean} [generateUv2=false] */ constructor(initData?: { pathPointList: PathPointList; options: PathTubeGeometryOptions; usage: Usage; } | Number, generateUv2?: boolean); _initByData(pathPointList: any, options: {}, usage: any, generateUv2: any): void; /** * Update geometry by PathPointList instance * @param {PathPointList} pathPointList * @param {Object} options * @param {Number} [options.radius=0.1] * @param {Number} [options.progress=1] * @param {Boolean} [options.radialSegments=8] * @param {Boolean} [options.circleSegments=16] * @param {String} [options.startRad=0] */ update(pathPointList: PathPointList, options?: PathTubeGeometryOptions): void; sectDataParam(): any; } interface PathTubeGeometryOptions { /** 形状为圆的半径,默认0.5 */ radius?: number; /** 绘制进度,默认全绘 1 */ progress?: number; /** 把弧分为几段绘制,默认8 */ radialSegments?: number; /** 把圆分为几段绘制,默认16 */ circleSegments?: number; /** 开始弧度,默认0 */ startRad?: number; /** 断面形状 */ shape?: "rect" | "arch" | "custom" | "circle" | "rectNoTop"; /** 矩形或拱形断面时宽,默认1 */ rectWidth?: number; /** 矩形或拱形断面时高,默认0.5 */ rectHeight?: number; /** 自定义形状时点坐标序列 形状,要求,xy平面,从y轴正方向开始加点,只需要给出右半部分的点 */ shapePoints?: [number, number][]; } class Pattern { type: 'pattern'; image: ImageLike | string; /** * svg element can only be used in svg renderer currently. * * Will be string if using SSR rendering. */ svgElement: SVGElement | string; repeat: ImagePatternRepeat; x: number; y: number; rotation: number; scaleX: number; scaleY: number; constructor(image: ImageLike | string, repeat: ImagePatternRepeat); } type PatternObject = ImagePatternObject | SVGPatternObject; interface PatternObjectBase { id?: number; type?: 'pattern'; x?: number; y?: number; rotation?: number; scaleX?: number; scaleY?: number; } /** * Temporarily pauses tracking. */ function pauseTracking(): void; export interface PhysicsBodyOption { /** * The collision group the body belongs to. * @default 1 */ collisionFilterGroup?: number; /** * The collision group the body can collide with. * @default -1 */ collisionFilterMask?: number; /** * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered. */ collisionResponse?: boolean; /** * World space position of the body. */ position?: Vec3; /** * World space velocity of the body. */ velocity?: Vec3; /** * The mass of the body. * @default 0 */ mass?: number; /** * The physics material of the body. It defines the body interaction with other bodies. */ material?: Material_2; /** * How much to damp the body velocity each step. It can go from 0 to 1. * @default 0.01 */ linearDamping?: number; /** * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`. */ type?: BodyType; /** * If true, the body will automatically fall to sleep. * @default true */ allowSleep?: boolean; /** * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy. * @default 0.1 */ sleepSpeedLimit?: number; /** * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping. * @default 1 */ sleepTimeLimit?: number; /** * World space orientation of the body. */ quaternion?: Quaternion; /** * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates. */ angularVelocity?: Vec3; /** * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation. * @default false */ fixedRotation?: boolean; /** * How much to damp the body angular velocity each step. It can go from 0 to 1. * @default 0.01 */ angularDamping?: number; /** * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none. */ linearFactor?: Vec3; /** * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none. */ angularFactor?: Vec3; /** * Add a Shape to the body. */ shape?: Shape; /** * When true the body behaves like a trigger. It does not collide * with other bodies but collision events are still triggered. * @default false */ isTrigger?: boolean; } export class PhysicsManagerModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: PhysicsManagerModuleOptions; world: World; CANNON: typeof CANNON; bodies: MeshPhysicsObjectParams[]; constructor(app?: App, options?: PhysicsManagerModuleOptions); get physicsEnable(): boolean; set physicsEnable(enable: boolean); /** 得到物理引擎世界对象 */ get physicsWorld(): CANNON.World; /** 得到物理引擎对象 */ get physicsEngine(): typeof CANNON; /** 启动物体引擎 */ enablePhysicsEngine(): Promise; /** 增加物理刚体 */ addPhysicsBody(phyObject: MeshPhysicsObjectParams): MeshPhysicsObjectParams; removePhysicsObject(object: Object3D | Entity): void; addPhysicsGround(): CANNON.Plane; setPhysicsDebugger(enable: boolean): void; onAwake(): void; onAppAfterUpdate(time: Time): void; } export interface PhysicsManagerModuleOptions { /** * The gravity of the world. */ gravity?: Vec3; /** * Gravity to use when approximating the friction max force (mu*mass*gravity). * If undefined, global gravity will be used. */ frictionGravity?: Vec3; /** * Makes bodies go to sleep when they've been inactive. * @default false */ allowSleep?: boolean; /** * The broadphase algorithm to use. * @default NaiveBroadphase */ broadphase?: Broadphase; /** * The solver algorithm to use. * @default GSSolver */ solver?: Solver; /** * Set to true to use fast quaternion normalization. It is often enough accurate to use. * If bodies tend to explode, set to false. * @default false */ quatNormalizeFast?: boolean; /** * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong). * @default 0 */ quatNormalizeSkip?: number; maxSubSteps?: number; } /** * 模型模块 */ export class PhysicsModule extends EntityModuleBase implements IEntityModuleBase { static moduleName: string; physics: MeshPhysicsObjectParams; constructor(entity: Entity, options?: MeshPhysicsObject); /** 获取碰撞体对象 */ getBody(): CANNON.Body; /** 移除物理 */ removePhysics(): void; } interface PhysicsResolver { resolve(pos: Vector3, normal: Vector3): boolean; } /** * Pick `props` from `object. * * Runtime version of `Pick`. */ export function pick(object: T, props: K[]): Pick; /** 拾取工具进入选项 */ export interface PickEnterOptions extends TLEventType { /** 高亮模式是否用外包盒的方式 默认false*/ highlightUseBoxHelper?: boolean; /** 选中时高亮的颜色 默认 "#ff0000" */ highlightColor?: ColorRepresentation; /** 选中时高亮的透明度 默认0.5 */ highlightOpacity?: number; /** 预先的实体 */ target?: InteractiveObject; /** 查询条件 */ queryOptions?: EntityQueryOption; /** 没有选中实体时退出拾取 默认true */ clickNoEntityExit?: boolean; /** 点击到其他实体时或没有选中实体退出拾取 默认false */ clickNoSelfEntityExit?: boolean; /** 点击判断是否是其他实体的物体对象,默认为控件关联的对象 */ clickIsEqualObject?: Object3D | Function; /** 点击选中新的实体时拾取上此实体 默认true */ clickEntitySelected?: boolean; /** 右键退出拾取 默认false */ rightClickConfirmExit?: boolean; /** 回车或esc退出拾取 默认 true */ enterEscConfirmExit?: boolean; /** 回调 */ pickCallBack?: (cb: { oldPick: InteractiveObject | undefined | null; curPick: InteractiveObject | undefined | null; }) => void; /** 鼠标移动事件 */ onPointerMove?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: (info?: TLEventHandler) => void; }, oldHover?: InteractiveObject, newHover?: InteractiveObject) => void; /** 键盘事件 */ onKeyUp?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: (info?: TLEventHandler) => void; }) => void; /** 右键上下文菜单回调 */ onContextMenu?: (info: TLEventHandler, context: { /** 如需要完成时调用 */ complete: (info?: TLEventHandler) => void; }) => void; /** 完成回调 */ onComplete?: (isCancel: boolean, info?: TLEventHandler, select?: InteractiveObject) => void; } export interface PickEntityOptions { /** 高亮模式是否用外包盒的方式 默认false*/ highlightUseBoxHelper?: boolean; /** 选中时高亮的颜色 默认 "#ff0000" */ highlightColor?: ColorRepresentation; /** 选中时高亮的透明度 默认0.5 */ highlightOpacity?: number; /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 选择多少个实体后自动确认返回。默认不限制 */ maxSelectedCount?: number; /** 是否ESC取消 默认是 */ escCancel?: boolean; /** 是否回车键确认 默认是 */ enterKeyConfirm?: boolean; /** 是否双击确认 默认是*/ dblClickConfirm?: boolean; /** 是否右键确认 默认否*/ rightClickConfirm?: boolean; /** 选择结束后自动清除 */ exitAutoClearHighlight?: boolean; /** 选择结束后自动清除延迟时间(使最后那个有选中的显示时间) 默认100ms, 0不延迟 */ exitAutoClearDelay?: number; /** 是否允许矩形框选 默认允许(需同时按shift键) */ canSelectBox?: boolean; /** 矩形框选需同时按shift键 默认是 */ shiftSelectBox?: boolean; /** 矩形框选样式 */ selectBoxStyle?: Record; /** 只能矩形选择 */ onlyUseSelectBox?: boolean; /** 已选中实体,再次选择时是否需同时按Ctrl键取消实体(默认不需要按ctrl,再次选择时取消选择) */ ctrlKeyCencelSelect?: boolean; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 过滤实体回调 满足条件的返回true */ filterEntityCb?: (ent: Entity) => boolean; /** 右键回调 */ rightClickCb?: (e: any, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 按enter回调(例如可以调出输入界面等 enterKeyConfirm 为false时有效) */ enterKeyCb?: (e: any, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 按键回调 */ keydownCb?: (e: any, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 更新坐标回调 */ updateCoordinate?: (e: any, context: { worldPos?: Vector3; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 结束框选回调 */ onSelectBoxEnd?: (pointLeftTop: Vector2, pointBottomRight: Vector2, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 选择了一个实体回调 如果返回false将不加入选择集 */ onSelect?: (currentEntity: Entity, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 结果确定前回调 返回true交确认结果。其他继续拾取 */ beforeConfirm?: (e: any, context: { entity?: Entity[]; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 选择结束结果回调 */ onResult?: (entity?: Entity[]) => Promise | any; } /** * 拾取模块 */ export class PickModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; constructor(app?: App); get isFreeStatus(): boolean; set isFreeStatus(v: boolean); get isFreeStatusRef(): Ref; onAwake(): void; /** * 拾取一个点 */ pickPoint(opts?: PickPointOptions): Promise; /** * 拾取实体 */ pickEntity(opts?: PickEntityOptions): Promise; drawSelectBox(style?: Record, shiftSelectBox?: boolean): Promise; actionDrawPoint(opts?: IDrawPointEnterOptions): Promise; actionDrawLineSting(opts?: IDrawLineEnterOptions): Promise; actionDrawPolygon(opts?: IDrawPolygonEnterOptions): Promise; actionDrawEdit(opts?: IDrawEditEnterOptions): Promise; actionPickSelect(opts?: PickEnterOptions): Promise; getDrawLayer(layerName?: string, noCreateStyle?: Record): { symbol: () => SymbolEntity | undefined; polylines: () => PolylinesEntity | undefined; polygons: () => PolygonsEntity | undefined; addPointData: (data: SymbolItemData, addToCommand?: boolean) => SymbolEntity; addPolylineData: (data: PolylineItemData, addToCommand?: boolean) => PolylinesEntity; addPolygonData: (data: PolygonItemData, addToCommand?: boolean) => PolygonsEntity; updatePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; updatePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; updatePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; deletePointData: (data: SymbolItemData, addToCommand?: boolean) => boolean; deletePolylineData: (data: PolylineItemData, addToCommand?: boolean) => boolean; deletePolygonData: (data: PolygonItemData, addToCommand?: boolean) => boolean; }; setupUiConfig(): UiObjectConfig; } export interface PickPointOptions { /** 同unproject的第三个参数 (undefined根据地图配置决定, false 不用场景数据, true用场景数据) 深度 (-1近裁剪面 到 1 远裁剪面) 或者输入 平面 或者由一个点所在的屏幕平面 或者使用当前场景实体 或 指定实体数组 或同时指定包含或过滤的实体 depth 使用深度*/ unprojectOpts?: UnProjectOpts | "depth"; /** 是否ESC取消 默认是 */ escCancel?: boolean; /** 是否右键取消 */ rightClickCancel?: boolean; /** 进入时先自动调用一次更新坐标事件 */ callUpdateWhenAwake?: boolean; /** 进入时使div元素自动获取焦点(能响应键盘事件) 默认是 */ autoFocus?: boolean; /** 右键回调 */ rightClickCb?: (e: any, context: { resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise; /** 按enter回调(例如可以调出输入界面等) */ enterKeyCb?: (e: any, context: { resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise; /** 按键回调 */ keydownCb?: (e: any, context: { resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise; /** 更新坐标回调 */ updateCoordinate?: (e: any, context: { worldPos?: Vector3; intersectObject?: any; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; /** 结果确定前回调 返回true交确认结果。其他继续拾取 */ beforeConfirm?: (e: any, context: { worldPos?: Vector3; intersectObject?: any; resolve: (value: unknown) => void; reject: (reason?: any) => void; }) => Promise | any; } /** 拾取工具 */ export class PickTool extends StateNode { static id: string; static initial: string; static children: () => (typeof Idle_4)[]; } export type PickType = { [P in keyof T as T[P] extends U ? P : never]: T[P]; }; export class PiecewiseBezier extends PiecewiseFunction implements FunctionValueGenerator { constructor(curves?: Array<[Bezier, number]>); genValue(t?: number): number; toSVG(length: number, segments: number): string; type: "function"; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): PiecewiseBezier; clone(): FunctionValueGenerator; } export abstract class PiecewiseFunction { functions: Array<[T, number]>; protected constructor(); findFunction(t: number): number; getStartX(index: number): number; setStartX(index: number, x: number): void; getEndX(index: number): number; setEndX(index: number, x: number): void; insertFunction(t: number, func: T): void; removeFunction(index: number): T; getFunction(index: number): T; setFunction(index: number, func: T): void; get numOfFunctions(): number; } /** * A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos. * @example * const planeShape = new CANNON.Plane() * const planeBody = new CANNON.Body({ mass: 0, shape: planeShape }) * planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up * world.addBody(planeBody) */ class Plane_2 extends Shape { /** worldNormal */ worldNormal: Vec3; /** worldNormalNeedsUpdate */ worldNormalNeedsUpdate: boolean; boundingSphereRadius: number; constructor(); /** computeWorldNormal */ computeWorldNormal(quat: Quaternion_2): void; calculateLocalInertia(mass: number, target?: Vec3): Vec3; volume(): number; calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; updateBoundingSphereRadius(): void; } export interface PlaneConfig { vertexShader: string; fragmentShader: string; uniforms: { [uniform: string]: IUniform; }; /** 透明色 */ opacityColor?: ColorRepresentation; /** 透明度 */ opacity?: number; /** 深度测试 */ depthTest?: boolean; /** 写深度 默认false*/ depthWrite?: boolean; /** 纹理 */ map?: Texture; /** 材质参数 */ materialParam?: ShaderMaterialParameters; /** 直接给材质参数 */ material?: Material; /** 如果不输入,则默认为当前鼠标 如输入[0-1] */ mouseInputPos?: [number, number]; /** 渲染次序 */ renderOrder?: number; /** 视锥体剔除 默认true */ frustumCulled?: boolean; } interface Platform { createCanvas(): HTMLCanvasElement; measureText(text: string, font?: string): { width: number; }; loadImage(src: string, onload: () => void | HTMLImageElement['onload'], onerror: () => void | HTMLImageElement['onerror']): HTMLImageElement; } /** 插件管理 */ export class PluginManager { #private; cacheResult: Map; private loaderUrlPath; /** * 加载一个插件 * @param path 路径 * @param opts */ loadPlugin(path: string, opts?: LoadPluginOpts): Promise; /** * 加载一个库 * @param path 路径 * @param opts */ loadLibrary(path: string, opts?: LoadPluginOpts): Promise; setLoaderPath(urlPath: string, dirs?: Array): void; } export let Plugins: vjmap3d_2.PluginManager; class Point { x: number; y: number; constructor(x?: number, y?: number); /** * Copy from another point */ copy(other: PointLike): this; /** * Clone a point */ clone(): Point; /** * Set x and y */ set(x: number, y: number): this; /** * If equal to another point */ equal(other: PointLike): boolean; /** * Add another point */ add(other: PointLike): this; scale(scalar: number): void; scaleAndAdd(other: PointLike, scalar: number): void; /** * Sub another point */ sub(other: PointLike): this; /** * Dot product with other point */ dot(other: PointLike): number; /** * Get length of point */ len(): number; /** * Get squared length */ lenSquare(): number; /** * Normalize */ normalize(): this; /** * Distance to another point */ distance(other: PointLike): number; /** * Square distance to another point */ distanceSquare(other: Point): number; /** * Negate */ negate(): this; /** * Apply a transform matrix array. */ transform(m: MatrixArray): this; toArray(out: number[]): number[]; fromArray(input: number[]): void; static set(p: PointLike, x: number, y: number): void; static copy(p: PointLike, p2: PointLike): void; static len(p: PointLike): number; static lenSquare(p: PointLike): number; static dot(p0: PointLike, p1: PointLike): number; static add(out: PointLike, p0: PointLike, p1: PointLike): void; static sub(out: PointLike, p0: PointLike, p1: PointLike): void; static scale(out: PointLike, p0: PointLike, scalar: number): void; static scaleAndAdd(out: PointLike, p0: PointLike, p1: PointLike, scalar: number): void; static lerp(out: PointLike, p0: PointLike, p1: PointLike, t: number): void; } export function pointDistance(a: [number, number, number], b: [number, number, number]): number; /** * A point emitter emits particles from a single point. */ export class PointEmitter implements EmitterShape { type: string; constructor(); update(system: ParticleSystem, delta: number): void; initialize(p: Particle): void; toJSON(): ShapeJSON; static fromJSON(json: any): PointEmitter; clone(): EmitterShape; } /** * A helper class to handle pointer events and dispatch drag events: `drag`, `dragStart` and `dragEnd` with NDC coordinates and time. * * To use, create an object of the class, set `element` with the HTML element(like canvas) and add event listeners to drag events. * * @example * ```ts * const pointerDragHelper = new PointerDragHelper() * pointerDragHelper.element = canvas * pointerDragHelper.addEventListener('dragStart', (e) => { * console.log('dragStart', e.pointer) * // {x: -0.5, y: 0.5, time: 123456789} * // x and y are NDC coordinates, time is the time when the event is fired. * // x and y are in the range of [-1, 1]. * // x is left to right, y is bottom to top. * // time is in milliseconds. * }) * pointerDragHelper.addEventListener('drag', (e) => { * console.log('drag', e.pointer) * // {x: -0.5, y: 0.5, time: 123456789} * }) * pointerDragHelper.addEventListener('dragEnd', (e) => { * console.log('dragEnd', e.pointer) * // {x: -0.5, y: 0.5, time: 123456789} * }) * ``` */ export class PointerDragHelper extends SimpleEventDispatcher<"dragStart" | "drag" | "dragEnd"> implements IDisposable { private _pointerDown?; private _pointer?; private _pointerUp?; get element(): HTMLElement | undefined; set element(value: HTMLElement | undefined); private _element?; private _removeElement; private _addElement; private readonly _onPointerDown; private readonly _onPointerMove; private readonly _onPointerUp; dispose(): void; } interface PointerInput { pointerId: number; clientX: number; clientY: number; deltaX: number; deltaY: number; mouseButton: MOUSE_BUTTON | null; } interface PointLike { x: number; y: number; } class PointsHelper extends InstancedMesh { constructor(count?: number, points?: Vector3[]); setPoints(points: Vector3): void; } /** * Connects two bodies at given offset points. * @example * const bodyA = new Body({ mass: 1 }) * const bodyB = new Body({ mass: 1 }) * bodyA.position.set(-1, 0, 0) * bodyB.position.set(1, 0, 0) * bodyA.addShape(shapeA) * bodyB.addShape(shapeB) * world.addBody(bodyA) * world.addBody(bodyB) * const localPivotA = new Vec3(1, 0, 0) * const localPivotB = new Vec3(-1, 0, 0) * const constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB) * world.addConstraint(constraint) */ class PointToPointConstraint extends Constraint { /** * Pivot, defined locally in bodyA. */ pivotA: Vec3; /** * Pivot, defined locally in bodyB. */ pivotB: Vec3; equationX: ContactEquation; equationY: ContactEquation; equationZ: ContactEquation; /** * @param pivotA The point relative to the center of mass of bodyA which bodyA is constrained to. * @param bodyB Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point. * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to. * @param maxForce The maximum force that should be applied to constrain the bodies. */ constructor(bodyA: Body_2, pivotA: Vec3, bodyB: Body_2, pivotB?: Vec3, maxForce?: number); update(): void; } /** * 点到线段的距离 * @param p * @param p1 * @param p2 * @return {number} */ export function pointToSegmentDistance(p: GeoPoint, p1: GeoPoint, p2: GeoPoint): number; class Polygon extends Path { shape: PolygonShape; constructor(opts?: PolygonProps); getDefaultShape(): PolygonShape; buildPath(ctx: CanvasRenderingContext2D, shape: PolygonShape): void; } /** * Polygon Geometry Object * * https://tools.ietf.org/html/rfc7946#section-3.1.6 */ interface Polygon_2 extends GeometryObject { type: "Polygon"; coordinates: Position[][]; } export interface PolygonItemData { /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][][] | [number, number, number][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 透明度(0-1) */ opacity?: number; /** 颜色 */ borderColor?: ColorRepresentation; /** 是否显示顶点 */ showVertex?: boolean; /** 是否禁止编辑 */ disableEdit?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 自动逆时针, 默认true */ autoAntiClockwise?: boolean; /** 自定义数据 */ [key: string]: any; } interface PolygonProps extends PathProps { shape?: Partial; } /** * 多边形实体 */ export class PolygonsEntity extends Entity { constructor(options: PolygonsEntityOptions); /** * 获取多边形对象 */ getPolygons: () => Mesh; /** * 获取顶点对象 */ getVertexSymbol: () => SymbolEntity; /** * 是否显示顶点 */ isShowVertex: () => boolean; /** * 设置是否显示顶点 */ setShowVertex: (show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }) => void; /** * 获取顶点数据 */ getVertexData: (isGetAll?: boolean) => SymbolItemData[]; /** * 获取多边形边框对象 */ getBorderPolyline: () => LineSegments2_2; /** * 更新样式 */ updateStyle: (style: MeshBasicMaterialParameters) => void; /** * 更新高亮样式 */ updateHightStyle: (style: MeshBasicMaterialParameters) => void; /** * 修改数据 */ setData: (data: PolygonItemData[]) => void; /** * 获取数据 */ getData: () => PolygonItemData[]; /** * 通过faceIndex获取 * @param faceIndex 索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex: (faceIndex: number, isRefData?: boolean) => { positionIndex: number; } & PolygonItemData; /** * 刷新高亮数据 */ refreshHighlight: () => void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight: (id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean) => void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight: (id: string) => boolean; /** * 清除所有高亮 * @returns */ clearHighlight: () => void; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type PolygonsEntityOptions = EntityOptions & PolygonsModuleOption; class PolygonShape { points: VectorArray[]; smooth?: number; smoothConstraint?: VectorArray[]; } /** * 拉伸模块,用来绘制批量拉伸 */ export class PolygonsModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; polygons: Mesh; data: PolygonItemData[]; style: MeshBasicMaterialParameters; highlightPolygons: Mesh; highlightData: PolygonItemData[]; highlightIndexMap: Map; highlightStyle: MeshBasicMaterialParameters; facePosIndex: Map; isXYPlane: boolean; borderStyle: LineMaterialParameters_2; showBorder: boolean; useBvh: boolean; borderPolyline: LineSegments2_2; vertexEntity: SymbolEntity; showVertex: boolean; vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; constructor(entity: Entity, options?: PolygonsModuleOption); setupUiConfig(): UiObjectConfig; /** * 获取拉伸对象 */ getPolygons(): Mesh, Material | Material[], Object3DEventMap>; /** * 获取顶点对象 */ getVertexSymbol(): SymbolEntity; /** * 获取拉伸边框对象 */ getBorderPolyline(): LineSegments2_2; /** * 更新样式 */ updateStyle(style: MeshBasicMaterialParameters): void; /** * 更新高亮样式 */ updateHightStyle(style: MeshBasicMaterialParameters): void; /** * 是否显示顶点 */ isShowVertex(): boolean; /** * 获取顶点数据 */ getVertexData(isGetAll?: boolean): SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex(show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }): void; /** * 修改数据 */ setData(data: PolygonItemData[]): void; /** * 获取数据 */ getData(): PolygonItemData[]; /** * 通过faceIndex获取 * @param faceIndex 面索引值 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex(faceIndex: number, isRefData?: boolean): { data: PolygonItemData; face: [number, number, number]; } | { face: number[]; /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][] | [number, number, number][][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 透明度(0-1) */ opacity?: number; /** 颜色 */ borderColor?: ColorRepresentation; /** 是否显示顶点 */ showVertex?: boolean; /** 是否禁止编辑 */ disableEdit?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 自动逆时针, 默认true */ autoAntiClockwise?: boolean; data?: undefined; }; /** * 刷新高亮数据 * @returns */ refreshHighlight(): void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight(id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean): void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight(id: string): boolean; /** * 清除所有高亮 * @returns */ clearHighlight(): void; } export interface PolygonsModuleOption { /** 数据 */ data: PolygonItemData[]; /** 样式 */ style?: MeshBasicMaterialParameters; /** 高亮样式 */ highlightStyle?: MeshBasicMaterialParameters; /** 边框样式 */ borderStyle?: LineMaterialParameters_2; /** 是否显示边框 */ showBorder?: boolean; /** 数据是否在xy平面,默认为xz 平面 */ isXYPlane?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; /** 是否显示顶点(全局控制显示) */ showVertex?: boolean; /** y方向偏离值,默认0.1,用于解决z-fighting */ yOffsetDelta?: number; /** 顶点样式 */ vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; } class Polyline extends Path { shape: PolylineShape; constructor(opts?: PolylineProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): PolylineShape; buildPath(ctx: CanvasRenderingContext2D, shape: PolylineShape): void; } export interface PolylineItemData { /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 线宽 */ lineWidth?: number; /** 透明度 */ opacity?: number; /** 是否是虚线 */ dashed?: boolean; /** 虚线偏移量 */ dashOffset?: number; /** 虚线缩放量 */ dashScale?: number; /** 虚线尺寸 */ dashSize?: number; /** 间隙尺寸 */ gapSize?: number; /** 是否显示顶点 */ showVertex?: boolean; /** 是否禁止编辑 */ disableEdit?: boolean; /** 是否隐藏 */ hidden?: boolean; /** 自定义数据 */ [key: string]: any; } interface PolylineProps extends PathProps { shape?: Partial; } /** * 多段线实体 */ export class PolylinesEntity extends Entity { constructor(options: PolylinesEntityOptions); /** * 获取线对象 */ getPolylines: () => LineSegments2_2; /** * 获取顶点对象 */ getVertexSymbol: () => SymbolEntity; /** * 是否显示顶点 */ isShowVertex: () => boolean; /** * 获取顶点数据 */ getVertexData: (isGetAll?: boolean) => SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex: (show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }) => void; /** * 更新样式 */ updateStyle: (style: LineMaterialParameters_2) => void; /** * 更新高亮样式 */ updateHightStyle: (style: LineMaterialParameters_2) => void; /** * 修改数据 */ setData: (data: PolylineItemData[]) => void; /** * 获取数据 */ getData: () => PolylineItemData[]; /** * 通过faceIndex获取 * @param faceIndex 面索引值 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex: (faceIndex: number, isRefData?: boolean) => { positionIndex: number; } & PolylineItemData; /** * 刷新高亮数据 */ refreshHighlight: () => void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight: (id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean) => void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight: (id: string) => boolean; /** * 清除所有高亮 * @returns */ clearHighlight: () => void; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type PolylinesEntityOptions = EntityOptions & PolylinesModuleOption; class PolylineShape { points: VectorArray[]; percent?: number; smooth?: number; smoothConstraint?: VectorArray[]; } /** * 多段线模块,用来绘制批量多段线 */ export class PolylinesModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; polylines: LineSegments2; data: PolylineItemData[]; style: LineMaterialParameters; highlightPolylines: LineSegments2; highlightData: PolylineItemData[]; highlightStyle: LineMaterialParameters; highlightIndexMap: Map; facePosIndex: Map; vertexEntity: SymbolEntity; showVertex: boolean; vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; constructor(entity: Entity, options?: PolylinesModuleOption); setupUiConfig(): UiObjectConfig; /** * 获取线对象 */ getPolylines(): LineSegments2; /** * 获取顶点对象 */ getVertexSymbol(): SymbolEntity; /** * 更新样式 */ updateStyle(style: LineMaterialParameters): void; /** * 更新高亮样式 */ updateHightStyle(style: LineMaterialParameters): void; /** * 修改数据 */ setData(data: PolylineItemData[]): void; /** * 是否显示顶点 */ isShowVertex(): boolean; /** * 获取顶点数据 */ getVertexData(isGetAll?: boolean): SymbolItemData[]; /** * 设置是否显示顶点 */ setShowVertex(show: boolean, symbolStyleOptions?: { /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; }): void; /** * 获取数据 */ getData(): PolylineItemData[]; /** * 通过faceIndex获取 * @param faceIndex 面索引值 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByFaceIndex(faceIndex: number, isRefData?: boolean): { data: PolylineItemData; positionIndex: number; } | { positionIndex: number; /** id */ id?: string; /** 坐标 */ coordinates: [number, number, number][]; /** 颜色 */ color?: ColorRepresentation | ColorRepresentation[]; /** 线宽 */ lineWidth?: number; /** 透明度 */ opacity?: number; /** 是否是虚线 */ dashed?: boolean; /** 虚线偏移量 */ dashOffset?: number; /** 虚线缩放量 */ dashScale?: number; /** 虚线尺寸 */ dashSize?: number; /** 间隙尺寸 */ gapSize?: number; /** 是否显示顶点 */ showVertex?: boolean; /** 是否禁止编辑 */ disableEdit?: boolean; /** 是否隐藏 */ hidden?: boolean; data?: undefined; }; /** * 刷新高亮数据 * @returns */ refreshHighlight(): void; /** * 设置某项高亮与否 * @param id id * @param ishighlight 是否 * @param disableAutoRefreshData 不自动刷新,需要调用 refreshHighlight 来刷新 * @returns */ setItemHighlight(id: string, ishighlight?: boolean, disableAutoRefreshData?: boolean): void; /** * 获取某项高亮与否 * @param id id * @returns */ isItemHighlight(id: string): boolean; /** * 清除所有高亮 * @returns */ clearHighlight(): void; } export interface PolylinesModuleOption { /** 数据 */ data: PolylineItemData[]; /** 样式 */ style?: LineMaterialParameters; /** 高亮样式(高亮样式的线宽是指在原来的线宽上的变化值) */ highlightStyle?: LineMaterialParameters; /** 是否显示顶点(全局控制显示) */ showVertex?: boolean; /** 顶点样式 */ vertexStyle?: SymbolMaterialProps & { pointColor?: ColorRepresentation; pointBorderColor?: ColorRepresentation; pointSize?: number; }; } /** * For pooling objects that can be reused. */ class Pool { /** * The objects array. */ objects: any[]; /** * The type of the objects. */ type: any; /** * Release an object after use */ release(...args: any[]): Pool; /** * Get an object */ get(): any; /** * Construct an object. Should be implemented in each subclass. */ constructObject(): void; /** * @return Self, for chaining */ resize(size: number): Pool; } export type PopopOffset = [number, number] | number | { 'center'?: [number, number]; 'top'?: [number, number]; 'bottom'?: [number, number]; 'left'?: [number, number]; 'right'?: [number, number]; 'top-left'?: [number, number]; 'top-right'?: [number, number]; 'bottom-left'?: [number, number]; 'bottom-right'?: [number, number]; }; /** * 2d的html的信息弹出窗 */ export class Popup2D extends CSS2DObject { #private; app: App; options: PopupOptions; _content: HTMLElement; _container: HTMLElement; _closeButton: HTMLElement; _tip: HTMLElement; _pos?: [number, number]; _anchor: Anchor; _classList: Set; isPopup2D: boolean; signal: { open: Signal; close: Signal; elementSizeReady: Signal; }; constructor(options?: PopupOptions); /** * 增加弹出信息框. * * @param {App} app add the popup to. */ addTo(app: App | Entity | Object3D, curApp?: App): this; /** * 弹出信息框是否打开. * * @returns {boolean} `true` 打开, `false` 关闭 * @example * const isPopupOpen = popup.isOpen(); */ isOpen(): boolean; /** * 移除弹出信息框. * * @example * const popup = new vjvjmap3d.Popup().addTo(app); * popup.remove(); * @returns {Popup} Returns itself to allow for method chaining. */ remove(): this; /** * 获取位置. */ getPosition(): Vector3; /** *设置位置. */ setPosition(pos: Vector3 | [number, number, number] | number, y?: number, z?: number): this; /** * 获取信息弹出框元素. * * @example * // Change the `Popup` element's font size * const popup = new vjvjmap3d.Popup() * .setLngLat([-96, 37.8]) * .setHTML("

Hello World!

") * .addTo(app); * const popupElem = popup.getElement(); * popupElem.style.fontSize = "25px"; * @returns {HTMLElement} Returns container element. */ getElement(): HTMLElement; isShow(): boolean; show(): void; hide(): void; /** * 设置信息弹出框信息内容. * * This function creates a Text node in the DOM, * so it cannot insert raw HTML. Use this method for security against XSS * if the popup content is user-provided. * * @param {string} text Textual content for the popup. * @returns {Popup} Returns itself to allow for method chaining. * @example * popup.setText('Hello, world!') */ setText(text: string): this; /** * 设置信息弹出框html内容. * * @param {string} html A string representing HTML content for the popup. * @returns {Popup} Returns itself to allow for method chaining. * @example * popup.setHTML("

Hello World!

") */ setHTML(html: string): this; /** * 获取信息弹出框最大宽度. * * @returns {string} The maximum width of the popup. * @example * const maxWidth = popup.getMaxWidth(); */ getMaxWidth(): string; /** * 设置信息弹出框最大宽度. CSS 属性 `max-width`. * * @param {string} maxWidth A string representing the value for the maximum width. * @returns {Popup} Returns itself to allow for method chaining. * @example * popup.setMaxWidth('50'); */ setMaxWidth(maxWidth: string): this; /** * 将弹出窗口的内容设置为作为DOM节点提供的元素. * * @param {Element} htmlNode A DOM node to be used as content for the popup. * @returns {Popup} Returns itself to allow for method chaining. * @example * // create an element with the popup content * const div = window.document.createElement('div'); * div.innerHTML = 'Hello, world!'; * popup.setDOMContent(div) */ setDOMContent(htmlNode: Node): this; /** * 将CSS类名添加到弹出容器元素中。 * * @param {string} className Non-empty string with CSS class name to add to popup container. * @returns {Popup} Returns itself to allow for method chaining. * * @example * const popup = new vjvjmap3d.Popup(); * popup.addClassName('some-class'); */ addClassName(className: string): this; /** * 从弹出式容器元素中删除一个CSS类。 * * @param {string} className Non-empty string with CSS class name to remove from popup container. * * @returns {Popup} Returns itself to allow for method chaining. * @example * const popup = new vjvjmap3d.Popup({className: 'some classes'}); * popup.removeClassName('some'); */ removeClassName(className: string): this; /** * 设置信息弹出框偏移量 * * @param {number | PointLike | Object} offset Sets the popup's offset. The `Object` is of the following structure * @returns {Popup} `this`. * @example * popup.setOffset(10); */ setOffset(offset?: PopopOffset): this; /** * 在弹出容器上添加或删除给定的CSS类,具体取决于容器当前是否具有该类。 * * @param {string} className Non-empty string with CSS class name to add/remove. * * @returns {boolean} If the class was removed return `false`. If the class was added, then return `true`. * * @example * const popup = new vjvjmap3d.Popup(); * popup.toggleClassName('highlighted'); */ toggleClassName(className: string): boolean; _createCloseButton(): void; _onMouseUp(event: InteractiveEvent): void; _onMouseMove(event: InteractiveEvent): void; _onDrag(event: InteractiveEvent): void; _getAnchor(offset: any): Anchor; updateClassList(): void; /** * 设置颜色 * @param bkColor 背景色 * @param closeBtnColor 关闭按钮颜色 */ setColor(bkColor?: string, closeBtnColor?: string): void; update(cursor?: [number, number]): void; _focusFirstElement(): void; _onClose(): void; setOpacity(opacity: string | number): void; static normalizeOffset(offset?: PopopOffset): { center: number[]; top: number[]; 'top-left': number[]; 'top-right': number[]; bottom: number[]; 'bottom-left': number[]; 'bottom-right': number[]; left: number[]; right: number[]; }; } export type PopupOptions = { closeButton?: boolean; closeOnClick?: boolean; closeOnMove?: boolean; focusAfterOpen?: boolean; anchor?: Anchor; offset?: PopopOffset; className?: string; maxWidth?: string; backgroundColor?: string; buttonColor?: string; showArrow?: boolean; /** 开始时隐藏 */ isHide?: boolean; }; /** * Position * * https://tools.ietf.org/html/rfc7946#section-3.1.1 * Array should contain between two and three elements. * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), * but the current specification only allows X, Y, and (optionally) Z to be defined. */ type Position = [number, number] | [number, number, number]; export class PostProcessModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: PostProcessModuleOptions; _isFirstRender: boolean; depthPickingPass: DepthPickingPass; _composer: EffectComposer; _passes: Pass[]; signal: { beforeAddComposer: Signal; afterAddComposer: Signal; beforeAddRenderPass: Signal; afterAddRenderPass: Signal; beforeRemoveComposer: Signal; afterRemoveComposer: Signal; beforeRemoveRenderPass: Signal; afterRemoveRenderPass: Signal; beforRenderComposer: Signal; afterRenderComposer: Signal; beforRebuild: Signal; afterRebuild: Signal; }; constructor(app?: App, options?: PostProcessModuleOptions); get composer(): EffectComposer; addEffectRenderPass(pass: Pass, orderIndex?: number): void; setEffectRenderPassOrder(pass: Pass, orderIndex: number): void; removeEffectRenderPass(pass: Pass): void; setEffectRenderPassEnable(pass: Pass, enable: boolean): void; isComposerEnable(): boolean; setComposerEnable(b: boolean): void; onAwake(): void; get outlineEffect(): OutlineEffect; get bloomEffect(): SelectiveBloomEffect; get selectedEffect(): OutlineEffect; getDepth(x: number, y: number): Promise; refreshEffectRenderPass(foreceUpdate?: boolean): void; onAppRender(time: Time): void; addKawaseBlurPass(): void; addToneMappingEffect(): void; addColorDepthEffect(): void; addDepthOfFieldEffect(): void; addGlitchEffect(): void; addPixelationEffect(): void; addSSAOEffect(): void; setupUiConfig(): UiObjectConfig; } export interface PostProcessModuleOptions { enable?: boolean; renderTargetOptions?: { depthBuffer?: boolean; stencilBuffer?: boolean; alpha?: boolean; /** 默认4 */ multisampling?: number; frameBufferType?: number; }; /** 自动增加渲染通道 */ autoAddRenderPass?: boolean; /** 自动增加Selected Outline通道 */ autoAddSelectedPass?: boolean; /** 自动增加辉光通道 */ autoAddBloomPass?: boolean; /** 自动增加Outline通道 */ autoAddOutlinePass?: boolean; /** 自动增加copypass通道 */ autoAddCopyPass?: boolean; /** 当selected空闲时,自动禁用,有数据时才启用,默认true*/ disableSelectedPassWhenIdle?: boolean; /** 当bloom空闲时,自动禁用,有数据时才启用,默认true*/ disableBloomPassWhenIdle?: boolean; /** 当bloom空闲时,自动禁用,有数据时才启用,默认true*/ disableOutlinePassWhenIdle?: boolean; /** 是否允许渲染更新 */ renderUpdate?: boolean; /** 自动清除 */ autoClear?: boolean; /** 使用smaa反锯齿 */ useSMAA?: boolean; /** 使用fxaa反锯齿 */ useFXAA?: boolean; /** 当无需后期处理时自动禁止后期处理,默认false */ disableWhenIdle?: boolean; depthPickingPass?: boolean; /** 当深度拾取空闲时,自动停止,时间秒,0表示不自动停止。默认3*/ disableDepthPickTime?: number; /** 拾取深度时,有效最小值,默认0 */ depthPickMinZ?: number; /** 当logarithmicDepthBuffer为true时禁止深度拾取,默认false */ disableDepthPickWhenlogDepthBuffer?: boolean; /** workaroundEnabled */ workaroundEnabled?: boolean; /** 禁止自动合并通道 默认false */ disableMergeEffect?: boolean; /** 合并道道时禁止缓存 默认false */ disableCacheEffectPass?: boolean; bloomPass?: { blendFunction?: BlendFunction; luminanceThreshold?: number; luminanceSmoothing?: number; mipmapBlur?: boolean; intensity?: number; radius?: number; levels?: number; kernelSize?: KernelSize; resolutionScale?: number; width?: number; height?: number; resolutionX?: number; resolutionY?: number; luminancePassEnabled?: boolean; ignoreBackground?: boolean; inverted?: boolean; /** 禁止自动合并通道 默认true */ disableMergeEffect?: boolean; }; outlinePass?: { blendFunction?: BlendFunction; patternTexture?: Texture; patternScale?: number; edgeStrength?: number; pulseSpeed?: number; visibleEdgeColor?: number; hiddenEdgeColor?: number; multisampling?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; blur?: boolean; xRay?: boolean; blurriness?: number; /** 禁止自动合并通道 默认false */ disableMergeEffect?: boolean; }; selectedPass?: { blendFunction?: BlendFunction; patternTexture?: Texture; patternScale?: number; edgeStrength?: number; pulseSpeed?: number; visibleEdgeColor?: number; hiddenEdgeColor?: number; multisampling?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; width?: number; height?: number; blur?: boolean; xRay?: boolean; blurriness?: number; /** 禁止自动合并通道 默认false */ disableMergeEffect?: boolean; }; } /** * Styles the default scrollbar to be more pretty and less intrusive (especially on dark backgrounds), (similar to MacOS) */ export function prettyScrollbar(root?: Element | undefined): HTMLStyleElement; export function preventDefaultEvent(event?: any): void; const PRIMARY_STATES_KEYS: ["x" | "y" | "originX" | "originY" | "anchorX" | "anchorY" | "rotation" | "scaleX" | "scaleY" | "skewX" | "skewY", "ignore"]; type Primitive = string | number | boolean | bigint | symbol | undefined | null; /** * `GeoPoint` 地理坐标. */ export abstract class Projection { /** The equatorial semi perimeter in meters. */ static EQUATORIAL_SEMIPERIMETER: number; /** The equatorial semi perimeter in meters. */ static EARTH_BOUNDS: [number, number, number, number]; /** * 经纬度转墨卡托 . */ static lngLat2Mercator(input: GeoPointLike): [number, number]; /** * 墨卡托转经纬度 . */ static mercator2LngLat(input: GeoPointLike): [number, number]; /** * 坐标转墨卡托(epsg:3857) * @param input 坐标点 * @return {[number, number]} */ abstract toMercator(input: GeoPointLike): [number, number]; /** * 墨卡托(epsg:3857)转坐标 * @param input 墨卡托坐标点 * @return {[number, number]} */ abstract fromMercator(input: GeoPointLike): [number, number]; /** * 地图地理坐标转经纬度 * @param input 地理坐标点 * @return {[number, number]} */ abstract toLngLat(input: GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]): [number, number]; /** * 经纬度转地图地理坐标 * @param input 经纬度坐标点 * @return {GeoPoint} */ abstract fromLngLat(input: GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]): GeoJsonGeomertry | GeoPoint | GeoPointLike | GeoPointLike[]; /** * 得到地图范围 * @return {GeoBounds} */ abstract getMapExtent(): GeoBounds; /** * 把距离转化为米 * @param dist */ abstract toMeter(dist: number): number; /** * 把米转化为距离 * @param meter */ abstract fromMeter(meter: number): number; } class ProjectionGenerator { [key: string]: any; } export class PromiseBehavior extends Behavior { __factory: any; __promise: any; __promise_state: BehaviorStatus; /** * * @param {()=>Promise} factory */ constructor(factory: Promise); initialize(context: BehaviorContext): void; tick(timeDelta: number): BehaviorStatus; } /** * Properties * * https://tools.ietf.org/html/rfc7946#section-3.2 * A Feature object has a member with the name 'properties'. * The value of the properties member is an object (any JSON object or a JSON null value). */ type Properties = { [name: string]: any; } | null; type PropType = TObj[TProp]; /** * Returns a reactive proxy for the given object. * * If the object already is reactive, it's returned as-is. If not, a new * reactive proxy is created. Direct child properties that are refs are properly * handled, as well. * * @param objectWithRefs - Either an already-reactive object or a simple object * that contains refs. */ function proxyRefs(objectWithRefs: T): ShallowUnwrapRef; /** * 对状态进行设置,采用堆栈方案,会保存之前的状态,退出时还原之前的状态 */ export function pushObjectStatus(obj: Record, attr: Record): { push: () => void; pop: () => void; }; export class PushValueCommand extends BaseCommand { private container; private object; constructor(container: T[], object: T); execute(): void; undo(): void; redo(): void; } /** * Constants to store quad-tree positions. */ export class QuadTreePosition { /** * Root node has no location. */ static root: number; /** * Index of top left quad-tree branch node. * * Can be used to navigate the children array looking for neighbors. */ static topLeft: number; /** * Index of top left quad-tree branch node. * * Can be used to navigate the children array looking for neighbors. */ static topRight: number; /** * Index of top left quad-tree branch node. * * Can be used to navigate the children array looking for neighbors. */ static bottomLeft: number; /** * Index of top left quad-tree branch node. * * Can be used to navigate the children array looking for neighbors. */ static bottomRight: number; } /** * A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = x*i + y*j + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation. * @param x Multiplier of the imaginary basis vector i. * @param y Multiplier of the imaginary basis vector j. * @param z Multiplier of the imaginary basis vector k. * @param w Multiplier of the real part. * @see http://en.wikipedia.org/wiki/Quaternion */ class Quaternion_2 { x: number; y: number; z: number; w: number; constructor(x?: number, y?: number, z?: number, w?: number); /** * Set the value of the quaternion. */ set(x: number, y: number, z: number, w: number): Quaternion_2; /** * Convert to a readable format * @return "x,y,z,w" */ toString(): string; /** * Convert to an Array * @return [x, y, z, w] */ toArray(): [number, number, number, number]; /** * Set the quaternion components given an axis and an angle in radians. */ setFromAxisAngle(vector: Vec3, angle: number): Quaternion_2; /** * Converts the quaternion to [ axis, angle ] representation. * @param targetAxis A vector object to reuse for storing the axis. * @return An array, first element is the axis and the second is the angle in radians. */ toAxisAngle(targetAxis?: Vec3): [Vec3, number]; /** * Set the quaternion value given two vectors. The resulting rotation will be the needed rotation to rotate u to v. */ setFromVectors(u: Vec3, v: Vec3): Quaternion_2; /** * Multiply the quaternion with an other quaternion. */ mult(quat: Quaternion_2, target?: Quaternion_2): Quaternion_2; /** * Get the inverse quaternion rotation. */ inverse(target?: Quaternion_2): Quaternion_2; /** * Get the quaternion conjugate */ conjugate(target?: Quaternion_2): Quaternion_2; /** * Normalize the quaternion. Note that this changes the values of the quaternion. */ normalize(): Quaternion_2; /** * Approximation of quaternion normalization. Works best when quat is already almost-normalized. * @author unphased, https://github.com/unphased */ normalizeFast(): Quaternion_2; /** * Multiply the quaternion by a vector */ vmult(v: Vec3, target?: Vec3): Vec3; /** * Copies value of source to this quaternion. * @return this */ copy(quat: Quaternion_2): Quaternion_2; /** * Convert the quaternion to euler angle representation. Order: YZX, as this page describes: https://www.euclideanspace.com/maths/standards/index.htm * @param order Three-character string, defaults to "YZX" */ toEuler(target: Vec3, order?: string): void; /** * Set the quaternion components given Euler angle representation. * * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination. * * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference */ setFromEuler(x: number, y: number, z: number, order?: string): Quaternion_2; clone(): Quaternion_2; /** * Performs a spherical linear interpolation between two quat * * @param toQuat second operand * @param t interpolation amount between the self quaternion and toQuat * @param target A quaternion to store the result in. If not provided, a new one will be created. * @returns {Quaternion} The "target" object */ slerp(toQuat: Quaternion_2, t: number, target?: Quaternion_2): Quaternion_2; /** * Rotate an absolute orientation quaternion given an angular velocity and a time step. */ integrate(angularVelocity: Vec3, dt: number, angularFactor: Vec3, target?: Quaternion_2): Quaternion_2; } export const RAD2DEG: number; export const RadarMaterial: (new (parameters?: ShaderMaterialParameters & Partial, uniforms?: Partial) => ShaderMaterial & RadarMaterialProps) & { key: string; }; export type RadarMaterialProps = { /** 半径 */ uRadius?: number; /** 颜色 */ uColor?: Color; /** 速度 */ uSpeed?: number; /** 扇区角度 */ uSectorAngle?: number; /** 边缘距离 */ uEdge?: number; /** 时间变量 */ uTime?: number | { value: number; }; [key: string]: any; }; /** * x, y, r are all percent from 0 to 1 when globalCoord is false */ class RadialGradient extends Gradient_2 { type: 'radial'; x: number; y: number; r: number; constructor(x: number, y: number, r: number, colorStops?: GradientColorStop[], globalCoord?: boolean); } interface RadialGradientObject extends GradientObject { type: 'radial'; x: number; y: number; r: number; } const RADIAN_TO_DEGREE: number; export function radToDeg(radians: number): number; export const randColor: () => Color; export const randHtmlColor: () => string; /** * 生成一个区间的随机总数 * @param n * @param m * @return {number} */ export function randInt(n: number, m: number): number; /** * Generate a random color */ function random(): string; export class RandomColor implements ColorGenerator { a: Vector4; b: Vector4; constructor(a: Vector4, b: Vector4); genColor(color: Vector4): Vector4; type: "value"; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): RandomColor; clone(): ColorGenerator; } export class RandomColorBetweenGradient implements MemorizedFunctionColorGenerator { gradient1: Gradient; gradient2: Gradient; constructor(gradient1: Gradient, gradient2: Gradient); startGen(memory: any): void; genColor(color: Vector4, t: number, memory?: any): Vector4; type: 'memorizedFunction'; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): RandomColorBetweenGradient; clone(): RandomColorBetweenGradient; } /** * A random() function, must return a numer in the interval [0,1), just like Math.random(). */ type RandomFn = () => number; export class RandomQuatGenerator implements RotationGenerator { type: "rotation"; constructor(); genValue(quat: Quaternion, t: number): Quaternion; toJSON(): FunctionJSON; static fromJSON(json: FunctionJSON): RotationGenerator; clone(): RotationGenerator; } export const randPoint2D: (opts?: { maxX?: number; maxY?: number; minX?: number; minY?: number; }) => number[]; export const randPoint3D: (opts?: { maxX?: number; maxY?: number; maxZ?: number; minX?: number; minY?: number; minZ?: number; }) => number[]; type Raw = T & { [RawSymbol]?: true; }; const RawSymbol: unique symbol; /** * A line in 3D space that intersects bodies and return points. */ class Ray_2 { /** * from */ from: Vec3; /** * to */ to: Vec3; /** * direction */ direction: Vec3; /** * The precision of the ray. Used when checking parallelity etc. * @default 0.0001 */ precision: number; /** * Set to `false` if you don't want the Ray to take `collisionResponse` flags into account on bodies and shapes. * @default true */ checkCollisionResponse: boolean; /** * If set to `true`, the ray skips any hits with normal.dot(rayDirection) < 0. * @default false */ skipBackfaces: boolean; /** * collisionFilterMask * @default -1 */ collisionFilterMask: number; /** * collisionFilterGroup * @default -1 */ collisionFilterGroup: number; /** * The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST. * @default RAY.ANY */ mode: number; /** * Current result object. */ result: RaycastResult; /** * Will be set to `true` during intersectWorld() if the ray hit anything. */ hasHit: boolean; /** * User-provided result callback. Will be used if mode is Ray.ALL. */ callback: RaycastCallback; /** * CLOSEST */ static CLOSEST: 1; /** * ANY */ static ANY: 2; /** * ALL */ static ALL: 4; get [Shape.types.SPHERE](): (sphere: Sphere_2, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape) => void; get [Shape.types.PLANE](): (shape: Plane_2, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape) => void; get [Shape.types.BOX](): (box: Box, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape) => void; get [Shape.types.CYLINDER](): (shape: ConvexPolyhedron, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape, options?: { faceList: number[]; }) => void; get [Shape.types.CONVEXPOLYHEDRON](): (shape: ConvexPolyhedron, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape, options?: { faceList: number[]; }) => void; get [Shape.types.HEIGHTFIELD](): (shape: Heightfield, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape) => void; get [Shape.types.TRIMESH](): (mesh: Trimesh, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape, options?: { faceList?: any[]; }) => void; constructor(from?: Vec3, to?: Vec3); /** * Do itersection against all bodies in the given World. * @return True if the ray hit anything, otherwise false. */ intersectWorld(world: World, options: RayOptions): boolean; /** * Shoot a ray at a body, get back information about the hit. * @deprecated @param result set the result property of the Ray instead. */ intersectBody(body: Body_2, result?: RaycastResult): void; /** * Shoot a ray at an array bodies, get back information about the hit. * @param bodies An array of Body objects. * @deprecated @param result set the result property of the Ray instead. * */ intersectBodies(bodies: Body_2[], result?: RaycastResult): void; /** * Updates the direction vector. */ private updateDirection; private intersectShape; _intersectBox(box: Box, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape): void; _intersectPlane(shape: Plane_2, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape): void; /** * Get the world AABB of the ray. */ getAABB(aabb: AABB): void; _intersectHeightfield(shape: Heightfield, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape): void; _intersectSphere(sphere: Sphere_2, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape): void; _intersectConvex(shape: ConvexPolyhedron, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape, options?: { faceList: number[]; }): void; /** * @todo Optimize by transforming the world to local space first. * @todo Use Octree lookup */ _intersectTrimesh(mesh: Trimesh, quat: Quaternion_2, position: Vec3, body: Body_2, reportedShape: Shape, options?: { faceList?: any[]; }): void; /** * @return True if the intersections should continue */ private reportIntersection; /** * As per "Barycentric Technique" as named * {@link https://www.blackpawn.com/texts/pointinpoly/default.html here} but without the division */ static pointInTriangle(p: Vec3, a: Vec3, b: Vec3, c: Vec3): boolean; } /** * RAY_MODES */ const RAY_MODES: { /** CLOSEST */ readonly CLOSEST: 1; /** ANY */ readonly ANY: 2; /** ALL */ readonly ALL: 4; }; type RaycastCallback = (result: RaycastResult) => void; /** * Storage for Ray casting data */ class RaycastResult { /** * rayFromWorld */ rayFromWorld: Vec3; /** * rayToWorld */ rayToWorld: Vec3; /** * hitNormalWorld */ hitNormalWorld: Vec3; /** * hitPointWorld */ hitPointWorld: Vec3; /** * hasHit */ hasHit: boolean; /** * shape */ shape: Shape | null; /** * body */ body: Body_2 | null; /** * The index of the hit triangle, if the hit shape was a trimesh */ hitFaceIndex: number; /** * Distance to the hit. Will be set to -1 if there was no hit */ distance: number; /** * If the ray should stop traversing the bodies */ shouldStop: boolean; constructor(); /** * Reset all result data. */ reset(): void; /** * abort */ abort(): void; /** * Set result data. */ set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body_2, distance: number): void; } /** * Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces. */ class RaycastVehicle { /** The car chassis body. */ chassisBody: Body_2; /** The wheels. */ wheelInfos: WheelInfo[]; /** Will be set to true if the car is sliding. */ sliding: boolean; world: World | null; /** Index of the right axis. x=0, y=1, z=2 */ indexRightAxis: number; /** Index of the forward axis. x=0, y=1, z=2 */ indexForwardAxis: number; /** Index of the up axis. x=0, y=1, z=2 */ indexUpAxis: number; /** The constraints. */ constraints: Constraint[]; /** Optional pre-step callback. */ preStepCallback: () => void; currentVehicleSpeedKmHour: number; /** Number of wheels on the ground. */ numWheelsOnGround: number; constructor(options: { /** The car chassis body. */ chassisBody: Body_2; /** Index of the right axis. x=0, y=1, z=2 */ indexRightAxis?: number; /** Index of the forward axis. x=0, y=1, z=2 */ indexForwardAxis?: number; /** Index of the up axis. x=0, y=1, z=2 */ indexUpAxis?: number; }); /** * Add a wheel. For information about the options, see `WheelInfo`. */ addWheel(options?: WheelInfoOptions): number; /** * Set the steering value of a wheel. */ setSteeringValue(value: number, wheelIndex: number): void; /** * Set the wheel force to apply on one of the wheels each time step */ applyEngineForce(value: number, wheelIndex: number): void; /** * Set the braking force of a wheel */ setBrake(brake: number, wheelIndex: number): void; /** * Add the vehicle including its constraints to the world. */ addToWorld(world: World): void; /** * Get one of the wheel axles, world-oriented. */ private getVehicleAxisWorld; updateVehicle(timeStep: number): void; updateSuspension(deltaTime: number): void; /** * Remove the vehicle including its constraints from the world. */ removeFromWorld(world: World): void; castRay(wheel: WheelInfo): number; updateWheelTransformWorld(wheel: WheelInfo): void; /** * Update one of the wheel transform. * Note when rendering wheels: during each step, wheel transforms are updated BEFORE the chassis; ie. their position becomes invalid after the step. Thus when you render wheels, you must update wheel transforms before rendering them. See raycastVehicle demo for an example. * @param wheelIndex The wheel index to update. */ updateWheelTransform(wheelIndex: number): void; /** * Get the world transform of one of the wheels */ getWheelTransformWorld(wheelIndex: number): Transform; updateFriction(timeStep: number): void; } type RaycastVehicleOptions = ConstructorParameters[0]; /** * RayMode */ type RayMode = typeof RAY_MODES[keyof typeof RAY_MODES]; /** * RayOptions */ type RayOptions = { /** * from */ from?: Vec3; /** * to */ to?: Vec3; /** * mode */ mode?: RayMode; /** * result */ result?: RaycastResult; /** * If set to `true`, the ray skips any hits with normal.dot(rayDirection) < 0. * @default false */ skipBackfaces?: boolean; /** * collisionFilterMask * @default -1 */ collisionFilterMask?: number; /** * collisionFilterGroup * @default -1 */ collisionFilterGroup?: number; /** * Set to `false` if you don't want the Ray to take `collisionResponse` flags into account on bodies and shapes. * @default true */ checkCollisionResponse?: boolean; /** * callback */ callback?: RaycastCallback; }; /** 射线查询类型 */ export enum RayQueryType { /** 禁止 */ Disable = 0, /** 允许 */ Allow = 1, /** 禁止自己查询,只允许查子实体 */ AllowOnlyChilds = 2 } /** * Returns a reactive proxy of the object. * * The reactive conversion is "deep": it affects all nested properties. A * reactive object also deeply unwraps any properties that are refs while * maintaining reactivity. * * @example * ```js * const obj = reactive({ count: 0 }) * ``` * * @param target - The source object. */ function reactive(target: T): UnwrapNestedRefs; class ReactiveEffect { fn: () => T; scheduler: EffectScheduler | null; active: boolean; deps: Dep[]; parent: ReactiveEffect | undefined; onStop?: () => void; constructor(fn: () => T, scheduler?: EffectScheduler | null, scope?: EffectScope); run(): T; stop(): void; } interface ReactiveEffectOptions { lazy?: boolean; scheduler?: EffectScheduler; scope?: EffectScope; allowRecurse?: boolean; onStop?: () => void; } interface ReactiveEffectRunner { (): T; effect: ReactiveEffect; } const enum ReactiveFlags { SKIP = "__vj_skip", IS_REACTIVE = "__vj_isReactive", IS_READONLY = "__vj_isReadonly", IS_SHALLOW = "__vj_isShallow", RAW = "__vj_raw" } namespace reactivity { export { ref, shallowRef, isRef, toRef, toValue, toRefs, unref, proxyRefs, customRef, triggerRef, Ref, MaybeRef, MaybeRefOrGetter, ToRef, ToRefs, UnwrapRef, ShallowRef, ShallowUnwrapRef, RefUnwrapBailTypes, CustomRefFactory, reactive, readonly, isReactive, isReadonly, isShallow, isProxy, shallowReactive, shallowReadonly, markRaw, toRaw, ReactiveFlags, Raw, DeepReadonly, ShallowReactive, UnwrapNestedRefs, computed, ComputedRef, WritableComputedRef, WritableComputedOptions, ComputedGetter, ComputedSetter, deferredComputed, effect, stop_2 as stop, trigger, track, enableTracking, pauseTracking, resetTracking, ITERATE_KEY, ReactiveEffect, ReactiveEffectRunner, ReactiveEffectOptions, EffectScheduler, effectScope, EffectScope, getCurrentScope, onScopeDispose, TrackOpTypes, TriggerOpTypes, watch, watchEffect, watchSyncEffect, createPathGetter, WatchEffect, WatchOptions, WatchOptionsBase, WatchCallback, WatchSource, WatchStopHandle } } export { reactivity } /** * Takes an object (reactive or plain) or a ref and returns a readonly proxy to * the original. * * A readonly proxy is deep: any nested property accessed will be readonly as * well. It also has the same ref-unwrapping behavior as {@link reactive()}, * except the unwrapped values will also be made readonly. * * @example * ```js * const original = reactive({ count: 0 }) * * const copy = readonly(original) * * watchEffect(() => { * // works for reactivity tracking * console.log(copy.count) * }) * * // mutating original will trigger watchers relying on the copy * original.count++ * * // mutating the copy will fail and result in a warning * copy.count++ // warning! * ``` * * @param target - The source object. */ function readonly(target: T): DeepReadonly>; export class RecordState { position: Vector3; size: number; color: Vector4; /** * Creates a new record state. * @param {Vector3} position - The position of the particle. * @param {number} size - The size of the particle. * @param {Vector4} color - The color of the particle. */ constructor(position: Vector3, size: number, color: Vector4); } class Rect extends Path { shape: RectShape; constructor(opts?: RectProps); getDefaultShape(): RectShape; buildPath(ctx: CanvasRenderingContext2D, shape: RectShape): void; isZeroArea(): boolean; } export class RectCollideModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: RectCollideModuleOptions; constructor(app?: App, options?: RectCollideModuleOptions); onAwake(): void; addCollideRectObject(item: IRectCollide): void; removeCollideRectObject(item: IRectCollide): void; setCollideRectDirty(): void; updateCollideRect(): void; onAppUpdate(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface RectCollideModuleOptions { /** 重叠边距 */ overlapMargin?: number; /** 刷新防抖或节流时间毫秒,默认500 */ refreshTimeout?: number; /** 如果为false,则使用防抖来刷新,否则节流用来刷新,默认false */ useDebounce?: boolean; } type RectLike = { x: number; y: number; width: number; height: number; }; interface RectProps extends PathProps { shape?: Partial; } class RectShape { r?: number | number[]; x: number; y: number; width: number; height: number; } function reduce(arr: readonly T[], cb: (this: Context, previousValue: S, currentValue: T, currentIndex?: number, arr?: readonly T[]) => S, memo?: S, context?: Context): S; interface Ref { value: T; /** * Type differentiator only. * We need this to be in public d.ts but don't want it to show up in IDE * autocomplete, so we use a private Symbol instead. */ [RefSymbol]: true; } /** * Takes an inner value and returns a reactive and mutable ref object, which * has a single property `.value` that points to the inner value. * * @param value - The object to wrap in the ref. */ function ref(value: T): T; function ref(value: T): Ref>; function ref(): Ref; export class ReflectorBlurMaterial extends RawShaderMaterial { constructor(); } export class ReflectorDudvMaterial extends RawShaderMaterial { constructor({ map, reflectivity, dithering }?: { map?: any; reflectivity?: number; dithering?: boolean; }); } /** 反射材质 */ export class ReflectorMaterial extends RawShaderMaterial { constructor({ color, map, normalMap, normalScale, reflectivity, mirror, mixStrength, fog, dithering }?: { color?: Color; map?: any; normalMap?: any; normalScale?: Vector2; reflectivity?: number; mirror?: number; mixStrength?: number; fog?: any; dithering?: boolean; }); } export class ReflectorObject extends Group_2 { clipBias: number; blurIterations: number; reflectorPlane: Plane; normal: Vector3; reflectorWorldPosition: Vector3; cameraWorldPosition: Vector3; rotationMatrix: Matrix4; lookAtPosition: Vector3; clipPlane: Vector4; view: Vector3; target: Vector3; q: Vector4; textureMatrix: Matrix4; virtualCamera: PerspectiveCamera; textureMatrixUniform: { value: any; }; renderTarget: any; renderTargetRead: any; renderTargetWrite: any; renderTargetUniform: { value: any; }; blurMaterial: ReflectorBlurMaterial; screenCamera: OrthographicCamera; screenTriangle: any; screen: any; constructor({ width, height, clipBias, blurIterations }?: { width?: number; height?: number; clipBias?: number; blurIterations?: number; }); setSize(width: any, height: any): void; update(renderer: any, scene: any, camera: any): void; destroy(): any; } const RefSymbol: unique symbol; interface RefTypeValue { value: number; } /** * This is a special exported interface for other packages to declare * additional types that should bail out for ref unwrapping. For example * \@vue/runtime-dom can it like so in its d.ts: * * ``` ts * module '@vue/reactivity' { * export interface RefUnwrapBailTypes { * runtimeDOMBailTypes: Node | Window * } * } * ``` */ interface RefUnwrapBailTypes { } function registerPainter(name: string, Ctor: PainterBaseCtor): void; export function registerShaderChunks(): void; function registerSSRDataGetter(getter: ElementSSRDataGetter): void; /** * Returns a blob:// URL which points to a javascript file which will call importScripts with the given URL, to be used for cross-origin workers. * https://stackoverflow.com/questions/21913673/execute-web-worker-from-different-origin * @param url - URL to the worker js file * @param wasmURL - optional wasm file URL, will be passed to a created Module.locateFile (for emscripten) */ export function remoteWorkerURL(url: string, wasmURL?: string): string; class Render2D { /** * Not necessary if using SSR painter like svg-ssr */ dom?: HTMLElement; id: number; storage: Storage_2; painter: PainterBase; handler: Handler; animation: Animation_2; private _sleepAfterStill; private _stillFrameAccum; private _needsRefresh; private _needsRefreshHover; /** * If theme is dark mode. It will determine the color strategy for labels. */ private _darkMode; private _backgroundColor; constructor(id: number, dom?: HTMLElement, opts?: Render2DInitOpt); /** * 添加元素 */ add(el: Element_2): void; /** * 删除元素 */ remove(el: Element_2): void; /** * Change configuration of layer */ configLayer(zLevel: number, config: LayerConfig): void; /** * Set background color */ setBackgroundColor(backgroundColor: string | GradientObject | PatternObject): void; getBackgroundColor(): string | GradientObject | PatternObject; /** * Force to set dark mode */ setDarkMode(darkMode: boolean): void; isDarkMode(): boolean; /** * Repaint the canvas immediately */ refreshImmediately(fromInside?: boolean): void; /** * Mark and repaint the canvas in the next frame of browser */ refresh(): void; /** * Perform all refresh */ flush(): void; private _flush; /** * Set sleep after still for frames. * Disable auto sleep when it's 0. */ setSleepAfterStill(stillFramesCount: number): void; /** * Wake up animation loop. But not render. */ wakeUp(): void; /** * Refresh hover in next frame */ refreshHover(): void; /** * Refresh hover immediately */ refreshHoverImmediately(): void; /** * Resize the canvas. * Should be invoked when container size is changed */ resize(opts?: { width?: number | string; height?: number | string; }): void; /** * Stop and clear all animation immediately */ clearAnimation(): void; /** * Get container width */ getWidth(): number; /** * Get container height */ getHeight(): number; /** * Set default cursor * @param cursorStyle='default' 例如 crosshair */ setCursorStyle(cursorStyle: string): void; /** * Find hovered element * @param x * @param y * @return {target, topTarget} */ findHover(x: number, y: number): { target: Displayable; topTarget: Displayable; }; on(eventName: ElementEventName, eventHandler: ElementEventCallback, context?: Ctx): this; on(eventName: string, eventHandler: WithThisType, unknown extends Ctx ? Render2dType : Ctx>, context?: Ctx): this; /** * Unbind event * @param eventName Event name * @param eventHandler Handler function */ off(eventName?: string, eventHandler?: EventCallback): void; /** * Trigger event manually * * @param eventName Event name * @param event Event object */ trigger(eventName: string, event?: unknown): void; /** * Clear all objects and the canvas. */ clear(): void; /** * Dispose self. */ dispose(): void; } namespace render2d { export { init, dispose, disposeAll, getInstance, registerPainter, getElementSSRData, registerSSRDataGetter, Render2DInitOpt, ElementSSRData, ElementSSRDataGetter, Render2dType, Point, PointLike, Element_2 as Element, ElementAnimateConfig, ElementTextConfig, ElementTextGuideLineConfig, ElementEvent, ElementEventCallback, ElementProps, Displayable, DisplayableProps, Group, GroupProps, Path, PathStyleProps, PathProps, PathStatePropNames, PathState, ZRImage as Image, ImageStyleProps, ImageProps, ImageState, CompoundPath, CompoundPathShape, TSpan, TSpanStyleProps, TSpanProps, TSpanState, IncrementalDisplayable, ZRText as Text, TextStylePropsPart, TextStyleProps, TextProps_2 as TextProps, TextState, Arc, ArcProps, ArcShape, BezierCurve, BezierCurveProps, BezierCurveShape, Circle, CircleProps, CircleShape, Droplet, DropletProps, DropletShape, Ellipse, EllipseProps, EllipseShape, Heart, HeartProps, HeartShape, Isogon, IsogonProps, IsogonShape, Line, LineProps, LineShape, Polygon, PolygonProps, PolygonShape, Polyline, PolylineProps, PolylineShape, Rect, RectProps, RectShape, Ring, RingProps, RingShape, Rose, RoseProps, RoseShape, Sector, SectorProps, SectorShape, Star, StarProps, StarShape, Trochoid, TrochoidProps, TrochoidShape, LinearGradient, LinearGradientObject, RadialGradient, RadialGradientObject, Pattern, PatternObjectBase, PatternObject, ImagePatternObject, SVGPatternObject, BoundingRect, RectLike, OrientedBoundingRect, matrix, vector, colorTool as color, pathTool as path, zrUtil as util, morphPathTool as morph, parseSVG, showDebugDirtyRect, setPlatformAPI, measureBoundingRect } } export { render2d } interface Render2DInitOpt { renderer?: string; devicePixelRatio?: number; width?: number | string; height?: number | string; useDirtyRect?: boolean; useCoarsePointer?: 'auto' | boolean; pointerSize?: number; ssr?: boolean; } export interface Render2dTextureOptions { /** 绘制的元素,元素组 */ elements?: render2d.Element | render2d.Element[]; /** 渲染对象 */ render2dObject?: render2d.Render2dType; /** 是否有事件 */ pointerEvents?: boolean; /** 绘布宽 */ canvasWidth?: number; /** 绘布高 */ canvasHeight?: number; /** 是否根据绘制的内容计算渲染的大小 */ autoCanvasSize?: boolean; /** 是否为了提高效率共享一个canvas */ sharedCanvas?: boolean; /** 纹理颜色空间。默认srgb */ colorSpace?: ColorSpace; } /** * @type {string} */ interface Render2dType extends Render2D { } /** * 创建3d绘图渲染材质 */ export class Render3dTexture { #private; fbo: WebGLRenderTarget; app: App; scene: Scene; camera: Camera; renderCount: number; renderInterval: number; _texture: CanvasTexture | Texture; signal: { onRenderFinsh: Signal; onRenderOne: Signal; }; /** * * @param app 如果app是离屏渲染,并且options中scene为空,将使用app中的渲染场景做为材质;否则app对象只是用来更新材质的计时器使用 * @param options */ constructor(app: App, options?: Render3dTextureOptions); /** * 获取材质 */ get texture(): Texture | CanvasTexture; update(): void; dispose(): void; } export interface Render3dTextureOptions extends FBOSettings { /** * 要渲染的场景 */ scene?: Scene; /** * 相机 */ camera?: Camera; /** 纹理宽度(默认1024)像素,需要乘pixelRatio */ width?: number; /** 纹理高度(默认1024)像素,需要乘pixelRatio */ height?: number; /** 渲染次数 为0时表示无限 */ renderCount?: number; /** 渲染间隔帧数 为0时表示不跳帧 */ renderInterval?: number; /** 如果是离屏渲染app时,销毁时是否自动销毁app对象 默认true */ autoDisposeApp?: boolean; } export interface RenderElementFlowMaterialOptions { geometryWidth: number; geometryHeight: number; flowDirection?: "horizon" | "vertical"; flowSpeed?: number; element: Element_2 | Element_2[]; canvasWidth?: number; canvasHeight?: number; autoCanvasSize?: boolean; expandRect?: number | [number, number, number, number]; } export type RendererEmitterSettings = TrailSettings | MeshSettings | BillBoardSettings | StretchedBillBoardSettings; /** * Enum representing the render modes for particles. */ export enum RenderMode { /** * Renders particles as billboards facing the camera. */ BillBoard = 0, /** * Renders particles as billboards that stretches towards the direction the particle is moving to. */ StretchedBillBoard = 1, /** * Renders particles as meshes. */ Mesh = 2, /** * Renders particles as trails. */ Trail = 3, /** * Renders particles as horizontal billboards. */ HorizontalBillBoard = 4, /** * Renders particles as vertical billboards. */ VerticalBillBoard = 5 } /** * Converts a render target to a png/jpeg data url string. * Note: this will clamp the values to [0, 1] and converts to srgb for float and half-float render targets. * @param target * @param mimeType * @param quality * @param textureIndex - index of the texture to use in the render target (only in case of multiple render target) */ export function renderTargetToDataUrl(renderer: WebGLRenderer, target: WebGLMultipleRenderTargets | WebGLRenderTarget, mimeType?: string, quality?: number, textureIndex?: number): string; /** * @extends {Behavior} */ export class RepeatBehavior extends AbstractDecoratorBehavior { limit: number; protected __iterator: number; /** * * @param {Behavior} source * @param {number} [count=Infinity] */ constructor(source: Behavior, count?: number); /** * @deprecated use .limit directly instead * @param {number} v */ setCount(v: number): void; /** * @deprecated use .limit directly instead * @return {number} */ getCount(): number; /** * * @param {Behavior} source * @param {number} [count] * @return {RepeatBehavior} */ static from(source: Behavior, count?: number): RepeatBehavior; initialize(context: BehaviorContext): void; tick(timeDelta: number): BehaviorStatus.Initial | BehaviorStatus.Running | BehaviorStatus.Succeeded | BehaviorStatus.Suspended | BehaviorStatus.Invalid; } /** * @extends {Behavior} */ export class RepeatUntilFailureBehavior extends AbstractDecoratorBehavior { protected __limit: number; protected __iterator: number; /** * * @param {Behavior} source * @param {number} [count=Infinity] */ constructor(source: Behavior, count?: number); /** * * @returns {RepeatUntilFailureBehavior} * @param {Behavior} source * @param {number} [limit] */ static from(source: Behavior, limit?: number): RepeatUntilFailureBehavior; tick(timeDelta: number): BehaviorStatus.Running | BehaviorStatus.Succeeded | BehaviorStatus.Failed; } export class RepeatUntilSuccessBehavior extends AbstractDecoratorBehavior { protected __limit: number; protected __iterator: number; /** * * @param {Behavior} source * @param {number} [count=Infinity] */ constructor(source: Behavior, count?: number); /** * * @param {Behavior} source * @param {number} [limit] * @return {RepeatUntilSuccessBehavior} */ static from(source: Behavior, limit?: number): RepeatUntilSuccessBehavior; tick(timeDelta: number): BehaviorStatus.Running | BehaviorStatus.Succeeded | BehaviorStatus.Failed; } /** * Replace all occurrences of a string in another string * @param str - The string to search * @param find - The string to replace * @param replace - The replacement string * * @category Text */ export function replaceAll(str: string, find: string, replace: string): string; /** * Resets the previous global effect tracking state. */ function resetTracking(): void; /** 根据坐标位置重置uv坐标 */ export const resetUV: (geometry: BufferGeometry) => void; export const ResManager: ResourceManager; export interface ResourceItem { /** 资源名称 */ name?: string; /** 资源路径 */ url?: string; /** 是否使用缓存,是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 */ useCache?: boolean; /** 资源类型 为custom时,options可输入一个异步回调函数 */ type?: "model" | "texture" | "plugin" | "library" | "extensionIfcLoader" | "extensionLoader" | "custom" | string; /** 选项 */ options?: ILoadModelOption | LoadPluginOpts | Function; } export class ResourceManager { #private; loaderManager: LoaderManager; defaultError: (err: string) => void; useCacheResMap: Map; serviceAasserUrlPath: string; constructor(_loaderManager?: LoaderManager); /** * 设置服务器资源数据 * @param path */ setServiceUrlPath(path: string, dirs?: Array): void; /** * 根据名称获取服务器端资源路径 * @param name 资源名称或路径。如果只通过名称的话,为了获取资源类型。需采用 名称.后缀 的格式 * @param type 默认是assert */ svrUrl(name?: string, type?: string): string; /** * 获取资源 * @param url * @param useCache 是否使用缓存,是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @param fileType 是否指定资源类型。如果不指定。则通过url获取 * @returns this */ loadRes(url: string, useCache: boolean, fileType?: string): Promise; /** * 获取材质(线性空间) * @param url * @param useCache 是否使用缓存(默认是),是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @param fileType 文件类型 默认 img * @param onError 错误回调 */ loadTextureLinear(url: string, useCache?: boolean, fileType?: string, onError?: (err: any) => void): Texture; /** * 获取材质(线性空间)返回一个promise * @param url * @param useCache 是否使用缓存(默认是),是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @param fileType 文件类型 默认 img * @param colorSpace 颜色空间默认 SRGBColorSpace */ loadTextureLinearSync(url: string, useCache?: boolean, fileType?: string, colorSpace?: ColorSpace): Promise; /** * 获取材质(默认srgb空间) * @param url * @param useCache 是否使用缓存(默认是),是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @param fileType 文件类型 默认 img * @param onError 错误回调 * @param colorSpace 颜色空间默认 SRGBColorSpace */ loadTexture(url: string, useCache?: boolean, fileType?: string, onError?: (err: any) => void, colorSpace?: ColorSpace): Texture; /** * 获取材质(默认srgb空间)返回一个promise * @param url * @param useCache 是否使用缓存(默认是),是的话,将把获取的资源保存至缓存,下次获取的是获取缓存保存的同一个资源对象。不使用缓存每次将创建新的资源对象 * @param fileType 文件类型 默认 img * @param colorSpace 颜色空间默认 SRGBColorSpace */ loadTextureSync(url: string, useCache?: boolean, fileType?: string, colorSpace?: ColorSpace): Promise; /** * 加载模型资源文件 */ loadModelRes(url: string, option?: ILoadModelOption): Promise; /** * 增加模型资源对象 * res 资源对象 * url 资源的url * option 选项 */ addModel(res: any, url: string, option?: ILoadModelOption): Entity; /** * 加载模型文件 */ loadModel(url: string, option?: ILoadModelOption): Promise; /** 加载资源数组 */ loadResources(_resources: ResourceItem[]): RosourceItemsReturnType; /** * 清除资源缓存 */ clearResourceCache(): void; /** * 加载扩展的loader库 */ loadExtensionLoader(): Promise; /** * 加载扩展的IfcLoader库 */ loadExtensionIfcLoader(options?: { setupOptionalCategoriesOpts?: Record; applyWebIfcConfigOpts?: Record; }): Promise; /** * 获取加载器 * @param ext 资源类型 * @returns */ getLoader(ext: string): Loader | null; dispose(): void; } interface Response_2 { status: number; response: Record; data?: string | Record; xhr: XMLHttpRequest; } export { Response_2 as Response } /** * 状态 */ export enum ResStatus { /** 不存在 */ NoExist = 0, /** 正在加载 */ Loading = 1, /** 加载完成 */ LoadFinish = 2, /** 加载失败 */ LoadError = 3 } /** * If value1 is not null, then return value1, otherwise judget rest of values. * Low performance. * @return Final value */ function retrieve(...args: T[]): T; function retrieve2(value0: T, value1: R): T | R; function retrieve3(value0: T, value1: R, value2: W): T | R | W; const REVERSE_SUBTRACTION: CSGOperation; /** * Simple vehicle helper class with spherical rigid body wheels. */ class RigidVehicle { /** * The bodies of the wheels. */ wheelBodies: Body_2[]; coordinateSystem: Vec3; /** * The chassis body. */ chassisBody: Body_2; /** * The constraints. */ constraints: (HingeConstraint & { motorTargetVelocity?: number; })[]; /** * The wheel axes. */ wheelAxes: Vec3[]; /** * The wheel forces. */ wheelForces: number[]; constructor(options?: { /** * A Vector3 defining the world coordinate system. * @default new Vec3(1, 2, 3) */ coordinateSystem?: Vec3; /** * Optionally pass a body for the chassis */ chassisBody?: Body_2; }); /** * Add a wheel */ addWheel(options?: { /** The wheel body */ body?: Body_2; /** Position of the wheel, locally in the chassis body. */ position?: Vec3; /** Axis of rotation of the wheel, locally defined in the chassis. */ axis?: Vec3; /** Slide direction of the wheel along the suspension. */ direction?: Vec3; }): number; /** * Set the steering value of a wheel. * @todo check coordinateSystem */ setSteeringValue(value: number, wheelIndex: number): void; /** * Set the target rotational speed of the hinge constraint. */ setMotorSpeed(value: number, wheelIndex: number): void; /** * Set the target rotational speed of the hinge constraint. */ disableMotor(wheelIndex: number): void; /** * Set the wheel force to apply on one of the wheels each time step */ setWheelForce(value: number, wheelIndex: number): void; /** * Apply a torque on one of the wheels. */ applyWheelForce(value: number, wheelIndex: number): void; /** * Add the vehicle including its constraints to the world. */ addToWorld(world: World): void; private _update; /** * Remove the vehicle including its constraints from the world. */ removeFromWorld(world: World): void; /** * Get current rotational velocity of a wheel */ getWheelSpeed(wheelIndex: number): number; } type RigidVehicleOptions = ConstructorParameters[0]; class Ring extends Path { shape: RingShape; constructor(opts?: RingProps); getDefaultShape(): RingShape; buildPath(ctx: CanvasRenderingContext2D, shape: RingShape): void; } interface RingProps extends PathProps { shape?: Partial; } class RingShape { cx: number; cy: number; r: number; r0: number; } class Rose extends Path { shape: RoseShape; constructor(opts?: RoseProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): RoseShape; buildPath(ctx: CanvasRenderingContext2D, shape: RoseShape): void; } interface RoseProps extends PathProps { shape?: Partial; } class RoseShape { cx: number; cy: number; r: number[]; k: number; n: number; } export interface RosourceItemsReturnType { promises: (progressCb?: (percentage: number, error?: any) => void) => Promise; getResouces: () => { name?: string; url?: string; type?: string; resource: any; }[]; getResource: (name: any) => any; getTexture: (name: any) => Texture; getModel: (name: any) => Entity; /** 根据模型名称克隆新的模型 */ cloneModel: (name: string, options?: ILoadModelOption) => Entity; } /** * 旋转变换 */ function rotate(out: MatrixArray, a: MatrixArray, rad: number, pivot?: VectorArray): MatrixArray; /** * 旋转的光环. */ export class RotatingApertureMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setMarkersWidth(width: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; _createMarker(): void; private _createMakerElement; private _getDotsStyleObj; } /** * 旋转的文本框. */ export class RotatingTextBorderMarker extends AnimateMarkerBase { constructor(features: FeatureCollection | { position: [number, number, number?]; text?: string; }, options?: AnimateMarkerLayerOption); setMarkersWidth(width: number): void; setMarkersHeight(height: number): void; setMarkersTextField(textField: string, index?: number): void; setMarkersTextColor(textColor: string, index?: number): void; setMarkersTextFontSize(textFontSize: number, index?: number): void; setMarkersColors(colors: string[], index?: number): void; _createMarker(): void; _setMarkerContainerProperty(properties: any, index?: number): void; } /** * Apply rotation to particles over their life. */ export class Rotation3DOverLife implements Simulation { angularVelocity: RotationGenerator; type: string; private tempQuat; private dynamic; constructor(angularVelocity: RotationGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } /** * Rotational constraint. Works to keep the local vectors orthogonal to each other in world space. */ class RotationalEquation extends Equation { /** * World oriented rotational axis. */ axisA: Vec3; /** * World oriented rotational axis. */ axisB: Vec3; /** * maxAngle */ maxAngle: number; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * World oriented rotational axis. */ axisA?: Vec3; /** * World oriented rotational axis. */ axisB?: Vec3; /** * maxAngle */ maxAngle?: number; /** * @default 1e6 */ maxForce?: number; }); computeB(h: number): number; } type RotationalEquationOptions = ConstructorParameters[2]; /** * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value. */ class RotationalMotorEquation extends Equation { /** * World oriented rotational axis. */ axisA: Vec3; /** * World oriented rotational axis. */ axisB: Vec3; /** * Motor velocity. */ targetVelocity: number; constructor(bodyA: Body_2, bodyB: Body_2, maxForce?: number); computeB(h: number): number; } export class RotationBehavior extends Behavior { axis: Vector3; speed: number; angle: number; __offset: Quaternion; resetWhenFinalize: boolean; constructor(); static fromJSON(param: { axis?: Vector3; speed?: number; angle?: number; resetWhenFinalize?: boolean; }): RotationBehavior; /** * * @param axis * @param speed * @param angle */ fromJSON(param: { axis?: Vector3; speed?: number; angle?: number; resetWhenFinalize?: boolean; }): void; initialize(context: BehaviorContext): void; tick(timeDelta: any): BehaviorStatus; finalize(): void; } /** * Apply rotation to particles based on their speed. */ export class RotationBySpeed implements Simulation { angularVelocity: ValueGenerator | FunctionValueGenerator; speedRange: IntervalValue; type: string; private tempQuat; constructor(angularVelocity: ValueGenerator | FunctionValueGenerator, speedRange: IntervalValue); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } export interface RotationGenerator { type: 'rotation'; genValue(q: Quaternion, t?: number): Quaternion; toJSON(): FunctionJSON; clone(): RotationGenerator; } export function RotationGeneratorFromJSON(json: FunctionJSON): RotationGenerator; /** * Apply rotation to particles over their life. */ export class RotationOverLife implements Simulation { angularVelocity: ValueGenerator | FunctionValueGenerator; type: string; private dynamic; constructor(angularVelocity: ValueGenerator | FunctionValueGenerator); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } export function roundToStep(value: number, step: number): number; /** * This class represents a running tween for a specific target object. * It manages the execution of actions and tweens associated with the tween. * Don't instantiate this manually. * @template T - The type of the target object. */ export class RunningTween { /** * Indicates whether the execution of the running tween is paused. * If set to `true`, the tween will not progress until it is resumed. */ paused: boolean; /** * The time scale factor for the running tween. * It determines the speed at which the tween progresses. * A value of `1` represents normal speed, while `0.5` would be half-speed, and `2` would be double-speed. */ timeScale: number; /** * Indicates whether the running tween has finished executing. */ get finished(): boolean; tweenManager: TweenManager; /** * Don't instantiate this manually. */ constructor(target: T, tween: Tween, tweenManager: TweenManager); /** * Set the time scale for the running tween. * @param value - The time scale value to apply. * @returns The updated RunningTween instance. */ setTimeScale(value: number): this; /** * Pause the execution of the running tween. */ pause(): void; /** * Resume the execution of the running tween if it was paused. */ resume(): void; /** * Stop the running tween, causing it to finish immediately. */ stop(): void; /** * Complete the running tween, causing it to finish immediately. */ complete(): void; } /** * Set value only if setter exists * @param object - object to set * @param prop - property to set * @param value - value to set * @param allowWritable - allow writable properties without setter * @param allowAny - allow any property (even if it doesn't exist) * * @category JS Object */ export function safeSetProperty(object: T | undefined | null, prop: K, value: NonNullable[K], allowWritable?: boolean, allowAny?: boolean): boolean; const SAH: SplitStrategy; /** * Sweep and prune broadphase along one axis. */ class SAPBroadphase extends Broadphase { /** * List of bodies currently in the broadphase. */ axisList: Body_2[]; /** * The world to search in. */ world: World | null; /** * Axis to sort the bodies along. * Set to 0 for x axis, and 1 for y axis. * For best performance, pick the axis where bodies are most distributed. */ axisIndex: 0 | 1 | 2; private _addBodyHandler; private _removeBodyHandler; /** * Check if the bounds of two bodies overlap, along the given SAP axis. */ static checkBounds(bi: Body_2, bj: Body_2, axisIndex: 0 | 1 | 2): boolean; /** * insertionSortX */ static insertionSortX(a: Body_2[]): Body_2[]; /** * insertionSortY */ static insertionSortY(a: Body_2[]): Body_2[]; /** * insertionSortZ */ static insertionSortZ(a: Body_2[]): Body_2[]; constructor(world: World); /** * Change the world */ setWorld(world: World): void; /** * Collect all collision pairs */ collisionPairs(world: World, p1: Body_2[], p2: Body_2[]): void; sortList(): void; /** * Computes the variance of the body positions and estimates the best axis to use. * Will automatically set property `axisIndex`. */ autoDetectAxis(): void; /** * Returns all the bodies within an AABB. * @param result An array to store resulting bodies in. */ aabbQuery(world: World, aabb: AABB, result?: Body_2[]): Body_2[]; } /** * 缩放变换 */ function scale(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray; /** * 向量缩放 */ function scale_2(out: T, v: VectorArray, s: number): T; /** * 向量缩放后相加 */ function scaleAndAdd(out: T, v1: VectorArray, v2: VectorArray, a: number): T; export class SceneModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; allScenes: Scene[]; allCameras: Camera[]; allControlStates: (CameraState | undefined)[]; options: SceneModuleOptions; _axesHelper: AxesHelper; _loadedResources: RosourceItemsReturnType; _config: EnvConfigOption & { [key: string]: any; }; constructor(app?: App, options?: SceneModuleOptions); get sceneEntity(): any; setAxesHelperVisible(visible?: boolean, size?: number): void; isAxesHelperVisible(): boolean; setBackgroundEnvironment(options?: BackgroundEnvironmentOptions): Promise; get envConfig(): EnvConfigOption & { [key: string]: any; }; setEnvConfig(key: string, value: any): void; clearScenes(): void; addScene(scene?: Scene, camera?: CameraOptions): Scene; activeScene(_scene: Scene, opts?: { oldScene?: Scene; camera?: Camera; oldCamera?: Camera; cameraState?: CameraState; enableTransition?: boolean; exitBlurTime?: number; }): Promise; removeScene(_scene: Scene): Promise; setScene(scene?: Scene, camera?: CameraOptions): Promise; /** 初始化场景对象 */ initScene(scene: Scene, opts?: { defaultLights?: boolean; gridHelper?: GridHelperModuleOptions; }): void; onAwake(): void; updateSceneMatixWorld(): void; addDefaultLights(scene?: Scene): void; getSceneStatData(): { objects: number; vertices: number; triangles: number; }; setFocus(): void; /** 加载资源数组 */ loadResources(_resources: ResourceItem[], options?: loadResourcesOptions): Promise; getLoadedResources(): RosourceItemsReturnType; setupUiConfig(): UiObjectConfig; } export type SceneModuleOptions = EnvConfigOption & BackgroundEnvironmentOptions; /** * The Scheduler is in charge of managing the Providers that * are used to gather resources needed to display the layers on a View. * There is only one instance of a Scheduler per webview, and it is instanciated * with the creation of the first view. * * @constructor */ export class Scheduler { constructor(); runCommand(command: any, queue: any, executingCounterUpToDate: any): void; execute(command: { id?: string; url?: string; priority?: number; notifyChange?: Function; executeCommand?: Function; [key: string]: any; }): any; /** * Adds a provider for a specified protocol. The provider will be used when * executing the queue to provide resources. */ addProtocolProvider(protocol: any, provider: any): void; /** * Get a specific Provider given a particular protocol. * * @param {string} protocol * * @return {Provider} */ getProtocolProvider(protocol: any): any; commandsWaitingExecutionCount(): any; commandsRunningCount(): any; resetCommandsCount(type: any): any; deQueue(queue: any): any; } /** * 一个全屏平面,使用它可以创建全屏效果 */ export class ScreenQuad { material: Material; mesh: Mesh; constructor(app: App, config?: Partial); } export interface Screenshot { quality?: number; mine?: string; download?: boolean; } export interface ScriptDefaultOptions { src: string; strategy?: string; injectLocation?: string; async?: boolean; } class Sector extends Path { shape: SectorShape; constructor(opts?: SectorProps); getDefaultShape(): SectorShape; buildPath(ctx: CanvasRenderingContext2D, shape: SectorShape): void; isZeroArea(): boolean; } interface SectorProps extends PathProps { shape?: Partial; } class SectorShape { cx: number; cy: number; r0: number; r: number; startAngle: number; endAngle: number; clockwise: boolean; /** * Corner radius of sector * * clockwise, from inside to outside, four corners are * inner start -> inner end * outer start -> outer end * * 5 => [5, 5, 5, 5] * [5] => [5, 5, 0, 0] * [5, 10] => [5, 5, 10, 10] * [5, 10, 15] => [5, 10, 15, 15] * [5, 10, 15, 20] => [5, 10, 15, 20] */ cornerRadius: number | number[]; } /** * 线段相交 * @param x1 * @param y1 * @param x2 * @param y2 * @param x3 * @param y3 * @param x4 * @param y4 * @return {{result: string, status: boolean} | {result: string, status: boolean} | {x: number, y: number, status: boolean, ratio: number} | {result: string, status: boolean}} */ export function segmentIntersect(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): { result: string; status: boolean; x?: undefined; y?: undefined; ratio?: undefined; } | { status: boolean; x: number; y: number; ratio: number; result?: undefined; }; /** * 判断两条三维线段是否共线、平行或相交,并求出交点及其比例 * @param p1 - 第一条线段的起点 * @param p2 - 第一条线段的终点 * @param p3 - 第二条线段的起点 * @param p4 - 第二条线段的终点 * @returns {Object} 结果对象,包含是否共线、是否平行、是否相交、交点及比例 */ export function segmentIntersect3d(p1: any, p2: any, p3: any, p4: any, epsilon?: number): { status: boolean; result: string; point: Vector3; ratio: number; }; /** * Will try every child behaviour in order until one succeeds or if all fail - the selector behavior will fail too */ export class SelectorBehavior extends CompositeBehavior { __currentBehaviour: Behavior; __currentBehaviourIndex: number; constructor(); /** * * @param {Behavior[]} children * @returns {SelectorBehavior} */ static from(children: Behavior[]): SelectorBehavior; tick(timeDelta: number): BehaviorStatus; finalize(): void; initialize(context: BehaviorContext): void; } export class SendEventBehavior extends Behavior { event: string; data: any; target: any; constructor(); fromJSON({ event, data, target }: { event: any; data?: {}; target?: any; }): void; static fromJSON(j: { event: string; data: any; target?: any; }): SendEventBehavior; tick(timeDelta: number): BehaviorStatus; } interface SeparateConfig extends ElementAnimateConfig { dividePath?: DividePath; individualDelay?: IndividualDelay; } /** * Make separate morphing from one path to many paths. * Make the MorphingKind of `toPath` become `'ONE_ONE'`. */ function separateMorph(fromPath: Path, toPathList: Path[], animationOpts: SeparateConfig): { fromIndividuals: Path[]; toIndividuals: Path[]; count: number; }; /** * Executes all contained behaviors one after another in a sequence, next behaviour in the sequence will not be started until the previous one signal success * If any of the contained behaviours fail - the whole sequence fails */ export class SequenceBehavior extends CompositeBehavior { __currentBehaviourIndex: number; __currentBehaviourState: BehaviorStatus; __currentBehaviour: Behavior; constructor(); initialize(context: BehaviorContext): void; /** * * @param {number} timeDelta * @returns {BehaviorStatus} */ tick(timeDelta: number): BehaviorStatus; finalize(): void; /** * * @param {Behavior[]} list * @return {SequenceBehavior} */ static from(list: Behavior[]): SequenceBehavior; } export interface Sequencer { transform(position: Vector3, index: number): void; toJSON(): any; clone(): Sequencer; } export function SequencerFromJSON(json: any): Sequencer; /** * Decorator to mark a class as serializable using the {@link Serialization} class. * @note - Requires "experimentalDecorators": true in tsconfig.json * @param id - The id to use when serializing the class. This is used to identify the class when deserializing. Class names can be mangled during minification, so it is required to provide an id. */ export function serializable(id: string): any>(constructor: T) => T; /** * Serialization class with static methods for serializing and deserializing objects. * Properties and classes can be marked serializable by adding {@link serialize} and {@link serializable} decorators. * @category Serialization */ export class Serialization { static TypeMap: Map; static SerializableClasses: Map; /** * Serializers for primitive, array and struct/custom object types */ static Serializers: Serializer[]; static GetSerializer(obj: any): Serializer; static RegisterSerializer(...serializers: Serializer[]): void; static UnregisterSerializer(...serializers: Serializer[]): void; /** * Serialize an object * @param obj - object to serialize * @param meta - Optional object to store common meta-data/resources across the serialization process of multiple objects @param isThis - true if called from inside the serialization function, like custom {@link IJSONSerializable.toJSON}. */ static Serialize(obj: any, meta?: Record>, isThis?: boolean): any; /** * Deserialize an object * @param data - data to deserialize * @param obj - current object that's set. If of the same class/type the data is deserialized into that instead of creating new objects. * @param meta - Optional object to retrieve common meta-data/resources across the deserialization process of multiple objects. Objects in meta must be class instances, not js objects. (like Material, Texture, Object3D etc) * @param isThis - true if called from inside the deserialization function, like custom {@link IJSONSerializable.fromJSON} */ static Deserialize(data: any, obj: any, meta?: Record, isThis?: boolean): any; } export interface SerializationOptions { /** * Use URL for image. * @type {boolean} */ useUrlForImage?: boolean; } /** * Decorator to mark a class property as serializable using the {@link Serialization} class. * @note - Requires "experimentalDecorators": true in tsconfig.json * @param key - The key to use when serializing the property. If not provided, the property name is used (for this make sure the property name is not mangled during minification). * @category Decorators */ export function serialize(key?: string): PropertyDecorator; interface Serialized { nodes: Array<{ id: NodeId; }>; links: Array<{ source: NodeId; target: NodeId; weight: EdgeWeight; }>; } class SerializedBVH { roots: Array; index: ArrayBufferView; } /** * Serializer interface for primitive, array and struct/custom object types * @category Serialization */ export interface Serializer { serialize: (obj: any, meta?: any) => any; deserialize: (data: any, obj: any, meta?: any) => any; isType: (obj: any) => boolean; priority?: number; } /** * `Service` 服务类. * */ export class Service { /** * 服务器地址 * @type {string} */ serverUrl: string; /** * 访问凭证 * @type {string} */ accessToken: string; private readonly _reqImpl; private _cur_map_param; private _svr_url_map; private readonly _svr_url_service; private _secretKeys?; private _accessKeys?; private _workspaceName?; /** * 构造函数 * @param url 服务地址 * @param token 访问凭证 * @param req 请求的方法实现(默认内部实现) */ constructor(url: string, token?: string, req?: IRequest); private _url; /** * 克隆一个新的服务实例对象 * @param isCloneWorkspace 是否克隆当前工作区 (默认是) * @return Service */ clone(isCloneWorkspace?: boolean): Service; /** * 得到服务地址 * @param u 要拼接的地址 * @return string */ serviceUrl(u: string): string; /** * 切换至工作区 * @param workspaceName 工作区名称 * @return */ switchWorkspace(workspaceName: string): void; /** * 获取当前的工作区名称 * @return */ getCurWorkspaceName(): string; /** * 获取所有工作区(如果不是root权限的token获取非公开的工作区名称将返回空) * @return */ getWorkspaces(): Promise; /** * 创建工作区(默认需要root权限) * @param workspace 工作区设置 * @return */ workspaceCreate(workspace: IWorkspace): Promise; /** * 修改工作区(默认需要root权限) * @param workspace 工作区 * @return */ workspaceModify(workspace: IWorkspace): Promise; /** * 删除工作区(会同时删除工作区下面的所有目录文件)(默认需要root权限) * @param name 要删除的工作区名称 * @return */ workspaceDelete(name: string): Promise; /** * 密码转换为秘钥 * @param pwd 密码 */ pwdToSecretKey(pwd: string): string; /** * 增加秘钥key * @param key key值 */ addSecretKey(key: string): Set; /** * 移除秘钥key, 如果key为undefined时,则移除所有的 * @param key key值 */ removeSecretKey(key: string): Set; /** * 增加访问key * @param key key值 */ addAccessKey(key: string): Set; /** * 移除访问key, 如果key为undefined时,则移除所有的 * @param key key值 */ removeAccessKey(key: string): void; private _to_layer_string; private _addTokenHeader; private _get; private _post; private _del; /** * 把图层名称数组转成图层索引数组 * @param layernames 图层名称数组 * @param layers 图层列表 * @return {number[]} */ toLayerIndex(layernames: string[], layers: any[]): number[]; private _waitOpenMap; /** * 设置打开地图参数 */ setCurrentMapParam(param: IOpenMapResponse): IOpenMapResponse | null; /** * 当前地图参数 */ currentMapParam(): IOpenMapResponse | null; /** * 打开图 * @param param * @param isWaitFinish 是否等待打开完成 * @return {Promise} */ openMap(param: IOpenMapParam, isWaitFinish?: boolean): Promise; /** * 更新地图 * @param param * @param isWaitFinish 是否等待打开完成 */ updateMap(param: IUpdateMapParam, isWaitFinish?: boolean): Promise; /** * 字体地址 * @param param */ glyphsUrl(): string; /** * 服务根地址 */ baseUrl(): string; /** * 精灵图片名称 * @param name 精灵名称 */ spriteUrl(name: string): string; /** * 设置精灵图片名称 * @param name 精灵名称 */ setSprite(name: string): string; /** * 空白瓦片地址 */ blankTileUrl(): string; /** * 二维码图片地址 * @param content 生成二维码的内容 * @param size 生成二维码的大小,默认256 */ qrcodeUrl(content: string, size?: number): string; /** * 栅格瓦片地址 * @param param */ rasterTileUrl(param?: ITileUrlParam): string; /** * 矢量瓦片地址 * @param param */ vectorTileUrl(param?: ITileUrlParam): string; /** * 检查文件是否上传过 * @param filemd5 文件md5值 */ checkFileHasUpload(filemd5: string): Promise; /** * 返回上传文件的url地址 * @return {string} */ uploadUrl(): string; /** * 获取字符串的Md5值 * @param str * @return {string} */ strMd5(str: string): string; /** * 得到style的版本号 */ styleVersion(): number; /** * 获取文件的Md5值 * @param file * @return {Promise} */ fileMd5(file: File): Promise; /** * 上传地图 * @param file * @return {Promise} */ uploadMap(file: File): Promise; /** * 执行命令 * @return {string} */ execCommand(cmdname: string, param?: Record, mapid?: string, version?: string, useGet?: boolean): Promise; /** * 获取地图元数据 * @param mapid 地图ID ,为空, 则为当前打开的图形 * @param version 版本号,为空 则为当前打开的版本; */ metadata(mapid?: string, version?: string): Promise; /** * 修改地图元数据 * @param meta 要修改的元数据项 * @param mapid 地图ID ,为空, 则为当前打开的图形 * @param version 版本号,为空 则为当前打开的版本; */ updateMetadata(meta: Record, mapid?: string, version?: string): Promise; /** * 获取所有地图信息 * @param mapid 地图ID,为空,则获取所有的;如果传入的是地图ID数组,则获取指定的地图ID数组的信息。如果不想一次性获取,可通过传入分页对象获取,如{curPage: 1, pageCount: 10} * @param version 版本号,为空,则获取最新的; * 则获取所有的版本 */ listMaps(mapid?: string | string[] | { curPage: number; pageCount: number; mapIds?: string[]; }, version?: string): Promise; /** * 等待地图打开完成 * @param mapid 地图ID * @param version 地图版本号 * @param tryTime 每次尝试时间间隔(秒) * @param maxTryTimes 最大尝试次数 * @return {Promise} */ waitMapOpenFinish(mapid: string, version: string, tryTime?: number, maxTryTimes?: number): Promise; /** * 处理查询结果 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 */ processQueryResult(param: any, cb?: (point: [number, number]) => [number, number] | null | undefined): any; /** * 处理查询结果 * @private */ private _processQueryResult; /** * 点查询实体 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 */ pointQueryFeature(param: IPointQueryFeatures, cb?: (point: [number, number]) => [number, number] | null | undefined): Promise; /** * 矩形查询实体 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 */ rectQueryFeature(param: IRectQueryFeatures, cb?: (point: [number, number]) => [number, number] | null | undefined): Promise; /** * 表达式查询实体 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 */ exprQueryFeature(param: IExprQueryFeatures, cb?: (point: [number, number]) => [number, number] | null | undefined): Promise; /** * 条件查询实体 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 */ conditionQueryFeature(param: IConditionQueryFeatures, cb?: (point: [number, number]) => [number, number] | null | undefined): Promise; /** * 得到地图图层集合,调用前请确保地图已打开,否则会抛异常 */ getMapLayers(): IMapLayer[]; /** * 切换图层 * @param visibleLayers 让可见的图层列表数组 * @param expression 样式表达式 * @return {Promise} */ cmdSwitchLayers(visibleLayers: string[], expression?: string): Promise; /** * 更新样式 * @param param 样式参数 * @return {Promise} * * * Example: * ```typescript * const res = svc.cmdUpdateStyle({ * name: "style1", * layeron: [0,1,2,4,5,6,7,8,9], * layeroff: "", * clipbounds: "", * backcolor: 0, * lineweight:[1,1,0] * expression: "gOutColorRed := gInColorGreen;gOutColorGreen := gInColorBlue;gOutColorBlue := gInColorRed;gOutColorAlpha := gInColorAlpha;" * }); * ``` */ cmdUpdateStyle(param: IUpdateStyle): Promise; /** * 对图层进行切片缓存 * @param param * @return {Promise} */ cmdSliceLayer(param: ISliceLayer): Promise; /** * 获取样式图层名 * @param style 样式参数 * @param mapid 地图ID * @param version 版本号,为空,则获取最新的; * @param isGeomLayer 几何渲染图层优先(默认true) * @return {Promise} */ createStyle(style: IMapStyleParam, mapid?: string, version?: string, isGeomLayer?: boolean): Promise; /** * 获取已缓存的切片级别 * @param param 参数 * @return {Promise} */ getSliceCacheZoom(param: ISliceCacheZoom): Promise; /** * 获取图形中有数据的范围区域 * @param mapid 地图id * @param version 版本号 * @return {Promise} */ cmdGetDrawBounds(mapid?: string, version?: string): Promise; /** * 获取样式图层名 * @param mapid 地图ID * @param version 版本号,为空,则获取最新的; * @param isGeomLayer 几何渲染图层优先(默认true) * @param name 有名称时,根据名称来查找; * @return {Promise} */ getStyleLayerName(mapid: string, version?: string, isGeomLayer?: boolean, name?: string): Promise; /** * 获取图的缩略图 * @param mapid * @param version * @param width * @param height * @param darkTheme 是否是深色主题,是的话,图片将反色(黑色变白色) */ thumbnailUrl(mapid?: string, version?: string, width?: number, height?: number, darkTheme?: boolean): string; wmsTileUrl(param: IWmsTileUrl): string; /** * 删除地图 * @return {Promise} * @param mapid 地图ID * @param version 版本号,如删除所有版本,输入"*"号 * @param retainVersionMaxCount 删除所有版本时,保留的最新的版本总数。如总共有10个版本,retainVersionMaxCount为3时,会保存最新的3个版本,其余的都会删除 */ cmdDeleteMap(mapid: string, version: string, retainVersionMaxCount?: number): Promise; /** * 获取地图的AccessKey,获取之前请确保已成功打开了地图 * @param mapid 地图ID * @param key secretKey秘钥和超级管理员superKey * @return {Promise} */ cmdGetAccessKey(mapid: string, key: string): Promise; /** * 重置地图的AccessKey,获取之前请确保已成功打开了地图 * @param mapid 地图ID * @param key secretKey秘钥和超级管理员superKey * @return {Promise} */ cmdResetAccessKey(mapid: string, key: string): Promise; /** * 重置地图的密码,如果之前有密码,则是修改密码。如果之前没有密码,则是把此地图设置了密码保护。如果设置密码为空,则取消对此地图的密码保护。 * @param mapid 地图ID * @param key 旧的secretKey秘钥和超级管理员superKey * @param newKey 新的secretKey秘钥 * @return {Promise} */ cmdSetMapPassword(mapid: string, key: string, newKey: string): Promise; /** * 地图ID重命名 * @return {Promise} * @param oldMapID 旧地图ID * @param newMapID 新地图ID */ cmdRenameMap(oldMapID: string, newMapID: string): Promise; /** * 清空地图的几何和瓦片缓存数据 * @return {Promise} * @param mapid 地图ID * @param version 版本号 */ cmdClearMapCache(mapid: string, version: string): Promise; /** * 清空地图的瓦片缓存数据 * @return {Promise} * @param mapid 地图ID * @param version 版本号 */ cmdClearTileCache(mapid: string, version: string): Promise; /** * 获取服务端用户配置数据 */ getUserConfig(): Promise>; /** * 删除地图样式 * @return {Promise} * @param param 样式接口 */ cmdDeleteStyle(param: IDeleteStyle): Promise; /** * 删除地图缓存 * @return {Promise} * @param param 缓存接口 */ cmdDeleteCache(param: IDeleteCache): Promise; /** * 删除后台的一个地图相关的地图源文件 * @param mapfileNames 要删除的源文件名 * @return {Promise} */ cmdDeleteMapFile(mapfileNames: string | string[]): Promise; /** * 获取当前运行状态 * @return {Promise} * @param bDetail 是否需要细节 (默认false) */ cmdRunStatus(bDetail?: boolean): Promise; /** * 获取支持的格式类型 * @return {Promise} */ cmdGetSupportFormat(): Promise; /** * 获取服务后台常量设置 * @return {Promise} */ getConstData(): Promise; /** * 空白栅格style * @param minzoom 最小级别,缺省0 * @param maxzoom 最大级别,缺省24 * @param prefix 前缀,缺省rasterBlank */ rasterBlankStyle(minzoom?: number, maxzoom?: number, prefix?: string): { version: number; sources: { [x: string]: { type: string; tiles: string[]; tileSize: number; minzoom: number; maxzoom: number; }; }; glyphs: string; layers: { id: string; type: string; source: string; minzoom: number; maxzoom: number; layout: { visibility: string; }; }[]; }; /** * 获取栅格图层ID * @param prefix * @return {string} */ rasterLayerId(prefix?: string): string; /** * 获取栅格源ID * @param prefix * @return {string} */ rasterSourceId(prefix?: string): string; /** * 栅格style * @param tileUrl 栅格瓦片地址 * @param minzoom 最小级别,缺省0 * @param maxzoom 最大级别,缺省24 * @param prefix 前缀,缺省raster */ rasterStyle(tileUrl?: string, minzoom?: number, maxzoom?: number, prefix?: string): { version: number; sources: { [x: string]: { type: string; tiles: string[]; tileSize: number; minzoom: number; maxzoom: number; }; }; glyphs: string; layers: { id: string; type: string; source: string; minzoom: number; maxzoom: number; layout: { visibility: string; }; }[]; }; /** * 矢量style * @param tileUrl 矢量瓦片地址 或者为一个Object,为Object时,设置项为参数的每个项值,做为一个参数传入 * @param minzoom 最小级别,缺省0 * @param maxzoom 最大级别,缺省24 * @param prefix 前缀,缺省vector * @param hoverColor 高亮时颜色,缺省rgba(0,0,255,255) * @param hoverOpacity 高亮时透明度,缺省0.5 * @param hoverLineWidth 高亮时线宽,缺省3 * @param customColorCaseExpr 自定义颜色表达式,必须为数组[条件1,值,条件2,值,...],如[['==', ['feature-state', 'status'], 'alarm'], '#ff0000', ['==', ['feature-state', 'status'], 'normal'], '#00ff00'],缺省默认 * @param customOpacityCaseExpr 自定义透明度表达式,必须为数组,缺省默认 * @param customLineWidthCaseExpr 自定义线宽表达式,必须为数组,缺省默认 * @param disableHover 禁止hover */ vectorStyle(tileUrl?: string | Record, minzoom?: number, maxzoom?: number, prefix?: string, hoverColor?: string, hoverOpacity?: number, hoverLineWidth?: number, customColorCaseExpr?: any[], customOpacityCaseExpr?: any[], customLineWidthCaseExpr?: any[], disableHover?: boolean): { layers: ({ id: string; type: string; source: string; "source-layer": string; paint: { "line-color": any[]; "line-opacity": any[]; "line-width": (string | number | boolean | (string | boolean | string[])[])[]; "fill-color"?: undefined; "fill-antialias"?: undefined; "fill-outline-color"?: undefined; "fill-opacity"?: undefined; "line-blur"?: undefined; "circle-radius"?: undefined; "circle-color"?: undefined; "circle-stroke-color"?: undefined; "circle-opacity"?: undefined; }; layout?: undefined; } | { id: string; type: string; source: string; "source-layer": string; paint: { "fill-color": any[]; "fill-antialias": boolean; "fill-outline-color": any[]; "fill-opacity": any[]; "line-color"?: undefined; "line-opacity"?: undefined; "line-width"?: undefined; "line-blur"?: undefined; "circle-radius"?: undefined; "circle-color"?: undefined; "circle-stroke-color"?: undefined; "circle-opacity"?: undefined; }; layout: { "line-cap"?: undefined; }; } | { id: string; type: string; source: string; "source-layer": string; layout: { "line-cap": string; }; paint: { "line-color": any[]; "line-blur": (string | number | boolean | (string | boolean | string[])[])[]; "line-opacity": any[]; "line-width": any[]; "fill-color"?: undefined; "fill-antialias"?: undefined; "fill-outline-color"?: undefined; "fill-opacity"?: undefined; "circle-radius"?: undefined; "circle-color"?: undefined; "circle-stroke-color"?: undefined; "circle-opacity"?: undefined; }; } | { id: string; type: string; source: string; "source-layer": string; paint: { "circle-radius": any[]; "circle-color": any[]; "circle-stroke-color": any[]; "circle-opacity": any[]; "line-color"?: undefined; "line-opacity"?: undefined; "line-width"?: undefined; "fill-color"?: undefined; "fill-antialias"?: undefined; "fill-outline-color"?: undefined; "fill-opacity"?: undefined; "line-blur"?: undefined; }; layout?: undefined; })[]; version: number; sources: { [x: string]: { type: string; tiles: (string | Record)[]; maxzoom: number; minzoom: number; }; }; glyphs: string; }; /** * 得到所有矢量字体名称 * @return {Promise} */ getFontsCapacity(): Promise; /** * 清空服务器缓存数据 * @return {Promise} * @param prefix key前缀 */ clearCache(prefix?: string): Promise; /** * 获取服务器地图服务地址 * @param tileProvider * @return {string} */ webMapUrl(tileProvider: { tileCrs?: "gcj02" | "wgs84"; tileSize?: number; tileRetina?: number; tileMaxZoom?: number; tileUrl: string | string[]; tileShards?: string; tileToken?: string | string[]; tileFlipY?: boolean; mapbounds?: string; fourParameterBefore?: string; fourParameterAfter?: string; srs?: string; }): string; /** * 组合成新地图 * @param param 组合参数 * @return {Promise} */ composeNewMap(param: IComposeNewMap | IComposeNewMap[]): Promise; /** * 比较地图不同 * @param param 组合参数 * @return {Promise} */ cmdMapDiff(param: IMapDiff): Promise; /** * 导出布局空间为dwg图 * @param param 参数 * @return {Promise} */ cmdExportLayout(param: IExportLayout): Promise; /** * 目标匹配 * @param param 参数 * @return {Promise} */ cmdMatchObject(param: IMatchObject): Promise; /** * 自动提交图中的表格 * @param param 参数 * @return {Promise} */ cmdExtractTable(param: IExtractTable): Promise; /** * 拆分子图 * @param param 参数 * @return {Promise} */ cmdSplitChildMaps(param: ISplitChildMaps): Promise; /** * 获取创建实体的几何数据 * @param param 参数 * @param cb 结果中每个点的处理回调。如果返回空的话,则用默认处理方法 * @return {Promise} */ cmdCreateEntitiesGeomData(param: ICreateEntitiesGeomData, cb?: (point: [number, number]) => [number, number] | null | undefined): Promise; /** * 坐标转换 * @return {Promise} * @param srs 源坐标系名称,如 EPSG:4326 * @param crs 目标坐标系名称,如 EPSG:3857 * @param points 要转换的坐标 * @param fourParameter 四参数(x偏移,y偏移,缩放,旋转弧度),可选,对坐标最后进行修正 * @param isInverseFourParamter 是否是上面四参数坐标的反算 */ cmdTransform(srs: string, crs: string, points: GeoPoint | GeoPoint[], fourParameter?: string | string[], isInverseFourParamter?: boolean): Promise; /** * 投影prj文件WKT字符转proj4字符串 * @return {Promise} * @param srs 投影prj文件WKT字符 * @param from 字符串来源,为空为话为WKT */ cmdPrjWktToPrj4(wkt: string, from?: undefined | "" | "wmsauto" | "xml" | "urn" | "crsurl" | "url" | "micoordsys" | "pci"): Promise; /** * 保存用户自定义数据 * @param key 键名(必须唯一,否则会覆盖之前的数据,同类型的key前缀尽量一样),如果是数组的话,可以批量 * @param value 键值 * @param prop 属性值 * @param ttl 有效时间,单位秒,默认长期有效 */ saveCustomData(key: string | { key: string; value: any; prop?: any; ttl?: number; }[], value?: any, prop?: any, ttl?: number): Promise; /** * 获取用户自定义数据 * @param key 键名,如果是数组的话,可以查询. * @param options 选项 retDataType为空时查询数据及属性,"value"只查询数据,"prop"只查询属性。contentType返回类型,为空时为json,为"image"时为图片. */ getCustomData(key: string | string[], options?: { retDataType?: "" | "value" | "prop"; contentType?: "" | "image"; }): Promise; /** * 通过前缀获取用户自定义数据的键值 * @param prefix 键名前缀 */ getCustomDataKeysByPrefix(prefix: string): Promise; /** * 删除用户自定义数据 * @param key 键名,如果是数组的话,可以查询 * @param isPrefix 是否删除所有前缀为key的所有键值,默认false */ deleteCustomData(key: string | string[], isPrefix?: boolean): Promise; /** * 转成文档字符串 * @param content 如果传入了内容,则以content为主。json格式 * @return {string} */ toDbDoc(content: string | Record): string; } /** * 设置向量的两个项 */ function set(out: T, a: number, b: number): T; /** * Set an object as primitive to be ignored traversing children in clone or merge */ function setAsPrimitive(obj: any): void; export class SetDataCommand extends BaseCommand { private readonly oldData; private readonly newData; private readonly object; constructor(object: IHasDataEntity, newData: any, oldData?: any, autoExecute?: boolean); execute(): void; undo(): void; redo(): void; } export class SetEmitDirection implements Simulation { type: string; _temp: Vector3; _q: Quaternion; velocityX: number; velocityY: number; velocityZ: number; opts: any; constructor(opts: { velocityX?: ValueGenerator; velocityY?: ValueGenerator; velocityZ?: ValueGenerator; }); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export class SetMaterialMapCommand extends BaseCommand { private material; private mapName; private newMap; private materialSlot; private oldMap; constructor(material: Material, mapName: any, newMap: Texture, materialSlot: any); execute(): void; undo(): void; redo(): void; } /** * 设置材质透明 * @param material * @param opacity 透明度 * @param opts isAccOpacity 是否累加透明度(ture和之前透明度相乘,false直接设置透明度), isClone 是否克隆成新的材质 disposeOldMaterial 当克隆时是否删除旧的材质 */ export const setMaterialOpacity: (material: Mesh | Material | Material[], opacity: number, opts?: { isAccOpacity?: boolean; isClone?: boolean; disposeOldMaterial?: boolean; }) => any; export class SetMultipleValuesCommand extends BaseCommand { private object; private attributes; private oldValues; constructor(object: T, attributes: Partial); execute(): void; undo(): void; redo(): void; } export function setPhysicsResolver(resolver: PhysicsResolver): void; function setPlatformAPI(newPlatformApis: Partial): void; export class SetPositionCommand extends BaseCommand { private object; private newPosition; private oldPosition; constructor(object: Object3D, newPosition: Vector3, oldPosition?: Vector3); execute(): void; undo(): void; redo(): void; } export class SetRotationCommand extends BaseCommand { private object; private newRotation; private optionalOldRotation; private readonly oldRotation; constructor(object: Object3D, newRotation: Euler, optionalOldRotation?: Euler); execute(): void; undo(): void; redo(): void; } export class SetScaleCommand extends BaseCommand { private object; private newScale; private optionalOldScale?; private readonly oldScale; constructor(object: Object3D, newScale: Vector3, optionalOldScale?: Vector3); execute(): void; undo(): void; redo(): void; } /** * Set URL query parameter. If value is null, remove parameter. Similar to PHP's $_GET * @param p - parameter name to set * @param v - parameter value or null to remove * @param reload - reload page after setting parameter, default false. If false, `history.replaceState` is used. * * @category URL */ export function setUrlQueryParam(p: string, v: string | null, reload?: boolean): void; export class SetValueCommand extends BaseCommand { private object; private attributeName; private newValue; private oldValue; constructor(object: T, attributeName: K, newValue: T[K], oldValue?: T[K]); execute(): void; undo(): void; redo(): void; } const shaderFunctions: string; export function shaderMaterial(uniforms: TProps, vertexShader: string, fragmentShader: string, onInit?: (material: ShaderMaterialInstance) => void): ShaderMaterialEx; type ShaderMaterialEx = (new (parameters?: ShaderMaterialParametersEx, uniforms?: Partial) => ShaderMaterialInstance) & { key: string; }; type ShaderMaterialInstance = ShaderMaterial & TProps; type ShaderMaterialParametersEx = ShaderMaterialParameters & Partial; const shaderStructs: string; /** * Shadertoy shader (只支持imageBuffer,不支持BufferA,B,C,D)https://www.shadertoy.com/ */ export class ShadertoyMaterial extends ShaderMaterial { constructor(app: App, parameters?: ShadertoyMaterialParameters); } export interface ShadertoyMaterialParameters extends ShaderMaterialParameters { /** * 背景颜色 */ color?: ColorRepresentation; /** * 背景颜色透明度(0-1) * */ colorOpacity?: number; /** * 背景材质 */ map?: Texture; /** * commom shader */ common?: string; /** * 等同于image中的shader */ shader?: string; /** * 透明度 */ opacity?: number; /** * 透明色 */ opacityColor?: ColorRepresentation; /** * 亮度透明值 大于0表示亮度值*值表示透明度,小于0表示 (1-亮度值)*值表示透明度 */ brightOpacity?: number; /** * uniforms */ inputUniforms?: { /** * uniform名称 */ name: string; /** * 用在 shader中声明写法 */ defs: string; /** * 值 */ value: Uniform_2; }[]; /** * hsb偏移 (对输出颜色进行处理) */ hsbOffset?: [number, number, number]; /** * hsb颜色表达式 (变量hsb) */ hsbExpr?: string; /** * 如果不输入,则默认为当前鼠标像素坐标 */ mouseInputPos?: [number, number]; /** * 生成纹理的材质预定义宏 */ defines?: Record; /** * 重复纹理 */ repeat?: [number, number]; /** * 分辨率,是1000,1000 */ resolution?: [number, number]; /** * 是否使用大小衰减(根据相机远近自动调整点的大小) false的话,表示用像素大小,true表示世界坐标 */ sizeAttenuation?: boolean; /** * sizeAttenuation为false表示像素大小时的尺寸xyz方向的比例大小 */ sizeAttScale?: number | [number, number, number]; /** * uv旋转角度 */ uvRotateAngle?: number; /** * uv旋转中心点,默认(0.5,0.5) */ uvRotateCenter?: [number, number]; /** * uv缩放倍数 */ uvScale?: [number, number]; /** * uv缩放倍中心点,默认(0.5,0.5) */ uvScaleCenter?: [number, number]; /** * uv缩放背景色(r,b,g,a) (0-1) */ uvScaleBgColor?: [number, number, number, number]; } /** * Shadertoy材质 https://www.shadertoy.com/ */ export class ShadertoyTexture { app: App; _texture: Texture; image: BufferShader; bufferA: BufferShader; bufferB: BufferShader; bufferC: BufferShader; bufferD: BufferShader; opacityColor?: Color; uniforms: UniformMap; clock: Clock; set common(value: string); get texture(): Texture; constructor(app: App, options: ShadertoyTextureOptions); render(): void; dispose(): void; } export interface ShadertoyTextureItemOptions { shader?: string; iChannel0?: (Texture | BufferShader); iChannel1?: (Texture | BufferShader); iChannel2?: (Texture | BufferShader); iChannel3?: (Texture | BufferShader); } export interface ShadertoyTextureOptions { /** 像素宽 */ width: number; /** 像素高 */ height: number; /** 背景颜色 */ color?: ColorRepresentation; /** 背景颜色透明度(0-1) */ colorOpacity?: number; /** 背景材质 */ map?: Texture; /** common的shader */ common?: string; /** 等同于image中的shader */ shader?: string; /** image的shader */ image?: ShadertoyTextureItemOptions; /** bufferA的shader */ bufferA?: ShadertoyTextureItemOptions; /** bufferB的shader */ bufferB?: ShadertoyTextureItemOptions; /** bufferC的shader */ bufferC?: ShadertoyTextureItemOptions; /** bufferD的shader */ bufferD?: ShadertoyTextureItemOptions; /** 透明度 */ opacity?: number; /** 透明色 */ opacityColor?: ColorRepresentation; /** 亮度透明值 大于0表示亮度值*值表示透明度,小于0表示 (1-亮度值)*值表示透明度 */ brightOpacity?: number; /** uniforms */ inputUniforms?: { /** uniform名称 */ name: string; /** 用在 shader中声明写法 */ defs: string; value: Uniform_2; }[]; /** hsb偏移 (对输出颜色进行处理) */ hsbOffset?: [number, number, number]; /** hsb颜色表达式 (变量hsb) */ hsbExpr?: string; /** 如果不输入,则默认为当前鼠标像素位置 */ mouseInputPos?: [number, number]; /** 生成纹理的材质预定义宏 */ defines?: Record; /** 生成纹理的材质参数 */ materialParameters?: MaterialParameters; /** 生成纹理的渲染参数 */ renderTargetOptions?: RenderTargetOptions; /** 重复纹理 */ repeat?: [number, number]; /** * uv旋转角度 */ uvRotateAngle?: number; /** * uv旋转中心点,默认(0.5,0.5) */ uvRotateCenter?: [number, number]; /** * uv缩放倍数 */ uvScale?: [number, number]; /** * uv缩放倍中心点,默认(0.5,0.5) */ uvScaleCenter?: [number, number]; /** * uv缩放背景色(r,b,g,a) (0-1) */ uvScaleBgColor?: [number, number, number, number]; } type ShallowReactive = T & { [ShallowReactiveMarker]?: true; }; /** * Shallow version of {@link reactive()}. * * Unlike {@link reactive()}, there is no deep conversion: only root-level * properties are reactive for a shallow reactive object. Property values are * stored and exposed as-is - this also means properties with ref values will * not be automatically unwrapped. * * @example * ```js * const state = shallowReactive({ * foo: 1, * nested: { * bar: 2 * } * }) * * // mutating state's own properties is reactive * state.foo++ * * // ...but does not convert nested objects * isReactive(state.nested) // false * * // NOT reactive * state.nested.bar++ * ``` * * @param target - The source object. */ function shallowReactive(target: T): ShallowReactive; const ShallowReactiveMarker: unique symbol; /** * Shallow version of {@link readonly()}. * * Unlike {@link readonly()}, there is no deep conversion: only root-level * properties are made readonly. Property values are stored and exposed as-is - * this also means properties with ref values will not be automatically * unwrapped. * * @example * ```js * const state = shallowReadonly({ * foo: 1, * nested: { * bar: 2 * } * }) * * // mutating state's own properties will fail * state.foo++ * * // ...but works on nested objects * isReadonly(state.nested) // false * * // works * state.nested.bar++ * ``` * * @param target - The source object. */ function shallowReadonly(target: T): Readonly; type ShallowRef = Ref & { [ShallowRefMarker]?: true; }; /** * Shallow version of {@link ref()}. * * @example * ```js * const state = shallowRef({ count: 1 }) * * // does NOT trigger change * state.value.count = 2 * * // does trigger change * state.value = { count: 2 } * ``` * * @param value - The "inner value" for the shallow ref. */ function shallowRef(value: T): T extends Ref ? T : ShallowRef; function shallowRef(value: T): ShallowRef; function shallowRef(): ShallowRef; const ShallowRefMarker: unique symbol; type ShallowUnwrapRef = { [K in keyof T]: T[K] extends Ref ? V : T[K] extends Ref | undefined ? unknown extends V ? undefined : V | undefined : T[K]; }; /** * Base class for shapes */ class Shape { /** * Identifier of the Shape. */ id: number; /** * The type of this shape. Must be set to an int > 0 by subclasses. */ type: ShapeType | 0; /** * The local bounding sphere radius of this shape. */ boundingSphereRadius: number; /** * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. * @default true */ collisionResponse: boolean; /** * @default 1 */ collisionFilterGroup: number; /** * @default -1 */ collisionFilterMask: number; /** * Optional material of the shape that regulates contact properties. */ material: Material_2 | null; /** * The body to which the shape is added to. */ body: Body_2 | null; static idCounter: number; /** * All the Shape types. */ static types: { /** SPHERE */ readonly SPHERE: 1; /** PLANE */ readonly PLANE: 2; /** BOX */ readonly BOX: 4; /** COMPOUND */ readonly COMPOUND: 8; /** CONVEXPOLYHEDRON */ readonly CONVEXPOLYHEDRON: 16; /** HEIGHTFIELD */ readonly HEIGHTFIELD: 32; /** PARTICLE */ readonly PARTICLE: 64; /** CYLINDER */ readonly CYLINDER: 128; /** TRIMESH */ readonly TRIMESH: 256; }; constructor(options?: { /** * The type of this shape. */ type?: ShapeType; /** * Whether to produce contact forces when in contact with other bodies. * @default true */ collisionResponse?: boolean; /** * @default 1 */ collisionFilterGroup?: number; /** * @default -1 */ collisionFilterMask?: number; /** * Optional material of the shape that regulates contact properties. * @default null * @todo check this, the material is passed to the body, right? */ material?: Material_2; }); /** * Computes the bounding sphere radius. * The result is stored in the property `.boundingSphereRadius` */ updateBoundingSphereRadius(): void; /** * Get the volume of this shape */ volume(): number; /** * Calculates the inertia in the local frame for this shape. * @see http://en.wikipedia.org/wiki/List_of_moments_of_inertia */ calculateLocalInertia(mass: number, target: Vec3): void; /** * @todo use abstract for these kind of methods */ calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; } /** * The available shape types. */ const SHAPE_TYPES: { /** SPHERE */ readonly SPHERE: 1; /** PLANE */ readonly PLANE: 2; /** BOX */ readonly BOX: 4; /** COMPOUND */ readonly COMPOUND: 8; /** CONVEXPOLYHEDRON */ readonly CONVEXPOLYHEDRON: 16; /** HEIGHTFIELD */ readonly HEIGHTFIELD: 32; /** PARTICLE */ readonly PARTICLE: 64; /** CYLINDER */ readonly CYLINDER: 128; /** TRIMESH */ readonly TRIMESH: 256; }; enum ShapecastIntersection { } function shapeCompareFunc(a: Displayable, b: Displayable): number; export interface ShapeJSON { type: string; radius?: number; arc?: number; thickness?: number; donutRadius?: number; angle?: number; width?: number; height?: number; column?: number; row?: number; mesh?: string; mode?: number; particleSystem?: string; spread?: number; speed?: any; } export interface ShapeOptions { type?: ShapeType2; cylinderAxis?: 'x' | 'y' | 'z'; sphereRadius?: number; } type ShapeOptions2 = ConstructorParameters[0]; export interface ShapeParameters { type: T; params: ShapeTypeToShapeParameters[T]; offset?: CANNON.Vec3; orientation?: CANNON.Quaternion; } export interface ShapeResult { shape: T; offset?: CANNON.Vec3; orientation?: CANNON.Quaternion; } /** * ShapeType */ type ShapeType = typeof SHAPE_TYPES[keyof typeof SHAPE_TYPES]; export enum ShapeType2 { BOX = "Box", CYLINDER = "Cylinder", SPHERE = "Sphere", HULL = "ConvexPolyhedron", MESH = "Trimesh" } type ShapeTypeToShapeParameters = { Box: BoxParameters; Cylinder: CylinderParameters; Sphere: SphereParameters; ConvexPolyhedron: ConvexPolyhedronParameters; Trimesh: TrimeshParameters; }; function showDebugDirtyRect(zr: Render2dType, opts?: Opts): void; /** * Signal is a type of event bus. You can subscribe to events using {@link add} method and dispatch using sendN method where N is the number of arguments you wish to pass * Signal is different from a normal event bus in that 1 signal corresponds to 1 event type. For example, in HTML you have `addEventListener` which lets you subscribe to any kind of event, let's use "mousedown" as a reference. Using a Signal you would instead have a signal corresponding to "mousedown" and dispatch this signal only for this event. * @example `const mouseDown = new Signal(); mouseDown.send1(myMouseEvent);` */ export class Signal { handlers: any; /** * Event dispatcher dedicated to single event type * @constructor */ constructor(); get dispatching(): boolean; /** * @deprecated * @param {boolean} v */ set dispatching(v: boolean); /** * * @returns {boolean} */ get silent(): boolean; /** * * @param {boolean} v */ set silent(v: boolean); setFlag(flag: any): void; clearFlag(flag: any): void; writeFlag(flag: any, value: any): void; getFlag(flag: any): boolean; /** * * @param {function} h * @returns {boolean} */ contains(h: any): boolean; mute(): void; unmute(): void; /** * Tells if there are any handlers attached to the signal or not * @returns {boolean} */ hasHandlers(): boolean; /** * * @param {function} h * @param {*} [context] */ addOne(h: any, context?: any): () => boolean; /** * * @param {function} h * @param {*} [context] */ add(h: any, context?: any): () => boolean; /** * * @param {function} h * @param {*} [thisArg] if supplied, will match handlers with a specific context only * @returns {boolean} true if a handler was removed, false otherwise */ remove(h: any, thisArg?: any): boolean; /** * Remove all handlers */ removeAll(): void; /** * @param {...*} args */ dispatch(...args: any[]): void; /** * @deprecated do not use * @returns {boolean} */ isDispatching(): boolean; /** * * @param {Signal} other * @returns {Signal} merged signal combining events from this and other */ merge(other: any): Signal; } export class SignalHandler { /** * * @param {function} handle * @param {*} [context] */ constructor(handle: any, context: any); setFlag(flag: any): void; clearFlag(flag: any): void; writeFlag(flag: any, value: any): void; getFlag(flag: any): boolean; } class SilhouetteGenerator { [key: string]: any; } /** * A simple event dispatcher with typed event types, see {@link IEventDispatcher}. */ export class SimpleEventDispatcher implements IEventDispatcher { constructor(); private readonly _eventListeners; addEventListener(type: T, listener: (event: IEvent) => void): void; hasEventListener(type: T, listener: (event: IEvent) => void): boolean; removeEventListener(type: T, listener: (event: IEvent) => void): void; dispatchEvent(event: IEvent): void; } /** Deterministic simplex noise generator suitable for 2D, 3D and 4D spaces. */ class SimplexNoise { private p; private perm; private permMod12; /** * Creates a new `SimplexNoise` instance. * This involves some setup. You can save a few cpu cycles by reusing the same instance. * @param randomOrSeed A random number generator or a seed (string|number). * Defaults to Math.random (random irreproducible initialization). */ constructor(randomOrSeed?: RandomFn | string | number); /** * Samples the noise field in 2 dimensions * @param x * @param y * @returns a number in the interval [-1, 1] */ noise2D(x: number, y: number): number; /** * Samples the noise field in 3 dimensions * @param x * @param y * @param z * @returns a number in the interval [-1, 1] */ noise3D(x: number, y: number, z: number): number; /** * Samples the noise field in 4 dimensions * @param x * @param y * @param z * @returns a number in the interval [-1, 1] */ noise4D(x: number, y: number, z: number, w: number): number; } export function simplifyPoints(points: [number, number][], tolerance?: number, highestQuality?: boolean): [number, number][]; /** * Interface for particle simulations. * a simulation is a function that modifies a particle's properties over time. */ export interface Simulation { type: string; initialize(particle: Particle, particleSystem: IParticleSystem): void; update(particle: Particle, delta: number): void; frameUpdate(delta: number): void; toJSON(): any; clone(): Simulation; reset(): void; } export function SimulationFromJSON(json: any, particleSystem: ParticleSystem): Simulation; export interface SimulationParticlePlugin { type: string; constructor: Constructable; params: ParameterPair[]; loadJSON: (json: any, particleSystem: ParticleSystem) => Simulation; } export const SimulationTypes: { [key: string]: SimulationParticlePlugin; }; type singleTouchAction = typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE; /** * Apply size to particles based on their speed. */ export class SizeBySpeed implements Simulation { size: FunctionValueGenerator; speedRange: IntervalValue; type: string; initialize(particle: Particle): void; constructor(size: FunctionValueGenerator, speedRange: IntervalValue); update(particle: Particle): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } /** * Apply size to particles based on their life. */ export class SizeOverLife implements Simulation { size: FunctionValueGenerator; type: string; initialize(particle: Particle): void; constructor(size: FunctionValueGenerator); update(particle: Particle): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } /** 休眠多少毫秒,默认1秒 */ export function sleep(ms?: number): Promise; function slice(arr: ArrayLike_2, ...args: SliceParams): T[]; type SliceParams = Parameters; /** * 平滑点,拐弯处将以曲线代替 * points 点数组 * curvePointNum 每个拐点增加的曲线点个数,默认5 * curvePointPosRatio 开始拐的点所占曲线位置的长度比例 (0-1) 默认 0.9 * oldIndexTarget 可填入一个数组,用来返回新数据索引对应的来老数组中的索引位置 */ export function smoothPoints(points: Array<[number, number, number]>, curvePointNum?: number, curvePointPosRatio?: number, oldIndexTarget?: number[]): any[]; /** * Constraint equation solver base class. */ class Solver { /** * All equations to be solved */ equations: Equation[]; /** * @todo remove useless constructor */ constructor(); /** * Should be implemented in subclasses! * @todo use abstract * @return number of iterations performed */ solve(dt: number, world: World): number; /** * Add an equation */ addEquation(eq: Equation): void; /** * Remove an equation */ removeEquation(eq: Equation): void; /** * Add all equations */ removeAllEquations(): void; } /** * Apply speed to particles based on their life. */ export class SpeedOverLife implements Simulation { speed: FunctionValueGenerator; type: string; initialize(particle: Particle): void; constructor(speed: FunctionValueGenerator); update(particle: Particle): void; toJSON(): any; static fromJSON(json: any): Simulation; frameUpdate(delta: number): void; clone(): Simulation; reset(): void; } /** * Spherical shape * @example * const radius = 1 * const sphereShape = new CANNON.Sphere(radius) * const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape }) * world.addBody(sphereBody) */ class Sphere_2 extends Shape { /** * The radius of the sphere. */ radius: number; /** * * @param radius The radius of the sphere, a non-negative number. */ constructor(radius: number); /** calculateLocalInertia */ calculateLocalInertia(mass: number, target?: Vec3): Vec3; /** volume */ volume(): number; updateBoundingSphereRadius(): void; calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; } export class SphereEmitter implements EmitterShape { type: string; radius: number; arc: number; thickness: number; mode: EmitterMode; spread: number; speed: ValueGenerator | FunctionValueGenerator; constructor(parameters?: SphereEmitterParameters); private currentValue; update(system: ParticleSystem, delta: number): void; initialize(p: Particle, emissionState: EmissionState): void; toJSON(): ShapeJSON; static fromJSON(json: any): SphereEmitter; clone(): EmitterShape; } /** * Interface representing the parameters for a sphere emitter. */ export interface SphereEmitterParameters { /** * The radius of the sphere. */ radius?: number; /** * The arc of the sphere. */ arc?: number; /** * The thickness of the sphere. 1 is a full sphere, 0 is a thin shell. */ thickness?: number; /** * The mode of the emitter. * {@link EmitterMode} */ mode?: EmitterMode; /** * The length of the segment at which the emitter point converges at the start and end, when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ spread?: number; /** * The speed of the emitter start point when mode is EmitterMode.Loop or EmitterMode.PingPong. * {@link EmitterMode} */ speed?: ValueGenerator | FunctionValueGenerator; } export type SphereParameters = { radius: number; }; /** * Smoothed-particle hydrodynamics system * @todo Make parameters customizable in the constructor */ class SPHSystem { /** * The particles array. */ particles: Body_2[]; /** * Density of the system (kg/m3). * @default 1 */ density: number; /** * Distance below which two particles are considered to be neighbors. * It should be adjusted so there are about 15-20 neighbor particles within this radius. * @default 1 */ smoothingRadius: number; /** * @default 1 */ speedOfSound: number; /** * Viscosity of the system. * @default 0.01 */ viscosity: number; /** * @default 0.000001 */ eps: number; pressures: number[]; densities: number[]; neighbors: Body_2[][]; constructor(); /** * Add a particle to the system. */ add(particle: Body_2): void; /** * Remove a particle from the system. */ remove(particle: Body_2): void; /** * Get neighbors within smoothing volume, save in the array neighbors */ getNeighbors(particle: Body_2, neighbors: Body_2[]): void; update(): void; w(r: number): number; gradw(rVec: Vec3, resultVec: Vec3): void; nablaw(r: number): number; } export class SphubeGeometry extends ParametricGeometry { constructor(slices?: number, stacks?: number); } function split(path: Path, count: number): any[]; /** * Splits the equations into islands and solves them independently. Can improve performance. */ class SplitSolver extends Solver { /** * The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations. */ iterations: number; /** * When tolerance is reached, the system is assumed to be converged. */ tolerance: number; /** subsolver */ subsolver: GSSolver; nodes: SplitSolverNode[]; nodePool: SplitSolverNode[]; constructor(subsolver: GSSolver); /** * createNode */ createNode(): SplitSolverNode; /** * Solve the subsystems * @return number of iterations performed */ solve(dt: number, world: World): number; } type SplitSolverNode = { body: Body_2 | null; children: SplitSolverNode[]; eqs: Equation[]; visited: boolean; }; enum SplitStrategy { } /** * A spring, connecting two bodies. * @example * const spring = new Spring(boxBody, sphereBody, { * restLength: 0, * stiffness: 50, * damping: 1, * }) * * // Compute the force after each step * world.addEventListener('postStep', (event) => { * spring.applyForce() * }) */ class Spring { /** * Rest length of the spring. A number > 0. * @default 1 */ restLength: number; /** * Stiffness of the spring. A number >= 0. * @default 100 */ stiffness: number; /** * Damping of the spring. A number >= 0. * @default 1 */ damping: number; /** * First connected body. */ bodyA: Body_2; /** * Second connected body. */ bodyB: Body_2; /** * Anchor for bodyA in local bodyA coordinates. * Where to hook the spring to body A, in local body coordinates. * @default new Vec3() */ localAnchorA: Vec3; /** * Anchor for bodyB in local bodyB coordinates. * Where to hook the spring to body B, in local body coordinates. * @default new Vec3() */ localAnchorB: Vec3; constructor(bodyA: Body_2, bodyB: Body_2, options?: { /** * Rest length of the spring. A number > 0. * @default 1 */ restLength?: number; /** * Stiffness of the spring. A number >= 0. * @default 100 */ stiffness?: number; /** * Damping of the spring. A number >= 0. * @default 1 */ damping?: number; /** * Anchor for bodyA in local bodyA coordinates. * Where to hook the spring to body A, in local body coordinates. * @default new Vec3() */ localAnchorA?: Vec3; /** * Anchor for bodyB in local bodyB coordinates. * Where to hook the spring to body B, in local body coordinates. * @default new Vec3() */ localAnchorB?: Vec3; /** * Where to hook the spring to body A, in world coordinates. */ worldAnchorA?: Vec3; /** * Where to hook the spring to body B, in world coordinates. */ worldAnchorB?: Vec3; }); /** * Set the anchor point on body A, using world coordinates. */ setWorldAnchorA(worldAnchorA: Vec3): void; /** * Set the anchor point on body B, using world coordinates. */ setWorldAnchorB(worldAnchorB: Vec3): void; /** * Get the anchor point on body A, in world coordinates. * @param result The vector to store the result in. */ getWorldAnchorA(result: Vec3): void; /** * Get the anchor point on body B, in world coordinates. * @param result The vector to store the result in. */ getWorldAnchorB(result: Vec3): void; /** * Apply the spring force to the connected bodies. */ applyForce(): void; } type SpringOptions = ConstructorParameters[2]; /** * 精灵动画实体 */ export class SpriteAnimatorEntity extends Entity { constructor(options: SpriteAnimatorEntityOptions); /** * 获取精灵动画对象 */ readonly spriteAnimator: SpriteAnimatorType; /** * 暂停动画 */ pauseAnimation: () => void; /** * 运行动画 */ playAnimation: () => void; /** * 设置动画帧名称 */ setFrameName: (name: string) => void; } export type SpriteAnimatorEntityOptions = EntityOptions & SpriteAnimatorProps; /** * 精灵动画模块 */ export class SpriteAnimatorModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; isLoaded?: boolean; constructor(entity: Entity, options?: SpriteAnimatorProps); setupUiConfig(): UiObjectConfig; get spriteAnimator(): SpriteAnimatorType; onAppUpdate(time: Time): void; pauseAnimation(): void; playAnimation(): void; setFrameName(name: string): void; } export type SpriteAnimatorProps = { startFrame?: number; endFrame?: number; fps?: number; frameName?: string; textureDataURL?: string; textureImageURL: string; loop?: boolean; numberOfFrames?: number; autoPlay?: boolean; animationNames?: Array; onStart?: Function; onEnd?: Function; onLoopEnd?: Function; onFrame?: Function; play?: boolean; pause?: boolean; flipX?: boolean; position?: Array; alphaTest?: number; asSprite?: boolean; }; export type SpriteAnimatorType = { group: Group_2; init: Function; update: Function; pauseAnimation: Function; playAnimation: Function; setFrameName: Function; }; /** * A VFX batch that render sprites in a batch. */ export class SpriteBatch extends VFXBatch { geometry: InstancedBufferGeometry; private offsetBuffer; private rotationBuffer; private sizeBuffer; private colorBuffer; private uvTileBuffer; private velocityBuffer?; constructor(settings: VFXBatchSettings); buildExpandableBuffers(): void; setupBuffers(): void; expandBuffers(target: number): void; rebuildMaterial(): void; vector_: Vector3; vector2_: Vector3; vector3_: Vector3; quaternion_: Quaternion; quaternion2_: Quaternion; quaternion3_: Quaternion; rotationMat_: Matrix3; rotationMat2_: Matrix3; update(): void; dispose(): void; } export interface SpriteImageItem extends SpriteImageItemData { material: SpriteMaterial; highlightMaterial?: SpriteMaterial; object: SpriteMarker; } /** * 精灵图标某项数据 */ export interface SpriteImageItemData { /** 位置 */ position: Vector3 | [number, number, number]; /** 图标 */ icon: string | ImageLike; /** 高亮时的图标 */ highlightIcon?: string | ImageLike; /** 高亮时的透明度 */ highlightOpacity?: number; /** x对齐方式 */ anchorX?: number | 'left' | 'center' | 'right'; /** y对齐方式 */ anchorY?: number | 'top' | 'center' | 'bottom'; /** x偏移 */ offsetX?: number; /** y偏移 */ offsetY?: number; /** 旋转角度(0-360) */ rotation?: number; /** 宽(sizeAttenuation为false是图标像素大小,否则表示世界坐标宽度) */ width?: number; /** 高(sizeAttenuation为false是图标像素大小,否则表示世界坐标制图高) */ height?: number; /** 碰撞检测时的zindex,值越大,越往上 */ collideZIndex?: number; /** 同一个id会一起显示和隐藏 */ collideId?: string; } /** * 精灵图标对象 */ export class SpriteImages extends Group_2 { #private; app: App; data: SpriteImageItem[]; constructor(options: SpriteImagesOptions, app: App); getOptions(): SpriteImagesOptions; update(): void; getData(): SpriteImageItem[]; setItemHighlight(index: number, isHighlight?: boolean): void; setData(data: SpriteImageItemData[]): Promise; dispose(): void; } /** * 精灵图像实体 */ export class SpriteImagesEntity extends Entity { constructor(options: SpriteImagesEntityOptions); /** * 获取精灵图像对象 */ readonly SpriteImages: SpriteImages; /** * 获取选顶数据 */ getOptions(): SpriteImagesOptions; /** * 更新 */ update(): void; /** * 获取数据 */ getData(): SpriteImageItem[]; /** * 设置某项高亮 */ setItemHighlight(index: number, isHighlight?: boolean): void; /** * 设置数据 */ setData(data: SpriteImageItemData[]): Promise; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type SpriteImagesEntityOptions = EntityOptions & SpriteImagesOptions; /** * 精灵图标模块 */ export class SpriteImagesModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; isLoaded?: boolean; constructor(entity: Entity, options?: SpriteImagesOptions); get SpriteImages(): SpriteImages; } /** * 精灵图标选顶 */ export interface SpriteImagesOptions { /** 数据 */ data: SpriteImageItemData[]; /** 是否使用大小衰减(根据相机远近自动调整点的大小) false的话,表示用像素大小,true表示世界坐标 */ sizeAttenuation?: boolean; /** 材质参数 */ materialParameters?: SpriteMaterialParameters; /** 更新材质节流时间毫秒,默认20 */ refreshRenderThrottleTimeout?: number; /** 透明度随相机距离大小 */ fadeDistance?: number; /** 是否允许重叠 */ allowOverlap?: boolean; /** 碰撞监测组名 会对同一个组名内的进行碰撞检测 */ collideGroupName?: string; /** 自动尺寸时,获取矩形大小时,额外扩展的范围 (左上,,左下y, 右x,右下y) */ expandRect?: number | [number, number, number, number]; } /** * 精灵标记对象 */ export class SpriteMarker extends Sprite { #private; options: SpriteMarkerOptions; width: number; height: number; app: App; constructor(options: SpriteMarkerOptions, app?: App); setMaterial(material: SpriteMaterial): void; updateRenderTexture(cb: (context: { group: render2d.Group; render: render2d.Render2dType; canvas: HTMLCanvasElement; }) => boolean): void; refreshRenderTexture(): void; dispatchRenderTextureEvent(eventName: "mousemove" | "mouseout" | "click" | "mousedown" | "mouseup" | "mousewheel" | "dblclick" | "contextmenu", x?: number | Vector2, y?: number): void; setAllowOverlap(allowOverlap: boolean): void; updateScale(): void; updateAnchor(): void; getBoundingRect(): { x1: number; y1: number; x2: any; y2: any; cx: number; cy: number; rotation: number; position: Vector3; zIndex: number; id: string; groupName: string; setVisible: (visible: any) => any; }; dispose(): void; } /** * 精灵标记实体 */ export class SpriteMarkerEntity extends Entity { constructor(options: SpriteMarkerEntityOptions); /** * 获取精灵标记对象 */ readonly SpriteMarker: SpriteMarker; /** * 设置材质 */ setMaterial(material: SpriteMaterial): void; /** *更新渲染材质 */ updateRenderTexture(cb: (context: { group: render2d.Group; render: render2d.Render2dType; canvas: HTMLCanvasElement; }) => boolean): void; /** *刷新渲染材质 */ refreshRenderTexture(): void; /** * 给渲染材质触发相应事件 */ dispatchRenderTextureEvent(eventName: "mousemove" | "mouseout" | "click" | "mousedown" | "mouseup" | "mousewheel" | "dblclick" | "contextmenu", x?: number | Vector2, y?: number): void; /** * 设置是否允许重叠 */ setAllowOverlap(allowOverlap: boolean): void; /** * 更新缩放尺寸 */ updateScale(): void; /** * 更新对齐 */ updateAnchor(): void; /** * 获取矩形范围 */ getBoundingRect(): { x1: number; y1: number; x2: any; y2: any; cx: number; cy: number; rotation: number; position: Vector3; zIndex: number; id: string; groupName: string; setVisible: (visible: any) => any; }; } export type SpriteMarkerEntityOptions = EntityOptions & SpriteMarkerOptions; /** * 精灵标记模块 */ export class SpriteMarkerModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; isLoaded?: boolean; constructor(entity: Entity, options?: SpriteMarkerOptions); get SpriteMarker(): SpriteMarker; setupUiConfig(): UiObjectConfig; } export interface SpriteMarkerOptions { /** 位置 */ position: Vector3 | [number, number, number]; /** x对齐方式 */ anchorX?: number | 'left' | 'center' | 'right'; /** y对齐方式 */ anchorY?: number | 'top' | 'center' | 'bottom'; /** x偏移 */ offsetX?: number; /** y偏移 */ offsetY?: number; /** 旋转角度(0-360) */ rotation?: number; /** 材质 */ material?: SpriteMaterial; /** 材质参数 */ materialParameters?: SpriteMaterialParameters; /** 是否使用大小衰减(根据相机远近自动调整点的大小) false的话,表示用像素大小,true表示世界坐标 */ sizeAttenuation?: boolean; /** 宽(sizeAttenuation为false是像素大小,否则表示世界坐标宽度) */ width?: number; /** 高(sizeAttenuation为false是像素大小,否则表示世界坐标制图高) */ height?: number; /** 使用渲染材质 */ renderTexture?: Render2dTextureOptions; /** 直接使用材质(当此项有值时renderTexture将无效) */ texture?: Texture; /** 更新材质节流时间毫秒,默认20 */ refreshRenderThrottleTimeout?: number; /** 透明度随相机距离大小 */ fadeDistance?: number; /** 是否允许重叠 */ allowOverlap?: boolean; /** 碰撞检测时的zindex,值越大,越往上 */ collideZIndex?: number; /** 同一个id会一起显示和隐藏 */ collideId?: string; /** 碰撞监测组名 会对同一个组名内的进行碰撞检测 */ collideGroupName?: string; /** 自动尺寸时,获取矩形大小时,额外扩展的范围 (左上,,左下y, 右x,右下y) */ expandRect?: number | [number, number, number, number]; } /** * Particle implementation for sprite-based particle. */ export class SpriteParticle implements Particle { /** * Parent matrix for transformation. * @type {Matrix4} */ parentMatrix?: Matrix4; /** * Initial speed of the particle. * @type {number} */ startSpeed: number; /** * Initial color of the particle. * @type {Vector4} */ startColor: Vector4; /** * Initial size of the particle. * @type {number} */ startSize: number; /** * Position of the particle. * @type {Vector3} */ position: Vector3; /** * Velocity of the particle. * @type {Vector3} */ velocity: Vector3; /** * Age of the particle. * @type {number} */ age: number; /** * Life duration of the particle. * @type {number} */ life: number; /** * Size of the particle. * @type {number} */ size: number; /** * Speed modifier of the particle. * @type {number} */ speedModifier: number; /** * Angular velocity of the particle. * @type {number | Quaternion} */ angularVelocity?: number | Quaternion; /** * Rotation of the particle. * @type {number | Quaternion} */ rotation: number | Quaternion; /** * Color of the particle. * @type {Vector4} */ color: Vector4; /** * UV tile index. * @type {number} */ uvTile: number; /** * Indicates if the particle has died. * @type {boolean} */ get died(): boolean; } export interface SpriteTextItem extends SpriteTextItemData { material: SpriteMaterial; highlightMaterial?: SpriteMaterial; object: SpriteMarker; } /** * 精灵文本某项数据 */ export interface SpriteTextItemData { /** id */ id?: string; /** 位置 */ position: Vector3 | [number, number, number]; /** 文本 */ text: string; /** 文本样式 */ style?: TextStyleProps; /** 高亮时的文本样式 */ highlightStyle?: TextStyleProps; /** x对齐方式 */ anchorX?: number | 'left' | 'center' | 'right'; /** y对齐方式 */ anchorY?: number | 'top' | 'center' | 'bottom'; /** x偏移 */ offsetX?: number; /** y偏移 */ offsetY?: number; /** 旋转角度(0-360) */ rotation?: number; /** 宽(sizeAttenuation为false是文本像素大小,否则表示世界坐标宽度) */ width?: number; /** 高(sizeAttenuation为false是文本像素大小,否则表示世界坐标制图高) */ height?: number; /** 碰撞检测时的zindex,值越大,越往上 */ collideZIndex?: number; /** 同一个id会一起显示和隐藏 */ collideId?: string; /** 是否根据绘制的内容计算渲染的大小 默认true */ autoCanvasSize?: boolean; /** 是否为了提高效率共享一个canvas 默认true */ sharedCanvas?: boolean; } /** * 精灵文本对象 */ export class SpriteTexts extends Group_2 { #private; app: App; data: SpriteTextItem[]; constructor(options: SpriteTextsOptions, app: App); getOptions(): SpriteTextsOptions; update(): void; getData(): SpriteTextItem[]; setItemHighlight(index: number, isHighlight?: boolean): void; setData(data: SpriteTextItemData[]): Promise; dispose(): void; } /** * 精灵文本实体 */ export class SpriteTextsEntity extends Entity { constructor(options: SpriteTextsEntityOptions); /** * 获取精灵文本对象 */ readonly SpriteTexts: SpriteTexts; /** * 获取选顶数据 */ getOptions(): SpriteTextsOptions; /** * 更新 */ update(): void; /** * 获取数据 */ getData(): SpriteTextItem[]; /** * 设置某项高亮 */ setItemHighlight(index: number, isHighlight?: boolean): void; /** * 设置数据 */ setData(data: SpriteTextItemData[]): Promise; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type SpriteTextsEntityOptions = EntityOptions & SpriteTextsOptions; /** * 精灵文本模块 */ export class SpriteTextsModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; isLoaded?: boolean; constructor(entity: Entity, options?: SpriteTextsOptions); get SpriteTexts(): SpriteTexts; } /** * 精灵文本选顶 */ export interface SpriteTextsOptions { /** * 数据 */ data: SpriteTextItemData[]; /** * 是否使用大小衰减(根据相机远近自动调整点的大小) false的话,表示用像素大小,true表示世界坐标 */ sizeAttenuation?: boolean; /** 材质参数 */ materialParameters?: SpriteMaterialParameters; /** 更新材质节流时间毫秒,默认20 */ refreshRenderThrottleTimeout?: number; /** 透明度随相机距离大小 */ fadeDistance?: number; /** 是否允许重叠 */ allowOverlap?: boolean; /** 碰撞监测组名 会对同一个组名内的进行碰撞检测 */ collideGroupName?: string; /** 自动尺寸时,获取矩形大小时,额外扩展的范围 (左上,,左下y, 右x,右下y) */ expandRect?: number | [number, number, number, number]; } /** * Converts a single color channel from the sRGB color space to linear. * @param c - The color channel to be converted. * @category Color */ export function SRGBToLinear(c: number): number; interface Stage { update?: () => void; } class Star extends Path { shape: StarShape; constructor(opts?: StarProps); getDefaultShape(): StarShape; buildPath(ctx: CanvasRenderingContext2D, shape: StarShape): void; } interface StarProps extends PathProps { shape?: Partial; } class StarShape { cx: number; cy: number; n: number; r0: number; r: number; } /** @public */ export abstract class StateNode { editor: App; private _current; private _isActive; app: App; parent: StateNode; constructor(editor: App, parent?: StateNode); static id: string; static initial?: string; static children?: () => TLStateNodeConstructor[]; id: string; type: TLStateNodeType; initial?: string; children?: Record; /** * This node's path of active state nodes * * @public */ getPath(): string; /** * This node's current active child node, if any. * * @public */ getCurrent(): any; /** * Whether this node is active. * * @public */ getIsActive(): boolean; setIsActive(b: boolean): void; /** * Transition to a new active child state node. * * @example * ```ts * parentState.transition('childStateA') * parentState.transition('childStateB', { myData: 4 }) *``` * * @param id - The id of the child state node to transition to. * @param info - Any data to pass to the `onEnter` and `onExit` handlers. * * @public */ transition: (id: string, info?: { [key: string]: any; name?: string; event?: InteractiveEvent; object?: InteractiveObject; }) => this; handleEvent: (info: { name: string; event: InteractiveEvent; object: InteractiveObject; }) => void; enter: (info: TLEventType, from: string) => void; exit: (info: TLEventType, from: string) => void; /** * This is a hack / escape hatch that will tell the editor to * report a different state as active (in `getCurrentToolId()`) when * this state is active. This is usually used when a tool transitions * to a child of a different state for a certain interaction and then * returns to the original tool when that interaction completes; and * where we would want to show the original tool as active in the UI. * * @public */ _currentToolIdMask: Ref; getCurrentToolIdMask(): string; setCurrentToolIdMask(id: string | undefined): void; onMouseUp?: (info: TLEventHandler) => void; onMouseDown?: (info: TLEventHandler) => void; onMouseClick?: (info: TLEventHandler) => void; onMouseDblClick?: (info: TLEventHandler) => void; onMouseMove?: (info: TLEventHandler) => void; onPointerDown?: (info: TLEventHandler) => void; onPointerMove?: (info: TLEventHandler) => void; onPointerUp?: (info: TLEventHandler) => void; onPointerDownUp?: (info: TLEventHandler) => void; onPointerCancel?: (info: TLEventHandler) => void; onContextMenu?: (info: TLEventHandler) => void; onMouseOut?: (info: TLEventHandler) => void; onMouseOver?: (info: TLEventHandler) => void; onMouseLeave?: (info: TLEventHandler) => void; onMouseEnter?: (info: TLEventHandler) => void; onMouseWheel?: (info: TLEventHandler) => void; onKeyDown?: (info: TLEventHandler) => void; onKeyUp?: (info: TLEventHandler) => void; onEnter?: TLEnterEventHandler; onExit?: TLExitEventHandler; } class StaticGeometryGenerator { useGroups: boolean; attributes: Array; applyWorldTransforms: boolean; constructor(objects: Array | Object3D); getMaterials(): Array; generate(target?: BufferGeometry): BufferGeometry; } export class StatModule extends AppModuleBase implements IAppModuleBase { static moduleName: string; private _stats; options: StatModuleOptions; constructor(app?: App, options?: StatModuleOptions); get showStat(): any; set showStat(show: any); onAwake(): void; onAppBeforeUpdate(): void; onAppAfterRender(): void; setupUiConfig(): UiObjectConfig; } export interface StatModuleOptions { show?: boolean; id?: string; left?: string; right?: string; top?: string; bottom?: string; panelIndex?: number; } /** * Stops the effect associated with the given runner. * * @param runner - Association with the effect to stop tracking. */ function stop_2(runner: ReactiveEffectRunner): void; class Storage_2 { private _roots; private _displayList; private _displayListLen; traverse(cb: (this: T, el: Element_2) => void, context?: T): void; /** * get a list of elements to be rendered * * @param {boolean} update whether to update elements before return * @param {DisplayParams} params options * @return {Displayable[]} a list of elements */ getDisplayList(update?: boolean, includeIgnore?: boolean): Displayable[]; /** * 更新图形的绘制队列。 * 每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中, * 最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列 */ updateDisplayList(includeIgnore?: boolean): void; private _updateAndAddDisplayable; /** * 添加图形(Displayable)或者组(Group)到根节点 */ addRoot(el: Element_2): void; /** * 删除指定的图形(Displayable)或者组(Group) * @param el */ delRoot(el: Element_2 | Element_2[]): void; delAllRoots(): void; getRoots(): Element_2[]; /** * 清空并且释放Storage */ dispose(): void; displayableSortFunc: typeof shapeCompareFunc; } /** * 全局变量类 */ export class Store { /** 全局应用类,会把最后加的app设置为全局app */ static app: App; /** 全局服务类 */ static service: Service; /** 全局用户数据 */ static useData: Record; } export interface StoredBatchSettings { instancingGeometry: BufferGeometry; material: Material; uTileCount: number; vTileCount: number; blendTiles: boolean; softParticles: boolean; softNearFade: number; softFarFade: number; renderMode: RenderMode; renderOrder: number; layers: Layers; } export interface StretchedBillBoardSettings { /** * how stretched the particle is in the direction of the camera based on the speed of the particle. * @type {number} */ speedFactor: number; /** * how stretched the particle is in the direction of the camera based on the size of the particle. * @type {number} */ lengthFactor: number; } /** * @param arrColor like [12,33,44,0.4] * @param type 'rgba', 'hsva', ... * @return Result color. (If input illegal, return undefined). */ function stringify(arrColor: number[], type: string): string; /** * Extract keys from object that are strings */ export type StringKeyOf = Extract; /** * 获取字符串的Md5值 * @param str * @return {string} */ export function strMd5(str: string): string; /** * 向量相减 */ function sub(out: T, v1: VectorArray, v2: VectorArray): T; export enum SubParticleEmitMode { Death = 0, Birth = 1, Frame = 2 } const SUBTRACTION: CSGOperation; /** * Behavior that always succeeds */ export class SucceedingBehavior extends Behavior { delayTicks: number; constructor(delayTicks?: number); tick(timeDelta: number): BehaviorStatus.Running | BehaviorStatus.Succeeded; static INSTANCE: SucceedingBehavior; } type SVGNodeTagLower = 'g' | 'rect' | 'circle' | 'line' | 'ellipse' | 'polygon' | 'polyline' | 'image' | 'text' | 'tspan' | 'path' | 'defs' | 'switch'; interface SVGParserOption { width?: number; height?: number; ignoreViewBox?: boolean; ignoreRootClip?: boolean; } interface SVGParserResult { root: Group; width: number; height: number; viewBoxRect: RectLike; viewBoxTransform: { x: number; y: number; scale: number; }; named: SVGParserResultNamedItem[]; } interface SVGParserResultNamedItem { name: string; namedFrom: SVGParserResultNamedItem; svgNodeTagLower: SVGNodeTagLower; el: Element_2; } class SVGPath extends Path { applyTransform(m: MatrixArray): void; } type SVGPathOption = Omit; interface SVGPatternObject extends PatternObjectBase { /** * svg vnode can only be used in svg renderer currently. * svgWidth, svgHeight defines width and height used for pattern. */ svgElement?: SVGVNode; svgWidth?: number; svgHeight?: number; } /** * Renders an SVG to a canvas. * @param svgDataUrl - data url of the svg. Can be created with {@link svgUrl} * @param options - options * * @category SVGs */ export const svgToCanvas: (svgDataUrl: string, options: ImageCanvasOptions) => Promise; /** * Renders an SVG to a png data url. * @param svgDataUrl - data url of the svg. Can be created with {@link svgUrl} * @param options - options * * @category SVGs */ export const svgToPng: (svgDataUrl: string, options: ImageCanvasOptions) => Promise; /** * Converts an SVG string to data url. This is useful for creating images from SVGs, or using SVGs in CSS. * To use put in template string: `url(${svgUrl\`...\`})` * @param strings - template strings * @param rest - template values * * @example * ```ts * const url = svgUrl\` * ... * \` * console.log(url) // data:image/svg+xml;charset=UTF-8,... * ``` * * @category Template Literals */ export const svgUrl: (strings: any, ...rest: any[]) => string; interface SVGVNode { tag: string; attrs: SVGVNodeAttrs; children?: SVGVNode[]; text?: string; elm?: Node; key: string; } type SVGVNodeAttrs = Record; /** * 符号实体 */ export class SymbolEntity extends Entity { constructor(options: SymbolEntityOptions); /** * 获取符号对象 */ readonly symbolObject: Points; /** * 更新样式 */ updateStyle: (style: SymbolMaterialProps) => void; /** * 获取数据 */ getData: () => SymbolItemData[]; /** * 设置数据 */ setData: (data: SymbolItemData[]) => void; /** * 通过pointIndex获取 * @param pointIndex 点索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByPointIndex: (pointIndex: number, isRefData?: boolean) => SymbolItemData; /** * 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件 */ isFireEventsByIntersect(closestObject: InteractiveObject, newClosestObject: InteractiveObject): boolean; } export type SymbolEntityOptions = EntityOptions & SymbolModuleOption; export interface SymbolItemData { /** id */ id?: string; /** 位置 */ position: [number, number, number]; /** 顶点颜色 */ color?: ColorRepresentation; /** 顶点边框颜色 */ borderColor?: ColorRepresentation; /** 点大小 */ size?: number; /** 高亮顶点颜色, 有高亮颜色时优先用高亮颜色 */ highlightColor?: ColorRepresentation; /** 高亮顶点边框颜色, 有高亮颜色边框颜色时优化用高亮颜色 */ highlightBorderColor?: ColorRepresentation; /** 高亮点大小, 有高亮大小时优化用高亮颜色 */ highlightSize?: number; /** 是否禁止编辑 */ disableEdit?: boolean; /** 是否隐藏 */ hidden?: boolean; } export interface SymbolMaterialProps extends PointsMaterialParameters { /** 边框宽 */ borderWidth?: number; /** 边框颜色 */ borderColor?: ColorRepresentation; /** 透明度随相机距离大小 */ fadeDistance?: number; /** 默认正方形 */ shape?: "square" | "circle" | "triangle"; /** 使用顶点大小 */ vertexSize?: boolean; /** 使用顶点边框颜色 */ vertexBorderColor?: boolean; } /** * 符号symbol模块,用来绘制批量符号点 */ export class SymbolModule extends EntityModuleBase implements IEntityModuleBase { #private; static moduleName: string; symbol: Points; material: PointsMaterial; geometry: BufferGeometry; _symbolData: SymbolItemData[]; style: SymbolMaterialProps; useBvh: boolean; constructor(entity: Entity, options?: SymbolModuleOption); get symbolObject(): Points, Material | Material[], Object3DEventMap>; getData(): SymbolItemData[]; setData(data?: SymbolItemData[]): void; updateStyle(style: SymbolMaterialProps): void; /** * 通过pointIndex获取 * @param pointIndex 点索引 * @param isRefData 返回的是否是数据引用的对象,默认false,将克隆新的数据 */ getItemDataByPointIndex(pointIndex: number, isRefData?: boolean): SymbolItemData; } export interface SymbolModuleOption { /** 符号数据 */ data: SymbolItemData[]; /** 样式 */ style?: SymbolMaterialProps; /** 像素大小拾取 */ pixelRaycasting?: boolean; /** 是否使用bvh射线查询。默认是 */ useBvh?: boolean; } export const tea: { utf8Encode: (str: any) => any; utf8Decode: (bs: any, n: any) => any; encrypt: (data: any, key: any) => any; encryptToBase64: (data: any, key: any) => any; encryptToBase64Url: (data: any, key: any) => any; decrypt: (data: any, key: any) => any; decryptFromBase64: (data: any, key: any) => any; decryptFromBase64Url: (data: any, key: any) => any; }; export function texImageToCanvas(image: TexImageSource, maxWidth: number, flipY?: boolean): HTMLCanvasElement; type TextAlign = 'left' | 'center' | 'right'; export interface TextFlowMaterialOptions extends TextStyleProps { geometryWidth: number; geometryHeight: number; flowDirection?: "horizon" | "vertical"; flowSpeed?: number; } interface TextPositionCalculationResult { x: number; y: number; align: TextAlign; verticalAlign: TextVerticalAlign; } export type TextProps = { text: string; characters?: string; color?: number | string; fontSize?: number; maxWidth?: number; lineHeight?: number; letterSpacing?: number; textAlign?: 'left' | 'right' | 'center' | 'justify'; font?: string; anchorX?: number | 'left' | 'center' | 'right'; anchorY?: number | 'top' | 'top-baseline' | 'middle' | 'bottom-baseline' | 'bottom'; clipRect?: [number, number, number, number]; depthOffset?: number; direction?: 'auto' | 'ltr' | 'rtl'; overflowWrap?: 'normal' | 'break-word'; whiteSpace?: 'normal' | 'overflowWrap' | 'nowrap'; outlineWidth?: number | string; outlineOffsetX?: number | string; outlineOffsetY?: number | string; outlineBlur?: number | string; outlineColor?: number | string; outlineOpacity?: number; strokeWidth?: number | string; strokeColor?: number | string; strokeOpacity?: number; fillOpacity?: number; sdfGlyphSize?: number; debugSDF?: boolean; onSync?: (troika: any) => void; onPreloadEnd?: () => void; }; interface TextProps_2 extends DisplayableProps { style?: TextStyleProps; zlevel?: number; z?: number; z2?: number; culling?: boolean; cursor?: string; } type TextState = Pick & ElementCommonState; interface TextStyleProps extends TextStylePropsPart { text?: string; x?: number; y?: number; /** * Only support number in the top block. */ width?: number; /** * Text styles for rich text. */ rich?: Dictionary; /** * Strategy when calculated text width exceeds textWidth. * break: break by word * break: will break inside the word * truncate: truncate the text and show ellipsis * Do nothing if not set */ overflow?: 'break' | 'breakAll' | 'truncate' | 'none'; /** * Strategy when text lines exceeds textHeight. * Do nothing if not set */ lineOverflow?: 'truncate'; /** * Epllipsis used if text is truncated */ ellipsis?: string; /** * Placeholder used if text is truncated to empty */ placeholder?: string; /** * Min characters for truncating */ truncateMinChar?: number; } interface TextStylePropsPart { text?: string; fill?: string; stroke?: string; strokeNoScale?: boolean; opacity?: number; fillOpacity?: number; strokeOpacity?: number; /** * textStroke may be set as some color as a default * value in upper applicaion, where the default value * of lineWidth should be 0 to make sure that * user can choose to do not use text stroke. */ lineWidth?: number; lineDash?: false | number[]; lineDashOffset?: number; borderDash?: false | number[]; borderDashOffset?: number; /** * If `fontSize` or `fontFamily` exists, `font` will be reset by * `fontSize`, `fontStyle`, `fontWeight`, `fontFamily`. * So do not visit it directly in upper application (like ), * but use `contain/text#makeFont` instead. */ font?: string; /** * The same as font. Use font please. * @deprecated */ textFont?: string; /** * It helps merging respectively, rather than parsing an entire font string. */ fontStyle?: FontStyle; /** * It helps merging respectively, rather than parsing an entire font string. */ fontWeight?: FontWeight; /** * It helps merging respectively, rather than parsing an entire font string. */ fontFamily?: string; /** * It helps merging respectively, rather than parsing an entire font string. * Should be 12 but not '12px'. */ fontSize?: number | string; align?: TextAlign; verticalAlign?: TextVerticalAlign; /** * Line height. Default to be text height of '国' */ lineHeight?: number; /** * Width of text block. Not include padding * Used for background, truncate, wrap */ width?: number | string; /** * Height of text block. Not include padding * Used for background, truncate */ height?: number; /** * Reserved for special functinality, like 'hr'. */ tag?: string; textShadowColor?: string; textShadowBlur?: number; textShadowOffsetX?: number; textShadowOffsetY?: number; backgroundColor?: string | { image: ImageLike | string; }; /** * Can be `2` or `[2, 4]` or `[2, 3, 4, 5]` */ padding?: number | number[]; /** * Margin of label. Used when layouting the label. */ margin?: number; borderColor?: string; borderWidth?: number; borderRadius?: number | number[]; /** * Shadow color for background box. */ shadowColor?: string; /** * Shadow blur for background box. */ shadowBlur?: number; /** * Shadow offset x for background box. */ shadowOffsetX?: number; /** * Shadow offset y for background box. */ shadowOffsetY?: number; } export type TextType = { mesh: Mesh; updateProps: (newProps: Partial) => void; dispose: () => void; }; export function textureDataToImageData(imgData: TextureImageData | ImageData | { data: Float32Array | Uint16Array | Uint8Array; width: number; height: number; }, colorSpace?: ColorSpace, outData?: ImageData): ImageData; export class TextureSequencer implements Sequencer { scaleX: number; scaleY: number; position: Vector3; locations: Vector2[]; constructor(scaleX?: number, scaleY?: number, position?: Vector3); transform(position: Vector3, index: number): void; static fromJSON(json: any): Sequencer; clone(): Sequencer; toJSON(): any; fromImage(img: CanvasImageSource, threshold: number): void; } /** * * @param texture * @param maxWidth * @param flipY * @param canvas */ export function textureToCanvas(texture: Texture | DataTexture, maxWidth: number, flipY?: boolean): HTMLCanvasElement; export function textureToDataUrl(texture: Texture | DataTexture, maxWidth: number, flipY: boolean, mimeType?: string, quality?: number): string; /** * Utils for texture creation and manipulation. */ export class TextureUtils { /** * Create a new texture filled with a CSS style. * * Can be color, gradient or pattern. Supports all options supported in the fillStyle of the canvas API. * * @param color - Style to apply to the texture surface. * @param width - Width of the canvas in pixels. * @param height - Height of the canvas in pixels. */ static createFillTexture(color?: (string | CanvasGradient | CanvasPattern), width?: number, height?: number): Texture; } type TextVerticalAlign = 'top' | 'middle' | 'bottom'; /** * Given a THREE.Object3D instance, creates a corresponding CANNON shape. */ export const threeToCannon: (object: Object3D, options?: ShapeOptions) => ShapeResult | null; interface Throttle { (fn: (...args: Args) => Result, timeout?: number, edge?: "leading" | "both"): (...args: Args) => Result; (fn: (...args: Args) => Result, timeout?: number, edge?: "trailing"): (...args: Args) => Result | undefined; (fn: (...args: Args) => Result, timeout?: number, edge?: "trailingPromise"): (...args: Args) => Promise; } export const throttle: Throttle; /** * Documented 3d-tile state managed by the TilesRenderer* / used/usable in priority / traverseFunctions! */ interface Tile extends TileBase { parent: Tile; /** * Hierarchy Depth from the TileGroup */ __depth: number; /** * The screen space error for this tile */ __error: number; /** * How far is this tiles bounds from the nearest active Camera. * Expected to be filled in during calculateError implementations. */ __distanceFromCamera: number; /** * This tile is currently active if: * 1: Tile content is loaded and ready to be made visible if needed */ __active: boolean; /** * This tile is currently visible if: * 1: Tile content is loaded * 2: Tile is within a camera frustum * 3: Tile meets the SSE requirements */ __visible: boolean; /** * Whether or not the tile was visited during the last update run. */ __used: boolean; /** * Whether or not the tile was within the frustum on the last update run. */ __inFrustum: boolean; /** * TODO: Document this if it is useful enough to be the default property in the LRU sorting. */ __depthFromRenderedParent: number; } /** * 3d-tiles Tile object per spec: * (incomplete, expanding as features become supported by this package.) * * See spec for full schema: https://github.com/CesiumGS/3d-tiles/blob/master/specification/schema/tile.schema.json */ interface TileBase { boundingVolume: { /** * An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z * values for the center of the box. The next three elements (with indices 3, 4, and 5) define the x axis * direction and half-length. The next three elements (indices 6, 7, and 8) define the y axis direction and * half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length. */ box?: number[]; /** * An array of four numbers that define a bounding sphere. The first three elements define the x, y, and z * values for the center of the sphere. The last element (with index 3) defines the radius in meters. */ sphere?: number[]; }; /** * The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */ geometricError: number; children?: TileBase[]; content?: { uri: string; /** * Dictionary object with content specific extension objects. */ extensions?: Record; extras?: Record; url?: string; }; /** * Dictionary object with tile specific extension objects. */ extensions?: Record; extras?: Record; refine?: 'REPLACE' | 'ADD'; transform?: number[]; } namespace Tiles3dPluginType { export { get3dTilesLngLatHeight, TileBase, Tile, Tileset, TilesRendererBase, TilesGroup, TilesRenderer } } export { Tiles3dPluginType } /** * A 3d-tiles tileset. * * Schema, see: https://github.com/CesiumGS/3d-tiles/blob/main/specification/schema/tileset.schema.json */ interface Tileset { /** * Metadata about the entire tileset. */ asset: { /** * 3d-tiles version */ version: string; /** * Application specific version */ tilesetVersion?: string; /** * Dictionary object with extension-specific objects. */ extensions?: Record; }; /** * The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */ geometricError: Number; /** * The root tile. */ root: TileBase; /** * Names of 3D Tiles extensions used somewhere in this tileset. */ extensionsUsed?: string[]; /** * Names of 3D Tiles extensions required to properly load this tileset. */ extensionsRequired?: string[]; /** * A dictionary object of metadata about per-feature properties. */ properties?: Record; /** * Dictionary object with extension-specific objects. */ extensions?: Record; extras?: Record; } class TilesGroup extends Group_2 { tilesRenderer: TilesRenderer; constructor(tilesRenderer: TilesRenderer); } class TilesRenderer extends TilesRendererBase { constructor(url: String, options?: { clearRootTransform?: boolean; }); autoDisableRendererCulling: Boolean; optimizeRaycast: Boolean; manager: LoadingManager; group: TilesGroup; getBoundingBox(box: Box3): Boolean; getOrientedBoundingBox(box: Box3, matrix: Matrix4): Boolean; getBoundingSphere(sphere: Sphere): Boolean; hasCamera(camera: Camera): Boolean; setCamera(camera: Camera): Boolean; deleteCamera(camera: Camera): Boolean; setResolution(camera: Camera, x: Number, y: Number): Boolean; setResolution(camera: Camera, resolution: Vector2): Boolean; setResolutionFromRenderer(camera: Camera, renderer: WebGLRenderer): Boolean; forEachLoadedModel(callback: (scene: Object3D, tile: Tile) => void): void; onLoadTileSet: ((tileSet: Tileset) => void) | null; onLoadModel: ((scene: Object3D, tile: Tile) => void) | null; onDisposeModel: ((scene: Object3D, tile: Tile) => void) | null; onTileVisibilityChange: ((scene: Object3D, tile: Tile, visible: boolean) => void) | null; addEventListener(type: String, cb: (e: Object) => void): any; hasEventListener(type: String, cb: (e: Object) => void): any; removeEventListener(type: String, cb: (e: Object) => void): any; dispatchEvent(e: Object): any; } class TilesRendererBase { readonly rootTileset: Object | null; readonly root: Object | null; errorTarget: Number; errorThreshold: Number; loadSiblings: Boolean; displayActiveTiles: Boolean; maxDepth: Number; stopAtEmptyTiles: Boolean; fetchOptions: any; /** function to preprocess the url for each individual tile */ preprocessURL: ((uri: string | URL) => string) | null; lruCache: any; parseQueue: any; downloadQueue: any; constructor(url: String); update(): void; traverse(beforeCb: ((tile: Object, parent: Object, depth: Number) => Boolean) | null, afterCb: ((tile: Object, parent: Object, depth: Number) => Boolean) | null): void; dispose(): void; resetFailedTiles(): void; } /** * 时间相关. */ export class Time { private _frameCount; private _deltaTime; private _actualDeltaTime; private _elapsedTime; private _actualElapsedTime; private _lastSystemTime; /** 每帧允许的最大增量时间(秒). */ maximumDeltaTime: number; /** 时间尺寸比例. */ timeScale: number; get frameCount(): number; /** * 从上一帧到当前帧的增量时间(秒). * * @remarks 当帧速率较低或出现卡顿时, deltaTime 不会超过 maximumDeltaTime * timeScale 的值。 */ get deltaTime(): number; /** * 经过的时间(以秒为单位). */ get elapsedTime(): number; /** * 从上一帧到当前帧的实际增量时间(秒). * * @remarks 实际增量时间不受 maximumDeltaTime * timeScale 的影响 */ get actualDeltaTime(): number; /** * 实际经过的时间(以秒为单位). */ get actualElapsedTime(): number; /** * 构造函数. */ constructor(); } /** * Returns a promise that resolves after the given duration. Basically a setTimeout that returns a promise. * @param duration - in ms * * @category Time */ export function timeout(duration: number): Promise; export type TLEnterEventHandler = (info: TLEventType, from: string) => void; export interface TLEventHandler { name?: string; event?: InteractiveEvent; object?: InteractiveObject; } export interface TLEventType extends TLEventHandler { /** 交互结束时调用哪个工具栏 */ onInteractionEnd?: string; /** 交互结束时调用哪个工具栏的上下文参数 */ onInteractionEndContext?: Record; /** 进入时回调 */ onEnterCallBack?: (node: StateNode, context: any, from: string) => void; /** 退出时回调 */ onExitCallBack?: (node: StateNode, context: any) => void; [key: string]: any; } /** @public */ export type TLExitEventHandler = (info: TLEventType, to: string) => void; /** @public */ export interface TLStateNodeConstructor { new (editor: App, parent?: StateNode): StateNode; id: string; initial?: string; children?: () => TLStateNodeConstructor[]; } type TLStateNodeType = 'branch' | 'leaf' | 'root'; /** * Modifies the supplied geometry if it is non-indexed, otherwise creates a new, non-indexed geometry. Returns the * geometry with smooth normals everywhere except faces that meet at an angle greater than the crease angle. * * @param geometry The input geometry. * @param creaseAngle The crease angle in radians. */ function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry; /** * 几何坐标距离长度转世界坐标距离长度. * @param dist 距离值 * @param isMap2dHeightMeter 是否以米为单位,默认false以地图单位 * @param app 应用 * @param mapView */ export function toDist(dist: number, isMap2dHeightMeter?: boolean, app?: App, mapView?: MapViewEntity): number; function toHex(color: string): string; export class ToolStateModule extends AppModuleBase implements IAppModuleBase { static moduleName: string; _rootState: StateNode; options: ToolStateModuleOptions; constructor(app?: App, options?: ToolStateModuleOptions); onAwake(): void; get rootState(): StateNode; /** * The editor's current path of active states. * * @example * ```ts * app.getStatePath() // "draw.idle" * ``` * * @public */ getStatePath(): string; /** * Get whether a certain tool (or other state node) is currently active. * * @example * ```ts * app.stateIsIn('draw') * app.stateIsIn('draw.drawpoint') * ``` * * @param path - The path of active states, separated by periods. * * @public */ stateIsIn(path: string): boolean; /** * Get whether the state node is in any of the given active paths. * * @example * ```ts * app.stateInAny('draw', 'pick') * app.stateInAny('draw.drawpoint', 'pick.idle') * ``` * * @public */ stateInAny(...paths: string[]): boolean; /** * Set the selected tool. * * @example * ```ts * app.setCurrentTool('transform') * app.setCurrentTool("draw.drawpolygon", {color: 0xff0000}) * ``` * * @param id - The id of the tool to select. * @param info - Arbitrary data to pass along into the transition. * * @public */ setCurrentTool(id?: string, info?: Record): App; /** * The current selected tool. * * @public */ getCurrentTool(): StateNode; /** * The id of the current selected tool. * * @public */ getCurrentToolId(): string; addTool(Tool: TLStateNodeConstructor): void; removeTool(Tool: TLStateNodeConstructor): void; /** * Get a descendant by its path. * * @example * ```ts * app.getStateDescendant('select') * app.getStateDescendant('select.brushing') * ``` * * @param path - The descendant's path of state ids, separated by periods. * * @public */ getStateDescendant(path: string): T | undefined; /** * 判断当前是否有工具处于运行中 */ isInActiveTool(): boolean; /** * 是否正在交互 */ isInteracting(): boolean; /** * 对一个物体进行变换控制器操作 */ transformObject(options: TransformEnterOptions): Promise; setupUiConfig(): UiObjectConfig; } export interface ToolStateModuleOptions { tools?: TLStateNodeConstructor[]; } /** * Returns the raw, original object of a Vue-created proxy. * * `toRaw()` can return the original object from proxies created by * {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or * {@link shallowReadonly()}. * * This is an escape hatch that can be used to temporarily read without * incurring proxy access / tracking overhead or write without triggering * changes. It is **not** recommended to hold a persistent reference to the * original object. Use with caution. * * @example * ```js * const foo = {} * const reactiveFoo = reactive(foo) * * console.log(toRaw(reactiveFoo) === foo) // true * ``` * * @param observed - The object for which the "raw" value is requested. */ function toRaw(observed: T): T; type ToRef = IfAny, [T] extends [Ref] ? T : Ref>; /** * Used to normalize values / refs / getters into refs. * * @example * ```js * // returns existing refs as-is * toRef(existingRef) * * // creates a ref that calls the getter on .value access * toRef(() => props.foo) * * // creates normal refs from non-function values * // equivalent to ref(1) * toRef(1) * ``` * * Can also be used to create a ref for a property on a source reactive object. * The created ref is synced with its source property: mutating the source * property will update the ref, and vice-versa. * * @example * ```js * const state = reactive({ * foo: 1, * bar: 2 * }) * * const fooRef = toRef(state, 'foo') * * // mutating the ref updates the original * fooRef.value++ * console.log(state.foo) // 2 * * // mutating the original also updates the ref * state.foo++ * console.log(fooRef.value) // 3 * ``` * * @param source - A getter, an existing ref, a non-function value, or a * reactive object to create a property ref from. * @param [key] - (optional) Name of the property in the reactive object. */ function toRef(value: T): T extends () => infer R ? Readonly> : T extends Ref ? T : Ref>; function toRef(object: T, key: K): ToRef; function toRef(object: T, key: K, defaultValue: T[K]): ToRef>; type ToRefs = { [K in keyof T]: ToRef; }; /** * Converts a reactive object to a plain object where each property of the * resulting object is a ref pointing to the corresponding property of the * original object. Each individual ref is created using {@link toRef()}. * * @param object - Reactive object to be made into an object of linked refs. */ function toRefs(object: T): ToRefs; /** * Convert a string to title case * @param str - The string to convert * * @category Text */ export function toTitleCase(str: string): string; function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry; interface Touches { one: singleTouchAction; two: multiTouchAction; three: multiTouchAction; } /** * Normalizes values / refs / getters to values. * This is similar to {@link unref()}, except that it also normalizes getters. * If the argument is a getter, it will be invoked and its return value will * be returned. * * @example * ```js * toValue(1) // 1 * toValue(ref(1)) // 1 * toValue(() => 1) // 1 * ``` * * @param source - A getter, an existing ref, or a non-function value. */ function toValue(source: MaybeRefOrGetter): T; /** * 转换为vector3类型 * @param v 值 * @returns */ export function toVector3(v: Vector3 | [number, number, number] | number): Vector3; /** * 几何坐标转世界坐标 . */ export function toWorld(vec3: [number, number, number?], app?: App, mapView?: MapViewEntity): Vector3; export type TParams = ValOrFunc, [T]>; class Track { keyframes: Keyframe_2[]; propName: string; valType: ValueType; discrete: boolean; _invalid: boolean; private _finished; private _needsSort; private _additiveTrack; private _additiveValue; /** * Last frame */ private _lastFr; /** * Percent of last frame. */ private _lastFrP; constructor(propName: string); isFinished(): boolean; setFinished(): void; needsAnimate(): boolean; getAdditiveTrack(): Track; addKeyframe(time: number, rawValue: unknown, easing?: AnimationEasing): Keyframe_2; prepare(maxTime: number, additiveTrack?: Track): void; step(target: any, percent: number): void; private _addToTarget; } /** * Tracks access to a reactive property. * * This will check which effect is running at the moment and record it as dep * which records all effects that depend on the reactive property. * * @param target - Object holding the reactive property. * @param type - Defines the type of access to the reactive property. * @param key - Identifier of the reactive property to track. */ function track(target: object, type: TrackOpTypes, key: unknown): void; /** * wasTracked and newTracked maintain the status for several levels of effect * tracking recursion. One bit per level is used to define whether the dependency * was/is tracked. */ interface TrackedMarkers { /** * wasTracked */ w: number; /** * newTracked */ n: number; } const enum TrackOpTypes { GET = "get", HAS = "has", ITERATE = "iterate" } /** * A VFX batch that render trails in a batch. */ export class TrailBatch extends VFXBatch { geometry: BufferGeometry; private positionBuffer; private previousBuffer; private nextBuffer; private uvBuffer; private sideBuffer; private widthBuffer; private colorBuffer; private indexBuffer; constructor(settings: VFXBatchSettings); setupBuffers(): void; expandBuffers(target: number): void; rebuildMaterial(): void; vector_: Vector3; vector2_: Vector3; vector3_: Vector3; quaternion_: Quaternion; update(): void; dispose(): void; } export class TrailLine { iconUrl: string; _originPositions: any; color: Color; opacity: any; lineWidth: any; useAlpha: any; showLine: any; placeLength: any; placeSpace: any; isAnimate: any; speed: any; smooth: any; uvOffset: number; colorArr: any[]; _map: any; positions: any; previous: any[]; next: any[]; side: any[]; width: any[]; indices: any[]; uvs: any[]; geometry: any; texture: any; material: any; trail: any; options: any; /** * 宽线箭头 * @param options */ constructor(options?: TrailLineOptions); /** * 初始化 * @private */ _init(): void; setVisible(bool: any): void; start(): void; stop(): void; compareV3(a: any, b: any): boolean; copyV3(a: any): any[]; _process(): void; update(app: App): void; } /** * 符号实体 */ export class TrailLineEntity extends Entity { trailLine: TrailLine; constructor(options: TrailLineEntityOptions); } export type TrailLineEntityOptions = EntityOptions & TrailLineOptions; export interface TrailLineOptions { /** 箭头url地址 */ iconUrl?: string; /** 坐标序列 */ positions?: [number, number, number][]; /** 颜色 */ color?: Color; /** 透明度 */ opacity?: number; /** 线宽,默认20 */ width?: number; /** 使用alpha,默认false */ useAlpha?: boolean; /** 显示线,默认true */ showLine?: boolean; /** 长,默认10 */ placeLength?: number; /** 空,默认10 */ placeSpace?: number; /** 动画,默认false */ isAnimate?: boolean; /** 速度,默认3 */ speed?: number; /** 平滑,默认true */ smooth?: boolean; } /** * Particle implementation for trail-based particles. */ export class TrailParticle implements Particle { /** * Parent matrix for transformation. * @type {Matrix4} */ parentMatrix?: Matrix4; /** * Initial speed of the particle. * @type {number} */ startSpeed: number; /** * Initial color of the particle. * @type {Vector4} */ startColor: Vector4; /** * Initial size of the particle. * @type {number} */ startSize: number; /** * Position of the particle. * @type {Vector3} */ position: Vector3; /** * Local position of the particle. * @type {Vector3} */ localPosition?: Vector3; /** * Velocity of the particle. * @type {Vector3} */ velocity: Vector3; /** * Age of the particle. * @type {number} */ age: number; /** * Life duration of the particle. * @type {number} */ life: number; /** * Size of the particle. * @type {number} */ size: number; /** * Length of the trail. * @type {number} */ length: number; /** * Speed modifier of the particle. * @type {number} */ speedModifier: number; /** * Color of the particle. * @type {Vector4} */ color: Vector4; /** * Previous states of the particle. * @type {LinkedList} */ previous: LinkedList; /** * UV tile index. * @type {number} */ uvTile: number; /** * Updates the particle state. */ update(): void; /** * Indicates if the particle has died. * @type {boolean} */ get died(): boolean; /** * Resets the particle properties and clears the previous states. */ reset(): void; } export interface TrailSettings { /** * Start length of the trail. * @type {ValueGenerator | FunctionValueGenerator} */ startLength: ValueGenerator | FunctionValueGenerator; /** * Whether to follow the local origin. * @type {boolean} */ followLocalOrigin: boolean; } /** * Transformation utilities. */ class Transform { /** * position */ position: Vec3; /** * quaternion */ quaternion: Quaternion_2; constructor(options?: { /** * position */ position?: Vec3; /** * quaternion */ quaternion?: Quaternion_2; }); /** * Get a global point in local transform coordinates. */ pointToLocal(worldPoint: Vec3, result?: Vec3): Vec3; /** * Get a local point in global transform coordinates. */ pointToWorld(localPoint: Vec3, result?: Vec3): Vec3; /** * vectorToWorldFrame */ vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; /** * pointToLocalFrame */ static pointToLocalFrame(position: Vec3, quaternion: Quaternion_2, worldPoint: Vec3, result?: Vec3): Vec3; /** * pointToWorldFrame */ static pointToWorldFrame(position: Vec3, quaternion: Quaternion_2, localPoint: Vec3, result?: Vec3): Vec3; /** * vectorToWorldFrame */ static vectorToWorldFrame(quaternion: Quaternion_2, localVector: Vec3, result?: Vec3): Vec3; /** * vectorToLocalFrame */ static vectorToLocalFrame(position: Vec3, quaternion: Quaternion_2, worldVector: Vec3, result?: Vec3): Vec3; } export const transform: { CRSTypes: typeof CRSTypes; convert: typeof convert; EpsgCrsTypes: typeof EpsgCrsTypes; getEpsgParam: typeof getEpsgParam; getEpsgCode: typeof getEpsgCode; }; class Transformable { parent: Transformable; x: number; y: number; scaleX: number; scaleY: number; skewX: number; skewY: number; rotation: number; /** * Will translated the element to the anchor position before applying other transforms. */ anchorX: number; anchorY: number; /** * Origin of scale, rotation, skew */ originX: number; originY: number; /** * Scale ratio */ globalScaleRatio: number; transform: matrix.MatrixArray; invTransform: matrix.MatrixArray; /** * Get computed local transform */ getLocalTransform(m?: matrix.MatrixArray): matrix.MatrixArray; /** * Set position from array */ setPosition(arr: number[]): void; /** * Set scale from array */ setScale(arr: number[]): void; /** * Set skew from array */ setSkew(arr: number[]): void; /** * Set origin from array */ setOrigin(arr: number[]): void; /** * If needs to compute transform */ needLocalTransform(): boolean; /** * Update global transform */ updateTransform(): void; private _resolveGlobalScaleRatio; /** * Get computed global transform * NOTE: this method will force update transform on all ancestors. * Please be aware of the potential performance cost. */ getComputedTransform(): matrix.MatrixArray; setLocalTransform(m: vector.VectorArray): void; /** * 分解`transform`矩阵到`position`, `rotation`, `scale` */ decomposeTransform(): void; /** * Get global scale */ getGlobalScale(out?: vector.VectorArray): vector.VectorArray; /** * 变换坐标位置到 shape 的局部坐标空间 */ transformCoordToLocal(x: number, y: number): number[]; /** * 变换局部坐标位置到全局坐标空间 */ transformCoordToGlobal(x: number, y: number): number[]; getLineScale(): number; copyTransform(source: Transformable): void; static getLocalTransform(target: Transformable, m?: matrix.MatrixArray): matrix.MatrixArray; private static initDefaultProps; } const TRANSFORMABLE_PROPS: readonly ["x", "y", "originX", "originY", "anchorX", "anchorY", "rotation", "scaleX", "scaleY", "skewX", "skewY"]; /** 变换控制器 */ export class TransformControls extends Object3D { readonly isTransformControls = true; visible: boolean; private domElement; private raycaster; private gizmo; private plane; private tempVector; private tempVector2; private tempQuaternion; private unit; private pointStart; private pointEnd; private offset; private rotationAxis; private startNorm; private endNorm; private rotationAngle; private cameraPosition; private cameraQuaternion; private cameraScale; private parentPosition; private parentQuaternion; private parentQuaternionInv; private parentScale; private worldPositionStart; private worldQuaternionStart; private worldScaleStart; private worldPosition; private worldQuaternion; private worldQuaternionInv; private worldScale; private eye; private positionStart; private quaternionStart; private scaleStart; private camera; private object; private enabled; private axis; private mode; private translationSnap; private rotationSnap; private scaleSnap; private space; private size; private dragging; private showX; private showY; private showZ; private changeEvent; private mouseDownEvent; private mouseUpEvent; private objectChangeEvent; app: App; constructor(camera: TCamera, domElement: HTMLElement | undefined, app?: App); private intersectObjectWithRay; attach: (object: Object3D) => this; detach: () => this; reset: () => this; updateMatrixWorld: () => void; private pointerHover; private pointerDown; private pointerMove; private pointerUp; private getPointer; private onPointerHover; private onPointerDown; private onPointerMove; private onPointerUp; getMode: () => TransformControls['mode']; setMode: (mode: TransformControls['mode']) => void; setTranslationSnap: (translationSnap: number) => void; setRotationSnap: (rotationSnap: number) => void; setScaleSnap: (scaleSnap: number) => void; setSize: (size: number) => void; setSpace: (space: string) => void; update: () => void; connect: (domElement: HTMLElement) => void; dispose: () => void; } export class TransformControlsGizmo extends Object3D { private isTransformControlsGizmo; type: string; private tempVector; private tempEuler; private alignVector; private zeroVector; private lookAtMatrix; private tempQuaternion; private tempQuaternion2; private identityQuaternion; private unitX; private unitY; private unitZ; private gizmo; picker: TransformControlsGizmoPrivateGizmos; private helper; private rotationAxis; private cameraPosition; private worldPositionStart; private worldQuaternionStart; private worldPosition; private worldQuaternion; private eye; private camera; private enabled; private axis; private mode; private space; private size; private dragging; private showX; private showY; private showZ; constructor(); updateMatrixWorld: () => void; } type TransformControlsGizmoPrivateGizmos = { ['translate']: Object3D; ['scale']: Object3D; ['rotate']: Object3D; ['visible']: boolean; }; export class TransformControlsPlane extends Mesh { private isTransformControlsPlane; type: string; constructor(); private unitX; private unitY; private unitZ; private tempVector; private dirVector; private alignVector; private tempMatrix; private identityQuaternion; private cameraQuaternion; private worldPosition; private worldQuaternion; private eye; private axis; private mode; private space; updateMatrixWorld: () => void; } export interface TransformControlsPointerObject { x: number; y: number; button: number; } export type TransformedTypes = TransformType, Vector3, number>; /** 变换控制器工具进入选项 */ export interface TransformEnterOptions extends TLEventType { /** 要操作的物体或点坐标 */ target?: Object3D | Vector3; /** 坐标轴 */ axis?: string | null; /** 模式 */ mode?: 'translate' | 'rotate' | 'scale'; /** 微调平移值 */ translationSnap?: number; /** 微调旋转值 */ rotationSnap?: number; /** 微调缩放值 */ scaleSnap?: number; /** 坐标空间 */ space?: 'world' | "local"; /** 辅助线尺寸大小 */ size?: number; /** 显示x轴, 如果指定了模式的话,则只在此模式下显示 */ showX?: boolean | ('translate' | 'rotate' | 'scale')[]; /** 显示y轴, 如果指定了模式的话,则只在此模式下显示 */ showY?: boolean | ('translate' | 'rotate' | 'scale')[]; /** 显示z轴, 如果指定了模式的话,则只在此模式下显示 */ showZ?: boolean | ('translate' | 'rotate' | 'scale')[]; /** 是否可以按 Q 键切换坐标空间 默认true*/ pressQKeySwitchSpace?: boolean; /** 按 shfit 键时进行微调 默认true*/ pressShiftKeySnap?: boolean; /** 是否可以按 W 键切换平移模式 默认true*/ pressWKeyModeTranslate?: boolean; /** 是否可以按 E 键切换平移模式 默认true*/ pressEKeyModeRotate?: boolean; /** 是否可以按 R 键切换平移模式 默认true*/ pressRKeyModeScale?: boolean; /** 是否可以按 X 键对x轴显示或隐藏 默认true*/ pressXKeyShowX?: boolean; /** 是否可以按 Y 键对x轴显示或隐藏 默认true*/ pressYKeyShowY?: boolean; /** 是否可以按 Z 键对x轴显示或隐藏 默认true*/ pressZKeyShowZ?: boolean; /** 查询条件 */ queryOptions?: EntityQueryOption; /** 没有选中实体时退出编辑 默认true */ clickNoEntityExit?: boolean; /** 点击到其他实体时或没有选中实体退出编辑 默认false */ clickNoSelfEntityExit?: boolean; /** 点击判断是否是其他实体的物体对象,默认为控件关联的对象 */ clickIsEqualObject?: Object3D | Function; /** 点击选中新的实体时自动附加到新实体上 默认true */ clickEntityAttach?: boolean; /** 操作是否加入命令组中用于撤销重做 默认true*/ editAsCommand?: boolean; /** 右键退出编辑 默认false */ rightClickConfirmExit?: boolean; /** 回车或esc退出编辑 默认 true */ enterEscConfirmExit?: boolean; /** 大小 */ transformSize?: number; /** 回调 */ dragCallBack?: (cb: { /** 是否重置 */ isReset: boolean; /** 是否一次操作完成 */ isOnceFinish: boolean; position: Vector3; scale: Vector3; rotation: Euler; deltaPosition: Vector3; deltaScale: Vector3; oldRotation: Euler; /** 命令对象,可以加用于撤销或重做的命令以命令方式加入此中 */ command?: MultiCmdsCommand; }) => void; } type TransformOptions = ConstructorParameters[0]; type TransformProp = (typeof TRANSFORMABLE_PROPS)[number]; /** 变换控制器工具 */ export class TransformTool extends StateNode { static id: string; static initial: string; static children: () => (typeof Idle_3)[]; } export type TransformType = { [P in keyof T]: T[P] extends U ? T[P] | V : T[P]; }; /** * 平移变换 */ function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray; /** * 遍历每个材质对象 * @param material */ export const traverseMaterial: (material: Mesh | Material | Material[], cb: (material: Material) => any) => any; interface TreeNode { bounds: Box3; count: number; offset: number; left?: TreeNode; right?: TreeNode; } export function triangle2dArea(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): number; class TriangleIntersectData { intersects: Object; triangle: Triangle; constructor(tri: Triangle); addTriangle(index: number, tri: Triangle): void; getIntersectArray(): Array; } class TriangleIntersectionSets { addTriangleIntersection(ia: number, tribA: Triangle, ib: number, triB: Triangle): void; getTrianglesAsArray(id?: number): Array; getTriangleIndices(): Array; getIntersectionIndices(id: number): void; getIntersectionsAsArray(id?: number, id2?: number): Array; } class TrianglePool { getTriangle(): Triangle; clear(): void; reset(): void; } class TriangleSetHelper extends Group_2 { constructor(triangles?: Triangle[]); setTriangles(triangles: Triangle[]): void; } class TriangleSplitter { trianglePool: TrianglePool; triangles: Triangle[]; normal: Vector3; initialize(tri: Triangle): void; splitByTriangle(triangle: Triangle): void; splitByPlane(plane: Plane, triangle: Triangle, coplanarIndex: number): void; reset(): void; } export function triangulate(vertices: number[], holes: number[], dimensions?: number): number[]; export function triangulatFlatten(data: number[][][]): { vertices: any[]; holes: any[]; dimensions: any; }; /** * Finds all deps associated with the target (or a specific property) and * triggers the effects stored within. * * @param target - The reactive object. * @param type - Defines the type of the operation that needs to trigger effects. * @param key - Can be used to target a specific reactive property in the target object. */ function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown): void; const enum TriggerOpTypes { SET = "set", ADD = "add", DELETE = "delete", CLEAR = "clear" } /** * Force trigger effects that depends on a shallow ref. This is typically used * after making deep mutations to the inner value of a shallow ref. * * @example * ```js * const shallow = shallowRef({ * greet: 'Hello, world' * }) * * // Logs "Hello, world" once for the first run-through * watchEffect(() => { * console.log(shallow.value.greet) * }) * * // This won't trigger the effect because the ref is shallow * shallow.value.greet = 'Hello, universe' * * // Logs "Hello, universe" * triggerRef(shallow) * ``` * * @param ref - The ref whose tied effects shall be executed. */ function triggerRef(ref: Ref): void; /** * @param str string to be trimed * @return trimed string */ function trim(str: string): string; /** * Trimesh. * @example * // How to make a mesh with a single triangle * const vertices = [ * 0, 0, 0, // vertex 0 * 1, 0, 0, // vertex 1 * 0, 1, 0 // vertex 2 * ] * const indices = [ * 0, 1, 2 // triangle 0 * ] * const trimeshShape = new CANNON.Trimesh(vertices, indices) */ class Trimesh extends Shape { /** * vertices */ vertices: Float32Array; /** * Array of integers, indicating which vertices each triangle consists of. The length of this array is thus 3 times the number of triangles. */ indices: Int16Array; /** * The normals data. */ normals: Float32Array; /** * The local AABB of the mesh. */ aabb: AABB; /** * References to vertex pairs, making up all unique edges in the trimesh. */ edges: Int16Array | null; /** * Local scaling of the mesh. Use .setScale() to set it. */ scale: Vec3; /** * The indexed triangles. Use .updateTree() to update it. */ tree: Octree; constructor(vertices: number[], indices: number[]); /** * updateTree */ updateTree(): void; /** * Get triangles in a local AABB from the trimesh. * @param result An array of integers, referencing the queried triangles. */ getTrianglesInAABB(aabb: AABB, result: number[]): number[]; /** * setScale */ setScale(scale: Vec3): void; /** * Compute the normals of the faces. Will save in the `.normals` array. */ updateNormals(): void; /** * Update the `.edges` property */ updateEdges(): void; /** * Get an edge vertex * @param firstOrSecond 0 or 1, depending on which one of the vertices you need. * @param vertexStore Where to store the result */ getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void; /** * Get a vector along an edge. */ getEdgeVector(edgeIndex: number, vectorStore: Vec3): void; /** * Get face normal given 3 vertices */ static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; /** * Get vertex i. * @return The "out" vector object */ getVertex(i: number, out: Vec3): Vec3; /** * Get raw vertex i * @return The "out" vector object */ private _getUnscaledVertex; /** * Get a vertex from the trimesh,transformed by the given position and quaternion. * @return The "out" vector object */ getWorldVertex(i: number, pos: Vec3, quat: Quaternion_2, out: Vec3): Vec3; /** * Get the three vertices for triangle i. */ getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void; /** * Compute the normal of triangle i. * @return The "target" vector object */ getNormal(i: number, target: Vec3): Vec3; /** * @return The "target" vector object */ calculateLocalInertia(mass: number, target: Vec3): Vec3; /** * Compute the local AABB for the trimesh */ computeLocalAABB(aabb: AABB): void; /** * Update the `.aabb` property */ updateAABB(): void; /** * Will update the `.boundingSphereRadius` property */ updateBoundingSphereRadius(): void; /** * calculateWorldAABB */ calculateWorldAABB(pos: Vec3, quat: Quaternion_2, min: Vec3, max: Vec3): void; /** * Get approximate volume */ volume(): number; /** * Create a Trimesh instance, shaped as a torus. */ static createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh; } export type TrimeshParameters = { vertices: Float32Array; indices: Uint32Array; }; class Trochoid extends Path { shape: TrochoidShape; constructor(opts?: TrochoidProps); getDefaultStyle(): { stroke: string; fill: string; }; getDefaultShape(): TrochoidShape; buildPath(ctx: CanvasRenderingContext2D, shape: TrochoidShape): void; } interface TrochoidProps extends PathProps { shape?: Partial; } class TrochoidShape { cx: number; cy: number; r: number; r0: number; d: number; location: string; } class TSpan extends Displayable { style: TSpanStyleProps; hasStroke(): boolean; hasFill(): boolean; /** * Create an image style object with default values in it's prototype. * @override */ createStyle(obj?: TSpanStyleProps): TSpanStyleProps; /** * Set bounding rect calculated from Text * For reducing time of calculating bounding rect. */ setBoundingRect(rect: BoundingRect): void; getBoundingRect(): BoundingRect; protected static initDefaultProps: void; } interface TSpanProps extends DisplayableProps { style?: TSpanStyleProps; } type TSpanState = Pick; interface TSpanStyleProps extends PathStyleProps { x?: number; y?: number; text?: string; font?: string; fontSize?: number; fontWeight?: FontWeight; fontStyle?: FontStyle; fontFamily?: string; textAlign?: CanvasTextAlign; textBaseline?: CanvasTextBaseline; } export type TUiRefreshModes = 'preRender' | 'postRender' | 'preFrame' | 'postFrame'; /** * TupleDictionary */ class TupleDictionary { data: { [id: string]: any; keys: string[]; }; /** get */ get(i: number, j: number): any; /** set */ set(i: number, j: number, value: any): void; /** delete */ delete(i: number, j: number): void; /** reset */ reset(): void; } /** * Apply turbulence to particles. */ export class TurbulenceField implements Simulation { scale: Vector3; octaves: number; velocityMultiplier: Vector3; timeScale: Vector3; type: string; generator: SimplexNoise; timeOffset: Vector3; temp: Vector3; temp2: Vector3; constructor(scale: Vector3, octaves: number, velocityMultiplier: Vector3, timeScale: Vector3); initialize(particle: Particle): void; update(particle: Particle, delta: number): void; toJSON(): any; frameUpdate(delta: number): void; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } /** * A Tween represents a series of actions that can be applied to a target object to create animations or sequences of events. * @template T - The type of the target object. */ export class Tween { /** The object to apply the tween to. */ target: T; /** Tags used for filtering and management. */ tags: string[]; /** Unique identifier. If specified, the old tween with the same id will be stopped. */ id: string; tweenManager: TweenManager; runningTween: RunningTween; /** * @param target - The object to apply the tween to. */ constructor(target: T, tweenManager?: TweenManager); /** * 为动画设置一个唯一的标识符。如果指定,则停止具有相同id的旧动画 * @param id The identifier to assign to the Tween. * @returns The updated Tween instance. */ setId(id: string): this; /** * 为动画设置标签,可用于过滤和管理。 * @param tags - Tags to associate with the Tween. * @returns The updated Tween instance. */ setTags(...tags: string[]): this; /** * 设置动画的目标对象 * @param target - The object to apply the tween to. * @returns The updated Tween instance. */ setTarget(target: T): this; /** * 控制补间的运动形式及方向, 当启动时,将读取当前属性值并 应用相对值来找出新的最终值 * @param time - The duration of the motion in milliseconds. * @param action - The motion configuration. * @param config - Additional motion configuration options. * @returns The updated Tween instance. */ to(time: number, action: Motion, config?: MotionConfig): this; /** * 定义当前状态的相对运动. * @param time - The duration of the motion in milliseconds. * @param action - The motion configuration. * @param config - Additional motion configuration options. * @returns The updated Tween instance. */ by(time: number, action: Motion, config?: MotionConfig): this; /** * 立即定义从当前状态到新状态的移动。 * @param action - The motion configuration. * @returns The updated Tween instance. */ set(action: Motion): this; /** * 增加回调函数. * @param callback - The callback function to execute. * @returns The updated Tween instance. */ call(callback: () => void): this; /** * 延迟执行动画的方法 .delay() , 接受一个参数用于控制延迟的具体时间,表示延迟多少时间后才开始执行动画 * @param time - The duration of the delay in milliseconds. * @returns The updated Tween instance. */ delay(time: number): this; /** * 使用该方法可以使动画重复执行,它接受一个参数 , 描述需要重复多少次 * @param times - The number of times to repeat the action. * @returns The updated Tween instance. */ repeat(times?: number): this; /** * 无限期地重复上一个操作 * @returns The updated Tween instance. */ repeatForever(): this; /** * 控制补间重复的模式, ,该动画像悠悠球一样来回运动 , 而不是重新开始 * @param times - The number of times to yoyo the last action. * @returns The updated Tween instance. */ yoyo(times?: number): this; /** * 对最后一个动作应用溜溜球效果,使其无限期地反转运动。 * @returns The updated Tween instance. */ yoyoForever(): this; /** * 链接另一个动画以在该动画之后执行。 * @param tween - The Tween to chain. * @returns The updated Tween instance. */ then(tween: Tween): this; /** * 并行运行多条 * @param tweens - The Tweens to run in parallel. * @returns The updated Tween instance. */ parallel(...tweens: Tween[]): this; /** * 按顺序运行多条 * @param tweens - The Tweens to run in sequence. * @returns The updated Tween instance. */ sequence(...tweens: Tween[]): this; /** * 链式补间动画,当我们顺序排列不同的补间动画时,比如我们在上一个补间结束的时候立即启动另外一个补间动画,使用 .chain() 方法来做。. * @param tween - The Tween containing actions to chain. * @returns The updated Tween instance. */ chain(tween: Tween): this; /** * 克隆动画. * @returns A new Tween instance with the same configuration. */ clone(): Tween; /** * 补间动画启动的方法 * @returns A RunningTween instance that controls the execution of the Tween. */ start(tweenManager?: TweenManager): RunningTween; } /** * This class is responsible for managing and controlling running tweens. */ export class TweenManager { private _running; private _runningChildren; /** * Stop the running tween with a specific id. * @param id Tween identifier. */ stopById(id: string): void; /** * Stop all running tweens. */ stopAll(): void; /** * Stop all running tweens with a specific tag. * @param tag - The tag to filter running tweens. */ stopAllByTag(tag: string): void; /** * Complete all running tweens. */ completeAll(): void; /** * Complete all running tweens with a specific tag. * @param tag - The tag to filter running tweens. */ completeAllByTag(tag: string): void; } /** * Mapping of typed array constructors by name * @category ArrayBuffer */ export const TYPED_ARRAYS: { Int8Array: Int8ArrayConstructor; Uint8Array: Uint8ArrayConstructor; Uint8ClampedArray: Uint8ClampedArrayConstructor; Int16Array: Int16ArrayConstructor; Uint16Array: Uint16ArrayConstructor; Int32Array: Int32ArrayConstructor; Uint32Array: Uint32ArrayConstructor; Float32Array: Float32ArrayConstructor; Float64Array: Float64ArrayConstructor; }; class TypedAttributeData { groupAttributes: Object[]; groupCount: number; getType(name: String): string; getTotalLength(name: String): number; getGroupSet(index?: number): Object; getGroupAttrArray(name: string, index?: number): Array; initializeArray(name: string, type: string): void; clear(): void; delete(key: string): void; reset(): void; } export function uiButton(label?: string, params?: TParams): PropertyDecorator; export function uiColor(label?: string, params?: TParams): PropertyDecorator; export function uiConfig(uiType?: string, params?: Partial & { params?: TParams; group?: string; }): PropertyDecorator; export interface UiConfigContainer extends IUiConfigContainer { [id: string]: any; } export class UiConfigMethods { protected _renderer: UiConfigRendererBase; constructor(_renderer: UiConfigRendererBase); getBinding(config: UiObjectConfig): [any, string | number]; getValue(config: UiObjectConfig): T | undefined; dispatchOnChangeSync(config: UiObjectConfig, props: { last?: boolean; config?: UiObjectConfig; configPath?: UiObjectConfig[]; }, ...args: any[]): void; setValue(config: UiObjectConfig, value: T, props: { last?: boolean; config?: UiObjectConfig; configPath?: UiObjectConfig[]; }, forceOnChange?: boolean): Promise; dispatchOnChange(config: UiObjectConfig, props: { last?: boolean; config?: UiObjectConfig; configPath?: UiObjectConfig[]; }): Promise; getLabel(config: UiObjectConfig): string; getChildren(config: UiObjectConfig): UiObjectConfig[]; clickButton(config: UiObjectConfig, options?: { args: any[]; }): Promise; runAtEvent(config: UiObjectConfig, run: () => T | Promise): Promise; initUiConfig(config: UiObjectConfig): void; } export abstract class UiConfigRendererBase extends SimpleEventDispatcher<"preFrame" | "preRender" | "postRender" | "postFrame"> { readonly methods: UiConfigMethods; readonly config: UiObjectConfig; protected constructor(container?: HTMLElement, autoFrameEvents?: boolean, methods?: UiConfigMethods); protected _refreshQueue: Record>; private _lastModeTime; refreshQueue(mode: TUiRefreshModes): void; private _addToRefreshQueue; dispose(): void; appendChild(config?: UiObjectConfig): void; removeChild(config: UiObjectConfig): void; refreshRoot(deep?: boolean, mode?: TUiRefreshModes | "immediate", delay?: number): void; abstract renderUiConfig(uiConfig: UiObjectConfig): void; protected _root?: TUiNode; /** * Disposes the UI associated with a config, doesn't makes change to the object or its parent. * @param config * @param performDispose */ disposeUiConfig(config?: UiObjectConfig, performDispose?: boolean): void; addToRefreshQueue(mode: TUiRefreshModes | "immediate", uiConfig: UiObjectConfig, deep: boolean, delay: number): void; protected abstract _refreshUiConfigObject(config: UiObjectConfig): void; protected _createUiContainer(): HTMLDivElement; private _flattenUiConfig; } export class UiConfigTypeMap { static Map: Map; } export function uiContainer(label: string, params?: any, type?: string): any>(constructor: T) => { new (...args: any[]): { [x: string]: any; uiConfig: UiObjectConfig; }; } & T; export function uiDropdown(label?: string, children?: UiObjectConfig[], params?: TParams): PropertyDecorator; export function uiFolderContainer(label: string, params?: any): any>(constructor: T) => { new (...args: any[]): { [x: string]: any; uiConfig: UiObjectConfig; }; } & T; export function uiImage(label?: string, params?: TParams): PropertyDecorator; export function uiInput(label?: string, params?: TParams): PropertyDecorator; export class UiModule extends AppModuleBase implements IAppModuleBase { static moduleName: string; _controls: Array; _controlContainer: HTMLElement; _controlPositions: Record; options: UiModuleOptions; configPane?: any; constructor(app?: App, options?: UiModuleOptions); onAwake(): void; /** * 设置光标 * @param cur 光标名称 */ setCursor(cur: string): void; setControlMargin(opts: ControlMarginOptions): void; /** * 增加控件 (会调用 `control.onAdd(this)` ). * * @param control 需要增加的控件. * @param {string} [position] 位置. 'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'` */ addControl(control: IControl, position?: ControlPosition): App; /** * 移除控件. * * @param {IControl} control 要移除的控件. */ removeControl(control: IControl): App; /** * 是否有控件. * * @param {IControl} control 要查询的控件. */ hasControl(control: IControl): boolean; getConfigPane(opts?: { /** 是否清空,默认是 */ isReset?: boolean; /** 标题 */ title?: string; /** 样式 */ style?: Partial; }): Promise<{ configPane: any; rootPane: any; element: HTMLElement; isInit: boolean; setVisible: (b: any) => "" | "none"; isVisible: () => boolean; reset: () => void; appendChild: (config?: UiObjectConfig, params?: UiObjectConfig) => any; renderUiConfig: (uiConfig: UiObjectConfig) => any; renderUiObject: (uiConfig: UiObjectConfig, parent?: any) => any; uiRefresh(deep?: boolean, mode?: TUiRefreshModes | 'immediate', delay?: number): any; }>; /** * 信息弹窗提示 * - text(必填):需要输出的文本 * - type(可选):输出类型 默认是 "log" * - time(可选):停留时间 默认是 2500 */ logInfo(text: string, type?: logInfoType | number, time?: number): void; setupUiConfig(): UiObjectConfig; } export interface UiModuleOptions { /** 控件参数 */ control?: ControlMarginOptions; /** 设置面板参数 */ configPane?: { /** 父容器,默认body */ container?: HTMLElement; /** 展表,默认true */ expanded?: boolean; /** 默认true */ autoPostFrame?: boolean; /** 样式 */ style?: Partial; /** 标题 */ title?: string; }; } export function uiMonitor(label?: string, params?: TParams): PropertyDecorator; export function uiNumber(label?: string, params?: TParams): PropertyDecorator; export interface UiObjectConfig { app?: App; /** * An optional uuid to identify this object. If not provided, one will be generated during first render. * This must be provided if a new UiObjectConfig object is generated each time the config is rendered. */ uuid?: string; /** * The type of the object. This is used to determine the component to use. * Examples: 'button', 'slider', 'dropdown', 'folder', 'input' etc */ type?: TType; /** * The label to use for the object. This is used as the title for folders, and as the label for inputs. * This can be a string or a function that returns a string. * If not provided, the label will be determined automatically, by the key of the property or sets to defaults */ label?: ValOrFunc; /** * Children of this object. This is used for folders and dropdowns. * This can be an array of UiObjectConfig objects, or an array of functions that returns an array of UiObjectConfig objects. */ children?: Array>>; /** * The property to bind to. This is used for inputs. * This can be an array of [target, key] or a function that returns an array of [target, key]. * key can be a number for arrays. */ property?: ValOrFunc<[TTarget, StringKeyOf | number]>; /** * Alias for property */ binding?: ValOrFunc<[TTarget, StringKeyOf]>; /** * The value of the object. This is used for inputs, if property is not provided. */ value?: T; /** * getValue function. This is used for inputs, if property, value is not specified. * This is called to get the value of the input on each render/update. */ getValue?: () => T; /** * setValue function. This is used for inputs, if property, value is not specified. * This is called when the value of the input changes. * @param value - The value to set * @param args - other arguments like the config, renderer, etc. See source code for details. */ setValue?: (value: T, ...args: ChangeArgs) => void; /** * The Ui element will be hidden if this is true. * This can be a boolean or a function that returns a boolean. */ hidden?: ValOrFunc; /** * The Ui input will be disabled if this is true, i.e. the user will not be able to change the value. * This can be a boolean or a function that returns a boolean. */ disabled?: ValOrFunc; /** * The Ui input will be read-only if this is true, i.e. the user will not be able to change the value. * This can be a boolean or a function that returns a boolean. * This can also be achieved by setting specifying a getValue function, but not a setValue function. Or by setting disabled to true. */ readOnly?: ValOrFunc; /** * tags can be added to the config object to be used for filtering, like rendering only objects with a certain tag. * This can be a string or an array of strings. */ tags?: ValOrArr; /** * onChange callbacks can be added to the config object to be called when the value of the object changes. * This can be a function or an array of functions. */ onChange?: ValOrArrOp<((...args: ChangeArgs) => void)>; /** * A function to be called when the Ui element is clicked. * Only for buttons. This is an alias of config.value or config.property for buttons. * @param args */ onClick?: (...args: any[]) => void; /** * bounds for the value of the object. This is used for numeric inputs like number and sliders. * This can be an array of [min, max] or a function that returns an array of [min, max]. */ bounds?: ValOrFunc; /** * stepSize for specifying the min change in the value. This is used for numeric inputs like number and slider. * The value will be rounded to the nearest multiple of stepSize. * This can be a number or a function that returns a number. */ stepSize?: ValOrFunc; /** * Only for folders. The Ui element will be expanded if this is true. * This can be a boolean or a function that returns a boolean. * If this is not set to a function, config.expanded can be read to get the current state. */ expanded?: ValOrFunc; /** * Only for folders. The callback called when a folder is expanded or collapsed. * @param c */ onExpand?: (c: UiObjectConfig) => void; /** * Only for elements with inline picker support * This can be a boolean or a function that returns a boolean. */ inlinePicker?: ValOrFunc; /** * Extra HTMLElements to be added to the UI element. This is used for customizing the UI. * This can be an array of HTMLElement or a function that returns an array of HTMLElement. */ domChildren?: HTMLElement[] | (() => HTMLElement[]); /** * After initial rendering, config.uiRef will be set to the instance of the UI component that's created. * The type of this will depend on the type of the component and the base UI library used. * This can be used to access the UI component directly, for example to add event listeners. Note that the uiRef might change on render. */ uiRef?: any; /** * The type of the UI component that's referenced by config.uiRef. This is set during rendering and used to re-render the UI if config.type changes. */ uiRefType?: UiObjectType; /** * After initial rendering, config.uiRefresh will be set to a function that can be used to re-render the UI. * @param deep - If true, the UI will be re-rendered recursively, otherwise only the current object will be re-rendered. * @param mode - The mode to re-render in. See TUiRefreshModes for details. Use when syncing with custom render loop * @param delay - The delay in ms to wait before re-rendering. This is useful if multiple changes are made in quick succession. If another refresh event is in the queue for the same object, it will be postponed by this amount. This is not exact for small values. */ uiRefresh?: (deep?: boolean, mode?: TUiRefreshModes | 'immediate', delay?: number) => void; dispatchMode?: TUiRefreshModes | 'immediate'; /** * Individual components can support custom options. These can be added to the config object. */ [id: string]: any; } export type UiObjectType = string; export function uiPanelContainer(label: string, params?: any): any>(constructor: T) => { new (...args: any[]): { [x: string]: any; uiConfig: UiObjectConfig; }; } & T; export class UiPanelJsonConfig { children: (Controller | UiPanelJsonConfig)[]; isFolder?: boolean; title?: string; expanded?: boolean; hidden?: boolean; constructor(); /** * Adds a controller to the GUI, inferring controller type using the `typeof` operator. * @example * gui.add( object, 'property' ); * gui.add( object, 'number', 0, 100, 1 ); * gui.add( object, 'options', [ 1, 2, 3 ] ); * * @param {object} object The object the controller will modify. * @param {string} property Name of the property to control. * @param {number|object|Array} [values] Minimum value for number controllers, or the set of * selectable values for a dropdown. * @param {number} [max] Maximum value for number controllers. * @param {number} [step] Step value for number controllers. * @returns {Controller} */ add(object: object, property: string, values?: number | object | any[], max?: number, step?: number): Controller; addBinding(object: object, property: string, opt_params?: { min?: number; max?: number; step?: number; label?: string; type?: string; view?: string; options?: any[] | object; }): Controller; /** * Adds a color controller to the GUI. * @example * params = { * cssColor: '#ff00ff', * rgbColor: { r: 0, g: 0.2, b: 0.4 }, * customRange: [ 0, 127, 255 ], * }; * * gui.addColor( params, 'cssColor' ); * gui.addColor( params, 'rgbColor' ); * gui.addColor( params, 'customRange', 255 ); * * @param {object} object The object the controller will modify. * @param {string} property Name of the property to control. * @param {number} rgbScale Maximum value for a color channel when using an RGB color. You may * need to set this to 255 if your colors are too bright. * @returns {Controller} */ addColor(object: object, property: string): Controller; /** * Adds a folder to the GUI, which is just another GUI. This method returns * the nested GUI so you can add controllers to it. * @example * const folder = gui.addFolder( 'Position' ); * folder.add( position, 'x' ); * folder.add( position, 'y' ); * folder.add( position, 'z' ); * * @param {string} title Name to display in the folder's title bar. */ addFolder(title: string | { title: string; expanded?: boolean; }): UiPanelJsonConfig; /** * 增加一个按钮 * @example * gui.addButton( "测试", () => console.log(1) ); * * @param {string} title Name to display in the folder's title bar. */ addButton(title: string, cb: Function): Controller; /** * 增加一个函数 */ addFunction(cb: Function): void; /** * Opens a GUI or folder. GUI and folders are open by default. * @param {boolean} open Pass false to close * @returns {this} * @example * gui.open(); // open * gui.open( false ); // close * gui.open( gui._closed ); // toggle */ open(open?: boolean): this; /** * Shows the GUI after it's been hidden. * @param {boolean} show * @returns {this} * @example * gui.show(); * gui.show( false ); // hide * gui.show( gui._hidden ); // toggle */ show(show?: boolean): this; toJson(): any; } export function uiSlider(label?: string, bounds?: [number, number], stepSize?: number, params?: TParams): PropertyDecorator; export function uiToggle(label?: string, params?: TParams): PropertyDecorator; export function uiVector(label?: string, bounds?: [number, number], stepSize?: number, params?: TParams): PropertyDecorator; export type Uniform = { [key: string]: IUniform; }; type UniformMap = { [uniform: string]: IUniform; }; type UniformProps = { [name: string]: UniformValue; }; type UniformValue = CubeTexture | Texture | Int32Array | Float32Array | Matrix4 | Matrix3 | Quaternion | Vector4 | Vector3 | Vector2 | Color | number | boolean | Array | null; type UninitializedUniform = { value: Value | null; }; /** * Units utils contains methods to convert data between representations. * * Multiple methods are used to reprent world coordinates based on the type of data being presented. * * WGS84 is the most commonly used representation with (latitude, longitude, altitude). * * EPSG:900913 is used for planar coordinates in (X, Y, Z) */ export class UnitsUtils { static EARTH_RADIUS: number; /** * Earth equator perimeter in meters. */ static EARTH_PERIMETER: number; /** * Earth equator perimeter in meters. */ static EARTH_ORIGIN: number; /** * Converts coordinates from WGS84 Datum to XY in Spherical Mercator EPSG:900913. * * @param latitude - Latitude value in degrees. * @param longitude - Longitude value in degrees. */ /** * Converts XY point from Spherical Mercator EPSG:900913 to WGS84 Datum. * * @param x - X coordinate. * @param y - Y coordinate. */ /** * Converts quad tree zoom/x/y to lat/lon in WGS84 Datum. * * The X and Y start from 0 from the top/left corner of the quadtree up to (4^zoom - 1) * * @param zoom - Zoom level of the quad tree. * @param x - X coordinate. * @param y - Y coordinate. */ /** * Direction vector to WGS84 coordinates. * * Can be used to transform surface points of world sphere to coordinates. * * @param dir - Direction vector. * @returns WGS84 coordinates. */ /** * Get a direction vector from WGS84 coordinates. * * The vector obtained will be normalized. * * @param latitude - Latitude value in degrees. * @param longitude - Longitude value in degrees. * @returns Direction vector normalized. */ /** * Get altitude from RGB color for mapbox altitude encoding * * https://docs.mapbox.com/data/tilesets/guides/access-elevation-data/~ * * @param color - Color of the pixel * @returns The altitude encoded in meters. */ static mapboxAltitude(color: Color): number; } export function unloadParticlePlugin(pluginId: string): void; /** * 投影参数选项 * number 深度 (-1近裁剪面 到 1 远裁剪面) * boolean undefined根据地图配置决定, false 不用场景数据, true用场景数据 * Plane 默认xz平面 地图模式xy平面 * Vector3 点所在的屏幕垂直与相机的平面 * Object3D[] 指定实体数组 * object 指定实体数组 或同时指定包含或过滤的实体 */ export type UnProjectOpts = number | Plane | Vector3 | boolean | Object3D[] | { include?: Object3D[]; exclude: Object3D[]; }; /** * Returns the inner value if the argument is a ref, otherwise return the * argument itself. This is a sugar function for * `val = isRef(val) ? val.value : val`. * * @example * ```js * function useFoo(x: number | Ref) { * const unwrapped = unref(x) * // unwrapped is guaranteed to be number now * } * ``` * * @param ref - Ref or plain value to be converted into the plain value. */ function unref(ref: MaybeRef): T; type UnwrapNestedRefs = T extends Ref ? T : UnwrapRefSimple; type UnwrapRef = T extends ShallowRef ? V : T extends Ref ? UnwrapRefSimple : UnwrapRefSimple; type UnwrapRefSimple = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | { [RawSymbol]?: true; } ? T : T extends readonly any[] ? { [K in keyof T]: UnwrapRefSimple; } : T extends object & { [ShallowReactiveMarker]?: never; } ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef; } : T; /** * Updates the bit at the given position to the given value. * @param number - the number to update * @param bitPosition - the bit position to update from the least significant bit (0) to most significant bit (31) * @param bitValue - 0 or 1 */ export function updateBit(number: number, bitPosition: number, bitValue: number): number; export class UpdateValueCommand extends BaseCommand { private object; private attributeName; private newValue; private oldValue; constructor(object: T, attributeName: K, newValue: T[K], oldValue?: T[K]); execute(): void; undo(): void; redo(): void; } /** * Prompt the user to select a file or directory in the browser. * @param multiple - allow multiple files * @param directory - allow directory * @param accept - file types to accept (default: all), e.g. 'image/*' * @category Browser */ export function uploadFile(multiple?: boolean, directory?: boolean, accept?: string): Promise; /** 选择一个文件获取内容 */ export function uploadFileGetContent(accept?: string, asBlob?: number): Promise; export function useFBO( /** Width in pixels */ width?: number, /** Height in pixels */ height?: number, /**Settings */ settings?: FBOSettings): WebGLRenderTarget; export class UvAtlasWebWorker extends BaseUvAtlas { init(onLoad: () => void, onProgress: (mode: any, progress: any) => void, wasmFilePath: string, workerFilePath?: string): void; } export class UVUnwrapper extends BaseUVUnwrapper { protected _createUvAtlas(): any; } function validateBounds(bvh: MeshBVH): boolean; /** * Type for a value of type T or an array of values of type T */ export type ValOrArr = T | T[]; /** * Type for a value of type `T|undefined` or an array of values of type `T|undefined` */ export type ValOrArrOp = ValOrArr; /** * Type for a value of type T or a function that returns a value of type T */ export type ValOrFunc = T | Fof; export interface ValueGenerator { type: 'value'; genValue(): number; toJSON(): FunctionJSON; clone(): ValueGenerator; } export function ValueGeneratorFromJSON(json: FunctionJSON): FunctionValueGenerator | ValueGenerator; type ValueType = 0 | 1 | 2 | 3 | 4 | 5 | 6; /** * @description 绘制变径管道 curve, radiusArr, 20, valuesArr, mapValuesArr, LUT * @param curve 轨迹 * @param radiusArr [['井深','半径']...] 半径数组, * @param radialSegments 管道截面分段数 默认8 * @param valuesArr ['值域最小值','值域最大值'] 半径值域, * @param mapValuesArr ['映射最小值','映射最大值'] 半径值域映射 * @param LUT 根据半径给顶点上色 */ export class VariableTubeGeometry extends BufferGeometry { constructor(path: CatmullRomCurve3, radiusArr: [number, number][], radialSegments?: number, valuesArr?: number[], mapValuesArr?: number[], lut?: Lut); } /** * 3-dimensional vector * @example * const v = new Vec3(1, 2, 3) * console.log('x=' + v.x) // x=1 */ class Vec3 { x: number; y: number; z: number; static ZERO: Vec3; static UNIT_X: Vec3; static UNIT_Y: Vec3; static UNIT_Z: Vec3; constructor(x?: number, y?: number, z?: number); /** * Vector cross product * @param target Optional target to save in. */ cross(vector: Vec3, target?: Vec3): Vec3; /** * Set the vectors' 3 elements */ set(x: number, y: number, z: number): Vec3; /** * Set all components of the vector to zero. */ setZero(): void; /** * Vector addition */ vadd(vector: Vec3): Vec3; vadd(vector: Vec3, target: Vec3): void; /** * Vector subtraction * @param target Optional target to save in. */ vsub(vector: Vec3): Vec3; vsub(vector: Vec3, target: Vec3): void; /** * Get the cross product matrix a_cross from a vector, such that a x b = a_cross * b = c * * See {@link https://www8.cs.umu.se/kurser/TDBD24/VT06/lectures/Lecture6.pdf Umeå University Lecture} */ crossmat(): Mat3; /** * Normalize the vector. Note that this changes the values in the vector. * @return Returns the norm of the vector */ normalize(): number; /** * Get the version of this vector that is of length 1. * @param target Optional target to save in * @return Returns the unit vector */ unit(target?: Vec3): Vec3; /** * Get the length of the vector */ length(): number; /** * Get the squared length of the vector. */ lengthSquared(): number; /** * Get distance from this point to another point */ distanceTo(p: Vec3): number; /** * Get squared distance from this point to another point */ distanceSquared(p: Vec3): number; /** * Multiply all the components of the vector with a scalar. * @param target The vector to save the result in. */ scale(scalar: number, target?: Vec3): Vec3; /** * Multiply the vector with an other vector, component-wise. * @param target The vector to save the result in. */ vmul(vector: Vec3, target?: Vec3): Vec3; /** * Scale a vector and add it to this vector. Save the result in "target". (target = this + vector * scalar) * @param target The vector to save the result in. */ addScaledVector(scalar: number, vector: Vec3, target?: Vec3): Vec3; /** * Calculate dot product * @param vector */ dot(vector: Vec3): number; isZero(): boolean; /** * Make the vector point in the opposite direction. * @param target Optional target to save in */ negate(target?: Vec3): Vec3; /** * Compute two artificial tangents to the vector * @param t1 Vector object to save the first tangent in * @param t2 Vector object to save the second tangent in */ tangents(t1: Vec3, t2: Vec3): void; /** * Converts to a more readable format */ toString(): string; /** * Converts to an array */ toArray(): [number, number, number]; /** * Copies value of source to this vector. */ copy(vector: Vec3): Vec3; /** * Do a linear interpolation between two vectors * @param t A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them. */ lerp(vector: Vec3, t: number, target: Vec3): void; /** * Check if a vector equals is almost equal to another one. */ almostEquals(vector: Vec3, precision?: number): boolean; /** * Check if a vector is almost zero */ almostZero(precision?: number): boolean; /** * Check if the vector is anti-parallel to another vector. * @param precision Set to zero for exact comparisons */ isAntiparallelTo(vector: Vec3, precision?: number): boolean; /** * Clone the vector */ clone(): Vec3; } /** * Vec3Pool */ class Vec3Pool extends Pool { type: typeof Vec3; /** * Construct a vector */ constructObject(): Vec3; } namespace vector { export { create_2 as create, copy_2 as copy, clone_2 as clone, set, add, scaleAndAdd, sub, len, lenSquare, mul_2 as mul, div, dot, scale_2 as scale, normalize, distance, distanceSquare, negate, lerp_2 as lerp, applyTransform, min, max, VectorArray, length_2 as length, lengthSquare, dist, distSquare } } type VectorArray = number[]; /** * Base class for VFX batches. */ export abstract class VFXBatch extends Mesh { type: string; systems: Set; material: ShaderMaterial; settings: StoredBatchSettings; protected maxParticles: any; protected constructor(settings: VFXBatchSettings); addSystem(system: IParticleSystem): void; removeSystem(system: IParticleSystem): void; applyDepthTexture(depthTexture: Texture | null): void; abstract setupBuffers(): void; abstract expandBuffers(target: number): void; abstract rebuildMaterial(): void; abstract update(): void; abstract dispose(): void; } /** * the settings for rendering a batch of VFX system. */ export interface VFXBatchSettings { /** * Geometry for instancing. * @type {BufferGeometry} */ instancingGeometry: BufferGeometry; /** * Material for rendering. * @type {Material} */ material: Material; /** * Number of horizontal tiles in the texture. * @type {number} */ uTileCount: number; /** * Number of vertical tiles in the texture. * @type {number} */ vTileCount: number; /** * Whether to blend tiles. * @type {boolean} */ blendTiles: boolean; /** * Enable soft particles. * @type {boolean} */ softParticles: boolean; /** * Near fade distance for soft particles. * @type {number} */ softNearFade: number; /** * Far fade distance for soft particles. * @type {number} */ softFarFade: number; /** * Render mode. * @type {RenderMode} */ renderMode: RenderMode; /** * Render order. * @type {number} */ renderOrder: number; /** * layers control visibility of the object. * @type {Layers} * @see {@link https://threejs.org/docs/index.html#api/en/core/Layers | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js | Source} */ layers: Layers; } export interface VFXParameters { autoDestroy?: boolean; looping?: boolean; prewarm?: boolean; duration?: number; emissionGraph: NodeGraph; updateGraph: NodeGraph; instancingGeometry?: BufferGeometry; renderMode?: RenderMode; rendererEmitterSettings?: TrailSettings | MeshSettings | BillBoardSettings; speedFactor?: number; material: Material; layers?: Layers; renderOrder?: number; worldSpace?: boolean; } class VideoLoader extends Loader { static autoplay: boolean; static preload: "" | "none" | "metadata" | "auto"; static muted: boolean; static loop: boolean; constructor(manager?: LoadingManager); load(url: string, onLoad?: (video: HTMLVideoElement) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: string | Event) => void): HTMLVideoElement; } export class ViewHelper extends Object3D { isViewHelper: boolean; animating: boolean; center: Vector3; viewSize: number; render: (renderer: any) => void; dispose: () => void; handleClick: (event: any) => Promise; container: HTMLElement; constructor(app: App, position?: "leftTop" | "rightTop" | "leftBottom" | "rightBottom", size?: number); } namespace vjmap3d { export { computeBoundsTree, disposeBoundsTree, acceleratedRaycast, SMAAEffect, EdgeDetectionMode, LambdaPass, FXAAEffect, KernelSize, PredicationMode, SMAAPreset, BloomEffect, KawaseBlurPass, ToneMappingEffect, ToneMappingMode, DepthOfFieldEffect, ChromaticAberrationEffect, GlitchEffect, GlitchMode, GodRaysEffect, PixelationEffect, SSAOEffect, NormalPass, OverrideMaterialManager, EffectComposer, DotScreenEffect, DepthPickingPass, TextureEffect, Effect, ColorDepthEffect, CopyPass, DepthPass, BlendFunction, ShaderPass, EffectAttribute, EffectPass, OutlineEffect, RenderPass, Pass, SelectiveBloomEffect, reactivity, render2d, __buildDate, __buildVersion, __buildVerNo, __DEV, deleteArrItem, generateUUID, cloneDeep, pick, bindAll, extend, strMd5, sleep, pushObjectStatus, throttle, debounce, applyMixins, BidirectionalMap, isObjectBehindCamera, cameraDistance2NdcZ, isObjectOcclude, addResourceRefCount, disposeObject3D, containSkeleton, objectTransformToMatrix, getBoundingBox, getObjectAnchorPoint, disableRayQuery, disableSelected, disableBloom, disableOutline, disableBloomSelectedRayQuery, Anchor3d, getObjectRefCount, ObjectTransform, resetUV, cameraWorldDirection, randColor, randHtmlColor, randPoint3D, randPoint2D, isMapMode, createScreenSpaceEntity, object2Entity, getOwerScene, getObjectOwnerEntity, getEntityParents, IUniformB, IUniformN, IUniformNArray, IUniformV2, IUniformV3, IUniformV3Array, IUniformColor, IUniformTexture, HighlightMaterialOption, traverseMaterial, cloneMaterial, disposeMaterial, setMaterialOpacity, enableMaterialVerticeOpacity, toWorld, fromWorld, toDist, fromDist, clamp, lerp, lerpEuler, approxZero, approxEquals, maxValue, minValue, randInt, approxArrayEquals, roundToStep, infinityToMaxNumber, maxNumberToInfinity, max3, min3, max2, min2, smoothPoints, toVector3, getFilterColorMatrix, degToRad, radToDeg, DEG2RAD, RAD2DEG, FilterColorOptions, expandLine, pointDistance, lineDistance, lineSlice, interpolatePointsByRatio, BitSet, isLeftButton, isMiddleButton, isRightButton, isShiftKeyDown, isCtrlKeyDown, isAltKeyDown, eventKeyCode, isEnterKey, isEscKey, isDeleteKey, preventDefaultEvent, eventXY, textureDataToImageData, renderTargetToDataUrl, textureToDataUrl, textureToCanvas, texImageToCanvas, exportRenderTarget, loadImage, DOM, addScript, ScriptDefaultOptions, lerpCoordinates, dist2d, offsetCoords, segmentIntersect3d, line3dSplit, multiLine3dSplit, isPointInPolygon, intersectLine3D, getFullscreenTriangle, getSphericalCube, getScreenSpaceBox, getFrustum, getFrustumFromHeight, lerpCameras, createUnProjectMenu, explodeGroup, enableSRGBColorSpace, optimizeModelRender, enableRealisticRender, enableShadow, getEnvmapFromHDRTexture, getEnvmapFromScene, flatModel, Graph, buildTopoGraph, buildPathTubeTopo, findShortestPath, EventDispatcher, Logger, DependencyError, Time, ModuleManager, AppBaseOptions, AppBase, IAppModuleBase, AppModuleBase, AppModuleConstructor, AppObject, IModuleBase, OrderIndex, ModuleBase, EntityBaseOptions, EntityBase, InteractiveEvent, DispatchEvent, IEntityModuleBase, EntityModuleBase, EntityModuleConstructor, findSignalHandlerIndexByHandle, findSignalHandlerIndexByHandleAndContext, dispatchViaProxy, SignalHandler, Signal, Store, CancelledCommandException, Scheduler, createWorker, workerWrap, workerProxy, workerTransfer, workerLink, createWorkerWrap, geoBounds, GeoBounds, geoPoint, GeoPoint, GeoPointLike, isGeoPointLike, Projection, GeoProjection, transform, InterpolationOptions, Interpolation, triangulate, triangulatFlatten, offsetPolygon, extrudePolygon, extrudePolyline, extrudeGeoJSON, lineIntersection, triangle2dArea, simplifyPoints, pointToSegmentDistance, closestPointOnSegment, closestToSegment3d, closestPointOnPolyline, closestPointOnPolylines, segmentIntersect, lineSplit, multiLineSplit, Screenshot, IWebGLRendererModule, WebGLRendererModuleOptions, WebGLRendererModule, ICameraModule, CameraOptions, CameraModuleOptions, CameraModule, EnvConfigOption, loadResourcesOptions, ISceneModule, BackgroundTexture, BackgroundEnvironmentOptions, SceneModuleOptions, SceneModule, IOrbitControlModule, OrbitControlModuleOptions, OrbitControlModule, IStatModule, StatModuleOptions, StatModule, PostProcessModuleOptions, IPostProcessModule, PostProcessModule, InputModuleOptions, IInputModule, InputModule, ICoordSystemModule, CoordSystemOption, UnProjectOpts, CoordSystemModule, ICSS2DRendererModule, CSS2DRendererModuleOptions, CSS2DRendererModule, ICSS3DRendererModule, CSS3DRendererModuleOptions, CSS3DRendererModule, IEntityManagerModule, EntityManagerModule, EntityOutlineModuleOptions, EntityOutlineModule, IEntityQueryModule, EntityQueryOption, InteractiveObject, EntityQueryModule, IDrawPointEnterOptions, IDrawLineEnterOptions, IDrawPolygonEnterOptions, IDrawEditEnterOptions, IPickModule, PickPointOptions, PickEntityOptions, PickModule, ICommandModule, CommandModuleOptions, CommandModule, IParticleRenderModule, ParticleRenderModuleOptions, ParticleRenderModule, IRectCollide, IRectCollideModule, RectCollideModuleOptions, RectCollideModule, IToolStateModule, ToolStateModuleOptions, ToolStateModule, IPhysicsManagerModule, PhysicsManagerModuleOptions, PhysicsBodyOption, MeshPhysicsObject, MeshPhysicsObjectParams, PhysicsManagerModule, ControlPosition, IControl, logInfoType, IUiModule, ControlMarginOptions, UiModuleOptions, UiModule, CameraState, CameraControls, GridHelperModuleOptions, GridHelperModule, MeshModuleOption, MeshModule, InstancedMeshModuleOption, DynamicInstancedMesh, InstancedMeshModule, SymbolItemData, SymbolModuleOption, BetterRaycastingPoints, SymbolModule, BillboardModule, OutlineModule, SpriteAnimatorModule, PolylineItemData, PolylinesModuleOption, PolylinesModule, PolygonItemData, PolygonsModuleOption, PolygonsModule, FillExtrusionItemData, FillExtrusionsModuleOption, FillExtrusionsModule, GlLineItemData, GlLinesModuleOption, GlLinesModule, BehaviorModule, SpriteMarkerModule, SpriteImagesModule, SpriteTextsModule, ParticleModuleOption, ParticleModule, AnimatorModuleOptions, AnimatorModule, ModelModuleOptions, ModelModule, EventModuleOptions, EventModule, PhysicsModule, PathAnimateModuleOptions, PathAnimateModule, AppOptions, App, EntityOptions, RayQueryType, Entity, LoadDetail, ResStatus, LoadUnit, LoaderManagerOptions, LoaderManager, ILoadModelOption, ResourceItem, RosourceItemsReturnType, ResourceManager, LoadManager, ResManager, AlgorithmPluginType, Tiles3dPluginType, LoadPluginOpts, PluginManager, Plugins, loadPluginAlgorithm, loadPlugin3dtiles, IEvent, IEventDispatcher, ImageCanvasOptions, AnyFunction, AnyOptions, Class, IDisposable, IJSONSerializable, PartialPick, PartialRecord, StringKeyOf, Fof, ValOrFunc, ValOrArr, ValOrArrOp, Serializer, PointerDragHelper, SimpleEventDispatcher, createCanvasElement, createDiv, createImage, createStyles, createScriptFromURL, TYPED_ARRAYS, arrayBufferToBase64, base64ToArrayBuffer, getTypedArray, escapeRegExp, getFilenameFromPath, parseFileExtension, replaceAll, toTitleCase, longestCommonPrefix, prettyScrollbar, blobToDataURL, downloadBlob, downloadFile, uploadFile, mobileAndTabletCheck, uploadFileGetContent, LinearToSRGB, SRGBToLinear, colorToDataUrl, onChange, onChange2, onChange3, serialize, serializable, aesGcmDecrypt, aesGcmEncrypt, embedUrlRefs, htmlToCanvas, htmlToPng, htmlToSvg, imageToCanvas, imageBitmapToBase64, imageUrlToImageData, imageDataToCanvas, canvasFlipY, isWebpExportSupported, absMax, clearBit, updateBit, includesAll, copyProps, getOrCall, getPropertyDescriptor, isPropertyWritable, safeSetProperty, deepAccessObject, getKeyByValue, objectHasOwn, makeColorSvg, makeTextSvg, makeColorSvgCircle, svgToCanvas, svgToPng, timeout, now, pathJoin, getUrlQueryParam, setUrlQueryParam, remoteWorkerURL, css, glsl, html, svgUrl, Serialization, BaseUvAtlas, UvAtlasWebWorker, PackOptions, ChartOptions, BaseUVUnwrapper, UVUnwrapper, GridProps, GridType, Grid, ViewHelper, ShadertoyMaterialParameters, ShadertoyMaterial, shaderMaterial, convertToMaterialParameters, FixedSizeMeshMaterial, highlightMaterial, SymbolMaterialProps, createSymbolMaterial, FlowMaterialProps, FlowMaterial, TextFlowMaterialOptions, RenderElementFlowMaterialOptions, createRenderElementFlowMaterial, createTextFlowMaterial, AnimatorFrameMaterialProps, AnimatorFrameMaterial, createAnimatorFrameSpriteMaterial, MeshReflectorMaterialConfig, MeshReflectorMaterial, ConvolutionMaterial, MeshTransmissionMaterialConfig, FBOConfig, MeshTransmissionMaterial, CustomShaderMaterial, MaterialConstructor, iCSMPatchMap, iCSMParams, iCSMUpdateParams, iCSMInternals, Uniform, iCSMShader, createFlowGradientMaterial, RadarMaterialProps, RadarMaterial, HolographicMaterial, ReflectorMaterial, ReflectorDudvMaterial, Render2dTextureOptions, createRender2dTexture, useFBO, Render3dTextureOptions, Render3dTexture, ShadertoyTextureItemOptions, ShadertoyTextureOptions, ShadertoyTexture, BufferShader, CharInfo, AtlasData, CharLayoutInfo, LayoutInfo, FontManagerOptions, FontManager, LabelMaterial, Label, LabelPool, LabelOptions, createLabel, ExtrudePath, ExtrudeMeshProps, ExtrudeMesh, MeshLineGeometry, MeshLineMaterial, MeshLine, PathPointList, PathGeometry, PathTubeGeometry, PathTubeEntitiesOptions, PathTubeEntities, BillboardProps, BillboardType, Billboard, Outlines, OutlinesProps, OutlinesType, TextProps, TextType, createTextMesh, SpriteAnimatorProps, SpriteAnimatorType, createSpriteAnimator, TrailLineOptions, TrailLine, Line2, LineGeometry, LineMaterialParameters, LineMaterial, LineSegments2, LineSegmentsGeometry, Wireframe, WireframeGeometry2, SpriteMarkerOptions, SpriteMarker, SpriteImageItemData, SpriteImageItem, SpriteImagesOptions, SpriteImages, SpriteTextItemData, SpriteTextItem, SpriteTextsOptions, SpriteTexts, AnimationClipOptions, AnimatorOptions, Animator, PlaneConfig, ScreenQuad, BoxHelperOptions, BoxHelper, HeatmapOptions, Heatmap, ReflectorBlurMaterial, ReflectorObject, createReflectorShaderMesh, MeasureRulerOptions, creataMeasureRuler, Environment, PackedMipMapGenerator, FullScreenQuad, DynamicEnvConfig, DynamicEnvironment, createFlyline, createMapApp, map2dUtils, MapThreeLayerOptions, MapThreeLayer, VariableTubeGeometry, HyperbolicHelicoidGeometry, SphubeGeometry, createWallBufferGeometry, MapView, LODControl, LODRaycast, MapProvider, MapNodeGeometry, MapNodeHeightGeometry, MapNode, QuadTreePosition, MapHeightNode, MapPlaneNode, UnitsUtils, MapUtils, CanvasUtils, CancelablePromise, XHRUtils, TextureUtils, MapViewEntity, AllowedTypes, Omitype, PickType, TransformType, TransformedTypes, FilteredType, Motion, MotionConfig, EasingFunction, Easing, DEFAULT_EASING, Easings, RunningTween, Tween, TweenManager, animation, animationAsync, MeshEntityOptions, MeshEntity, InstancedMeshEntityOptions, InstancedMeshEntity, SymbolEntityOptions, SymbolEntity, SpriteAnimatorEntityOptions, SpriteAnimatorEntity, PolylinesEntityOptions, PolylinesEntity, PolygonsEntityOptions, PolygonsEntity, FillExtrusionsEntityOptions, FillExtrusionsEntity, GlLinesEntityOptions, GlLinesEntity, SpriteMarkerEntityOptions, SpriteMarkerEntity, SpriteImagesEntityOptions, SpriteImagesEntity, SpriteTextsEntityOptions, SpriteTextsEntity, TrailLineEntityOptions, TrailLineEntity, MetaData, ParticleEmitter, IParticle, Particle, NodeParticle, SpriteParticle, RecordState, TrailParticle, BurstParameters, BurstParametersJSON, ParticleSystemParameters, ParticleSystemJSONParameters, JsonMetaData, EmissionState, ParticleSystem, StoredBatchSettings, RenderMode, VFXBatch, SpriteBatch, TrailBatch, VFXBatchSettings, SerializationOptions, RendererEmitterSettings, StretchedBillBoardSettings, BillBoardSettings, TrailSettings, MeshSettings, IParticleSystem, BatchedRenderer, ParticleLoader, Constructable, FieldType, ParameterType, ParameterPair, loadParticlePlugin, unloadParticlePlugin, ParticlePlugin, ParticlePlugins, getValueFromEmitterMode, ShapeJSON, EmitterMode, EmitterShape, ConeEmitterParameters, ConeEmitter, CircleEmitterParameters, CircleEmitter, DonutEmitterParameters, DonutEmitter, PointEmitter, SphereEmitterParameters, SphereEmitter, HemisphereEmitterParameters, HemisphereEmitter, GridEmitterParameters, GridEmitter, MeshSurfaceEmitter, EmitterFromJSON, EmitterShapeParticlePlugin, EmitterShapes, Bezier, ColorGeneratorFromJSON, ColorGenerator, FunctionColorGenerator, MemorizedFunctionColorGenerator, ConstantColor, ColorRange, ConstantValue, FunctionJSON, Gradient, RandomColorBetweenGradient, IntervalValue, PiecewiseBezier, PiecewiseFunction, RandomColor, ValueGeneratorFromJSON, ValueGenerator, FunctionValueGenerator, RandomQuatGenerator, AxisAngleGenerator, RotationGeneratorFromJSON, RotationGenerator, EulerGenerator, GeneratorFromJSON, ColorOverLife, RotationOverLife, Rotation3DOverLife, ForceOverLife, SizeOverLife, SpeedOverLife, FrameOverLife, OrbitOverLife, WidthOverLength, ApplyForce, GravityForce, ChangeEmitDirection, SubParticleEmitMode, EmitSubParticleSystem, TurbulenceField, Noise, ApplySequences, setPhysicsResolver, getPhysicsResolver, ApplyCollision, ColorBySpeed, SizeBySpeed, RotationBySpeed, LimitSpeedOverLife, SimulationFromJSON, Simulation, SimulationParticlePlugin, SimulationTypes, TextureSequencer, SequencerFromJSON, Sequencer, Interpreter, NodeData, Node_2 as Node, ConstInput, Wire, Adapter, NodeTypes, OutputNodeTypeNames, NodeGraph, ExecutionContext, NodeTypeSignature, NodeType, NodeDef, GraphNodeType, NodeValueType, getAlignOfNodeValueType, getSizeOfNodeValueType, genDefaultForNodeValueType, VFXParameters, NodeVFX, WebGPUCompiler, registerShaderChunks, CubeEmitterParameters, CubeEmitter, PathEmitterParameters, PathEmitter, SetEmitDirection, ApplyRoute, BehaviorContext, BehaviorStatus, Behavior, AbstractDecoratorBehavior, ConditionalBehavior, LogMessageBehavior, SendEventBehavior, ActionBehavior, DelayBehavior, ParallelBehaviorPolicy, ParallelBehavior, SequenceBehavior, DestoryBehavior, PromiseBehavior, SucceedingBehavior, FailingBehavior, RepeatBehavior, WaitForEventBehavior, BranchBehavior, FilterBehavior, RepeatUntilFailureBehavior, CompositeBehavior, IgnoreFailureBehavior, RepeatUntilSuccessBehavior, ConditionBehavior, InvertStatusBehavior, SelectorBehavior, RotationBehavior, AnimationTrackPlayback, AnimationTrack, AnimationBehavior, TLEventHandler, TLEventType, TLEnterEventHandler, TLExitEventHandler, TLStateNodeConstructor, StateNode, DefaultTool, DrawShapeTool, TransformControlsPointerObject, TransformControls, TransformControlsGizmo, TransformControlsPlane, TransformEnterOptions, TransformTool, PickEnterOptions, PickTool, ICommand, ICommandCallback, BaseCommand, SetMaterialMapCommand, IHasUpdate, SetValueCommand, UpdateValueCommand, CallFunctionCommand, SetMultipleValuesCommand, CommandHistory, MultiCmdsCommand, SetRotationCommand, SetPositionCommand, PushValueCommand, SetScaleCommand, IHasDataEntity, SetDataCommand, AddObject3DCommand, Anchor, anchorTranslate, anchorOrigin, Marker2dOptions, createDefaultMarkerElement, Marker2D, PopopOffset, PopupOptions, Popup2D, Marker3dOptions, Marker3D, AnimateMarkerType, AnimateMarkerLayerOption, AnimateMarkerBase, BreathingApertureMarker, DiffusedApertureMarker, FluorescenceMarker, HaloRingMarker, RotatingApertureMarker, RotatingTextBorderMarker, ContextMenuSubItemOptions, ContextMenuOptions, ContextMenu, ButtonGroupControlOptions, ButtonGroupControl, MousePositionControlOption, MousePositionControl, FullscreenControlOptions, FullscreenControl, MiniMapControlOption, MiniMapControl, UiConfigRendererBase, UiConfigMethods, UiConfigContainer, IUiConfigContainer, UiObjectConfig, UiObjectType, TUiRefreshModes, ChangeArgs, ChangeEvent, uiConfig, uiContainer, uiMonitor, uiSlider, uiVector, uiDropdown, uiButton, uiInput, uiColor, uiImage, uiToggle, uiNumber, uiPanelContainer, uiFolderContainer, generateUiConfig, generateUiFolder, UiConfigTypeMap, TParams, UiPanelJsonConfig, makeObject3DUiConfig, makeSamplerUi, getEmptyMeta, iMaterialUI, makeBasicMaterialUiConfig, makePhongMaterialUiConfig, makePhysicalMaterialUiConfig, makeMaterialUiConfig, makeGeomertyUiConfig, makeCameraUiConfig, makeLightUiConfig, encryptToBase64, decryptFromBase64, tea, MapOpenWay, IMapStyleParam, IOpenMapBaseParam, IOpenMapParam, IUpdateMapParam, IOpenMapResponse, ITileUrlParam, IQueryBaseFeatures, IPointQueryFeatures, IRectQueryFeatures, IExprQueryFeatures, IConditionQueryFeatures, IMapLayer, IUpdateStyle, ISliceLayer, ISliceCacheZoom, IWmsTileUrl, IDeleteStyle, IDeleteCache, IExportLayout, IMatchObject, IExtractTable, ISplitChildMaps, IComposeNewMap, IMapDiff, ICreateEntitiesGeomData, IWorkspace, openMapDarkStyle, openMapLightStyle, Service, Config, Response_2 as Response, IRequest, httpHelper, loadPhysicsEngine, CANNON, BoxParameters, CylinderParameters, SphereParameters, ConvexPolyhedronParameters, TrimeshParameters, ShapeType2, ShapeOptions, ShapeParameters, ShapeResult, getShapeParameters, threeToCannon } } namespace vjmap3d_2 { export { vjmap3d as default, computeBoundsTree, disposeBoundsTree, acceleratedRaycast, SMAAEffect, EdgeDetectionMode, LambdaPass, FXAAEffect, KernelSize, PredicationMode, SMAAPreset, BloomEffect, KawaseBlurPass, ToneMappingEffect, ToneMappingMode, DepthOfFieldEffect, ChromaticAberrationEffect, GlitchEffect, GlitchMode, GodRaysEffect, PixelationEffect, SSAOEffect, NormalPass, OverrideMaterialManager, EffectComposer, DotScreenEffect, DepthPickingPass, TextureEffect, Effect, ColorDepthEffect, CopyPass, DepthPass, BlendFunction, ShaderPass, EffectAttribute, EffectPass, OutlineEffect, RenderPass, Pass, SelectiveBloomEffect, reactivity, render2d, __buildDate, __buildVersion, __buildVerNo, __DEV, deleteArrItem, generateUUID, cloneDeep, pick, bindAll, extend, strMd5, sleep, pushObjectStatus, throttle, debounce, applyMixins, BidirectionalMap, isObjectBehindCamera, cameraDistance2NdcZ, isObjectOcclude, addResourceRefCount, disposeObject3D, containSkeleton, objectTransformToMatrix, getBoundingBox, getObjectAnchorPoint, disableRayQuery, disableSelected, disableBloom, disableOutline, disableBloomSelectedRayQuery, Anchor3d, getObjectRefCount, ObjectTransform, resetUV, cameraWorldDirection, randColor, randHtmlColor, randPoint3D, randPoint2D, isMapMode, createScreenSpaceEntity, object2Entity, getOwerScene, getObjectOwnerEntity, getEntityParents, IUniformB, IUniformN, IUniformNArray, IUniformV2, IUniformV3, IUniformV3Array, IUniformColor, IUniformTexture, HighlightMaterialOption, traverseMaterial, cloneMaterial, disposeMaterial, setMaterialOpacity, enableMaterialVerticeOpacity, toWorld, fromWorld, toDist, fromDist, clamp, lerp, lerpEuler, approxZero, approxEquals, maxValue, minValue, randInt, approxArrayEquals, roundToStep, infinityToMaxNumber, maxNumberToInfinity, max3, min3, max2, min2, smoothPoints, toVector3, getFilterColorMatrix, degToRad, radToDeg, DEG2RAD, RAD2DEG, FilterColorOptions, expandLine, pointDistance, lineDistance, lineSlice, interpolatePointsByRatio, BitSet, isLeftButton, isMiddleButton, isRightButton, isShiftKeyDown, isCtrlKeyDown, isAltKeyDown, eventKeyCode, isEnterKey, isEscKey, isDeleteKey, preventDefaultEvent, eventXY, textureDataToImageData, renderTargetToDataUrl, textureToDataUrl, textureToCanvas, texImageToCanvas, exportRenderTarget, loadImage, DOM, addScript, ScriptDefaultOptions, lerpCoordinates, dist2d, offsetCoords, segmentIntersect3d, line3dSplit, multiLine3dSplit, isPointInPolygon, intersectLine3D, getFullscreenTriangle, getSphericalCube, getScreenSpaceBox, getFrustum, getFrustumFromHeight, lerpCameras, createUnProjectMenu, explodeGroup, enableSRGBColorSpace, optimizeModelRender, enableRealisticRender, enableShadow, getEnvmapFromHDRTexture, getEnvmapFromScene, flatModel, Graph, buildTopoGraph, buildPathTubeTopo, findShortestPath, EventDispatcher, Logger, DependencyError, Time, ModuleManager, AppBaseOptions, AppBase, IAppModuleBase, AppModuleBase, AppModuleConstructor, AppObject, IModuleBase, OrderIndex, ModuleBase, EntityBaseOptions, EntityBase, InteractiveEvent, DispatchEvent, IEntityModuleBase, EntityModuleBase, EntityModuleConstructor, findSignalHandlerIndexByHandle, findSignalHandlerIndexByHandleAndContext, dispatchViaProxy, SignalHandler, Signal, Store, CancelledCommandException, Scheduler, createWorker, workerWrap, workerProxy, workerTransfer, workerLink, createWorkerWrap, geoBounds, GeoBounds, geoPoint, GeoPoint, GeoPointLike, isGeoPointLike, Projection, GeoProjection, transform, InterpolationOptions, Interpolation, triangulate, triangulatFlatten, offsetPolygon, extrudePolygon, extrudePolyline, extrudeGeoJSON, lineIntersection, triangle2dArea, simplifyPoints, pointToSegmentDistance, closestPointOnSegment, closestToSegment3d, closestPointOnPolyline, closestPointOnPolylines, segmentIntersect, lineSplit, multiLineSplit, Screenshot, IWebGLRendererModule, WebGLRendererModuleOptions, WebGLRendererModule, ICameraModule, CameraOptions, CameraModuleOptions, CameraModule, EnvConfigOption, loadResourcesOptions, ISceneModule, BackgroundTexture, BackgroundEnvironmentOptions, SceneModuleOptions, SceneModule, IOrbitControlModule, OrbitControlModuleOptions, OrbitControlModule, IStatModule, StatModuleOptions, StatModule, PostProcessModuleOptions, IPostProcessModule, PostProcessModule, InputModuleOptions, IInputModule, InputModule, ICoordSystemModule, CoordSystemOption, UnProjectOpts, CoordSystemModule, ICSS2DRendererModule, CSS2DRendererModuleOptions, CSS2DRendererModule, ICSS3DRendererModule, CSS3DRendererModuleOptions, CSS3DRendererModule, IEntityManagerModule, EntityManagerModule, EntityOutlineModuleOptions, EntityOutlineModule, IEntityQueryModule, EntityQueryOption, InteractiveObject, EntityQueryModule, IDrawPointEnterOptions, IDrawLineEnterOptions, IDrawPolygonEnterOptions, IDrawEditEnterOptions, IPickModule, PickPointOptions, PickEntityOptions, PickModule, ICommandModule, CommandModuleOptions, CommandModule, IParticleRenderModule, ParticleRenderModuleOptions, ParticleRenderModule, IRectCollide, IRectCollideModule, RectCollideModuleOptions, RectCollideModule, IToolStateModule, ToolStateModuleOptions, ToolStateModule, IPhysicsManagerModule, PhysicsManagerModuleOptions, PhysicsBodyOption, MeshPhysicsObject, MeshPhysicsObjectParams, PhysicsManagerModule, ControlPosition, IControl, logInfoType, IUiModule, ControlMarginOptions, UiModuleOptions, UiModule, CameraState, CameraControls, GridHelperModuleOptions, GridHelperModule, MeshModuleOption, MeshModule, InstancedMeshModuleOption, DynamicInstancedMesh, InstancedMeshModule, SymbolItemData, SymbolModuleOption, BetterRaycastingPoints, SymbolModule, BillboardModule, OutlineModule, SpriteAnimatorModule, PolylineItemData, PolylinesModuleOption, PolylinesModule, PolygonItemData, PolygonsModuleOption, PolygonsModule, FillExtrusionItemData, FillExtrusionsModuleOption, FillExtrusionsModule, GlLineItemData, GlLinesModuleOption, GlLinesModule, BehaviorModule, SpriteMarkerModule, SpriteImagesModule, SpriteTextsModule, ParticleModuleOption, ParticleModule, AnimatorModuleOptions, AnimatorModule, ModelModuleOptions, ModelModule, EventModuleOptions, EventModule, PhysicsModule, PathAnimateModuleOptions, PathAnimateModule, AppOptions, App, EntityOptions, RayQueryType, Entity, LoadDetail, ResStatus, LoadUnit, LoaderManagerOptions, LoaderManager, ILoadModelOption, ResourceItem, RosourceItemsReturnType, ResourceManager, LoadManager, ResManager, AlgorithmPluginType, Tiles3dPluginType, LoadPluginOpts, PluginManager, Plugins, loadPluginAlgorithm, loadPlugin3dtiles, IEvent, IEventDispatcher, ImageCanvasOptions, AnyFunction, AnyOptions, Class, IDisposable, IJSONSerializable, PartialPick, PartialRecord, StringKeyOf, Fof, ValOrFunc, ValOrArr, ValOrArrOp, Serializer, PointerDragHelper, SimpleEventDispatcher, createCanvasElement, createDiv, createImage, createStyles, createScriptFromURL, TYPED_ARRAYS, arrayBufferToBase64, base64ToArrayBuffer, getTypedArray, escapeRegExp, getFilenameFromPath, parseFileExtension, replaceAll, toTitleCase, longestCommonPrefix, prettyScrollbar, blobToDataURL, downloadBlob, downloadFile, uploadFile, mobileAndTabletCheck, uploadFileGetContent, LinearToSRGB, SRGBToLinear, colorToDataUrl, onChange, onChange2, onChange3, serialize, serializable, aesGcmDecrypt, aesGcmEncrypt, embedUrlRefs, htmlToCanvas, htmlToPng, htmlToSvg, imageToCanvas, imageBitmapToBase64, imageUrlToImageData, imageDataToCanvas, canvasFlipY, isWebpExportSupported, absMax, clearBit, updateBit, includesAll, copyProps, getOrCall, getPropertyDescriptor, isPropertyWritable, safeSetProperty, deepAccessObject, getKeyByValue, objectHasOwn, makeColorSvg, makeTextSvg, makeColorSvgCircle, svgToCanvas, svgToPng, timeout, now, pathJoin, getUrlQueryParam, setUrlQueryParam, remoteWorkerURL, css, glsl, html, svgUrl, Serialization, BaseUvAtlas, UvAtlasWebWorker, PackOptions, ChartOptions, BaseUVUnwrapper, UVUnwrapper, GridProps, GridType, Grid, ViewHelper, ShadertoyMaterialParameters, ShadertoyMaterial, shaderMaterial, convertToMaterialParameters, FixedSizeMeshMaterial, highlightMaterial, SymbolMaterialProps, createSymbolMaterial, FlowMaterialProps, FlowMaterial, TextFlowMaterialOptions, RenderElementFlowMaterialOptions, createRenderElementFlowMaterial, createTextFlowMaterial, AnimatorFrameMaterialProps, AnimatorFrameMaterial, createAnimatorFrameSpriteMaterial, MeshReflectorMaterialConfig, MeshReflectorMaterial, ConvolutionMaterial, MeshTransmissionMaterialConfig, FBOConfig, MeshTransmissionMaterial, CustomShaderMaterial, MaterialConstructor, iCSMPatchMap, iCSMParams, iCSMUpdateParams, iCSMInternals, Uniform, iCSMShader, createFlowGradientMaterial, RadarMaterialProps, RadarMaterial, HolographicMaterial, ReflectorMaterial, ReflectorDudvMaterial, Render2dTextureOptions, createRender2dTexture, useFBO, Render3dTextureOptions, Render3dTexture, ShadertoyTextureItemOptions, ShadertoyTextureOptions, ShadertoyTexture, BufferShader, CharInfo, AtlasData, CharLayoutInfo, LayoutInfo, FontManagerOptions, FontManager, LabelMaterial, Label, LabelPool, LabelOptions, createLabel, ExtrudePath, ExtrudeMeshProps, ExtrudeMesh, MeshLineGeometry, MeshLineMaterial, MeshLine, PathPointList, PathGeometry, PathTubeGeometry, PathTubeEntitiesOptions, PathTubeEntities, BillboardProps, BillboardType, Billboard, Outlines, OutlinesProps, OutlinesType, TextProps, TextType, createTextMesh, SpriteAnimatorProps, SpriteAnimatorType, createSpriteAnimator, TrailLineOptions, TrailLine, Line2, LineGeometry, LineMaterialParameters, LineMaterial, LineSegments2, LineSegmentsGeometry, Wireframe, WireframeGeometry2, SpriteMarkerOptions, SpriteMarker, SpriteImageItemData, SpriteImageItem, SpriteImagesOptions, SpriteImages, SpriteTextItemData, SpriteTextItem, SpriteTextsOptions, SpriteTexts, AnimationClipOptions, AnimatorOptions, Animator, PlaneConfig, ScreenQuad, BoxHelperOptions, BoxHelper, HeatmapOptions, Heatmap, ReflectorBlurMaterial, ReflectorObject, createReflectorShaderMesh, MeasureRulerOptions, creataMeasureRuler, Environment, PackedMipMapGenerator, FullScreenQuad, DynamicEnvConfig, DynamicEnvironment, createFlyline, createMapApp, map2dUtils, MapThreeLayerOptions, MapThreeLayer, VariableTubeGeometry, HyperbolicHelicoidGeometry, SphubeGeometry, createWallBufferGeometry, MapView, LODControl, LODRaycast, MapProvider, MapNodeGeometry, MapNodeHeightGeometry, MapNode, QuadTreePosition, MapHeightNode, MapPlaneNode, UnitsUtils, MapUtils, CanvasUtils, CancelablePromise, XHRUtils, TextureUtils, MapViewEntity, AllowedTypes, Omitype, PickType, TransformType, TransformedTypes, FilteredType, Motion, MotionConfig, EasingFunction, Easing, DEFAULT_EASING, Easings, RunningTween, Tween, TweenManager, animation, animationAsync, MeshEntityOptions, MeshEntity, InstancedMeshEntityOptions, InstancedMeshEntity, SymbolEntityOptions, SymbolEntity, SpriteAnimatorEntityOptions, SpriteAnimatorEntity, PolylinesEntityOptions, PolylinesEntity, PolygonsEntityOptions, PolygonsEntity, FillExtrusionsEntityOptions, FillExtrusionsEntity, GlLinesEntityOptions, GlLinesEntity, SpriteMarkerEntityOptions, SpriteMarkerEntity, SpriteImagesEntityOptions, SpriteImagesEntity, SpriteTextsEntityOptions, SpriteTextsEntity, TrailLineEntityOptions, TrailLineEntity, MetaData, ParticleEmitter, IParticle, Particle, NodeParticle, SpriteParticle, RecordState, TrailParticle, BurstParameters, BurstParametersJSON, ParticleSystemParameters, ParticleSystemJSONParameters, JsonMetaData, EmissionState, ParticleSystem, StoredBatchSettings, RenderMode, VFXBatch, SpriteBatch, TrailBatch, VFXBatchSettings, SerializationOptions, RendererEmitterSettings, StretchedBillBoardSettings, BillBoardSettings, TrailSettings, MeshSettings, IParticleSystem, BatchedRenderer, ParticleLoader, Constructable, FieldType, ParameterType, ParameterPair, loadParticlePlugin, unloadParticlePlugin, ParticlePlugin, ParticlePlugins, getValueFromEmitterMode, ShapeJSON, EmitterMode, EmitterShape, ConeEmitterParameters, ConeEmitter, CircleEmitterParameters, CircleEmitter, DonutEmitterParameters, DonutEmitter, PointEmitter, SphereEmitterParameters, SphereEmitter, HemisphereEmitterParameters, HemisphereEmitter, GridEmitterParameters, GridEmitter, MeshSurfaceEmitter, EmitterFromJSON, EmitterShapeParticlePlugin, EmitterShapes, Bezier, ColorGeneratorFromJSON, ColorGenerator, FunctionColorGenerator, MemorizedFunctionColorGenerator, ConstantColor, ColorRange, ConstantValue, FunctionJSON, Gradient, RandomColorBetweenGradient, IntervalValue, PiecewiseBezier, PiecewiseFunction, RandomColor, ValueGeneratorFromJSON, ValueGenerator, FunctionValueGenerator, RandomQuatGenerator, AxisAngleGenerator, RotationGeneratorFromJSON, RotationGenerator, EulerGenerator, GeneratorFromJSON, ColorOverLife, RotationOverLife, Rotation3DOverLife, ForceOverLife, SizeOverLife, SpeedOverLife, FrameOverLife, OrbitOverLife, WidthOverLength, ApplyForce, GravityForce, ChangeEmitDirection, SubParticleEmitMode, EmitSubParticleSystem, TurbulenceField, Noise, ApplySequences, setPhysicsResolver, getPhysicsResolver, ApplyCollision, ColorBySpeed, SizeBySpeed, RotationBySpeed, LimitSpeedOverLife, SimulationFromJSON, Simulation, SimulationParticlePlugin, SimulationTypes, TextureSequencer, SequencerFromJSON, Sequencer, Interpreter, NodeData, Node_2 as Node, ConstInput, Wire, Adapter, NodeTypes, OutputNodeTypeNames, NodeGraph, ExecutionContext, NodeTypeSignature, NodeType, NodeDef, GraphNodeType, NodeValueType, getAlignOfNodeValueType, getSizeOfNodeValueType, genDefaultForNodeValueType, VFXParameters, NodeVFX, WebGPUCompiler, registerShaderChunks, CubeEmitterParameters, CubeEmitter, PathEmitterParameters, PathEmitter, SetEmitDirection, ApplyRoute, BehaviorContext, BehaviorStatus, Behavior, AbstractDecoratorBehavior, ConditionalBehavior, LogMessageBehavior, SendEventBehavior, ActionBehavior, DelayBehavior, ParallelBehaviorPolicy, ParallelBehavior, SequenceBehavior, DestoryBehavior, PromiseBehavior, SucceedingBehavior, FailingBehavior, RepeatBehavior, WaitForEventBehavior, BranchBehavior, FilterBehavior, RepeatUntilFailureBehavior, CompositeBehavior, IgnoreFailureBehavior, RepeatUntilSuccessBehavior, ConditionBehavior, InvertStatusBehavior, SelectorBehavior, RotationBehavior, AnimationTrackPlayback, AnimationTrack, AnimationBehavior, TLEventHandler, TLEventType, TLEnterEventHandler, TLExitEventHandler, TLStateNodeConstructor, StateNode, DefaultTool, DrawShapeTool, TransformControlsPointerObject, TransformControls, TransformControlsGizmo, TransformControlsPlane, TransformEnterOptions, TransformTool, PickEnterOptions, PickTool, ICommand, ICommandCallback, BaseCommand, SetMaterialMapCommand, IHasUpdate, SetValueCommand, UpdateValueCommand, CallFunctionCommand, SetMultipleValuesCommand, CommandHistory, MultiCmdsCommand, SetRotationCommand, SetPositionCommand, PushValueCommand, SetScaleCommand, IHasDataEntity, SetDataCommand, AddObject3DCommand, Anchor, anchorTranslate, anchorOrigin, Marker2dOptions, createDefaultMarkerElement, Marker2D, PopopOffset, PopupOptions, Popup2D, Marker3dOptions, Marker3D, AnimateMarkerType, AnimateMarkerLayerOption, AnimateMarkerBase, BreathingApertureMarker, DiffusedApertureMarker, FluorescenceMarker, HaloRingMarker, RotatingApertureMarker, RotatingTextBorderMarker, ContextMenuSubItemOptions, ContextMenuOptions, ContextMenu, ButtonGroupControlOptions, ButtonGroupControl, MousePositionControlOption, MousePositionControl, FullscreenControlOptions, FullscreenControl, MiniMapControlOption, MiniMapControl, UiConfigRendererBase, UiConfigMethods, UiConfigContainer, IUiConfigContainer, UiObjectConfig, UiObjectType, TUiRefreshModes, ChangeArgs, ChangeEvent, uiConfig, uiContainer, uiMonitor, uiSlider, uiVector, uiDropdown, uiButton, uiInput, uiColor, uiImage, uiToggle, uiNumber, uiPanelContainer, uiFolderContainer, generateUiConfig, generateUiFolder, UiConfigTypeMap, TParams, UiPanelJsonConfig, makeObject3DUiConfig, makeSamplerUi, getEmptyMeta, iMaterialUI, makeBasicMaterialUiConfig, makePhongMaterialUiConfig, makePhysicalMaterialUiConfig, makeMaterialUiConfig, makeGeomertyUiConfig, makeCameraUiConfig, makeLightUiConfig, encryptToBase64, decryptFromBase64, tea, MapOpenWay, IMapStyleParam, IOpenMapBaseParam, IOpenMapParam, IUpdateMapParam, IOpenMapResponse, ITileUrlParam, IQueryBaseFeatures, IPointQueryFeatures, IRectQueryFeatures, IExprQueryFeatures, IConditionQueryFeatures, IMapLayer, IUpdateStyle, ISliceLayer, ISliceCacheZoom, IWmsTileUrl, IDeleteStyle, IDeleteCache, IExportLayout, IMatchObject, IExtractTable, ISplitChildMaps, IComposeNewMap, IMapDiff, ICreateEntitiesGeomData, IWorkspace, openMapDarkStyle, openMapLightStyle, Service, Config, Response_2 as Response, IRequest, httpHelper, loadPhysicsEngine, CANNON, BoxParameters, CylinderParameters, SphereParameters, ConvexPolyhedronParameters, TrimeshParameters, ShapeType2, ShapeOptions, ShapeParameters, ShapeResult, getShapeParameters, threeToCannon } } export class WaitForEventBehavior extends Behavior { #private; event: string; data: any; target: any; detected: boolean; constructor(); fromJSON(json: { event: string; target?: any; }): void; /** * * @param json * @return {WaitForEventBehavior} */ static fromJSON(json: { event: string; target?: any; }): WaitForEventBehavior; tick(timeDelta?: number): BehaviorStatus.Running | BehaviorStatus.Succeeded; /** * @private */ listener(): void; initialize(context: BehaviorContext): void; finalize(): void; } function watch = false>(sources: [...T], cb: WatchCallback, MapSources>, options?: WatchOptions): WatchStopHandle; function watch, Immediate extends Readonly = false>(source: T, cb: WatchCallback, MapSources>, options?: WatchOptions): WatchStopHandle; function watch = false>(source: WatchSource, cb: WatchCallback, options?: WatchOptions): WatchStopHandle; function watch = false>(source: T, cb: WatchCallback, options?: WatchOptions): WatchStopHandle; type WatchCallback = (value: V, oldValue: OV, onCleanup: OnCleanup) => any; type WatchEffect = (onCleanup: OnCleanup) => void; function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle; interface WatchOptions extends WatchOptionsBase { immediate?: Immediate; deep?: boolean; } interface WatchOptionsBase { flush?: "pre" | "sync"; } type WatchSource = Ref | ComputedRef | (() => T); type WatchStopHandle = () => void; function watchSyncEffect(effect: WatchEffect): WatchStopHandle; type WeakCollections = WeakMap | WeakSet; export class WebGLRendererModule extends AppModuleBase implements IAppModuleBase { #private; static moduleName: string; options: WebGLRendererModuleOptions; _commonUniforms: { time: Uniform_2; resolution: Uniform_2; iGlobalTime: Uniform_2; iTime: Uniform_2; iTimeDelta: Uniform_2; iResolution: Uniform_2; iMouse: Uniform_2; iFrame: Uniform_2; iDate: Uniform_2; iSampleRate: Uniform_2; iChannelTime: Uniform_2<[number, number, number, number]>; }; constructor(app?: App, options?: WebGLRendererModuleOptions); getScreenshot(params?: Screenshot): Promise; get renderer(): any; get isMapMode(): boolean; get commonUniforms(): { time: Uniform_2; resolution: Uniform_2; iGlobalTime: Uniform_2; iTime: Uniform_2; iTimeDelta: Uniform_2; iResolution: Uniform_2; iMouse: Uniform_2; iFrame: Uniform_2; iDate: Uniform_2; iSampleRate: Uniform_2; iChannelTime: Uniform_2<[number, number, number, number]>; }; onAwake(): void; onAppRender(time: Time): void; setupUiConfig(): UiObjectConfig; } export interface WebGLRendererModuleOptions extends WebGLRendererParameters { clearColor?: ColorRepresentation; clearColorAlpha?: number; pixelRatio?: number; renderUpdate?: boolean; autoClear?: boolean; stylePosition?: string; } export class WebGPUCompiler extends BaseCompiler { run(graph: NodeGraph, context: ExecutionContext): void; constructor(); protected nodeResult: Map; particleInstanceByteSize: number; hasRandom: boolean; private calculateMemoryLayout; private buildPredefinedStructs; private buildHeader; private buildFooter; private buildWebGPUCode; private buildDataFlow; build(graph: NodeGraph, context: ExecutionContext): string; private buildFromValue; private getTypeFromNodeType; private buildFromAdapter; private getResult; } /** * WheelInfo */ class WheelInfo { /** * Max travel distance of the suspension, in meters. * @default 1 */ maxSuspensionTravel: number; /** * Speed to apply to the wheel rotation when the wheel is sliding. * @default -0.1 */ customSlidingRotationalSpeed: number; /** * If the customSlidingRotationalSpeed should be used. * @default false */ useCustomSlidingRotationalSpeed: boolean; /** * sliding */ sliding: boolean; /** * Connection point, defined locally in the chassis body frame. */ chassisConnectionPointLocal: Vec3; /** * chassisConnectionPointWorld */ chassisConnectionPointWorld: Vec3; /** * directionLocal */ directionLocal: Vec3; /** * directionWorld */ directionWorld: Vec3; /** * axleLocal */ axleLocal: Vec3; /** * axleWorld */ axleWorld: Vec3; /** * suspensionRestLength * @default 1 */ suspensionRestLength: number; /** * suspensionMaxLength * @default 2 */ suspensionMaxLength: number; /** * radius * @default 1 */ radius: number; /** * suspensionStiffness * @default 100 */ suspensionStiffness: number; /** * dampingCompression * @default 10 */ dampingCompression: number; /** * dampingRelaxation * @default 10 */ dampingRelaxation: number; /** * frictionSlip * @default 10.5 */ frictionSlip: number; /** forwardAcceleration */ forwardAcceleration: number; /** sideAcceleration */ sideAcceleration: number; /** * steering * @default 0 */ steering: number; /** * Rotation value, in radians. * @default 0 */ rotation: number; /** * deltaRotation * @default 0 */ deltaRotation: number; /** * rollInfluence * @default 0.01 */ rollInfluence: number; /** * maxSuspensionForce */ maxSuspensionForce: number; /** * engineForce */ engineForce: number; /** * brake */ brake: number; /** * isFrontWheel * @default true */ isFrontWheel: boolean; /** * clippedInvContactDotSuspension * @default 1 */ clippedInvContactDotSuspension: number; /** * suspensionRelativeVelocity * @default 0 */ suspensionRelativeVelocity: number; /** * suspensionForce * @default 0 */ suspensionForce: number; /** * slipInfo */ slipInfo: number; /** * skidInfo * @default 0 */ skidInfo: number; /** * suspensionLength * @default 0 */ suspensionLength: number; /** * sideImpulse */ sideImpulse: number; /** * forwardImpulse */ forwardImpulse: number; /** * The result from raycasting. */ raycastResult: WheelRaycastResult; /** * Wheel world transform. */ worldTransform: Transform; /** * isInContact */ isInContact: boolean; constructor(options?: { /** * Connection point, defined locally in the chassis body frame. */ chassisConnectionPointLocal?: Vec3; /** * chassisConnectionPointWorld */ chassisConnectionPointWorld?: Vec3; /** * directionLocal */ directionLocal?: Vec3; /** * directionWorld */ directionWorld?: Vec3; /** * axleLocal */ axleLocal?: Vec3; /** * axleWorld */ axleWorld?: Vec3; /** * suspensionRestLength * @default 1 */ suspensionRestLength?: number; /** * suspensionMaxLength * @default 2 */ suspensionMaxLength?: number; /** * radius * @default 1 */ radius?: number; /** * suspensionStiffness * @default 100 */ suspensionStiffness?: number; /** * dampingCompression * @default 10 */ dampingCompression?: number; /** * dampingRelaxation * @default 10 */ dampingRelaxation?: number; /** * frictionSlip * @default 10.5 */ frictionSlip?: number; /** forwardAcceleration */ forwardAcceleration?: number; /** sideAcceleration */ sideAcceleration?: number; /** * steering * @default 0 */ steering?: number; /** * Rotation value, in radians. * @default 0 */ rotation?: number; /** * deltaRotation * @default 0 */ deltaRotation?: number; /** * rollInfluence * @default 0.01 */ rollInfluence?: number; /** * maxSuspensionForce */ maxSuspensionForce?: number; /** * isFrontWheel * @default true */ isFrontWheel?: boolean; /** * clippedInvContactDotSuspension * @default 1 */ clippedInvContactDotSuspension?: number; /** * suspensionRelativeVelocity * @default 0 */ suspensionRelativeVelocity?: number; /** * suspensionForce * @default 0 */ suspensionForce?: number; /** * slipInfo */ slipInfo?: number; /** * skidInfo * @default 0 */ skidInfo?: number; /** * suspensionLength * @default 0 */ suspensionLength?: number; /** * Max travel distance of the suspension, in meters. * @default 1 */ maxSuspensionTravel?: number; /** * If the customSlidingRotationalSpeed should be used. * @default false */ useCustomSlidingRotationalSpeed?: boolean; /** * Speed to apply to the wheel rotation when the wheel is sliding. * @default -0.1 */ customSlidingRotationalSpeed?: number; }); updateWheel(chassis: Body_2): void; } type WheelInfoOptions = ConstructorParameters[0]; type WheelRaycastResult = RaycastResult & Partial<{ suspensionLength: number; directionWorld: Vec3; groundObject: number; }>; /** * Apply width to particles based on their length. */ export class WidthOverLength implements Simulation { width: FunctionValueGenerator; type: string; initialize(particle: Particle): void; constructor(width: FunctionValueGenerator); update(particle: Particle): void; frameUpdate(delta: number): void; toJSON(): any; static fromJSON(json: any): Simulation; clone(): Simulation; reset(): void; } export class Wire { input: Node_2 | Adapter; inputIndex: number; output: Node_2 | Adapter; outputIndex: number; constructor(input: Node_2 | Adapter, inputIndex: number, output: Node_2 | Adapter, outputIndex: number); } export class Wireframe extends Mesh { constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); computeLineDistances(): this; } export class WireframeGeometry2 extends LineSegmentsGeometry { constructor(geometry: any); } type WithThisType any, This> = (this: This, ...args: Parameters) => ReturnType; export function workerLink(): any; export function workerProxy(obj: any): any; export function workerTransfer(obj: any, transfers: any): any; export function workerWrap(ep: Worker, target?: any): any; /** * The physics world */ class World extends EventTarget_2 { /** * Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is "fresh" inside event callbacks. */ dt: number; /** * Makes bodies go to sleep when they've been inactive. * @default false */ allowSleep: boolean; /** * All the current contacts (instances of ContactEquation) in the world. */ contacts: ContactEquation[]; frictionEquations: FrictionEquation[]; /** * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong). * @default 0 */ quatNormalizeSkip: number; /** * Set to true to use fast quaternion normalization. It is often enough accurate to use. * If bodies tend to explode, set to false. * @default false */ quatNormalizeFast: boolean; /** * The wall-clock time since simulation start. */ time: number; /** * Number of timesteps taken since start. */ stepnumber: number; /** * Default and last timestep sizes. */ default_dt: number; nextId: number; /** * The gravity of the world. */ gravity: Vec3; /** * Gravity to use when approximating the friction max force (mu \* mass \* gravity). * If undefined, global gravity will be used. * Use to enable friction in a World with a null gravity vector (no gravity). */ frictionGravity?: Vec3; /** * The broadphase algorithm to use. * @default NaiveBroadphase */ broadphase: Broadphase; /** * All bodies in this world */ bodies: Body_2[]; /** * True if any bodies are not sleeping, false if every body is sleeping. */ hasActiveBodies: boolean; /** * The solver algorithm to use. * @default GSSolver */ solver: Solver; constraints: Constraint[]; narrowphase: Narrowphase; /** * collisionMatrix */ collisionMatrix: ArrayCollisionMatrix; /** * CollisionMatrix from the previous step. */ collisionMatrixPrevious: ArrayCollisionMatrix; bodyOverlapKeeper: OverlapKeeper; shapeOverlapKeeper: OverlapKeeper; /** * All added contactmaterials. */ contactmaterials: ContactMaterial[]; /** * Used to look up a ContactMaterial given two instances of Material. */ contactMaterialTable: TupleDictionary; /** * The default material of the bodies. */ defaultMaterial: Material_2; /** * This contact material is used if no suitable contactmaterial is found for a contact. */ defaultContactMaterial: ContactMaterial; doProfiling: boolean; profile: { solve: number; makeContactConstraints: number; broadphase: number; integrate: number; narrowphase: number; }; /** * Time accumulator for interpolation. * @see https://gafferongames.com/game-physics/fix-your-timestep/ */ accumulator: number; subsystems: any[]; /** * Dispatched after a body has been added to the world. */ addBodyEvent: { type: 'addBody'; body: Body_2 | null; }; /** * Dispatched after a body has been removed from the world. */ removeBodyEvent: { type: 'removeBody'; body: Body_2 | null; }; idToBodyMap: { [id: number]: Body_2; }; lastCallTime?: number; constructor(options?: { /** * The gravity of the world. */ gravity?: Vec3; /** * Gravity to use when approximating the friction max force (mu*mass*gravity). * If undefined, global gravity will be used. */ frictionGravity?: Vec3; /** * Makes bodies go to sleep when they've been inactive. * @default false */ allowSleep?: boolean; /** * The broadphase algorithm to use. * @default NaiveBroadphase */ broadphase?: Broadphase; /** * The solver algorithm to use. * @default GSSolver */ solver?: Solver; /** * Set to true to use fast quaternion normalization. It is often enough accurate to use. * If bodies tend to explode, set to false. * @default false */ quatNormalizeFast?: boolean; /** * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong). * @default 0 */ quatNormalizeSkip?: number; }); /** * Get the contact material between materials m1 and m2 * @return The contact material if it was found. */ getContactMaterial(m1: Material_2, m2: Material_2): ContactMaterial; /** * Store old collision state info */ collisionMatrixTick(): void; /** * Add a constraint to the simulation. */ addConstraint(c: Constraint): void; /** * Removes a constraint */ removeConstraint(c: Constraint): void; /** * Raycast test * @deprecated Use .raycastAll, .raycastClosest or .raycastAny instead. */ rayTest(from: Vec3, to: Vec3, result: RaycastResult | RaycastCallback): void; /** * Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument. * @return True if any body was hit. */ raycastAll(from?: Vec3, to?: Vec3, options?: RayOptions, callback?: RaycastCallback): boolean; /** * Ray cast, and stop at the first result. Note that the order is random - but the method is fast. * @return True if any body was hit. */ raycastAny(from?: Vec3, to?: Vec3, options?: RayOptions, result?: RaycastResult): boolean; /** * Ray cast, and return information of the closest hit. * @return True if any body was hit. */ raycastClosest(from?: Vec3, to?: Vec3, options?: RayOptions, result?: RaycastResult): boolean; /** * Add a rigid body to the simulation. * @todo If the simulation has not yet started, why recrete and copy arrays for each body? Accumulate in dynamic arrays in this case. * @todo Adding an array of bodies should be possible. This would save some loops too */ addBody(body: Body_2): void; /** * Remove a rigid body from the simulation. */ removeBody(body: Body_2): void; getBodyById(id: number): Body_2; /** * @todo Make a faster map */ getShapeById(id: number): Shape | null; /** * Adds a contact material to the World */ addContactMaterial(cmat: ContactMaterial): void; /** * Removes a contact material from the World. */ removeContactMaterial(cmat: ContactMaterial): void; /** * Step the simulation forward keeping track of last called time * to be able to step the world at a fixed rate, independently of framerate. * * @param dt The fixed time step size to use (default: 1 / 60). * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). * @see https://gafferongames.com/post/fix_your_timestep/ * @example * // Run the simulation independently of framerate every 1 / 60 ms * world.fixedStep() */ fixedStep(dt?: number, maxSubSteps?: number): void; /** * Step the physics world forward in time. * * There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take. * * @param dt The fixed time step size to use. * @param timeSinceLastCalled The time elapsed since the function was last called. * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F * @example * // fixed timestepping without interpolation * world.step(1 / 60) */ step(dt: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; internalStep(dt: number): void; emitContactEvents(): void; /** * Sets all body forces in the world to zero. */ clearForces(): void; } type WorldOptions = ConstructorParameters[0]; interface WritableArrayLike { readonly length: number; [n: number]: T; } interface WritableComputedOptions { get: ComputedGetter; set: ComputedSetter; } interface WritableComputedRef extends Ref { readonly effect: ReactiveEffect; } /** * XHR utils contains public static methods to allow easy access to services via XHR. */ export class XHRUtils { /** * Get file data from URL as text, using a XHR call. * * @param url - Target for the request. * @param onLoad - On load callback. * @param onError - On progress callback. */ static get(url: string): Promise; /** * Get raw file data from URL, using a XHR call. * * @param url - Target for the request. * @param onLoad - On load callback. * @param onError - On progress callback. */ static getRaw(url: string): Promise; /** * Perform a request with the specified configuration. * * Syncronous request should be avoided unless they are strictly necessary. * * @param url - Target for the request. * @param type - Resquest type (POST, GET, ...) * @param header - Object with data to be added to the request header. * @param body - Data to be sent in the resquest. * @param onLoad - On load callback, receives data (String or Object) and XHR as arguments. * @param onError - XHR onError callback. */ static request(url: string, type: string, header?: any, body?: any, onLoad?: Function, onError?: Function, onProgress?: Function): XMLHttpRequest; } type ZREventProperties = { zrX: number; zrY: number; zrDelta: number; zrEventControl: 'no_globalout' | 'only_globalout'; zrByTouch: boolean; }; class ZRImage extends Displayable { style: ImageStyleProps; __image: ImageLike; __imageSrc: string; onload: (image: ImageLike) => void; /** * Create an image style object with default values in it's prototype. * @override */ createStyle(obj?: ImageStyleProps): ImageStyleProps; private _getSize; getWidth(): number; getHeight(): number; getAnimationStyleProps(): MapToType; getBoundingRect(): BoundingRect; } type ZRRawEvent = ZRRawMouseEvent | ZRRawTouchEvent | ZRRawPointerEvent; type ZRRawMouseEvent = MouseEvent & ZREventProperties; type ZRRawPointerEvent = TouchEvent & ZREventProperties; type ZRRawTouchEvent = TouchEvent & ZREventProperties; interface ZRText { animate(key?: '', loop?: boolean): Animator_2; animate(key: 'style', loop?: boolean): Animator_2; getState(stateName: string): TextState; ensureState(stateName: string): TextState; states: Dictionary; stateProxy: (stateName: string) => TextState; } class ZRText extends Displayable implements GroupLike { type: string; style: TextStyleProps; /** * How to handling label overlap * * hidden: */ overlap: 'hidden' | 'show' | 'blur'; /** * Will use this to calculate transform matrix * instead of Element itseelf if it's give. * Not exposed to developers */ innerTransformable: Transformable; private _children; private _childCursor; private _defaultStyle; constructor(opts?: TextProps_2); childrenRef(): (ZRImage | Rect | TSpan)[]; update(): void; updateTransform(): void; getLocalTransform(m?: MatrixArray): MatrixArray; getComputedTransform(): MatrixArray; private _updateSubTexts; addSelfToZr(zr: Render2dType): void; removeSelfFromZr(zr: Render2dType): void; getBoundingRect(): BoundingRect; setDefaultTextStyle(defaultTextStyle: DefaultTextStyle): void; setTextContent(textContent: never): void; protected _mergeStyle(targetStyle: TextStyleProps, sourceStyle: TextStyleProps): TextStyleProps; private _mergeRich; getAnimationStyleProps(): MapToType; private _getOrCreateChild; private _updatePlainTexts; private _updateRichTexts; private _placeToken; private _renderBackground; static makeFont(style: TextStylePropsPart): string; } namespace zrUtil { export { guid, logError, clone_3 as clone, merge, mergeAll, extend_2 as extend, defaults, indexOf, inherits, mixin, isArrayLike, each, map, reduce, filter, find, keys, isArray, isFunction, isString, isStringSafe, isNumber, isObject, isBuiltInObject, isTypedArray, isDom, isGradientObject, isImagePatternObject, isRegExp, eqNaN, retrieve, retrieve2, retrieve3, slice, normalizeCssArray, assert, trim, setAsPrimitive, isPrimitive, createHashMap, concatArray, createObject, disableUserSelect, hasOwn, noop, createCanvas, Bind1, Bind2, Bind3, Bind4, Bind5, bind, Curry1, Curry2, Curry3, Curry4, curry, HashMap, RADIAN_TO_DEGREE } } export { } }