UNPKG

s2maps-gpu

Version:

S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.

83 lines (82 loc) 3.55 kB
import type { LineData } from 'workers/worker.spec.js'; import type { TileGPU as Tile } from 'source/tile.spec.js'; import type { WebGPUContext } from '../context/index.js'; import type { LayerDefinitionBase, LineDefinition, LineStyle, LineWorkflowLayerGuideGPU } from 'style/style.spec.js'; import type { LineFeature as LineFeatureSpec, LineSource, LineWorkflow as LineWorkflowSpec } from './workflow.spec.js'; /** Line Feature is a standalone line render storage unit that can be drawn to the GPU */ export declare class LineFeature implements LineFeatureSpec { #private; workflow: LineWorkflowSpec; layerGuide: LineWorkflowLayerGuideGPU; source: LineSource; tile: Tile; count: number; offset: number; featureCode: number[]; dashTexture: GPUTexture; featureCodeBuffer: GPUBuffer; lineUniformBuffer: GPUBuffer; cap: number; parent?: Tile | undefined; type: "line"; bindGroup: GPUBindGroup; lineBindGroup: GPUBindGroup; /** * @param workflow - the line workflow * @param layerGuide - the layer guide for this feature * @param source - the line source * @param tile - the tile this feature is drawn on * @param count - the number of points * @param offset - the offset of the points * @param featureCode - the encoded feature code that tells the GPU how to compute it's properties * @param dashTexture - the dash texture * @param featureCodeBuffer - the encoded feature code that tells the GPU how to compute it's properties * @param lineUniformBuffer - the line uniform buffer * @param cap - the line cap * @param parent - the parent tile if applicable */ constructor(workflow: LineWorkflowSpec, layerGuide: LineWorkflowLayerGuideGPU, source: LineSource, tile: Tile, count: number, offset: number, featureCode: number[], dashTexture: GPUTexture, featureCodeBuffer: GPUBuffer, lineUniformBuffer: GPUBuffer, cap: number, parent?: Tile | undefined); /** Draw the feature to the GPU */ draw(): void; /** Destroy the feature */ destroy(): void; /** * Duplicate the line feature * @param tile - the tile this feature is drawn on * @param parent - the parent tile if applicable * @returns the duplicated feature */ duplicate(tile: Tile, parent?: Tile): LineFeature; } /** Line Workflow */ export default class LineWorkflow implements LineWorkflowSpec { #private; context: WebGPUContext; layerGuides: Map<number, LineWorkflowLayerGuideGPU>; pipeline: GPURenderPipeline; lineBindGroupLayout: GPUBindGroupLayout; /** @param context - The WebGPU context */ constructor(context: WebGPUContext); /** Setup the workflow */ setup(): Promise<void>; /** Destroy and cleanup the workflow */ destroy(): void; /** * Build the layer definition for this workflow * @param layerBase - the common layer attributes * @param layer - the user defined layer attributes * @returns a built layer definition that's ready to describe how to render a feature */ buildLayerDefinition(layerBase: LayerDefinitionBase, layer: LineStyle): LineDefinition; /** * Build the source line data into line features * @param lineData - the input line data * @param tile - the tile we are building the features for */ buildSource(lineData: LineData, tile: Tile): void; /** * Draw a line feature to the GPU * @param feature - line feature guide */ draw(feature: LineFeatureSpec): void; }