@arcgis/core 4.24.0-next.20220401 → 4.24.0-next.20220404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{c665e9b7d09fe516f138.js → 2fe10c5c01056babeae5.js} +1 -1
- package/assets/esri/core/workers/chunks/{8771296b537f366596c4.js → 37aa4532e25d54055e40.js} +54 -54
- package/assets/esri/core/workers/chunks/528033aa0d663b4d41bf.js +1 -0
- package/assets/esri/core/workers/chunks/{0e29250c24a3a7b1ce13.js → 6de5a790c14f04c6c302.js} +1 -1
- package/assets/esri/core/workers/chunks/b1188ca77b975c6a7d92.js +1 -0
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +26 -26
- package/chunks/HUDMaterial.glsl.js +37 -37
- package/chunks/HighlightDownsample.glsl.js +1 -1
- package/chunks/ImageMaterial.glsl.js +10 -10
- package/chunks/LineMarker.glsl.js +75 -32
- package/chunks/RealisticTree.glsl.js +26 -26
- package/chunks/SMAA.glsl.js +2 -2
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +10 -10
- package/chunks/TextureOnly.glsl.js +2 -2
- package/core/accessorSupport/Property.js +1 -1
- package/interfaces.d.ts +25 -7
- package/package.json +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/location.js +1 -1
- package/smartMapping/renderers/predominance.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/dotDensity.js +1 -1
- package/smartMapping/symbology/flow.js +1 -1
- package/smartMapping/symbology/heatmap.js +1 -1
- package/smartMapping/symbology/location.js +1 -1
- package/smartMapping/symbology/predominance.js +1 -1
- package/smartMapping/symbology/relationship.js +1 -1
- package/smartMapping/symbology/size.js +1 -1
- package/smartMapping/symbology/type.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/BrushFlow.js +1 -1
- package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
- package/views/2d/engine/imagery/BrushVectorField.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushBitmap.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/EffectManager.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +12 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -9
- package/views/3d/webgl-engine/core/shaderModules/BooleanUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/IntegerUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Uniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/BindType.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/assets/esri/core/workers/chunks/5682039666f874836451.js +0 -1
- package/assets/esri/core/workers/chunks/79bdb26244ec7b4472fe.js +0 -1
- package/chunks/color.js +0 -5
- package/chunks/dotDensity.js +0 -5
- package/chunks/heatmap.js +0 -5
- package/chunks/location.js +0 -5
- package/chunks/predominance.js +0 -5
- package/chunks/relationship.js +0 -5
- package/chunks/size.js +0 -5
- package/chunks/type.js +0 -5
- package/renderers/smartMapping/creators/color.js +0 -5
- package/renderers/smartMapping/creators/dotDensity.js +0 -5
- package/renderers/smartMapping/creators/heatmap.js +0 -5
- package/renderers/smartMapping/creators/location.js +0 -5
- package/renderers/smartMapping/creators/opacity.js +0 -5
- package/renderers/smartMapping/creators/predominance.js +0 -5
- package/renderers/smartMapping/creators/relationship.js +0 -5
- package/renderers/smartMapping/creators/size.js +0 -5
- package/renderers/smartMapping/creators/support/utils.js +0 -5
- package/renderers/smartMapping/creators/type.js +0 -5
- package/renderers/smartMapping/creators/univariateColorSize.js +0 -5
- package/renderers/smartMapping/heuristics/scaleRange.js +0 -5
- package/renderers/smartMapping/heuristics/sizeRange.js +0 -5
- package/renderers/smartMapping/statistics/classBreaks.js +0 -5
- package/renderers/smartMapping/statistics/heatmapStatistics.js +0 -5
- package/renderers/smartMapping/statistics/histogram.js +0 -5
- package/renderers/smartMapping/statistics/predominantCategories.js +0 -5
- package/renderers/smartMapping/statistics/summaryStatistics.js +0 -5
- package/renderers/smartMapping/statistics/summaryStatisticsForAge.js +0 -5
- package/renderers/smartMapping/statistics/support/ageUtils.js +0 -5
- package/renderers/smartMapping/statistics/uniqueValues.js +0 -5
- package/renderers/smartMapping/symbology/color.js +0 -5
- package/renderers/smartMapping/symbology/dotDensity.js +0 -5
- package/renderers/smartMapping/symbology/heatmap.js +0 -5
- package/renderers/smartMapping/symbology/location.js +0 -5
- package/renderers/smartMapping/symbology/predominance.js +0 -5
- package/renderers/smartMapping/symbology/relationship.js +0 -5
- package/renderers/smartMapping/symbology/size.js +0 -5
- package/renderers/smartMapping/symbology/support/colorRamps.js +0 -5
- package/renderers/smartMapping/symbology/support/utils.js +0 -5
- package/renderers/smartMapping/symbology/type.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as
|
|
5
|
+
import{disposeMaybe as e,isSome as t,isNone as o}from"../../../../../core/maybe.js";import r from"../../../../../core/RandomLCG.js";import{TEXTURE_BINDING_RENDERER_0 as i,TEXTURE_BINDING_RENDERER_1 as s,TILE_SIZE as n}from"../definitions.js";import{WGLGeometryType as a}from"../enums.js";import{createProgramDescriptor as d}from"../Utils.js";import l from"./WGLGeometryBrush.js";import{FillMaterialKey as m}from"../materialKey/MaterialKey.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{PrimitiveType as _,DataType as c,TextureType as f,PixelFormat as h,PixelType as T,TextureSamplingMode as p,TextureWrapMode as y,TargetType as x,DepthStencilTargetType as D,RenderbufferFormat as g,Usage as E}from"../../../../webgl/enums.js";import{FramebufferObject as S}from"../../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../../webgl/Renderbuffer.js";import{Texture as U}from"../../../../webgl/Texture.js";import{VertexArrayObject as O}from"../../../../webgl/VertexArrayObject.js";const b=e=>{const t={geometry:[{location:0,name:"a_pos",count:2,type:c.SHORT},{location:1,name:"a_id",count:3,type:c.UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:c.UNSIGNED_BYTE}]};return e.dotDensity?(t.geometry.push({location:3,name:"a_inverseArea",count:1,type:c.FLOAT}),d(e.data,t)):(t.geometry.push({location:3,name:"a_color",count:4,type:c.UNSIGNED_BYTE,normalized:!0}),e.simple||t.geometry.push({location:4,name:"a_aux1",count:4,type:c.UNSIGNED_SHORT}),t.geometry.push({location:5,name:"a_aux2",count:4,type:c.UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:c.UNSIGNED_BYTE}),e.simple||t.geometry.push({location:7,name:"a_zoomRange",count:2,type:c.UNSIGNED_SHORT}),d(e.data,t))};class N extends l{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([i,s]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=e(this._dotFBO),this._dotVAO=e(this._dotVAO)}getGeometryType(){return a.FILL}drawGeometry(e,o,r,i){const{context:s,painter:n,rendererInfo:a,requiredLevel:d,passOptions:l,requestRender:u}=e,f=m.load(r.materialKey),h=t(l)&&"hittest"===l.type,T=n.materialManager;let p=_.TRIANGLES,y=b(f);h&&(y=this._getTriangleDesc(r.materialKey,y),p=_.POINTS);const{attributes:x,bufferLayouts:D}=y,g=T.getMaterialProgram(e,f,"materials/fill",x,i);if(t(u)&&!h&&!g.isCompiled)return void u();if(s.useProgram(g),this._setSharedUniforms(g,e,o),g.setUniform2f("u_tileOffset",512*o.key.col,512*o.key.row),f.textureBinding){n.textureManager.bindTextures(s,g,f);const e=1/2**(d-o.key.level);g.setUniform1f("u_zoomFactor",e)}const E=1/e.pixelRatio;g.setUniform1f("u_blur",E),g.setUniform1f("u_antialiasing",E),this._setSizeVVUniforms(f,g,a,o),this._setColorAndOpacityVVUniforms(f,g,a);const S=r.target.getVAO(s,D,x,h);let w=r.indexCount,U=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(h&&(w/=3,U/=3),s.bindVAO(S),!f.dotDensity||h)s.drawElements(p,w,c.UNSIGNED_INT,U);else{const t=this._drawDotLocations(e,o,g,w,U);this._drawDotDensity(e,o,t)}}_drawDotDensity(e,o,r){const{context:i,painter:s,rendererInfo:n,requestRender:a}=e,d=s.materialManager.getProgram(this._dotDesc);if(t(a)&&!d.isCompiled)return void a();const l=this._createDotDensityMesh(i,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:c.SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});i.setStencilTestEnabled(!0),i.useProgram(d),d.setUniform1f("u_tileZoomFactor",1),d.setUniform1i("u_texture",this._dotSamplers[0]),d.setUniform1f("u_dotSize",Math.max(n.ddDotSize,1)),d.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(d,e,o),i.bindTexture(r,this._dotSamplers[0]),i.bindVAO(l),i.drawArrays(_.POINTS,0,262144)}_drawDotLocations(e,t,o,r,i){const{context:s,rendererInfo:a,requiredLevel:d}=e,l=s.getViewport();s.setViewport(0,0,512,512);const m=s.getBoundFramebufferObject(),u=this._createFBO(s);s.bindFramebuffer(u),s.setClearColor(0,0,0,0),s.clear(s.gl.COLOR_BUFFER_BIT|s.gl.STENCIL_BUFFER_BIT),s.setStencilTestEnabled(!1);const f=1/2**(d-t.key.level),h=n,T=h*window.devicePixelRatio*h*window.devicePixelRatio,p=1/f*(1/f),y=a.ddDotScale?e.state.scale/a.ddDotScale:1;return o.setUniform1f("u_tileZoomFactor",f),o.setUniform1f("u_tileDotsOverArea",T/(n*window.devicePixelRatio*n*window.devicePixelRatio)),o.setUniformMatrix4fv("u_dotColors",a.ddColors),o.setUniform4fv("u_isActive",a.ddActiveDots),o.setUniform4fv("u_dotBackgroundColor",a.ddBackgroundColor),o.setUniform1f("u_dotValue",Math.max(1,a.ddDotValue*y*p)),this._bindDotDensityTextures(s,o,a,h),s.drawElements(_.TRIANGLES,r,c.UNSIGNED_INT,i),s.setViewport(l.x,l.y,l.width,l.height),s.bindFramebuffer(m),u.colorTexture}_createFBO(e){if(o(this._dotFBO)){const t=512,o=512,r={target:f.TEXTURE_2D,pixelFormat:h.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:y.CLAMP_TO_EDGE,width:t,height:o},i={colorTarget:x.TEXTURE,depthStencilTarget:D.DEPTH_STENCIL_RENDER_BUFFER},s=new w(e,{width:t,height:o,internalFormat:g.DEPTH_STENCIL});this._dotFBO=new S(e,i,r,s)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let e=0;e<this._dotTextures.length;e++)this._dotTextures[e].dispose();this._dotTextures=null}}_bindDotDensityTextures(e,t,o,r){const i=this._createDotDensityTextures(e,r,o.ddSeed);t.setUniform1iv("u_dotTextures",this._dotSamplers);for(let s=0;s<i.length;s++)e.bindTexture(i[s],this._dotSamplers[s])}_createDotDensityMesh(e,t,r){if(o(this._dotVAO)){const o=2,i=new Int16Array(262144*o);for(let e=0;e<512;e++)for(let t=0;t<512;t++)i[o*(t+512*e)]=t,i[o*(t+512*e)+1]=e;const s=u.createVertex(e,E.STATIC_DRAW,i);this._dotVAO=new O(e,t,r,{geometry:s},null)}return this._dotVAO}_createDotDensityTextures(e,t,o){if(this._dotTextureSize===t&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=t,this._seed=o),null===this._dotTextures){const i=new r(o);this._dotTextures=[this._allocDotDensityTexture(e,t,i),this._allocDotDensityTexture(e,t,i)]}return this._dotTextures}_allocDotDensityTexture(e,t,o){const r=new Float32Array(t*t*4);for(let i=0;i<r.length;i++)r[i]=o.getFloat();return new U(e,{wrapMode:y.REPEAT,pixelFormat:h.RGBA,dataType:T.FLOAT,samplingMode:p.NEAREST,width:t,height:t},r)}}export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
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{LabelMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,CompareFunction as i,PrimitiveType as s}from"../../../../webgl/enums.js";const m=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:r.UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:r.UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:r.UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:r.SHORT},{location:8,name:"a_texCoords",count:2,type:r.UNSIGNED_SHORT}]});class l extends a{dispose(){}getGeometryType(){return t.LABEL}drawGeometry(t,o,a,l){const{context:c,painter:d,state:f,rendererInfo:u,passOptions:p,requestRender:y}=t,_=n.load(a.materialKey),E=e(p)&&"hittest"===p.type,N=_.mapAligned?1:0;if(!N&&Math.abs(o.key.level-Math.round(100*t.displayLevel)/100)>=1)return;const{bufferLayouts:S,attributes:U}=m(_),T=d.materialManager.getMaterialProgram(t,_,"materials/label",U,l);if(e(y)&&!E&&!T.isCompiled)return void y();t.context.setStencilFunction(i.EQUAL,0,255),c.useProgram(T),this._setSharedUniforms(T,t,o),d.textureManager.bindTextures(c,T,_);const G=1===N?f.displayViewMat3:f.displayMat3;this._setSizeVVUniforms(_,T,u,o),T.setUniform1f("u_mapRotation",Math.floor(f.rotation/360*254)),T.setUniform1f("u_mapAligned",N),T.setUniformMatrix3fv("u_displayMat3",G),T.setUniform1f("u_opacity",1),T.setUniform2fv("u_screenSize",t.state.size),T.setUniform1f("u_isHalo",1);const g=a.target.getVAO(c,S,U),I=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;c.bindVAO(g),c.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),T.setUniform1f("u_isHalo",0),c.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),c.setStencilTestEnabled(!0),c.setBlendingEnabled(!0)}}export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as
|
|
5
|
+
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{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";const s=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:r.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:r.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:r.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:r.BYTE},{location:7,name:"a_aux",count:2,type:r.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:r.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return t.LINE}drawGeometry(t,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:d,requestRender:y}=t,_=n.load(a.materialKey),f=e(d)&&"hittest"===d.type;let E=s(_),N=i.TRIANGLES;f&&(E=this._getTriangleDesc(a.materialKey,E),N=i.POINTS);const{attributes:g,bufferLayouts:S}=E,T=c.materialManager.getMaterialProgram(t,_,"materials/line",g,m);if(e(y)&&!f&&!T.isCompiled)return void y();const U=1/t.pixelRatio,G=0;l.useProgram(T),this._setSharedUniforms(T,t,o),_.textureBinding&&c.textureManager.bindTextures(l,T,_);const I=2**(p-o.key.level);T.setUniform1f("u_zoomFactor",I),T.setUniform1f("u_blur",G+U),T.setUniform1f("u_antialiasing",U),this._setSizeVVUniforms(_,T,u,o),this._setColorAndOpacityVVUniforms(_,T,u),l.setFaceCullingEnabled(!1);const x=a.target.getVAO(l,S,g,f);let D=a.indexCount,O=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;f&&(D/=3,O/=3),l.bindVAO(x),l.drawElements(N,D,r.UNSIGNED_INT,O)}}export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{MarkerMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_vertexOffset",count:2,type:i.SHORT},{location:2,name:"a_texCoords",count:2,type:i.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:i.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:i.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.MARKER}drawGeometry(e,o,a,m){const{context:l,painter:
|
|
5
|
+
import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{MarkerMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_vertexOffset",count:2,type:i.SHORT},{location:2,name:"a_texCoords",count:2,type:i.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:i.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:i.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.MARKER}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:c,state:d,passOptions:u,requestRender:y}=e,_=n.load(a.materialKey),E=t(u)&&"hittest"===u.type,{bufferLayouts:N,attributes:f}=s(_),S=p.materialManager.getMaterialProgram(e,_,"materials/icon",f,m);if(t(y)&&!E&&!S.isCompiled)return void y();l.useProgram(S),_.textureBinding&&p.textureManager.bindTextures(l,S,_,!0);let T=r.TRIANGLES;t(u)&&"hittest"===u.type&&(T=r.POINTS),this._setSharedUniforms(S,e,o);const U=_.vvRotation?d.displayViewMat3:d.displayMat3;S.setUniformMatrix3fv("u_displayMat3",U),this._setSizeVVUniforms(_,S,c,o),this._setColorAndOpacityVVUniforms(_,S,c),this._setRotationVVUniforms(_,S,c);const R=a.target.getVAO(l,N,f),G=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(R),l.drawElements(T,a.indexCount,i.UNSIGNED_INT,G)}}export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{TextMaterialKey as r}from"../materialKey/MaterialKey.js";import{DataType as n,PrimitiveType as i}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT},{location:1,name:"a_id",count:4,type:n.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:n.UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:n.BYTE},{location:6,name:"a_zoomRange",count:2,type:n.UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:n.SHORT},{location:8,name:"a_texCoords",count:2,type:n.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.TEXT}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:u,state:
|
|
5
|
+
import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{TextMaterialKey as r}from"../materialKey/MaterialKey.js";import{DataType as n,PrimitiveType as i}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT},{location:1,name:"a_id",count:4,type:n.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:n.UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:n.BYTE},{location:6,name:"a_zoomRange",count:2,type:n.UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:n.SHORT},{location:8,name:"a_texCoords",count:2,type:n.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.TEXT}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:u,state:d,passOptions:_,requestRender:c}=e,y=r.load(a.materialKey),f=t(_)&&"hittest"===_.type,{bufferLayouts:E,attributes:N}=s(y),T=p.materialManager.getMaterialProgram(e,y,"materials/text",N,m);if(t(c)&&!f&&!T.isCompiled)return void c();l.useProgram(T);let S=i.TRIANGLES;f&&(S=i.POINTS),this._setSharedUniforms(T,e,o),p.textureManager.bindTextures(l,T,y),T.setUniformMatrix3fv("u_displayMat3",d.displayMat3),T.setUniformMatrix3fv("u_displayViewMat3",d.displayViewMat3),this._setSizeVVUniforms(y,T,u,o),this._setColorAndOpacityVVUniforms(y,T,u),this._setRotationVVUniforms(y,T,u),T.setUniform1f("u_isHalo",1);const U=a.target.getVAO(l,E,N),x=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(U),l.drawElements(i.TRIANGLES,a.indexCount,n.UNSIGNED_INT,x),T.setUniform1f("u_isHalo",0),l.drawElements(S,a.indexCount,n.UNSIGNED_INT,x)}}export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Bloom as
|
|
5
|
+
import{Bloom as o}from"./Bloom.js";import{Blur as e}from"./Blur.js";import{Colorize as t}from"./Colorize.js";import{DropShadow as s}from"./DropShadow.js";import{Opacity as r}from"./Opacity.js";function c(o){switch(o){case"bloom":case"blur":case"opacity":case"drop-shadow":return o;default:return"colorize"}}const f={colorize:()=>new t,blur:()=>new e,bloom:()=>new o,opacity:()=>new r,"drop-shadow":()=>new s};class i{constructor(){this._effectMap=new Map}dispose(){this._effectMap.forEach((o=>o.dispose())),this._effectMap.clear()}getPostProcessingEffects(o){if(!o||0===o.length)return[];const e=[];for(const t of o){const o=c(t.type);let s=this._effectMap.get(o);s||(s=f[o](),this._effectMap.set(o,s)),e.push({postProcessingEffect:s,effect:t})}return e}}export{i as EffectManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import a from"../../../core/Accessor.js";import{clamp as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import a from"../../../core/Accessor.js";import{clamp as e}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as s,isNone as o}from"../../../core/maybe.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c,e as d}from"../../../chunks/mat4.js";import{c as f}from"../../../chunks/mat4f64.js";import{y as h,c as u,l as m,n as I,g as l,b as F}from"../../../chunks/vec3.js";import{c as g,f as p}from"../../../chunks/vec3f64.js";import{create as _,fromPoints as H,axis as E}from"../../../geometry/support/axisAngle.js";import{CloudsCompositionTechnique as D}from"./CloudsCompositionTechnique.js";import{weatherHeightLimit as N}from"./weather.js";import{NoParameters as C}from"../webgl-engine/core/shaderModules/interfaces.js";import{createQuadVAO as S}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as O}from"../../webgl/enums.js";let A=class extends a{constructor(t){super(t),this._inverseViewMatrix=f(),this._technique=new D(t),this._vao=S(t.rctx),this._parameters=new U(t.radius)}destroy(){this._technique=r(this._technique),this._vao=s(this._vao)}render(t,a,e){const r=t.bindParameters.camera;if(o(this._vao)||o(r))return;if(!this._technique.compiled)return void this.requestRender();this._parameters.clouds=a;const s=t.rctx,i=s.bindTechnique(this._technique,R,t.bindParameters);t.bindParameters.lighting.setLightDirectionUniform(i),t.bindParameters.lighting.setUniforms(i,!1),c(this._inverseViewMatrix,r.viewMatrix),i.setUniformMatrix4fv("inverseViewMatrix",this._inverseViewMatrix),i.setUniform2f("cloudVariables",this._parameters.clouds.coverage,this._parameters.clouds.absorption),this._setParallaxParams(r.eye,e),t.bindParameters.cloudsComposition=this._parameters,w(i,r,this._parameters),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(O.TRIANGLE_STRIP,0,4),this.fading&&this.requestRender()}get fading(){return this._parameters.crossFade.stage!==P.FINISHED||this._parameters.fadeInOut.stage!==v.FINISHED||this._parameters.fadeIn.stage!==x.FINISHED||this._parameters.fadeInOutHeight.stage!==T.FINISHED}_isCameraPositionFinal(t){return h(this._parameters.cameraPositionLastFrame,t)}_setFadeInStage(t){const a=performance.now(),e=this._parameters,r=e.parallax.anchorPointClouds,s=this._isCameraPositionFinal(t);e.fadeIn.stage===x.FINISHED&&(e.fadeIn.factor=1,u(r,y),e.fadeIn.stage=x.CHANGE_ANCHOR,e.crossFade.stage=P.FINISHED,e.fadeInOut.stage=v.FINISHED),e.fadeIn.stage===x.CHANGE_ANCHOR&&s&&(u(r,y),e.fadeIn.stage=x.FADE_IN,e.startTime=a),e.fadeIn.factor>0&&e.fadeIn.stage===x.FADE_IN&&(e.fadeIn.factor=1-(a-e.startTime)/q),e.fadeIn.factor<=0&&e.fadeIn.stage===x.FADE_IN&&(e.fadeIn.stage=x.FINISHED,e.fadeIn.factor=0)}_setCrossFadingStage(){const t=performance.now(),a=this._parameters,{crossFade:e}=a,r=a.parallax.anchorPointClouds;e.stage===P.FINISHED&&(u(r,y),a.startTime=t,e.factor=0,e.stage=P.CROSS_FADE),e.factor<1&&e.stage===P.CROSS_FADE&&(e.factor=(t-a.startTime)/V),e.factor>=1&&e.stage===P.CROSS_FADE&&(e.stage=P.FINISHED,e.factor=1,u(r,a.parallaxNew.anchorPointClouds))}_setFadeInOutStage(t){const a=performance.now(),e=this._parameters,{fadeInOut:r,crossFade:s}=e;r.stage===v.FINISHED&&(e.startTime=a,r.factor=0,r.stage=v.FADE_OUT),r.factor<1&&r.stage===v.FADE_OUT&&(r.factor=(a-e.startTime)/G),r.factor>=1&&r.stage===v.FADE_OUT&&(r.factor=1,u(e.parallax.anchorPointClouds,y)),r.factor>=1&&r.stage===v.FADE_OUT&&this._isCameraPositionFinal(t)&&(e.startTime=a,r.factor=1,r.stage=v.FADE_IN,s.stage=P.FINISHED,s.factor=0),r.factor>0&&r.stage===v.FADE_IN&&(r.factor=1-(a-e.startTime)/q),r.factor<=0&&r.stage===v.FADE_IN&&(r.stage=v.FINISHED,r.factor=0)}_setFadeInOutHeight(t){const a=performance.now(),r=this._parameters,s=r.fadeInOutHeight,o=(a-(s.stage===T.FINISHED?a:r.startTimeHeightFade))/L;s.factor+=t?o:-o,r.startTimeHeightFade=a,s.factor=e(s.factor,0,1),s.stage=T.HEIGHT_FADE}_setParallaxParams(t,a){const e=this._parameters,{parallax:r}=e;e.fadeInOutHeight.factor<0&&(e.fadeInOutHeight.factor=m(t)-e.radius>N?1:0),I(y,t),l(y,y,e.radius),0===r.anchorPointClouds[0]&&0===r.anchorPointClouds[1]&&0===r.anchorPointClouds[2]&&u(r.anchorPointClouds,y);const s=m(F(M,r.anchorPointClouds,y));let o=!0;s>e.fadeIn.distanceThresholdFactor*r.cloudsHeight||e.fadeIn.stage!==x.FINISHED?this._setFadeInStage(t):s>e.fadeInOut.distanceThresholdFactor*r.cloudsHeight||e.fadeInOut.stage!==v.FINISHED?this._setFadeInOutStage(t):s>e.crossFade.distanceThresholdFactor*r.cloudsHeight&&!a||e.crossFade.stage!==P.FINISHED?this._setCrossFadingStage():o=!1;const i=m(t),n=i-e.radius;if((n>1.7*N||n<-N)&&e.fadeInOutHeight.factor<1?e.fadeInOutHeight.factor=1:(n>N||n<-.35*N)&&e.fadeInOutHeight.factor<1?this._setFadeInOutHeight(!0):n<N&&n>-.35*N&&e.fadeInOutHeight.factor>0?this._setFadeInOutHeight(!1):e.fadeInOutHeight.stage=T.FINISHED,r.radiusCurvatureCorrectionFactor=.84*Math.sqrt(Math.max(i*i-e.radius*e.radius,0))/i,H(b,r.anchorPointClouds,j),r.transform=f(),d(r.transform,r.transform,j[3],E(j)),o){const{parallaxNew:t}=e;H(b,t.anchorPointClouds,j),t.transform=f(),d(t.transform,t.transform,j[3],E(j))}u(e.cameraPositionLastFrame,t)}};var x,v,P,T;t([i({constructOnly:!0})],A.prototype,"rctx",void 0),t([i({constructOnly:!0})],A.prototype,"viewingMode",void 0),t([i({constructOnly:!0})],A.prototype,"radius",void 0),t([i({constructOnly:!0})],A.prototype,"requestRender",void 0),A=t([n("esri.views.3d.environment.CloudsComposition")],A),function(t){t[t.FINISHED=0]="FINISHED",t[t.CHANGE_ANCHOR=1]="CHANGE_ANCHOR",t[t.FADE_IN=2]="FADE_IN"}(x||(x={})),function(t){t[t.FINISHED=0]="FINISHED",t[t.FADE_OUT=1]="FADE_OUT",t[t.FADE_IN=2]="FADE_IN"}(v||(v={})),function(t){t[t.FINISHED=0]="FINISHED",t[t.CROSS_FADE=1]="CROSS_FADE"}(P||(P={})),function(t){t[t.FINISHED=0]="FINISHED",t[t.HEIGHT_FADE=1]="HEIGHT_FADE"}(T||(T={}));class U{constructor(t){this.radius=t,this.startTime=0,this.startTimeHeightFade=0,this.cameraPositionLastFrame=g(),this.parallax={anchorPointClouds:g(),cloudsHeight:1e5,radiusCurvatureCorrectionFactor:0,transform:f()},this.parallaxNew={anchorPointClouds:g(),cloudsHeight:1e5,radiusCurvatureCorrectionFactor:0,transform:f()},this.crossFade={stage:P.FINISHED,factor:0,distanceThresholdFactor:.3},this.fadeInOut={stage:v.FINISHED,factor:0,distanceThresholdFactor:.6},this.fadeIn={stage:x.FINISHED,factor:0,distanceThresholdFactor:2},this.fadeInOutHeight={stage:T.FINISHED,factor:-1}}}function w(t,a,r){t.bindTexture("cubeMap",r.clouds.cubeMap.colorTexture),t.setUniform1f("cloudsHeight",r.parallax.cloudsHeight),t.setUniformMatrix4fv("rotationMatrixClouds",r.parallax.transform),t.setUniformMatrix4fv("rotationMatrixCloudsCrossFade",r.parallaxNew.transform),t.setUniform3fv("anchorPosition",r.parallax.anchorPointClouds),t.setUniform3fv("anchorPositionCrossFade",r.parallaxNew.anchorPointClouds),r.fadeInOut.stage!==v.FINISHED?t.setUniform1f("totalFadeInOut",r.fadeInOutHeight.factor+Math.max(e(r.fadeInOut.factor,0,1))):t.setUniform1f("totalFadeInOut",r.fadeInOutHeight.factor+Math.max(e(r.fadeIn.factor,0,1))),t.setUniform1f("radiusCurvatureCorrectionFactor",r.parallax.radiusCurvatureCorrectionFactor),t.setUniform1i("crossFade",r.crossFade.stage),t.setUniform1f("crossFadeAnchorFactor",e(r.crossFade.factor,0,1)),t.setUniform1f("radius",r.radius),t.setUniform3fv("cameraPosition",a.eye)}const b=p(0,0,1),j=_(),y=g(),M=g(),R=new C,q=500,G=250,V=500,L=500;export{A as CloudsComposition,U as CloudsCompositionParameters,w as bindCloudsComposition};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,isAbortError as
|
|
5
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,isAbortError as s}from"../../../core/promiseUtils.js";import{c as i}from"../../../chunks/mat4.js";import{c as a}from"../../../chunks/mat4f64.js";import{requestImage as n}from"../../../support/requestImageUtils.js";import{S as m}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as l}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as h,SimpleAtmosphereGeometry as p}from"./SimpleAtmosphereTechniqueConfiguration.js";import c from"./resources/SimpleAtmosphereTexture.js";import{glLayout as u}from"../support/buffer/glUtil.js";import{newLayout as f}from"../support/buffer/InterleavedLayout.js";import{Default3D as g}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import _ from"../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as d}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{PixelFormat as y,PixelType as j,TextureWrapMode as v,TextureSamplingMode as x,PrimitiveType as A,Usage as w}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as P}from"../../webgl/Util.js";import{VertexArrayObject as T}from"../../webgl/VertexArrayObject.js";const q=e.getLogger("esri.views.3d.environment.PanoramicAtmosphere");class R{constructor(){this.type="panoramic",this._techniqueConfig=new h,this._passParameters=new m,this._readyResolver=o(),this._readyController=new AbortController}destroy(){this._readyResolver.reject(),this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao),this._readyController=r(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(e){this._techniqueConfig.geometry=p.Cylinder,this._technique=e.shaderTechniqueRepository.acquire(l,this._techniqueConfig);const t=e.renderContext.rctx;this._vao=this._createVertexArrayObject(t),this._vaoCount=P(this._vao,"geometry"),n(c,{signal:this._readyController.signal}).then((r=>{this._passParameters.texture=new C(t,{pixelFormat:y.RGBA,dataType:j.UNSIGNED_BYTE,wrapMode:v.CLAMP_TO_EDGE,samplingMode:x.LINEAR,flipped:!0},r),e.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((e=>{s(e)||q.error("Unable to initialize atmosphere: image request failed",e),this._readyResolver.reject()}))}get canRender(){return null!=this._passParameters.texture}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,this._passParameters,e.bindParameters);I(O,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",O),e.bindParameters.lighting.setLightDirectionUniform(r),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(A.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=_.createPolySphereGeometry(1,2,!1),r=t.indices.get(d.POSITION);for(let a=0;a<r.length;a+=3){const e=r[a];r[a]=r[a+2],r[a+2]=e}const o=t.vertexAttributes.get(d.POSITION).data,s=S.createBuffer(r.length),i=s.position;for(let a=0;a<r.length;++a){const e=3*r[a];i.set(a,0,o[e]),i.set(a,1,o[e+1]),i.set(a,2,o[e+2])}return new T(e,g,{geometry:u(S)},{geometry:b.createVertex(e,w.STATIC_DRAW,s.buffer)})}}function I(e,t){i(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const O=a(),S=f().vec3f(d.POSITION);export{R as PanoramicAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"./SimpleAtmosphereTechniqueConfiguration.js";import"../webgl-engine/core/shaderLibrary/Transform.glsl.js";import"../webgl-engine/core/shaderModules/Float2Uniform.js";import"../webgl-engine/core/shaderModules/Float3Uniform.js";import"../webgl-engine/core/shaderModules/FloatUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix4Uniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DUniform.js";import"../webgl-engine/core/shaderTechnique/BindType.js";import"../webgl-engine/lib/VertexAttribute.js";export{b as build}from"../../../chunks/SimpleAtmosphere.glsl.js";
|
|
5
|
+
import"./SimpleAtmosphereTechniqueConfiguration.js";import"../webgl-engine/core/shaderLibrary/Transform.glsl.js";import"../webgl-engine/core/shaderModules/Float2Uniform.js";import"../webgl-engine/core/shaderModules/Float3Uniform.js";import"../webgl-engine/core/shaderModules/FloatUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix4Uniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DUniform.js";import"../webgl-engine/core/shaderTechnique/BindType.js";import"../webgl-engine/lib/VertexAttribute.js";export{S as SimpleAtmospherePassParameters,b as build}from"../../../chunks/SimpleAtmosphere.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as
|
|
5
|
+
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as a,isNone as o}from"../../../core/maybe.js";import{createResolver as n,throwIfAborted as h,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as l,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{n as d}from"../../../chunks/mat4.js";import{c as u}from"../../../chunks/mat4f64.js";import{s as p}from"../../../chunks/vec2.js";import{a as f}from"../../../chunks/vec2f64.js";import{l as _,g,a as R,i as j,f as x,p as V}from"../../../chunks/vec3.js";import{c as y}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../geometry/projectionEllipsoid.js";import{isMars as v}from"../../../geometry/support/spatialReferenceUtils.js";import{requestImage as b}from"../../../support/requestImageUtils.js";import{computeInnerAltitudeFade as A,innerAtmosphereDepth as T}from"./atmosphereUtils.js";import{S as w}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as q}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as U,SimpleAtmosphereGeometry as D}from"./SimpleAtmosphereTechniqueConfiguration.js";import S from"./resources/MarsAtmosphereTexture.js";import F from"./resources/SimpleAtmosphereTexture.js";import{makePiecewiseLinearFunction as M}from"../support/mathUtils.js";import{glLayout as P}from"../support/buffer/glUtil.js";import{newLayout as I}from"../support/buffer/InterleavedLayout.js";import{Default3D as L}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as O}from"../webgl-engine/lib/glUtil3D.js";import{project as E}from"../webgl-engine/lib/Util.js";import{VertexAttribute as W}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as k}from"../../webgl/BufferObject.js";import{PixelFormat as N,PixelType as G,TextureWrapMode as B,TextureSamplingMode as H,PrimitiveType as z,Usage as Y}from"../../webgl/enums.js";import{Texture as J}from"../../webgl/Texture.js";import{vertexCount as K}from"../../webgl/Util.js";import{VertexArrayObject as Q}from"../../webgl/VertexArrayObject.js";const X=e.getLogger("esri.views.3d.environment.SimpleAtmosphere"),Z=128,$=-T,ee=0,te=50,re=()=>1-511/512,ie=M([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class se{constructor(e){this.view=e,this.type="simple",this._renderData={texV:f(),silCircleCenter:y(),silCircleV1:y(),silCircleV2:y(),altitudeFade:0,innerScale:0,undergroundFadeAlpha:0},this._passParameters=new w,this._fadeVaoCount=0,this._readyResolver=n(),this._readyController=new AbortController,this.texV1=1,this.canRender=!0,this.isOnMars=v(e.spatialReference);const t=C(e.spatialReference);this.planetRadius=t.radius,this.outerRimWidth=t.outerAtmosphereRimWidth,this.innerRimFactor=(this.planetRadius+$)/this.planetRadius,this.middleRimFactor=(this.planetRadius+ee)/this.planetRadius,this.outerRimFactor=(this.planetRadius+this.outerRimWidth)/this.planetRadius,this.texV0=ee/this.outerRimWidth,this.texVScale=this.texV1-this.texV0}destroy(){this._readyResolver.reject(),this._cameraChangeHandle=i(this._cameraChangeHandle),this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao),this._readyController=a(this._readyController)}when(){return this._readyResolver.promise}async initializeRenderContext(e){this._shaderTechniqueRepository=e.shaderTechniqueRepository;const t=e.renderContext.rctx;this._cameraChangeHandle=l((()=>{var e;return null==(e=this.view.state)?void 0:e.camera}),(()=>e.requestRender()),c),this._vao=this._createRibbon(t),this._vaoCount=K(this._vao,"geometry"),this._fadeVao=O(t),this._fadeVaoCount=K(this._fadeVao,"geometry");const r=this.isOnMars?S:F,i=this._readyController.signal;try{const s=await b(r,{signal:i});h(i),this._passParameters.texture=new J(t,{pixelFormat:N.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:B.CLAMP_TO_EDGE,samplingMode:H.LINEAR,flipped:!0},s),e.requestRender(),this._readyController=null,this._readyResolver.resolve()}catch(s){m(s)||X.error("Unable to initialize simple atmosphere: image request failed",s),this._readyResolver.reject(s)}}get coneTechnique(){if(o(this._coneTechnique)){const e=new U;e.geometry=D.Cone,this._coneTechnique=this._shaderTechniqueRepository.acquire(q,e)}return this._coneTechnique}get undergroundTechnique(){if(o(this._undergroundTechnique)){const e=new U;e.geometry=D.Underground,this._undergroundTechnique=this._shaderTechniqueRepository.acquire(q,e)}return this._undergroundTechnique}render(e){const t=e.bindParameters.camera;this._update(t);const r=e.rctx;if(this._renderData.undergroundFadeAlpha<1){const i=r.bindTechnique(this.coneTechnique,this._passParameters,e.bindParameters);i.setUniformMatrix4fv("proj",t.projectionMatrix),i.setUniformMatrix4fv("view",t.viewMatrix),i.setUniform3fv("silCircleCenter",this._renderData.silCircleCenter),i.setUniform3fv("silCircleV1",this._renderData.silCircleV1),i.setUniform3fv("silCircleV2",this._renderData.silCircleV2),i.setUniform2fv("texV",this._renderData.texV),e.bindParameters.lighting.setLightDirectionUniform(i),i.setUniform1f("altitudeFade",this._renderData.altitudeFade),i.setUniform1f("innerScale",this._renderData.innerScale),r.bindVAO(this._vao),r.drawArrays(z.TRIANGLES,0,this._vaoCount)}if(this._renderData.undergroundFadeAlpha>0){const i=r.bindTechnique(this.undergroundTechnique,this._passParameters,e.bindParameters);i.setUniform1f("undergroundFadeAlpha",this._renderData.undergroundFadeAlpha),e.bindParameters.lighting.setLightDirectionUniform(i),i.setUniform3fv("cameraPosition",t.eye),r.bindVAO(this._fadeVao),r.drawArrays(z.TRIANGLE_STRIP,0,this._fadeVaoCount)}}renderHaze(){return!1}_update(e){const i=y(),s=this.planetRadius,a=_(e.eye),o=a-s;if(o<0){const e=Math.min(-o/5e3,1);this._renderData.undergroundFadeAlpha=e}else this._renderData.undergroundFadeAlpha=0;const n=Math.max(te,o),h=s+$;this._renderData.innerScale=me(s+n,s,h)-1,this._renderData.altitudeFade=A(o),g(i,e.eye,(s+te)/a),ae(i,e.center,e.up,s,this._renderData);const m=this._computeScreenRimWidth(e,i,e.up,this._renderData),l=re(),c=ie(o);let d=this.texV0+l*this.texVScale,u=this.texV0+m*c*this.texVScale;if(o>te){ae(e.eye,e.center,e.up,s,this._renderData);const i=this._computeScreenRimWidth(e,e.eye,e.up,this._renderData),a=r((i-1.5)/(m-1.5),0,1);d=this.texV0+a*l*this.texVScale,u=this.texV0+t(this.texV1,m*c,a)*this.texVScale}p(this._renderData.texV,d,u)}_createRibbon(e){const t=new Float32Array(3+3*Z*3),r=new Uint32Array(3*Z*5);t[0]=0,t[1]=0,t[2]=-1;for(let a=0;a<Z;a++){const e=9*a+3;t[e+0]=a,t[e+1]=this.innerRimFactor,t[e+2]=-1,t[e+3]=a,t[e+4]=this.middleRimFactor,t[e+5]=0,t[e+6]=a,t[e+7]=this.outerRimFactor,t[e+8]=1;const i=3*a+1,s=a===Z-1?1:i+3,o=15*a;r[o+0]=i,r[o+1]=i+1,r[o+2]=s+1,r[o+3]=s+1,r[o+4]=s,r[o+5]=i,r[o+6]=i+1,r[o+7]=i+2,r[o+8]=s+2,r[o+9]=s+2,r[o+10]=s+1,r[o+11]=i+1,r[o+12]=i,r[o+13]=s,r[o+14]=0}const i=le.createBuffer(r.length),s=i.position;for(let a=0;a<r.length;++a){const e=3*r[a];s.set(a,0,t[e]),s.set(a,1,t[e+1]),s.set(a,2,t[e+2])}return new Q(e,L,{geometry:P(le)},{geometry:k.createVertex(e,Y.STATIC_DRAW,i.buffer)})}_computeScreenRimWidth(e,t,r,i){return R(ne,i.silCircleCenter,i.silCircleV2),g(he,ne,this.outerRimFactor),d(oe,t,ne,r),E(ne,oe,e.projectionMatrix,e.viewport),E(he,oe,e.projectionMatrix,e.viewport),j(ne,he)/e.height}}function ae(e,t,r,i,s){const a=_(e),o=i*Math.sqrt(a*a-i*i)/a,n=Math.sqrt(i*i-o*o),h=s.silCircleV1,m=s.silCircleV2;return g(s.silCircleCenter,e,n/a),x(h,e,t),V(h)<1&&x(h,e,r),g(h,h,o/_(h)),x(m,h,e),g(m,m,o/_(m)),o}const oe=u(),ne=y(),he=y();function me(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const le=I().vec3f(W.POSITION);export{se as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{a as e}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereGeometry as r}from"./SimpleAtmosphereTechniqueConfiguration.js";import{ReloadableShaderModule as i}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Default3D as t}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as n}from"../webgl-engine/lib/Program.js";import{BlendFactor as l,CompareFunction as s}from"../../webgl/enums.js";import{makePipelineState as m,separateBlendingParams as g,backFaceCullingParams as a,defaultColorWriteParams as p}from"../../webgl/renderState.js";class c extends o{initializeProgram(e){const r=c.shader.get().build(this.configuration);return new n(e.rctx,r,t)}initializePipeline(){return this.configuration.geometry===r.Cylinder?m({blending:g(l.SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),culling:a,depthTest:{func:s.LEQUAL},colorWrite:p}):m({blending:g(l.SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),depthTest:{func:s.LEQUAL},colorWrite:p})}}c.shader=new i(e,(()=>import("./SimpleAtmosphere.glsl.js")));export{c as SimpleAtmosphereTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,b as l,E as c,l as m,n as d,h as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as h,BufferViewVec4f as b,BufferViewVec2f as R,BufferViewVec4u8 as v,BufferViewVec4u16 as B,BufferViewVec3u8 as M,BufferViewVec3u16 as T}from"../../../../geometry/support/buffer/BufferView.js";import{t as w,a as y,s as j}from"../../../../chunks/vec32.js";import{t as E,s as O}from"../../../../chunks/vec42.js";import{createBuffer as C}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as S}from"../../glTF/DefaultLoadingContext.js";import{load as A}from"../../glTF/loader.js";import{triangleFanToTriangles as N,triangleStripToTriangles as I,trianglesToTriangles as L}from"../../glTF/internal/indexUtils.js";import{load as F,processLoadResult as k}from"./wosrLoader.js";import{AlphaDiscardMode as P,DepthTestFunction as V,CullFaceOptions as _}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as G}from"../../webgl-engine/lib/Geometry.js";import{Texture as D}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as z}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as U}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as q}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{n as $}from"../../../../chunks/vec22.js";import{c as K,f as Q}from"../../../../chunks/vec43.js";import{c as H}from"../../../../chunks/vec33.js";async function J(s,o){const i=X(e(s));if("wosr"===i.fileType){const e=await(o.cache?o.cache.loadWOSR(i.url,o):F(i.url,o)),t=k(e,o);return{lods:[t],referenceBoundingBox:t.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const a=await(o.cache?o.cache.loadGLTF(i.url,o,o.usePBR):A(new S(o.streamDataRequester),i.url,o,o.usePBR)),u=t(a.model.meta,"ESRI_proxyEllipsoid");a.meta.isEsriSymbolResource&&r(u)&&a.meta.uri.includes("/RealisticTrees/")&&te(a,u);const n=a.meta.isEsriSymbolResource?{usePBR:o.usePBR,isSchematic:!1,treeRendering:a.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:o.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},l={...o.materialParamsMixin,treeRendering:a.customMeta.esriTreeRendering};if(null!=i.specifiedLodIndex){const e=Y(a,n,l,i.specifiedLodIndex);let t=e[0].boundingBox;if(0!==i.specifiedLodIndex){t=Y(a,n,l,0)[0].boundingBox}return{lods:e,referenceBoundingBox:t,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}const c=Y(a,n,l);return{lods:c,referenceBoundingBox:c[0].boundingBox,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}function X(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function Y(e,t,s,a){const u=e.model,n=i(),l=new Array,c=new Map,m=new Map;return u.lods.forEach(((e,i)=>{if(void 0!==a&&i!==a)return;const d={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:r(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:x()};l.push(d),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=u.materials.get(e.material),l=r(e.attributes.texCoord0),f=r(e.attributes.normal),p=Z(a.alphaMode);if(!c.has(i)){if(l){if(r(a.textureColor)&&!m.has(a.textureColor)){const e=u.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:p!==P.Opaque};m.set(a.textureColor,new D(e.data,t))}if(r(a.textureNormal)&&!m.has(a.textureNormal)){const e=u.textures.get(a.textureNormal);m.set(a.textureNormal,new D(e.data,e.parameters))}if(r(a.textureOcclusion)&&!m.has(a.textureOcclusion)){const e=u.textures.get(a.textureOcclusion);m.set(a.textureOcclusion,new D(e.data,e.parameters))}if(r(a.textureEmissive)&&!m.has(a.textureEmissive)){const e=u.textures.get(a.textureEmissive);m.set(a.textureEmissive,new D(e.data,e.parameters))}if(r(a.textureMetallicRoughness)&&!m.has(a.textureMetallicRoughness)){const e=u.textures.get(a.textureMetallicRoughness);m.set(a.textureMetallicRoughness,new D(e.data,e.parameters))}}const o=a.color[0]**(1/q),n=a.color[1]**(1/q),d=a.color[2]**(1/q),x=a.emissiveFactor[0]**(1/q),g=a.emissiveFactor[1]**(1/q),h=a.emissiveFactor[2]**(1/q),b=r(a.textureColor)&&l?m.get(a.textureColor):null;c.set(i,new U({...t,transparent:p===P.Blend,customDepthTest:V.Lequal,textureAlphaMode:p,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,n,d],ambient:[o,n,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?_.None:_.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:f?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,b as l,E as c,l as m,n as d,h as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as h,BufferViewVec4f as b,BufferViewVec2f as R,BufferViewVec4u8 as v,BufferViewVec4u16 as B,BufferViewVec3u8 as M,BufferViewVec3u16 as T}from"../../../../geometry/support/buffer/BufferView.js";import{t as w,a as y,s as j}from"../../../../chunks/vec32.js";import{t as E,s as O}from"../../../../chunks/vec42.js";import{createBuffer as C}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as S}from"../../glTF/DefaultLoadingContext.js";import{load as A}from"../../glTF/loader.js";import{triangleFanToTriangles as N,triangleStripToTriangles as I,trianglesToTriangles as L}from"../../glTF/internal/indexUtils.js";import{load as F,processLoadResult as k}from"./wosrLoader.js";import{AlphaDiscardMode as P,DepthTestFunction as V,CullFaceOptions as _}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as G}from"../../webgl-engine/lib/Geometry.js";import{Texture as D}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as z}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as U}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as q}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{n as $}from"../../../../chunks/vec22.js";import{c as K,f as Q}from"../../../../chunks/vec43.js";import{c as H}from"../../../../chunks/vec33.js";async function J(s,o){const i=X(e(s));if("wosr"===i.fileType){const e=await(o.cache?o.cache.loadWOSR(i.url,o):F(i.url,o)),t=k(e,o);return{lods:[t],referenceBoundingBox:t.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const a=await(o.cache?o.cache.loadGLTF(i.url,o,o.usePBR):A(new S(o.streamDataRequester),i.url,o,o.usePBR)),u=t(a.model.meta,"ESRI_proxyEllipsoid");a.meta.isEsriSymbolResource&&r(u)&&a.meta.uri.includes("/RealisticTrees/")&&te(a,u);const n=a.meta.isEsriSymbolResource?{usePBR:o.usePBR,isSchematic:!1,treeRendering:a.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:o.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},l={...o.materialParamsMixin,treeRendering:a.customMeta.esriTreeRendering};if(null!=i.specifiedLodIndex){const e=Y(a,n,l,i.specifiedLodIndex);let t=e[0].boundingBox;if(0!==i.specifiedLodIndex){t=Y(a,n,l,0)[0].boundingBox}return{lods:e,referenceBoundingBox:t,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}const c=Y(a,n,l);return{lods:c,referenceBoundingBox:c[0].boundingBox,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}function X(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function Y(e,t,s,a){const u=e.model,n=i(),l=new Array,c=new Map,m=new Map;return u.lods.forEach(((e,i)=>{if(void 0!==a&&i!==a)return;const d={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:r(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:x()};l.push(d),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=u.materials.get(e.material),l=r(e.attributes.texCoord0),f=r(e.attributes.normal),p=Z(a.alphaMode);if(!c.has(i)){if(l){if(r(a.textureColor)&&!m.has(a.textureColor)){const e=u.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:p!==P.Opaque};m.set(a.textureColor,new D(e.data,t))}if(r(a.textureNormal)&&!m.has(a.textureNormal)){const e=u.textures.get(a.textureNormal);m.set(a.textureNormal,new D(e.data,e.parameters))}if(r(a.textureOcclusion)&&!m.has(a.textureOcclusion)){const e=u.textures.get(a.textureOcclusion);m.set(a.textureOcclusion,new D(e.data,e.parameters))}if(r(a.textureEmissive)&&!m.has(a.textureEmissive)){const e=u.textures.get(a.textureEmissive);m.set(a.textureEmissive,new D(e.data,e.parameters))}if(r(a.textureMetallicRoughness)&&!m.has(a.textureMetallicRoughness)){const e=u.textures.get(a.textureMetallicRoughness);m.set(a.textureMetallicRoughness,new D(e.data,e.parameters))}}const o=a.color[0]**(1/q),n=a.color[1]**(1/q),d=a.color[2]**(1/q),x=a.emissiveFactor[0]**(1/q),g=a.emissiveFactor[1]**(1/q),h=a.emissiveFactor[2]**(1/q),b=r(a.textureColor)&&l?m.get(a.textureColor):null;c.set(i,new U({...t,transparent:p===P.Blend,customDepthTest:V.Lequal,textureAlphaMode:p,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,n,d],ambient:[o,n,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?_.None:_.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:f?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:r(b)?b.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:r(a.textureNormal)&&l?m.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:r(b)&&!!b.params.preMultiplyAlpha,occlusionTextureId:r(a.textureOcclusion)&&l?m.get(a.textureOcclusion).id:void 0,emissiveTextureId:r(a.textureEmissive)&&l?m.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:r(a.textureMetallicRoughness)&&l?m.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[x,g,h],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...s}))}const x=ee(e.indices||e.attributes.position.count,e.primitiveType),S=e.attributes.position.count,A=C(h,S);w(A,e.attributes.position,e.transform);const N=[[z.POSITION,{data:A.typedBuffer,size:A.elementCount,exclusive:!0}]],I=[[z.POSITION,x]];if(r(e.attributes.normal)){const t=C(h,S);o(n,e.transform),y(t,e.attributes.normal,n),N.push([z.NORMAL,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.NORMAL,x])}if(r(e.attributes.tangent)){const t=C(b,S);o(n,e.transform),E(t,e.attributes.tangent,n),N.push([z.TANGENT,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.TANGENT,x])}if(r(e.attributes.texCoord0)){const t=C(R,S);$(t,e.attributes.texCoord0),N.push([z.UV0,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.UV0,x])}if(r(e.attributes.color)){const t=C(v,S);if(4===e.attributes.color.elementCount)e.attributes.color instanceof b?O(t,e.attributes.color,255):e.attributes.color instanceof v?K(t,e.attributes.color):e.attributes.color instanceof B&&O(t,e.attributes.color,1/256);else{Q(t,255,255,255,255);const r=new M(t.buffer,0,4);e.attributes.color instanceof h?j(r,e.attributes.color,255):e.attributes.color instanceof M?H(r,e.attributes.color):e.attributes.color instanceof T&&j(r,e.attributes.color,1/256)}N.push([z.COLOR,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.COLOR,x])}const L=new G(N,I);d.stageResources.geometries.push(L),d.stageResources.materials.push(c.get(i)),l&&(r(a.textureColor)&&d.stageResources.textures.push(m.get(a.textureColor)),r(a.textureNormal)&&d.stageResources.textures.push(m.get(a.textureNormal)),r(a.textureOcclusion)&&d.stageResources.textures.push(m.get(a.textureOcclusion)),r(a.textureEmissive)&&d.stageResources.textures.push(m.get(a.textureEmissive)),r(a.textureMetallicRoughness)&&d.stageResources.textures.push(m.get(a.textureMetallicRoughness))),d.numberOfVertices+=S;const F=L.boundingInfo;r(F)&&(g(d.boundingBox,F.getBBMin()),g(d.boundingBox,F.getBBMax()))}))})),l}function Z(e){switch(e){case"BLEND":return P.Blend;case"MASK":return P.Mask;case"OPAQUE":case null:case void 0:return P.Opaque}}function ee(e,t){switch(t){case W.TRIANGLES:return L(e);case W.TRIANGLE_STRIP:return I(e);case W.TRIANGLE_FAN:return N(e)}}function te(e,t){for(let r=0;r<e.model.lods.length;++r){const o=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const i of o.parts){const o=i.attributes.normal;if(s(o))return;const x=i.attributes.position,g=x.count,b=p(),R=p(),B=p(),M=C(v,g),T=C(h,g),w=a(u(),i.transform);for(let s=0;s<g;s++){x.getVec(s,R),o.getVec(s,b),n(R,R,i.transform),l(B,R,t.center),c(B,B,t.radius);const a=B[2],u=m(B),p=Math.min(.45+.55*u*u,1);c(B,B,t.radius),n(B,B,w),d(B,B),r+1!==e.model.lods.length&&e.model.lods.length>1&&f(B,B,b,a>-1?.2:Math.min(-4*a-3.8,1)),T.setVec(s,B),M.set(s,0,255*p),M.set(s,1,255*p),M.set(s,2,255*p),M.set(s,3,255)}i.attributes.normal=T,i.attributes.color=M}}}export{J as fetch,Y as gltfToEngineResources,X as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{b as c,s as u,n as p,e as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{Z as T,c as b}from"../../../chunks/vec4f64.js";import{create as R,set as _,expandWithOffset as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as A}from"../../../support/requestImageUtils.js";import{ViewingMode as O}from"../../ViewingMode.js";import{TextureUpdate as x,OverlayIndex as D}from"./interfaces.js";import{LayerClass as P}from"./LayerClass.js";import{OverlaySource as E}from"./Overlay.js";import{overlayRenderOccludedFlag as S}from"./OverlayRenderer.js";import{clearCaches as C,getGlobalSkirtGeometry as I,intersectSkirtsGlobal as k,intersectSkirtsLocal as N}from"./PatchGeometryFactory.js";import{PatchRenderData as q}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{ScaleRangeQueries as L}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as M}from"./TerrainConst.js";import{TileRenderer as j}from"./TileRenderer.js";import{TileUpdate as G}from"./TileUpdate.js";import{IteratorPreorder as U,sortTiles as B,compareTiles as F}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as H,ComponentIntersectionData as z}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as V}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{SlicePlaneParameters as W}from"../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{OverlayMode as Q}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{NoParameters as Y}from"../webgl-engine/core/shaderModules/interfaces.js";import{RenderRequestType as X}from"../webgl-engine/lib/basicInterfaces.js";import{hasEnabledShadowMap as Z}from"../webgl-engine/lib/BindParameters.js";import{createEmptyTexture as K}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as J}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as $,StoreResults as ee}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as te}from"../webgl-engine/lib/Material.js";import{RenderPass as re}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as ie}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as se}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ne}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as ae,getVerticalOffsetTerrain as oe}from"../webgl-engine/lib/verticalOffsetUtils.js";import{bindScreenSizePerspective as le,intersectAabbInvDirBefore as de,intersectTriangles as he}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as ce}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ue}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as pe,PrimitiveType as ge}from"../../webgl/enums.js";const fe=7,me=10,Te=R(),be=b();let Re=class extends r{constructor(e){super(e),this.type=$.TERRAIN,this.isGround=!0,this.tileSize=256,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new L,this.renderDataPool=new n(q),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new U,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._skirtScale=1,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.overlayOpacity=1,this.needsHighlight=!1,this.renderOccludedFlags=te.Occlude}get isGlobal(){return this.stage.viewingMode===O.Global}initialize(){const e=[ie.OPAQUE_TERRAIN,ie.TRANSPARENT_TERRAIN,ie.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),C()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this.shaderTechniqueConfig.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}set skirtScale(e){e!==this._skirtScale&&(this._skirtScale=e,this.setNeedsRender())}get skirtScale(){return this._skirtScale}get renderPatchBorders(){return!!this.shaderTechniqueConfig.tileBorders}set renderPatchBorders(e){this.shaderTechniqueConfig.tileBorders!==e&&(this.shaderTechniqueConfig.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this.shaderTechniqueConfig.backfaceCullingEnabled}set cullBackFaces(e){this.shaderTechniqueConfig.backfaceCullingEnabled!==e&&(this.shaderTechniqueConfig.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return ae}get slicePlaneEnabled(){return this.shaderTechniqueConfig.hasSlicePlane}set slicePlaneEnabled(e){this.shaderTechniqueConfig.hasSlicePlane!==e&&(this.shaderTechniqueConfig.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this.shaderTechniqueConfig.textureFadingEnabled!==e&&(this.shaderTechniqueConfig.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this.shaderTechniqueConfig.screenSizePerspective!==e&&(this.shaderTechniqueConfig.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?S:te.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}loadTile(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e)),this.updateTileGeometry(e),this.updateTileTexture(e,G.TEXTURE_FADING)}queryVisibleLevelRange(e,t,r,i){this._scaleRangeQueries.queryVisibleLevelRange(e,t,r,i),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===G.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometry(e){for(const t of e.layerInfo[P.ELEVATION])t.pendingUpdates&=~G.GEOMETRY;e.resetPendingUpdate(G.GEOMETRY),e.renderData.updateGeometry(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){e.renderData&&(e.renderData.releaseGeometry()&&this.setNeedsRender(),this.renderDataPool.release(e.renderData),e.renderData.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=me-fe,r=Math.max(0,Math.floor((e.level-t)/fe)*fe);if(this.isGlobal&&0===r)return f;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((t=>{var r;return null==(r=t.renderData)?void 0:r.updateGeometry(this.rctx,e)})),this.setNeedsRender())}setNeedsRender(e=X.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this.shaderTechniques=e.shaderTechniqueRepository,this.shaderTechniqueConfig=new ue,this.tileRenderer=new j(this.rctx,this.tileSize,this.shaderTechniques),this.tileBackground&&this._updateTileBackground(),this.emptyTex=K(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=Oe,o=xe;c(a,n,r),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===ee.MIN,m=!!e.results.ground.target,T=oe(e.verticalOffset),b=this._skirtScale,R=e.tolerance;let A,O=f&&i(l.dist)?l.dist:1/0;const x=u=>{const m=u.renderData;if(null==m)return;const x=m.geometryInfo;_(Te,x.boundingBox);const D=m.localOrigin;i(T)&&(T.localOrigin=D,T.applyToAabb(Te));const P=-b*x.skirtLength;if(0!==P){const e=u.up;y(Te,P*e[0],P*e[1],P*e[2])}const E=Te;if(De[0]=r[0]-D[0],De[1]=r[1]-D[1],De[2]=r[2]-D[2],!de(E,De,o,R,O))return;const S=(e,t,r)=>{e.set(this.type,u,t,r,h),O=f&&i(l.dist)?l.dist:1/0},C=(o,h)=>{if(i(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,n,o))){if((null==p.dist||o<p.dist)&&S(p,o,h),e.options.isFiltered)return;e.options.store===ee.ALL&&(s(A)?(A=J(e.ray),S(A,o,h),e.results.all.push(A)):o<A.dist&&S(A,o,h)),(null==l.dist||o<l.dist)&&S(l,o,h),e.options.store!==ee.MIN&&(null==d.dist||o>d.dist)&&S(d,o,h)}},q=Pe;c(q,n,D);const w=x.indices,L=x.vertexAttributes,M={data:L.getField(ne.POSITION,v).typedBuffer,size:3,stride:L.stride/4},j=x.numWithoutSkirtIndices/3;if(s(T)&&j>H){const e=u.renderData;s(e.intersectionData)&&(e.intersectionData=new z(w,0,j,M)),e.intersectionData.intersectRay({r0:De,r1:q},C)}else he(De,q,0,j,w,M,null,T,C);if(0!==P){const e=w.length/3;if(this.isGlobal){const t=e-j;if(s(T)&&t>H){const r=u.renderData;if(s(r.skirtIntersectionData)){const i=I(w,j,e,L,P,D);r.skirtIntersectionData=new z(i.indices,0,t,{data:i.vertices,stride:3})}r.skirtIntersectionData.intersectRay({r0:De,r1:q},C)}else k(De,q,j,e,w,L,P,D,T,C)}else N(De,q,j,e,w,L,P,T,C)}},D=this._rootTiles;if(i(D)){(()=>{const t=this.tileIterator;t.reset(D);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!i(T)&&!e.intersectsRay(r,a,R,O,b)||m&&this._useStencilForTile(e)?t.skipSubtree():x(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===ie.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&S))return null}else{const t=this.opaque?ie.OPAQUE_TERRAIN:ie.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case re.MATERIAL:{const t=Z(e.bindParameters);this.shaderTechniqueConfig.receiveShadows!==t&&(this.shaderTechniqueConfig.receiveShadows=t);const r=this.overlayRenderer.isEmpty()?Q.Disabled:this.overlayRenderer.hasWater?Q.EnabledWithWater:Q.Enabled;this.shaderTechniqueConfig.overlayMode!==r&&(this.shaderTechniqueConfig.overlayMode=r);const i=e.bindParameters.slot===ie.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;return this._updateTechnique(V.Color,i===E.Occluded)}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?this._updateTechnique(V.Shadow,!1):null;case re.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:this._updateTechnique(V.Depth,!1);case re.MATERIAL_NORMAL:return this._updateTechnique(V.Normal,!1);case re.MATERIAL_HIGHLIGHT:return this.needsHighlight?this._updateTechnique(V.Highlight,!1):null}return null}render(e,t){const r=e.pass,i=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,r){case re.MATERIAL:{const r=e.bindParameters.slot===ie.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;this._renderMaterialPass(e,t,r);break}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&i&&this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,E.Highlight),e.rctx.clearSafe(pe.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,r){const{rctx:s}=e;this._ssrEnabled=e.bindParameters.ssr.enabled;const n=s.bindTechnique(t,Ee,e.bindParameters);i(e.bindParameters.shadowMap)&&e.bindParameters.shadowMap.bind(n);const a=e.bindParameters.camera;i(e.bindParameters.ssaoHelper)&&e.bindParameters.ssaoHelper.bind(n,a),this._bindOverlayData(n,r),e.bindParameters.lighting.setUniforms(n,!0,!1);const o=a.viewMatrix;u(Ae,o[12],o[13],o[14]),p(Ae,Ae),n.setUniform3fv("viewDirection",Ae),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,r):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,r)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,r){const i=e.rctx.bindTechnique(t,Ee,e.bindParameters),s=e.bindParameters.camera;e.pass!==re.MATERIAL_DEPTH&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||i.setUniform2fv("nearFar",s.nearFar),this._renderPatchGroupsAuxiliary(e,t,r)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this.shaderTechniqueConfig.useGrid=this.tileRenderer.backgroundIsGrid,this.shaderTechniqueConfig.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&i(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,x.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;A(t).then((r=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(r,this.tileBackground===M),e())}))}else{const r=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(r,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==w.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>B(this.renderOrder,e))),e.sort(((e,t)=>F(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r||e.visible)if(e.rendered){if(r){const i=this._patchGroups.get(r.localOrigin)||new Array;this._patchGroups.set(r.localOrigin,i),i.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=e.bindParameters.camera;t.program.setUniformMatrix4fv("proj",i.projectionMatrix),t.program.setUniform1f("skirtScale",this._skirtScale),r!==E.None&&this._bindOverlayData(t.program,r);const s=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;this._bindPatchGroupData(t.program,a,i.eye,i.viewMatrix);for(let i=0;i<n.length;i++)this._renderPatch(e,t,n[i],ge.TRIANGLES,s,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const n=e.rctx,a=e.bindParameters.camera,o=a.viewMatrix,l=t.program;if(this.shaderTechniqueConfig.screenSizePerspective&&this.pointsOfInterest){const e=se(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY}),le(e,l,"screenSizePerspective")}const d=this.stencilEnabledLayerExtents.length>0,h=r===E.Occluded;h&&(l.bindTexture("tex",this.emptyTex),l.setUniform1f("blend",1),l.setUniform4fv("texOffsetAndScale",T));const c=i(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this.shaderTechniqueConfig.hasBackgroundColor&&l.setUniform3fv("backgroundColor",c);const u=h?0:this._skirtScale;l.setUniform1f("skirtScale",u);const p=this.wireframe?ge.LINES:ge.TRIANGLES;this.shaderTechniqueConfig.textureFadingEnabled&&l.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const c=n[0].renderData.localOrigin;this._bindPatchGroupData(l,c,a.eye,o),l.bindDraw(new W(c),e.bindParameters),i(e.bindParameters.shadowMap)&&e.bindParameters.shadowMap.bindView(l,c),this.numOriginsRendered++;for(let a=0;a<n.length;a++){const o=n[a],c=o.renderData.textureReference;if(!s(c)){if(!h){this._scaleRangeQueries.scaleQueriesForTile(o),ye(o.renderData.geometryInfo.uvOffsetAndScale,c.offsetAndScale,be),l.setUniform4fv("texOffsetAndScale",be),l.bindTexture("tex",c.texture.texture);const e=o.renderData.textureFadeFactor,t=e<1?o.renderData.nextTextureReference:null;this.shaderTechniqueConfig.textureFadingEnabled&&i(t)&&e<1?(ye(o.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,be),l.setUniform1f("fadeFactor",e),l.setUniform4fv("nextTexOffsetAndScale",be),l.setUniform3fv("nextTexOpacities",t.opacities),l.bindTexture("texNext",t.texture.texture)):l.setUniform1f("fadeFactor",1),o.renderData.textureIsFading&&this.setNeedsRender(),l.setUniform3fv("textureOpacities",c.opacities)}this._renderPatch(e,t,o,p,d,r),o.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,r,i,n,a){if(s(r.renderData.vao.indexBuffer))return;const o=t.program;a!==E.None&&this._bindOverlayPatchData(o,r.renderData.overlay),n&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const l=0===this._skirtScale?r.renderData.geometryInfo.numWithoutSkirtIndices:r.renderData.vao.indexBuffer.size;e.rctx.bindVAO(r.renderData.vao),o.assertCompatibleVertexAttributeLocations(r.renderData.vao),e.rctx.drawElements(i,l,r.renderData.vao.indexBuffer.indexType,0)}_bindPatchGroupData(e,t,r,i){e.setUniform3fv("origin",t),l(ve,i,t),e.setUniformMatrix4fv("view",ve),e.setUniform3f("cameraPosition",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayData(e,t){if(this.shaderTechniqueConfig.overlayMode===Q.Disabled)return;e.setUniform1f("overlayOpacity",this.overlayOpacity);const r=this.overlayRenderer.overlays;if(r.length>D.INNER){const s=r[D.INNER],n=s.getColorTexture(t);if(e.bindTexture("ovColorTex",i(n)?n:this.emptyTex),this.shaderTechniqueConfig.overlayMode===Q.EnabledWithWater){const r=s.getNormalTexture(t);e.bindTexture("ovWaterTex",i(r)?r:this.emptyTex)}}}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this.shaderTechniqueConfig.output=e,e===V.Color&&(this.shaderTechniqueConfig.atmosphere=this.isGlobal&&this._velvetOverground,this.shaderTechniqueConfig.hasScreenSpaceReflections=this._ssrEnabled),this.shaderTechniqueConfig.renderOccluded=t,this.shaderTechniqueConfig.stencilEnabled=!1,this._shaderTechnique=this.shaderTechniques.releaseAndAcquire(ce,this.shaderTechniqueConfig,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],Re.prototype,"tileBackgroundInitialized",void 0),e([a()],Re.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],Re.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],Re.prototype,"stage",void 0),e([a({readOnly:!0})],Re.prototype,"isGlobal",null),e([a({constructOnly:!0})],Re.prototype,"allTiles",void 0),e([a({constructOnly:!0})],Re.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],Re.prototype,"updating",null),e([a({value:!1})],Re.prototype,"renderingDisabled",null),e([a()],Re.prototype,"renderPatchBorders",null),e([a()],Re.prototype,"cullBackFaces",null),e([a({value:w.FRONT_TO_BACK})],Re.prototype,"renderOrder",null),e([a()],Re.prototype,"wireframe",null),Re=e([o("esri.views.3d.terrain.TerrainRenderer")],Re);const _e=Re;function ye(e,t,r){r[0]=e[0]*t[2]+t[0],r[1]=e[1]*t[3]+t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3]}const ve=d(),Ae=m(),Oe=m(),xe=m(),De=m(),Pe=m(),Ee=new Y;export{_e as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{b as c,s as u,n as p,e as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{Z as T,c as b}from"../../../chunks/vec4f64.js";import{create as R,set as _,expandWithOffset as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as A}from"../../../support/requestImageUtils.js";import{ViewingMode as O}from"../../ViewingMode.js";import{TextureUpdate as x,OverlayIndex as D}from"./interfaces.js";import{LayerClass as P}from"./LayerClass.js";import{OverlaySource as E}from"./Overlay.js";import{overlayRenderOccludedFlag as S}from"./OverlayRenderer.js";import{clearCaches as C,getGlobalSkirtGeometry as I,intersectSkirtsGlobal as k,intersectSkirtsLocal as N}from"./PatchGeometryFactory.js";import{PatchRenderData as q}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{ScaleRangeQueries as L}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as M}from"./TerrainConst.js";import{TileRenderer as j}from"./TileRenderer.js";import{TileUpdate as G}from"./TileUpdate.js";import{IteratorPreorder as U,sortTiles as B,compareTiles as F}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as H,ComponentIntersectionData as z}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as V}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{SlicePlaneParameters as W}from"../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{OverlayMode as Q}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{NoParameters as Y}from"../webgl-engine/core/shaderModules/interfaces.js";import{RenderRequestType as X}from"../webgl-engine/lib/basicInterfaces.js";import{hasEnabledShadowMap as Z}from"../webgl-engine/lib/BindParameters.js";import{createEmptyTexture as K}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as J}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as $,StoreResults as ee}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as te}from"../webgl-engine/lib/Material.js";import{RenderPass as re}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as ie}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as se}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ne}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as ae,getVerticalOffsetTerrain as oe}from"../webgl-engine/lib/verticalOffsetUtils.js";import{bindScreenSizePerspective as le,intersectAabbInvDirBefore as de,intersectTriangles as he}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as ce}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ue}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as pe,PrimitiveType as ge}from"../../webgl/enums.js";const fe=7,me=10,Te=R(),be=b();let Re=class extends r{constructor(e){super(e),this.type=$.TERRAIN,this.isGround=!0,this.tileSize=256,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new L,this.renderDataPool=new n(q),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new U,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._skirtScale=1,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.overlayOpacity=1,this.needsHighlight=!1,this.renderOccludedFlags=te.Occlude}get isGlobal(){return this.stage.viewingMode===O.Global}initialize(){const e=[ie.OPAQUE_TERRAIN,ie.TRANSPARENT_TERRAIN,ie.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),C()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this.shaderTechniqueConfig.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}set skirtScale(e){e!==this._skirtScale&&(this._skirtScale=e,this.setNeedsRender())}get skirtScale(){return this._skirtScale}get renderPatchBorders(){return!!this.shaderTechniqueConfig.tileBorders}set renderPatchBorders(e){this.shaderTechniqueConfig.tileBorders!==e&&(this.shaderTechniqueConfig.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this.shaderTechniqueConfig.backfaceCullingEnabled}set cullBackFaces(e){this.shaderTechniqueConfig.backfaceCullingEnabled!==e&&(this.shaderTechniqueConfig.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return ae}get slicePlaneEnabled(){return this.shaderTechniqueConfig.hasSlicePlane}set slicePlaneEnabled(e){this.shaderTechniqueConfig.hasSlicePlane!==e&&(this.shaderTechniqueConfig.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this.shaderTechniqueConfig.textureFadingEnabled!==e&&(this.shaderTechniqueConfig.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this.shaderTechniqueConfig.screenSizePerspective!==e&&(this.shaderTechniqueConfig.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?S:te.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}loadTile(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e)),this.updateTileGeometry(e),this.updateTileTexture(e,G.TEXTURE_FADING)}queryVisibleLevelRange(e,t,r,i){this._scaleRangeQueries.queryVisibleLevelRange(e,t,r,i),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===G.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometry(e){for(const t of e.layerInfo[P.ELEVATION])t.pendingUpdates&=~G.GEOMETRY;e.resetPendingUpdate(G.GEOMETRY),e.renderData.updateGeometry(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){e.renderData&&(e.renderData.releaseGeometry()&&this.setNeedsRender(),this.renderDataPool.release(e.renderData),e.renderData.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=me-fe,r=Math.max(0,Math.floor((e.level-t)/fe)*fe);if(this.isGlobal&&0===r)return f;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((t=>{var r;return null==(r=t.renderData)?void 0:r.updateGeometry(this.rctx,e)})),this.setNeedsRender())}setNeedsRender(e=X.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this.shaderTechniques=e.shaderTechniqueRepository,this.shaderTechniqueConfig=new ue,this.tileRenderer=new j(this.rctx,this.tileSize,this.shaderTechniques),this.tileBackground&&this._updateTileBackground(),this.emptyTex=K(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=Oe,o=xe;c(a,n,r),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===ee.MIN,m=!!e.results.ground.target,T=oe(e.verticalOffset),b=this._skirtScale,R=e.tolerance;let A,O=f&&i(l.dist)?l.dist:1/0;const x=u=>{const m=u.renderData;if(null==m)return;const x=m.geometryInfo;_(Te,x.boundingBox);const D=m.localOrigin;i(T)&&(T.localOrigin=D,T.applyToAabb(Te));const P=-b*x.skirtLength;if(0!==P){const e=u.up;y(Te,P*e[0],P*e[1],P*e[2])}const E=Te;if(De[0]=r[0]-D[0],De[1]=r[1]-D[1],De[2]=r[2]-D[2],!de(E,De,o,R,O))return;const S=(e,t,r)=>{e.set(this.type,u,t,r,h),O=f&&i(l.dist)?l.dist:1/0},C=(o,h)=>{if(i(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,n,o))){if((null==p.dist||o<p.dist)&&S(p,o,h),e.options.isFiltered)return;e.options.store===ee.ALL&&(s(A)?(A=J(e.ray),S(A,o,h),e.results.all.push(A)):o<A.dist&&S(A,o,h)),(null==l.dist||o<l.dist)&&S(l,o,h),e.options.store!==ee.MIN&&(null==d.dist||o>d.dist)&&S(d,o,h)}},q=Pe;c(q,n,D);const w=x.indices,L=x.vertexAttributes,M={data:L.getField(ne.POSITION,v).typedBuffer,size:3,stride:L.stride/4},j=x.numWithoutSkirtIndices/3;if(s(T)&&j>H){const e=u.renderData;s(e.intersectionData)&&(e.intersectionData=new z(w,0,j,M)),e.intersectionData.intersectRay({r0:De,r1:q},C)}else he(De,q,0,j,w,M,null,T,C);if(0!==P){const e=w.length/3;if(this.isGlobal){const t=e-j;if(s(T)&&t>H){const r=u.renderData;if(s(r.skirtIntersectionData)){const i=I(w,j,e,L,P,D);r.skirtIntersectionData=new z(i.indices,0,t,{data:i.vertices,stride:3})}r.skirtIntersectionData.intersectRay({r0:De,r1:q},C)}else k(De,q,j,e,w,L,P,D,T,C)}else N(De,q,j,e,w,L,P,T,C)}},D=this._rootTiles;if(i(D)){(()=>{const t=this.tileIterator;t.reset(D);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!i(T)&&!e.intersectsRay(r,a,R,O,b)||m&&this._useStencilForTile(e)?t.skipSubtree():x(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===ie.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&S))return null}else{const t=this.opaque?ie.OPAQUE_TERRAIN:ie.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case re.MATERIAL:{const t=Z(e.bindParameters);this.shaderTechniqueConfig.receiveShadows!==t&&(this.shaderTechniqueConfig.receiveShadows=t);const r=this.overlayRenderer.isEmpty()?Q.Disabled:this.overlayRenderer.hasWater?Q.EnabledWithWater:Q.Enabled;this.shaderTechniqueConfig.overlayMode!==r&&(this.shaderTechniqueConfig.overlayMode=r);const i=e.bindParameters.slot===ie.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;return this._updateTechnique(V.Color,i===E.Occluded)}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?this._updateTechnique(V.Shadow,!1):null;case re.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:this._updateTechnique(V.Depth,!1);case re.MATERIAL_NORMAL:return this._updateTechnique(V.Normal,!1);case re.MATERIAL_HIGHLIGHT:return this.needsHighlight?this._updateTechnique(V.Highlight,!1):null}return null}render(e,t){const r=e.pass,i=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,r){case re.MATERIAL:{const r=e.bindParameters.slot===ie.OCCLUDED_TERRAIN?E.Occluded:E.ColorAndWater;this._renderMaterialPass(e,t,r);break}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&i&&this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,E.None);break;case re.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,E.Highlight),e.rctx.clearSafe(pe.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,r){const{rctx:s}=e;this._ssrEnabled=e.bindParameters.ssr.enabled;const n=s.bindTechnique(t,Ee,e.bindParameters);i(e.bindParameters.shadowMap)&&e.bindParameters.shadowMap.bind(n);const a=e.bindParameters.camera;i(e.bindParameters.ssaoHelper)&&e.bindParameters.ssaoHelper.bind(n,a),this._bindOverlayData(n,r),e.bindParameters.lighting.setUniforms(n,!0);const o=a.viewMatrix;u(Ae,o[12],o[13],o[14]),p(Ae,Ae),n.setUniform3fv("viewDirection",Ae),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,r):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,r)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,r){const i=e.rctx.bindTechnique(t,Ee,e.bindParameters),s=e.bindParameters.camera;e.pass!==re.MATERIAL_DEPTH&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||i.setUniform2fv("nearFar",s.nearFar),this._renderPatchGroupsAuxiliary(e,t,r)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this.shaderTechniqueConfig.useGrid=this.tileRenderer.backgroundIsGrid,this.shaderTechniqueConfig.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&i(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,x.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;A(t).then((r=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(r,this.tileBackground===M),e())}))}else{const r=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(r,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==w.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>B(this.renderOrder,e))),e.sort(((e,t)=>F(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r||e.visible)if(e.rendered){if(r){const i=this._patchGroups.get(r.localOrigin)||new Array;this._patchGroups.set(r.localOrigin,i),i.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=e.bindParameters.camera;t.program.setUniformMatrix4fv("proj",i.projectionMatrix),t.program.setUniform1f("skirtScale",this._skirtScale),r!==E.None&&this._bindOverlayData(t.program,r);const s=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;this._bindPatchGroupData(t.program,a,i.eye,i.viewMatrix);for(let i=0;i<n.length;i++)this._renderPatch(e,t,n[i],ge.TRIANGLES,s,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const n=e.rctx,a=e.bindParameters.camera,o=a.viewMatrix,l=t.program;if(this.shaderTechniqueConfig.screenSizePerspective&&this.pointsOfInterest){const e=se(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY}),le(e,l,"screenSizePerspective")}const d=this.stencilEnabledLayerExtents.length>0,h=r===E.Occluded;h&&(l.bindTexture("tex",this.emptyTex),l.setUniform1f("blend",1),l.setUniform4fv("texOffsetAndScale",T));const c=i(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this.shaderTechniqueConfig.hasBackgroundColor&&l.setUniform3fv("backgroundColor",c);const u=h?0:this._skirtScale;l.setUniform1f("skirtScale",u);const p=this.wireframe?ge.LINES:ge.TRIANGLES;this.shaderTechniqueConfig.textureFadingEnabled&&l.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const c=n[0].renderData.localOrigin;this._bindPatchGroupData(l,c,a.eye,o),l.bindDraw(new W(c),e.bindParameters),i(e.bindParameters.shadowMap)&&e.bindParameters.shadowMap.bindView(l,c),this.numOriginsRendered++;for(let a=0;a<n.length;a++){const o=n[a],c=o.renderData.textureReference;if(!s(c)){if(!h){this._scaleRangeQueries.scaleQueriesForTile(o),ye(o.renderData.geometryInfo.uvOffsetAndScale,c.offsetAndScale,be),l.setUniform4fv("texOffsetAndScale",be),l.bindTexture("tex",c.texture.texture);const e=o.renderData.textureFadeFactor,t=e<1?o.renderData.nextTextureReference:null;this.shaderTechniqueConfig.textureFadingEnabled&&i(t)&&e<1?(ye(o.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,be),l.setUniform1f("fadeFactor",e),l.setUniform4fv("nextTexOffsetAndScale",be),l.setUniform3fv("nextTexOpacities",t.opacities),l.bindTexture("texNext",t.texture.texture)):l.setUniform1f("fadeFactor",1),o.renderData.textureIsFading&&this.setNeedsRender(),l.setUniform3fv("textureOpacities",c.opacities)}this._renderPatch(e,t,o,p,d,r),o.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,r,i,n,a){if(s(r.renderData.vao.indexBuffer))return;const o=t.program;a!==E.None&&this._bindOverlayPatchData(o,r.renderData.overlay),n&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const l=0===this._skirtScale?r.renderData.geometryInfo.numWithoutSkirtIndices:r.renderData.vao.indexBuffer.size;e.rctx.bindVAO(r.renderData.vao),o.assertCompatibleVertexAttributeLocations(r.renderData.vao),e.rctx.drawElements(i,l,r.renderData.vao.indexBuffer.indexType,0)}_bindPatchGroupData(e,t,r,i){e.setUniform3fv("origin",t),l(ve,i,t),e.setUniformMatrix4fv("view",ve),e.setUniform3f("cameraPosition",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayData(e,t){if(this.shaderTechniqueConfig.overlayMode===Q.Disabled)return;e.setUniform1f("overlayOpacity",this.overlayOpacity);const r=this.overlayRenderer.overlays;if(r.length>D.INNER){const s=r[D.INNER],n=s.getColorTexture(t);if(e.bindTexture("ovColorTex",i(n)?n:this.emptyTex),this.shaderTechniqueConfig.overlayMode===Q.EnabledWithWater){const r=s.getNormalTexture(t);e.bindTexture("ovWaterTex",i(r)?r:this.emptyTex)}}}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this.shaderTechniqueConfig.output=e,e===V.Color&&(this.shaderTechniqueConfig.atmosphere=this.isGlobal&&this._velvetOverground,this.shaderTechniqueConfig.hasScreenSpaceReflections=this._ssrEnabled),this.shaderTechniqueConfig.renderOccluded=t,this.shaderTechniqueConfig.stencilEnabled=!1,this._shaderTechnique=this.shaderTechniques.releaseAndAcquire(ce,this.shaderTechniqueConfig,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],Re.prototype,"tileBackgroundInitialized",void 0),e([a()],Re.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],Re.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],Re.prototype,"stage",void 0),e([a({readOnly:!0})],Re.prototype,"isGlobal",null),e([a({constructOnly:!0})],Re.prototype,"allTiles",void 0),e([a({constructOnly:!0})],Re.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],Re.prototype,"updating",null),e([a({value:!1})],Re.prototype,"renderingDisabled",null),e([a()],Re.prototype,"renderPatchBorders",null),e([a()],Re.prototype,"cullBackFaces",null),e([a({value:w.FRONT_TO_BACK})],Re.prototype,"renderOrder",null),e([a()],Re.prototype,"wireframe",null),Re=e([o("esri.views.3d.terrain.TerrainRenderer")],Re);const _e=Re;function ye(e,t,r){r[0]=e[0]*t[2]+t[0],r[1]=e[1]*t[3]+t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3]}const ve=d(),Ae=m(),Oe=m(),xe=m(),De=m(),Pe=m(),Ee=new Y;export{_e as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r,isNone as s}from"../../../../../../core/maybe.js";import{C as o}from"../../../../../../chunks/vec3.js";import{f as a}from"../../../../../../chunks/vec3f32.js";import{g as i,c as n,v as l}from"../../../../../../chunks/vec4.js";import{f as h}from"../../../../../../chunks/vec4f32.js";import{f as p}from"../../../../../../chunks/vec4f64.js";import{ColorMixModeEnum as c}from"../../../../layers/support/symbolColorUtils.js";import{ComponentTechnique as u}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as d,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as y}from"./shader/ComponentData.glsl.js";import{a as v}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as g}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as b,parameterBlock as f,MaterialBase as T,MaterialParameterBlock as M}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as x,MaterialSubPass as O}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as C}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as P}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as N}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as q}from"../../../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{EllipsoidMode as D}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{AlphaDiscardMode as w,TransparencyPassType as A,CullFaceOptions as j}from"../../../lib/basicInterfaces.js";import{hasEnabledSSAO as R,hasEnabledShadowMap as E}from"../../../lib/BindParameters.js";class I extends T{constructor(){super(...arguments),this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=a(1,1,.5),this.emissiveFactor=a(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.overlayTexOffset=p(-1,-1,-1,-1),this.overlayTexScale=p(0,0,0,0),this.overlayColor=null,this.overlayHighlight=null,this.overlayNormal=null,this.objectOpacity=1,this.commonMaterialParameters=new F,this.componentParameters=new V,this.alphaCutoff=q,this.alphaDiscardMode=w.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=D.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new d}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}prepareTechnique(e,t,o,a){const i=this._techniqueConfiguration;if(i.hasVertexColors=a.colors,i.hasNormals=a.normals,i.textureCoordinateType=a.textureCoordinates,i.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),i.hasEmissionTexture=r(this.emissionTexture),i.hasOcclusionTexture=r(this.occlusionTexture),i.hasNormalTexture=r(this.normalTexture),i.transparencyPassType=t.identifier===x.Material&&null!=o.transparencyPassType?o.transparencyPassType:A.NONE,i.hasMultipassTerrain=t.identifier===x.Material&&null!=o.multipassTerrain&&o.multipassTerrain.enabled,i.cullAboveGround=t.identifier===x.Material&&null!=o.multipassTerrain&&o.multipassTerrain.cullAboveGround,i.ellipsoidMode=this.ellipsoidMode,this.dirty){i.componentData=this.componentParameters.type,i.cullFace=this.commonMaterialParameters.cullFace,i.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,i.hasBaseColorTexture=r(this.baseColorTexture);const e=this._computeWhichMaterialPass();i.blendingEnabled=e===k.Transparent||e===k.OpaqueAndTransparent,i.alphaDiscardMode=this.alphaDiscardMode,i.integratedMeshMode=this.isIntegratedMesh?this.overlayColor?this.overlayNormal?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,i.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}const n=this.hasParametersFromSource&&s(this.baseColorTexture);return i.pbrMode=i.integratedMeshMode===m.ColorOverlayWithWater?N.WaterOnIntegratedMesh:this.usePBR?n?N.Schematic:N.Normal:N.Disabled,i.normalType=i.integratedMeshMode===m.None?i.hasNormals?P.CompressedAttribute:P.ScreenDerivative:P.Ground,i.hasSlicePlane=r(o.slicePlane)&&this.commonMaterialParameters.hasSlicePlane,t.identifier===x.ShadowMap?(i.output=C.Shadow,i.vertexDiscardMode=g.None):t.identifier===x.Highlight?(i.output=C.Highlight,i.vertexDiscardMode=g.None):(this._computeWhichMaterialPass()===k.OpaqueAndTransparent?i.vertexDiscardMode=t.transparent?g.Opaque:g.Transparent:i.vertexDiscardMode=g.None,i.output=L(t.subPass),t.subPass===O.Alpha&&(i.hasOccludees=o.hasOccludees),t.subPass===O.Color?(i.receiveAmbientOcclusion=R(o),i.hasOccludees=o.hasOccludees,i.receiveShadows=E(o),i.hasScreenSpaceReflections=o.ssr.enabled):(i.receiveAmbientOcclusion=!1,i.receiveShadows=!1)),this._technique=e.releaseAndAcquire(u,i,this._technique),this._technique}submit(e,t){if(0===this.objectOpacity)return;const s=t.renderable.geometry,o=t.components,a=t.renderable.drawParameters,i=t.renderable.meta.cameraDepthSquared,n=o.geometryRanges,l=o.highlightRanges,h=o.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case k.Opaque:e.materialOpaque.submitDraw(this,s,n,a,i);break;case k.Transparent:e.materialTransparent.submitDraw(this,s,n,a,i);break;case k.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,s,n,a,i),e.materialTransparent.submitDraw(this,s,n,a,i);break;case k.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,s,n,a,i),this.overlayHighlight&&e.highlightIntegratedMesh.submitDraw(this,s,n,a,i)}const p=this.componentParameters.castShadows!==B.None;p&&e.shadowMap.submitDraw(this,s,n,a,i),r(l)&&(e.highlight.submitDraw(this,s,l,a,i),p&&e.highlightShadowMap.submitDraw(this,s,l,a,i)),p&&r(h)&&e.defaultShadowMap.submitDraw(this,s,h,a,i)}get attributeLocations(){return v}_computeWhichMaterialPass(){return this.isIntegratedMesh?k.IntegratedMesh:this.objectOpacity<1?k.Transparent:this.componentParameters.opaqueOverride===B.All?k.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===w.Blend||this.alphaDiscardMode===w.MaskBlend?k.Transparent:this.componentParameters.transparent===B.None?k.Opaque:this.componentParameters.transparent===B.All?k.Transparent:k.OpaqueAndTransparent}}var _,k,B;e([b({vectorOps:l})],I.prototype,"baseColor",void 0),e([b()],I.prototype,"usePBR",void 0),e([b()],I.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:o})],I.prototype,"mrrFactors",void 0),e([b({vectorOps:o})],I.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],I.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],I.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],I.prototype,"emissionTexture",void 0),e([b({dispose:!0})],I.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],I.prototype,"normalTexture",void 0),e([b({vectorOps:{equals:i,copy:n}})],I.prototype,"overlayTexOffset",void 0),e([b({vectorOps:{equals:i,copy:n}})],I.prototype,"overlayTexScale",void 0),e([b()],I.prototype,"overlayColor",void 0),e([b()],I.prototype,"overlayHighlight",void 0),e([b()],I.prototype,"overlayNormal",void 0),e([b()],I.prototype,"objectOpacity",void 0),e([f()],I.prototype,"commonMaterialParameters",void 0),e([f()],I.prototype,"componentParameters",void 0),e([b()],I.prototype,"alphaCutoff",void 0),e([b()],I.prototype,"alphaDiscardMode",void 0),e([b()],I.prototype,"isIntegratedMesh",void 0),e([b()],I.prototype,"polygonOffsetEnabled",void 0),e([b()],I.prototype,"ellipsoidMode",void 0),e([b()],I.prototype,"hasOccludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(_||(_={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class F extends M{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=j.Back,this.hasSlicePlane=!0}}e([b()],F.prototype,"doubleSided",void 0),e([b()],F.prototype,"cullFace",void 0),e([b()],F.prototype,"hasSlicePlane",void 0);class V extends M{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=c.Multiply,this.castShadows=B.All}get transparent(){return this.externalColor[3]<1?B.All:B.None}get opaqueOverride(){return this.externalColorMixMode===c.Replace&&1===this.externalColor[3]?B.All:B.None}get visible(){return this.externalColor[3]>0?B.All:B.None}get type(){return y.Uniform}}e([b({vectorOps:l})],V.prototype,"externalColor",void 0),e([b()],V.prototype,"externalColorMixMode",void 0),e([b()],V.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(B||(B={}));class W extends M{constructor(){super(...arguments),this.texture=null,this.transparent=B.None,this.opaqueOverride=B.None,this.castShadows=B.None}get type(){return y.Varying}}function L(e){switch(e){case O.Color:return C.Color;case O.Alpha:return C.Alpha;case O.Depth:return C.Depth;case O.Normal:return C.Normal}}e([b()],W.prototype,"texture",void 0),e([b()],W.prototype,"transparent",void 0),e([b()],W.prototype,"opaqueOverride",void 0),e([b()],W.prototype,"castShadows",void 0);export{F as CommonMaterialParameters,I as ComponentMaterial,B as ComponentParameterSummary,V as ComponentParametersUniform,W as ComponentParametersVarying,_ as ShadingNormalSource};
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r,isNone as s}from"../../../../../../core/maybe.js";import{C as o}from"../../../../../../chunks/vec3.js";import{f as a}from"../../../../../../chunks/vec3f32.js";import{g as i,c as l,v as n}from"../../../../../../chunks/vec4.js";import{f as h}from"../../../../../../chunks/vec4f32.js";import{f as p}from"../../../../../../chunks/vec4f64.js";import{ColorMixModeEnum as u}from"../../../../layers/support/symbolColorUtils.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as d,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as y}from"./shader/ComponentData.glsl.js";import{a as v}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as g}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as T,parameterBlock as x,MaterialBase as b,MaterialParameterBlock as f}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as M,MaterialSubPass as O}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as C}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as P}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as N}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as q}from"../../../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{EllipsoidMode as D}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{AlphaDiscardMode as w,TransparencyPassType as A,CullFaceOptions as j}from"../../../lib/basicInterfaces.js";import{hasEnabledSSAO as R,hasEnabledShadowMap as E}from"../../../lib/BindParameters.js";class I extends b{constructor(){super(...arguments),this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=a(1,1,.5),this.emissiveFactor=a(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.overlayTexOffset=p(-1,-1,-1,-1),this.overlayTexScale=p(0,0,0,0),this.overlayColor=null,this.overlayHighlight=null,this.overlayNormal=null,this.objectOpacity=1,this.commonMaterialParameters=new F,this.componentParameters=new V,this.alphaCutoff=q,this.alphaDiscardMode=w.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=D.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new d}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return r(this.baseColorTexture)?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return r(this.metallicRoughnessTexture)?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return r(this.emissionTexture)?this.emissionTexture.glTexture:null}get textureOcclusion(){return r(this.occlusionTexture)?this.occlusionTexture.glTexture:null}get textureNormal(){return r(this.normalTexture)?this.normalTexture.glTexture:null}prepareTechnique(e,t,o,a){const i=this._techniqueConfiguration;if(i.hasVertexColors=a.colors,i.hasNormals=a.normals,i.textureCoordinateType=a.textureCoordinates,i.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),i.hasEmissionTexture=r(this.emissionTexture),i.hasOcclusionTexture=r(this.occlusionTexture),i.hasNormalTexture=r(this.normalTexture),i.transparencyPassType=t.identifier===M.Material&&null!=o.transparencyPassType?o.transparencyPassType:A.NONE,i.hasMultipassTerrain=t.identifier===M.Material&&null!=o.multipassTerrain&&o.multipassTerrain.enabled,i.cullAboveGround=t.identifier===M.Material&&null!=o.multipassTerrain&&o.multipassTerrain.cullAboveGround,i.ellipsoidMode=this.ellipsoidMode,this.dirty){i.componentData=this.componentParameters.type,i.cullFace=this.commonMaterialParameters.cullFace,i.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,i.hasBaseColorTexture=r(this.baseColorTexture);const e=this._computeWhichMaterialPass();i.blendingEnabled=e===k.Transparent||e===k.OpaqueAndTransparent,i.alphaDiscardMode=this.alphaDiscardMode,i.integratedMeshMode=this.isIntegratedMesh?this.overlayColor?this.overlayNormal?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,i.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}const l=this.hasParametersFromSource&&s(this.baseColorTexture);return i.pbrMode=i.integratedMeshMode===m.ColorOverlayWithWater?N.WaterOnIntegratedMesh:this.usePBR?l?N.Schematic:N.Normal:N.Disabled,i.normalType=i.integratedMeshMode===m.None?i.hasNormals?P.CompressedAttribute:P.ScreenDerivative:P.Ground,i.hasSlicePlane=r(o.slicePlane)&&this.commonMaterialParameters.hasSlicePlane,t.identifier===M.ShadowMap?(i.output=C.Shadow,i.vertexDiscardMode=g.None):t.identifier===M.Highlight?(i.output=C.Highlight,i.vertexDiscardMode=g.None):(this._computeWhichMaterialPass()===k.OpaqueAndTransparent?i.vertexDiscardMode=t.transparent?g.Opaque:g.Transparent:i.vertexDiscardMode=g.None,i.output=L(t.subPass),t.subPass===O.Alpha&&(i.hasOccludees=o.hasOccludees),t.subPass===O.Color?(i.receiveAmbientOcclusion=R(o),i.hasOccludees=o.hasOccludees,i.receiveShadows=E(o),i.hasScreenSpaceReflections=o.ssr.enabled):(i.receiveAmbientOcclusion=!1,i.receiveShadows=!1)),this._technique=e.releaseAndAcquire(c,i,this._technique),this._technique}submit(e,t){if(0===this.objectOpacity)return;const s=t.renderable.geometry,o=t.components,a=t.renderable.drawParameters,i=t.renderable.meta.cameraDepthSquared,l=o.geometryRanges,n=o.highlightRanges,h=o.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case k.Opaque:e.materialOpaque.submitDraw(this,s,l,a,i);break;case k.Transparent:e.materialTransparent.submitDraw(this,s,l,a,i);break;case k.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,s,l,a,i),e.materialTransparent.submitDraw(this,s,l,a,i);break;case k.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,s,l,a,i),this.overlayHighlight&&e.highlightIntegratedMesh.submitDraw(this,s,l,a,i)}const p=this.componentParameters.castShadows!==B.None;p&&e.shadowMap.submitDraw(this,s,l,a,i),r(n)&&(e.highlight.submitDraw(this,s,n,a,i),p&&e.highlightShadowMap.submitDraw(this,s,n,a,i)),p&&r(h)&&e.defaultShadowMap.submitDraw(this,s,h,a,i)}get attributeLocations(){return v}_computeWhichMaterialPass(){return this.isIntegratedMesh?k.IntegratedMesh:this.objectOpacity<1?k.Transparent:this.componentParameters.opaqueOverride===B.All?k.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===w.Blend||this.alphaDiscardMode===w.MaskBlend?k.Transparent:this.componentParameters.transparent===B.None?k.Opaque:this.componentParameters.transparent===B.All?k.Transparent:k.OpaqueAndTransparent}}var _,k,B;e([T({vectorOps:n})],I.prototype,"baseColor",void 0),e([T()],I.prototype,"usePBR",void 0),e([T()],I.prototype,"hasParametersFromSource",void 0),e([T({vectorOps:o})],I.prototype,"mrrFactors",void 0),e([T({vectorOps:o})],I.prototype,"emissiveFactor",void 0),e([T({dispose:!0})],I.prototype,"baseColorTexture",void 0),e([T({dispose:!0})],I.prototype,"metallicRoughnessTexture",void 0),e([T({dispose:!0})],I.prototype,"emissionTexture",void 0),e([T({dispose:!0})],I.prototype,"occlusionTexture",void 0),e([T({dispose:!0})],I.prototype,"normalTexture",void 0),e([T({vectorOps:{equals:i,copy:l}})],I.prototype,"overlayTexOffset",void 0),e([T({vectorOps:{equals:i,copy:l}})],I.prototype,"overlayTexScale",void 0),e([T()],I.prototype,"overlayColor",void 0),e([T()],I.prototype,"overlayHighlight",void 0),e([T()],I.prototype,"overlayNormal",void 0),e([T()],I.prototype,"objectOpacity",void 0),e([x()],I.prototype,"commonMaterialParameters",void 0),e([x()],I.prototype,"componentParameters",void 0),e([T()],I.prototype,"alphaCutoff",void 0),e([T()],I.prototype,"alphaDiscardMode",void 0),e([T()],I.prototype,"isIntegratedMesh",void 0),e([T()],I.prototype,"polygonOffsetEnabled",void 0),e([T()],I.prototype,"ellipsoidMode",void 0),e([T()],I.prototype,"hasOccludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(_||(_={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class F extends f{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=j.Back,this.hasSlicePlane=!0}}e([T()],F.prototype,"doubleSided",void 0),e([T()],F.prototype,"cullFace",void 0),e([T()],F.prototype,"hasSlicePlane",void 0);class V extends f{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=u.Multiply,this.castShadows=B.All}get transparent(){return this.externalColor[3]<1?B.All:B.None}get opaqueOverride(){return this.externalColorMixMode===u.Replace&&1===this.externalColor[3]?B.All:B.None}get visible(){return this.externalColor[3]>0?B.All:B.None}get type(){return y.Uniform}}e([T({vectorOps:n})],V.prototype,"externalColor",void 0),e([T()],V.prototype,"externalColorMixMode",void 0),e([T()],V.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(B||(B={}));class W extends f{constructor(){super(...arguments),this.texture=null,this.transparent=B.None,this.opaqueOverride=B.None,this.castShadows=B.None}get type(){return y.Varying}}function L(e){switch(e){case O.Color:return C.Color;case O.Alpha:return C.Alpha;case O.Depth:return C.Depth;case O.Normal:return C.Normal}}e([T()],W.prototype,"texture",void 0),e([T()],W.prototype,"transparent",void 0),e([T()],W.prototype,"opaqueOverride",void 0),e([T()],W.prototype,"castShadows",void 0);export{F as CommonMaterialParameters,I as ComponentMaterial,B as ComponentParameterSummary,V as ComponentParametersUniform,W as ComponentParametersVarying,_ as ShadingNormalSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../../../../../core/maybe.js";import{ViewingMode as r}from"../../../../../ViewingMode.js";import{IntegratedMeshMode as o}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as t}from"./shader/ComponentData.glsl.js";import{C as i}from"../../../../../../chunks/ComponentShader.glsl.js";import{RenderPassIdentifier as a,MaterialSubPass as s}from"../../../core/renderPasses/AllRenderPasses.js";import{RenderPassTechnique as n}from"../../../core/renderPasses/RenderPassTechnique.js";import{ShaderOutput as l}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{bindPBRUniforms as m}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{doublePrecisionRequiresObfuscation as
|
|
5
|
+
import{isSome as e}from"../../../../../../core/maybe.js";import{ViewingMode as r}from"../../../../../ViewingMode.js";import{IntegratedMeshMode as o}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as t}from"./shader/ComponentData.glsl.js";import{C as i}from"../../../../../../chunks/ComponentShader.glsl.js";import{RenderPassIdentifier as a,MaterialSubPass as s}from"../../../core/renderPasses/AllRenderPasses.js";import{RenderPassTechnique as n}from"../../../core/renderPasses/RenderPassTechnique.js";import{ShaderOutput as l}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{bindPBRUniforms as m}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{doublePrecisionRequiresObfuscation as p}from"../../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{ReloadableShaderModule as c}from"../../../core/shaderTechnique/ReloadableShaderModule.js";import{TransparencyPassType as d,StencilBits as f}from"../../../lib/basicInterfaces.js";import{hasEnabledSSAO as h,hasEnabledShadowMap as u}from"../../../lib/BindParameters.js";import{blendingDefault as g,oitBlending as b,oitDepthTest as M,OITPolygonOffset as x}from"../../../lib/OrderIndependentTransparency.js";import{Program as C}from"../../../lib/Program.js";import{stencilWriteMaskOn as P,replaceBitWhenDepthTestPasses as y,stencilBaseAllZerosParams as j}from"../../../lib/StencilUtils.js";import{makePipelineState as T,cullingParams as S,defaultDepthWriteParams as v,defaultColorWriteParams as O}from"../../../../../webgl/renderState.js";class U extends n{bindPass(e,r){const o=this.program;o.bindPass(e,r),e.identifier===a.Material&&(o.setUniformMatrix3fv("transformNormalViewFromGlobal",e.transformNormalViewFromGlobal),e.subPass===s.Color&&r.lighting.setUniforms(this.program,e.integratedMesh))}bindDraw(r,o){if(this.program.bindDraw(r,o),this.program.rebindTextures(),e(this._material)&&this._material.isIntegratedMesh){const e=this._material.overlayTexScale,o=this._material.overlayTexOffset;this.program.setUniform4fv("overlayTexOffset",[r.toMapSpace[0]*e[0]+o[0],r.toMapSpace[1]*e[1]+o[1],r.toMapSpace[0]*e[2]+o[2],r.toMapSpace[1]*e[3]+o[3]]),this.program.setUniform4fv("overlayTexScale",[r.toMapSpace[2]*e[0],r.toMapSpace[3]*e[1],r.toMapSpace[2]*e[2],r.toMapSpace[3]*e[3]])}}bindMaterial(e,r,o){this._material=e;const i=this.program;this.program.bindMaterial(e,o),i.setUniform4fv("baseColor",e.baseColor),i.setUniform1f("objectOpacity",e.objectOpacity),i.setUniform1f("textureAlphaCutoff",e.alphaCutoff),e.componentParameters.type===t.Varying?e.componentParameters.texture.bind(i,"componentColorTex","componentColorTexInvDim"):(i.setUniform4fv("externalColor",e.componentParameters.externalColor),i.setUniform1i("externalColorMixMode",e.componentParameters.externalColorMixMode)),this.configuration.output!==l.Color&&this.configuration.output!==l.Alpha||m(this.program,e,this.configuration.pbrMode),e.isIntegratedMesh&&(r.identifier===a.Material&&r.subPass===s.Color?(i.bindTexture("ovColorTex",e.overlayColor),i.bindTexture("ovNormalTex",e.overlayNormal)):r.identifier===a.Highlight&&i.bindTexture("ovColorTex",e.overlayHighlight),i.setUniform1f("overlayOpacity",1)),r.identifier===a.Material&&r.subPass===s.Color&&(h(o)&&r.bindAmbientOcclusion(i),u(o)&&r.bindShadowMap(i))}initializeConfiguration(e,o){o.spherical=e.viewingMode===r.Global,o.doublePrecisionRequiresObfuscation=p(e.rctx)}initializeProgram(e){const r=U.shader.get(),o=r.build(this.configuration);return new C(e.rctx,o,r.attributeLocations)}_setPipelineState(e){const r=this.configuration,t=r.integratedMeshMode!==o.None,i=e===d.NONE,a=e===d.FrontFace;return T({blending:r.output!==l.Color&&r.output!==l.Alpha||!r.blendingEnabled?null:i?g:b(e),culling:S(r.cullFace),depthTest:{func:M(e)},depthWrite:i||a?v:null,colorWrite:O,stencilWrite:t||r.hasOccludees?P:null,stencilTest:t?y(f.IntegratedMeshMaskExcluded):r.hasOccludees?j:null,polygonOffset:i||a?r.hasPolygonOffset?{factor:2,units:2}:null:x})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}U.shader=new c(i,(()=>import("./shader/ComponentShader.glsl.js")));export{U as ComponentTechnique};
|