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.67 kB
TypeScript
import Workflow, { Feature } from './workflow.js';
import type Context from '../context/context.js';
import type { RasterData } from 'workers/worker.spec.js';
import type { TileGL as Tile } from 'source/tile.spec.js';
import type { LayerDefinitionBase, RasterDefinition, RasterStyle, RasterWorkflowLayerGuide } from 'style/style.spec.js';
import type { RasterFeature as RasterFeatureSpec, RasterSource, RasterWorkflow as RasterWorkflowSpec, RasterWorkflowUniforms } from './workflow.spec.js';
/** Raster Feature is a standalone raster render storage unit that can be drawn to the GPU */
export declare class RasterFeature extends Feature implements RasterFeatureSpec {
layerGuide: RasterWorkflowLayerGuide;
workflow: RasterWorkflowSpec;
source: RasterSource;
featureCode: number[];
tile: Tile;
fadeStartTime: number;
parent?: Tile | undefined;
type: "raster";
opacity?: number;
saturation?: number;
contrast?: number;
/**
* @param layerGuide - layer guide for this feature
* @param workflow - the raster workflow
* @param source - the raster 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
* @param fadeStartTime - the start time of the "fade" to be applied
* @param parent - the parent tile
*/
constructor(layerGuide: RasterWorkflowLayerGuide, workflow: RasterWorkflowSpec, source: RasterSource, featureCode: number[], tile: Tile, fadeStartTime?: number, parent?: Tile | undefined);
/**
* Draw this feature to the GPU
* @param interactive - whether or not the feature is interactive for compute or render
*/
draw(interactive?: boolean): void;
/**
* Duplicate this feature
* @param tile - the tile that the feature is drawn on
* @param parent - the parent tile if applicable
* @returns the duplicated feature
*/
duplicate(tile: Tile, parent?: Tile): RasterFeature;
/**
* Set the webgl1 attributes if the context is webgl1
* @param opacity - the opacity
* @param saturation - the saturation
* @param contrast - the contrast
*/
setWebGL1Attributes(opacity?: number, saturation?: number, contrast?: number): void;
}
/** Raster Workflow */
export default class RasterWorkflow extends Workflow implements RasterWorkflowSpec {
#private;
label: "raster";
curSample: 'none' | 'linear' | 'nearest';
layerGuides: Map<number, RasterWorkflowLayerGuide>;
uniforms: {
[key in RasterWorkflowUniforms]: 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 raster feature
*/
buildLayerDefinition(layerBase: LayerDefinitionBase, layer: RasterStyle): RasterDefinition;
/**
* Build the source raster data into raster features
* @param rasterData - the input raster data
* @param tile - the tile we are building the features for
*/
buildSource(rasterData: RasterData, tile: Tile): void;
/** Use this workflow as the current shaders for the GPU */
use(): void;
/**
* Draw a raster feature
* @param feature - the feature to draw
* @param _interactive - whether or not the feature is interactive
*/
draw(feature: RasterFeatureSpec, _interactive?: boolean): void;
}