UNPKG

s2maps-gpu

Version:

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

63 lines (62 loc) 2.74 kB
import Workflow, { Feature } from './workflow.js'; import type Context from '../context/context.js'; import type { TileGL as Tile } from 'source/tile.spec.js'; import type { LayerDefinitionBase, ShadeDefinition, ShadeStyle, ShadeWorkflowLayerGuide } from 'style/style.spec.js'; import type { MaskSource, ShadeFeature as ShadeFeatureSpec, ShadeWorkflow as ShadeWorkflowSpec, ShadeWorkflowUniforms } from './workflow.spec.js'; /** Shape Feature is a standalone shade render storage unit that can be drawn to the GPU */ export declare class ShadeFeature extends Feature implements ShadeFeatureSpec { layerGuide: ShadeWorkflowLayerGuide; workflow: ShadeWorkflowSpec; source: MaskSource; featureCode: number[]; tile: Tile; type: "shade"; maskLayer: boolean; /** * @param layerGuide - layer guide for this feature * @param workflow - the shade workflow * @param source - the input mask source * @param featureCode - the encoded feature code that tells the GPU how to compute it's properties * @param tile - the tile that the feature is drawn on */ constructor(layerGuide: ShadeWorkflowLayerGuide, workflow: ShadeWorkflowSpec, source: MaskSource, featureCode: number[], tile: Tile); /** Draw this feature to the GPU */ draw(): void; /** * Duplicate this feature * @param tile - the tile that the feature is drawn on * @returns the duplicated feature */ duplicate(tile: Tile): ShadeFeature; } /** Shade Workflow */ export default class ShadeWorkflow extends Workflow implements ShadeWorkflowSpec { label: "shade"; uniforms: { [key in ShadeWorkflowUniforms]: WebGLUniformLocation; }; /** @param context - The WebGL(1|2) context */ constructor(context: Context); /** * Build a layer definition for this workflow given the user input layer * @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: ShadeStyle): ShadeDefinition; /** * given a set of layerIndexes that use Masks and the tile of interest, build a mask feature * @param layerDefinition - layer definition * @param tile - the tile that needs a mask */ buildMaskFeature(layerDefinition: ShadeDefinition, tile: Tile): void; /** Use this workflow as the current shaders for the GPU */ use(): void; /** Set the layer code uniforms for this workflow */ setLayerCode(): void; /** * Draw a shade feature * @param feature - the feature */ draw(feature: ShadeFeatureSpec): void; }