UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.27 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n,depthOnlyOutputBuffersOr as o}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as u}from"../effects/geometry/olidUtils.js";import{OITPolygonOffset as c,drawBuffers as p,depthWrite as a,depthTest as f,blending as d}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as h,stencilBaseAllZerosParams as m,stencilWriteMaskOn as b,stencilToolTransparentOccluderParams as g,depthCompareAlways as P,stencilToolMaskOccluderParams as T,stencilWriteMaskOff as W,depthCompareLess as j}from"../lib/StencilUtils.js";import{R as y}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as O}from"../../../webgl/enums.js";import{makePipelineState as S,defaultColorWrite as v,unpremultipliedAlphaToPremultipliedAlpha as _}from"../../../webgl/renderState.js";let w=class extends n{constructor(e,t){super(e,t,i(R(t))),this.shader=new s(y,()=>import("./RibbonLine.glsl.js")),this.primitiveType=t.wireframe?O.LINES:O.TRIANGLE_STRIP}_makePipelineState(e,t){const{oitPass:i,output:r,hasEmission:s,hasOccludees:n,hasPolygonOffset:u}=e,g=0===i,P=2===i;return S({blending:l(r)?d(i):null,depthTest:f(i),depthWrite:a(e),drawBuffers:o(r,p(i,s)),colorWrite:v,stencilWrite:n?b:null,stencilTest:n?t?h:m:null,polygonOffset:g||P?u?L:null:c})}initializePipeline(e){if(e.occluder){const t=e.hasPolygonOffset?L:null,{output:i,hasOccludees:r}=e;this._occluderPipelineTransparent=S({blending:_,polygonOffset:t,depthTest:P,depthWrite:null,colorWrite:v,stencilWrite:null,stencilTest:r?g:null,drawBuffers:o(i)}),this._occluderPipelineOpaque=S({blending:_,polygonOffset:t,depthTest:r?P:j,depthWrite:null,colorWrite:v,stencilWrite:r?W:null,stencilTest:r?T:null,drawBuffers:o(i)}),this._occluderPipelineMaskWrite=S({blending:null,polygonOffset:t,depthTest:j,depthWrite:null,colorWrite:null,stencilWrite:r?b:null,stencilTest:r?h:null,drawBuffers:o(i)})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 12:return this._occluderPipelineTransparent??super.getPipeline(e);case 11:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};w=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],w);const L={factor:0,units:-4};function R(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),u()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}export{w as RibbonLineTechnique,R as getLayout};