UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.98 kB
import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{blendingDefault as r,oitBlending as n,oitDepthTest as l,oitDepthWrite as s,OITPolygonOffset as o}from"../lib/OrderIndependentTransparency.js";import{Program as c}from"../lib/Program.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{stencilWriteMaskOn as p,stencilToolMaskBaseParams as u,stencilBaseAllZerosParams as h,depthCompareAlways as d,stencilToolTransparentOccluderParams as T,stencilWriteMaskOff as f,stencilToolMaskOccluderParams as m,depthCompareLess as O}from"../lib/StencilUtils.js";import{TransparencyPassType as g}from"../lib/TransparencyPassType.js";import{VertexAttribute as P}from"../lib/VertexAttribute.js";import{a as R}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as S}from"../../../webgl/enums.js";import{makePipelineState as A,defaultDepthWriteParams as E,defaultColorWriteParams as b}from"../../../webgl/renderState.js";const I=new Map([[P.POSITION,0],[P.SUBDIVISIONFACTOR,1],[P.UV0,2],[P.AUXPOS1,3],[P.AUXPOS2,4],[P.COLOR,5],[P.COLORFEATUREATTRIBUTE,5],[P.SIZE,6],[P.SIZEFEATUREATTRIBUTE,6],[P.OPACITYFEATUREATTRIBUTE,7],[P.OBJECTANDLAYERIDCOLOR,8]]);class y extends i{initializeProgram(e){return new c(e.rctx,y.shader.get().build(this.configuration),I)}_makePipelineState(t,i){const c=this.configuration,a=t===g.NONE,d=t===g.FrontFace;return A({blending:c.output===e.Color||c.output===e.Alpha?a?r:n(t):null,depthTest:{func:l(t)},depthWrite:a?c.writeDepth?E:null:s(t),colorWrite:b,stencilWrite:c.hasOccludees?p:null,stencilTest:c.hasOccludees?i?u:h:null,polygonOffset:a||d?c.hasPolygonOffset?_:null:o})}initializePipeline(){const e=this.configuration;if(e.occluder){const t=e.hasPolygonOffset?_:null;this._occluderPipelineTransparent=A({blending:r,polygonOffset:t,depthTest:d,depthWrite:null,colorWrite:b,stencilWrite:null,stencilTest:T}),this._occluderPipelineOpaque=A({blending:r,polygonOffset:t,depthTest:d,depthWrite:null,colorWrite:b,stencilWrite:f,stencilTest:m}),this._occluderPipelineMaskWrite=A({blending:null,polygonOffset:t,depthTest:O,depthWrite:null,colorWrite:null,stencilWrite:p,stencilTest:u})}return this._occludeePipelineState=this._makePipelineState(this.configuration.transparencyPassType,!0),this._makePipelineState(this.configuration.transparencyPassType,!1)}get primitiveType(){return this.configuration.wireframe?S.LINES:S.TRIANGLE_STRIP}getPipelineState(e,t){return t?this._occludeePipelineState:this.configuration.occluder?e===a.TRANSPARENT_OCCLUDER_MATERIAL?this._occluderPipelineTransparent:e===a.OCCLUDER_MATERIAL?this._occluderPipelineOpaque:this._occluderPipelineMaskWrite:super.getPipelineState(e,t)}}y.shader=new t(R,(()=>import("./RibbonLine.glsl.js")));const _={factor:0,units:-4};export{y as RibbonLineTechnique,I as vertexAttributeLocations};