@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.95 kB
JavaScript
import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{PrimitiveType as r,DataType as i}from"../../../../webgl/enums.js";const s=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:i.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:i.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:i.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:i.BYTE},{location:7,name:"a_aux",count:2,type:i.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return t.LINE}supportsSymbology(e){return!0}drawGeometry(t,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:d,requestRender:y,allowDelayedRender:_}=t,f=n.load(a.materialKey),E=e(d)&&"hittest"===d.type;let N=s(f),g=r.TRIANGLES;E&&(N=this._getTriangleDesc(a.materialKey,N),g=r.POINTS);const{attributes:S,bufferLayouts:T}=N,U=c.materialManager.getMaterialProgram(t,f,"materials/line",S,m);if(_&&e(y)&&!U.compiled)return void y();const G=1/t.pixelRatio,I=0;l.useProgram(U),this._setSharedUniforms(U,t,o),f.textureBinding&&c.textureManager.bindTextures(l,U,f);const D=2**(p-o.key.level);U.setUniform1f("u_zoomFactor",D),U.setUniform1f("u_blur",I+G),U.setUniform1f("u_antialiasing",G),this._setSizeVVUniforms(f,U,u,o),this._setColorAndOpacityVVUniforms(f,U,u),l.setFaceCullingEnabled(!1);const R=a.target.getVAO(l,T,S,E);let b=a.indexCount,x=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;E&&(b/=3,x/=3),l.bindVAO(R),l.drawElements(g,b,i.UNSIGNED_INT,x)}}export{m as default};