import Kernel from '../Kernel' ; import Camera from '../Camera' ; import TileGrid from '../TileGrid' ; import Tile from '../graphics/Tile' ; import SubTiledLayer from './SubTiledLayer' ; abstract class LabelLayer extends SubTiledLayer { protected minLevel : number = 4 ; constructor ( ) { super ( - 1 ) ; } onDraw ( camera ) { var program = Tile . findProgram ( ) ; if ( ! program ) { return ; } program . use ( ) ; var gl = Kernel . gl ; gl . enable ( gl . BLEND ) ; gl . blendFunc ( gl . SRC_ALPHA , gl . ONE_MINUS_SRC_ALPHA ) ; var pmvMatrix = camera . getProjViewMatrixForDraw ( ) ; var locPMVMatrix = program . getUniformLocation ( 'uPMVMatrix' ) ; gl . uniformMatrix4fv ( locPMVMatrix , false , pmvMatrix . getFloat32Array ( ) ) ; gl . activeTexture ( gl . TEXTURE0 ) ; var locSampler = program . getUniformLocation ( 'uSampler' ) ; gl . uniform1i ( locSampler , 0 ) ; gl . depthFunc ( gl . ALWAYS ) ; super . onDraw ( camera ) ; gl . depthFunc ( gl . LEQUAL ) ; gl . disable ( gl . BLEND ) ; } abstract getTileUrl ( level , row , column ) ; updateTiles ( level , visibleTileGrids ) { var validTileGrids = visibleTileGrids . filter ( ( tileGrid ) => tileGrid . level >= this . minLevel ) ; super . updateTiles ( level , validTileGrids , true ) ; } } export default LabelLayer ;