UNPKG

@maptalks/gl

Version:

WebGL infrastrcture for maptalks

1,564 lines (1,496 loc) 90.3 kB
/// <reference types="gl-matrix" /> /// <reference types="@webgpu/types" /> /// <reference types="gl-matrix/index.js" /> /*! * @maptalks/gl v0.118.1 * LICENSE : UNLICENSED * (c) 2016-2025 maptalks.com */ import * as REGL from '@maptalks/regl'; import REGL__default, { Texture, Texture2DOptions, TextureImageData, Regl, Texture2D as Texture2D$1, Uniforms } from '@maptalks/regl'; export { default as createREGL } from '@maptalks/regl'; import * as gl_matrix from 'gl-matrix'; import { vec3, mat4, glMatrix, mat2, mat2d, mat3, quat, quat2, vec2, vec4 } from 'gl-matrix'; export { mat2, mat2d, mat3, mat4, quat, quat2, vec2, vec3, vec4 } from 'gl-matrix'; import * as maptalks from 'maptalks'; import { Polygon, LayerJSONType, renderer, Layer, MixinConstructor, Extent } from 'maptalks'; export { GLContext } from '@maptalks/fusiongl'; export { default as earcut } from 'earcut'; export { default as color } from 'color'; declare const TerrainLayer_base: { new (...args: any[]): { _maskProjViewMatrix: gl_matrix.mat4; _maskExtentInWorld: [number, number, number, number]; removeMask(masks: any): any; setMask(masks: any): any; onAdd(): void; getMasks(): any; onGeometryEvent(param: any): void; identifyMask(point: any, options: any): any[]; remove(): void; updateMask(extent: any): { projViewMatrix: gl_matrix.mat4; extentInWorld: [number, number, number, number]; }; getProjViewMatrixInOrtho(extent: any): { mapExtent: any; projViewMatrix: gl_matrix.mat4; }; updateMaskExtent(): void; getMaskExtent(): { extent: maptalks.Extent; ratio: number; minHeight: any; }; }; } & typeof maptalks.TileLayer; declare class TerrainLayer extends TerrainLayer_base { constructor(id: any, options: any); onAdd(): void; getTileUrl(x: any, y: any, z: any): string; _skuToken: string; _createSkuToken(): string; _getExaggeration(): any; setSkinLayers(skinLayers: any): void; _skinLayers: any; getSkinTiles(layer: any): { tileGrids: any[]; count: number; }; getSkinLayer(index: any): any; getSkinLayers(): any; getSkinCount(): any; queryTerrainByProjCoord(prjCoord: any, out: any): any; queryTileTerrainByProjCoord(prjCoord: any, tileId: any, tileIndex: any, out: any): any; queryTileTerrainByPointAtRes(point: any, res: any, tileId: any, tileIndex: any, out: any): any; queryTerrain(coordinate: any, out: any): any; queryTileMesh(tile: any, cb: any): void; getTerrainTiles(layer: any, tileInfo: any): any; isTerrainTileLoaded(tileId: any): boolean; updateMaterial(mat: any): void; setMaterial(mat: any): void; _createTileNode(x: any, y: any, z: any, idx: any, idy: any, res: any, error: any, parentId: any, extent2d: any, tileId: any): { parent: any; layer: string; x: any; y: any; z: any; idx: any; idy: any; res: any; extent2d: any; id: any; url: string; offset: any; error: any; children: any[]; }; } declare class GraphicsFramebuffer { device: GraphicsDevice; options: any; width: number; height: number; constructor(device: any, options: any); get color(): GraphicsTexture[]; resize(width: any, height: any): void; _update(): void; getRenderPassDescriptor(): GPURenderPassDescriptor; setClearOptions(options: any): void; _resetClearOptions(): void; destroy(): void; } declare class GraphicsDevice { wgpu: GPUDevice; context: GPUCanvasContext; adapter: GPUAdapter; gltfManager?: any; constructor(device: GPUDevice, context: GPUCanvasContext, adapter: GPUAdapter); hasExtension(extension: any): boolean; getCommandEncoder(): GPUCommandEncoder; endCommandEncoder(): void; getDefaultFramebuffer(): GraphicsFramebuffer; getRenderPassEncoder(fbo: GraphicsFramebuffer): GPURenderPassEncoder; addCommandBuffer(commandBuffer: GPUCommandBuffer, front: boolean): void; submit(): void; preserveDrawingBuffer(canvas: any): void; buffer(options: any): any; elements(options: any): any; framebuffer(width: any, height: any): GraphicsFramebuffer; texture(width: any, height?: any): GraphicsTexture; clear(options: any): void; read(options: any): any; destroy(): void; incrDrawCall(): void; resetDrawCalls(): void; getDrawCalls(): 0; _renderToClear(fbo: any): void; _getEmptyPipeline(fbo: any): any; } declare class GraphicsTexture { texture: GPUTexture; device: GraphicsDevice; config: any; constructor(device: GraphicsDevice, config: any); get width(): any; get height(): any; updateFilter(): void; _clearBindGroups(): void; resize(width: any, height: any): void; update(config: any): void; _updateTexture(): void; getView(descriptor?: GPUTextureViewDescriptor): GPUTextureView; addBindGroup(bindGroup: any): void; destroy(): void; } type UrlModifierFunction = (url: string) => string; type TypedArray = Uint8Array | Uint16Array | Uint32Array | Int8Array | Int16Array | Float32Array; type NumberArray = TypedArray | number[]; type AttributeData = NumberArray | any; type GeometryDesc = { 'positionSize'?: number; 'primitive'?: REGL__default.PrimitiveType; 'positionAttribute'?: string; 'normalAttribute'?: string; 'uv0Attribute'?: string; 'uv1Attribute'?: string; 'color0Attribute'?: string; 'colorAttribute'?: string; 'tangentAttribute'?: string; 'pickingIdAttribute'?: string; 'textureCoordMatrixAttribute'?: string; 'altitudeAttribute'?: string; 'fillEmptyDataInMissingAttribute'?: boolean; 'static'?: boolean; }; type AttributeKey = { key: string; }; type ActiveAttributes = { name: string; type: number; }[] & AttributeKey; type ShaderUniformValue = number | boolean | string | NumberArray | null | ShaderUniformTexture; type ShaderUniformTexture = AbstractTexture | Texture | GraphicsTexture; type ShaderUniforms = { meshConfig?: MeshOptions; primitive?: REGL__default.PrimitiveType; } & { [_: string]: ShaderUniformValue; }; type ShaderDefines = { [_: string]: number | string; }; type MeshOptions = { transparent?: boolean; bloom?: boolean; ssr?: boolean; castShadow?: boolean; picking?: boolean; disableVAO?: boolean; }; type AttributeBufferData = { buffer?: REGL__default.Buffer; data?: NumberArray; divisor?: number; }; type AttributeType = NumberArray | REGL__default.Buffer | AttributeBufferData; type InstancedAttribute = Record<string, AttributeType>; type ImageObject = { array: TextureImageData; width: number; height: number; }; type TextureConfig = { url?: string; image?: ImageObject; hdr?: boolean; /** * hdr 纹理的最大 RGBMRange,默认为9 * @english * max RGBMRange for hdr texture, default is 9 */ maxRange?: number; promise?: Promise<any>; persistent?: boolean; compare?: GPUCompareFunction; } & Texture2DOptions; type HandlerFnResultType = { type: string; target: any; [propName: string]: any; }; type BaseEventParamsType = { type?: string; target?: any; [propName: string]: any; }; type HandlerFn = (result?: HandlerFnResultType) => void | boolean; type CachedResource = { image: any; count: number; }; type PromiseResource = { url: string; data: any; }; declare class InnerResourceLoader { defaultTexture?: Uint8Array; defaultCubeTexture: number[]; urlModifier?: UrlModifierFunction; resources: Record<string, CachedResource>; constructor(DEFAULT_TEXTURE: Uint8Array, urlModifier?: UrlModifierFunction); setURLModifier(urlModifier: UrlModifierFunction): void; get(url: string | string[]): Promise<PromiseResource[]> | Promise<PromiseResource>; getArrayBuffer(url: string | string[]): Promise<PromiseResource | PromiseResource[]>; disposeRes(url: string | string[]): this; isLoading(): boolean; getDefaultTexture(url: string | string[]): Uint8Array | number[]; } declare const ResourceLoader_base: { new (...args: any[]): { _events: Record<string, BaseEventParamsType>; on(type: string, handler: HandlerFn): any; once(type: string, handler: HandlerFn): any; off(type: string, handler: HandlerFn): any; fire(type: string, params?: BaseEventParamsType): any; _wrapOnce(type: string, handler: HandlerFn): (params: any) => void; }; } & typeof InnerResourceLoader; declare class ResourceLoader extends ResourceLoader_base { } //# sourceMappingURL=ResourceLoader.d.ts.map declare class Base$1 { } declare const AbstractTexture_base: { new (...args: any[]): { _events: Record<string, BaseEventParamsType>; on(type: string, handler: HandlerFn): any; once(type: string, handler: HandlerFn): any; off(type: string, handler: HandlerFn): any; fire(type: string, params?: BaseEventParamsType): any; _wrapOnce(type: string, handler: HandlerFn): (params: any) => void; }; } & typeof Base$1; /** * Abstract Texture * Common methods for Texture2D and TextureCube * @abstract */ declare class AbstractTexture extends AbstractTexture_base { config: TextureConfig; promise?: Promise<any>; resLoader: ResourceLoader; dirty?: boolean; constructor(config: any, resLoader?: any); onLoad(data: any): void; isReady(): boolean; set(k: string, v: any): this; get(k: string): any; createREGLTexture(regl: Regl): null | Texture2D$1; getREGLTexture(regl: any): any; getMemorySize(): number; _update(): void; dispose(): void; } declare class BoundingBox { min: vec3; max: vec3; vertex?: vec3[]; center: vec3; constructor(min?: vec3, max?: vec3); static copy(out: BoundingBox, bbox: BoundingBox): BoundingBox; combine(bbox: number[] | BoundingBox): this; dirty(): this; /** * Get center of the bounding box * @returns {Number[]} center */ getCenter(): vec3; /** * 判断BBox是否包含给定的坐标 * @english * If contain point entirely * @param point */ containPoint(p: number): boolean; /** * BBox的值是否是Infinite * @english * If bounding box is finite */ isFinite(): boolean; updateVertex(): vec3[]; copy(out: BoundingBox): BoundingBox; equals(box: BoundingBox): boolean; transform(positionMatrix: any, modelMatrix: any): this; } //# sourceMappingURL=BoundingBox.d.ts.map declare class Geometry { static createElementBuffer(device: any, elements: any): any; static createBuffer(device: any, data: any, name?: string): any; static padGPUBufferAlignment(array: TypedArray, vertexCount: number): TypedArray; data: Record<string, AttributeData>; elements: any; desc: GeometryDesc; semantic: Record<string, string>; count: number; properties: any; indices: NumberArray; boundingBox: BoundingBox; count1?: number; offset?: number; constructor(data: AttributeData, elements: any, count?: number, desc?: GeometryDesc); set version(v: number); get version(): number; getBuffer(name: string): any; getAttrData(activeAttributes: ActiveAttributes): any; getREGLData(regl: any, activeAttributes: ActiveAttributes, disableVAO: boolean): AttributeData; generateBuffers(device: any): void; isBufferGenerated(): boolean; getVertexCount(): number; getColor0Size(): number; /** * 手动设置geometry的buffer,用于多个属性共用一个ArrayBuffer(interleaved) * @param {String} key - 属性 * @param {ArrayBuffer|REGLBuffer} data - 数据 */ deleteData(name: string): this; /** * Replace data or refill attribute data buffer * @param {String} name - data's name * @param {Number[] | Object} data - data to update * @returns this */ updateData(name: string, data: AttributeData): this; _updateGPUBuffer(buffer: GPUBuffer, data: AttributeData, offset: number, byteLength: number): any; updateSubData(name: string, data: AttributeData, offset: number): this; getPrimitive(): REGL__default.PrimitiveType; getElements(): any; setElements(elements: any, count: number): this; isIndexedElements(): boolean; deleteElements(): this; setDrawCount(count: number): this; getDrawCount(): number; setDrawOffset(offset: number): this; getDrawOffset(): number; dispose(): void; isDisposed(): boolean; /** * Update boundingBox of Geometry */ updateBoundingBox(): void; createTangent(name?: string, tangentsDataArray?: Float32Array | Array<number>): void; createNormal(name?: string): void; /** * Create barycentric attribute data * @param {String} name - attribute name for barycentric attribute */ createBarycentric(name?: string): void; /** * Build unique vertex data for each attribute */ buildUniqueVertex(): void; getMemorySize(): number; getElementsType(elements: NumberArray): "uint8" | "uint32" | "uint16"; getCommandKey(device: any): string; getBufferDescriptor(vertexInfo: any): any[]; } declare class EdgeGeometry extends Geometry { constructor(data: AttributeData, elements: any, count: number, desc?: GeometryDesc); } declare class Base { } declare const Material_base: { new (...args: any[]): { _events: Record<string, BaseEventParamsType>; on(type: string, handler: HandlerFn): any; once(type: string, handler: HandlerFn): any; off(type: string, handler: HandlerFn): any; fire(type: string, params?: BaseEventParamsType): any; _wrapOnce(type: string, handler: HandlerFn): (params: any) => void; }; } & typeof Base; declare class Material extends Material_base { uniforms: ShaderUniforms; refCount: number; unlit: boolean; constructor(uniforms?: ShaderUniforms, defaultUniforms?: ShaderUniforms); set version(v: number); get version(): number; get propVersion(): number; get textureVersion(): number; set doubleSided(value: boolean); get doubleSided(): boolean; getUniforms(device: any): ShaderUniforms; getMemorySize(): number; isReady(): boolean; hasUniform(k: string): any; setUniform(k: string, v: ShaderUniformValue): this; getUniform(k: string): ShaderUniformValue; set(k: string, v: ShaderUniformValue, isDispose?: boolean): this; setFunctionUniform(k: string, fn: () => ShaderUniformValue): this; hasFunctionUniform(k: string): boolean; get(k: string): ShaderUniformValue; isDirty(): boolean; /** * Get shader defines * @return {Object} */ appendDefines(defines: ShaderDefines, _geometry: Geometry): ShaderDefines; hasSkinAnimation(): boolean; isTexture(k: string): boolean; dispose(): void; isDisposed(): boolean; getUniformKeys(): string; } declare class WireFrameMaterial extends Material { constructor(uniforms: ShaderUniforms); } //# sourceMappingURL=WireFrameMaterial.d.ts.map declare class StandardMaterial extends Material { constructor(uniforms: ShaderUniforms); appendDefines(defines: ShaderDefines, geometry: Geometry): ShaderDefines; } //# sourceMappingURL=StandardMaterial.d.ts.map declare class PhongMaterial extends Material { constructor(uniforms: ShaderUniforms); static convertFrom(standardMaterial: StandardMaterial): PhongMaterial; appendDefines(defines: ShaderDefines, geometry: Geometry): ShaderDefines; } //# sourceMappingURL=PhongMaterial.d.ts.map declare class StandardLiteMaterial extends Material { constructor(uniforms: ShaderUniforms); appendDefines(defines: ShaderDefines, geometry: Geometry): ShaderDefines; } //# sourceMappingURL=StandardLiteMaterial.d.ts.map declare const PhongSpecularGlossinessMaterial_base: { new (...args: any[]): { appendDefines(defines: ShaderDefines, geometry: Geometry): ShaderDefines; }; } & typeof PhongMaterial; declare class PhongSpecularGlossinessMaterial extends PhongSpecularGlossinessMaterial_base { } //# sourceMappingURL=PhongSpecularGlossinessMaterial.d.ts.map type DynamicBufferAllocation = { storage?: ArrayBuffer; gpuBuffer?: GPUBuffer; offset?: number; size?: number; }; declare class DynamicBufferPool { /** * Allocation size of the underlying buffers. * */ bufferSize: number; /** * Internally allocated gpu buffers. * */ poolBuffers: DynamicBufferAllocation[]; usedBuffers: DynamicBufferAllocation[]; /** * @type {DynamicBufferAllocation|null} */ activeBuffer: DynamicBufferAllocation; device: GPUDevice; bufferAlignment: number; /** * Create the system of dynamic buffers. * * @param device - The graphics device. * @param bufferSize - The size of the underlying large buffers. * @param bufferAlignment - Alignment of each allocation. */ constructor(device: GPUDevice, bufferSize: number, bufferAlignment: number); /** * Destroy the system of dynamic buffers. */ destroy(): void; /** * Allocate an aligned space of the given size from a dynamic buffer. * * @param {DynamicBufferAllocation} allocation - The allocation info to fill. * @param {number} size - The size of the allocation. */ alloc(allocation: any, size: any): void; createBuffer(device: GPUDevice, size: number): GPUBuffer; scheduleSubmit(): void; submit(): void; } declare class DynamicOffsets { items: any[]; offsets: number[]; index: number; constructor(); reset(): void; addItem(binding: any, offset: any): void; addItems(items: any[]): void; getItems(): any[]; getDynamicOffsets(): number[]; } declare class DynamicBuffer { bindgroupMapping: any; dynamicOffsets: number[]; pool: DynamicBufferPool; allocation: DynamicBufferAllocation; version: number; constructor(bindgroupMapping: any, pool: DynamicBufferPool); writeBuffer(uniformValues: Record<string, ShaderUniformValue>, dynamicOffsets: DynamicOffsets): void; _fillValue(type: any, buffer: any, offset: any, size: any, value: any): void; dispose(): void; } type BindGroupResult = { bindGroup: GPUBindGroup; outdated: boolean; uniformTextures?: any; }; declare class BindGroupFormat { bytes: number; uuid: number; name: string; constructor(name: any, bindGroupMapping: any, minUniformBufferOffsetAlignment: any); getShaderUniforms(): any; getMeshUniforms(): any; _parse(bindGroupMapping: any): void; createFormatBindGroup(device: GraphicsDevice, mesh: Mesh$1, shaderUniforms: ShaderUniforms, layout: GPUBindGroupLayout, shaderBuffer: DynamicBuffer, meshBuffer: DynamicBuffer): BindGroupResult; copyTextures(bindGroup: BindGroupResult, props: any): void; dispose(): void; } /** * Config: * transparent, castShadow */ declare class Mesh$1 { uuid: number; transparent: boolean; bloom: boolean; ssr: boolean; needUpdateShadow: boolean; picking: boolean; disableVAO: boolean; properties: any; uniforms: ShaderUniforms; dirtyDefines?: boolean; parent?: Mesh$1; constructor(geometry: Geometry, material?: Material, config?: MeshOptions); set material(v: Material); get material(): Material; set version(v: number); get version(): number; get textureVersion(): number; get geometry(): Geometry; set geometry(geo: Geometry); set localTransform(m: mat4); get localTransform(): mat4; set positionMatrix(m: mat4); get positionMatrix(): mat4; get config(): MeshOptions; get defines(): ShaderDefines; set defines(v: ShaderDefines); get castShadow(): boolean; set castShadow(v: boolean); setMaterial(material: Material): this; setParent(parent: Mesh$1): this; setLocalTransform(transform: mat4): this; setPositionMatrix(matrix: mat4): void; setUniform(k: string, v: ShaderUniformValue): this; setFunctionUniform(k: string, fn: () => ShaderUniformValue): this; hasFunctionUniform(k: string): boolean; hasUniform(k: string): boolean; getUniform(k: string): ShaderUniformValue; getDefines(): ShaderDefines; setDefines(defines: ShaderDefines): this; hasSkinAnimation(): boolean; getCommandKey(device: any): string; getRenderProps(device: any): ShaderUniforms; appendGeoAttributes(props: any, device: any, activeAttributes: any): void; getUniforms(device: any): ShaderUniforms; getMaterial(): Material; getElements(): any; dispose(): this; isValid(): boolean; getBoundingBox(): [vec3, vec3]; updateBoundingBox(): void; getMemorySize(): number; getWorldTransform(): any; _meshBuffer: Record<string, DynamicBuffer>; writeDynamicBuffer(commandUID: string, renderProps: any, bindGroupMapping: BindGroupFormat, pool: DynamicBufferPool, dynamicOffsets: DynamicOffsets): DynamicBuffer; getBindGroup(key: any): BindGroupResult; setBindGroup(key: any, bindGroup: any): this; getShaderFnValues(shaderUID: number): GPUBindGroup; setShaderFnValues(shaderUID: number, fnValues: any): this; } declare class InstancedMesh extends Mesh$1 { instancedData: InstancedAttribute; constructor(instancedData: InstancedAttribute, instanceCount: number, geometry: Geometry, material?: Material, config?: MeshOptions); get instanceCount(): number; set instanceCount(count: number); getMemorySize(): number; getDefines(): ShaderDefines; getCommandKey(device: any): string; updateInstancedData(name: string, data: any): this; getInstancedBuffer(name: string): any; generateInstancedBuffers(device: any): this; getRenderProps(regl: Regl): ShaderUniforms; disposeInstancedData(): void; getBufferDescriptor(vertexInfo: any): any[]; } declare class Scene { sortedMeshes: { opaques?: Mesh$1[]; transparents?: Mesh$1[]; }; sortFunction?: (a: Mesh$1, b: Mesh$1) => number; meshes?: Mesh$1[]; constructor(meshes: any); setMeshes(meshes?: Mesh$1 | Mesh$1[]): this; addMesh(mesh: Mesh$1 | Mesh$1[]): this; removeMesh(mesh?: Mesh$1 | Mesh$1[]): this; getMeshes(): Mesh$1[]; clear(): this; dirty(): this; sortMeshes(cameraPosition?: vec3): void; getSortedMeshes(): { opaques?: Mesh$1[]; transparents?: Mesh$1[]; }; } //# sourceMappingURL=Scene.d.ts.map /** * A basic renderer to render meshes in fashion of forward rendering */ declare class Renderer { device: any; constructor(device: any); render(shader: any, uniforms: Uniforms, scene: Scene, framebuffer: REGL__default.Framebuffer): number; clear(options: REGL__default.ClearOptions): void; isWebGPU(): boolean; } //# sourceMappingURL=Renderer.d.ts.map /** * config properties: * https://github.com/regl-project/regl/blob/gh-pages/API.md#textures */ declare class Texture2D extends AbstractTexture { _version: number; get version(): number; set version(version: number); onLoad({ data }: { data: any; }): void; setConfig(config: any): void; setMinFilter(value: number): void; setMagFilter(value: number): void; createREGLTexture(regl: Regl): REGL__default.Texture2D; _checkNPOT(regl: any): void; } declare class Plane extends Geometry { constructor(z?: number); } //# sourceMappingURL=Plane.d.ts.map /** * 对象是否是字符串 * @english * Check whether the object is a string * @param obj */ declare function isString(obj: any): boolean; /** * 对象是否是null或undefined * @english * Whether the object is null or undefined. * @param obj - object */ declare function isNil(obj: any): boolean; declare function defined(obj: any): boolean; /** * 对象是否是函数 * @english * Check whether the object is a function * @param obj */ declare function isFunction(obj: any): boolean; /** * 将后续所有对象属性合并到第一个dest对象中 * @english * Merges the properties of sources into destination object. * @param dest - object to extend * @param src - sources */ declare function extend(dest: any, ...src: any[]): any; /** * 将后续所有对象属性合并到第一个dest对象中,但忽略undefined或null的属性 * @english * Merges the properties of sources into destination object without nil properties. * @param dest - object to extend * @param src - sources */ declare function extendWithoutNil(dest: any, ...args: any[]): any; /** * 检查是否是个数值 * @english * Whether val is a number and not a NaN. * @param val - val */ declare function isNumber(val: any): boolean; /** * 计算值的log2 * @english * compute value's log2 * @param x - value to log * @returns */ declare function log2(x: number): number; /** * 归一化数组 * @english * normalize a number array * @param out - array receives result * @param arr - array * @returns out */ declare function normalize(out: NumberArray, arr: ArrayLike<number>): NumberArray; /** * 两个数值之间的比例推算 * * @english * Interpolate between two number. * * @param from - from value * @param to - to value * @param t - interpolation factor between 0 and 1 * @returns interpolated value */ declare function interpolate(a: number, b: number, t: number): number; /** * 检查对象是否是数组或者类型数组 * @english * Check if is an Array or a TypedArray * @param arr - input object * @returns */ declare function isArray(arr: any): boolean; declare function getArrayCtor(arr: any): ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor; /** * 对两个矢量执行线性推算 * * @english * Performs a linear interpolation between two number's * * @param out - the receiving vector * @param a - the first operand * @param b - the second operand * @param t - interpolation amount, in the range [0-1], between the two inputs * @returns out */ declare function lerp(out: NumberArray, a: NumberArray, b: NumberArray, t: number): NumberArray; /** * 将input数组的值设置给out * @english * Set input array's value to out * @param out - the receiving array * @param input - input array * @returns out */ declare function set(out: NumberArray, input: NumberArray): NumberArray; /** * 根据Position的最大值,选择一个合适的TypedArray * @english * Choose a TypedArray for position according to its max value * @param max - position's max value * @returns */ declare function getPosArrayType(max: number): Int8ArrayConstructor | Int16ArrayConstructor | Float32ArrayConstructor; /** * n大于max时返回max,n小于min时返回min,否则返回n * @english * Clamp input value between min and max * @param n - input value * @param min - min value * @param max - max value */ declare function clamp(n: number, min: number, max: number): number; declare function isSupportVAO(regl: any): any; /** * Object.hasOwnProperty的包装方法 * @english * Check if object hasOwnProperty of property * @param obj - object * @param prop - property * @returns */ declare function hasOwn(obj: any, prop: string): any; /** * 获取buffer的byte大小 * @english * Get buffer's size in bytes * @param buffer */ declare function getBufferSize(buffer: AttributeBufferData | AttributeType): number; /** * 获取regl texture对象的bytes大小 * @english * Get regl texture size in bytes * @param tex - regl rexture * @returns */ declare function getTexMemorySize(tex: REGL__default.Texture): number; /** * 获取regl texture的byte width * @english * Get regl texture's byte width * @param type - regl texture's type * @returns */ declare function getTextureByteWidth(type: any): 4 | 1 | 2 | 0; /** * 获取regl texture 的channels数量 * @english * Get regl texture's number of channels * @param format - regl texture's format * @returns */ declare function getTextureChannels(format: any): 4 | 1 | 2 | 3; /** * 检查该attribute数据是否处于interleaved数据中 * @english * Check if this attribute data is in interleaved stride * @param dataObj attribute object * @returns */ declare function isInStride(dataObj: any): boolean; /** * 检查该attribute数据是否是interleaved * @english * Check if this attribute data is an interleaved data * @param dataObj attribute object * @returns */ declare function isInterleaved(dataObj: any): boolean; /** * 获取该webgl上下文支持的压缩纹理格式 * @english * Get webgl context's supported formats for compressed texture * @param gl * @returns */ declare function getSupportedFormats(gl: WebGL2RenderingContext | WebGLRenderingContext | GPUDevice): { etc: boolean; etc1: boolean; s3tc: boolean; pvrtc: boolean; astc: boolean; bc7: boolean; }; /** * 获取字符串的hash值 * @english * Get string's hash code * @param s input string * @returns */ declare function hashCode(s: string): number; /** * 值是否是2的n次幂 * @english * Get the nearest power of 2 that is less than this value * @param value - input value * @returns */ declare function isPowerOfTwo(value: number): boolean; declare function resizeToPowerOfTwo(image: HTMLImageElement | NumberArray, width?: number, height?: number): NumberArray | HTMLCanvasElement | HTMLImageElement; declare function supportNPOT(regl: any): boolean; declare function isTextureDestroyed(texture: any): boolean; declare function isTextureLike(texture: any): any; declare const Util_d_clamp: typeof clamp; declare const Util_d_defined: typeof defined; declare const Util_d_extend: typeof extend; declare const Util_d_extendWithoutNil: typeof extendWithoutNil; declare const Util_d_getArrayCtor: typeof getArrayCtor; declare const Util_d_getBufferSize: typeof getBufferSize; declare const Util_d_getPosArrayType: typeof getPosArrayType; declare const Util_d_getSupportedFormats: typeof getSupportedFormats; declare const Util_d_getTexMemorySize: typeof getTexMemorySize; declare const Util_d_getTextureByteWidth: typeof getTextureByteWidth; declare const Util_d_getTextureChannels: typeof getTextureChannels; declare const Util_d_hasOwn: typeof hasOwn; declare const Util_d_hashCode: typeof hashCode; declare const Util_d_interpolate: typeof interpolate; declare const Util_d_isArray: typeof isArray; declare const Util_d_isFunction: typeof isFunction; declare const Util_d_isInStride: typeof isInStride; declare const Util_d_isInterleaved: typeof isInterleaved; declare const Util_d_isNil: typeof isNil; declare const Util_d_isNumber: typeof isNumber; declare const Util_d_isPowerOfTwo: typeof isPowerOfTwo; declare const Util_d_isString: typeof isString; declare const Util_d_isSupportVAO: typeof isSupportVAO; declare const Util_d_isTextureDestroyed: typeof isTextureDestroyed; declare const Util_d_isTextureLike: typeof isTextureLike; declare const Util_d_lerp: typeof lerp; declare const Util_d_log2: typeof log2; declare const Util_d_normalize: typeof normalize; declare const Util_d_resizeToPowerOfTwo: typeof resizeToPowerOfTwo; declare const Util_d_set: typeof set; declare const Util_d_supportNPOT: typeof supportNPOT; declare namespace Util_d { export { Util_d_clamp as clamp, Util_d_defined as defined, Util_d_extend as extend, Util_d_extendWithoutNil as extendWithoutNil, Util_d_getArrayCtor as getArrayCtor, Util_d_getBufferSize as getBufferSize, Util_d_getPosArrayType as getPosArrayType, Util_d_getSupportedFormats as getSupportedFormats, Util_d_getTexMemorySize as getTexMemorySize, Util_d_getTextureByteWidth as getTextureByteWidth, Util_d_getTextureChannels as getTextureChannels, Util_d_hasOwn as hasOwn, Util_d_hashCode as hashCode, Util_d_interpolate as interpolate, Util_d_isArray as isArray, Util_d_isFunction as isFunction, Util_d_isInStride as isInStride, Util_d_isInterleaved as isInterleaved, Util_d_isNil as isNil, Util_d_isNumber as isNumber, Util_d_isPowerOfTwo as isPowerOfTwo, Util_d_isString as isString, Util_d_isSupportVAO as isSupportVAO, Util_d_isTextureDestroyed as isTextureDestroyed, Util_d_isTextureLike as isTextureLike, Util_d_lerp as lerp, Util_d_log2 as log2, Util_d_normalize as normalize, Util_d_resizeToPowerOfTwo as resizeToPowerOfTwo, Util_d_set as set, Util_d_supportNPOT as supportNPOT }; } declare function parseRGBE(arrayBuffer: ArrayBufferLike, exposure?: number): { width: number; height: number; pixels: any; }; //# sourceMappingURL=HDR.d.ts.map declare const GL_NEAREST = 9728; declare const GL_LINEAR = 9729; declare const GL_LINEAR_MIPMAP_LINEAR = 9987; declare const MAG_FILTER = 10240; declare const MIN_FILTER = 10241; declare const WebGLConstants_d_GL_LINEAR: typeof GL_LINEAR; declare const WebGLConstants_d_GL_LINEAR_MIPMAP_LINEAR: typeof GL_LINEAR_MIPMAP_LINEAR; declare const WebGLConstants_d_GL_NEAREST: typeof GL_NEAREST; declare const WebGLConstants_d_MAG_FILTER: typeof MAG_FILTER; declare const WebGLConstants_d_MIN_FILTER: typeof MIN_FILTER; declare namespace WebGLConstants_d { export { WebGLConstants_d_GL_LINEAR as GL_LINEAR, WebGLConstants_d_GL_LINEAR_MIPMAP_LINEAR as GL_LINEAR_MIPMAP_LINEAR, WebGLConstants_d_GL_NEAREST as GL_NEAREST, WebGLConstants_d_MAG_FILTER as MAG_FILTER, WebGLConstants_d_MIN_FILTER as MIN_FILTER }; } declare namespace _default$2 { /** * Register a new shader segment for includes for 3rd parties * @param {String} name key name * @param {String} source shader segment source */ function register(name: string, source: string): void; /** * Compile the given source, replace #include with registered shader sources * @param {String} source source to compile */ function compile(source: string): any; function get(name: any): any; } //# sourceMappingURL=ShaderLib.d.ts.map declare const _default$1: { register(name: any, segment: any): void; /** * Compile the given source, replace #include with registered shader sources * @param {String} source source to compile */ compile(source: any, defines: any): any; get(name: any): any; }; //# sourceMappingURL=WgslShaderLib.d.ts.map type CommandStruct = { uid: string; layout: GPUBindGroupLayout; pipeline: GPURenderPipeline; vertexInfo: any; bindGroupFormat: BindGroupFormat; bindGroupMapping: any; activeAttributes: ActiveAttributes; }; declare class GLShader { vert: string; frag: string; wgslVert: string; wgslFrag: string; uid: number; commandId: number; version: number; extraCommandProps: any; name: string; constructor({ vert, frag, wgslVert, wgslFrag, uniforms, defines, extraCommandProps, name }: { vert: any; frag: any; wgslVert: any; wgslFrag: any; uniforms: any; defines: any; extraCommandProps: any; name: any; }); set shaderDefines(defines: Record<string, string | number>); get shaderDefines(): Record<string, string | number>; setDefines(defines: any): void; /** * The framebuffer object to render to * Set to null to render to default display * @param framebuffer */ setFramebuffer(framebuffer: any): this; run(regl: any, command: any, props: any): any; getShaderCommandKey(device: any, mesh: any, uniformValues: any): string; getVersion(regl: any, source: any): "" | "#version 300 es\n" | "#version 100\n"; getActiveVars(regl: any, vert: any, frag: any, hash: any): any; _insertDefines(source: any, defines: any): string; createMeshCommand(regl: any, mesh: any, commandProps?: {}, _uniformValues?: any): any; dispose(): void; /** * Get shader's context uniforms values * @param {Object} meshProps - mesh uniforms */ appendDescUniforms(regl: any, meshProps: any): any; /** * Set or get context uniform to or from the shader * @returns {this} */ setUniforms(uniforms: any): this; _compileSource(): void; } declare class GPUShader extends GLShader { getShaderCommandKey(device: any, mesh: any, renderProps: any): any; createMeshCommand(device: any, mesh: Mesh$1, commandProps: any, renderProps: any): any; _compileWGSLSource(defines: any): { vert: any; frag: any; }; run(deviceOrRegl: any, command: CommandStruct, props: any): any; _checkBindGroupTextures(bindGroup: BindGroupResult, props: any): boolean; _getCurrentRenderPassEncoder(device: GraphicsDevice): GPURenderPassEncoder; setFramebuffer(framebuffer: any): this; dispose(): void; } declare class MeshShader extends GPUShader { draw(device: any, meshes: any): number; _ensureContextDefines(v: any): void; _runFilter(m: any): any; getMeshCommand(device: any, mesh: any, renderProps: any): any; _cmdKeys: {}; } //# sourceMappingURL=MeshShader.d.ts.map declare class WireframeShader extends MeshShader { constructor(config?: {}); } //# sourceMappingURL=WireframeShader.d.ts.map declare class PhongShader extends MeshShader { constructor(config?: {}); getGeometryDefines(geometry: any): { HAS_TANGENT: number; HAS_NORMAL: number; }; } //# sourceMappingURL=PhongShader.d.ts.map declare class PointLineShader extends MeshShader { constructor(config?: {}); } //# sourceMappingURL=PointLineShader.d.ts.map declare class QuadShader extends MeshShader { constructor(config: any); draw(regl: any): number; getMeshCommand(regl: any): any; _createQuadMesh(regl: any): void; _quadMesh: Mesh$1[]; } //# sourceMappingURL=QuadShader.d.ts.map declare class FxaaShader extends QuadShader { constructor(); getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=FxaaShader.d.ts.map declare class BoxBlurShader extends QuadShader { constructor({ blurOffset }: { blurOffset: any; }); _blurOffset: any; getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=BoxBlurShader.d.ts.map declare class ImageShader extends MeshShader { constructor(config: any); getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=ImageShader.d.ts.map declare class PostProcessShader extends QuadShader { constructor(); getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=PostProcessShader.d.ts.map declare class Jitter { constructor(ratio: any); _frameNum: number; _ratio: any; _avg: number[]; getRatio(): any; setRatio(ratio: any): void; getAverage(): number[]; reset(): void; getJitter(out: any): any; frame(): void; getSampleCount(): number; } //# sourceMappingURL=Jitter.d.ts.map declare class BlurPass { constructor(regl: any, inputRGBM: any, level?: number); _regl: any; _renderer: Renderer; _inputRGBM: any; _level: number; render(sourceTex: any, luminThreshold: any): { blurTex0: any; blurTex1: any; blurTex2: any; blurTex3: any; blurTex4: any; }; _blur(curTex: any, luminThreshold: any): void; _blurUniforms: { rgbmRange: number; blurDir: number[]; outSize: number[]; pixelRatio: number[]; outputSize: number[]; }; _blurOnce(shader: any, inputTex: any, output0: any, output1: any, sizeRatio: any, luminThreshold: any): void; dispose(): void; _createTextures(tex: any): void; _blur00Tex: any; _blur00FBO: any; _blur01Tex: any; _blur01FBO: any; _blur10Tex: any; _blur10FBO: any; _blur11Tex: any; _blur11FBO: any; _blur20Tex: any; _blur20FBO: any; _blur21Tex: any; _blur21FBO: any; _blur30Tex: any; _blur30FBO: any; _blur31Tex: any; _blur31FBO: any; _blur40Tex: any; _blur40FBO: any; _blur41Tex: any; _blur41FBO: any; _blur50Tex: any; _blur50FBO: any; _blur51Tex: any; _blur51FBO: any; _blur60Tex: any; _blur60FBO: any; _blur61Tex: any; _blur61FBO: any; _createColorTex(curTex: any, w: any, h: any): any; _createBlurFBO(tex: any): any; _initShaders(): void; _blur0Shader: QuadShader; _blur1Shader: QuadShader; _blur2Shader: QuadShader; _blur3Shader: QuadShader; _blur4Shader: QuadShader; _blur5Shader: QuadShader; _blur6Shader: QuadShader; } //# sourceMappingURL=BlurPass.d.ts.map declare class BloomPass { constructor(regl: any); _regl: any; _renderer: Renderer; render(sourceTex: any, bloomTex: any, bloomThreshold: any, bloomFactor: any, bloomRadius: any, noAaSource: any, pointSource: any, enableAA: any, paintToScreen: any): any; _combine(sourceTex: any, blurTexes: any, inputTex: any, bloomFactor: any, bloomRadius: any, noAaSource: any, pointSource: any, enableAA: any, paintToScreen: any): any; _combineUniforms: { bloomFactor: number; bloomRadius: number; rgbmRange: number; TextureBloomBlur1: any; TextureBloomBlur2: any; TextureBloomBlur3: any; TextureBloomBlur4: any; TextureBloomBlur5: any; TextureInput: any; TextureSource: any; outputSize: number[]; }; dispose(): void; _createTextures(tex: any): void; _combineTex: any; _combineFBO: any; _createColorTex(curTex: any, w: any, h: any, dataType: any): any; _createBlurFBO(tex: any): any; _initShaders(): void; _blurPass: BlurPass; _combineShader: QuadShader; } //# sourceMappingURL=BloomPass.d.ts.map declare class CopyDepthShader extends QuadShader { constructor(); getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=CopyDepthShader.d.ts.map declare class SsrPass { static getUniformDeclares(): ({ name: string; type: string; fn: (context: any, props: any) => mat4; length?: undefined; } | { name: string; type: string; length: number; fn: (context: any, props: any) => number[][]; })[]; static getDefines(): { HAS_SSR: number; }; constructor(regl: any); _regl: any; _renderer: Renderer; _inputRGBM: number; setup(sourceTex: any): void; getSSRUniforms(map: any, factor: any, quality: any): { TextureDepth: any; TextureReflected: any; ssrFactor: any; ssrQuality: any; outSize: any[]; fov: number; prevProjViewMatrix: any; cameraWorldMatrix: any; }; genMipMap(sourceTex: any, depthTex: any, projViewMatrix: any): any; _projViewMatrix: any[]; getPrevProjViewMatrix(): any[]; copyDepthTex(depthTex: any): any; _depthCopy: any; _depthCopyFBO: any; _depthCopied: boolean; _mipmap(inputTex: any): void; _blurUniforms: { rgbmRange: number; outputSize: number[]; inputSize: number[]; }; getMipmapTexture(): any; _outputTex: any; dispose(): void; _initShaders(): void; _copyDepthShader: CopyDepthShader; _ssrQuadShader: QuadShader; _createTextures(sourceTex: any): void; _targetFBO: any; } //# sourceMappingURL=SsrPass.d.ts.map declare class HeatmapShader extends MeshShader { constructor(config: any); } //# sourceMappingURL=HeatmapShader.d.ts.map declare class SkyboxShader extends MeshShader { constructor(); /** * @param inputRGBM 输入的cubemap是否是rgbm格式 * @param mode 模式,0: ambient模式, 1: lod模式 */ setMode(toneMapping: any, mode: any): this; _meshDefines: { TONE_MAPPING: number; USE_AMBIENT: number; }; draw(regl: any): number; _createSkyboxMesh(regl: any): void; _skyboxMesh: Mesh$1[]; } //# sourceMappingURL=SkyboxShader.d.ts.map declare class HeatmapDisplayShader extends MeshShader { constructor(viewport: any, config: any); } declare class WaterShader extends MeshShader { constructor(config?: {}); } //# sourceMappingURL=WaterShader.d.ts.map declare class CopyShader extends QuadShader { constructor(); getMeshCommand(regl: any, mesh: any): any; } //# sourceMappingURL=CopyShader.d.ts.map declare class EdgeShader extends MeshShader { constructor(config?: {}); } //# sourceMappingURL=EdgeShader.d.ts.map declare class StandardLiteShader extends MeshShader { constructor(config?: {}); } //# sourceMappingURL=StandardLiteShader.d.ts.map declare class EffectShader extends QuadShader { constructor(); } //# sourceMappingURL=EffectShader.d.ts.map declare class FogPass { constructor(regl: any, viewport: any, layer: any); _regl: any; _layer: any; _viewport: any; _init(): void; _shader: MeshShader; _fbo: any; _scene: Scene; renderer: Renderer; render(meshes: any, options: any): any; dispose(): void; _resize(): void; } //# sourceMappingURL=FogPass.d.ts.map declare class FogShader extends QuadShader { constructor(); } //# sourceMappingURL=FogShader.d.ts.map declare class RainRipplePass { constructor(regl: any, viewport: any); _regl: any; _viewport: any; _init(): void; _shader: MeshShader; _fbo: any; _scene: Scene; renderer: Renderer; _transformRipples(map: any): void; _createRipplesMask(map: any): Mesh$1; _fixZoom: any; render(map: any, options: any): any; _mesh: any; dispose(): void; _resize(): void; } declare class ExtentPass { constructor(regl: any, viewport: any); regl: any; _viewport: any; renderer: Renderer; _init(): void; _maskColorFbo: any; _maskModeFbo: any; _maskColorShader: MeshShader; _maskModeShader: MeshShader; _scene: Scene; render(meshes: any, projViewMatrix: any): { colorExtent: any; modeExtent: any; }; _resize(): void; dispose(): void; } //# sourceMappingURL=ExtentPass.d.ts.map declare class ScanEffectPass { constructor(regl: any, viewport: any, layer: any); _regl: any; _layer: any; _viewport: any; _effectsLength: number; _init(): void; _fbo: any; _scene: Scene; renderer: Renderer; render(meshes: any, options: any): any; _shader: MeshShader; _createFragSource(effectInfos: any): string; _updateUniforms(uniforms: any, effectInfos: any): void; dispose(): void; _resize(): void; } //# sourceMappingURL=ScanEffectPass.d.ts.map declare class GLTFPack { constructor(gltf: any, regl: any); gltf: any; regl: any; geometries: any[]; _emptyTexture: any; getMeshesInfo(): any[]; getGLTFBBox(transform: any): BoundingBox; _createSkins(skins: any): void; _skinMap: {}; _createTextures(textures: any): void; _textureMap: {}; _checkBaseColorFactor(): void; _checkBaseColorFactorAlpha(): boolean; dispose(): void; updateAnimation(time: any, loop: any, speed: any, animationName: any, startTime: any, nodeMatrixMap: any, skinMap: any, animationNodes: any): void; _isFirstLoop(time: any, speed: any, animationName: any, startTime: any): boolean; hasSkinAnimation(): boolean; _updateNodeMatrix(animationName: any, time: any, node: any, parentNodeMatrix: any, nodeMatrixMap: any, animationNodes: any): void; _updateNodeTRS(node: any, time: any, animationName: any): void; _updateMorph(node: any, weights: any): void; _parserNode(node: any, geometries: any, parentNodeMatrix: any): void; _isAnimation: boolean; _createMaterialInfo(materialIndex: any): { baseColorTexture: any; khr_offset: any; khr_rotation: any; khr_scale: any; baseColorFactor: any; metallicRoughnessTexture: any; metallicFactor: any; roughnessFactor: any; name: string; normalTexture: any; occlusionTexture: any; emissiveTexture: any; emissiveFactor: any; alphaCutoff: any; doubleSided: any; alphaMode: any; }; _createExtralInfo(material: any): { doubleSided: any; alphaMode: any; }; _getTexture(texInfo: any): any; _toTexture(texture: any): any; /** * * @param map * @param from * @param to * @param dist * @param rotationZ 模型绕Z轴旋转角度,弧度 * @param rotationXY 模型绕Z轴与线段的交叉轴的旋转角度,弧度 * @param gltfScale * @param projectionScale * @param options * @returns */ arrangeAlongLine(from: any, to: any, xyDist: any, gltfScale: any, projectionScale: any, rotationScaleMat: any, options: any): { coordinates: any; t: number; scale: number[]; rotation: number[]; rotationZ: number; rotationXY: number; }[]; calModelHeightScale(out: any, modelHeight: any): vec3; _calBoxWidth(scale: any, rotationScaleMat: any, options: any): any; _getRotationZ(from: any, to: any): number; _getRotationXY(xyDist: any, zDist: any): number; } declare function load(url: any, options: any): any; declare function exportGLTFPack(gltf: any, regl: any): GLTFPack; declare function loadGLTF(root: any, gltf: any, loaderOptions: any): any; declare const GLTFHelper_d_exportGLTFPack: typeof exportGLTFPack; declare const GLTFHelper_d_load: typeof load; declare const GLTFHelper_d_loadGLTF: typeof loadGLTF; declare namespace GLTFHelper_d { export { GLTFHelper_d_exportGLTFPack as exportGLTFPack, GLTFHelper_d_load as load, GLTFHelper_d_loadGLTF as loadGLTF }; } declare class GLTFManager { constructor(regl: any, options: any); regl: any; resourceMap: {}; options: any; getGLTF(url: any): any; loginGLTF(url: any, requestor: any): void; logoutGLTF(url: any): void; isSimpleModel(url: any): any; addSimpleModel(id: any, gltfData: any): void; removeSimpleModel(id: any): void; _exportGLTFResource(gltf: any, url: any, useUniqueREGLBuffer?: boolean): { bbox: BoundingBox; gltfPack: GLTFPack; resources: any[]; json: any; refCount: any; }; fetchGLTF(url: any): any; _loadGLTFModel(url: any): any; } declar