@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.29 kB
JavaScript
import{isSome as t,unwrapOr as e}from"../../../../../core/maybe.js";import{WGLGeometryType as o,WGLSymbologyType as a}from"../enums.js";import{createProgramDescriptor as r}from"../Utils.js";import i from"./WGLGeometryBrush.js";import{MarkerMaterialKey as n}from"../materialKey/MaterialKey.js";import{getTechniqueFromMaterialKey as s}from"../techniques/utils.js";import{DataType as m,PrimitiveType as l}from"../../../../webgl/enums.js";const d={shader:"materials/icon",vertexLayout:{geometry:[{location:0,name:"a_pos",count:2,type:m.SHORT},{location:1,name:"a_vertexOffset",count:2,type:m.SHORT},{location:2,name:"a_texCoords",count:2,type:m.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:m.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:m.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:m.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:m.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:m.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:m.UNSIGNED_SHORT}]},hittestAttributes:["a_vertexOffset","a_texCoords"]};class u extends i{dispose(){}getGeometryType(){return o.MARKER}supportsSymbology(t){return t!==a.HEATMAP&&t!==a.PIE_CHART}drawGeometry(o,a,i,m){const{context:u,painter:c,rendererInfo:p,state:y,passOptions:_,requestRender:f,allowDelayedRender:E}=o,S=n.load(i.materialKey),N=s(S.data),T=t(_)&&"hittest"===_.type,{shader:g,vertexLayout:x,hittestAttributes:R}=e(N.programSpec,d);let h=l.TRIANGLES,U=r(S.data,x);T&&(U=this._getTriangleDesc(i.materialKey,U,R),h=l.POINTS);const{attributes:A,bufferLayouts:O}=U,G=c.materialManager.getMaterialProgram(o,S,g,A,m);if(E&&t(f)&&!G.compiled)return void f();u.useProgram(G),S.textureBinding&&c.textureManager.bindTextures(u,G,S,!0),this._setSharedUniforms(G,o,a);const I=S.vvRotation?y.displayViewMat3:y.displayMat3;G.setUniformMatrix3fv("u_displayMat3",I),this._setSizeVVUniforms(S,G,p,a),this._setColorAndOpacityVVUniforms(S,G,p),this._setRotationVVUniforms(S,G,p);const M=i.target.getVAO(u,O,A,T);let b=i.indexCount,D=i.indexFrom*Uint32Array.BYTES_PER_ELEMENT;T&&(b/=3,D/=3),u.bindVAO(M),this._drawMarkers(o,a,G,h,b,D,T),u.bindVAO(null)}_drawMarkers(t,e,o,a,r,i,n){t.context.drawElements(a,r,m.UNSIGNED_INT,i)}}export{u as default};