s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
64 lines (63 loc) • 2.62 kB
TypeScript
import type { TileGPU as Tile } from 'source/tile.spec.js';
import type { WebGPUContext } from '../context/index.js';
import type { LayerDefinitionBase, ShadeDefinition, ShadeStyle, ShadeWorkflowLayerGuideGPU } from 'style/style.spec.js';
import type { MaskSource, ShadeFeature as ShadeFeatureSpec, ShadeWorkflow as ShadeWorkflowSpec } from './workflow.spec.js';
/** Shade Feature is a standalone shade render storage unit that can be drawn to the GPU */
export declare class ShadeFeature implements ShadeFeatureSpec {
#private;
workflow: ShadeWorkflowSpec;
tile: Tile;
layerIndex: number;
layerGuide: ShadeWorkflowLayerGuideGPU;
featureCodeBuffer: GPUBuffer;
type: "shade";
maskLayer: boolean;
source: MaskSource;
count: number;
offset: number;
featureCode: number[];
bindGroup: GPUBindGroup;
/**
* @param workflow - the shade workflow
* @param tile - the tile that the feature is drawn on
* @param layerIndex - the layer's index
* @param layerGuide - the layer guide for this feature
* @param featureCodeBuffer - the encoded feature code that tells the GPU how to compute it's properties
*/
constructor(workflow: ShadeWorkflowSpec, tile: Tile, layerIndex: number, layerGuide: ShadeWorkflowLayerGuideGPU, featureCodeBuffer: GPUBuffer);
/** Draw the feature to the GPU */
draw(): void;
/** Delete and cleanup the feature */
destroy(): void;
}
/** Shade Workflow */
export default class ShadeWorkflow implements ShadeWorkflowSpec {
#private;
context: WebGPUContext;
layerGuide?: ShadeWorkflowLayerGuideGPU;
pipeline: GPURenderPipeline;
/** @param context - The WebGPU context */
constructor(context: WebGPUContext);
/** Setup the shade workflow */
setup(): Promise<void>;
/** Cleanup the shade 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: ShadeStyle): ShadeDefinition;
/**
* Build a mask feature for the tile that helps the shade guide work
* @param shadeGuide - the shade guide
* @param tile - the tile that needs a mask
*/
buildMaskFeature(shadeGuide: ShadeDefinition, tile: Tile): void;
/**
* Draw a shade feature to the GPU
* @param feature - shade feature guide
*/
draw(feature: ShadeFeatureSpec): void;
}