UNPKG

@allmaps/render

Version:

Render functions for WebGL and image buffers

96 lines (94 loc) 4.3 kB
import { GeoreferencedMap } from '@allmaps/annotation'; import { TriangulatedWarpedMap } from './TriangulatedWarpedMap.js'; import { Image } from '@allmaps/iiif-parser'; import { HomogeneousTransform, Size } from '@allmaps/types'; import { LineGroup, PointGroup, AnimationOptions, WebGL2WarpedMapOptions, WarpedMapListOptions } from '../shared/types.js'; import { CachedTile } from '../tilecache/CacheableTile.js'; export declare function createWebGL2WarpedMapFactory(gl: WebGL2RenderingContext, mapProgram: WebGLProgram, linesProgram: WebGLProgram, pointsProgram: WebGLProgram): (mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial<WarpedMapListOptions>, mapOptions?: Partial<WebGL2WarpedMapOptions>) => WebGL2WarpedMap; /** * Class for WarpedMaps that are rendered with WebGL 2 */ export declare class WebGL2WarpedMap extends TriangulatedWarpedMap { mapOptions: Partial<WebGL2WarpedMapOptions>; listOptions: Partial<WebGL2WarpedMapOptions>; georeferencedMapOptions: Partial<WebGL2WarpedMapOptions>; defaultOptions: WebGL2WarpedMapOptions; options: WebGL2WarpedMapOptions; imageId: string; image: Image; tileSize: Size; gl: WebGL2RenderingContext; mapProgram: WebGLProgram; linesProgram: WebGLProgram; pointsProgram: WebGLProgram; mapVao: WebGLVertexArrayObject | null; linesVao: WebGLVertexArrayObject | null; pointsVao: WebGLVertexArrayObject | null; lineGroups: LineGroup[]; pointGroups: PointGroup[]; cachedTilesByTileKey: Map<string, CachedTile<ImageData>>; cachedTilesByTileUrl: Map<string, CachedTile<ImageData>>; cachedTilesForTexture: CachedTile<ImageData>[]; previousCachedTilesForTexture: CachedTile<ImageData>[]; cachedTilesTextureArray: WebGLTexture | null; cachedTilesResourceOriginPointsAndSizesTexture: WebGLTexture | null; cachedTilesScaleFactorsTexture: WebGLTexture | null; invertedRenderHomogeneousTransform: HomogeneousTransform; private throttledUpdateTextures; /** * Creates an instance of WebGL2WarpedMap. * * @constructor * @param mapId - ID of the map * @param georeferencedMap - Georeferenced map used to construct the WarpedMap * @param gl - WebGL rendering context * @param mapProgram - WebGL program for map * @param options - WarpedMapOptions */ constructor(mapId: string, georeferencedMap: GeoreferencedMap, gl: WebGL2RenderingContext, mapProgram: WebGLProgram, linesProgram: WebGLProgram, pointsProgram: WebGLProgram, listOptions?: Partial<WarpedMapListOptions>, mapOptions?: Partial<WebGL2WarpedMapOptions>); initializeWebGL(mapProgram: WebGLProgram, linesProgram: WebGLProgram, pointsProgram: WebGLProgram): void; /** * Get default options */ static getDefaultOptions(): WebGL2WarpedMapOptions; /** Set default options */ setDefaultOptions(): void; protected applyOptions(animationOptions?: Partial<AnimationOptions>): object; shouldRenderMap(): boolean; shouldRenderLines(): boolean; shouldRenderPoints(): boolean; /** * Update the vertex buffers of this warped map * * @param projectedGeoToClipHomogeneousTransform - Transform from projected geo coordinates to webgl2 coordinates in the [-1, 1] range. Equivalent to OpenLayers' projectionTransform. */ updateVertexBuffers(projectedGeoToClipHomogeneousTransform: HomogeneousTransform): void; /** * Clear textures for this map */ clearTextures(): void; /** * Add cached tile to the textures of this map and update textures * * @param cachedTile */ addCachedTileAndUpdateTextures(cachedTile: CachedTile<ImageData>): void; /** * Remove cached tile from the textures of this map and update textures * * @param tileUrl */ removeCachedTileAndUpdateTextures(tileUrl: string): void; cancelThrottledFunctions(): void; destroy(): void; private setLineGroups; private setPointGroups; private updateVertexBuffersMap; private updateVertexBuffersLines; private updateVertexBuffersPoints; private updateTextures; private updateCachedTilesForTextures; private getCachedTilesAtOtherScaleFactors; private tileToCachedTile; private tileInCachedTiles; }