UNPKG

@itwin/core-frontend

Version:
362 lines • 16.5 kB
/** @packageDocumentation * @module WebGL */ import { Point3d, Range3d, Vector2d } from "@itwin/core-geometry"; import { QParams3d, QPoint2dList, QPoint3dList, RenderTexture } from "@itwin/core-common"; import { RenderSkyGradientParams, RenderSkySphereParams } from "../RenderSkyBoxParams"; import { FlashMode } from "../../../FlashSettings"; import { TesselatedPolyline } from "../../../common/internal/render/PolylineParams"; import { RenderMemory } from "../../../render/RenderMemory"; import { ColorInfo } from "./ColorInfo"; import { WebGLDisposable } from "./Disposable"; import { DrawParams, ShaderProgramParams } from "./DrawCommand"; import { BufferHandle, BuffersContainer, QBufferHandle2d, QBufferHandle3d } from "./AttributeBuffers"; import { InstancedGeometry } from "./InstancedGeometry"; import { MaterialInfo } from "./Material"; import { MeshGeometry } from "./MeshGeometry"; import { EdgeGeometry, SilhouetteEdgeGeometry } from "./EdgeGeometry"; import { IndexedEdgeGeometry } from "./IndexedEdgeGeometry"; import { SurfaceGeometry } from "./SurfaceGeometry"; import { PointCloudGeometry } from "./PointCloud"; import { CompositeFlags, Pass, RenderOrder } from "./RenderFlags"; import { Target } from "./Target"; import { TechniqueId } from "./TechniqueId"; import { RealityMeshGeometry } from "./RealityMesh"; import { VertexLUT } from "./VertexLUT"; import { PlanarGridGeometry } from "./PlanarGrid"; /** Represents a geometric primitive ready to be submitted to the GPU for rendering. * @internal */ export declare abstract class CachedGeometry implements WebGLDisposable, RenderMemory.Consumer { protected _range?: Range3d; /** * Functions for obtaining a subclass of CachedGeometry. * IMPORTANT: Do NOT use code like `const surface = cachedGeom as SurfaceGeometry`. * Instanced geometry holds a reference to the shared geometry rendered for each instance - such casts will fail, * while the casting `functions` will forward to the shared geometry. */ get asLUT(): LUTGeometry | undefined; get asSurface(): SurfaceGeometry | undefined; get asMesh(): MeshGeometry | undefined; get asEdge(): EdgeGeometry | undefined; get asIndexedEdge(): IndexedEdgeGeometry | undefined; get asRealityMesh(): RealityMeshGeometry | undefined; get asSilhouette(): SilhouetteEdgeGeometry | undefined; get asInstanced(): InstancedGeometry | undefined; get isInstanced(): boolean; get asPointCloud(): PointCloudGeometry | undefined; get asPlanarGrid(): PlanarGridGeometry | undefined; get alwaysRenderTranslucent(): boolean; get allowColorOverride(): boolean; protected abstract _wantWoWReversal(_target: Target): boolean; protected _getLineWeight(_params: ShaderProgramParams): number; protected _getLineCode(_params: ShaderProgramParams): number; abstract get isDisposed(): boolean; abstract get techniqueId(): TechniqueId; abstract getPass(target: Target): Pass; abstract get renderOrder(): RenderOrder; get isLitSurface(): boolean; get hasBakedLighting(): boolean; get hasAnimation(): boolean; /** If false, the geometry's positions are not quantized. * qOrigin and qScale can still be used to derive the geometry's range, but will not be passed to the shader. * see VertexLUT.usesQuantizedPositions. */ get usesQuantizedPositions(): boolean; /** Returns the origin of this geometry's quantization parameters. */ abstract get qOrigin(): Float32Array; /** Returns the scale of this geometry's quantization parameters. */ abstract get qScale(): Float32Array; abstract draw(): void; abstract [Symbol.dispose](): void; get materialInfo(): MaterialInfo | undefined; get hasMaterialAtlas(): boolean; get polylineBuffers(): PolylineBuffers | undefined; get hasFeatures(): boolean; get viewIndependentOrigin(): Point3d | undefined; get isViewIndependent(): boolean; get supportsThematicDisplay(): boolean; get isEdge(): boolean; wantWoWReversal(params: ShaderProgramParams): boolean; getLineCode(params: ShaderProgramParams): number; getLineWeight(params: ShaderProgramParams): number; getFlashMode(params: DrawParams): FlashMode; wantMixMonochromeColor(_target: Target): boolean; wantMonochrome(_target: Target): boolean; abstract collectStatistics(stats: RenderMemory.Statistics): void; computeRange(output?: Range3d): Range3d; } /** Geometry which is drawn using indices into a look-up texture of vertex data, via gl.drawArrays() * @internal */ export declare abstract class LUTGeometry extends CachedGeometry { private readonly _viewIndependentOrigin?; abstract get lutBuffers(): BuffersContainer; abstract get lut(): VertexLUT; get asLUT(): this; get viewIndependentOrigin(): Point3d | undefined; protected abstract _draw(_numInstances: number, _instanceBuffersContainer?: BuffersContainer): void; draw(): void; drawInstanced(numInstances: number, instanceBuffersContainer: BuffersContainer): void; getColor(_target: Target): ColorInfo; get usesQuantizedPositions(): boolean; get qOrigin(): Float32Array; get qScale(): Float32Array; get hasAnimation(): boolean; protected constructor(viewIndependentOrigin?: Point3d); } /** Parameters used to construct an IndexedGeometry * @internal */ export declare class IndexedGeometryParams implements WebGLDisposable { readonly buffers: BuffersContainer; readonly positions: QBufferHandle3d; readonly indices: BufferHandle; readonly numIndices: number; protected constructor(positions: QBufferHandle3d, indices: BufferHandle, numIndices: number); static create(positions: Uint16Array, qParams: QParams3d, indices: Uint32Array): IndexedGeometryParams | undefined; static createFromList(positions: QPoint3dList, indices: Uint32Array): IndexedGeometryParams | undefined; get isDisposed(): boolean; [Symbol.dispose](): void; } /** A geometric primitive which is rendered using gl.drawElements() with one or more vertex buffers indexed by an index buffer. * @internal */ export declare abstract class IndexedGeometry extends CachedGeometry { protected readonly _params: IndexedGeometryParams; protected _wantWoWReversal(_target: Target): boolean; protected constructor(params: IndexedGeometryParams); get isDisposed(): boolean; [Symbol.dispose](): void; draw(): void; get qOrigin(): Float32Array; get qScale(): Float32Array; } /** Parameters used to construct an SkyBox * @internal */ export declare class SkyBoxGeometryParams implements WebGLDisposable { readonly buffers: BuffersContainer; readonly positions: QBufferHandle3d; protected constructor(positions: QBufferHandle3d); static create(positions: Uint16Array, qparams: QParams3d): SkyBoxGeometryParams | undefined; get isDisposed(): boolean; [Symbol.dispose](): void; } /** Geometry used for view-space rendering techniques. * @internal */ export declare class SkyBoxQuadsGeometry extends CachedGeometry { protected _techniqueId: TechniqueId; readonly cube: RenderTexture; protected readonly _params: SkyBoxGeometryParams; protected constructor(ndxGeomParams: SkyBoxGeometryParams, texture: RenderTexture); static create(texture: RenderTexture): SkyBoxQuadsGeometry | undefined; collectStatistics(_stats: RenderMemory.Statistics): void; get techniqueId(): TechniqueId; getPass(): Pass; get renderOrder(): RenderOrder; draw(): void; get qOrigin(): Float32Array; get qScale(): Float32Array; get isDisposed(): boolean; [Symbol.dispose](): void; protected _wantWoWReversal(_target: Target): boolean; } /** Geometry used for view-space rendering techniques. * @internal */ export declare class ViewportQuadGeometry extends IndexedGeometry { protected _techniqueId: TechniqueId; protected constructor(params: IndexedGeometryParams, techniqueId: TechniqueId); static create(techniqueId: TechniqueId): ViewportQuadGeometry | undefined; get techniqueId(): TechniqueId; getPass(): Pass; get renderOrder(): RenderOrder; collectStatistics(_stats: RenderMemory.Statistics): void; } /** Geometry used for view-space rendering techniques which involve sampling one or more textures. * @internal */ export declare class TexturedViewportQuadGeometry extends ViewportQuadGeometry { protected readonly _textures: WebGLTexture[]; protected constructor(params: IndexedGeometryParams, techniqueId: TechniqueId, textures: WebGLTexture[]); static createTexturedViewportQuadGeometry(techniqueId: TechniqueId, textures: WebGLTexture[]): TexturedViewportQuadGeometry | undefined; } /** Geometry used for rendering default gradient-style or single texture spherical skybox. * @internal */ export declare class SkySphereViewportQuadGeometry extends ViewportQuadGeometry { worldPos: Float32Array; readonly typeAndExponents: Float32Array; readonly zOffset: number; readonly rotation: number; readonly zenithColor: Float32Array; readonly skyColor: Float32Array; readonly groundColor: Float32Array; readonly nadirColor: Float32Array; readonly skyTexture?: RenderTexture; protected readonly _worldPosBuff: BufferHandle; private _isWorldPosSet; initWorldPos(target: Target): void; private _setPointsFromFrustum; protected constructor(params: IndexedGeometryParams, skybox: RenderSkySphereParams | RenderSkyGradientParams, techniqueId: TechniqueId); static createGeometry(skybox: RenderSkySphereParams | RenderSkyGradientParams): SkySphereViewportQuadGeometry | undefined; get isDisposed(): boolean; [Symbol.dispose](): void; } /** Geometry used when rendering ambient occlusion information to an output texture * @internal */ export declare class AmbientOcclusionGeometry extends TexturedViewportQuadGeometry { static createGeometry(depthAndOrder: WebGLTexture, depth: WebGLTexture): AmbientOcclusionGeometry | undefined; get depthAndOrder(): WebGLTexture; get depth(): WebGLTexture; get noise(): WebGLTexture; private constructor(); } /** @internal */ export declare enum BlurType { NoTest = 0, TestOrder = 1 } /** @internal */ export declare class BlurGeometry extends TexturedViewportQuadGeometry { readonly blurDir: Vector2d; static createGeometry(texToBlur: WebGLTexture, depthAndOrder: WebGLTexture, depthAndOrderHidden: WebGLTexture | undefined, blurDir: Vector2d, blurType: BlurType): BlurGeometry | undefined; get textureToBlur(): WebGLTexture; get depthAndOrder(): WebGLTexture; get depthAndOrderHidden(): WebGLTexture; private constructor(); } /** @internal */ export declare class EDLCalcBasicGeometry extends TexturedViewportQuadGeometry { readonly texInfo: Float32Array; static createGeometry(colorBuffer: WebGLTexture, depthBuffer: WebGLTexture, width: number, height: number): EDLCalcBasicGeometry | undefined; get colorTexture(): WebGLTexture; get depthTexture(): WebGLTexture; private constructor(); } /** @internal */ export declare class EDLCalcFullGeometry extends TexturedViewportQuadGeometry { readonly texInfo: Float32Array; static createGeometry(colorBuffer: WebGLTexture, depthBuffer: WebGLTexture, scale: number, width: number, height: number): EDLCalcFullGeometry | undefined; get colorTexture(): WebGLTexture; get depthTexture(): WebGLTexture; private constructor(); } /** @internal */ export declare class EDLFilterGeometry extends TexturedViewportQuadGeometry { readonly texInfo: Float32Array; static createGeometry(colorBuffer: WebGLTexture, depthBuffer: WebGLTexture, scale: number, width: number, height: number): EDLFilterGeometry | undefined; get colorTexture(): WebGLTexture; get depthTexture(): WebGLTexture; private constructor(); } /** @internal */ export declare class EDLMixGeometry extends TexturedViewportQuadGeometry { static createGeometry(colorTexture1: WebGLTexture, colorTexture2: WebGLTexture, colorTexture4: WebGLTexture): EDLMixGeometry | undefined; get colorTexture1(): WebGLTexture; get colorTexture2(): WebGLTexture; get colorTexture4(): WebGLTexture; private constructor(); } /** @internal */ export declare class EVSMGeometry extends TexturedViewportQuadGeometry { readonly stepSize: Float32Array; static createGeometry(depthBuffer: WebGLTexture, width: number, height: number): EVSMGeometry | undefined; get depthTexture(): WebGLTexture; private constructor(); } /** Geometry used during the 'composite' pass to apply transparency and/or hilite effects. * @internal */ export declare class CompositeGeometry extends TexturedViewportQuadGeometry { static createGeometry(opaque: WebGLTexture, accum: WebGLTexture, reveal: WebGLTexture, hilite: WebGLTexture): CompositeGeometry | undefined; get opaque(): WebGLTexture; get accum(): WebGLTexture; get reveal(): WebGLTexture; get hilite(): WebGLTexture; get occlusion(): WebGLTexture | undefined; set occlusion(occlusion: WebGLTexture | undefined); update(flags: CompositeFlags): void; private determineTechnique; private constructor(); } /** Geometry used to ping-pong the pick buffer data in between opaque passes. * @internal */ export declare class CopyPickBufferGeometry extends TexturedViewportQuadGeometry { static createGeometry(featureId: WebGLTexture, depthAndOrder: WebGLTexture): CopyPickBufferGeometry | undefined; get featureId(): WebGLTexture; get depthAndOrder(): WebGLTexture; private constructor(); } export declare class CombineTexturesGeometry extends TexturedViewportQuadGeometry { static createGeometry(texture0: WebGLTexture, texture1: WebGLTexture): CombineTexturesGeometry | undefined; get texture0(): WebGLTexture; get texture1(): WebGLTexture; private constructor(); } export declare class Combine3TexturesGeometry extends TexturedViewportQuadGeometry { static createGeometry(texture0: WebGLTexture, texture1: WebGLTexture, texture2: WebGLTexture): Combine3TexturesGeometry | undefined; get texture0(): WebGLTexture; get texture1(): WebGLTexture; get texture2(): WebGLTexture; private constructor(); } /** @internal */ export declare class SingleTexturedViewportQuadGeometry extends TexturedViewportQuadGeometry { static createGeometry(texture: WebGLTexture, techId: TechniqueId): SingleTexturedViewportQuadGeometry | undefined; get texture(): WebGLTexture; set texture(texture: WebGLTexture); protected constructor(params: IndexedGeometryParams, texture: WebGLTexture, techId: TechniqueId); } /** @internal */ export declare enum BoundaryType { Outside = 0, Inside = 1, Selected = 2 } /** @internal */ export declare class VolumeClassifierGeometry extends SingleTexturedViewportQuadGeometry { boundaryType: BoundaryType; static createVCGeometry(texture: WebGLTexture): VolumeClassifierGeometry | undefined; private constructor(); } /** A geometric primitive which renders gl points using gl.drawArrays() with one vertex buffer. * @internal */ export declare class ScreenPointsGeometry extends CachedGeometry { protected _numPoints: number; protected _origin: Float32Array; protected _scale: Float32Array; protected _positions: QBufferHandle2d; readonly buffers: BuffersContainer; readonly zTexture: WebGLTexture; protected constructor(vertices: QPoint2dList, zTexture: WebGLTexture); static createGeometry(width: number, height: number, depth: WebGLTexture): ScreenPointsGeometry; draw(): void; get isDisposed(): boolean; [Symbol.dispose](): void; collectStatistics(stats: RenderMemory.Statistics): void; protected _wantWoWReversal(_target: Target): boolean; get techniqueId(): TechniqueId; getPass(): Pass; get renderOrder(): RenderOrder; get qOrigin(): Float32Array; get qScale(): Float32Array; } /** @internal */ export declare class PolylineBuffers implements WebGLDisposable { buffers: BuffersContainer; indices: BufferHandle; prevIndices: BufferHandle; nextIndicesAndParams: BufferHandle; private constructor(); static create(polyline: TesselatedPolyline): PolylineBuffers | undefined; collectStatistics(stats: RenderMemory.Statistics, type: RenderMemory.BufferType): void; get isDisposed(): boolean; [Symbol.dispose](): void; } //# sourceMappingURL=CachedGeometry.d.ts.map