UNPKG

@allmaps/render

Version:

Render functions for WebGL and image buffers

84 lines (82 loc) 3.83 kB
import { GeoreferencedMap } from '@allmaps/annotation'; import { TriangulatedWarpedMap } from './TriangulatedWarpedMap.js'; import { Image } from '@allmaps/iiif-parser'; import { HomogeneousTransform } from '@allmaps/types'; import { LineLayer, PointLayer, SpecificWebGL2WarpedMapOptions, WebGL2RendererOptions, WebGL2WarpedMapOptions, RenderOptions } 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, options?: Partial<WebGL2WarpedMapOptions>) => WebGL2WarpedMap; /** * Class for WarpedMaps that are rendered with WebGL 2 */ export declare class WebGL2WarpedMap extends TriangulatedWarpedMap { imageId: string; parsedImage: Image; webgl2WarpedMapOptions: SpecificWebGL2WarpedMapOptions; gl: WebGL2RenderingContext; mapProgram: WebGLProgram; linesProgram: WebGLProgram; pointsProgram: WebGLProgram; mapVao: WebGLVertexArrayObject | null; linesVao: WebGLVertexArrayObject | null; pointsVao: WebGLVertexArrayObject | null; lineLayers: LineLayer[]; pointLayers: PointLayer[]; cachedTilesByTileKey: Map<string, CachedTile<ImageData>>; cachedTilesByTileUrl: Map<string, CachedTile<ImageData>>; cachedTilesForTexture: CachedTile<ImageData>[]; previousCachedTilesForTexture: CachedTile<ImageData>[]; opacity: number; saturation: number; renderOptions: RenderOptions; cachedTilesTextureArray: WebGLTexture | null; cachedTilesResourceOriginPointsAndDimensionsTexture: 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, options?: Partial<WebGL2WarpedMapOptions>); initializeWebGL(mapProgram: WebGLProgram, linesProgram: WebGLProgram, pointsProgram: WebGLProgram): void; /** * 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, partialWebgl2RendererOptions: Partial<WebGL2RendererOptions>): 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 setLineLayers; private setPointLayers; private updateVertexBuffersMap; private updateVertexBuffersLines; private updateVertexBuffersPoints; private updateTextures; private updateCachedTilesForTextures; private getCachedTilesAtOtherScaleFactors; private tileToCachedTile; private tileInCachedTiles; }