@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.31 kB
JavaScript
import{ViewingMode as e}from"../../../../../ViewingMode.js";import{IntegratedMeshMode as r}from"./ComponentTechniqueConfiguration.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{ShaderOutput as i}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as o}from"../../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as n}from"../../../core/shaderTechnique/ShaderTechnique.js";import{StencilBits as s}from"../../../lib/basicInterfaces.js";import{blendingDefault as l,oitBlending as a,oitDepthTest as c,OITPolygonOffset as u}from"../../../lib/OrderIndependentTransparency.js";import{Program as p}from"../../../lib/Program.js";import{stencilWriteMaskOn as d,replaceBitWhenDepthTestPasses as m,stencilBaseAllZerosParams as h}from"../../../lib/StencilUtils.js";import{TransparencyPassType as f}from"../../../lib/TransparencyPassType.js";import{VertexAttribute as b}from"../../../lib/VertexAttribute.js";import{ContextType as g}from"../../../../../webgl/context-util.js";import{makePipelineState as O,cullingParams as j,defaultDepthWriteParams as P,defaultColorWriteParams as T}from"../../../../../webgl/renderState.js";class M extends n{initializeConfiguration(r,t){t.hasWebGL2Context=r.rctx.type===g.WEBGL2,t.spherical=r.viewingMode===e.Global,t.doublePrecisionRequiresObfuscation=r.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new p(e.rctx,M.shader.get().build(this.configuration),S)}_setPipelineState(e){const t=this.configuration,o=t.integratedMeshMode!==r.None,n=e===f.NONE,p=e===f.FrontFace;return O({blending:t.output!==i.Color&&t.output!==i.Alpha||!t.blendingEnabled?null:n?l:a(e),culling:j(t.cullFace),depthTest:{func:c(e)},depthWrite:n||p?P:null,colorWrite:T,stencilWrite:o||t.hasOccludees?d:null,stencilTest:o?m(s.IntegratedMeshMaskExcluded):t.hasOccludees?h:null,polygonOffset:n||p?t.hasPolygonOffset?{factor:2,units:2}:null:u})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}M.shader=new o(t,(()=>import("./shader/ComponentShader.glsl.js")));const S=new Map([[b.POSITION,0],[b.NORMAL,1],[b.NORMALCOMPRESSED,1],[b.COLOR,2],[b.UV0,3],[b.UVREGION,4],[b.COMPONENTINDEX,5]]);export{M as ComponentTechnique,S as attributeLocations};