@arcgis/core 4.34.0-next.80 → 4.34.0-next.82
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/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.js +5 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.js +5 -0
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{c90571063bd2bb57a5a7.js → 1d491447b13f2f2b4399.js} +1 -1
- package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +1 -0
- package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +1 -0
- package/assets/esri/core/workers/chunks/3192b68675ff2afcb1d6.js +1 -0
- package/assets/esri/core/workers/chunks/365d63c2aed3a49918f2.js +1 -0
- package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +351 -0
- package/assets/esri/core/workers/chunks/a1196637268b89281780.js +1 -0
- package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +1 -0
- package/assets/esri/core/workers/chunks/{b815c2f61fb9c58a2956.js → b6c4712e00fce87bd0f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{db2396bf062468ee8b60.js → b8810711d058300395cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{22bd4255b6b511a43b66.js → c2bc70b65f5c2a2c9671.js} +1 -1
- package/assets/esri/core/workers/chunks/cc579c94438f48a0dbab.js +1 -0
- package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +1 -0
- package/assets/esri/core/workers/chunks/e4acc3c2b6d865ed1940.js +1 -0
- package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +1 -0
- package/assets/esri/core/workers/chunks/{ede479faa4e6920fe673.js → f8f85207b382c1ea038c.js} +17 -9
- package/assets/esri/core/workers/chunks/{23a13fbab9984953a7c6.js → fc06014fb484fc8c697e.js} +1 -1
- package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
- package/chunks/CutFillComposition.glsl.js +8 -0
- package/chunks/CutFillMask.glsl.js +6 -0
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +4 -6
- package/chunks/draco_mesh_decoder.js +5 -0
- package/config.js +1 -1
- package/core/unitUtils.js +1 -1
- package/interfaces.d.ts +147 -13
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/FieldConfiguration.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/datasetUtils.js +1 -1
- package/libs/dracoMeshDecoder/dracoMeshDecoder.js +5 -0
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +5 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +15 -7
- package/views/3d/webgl-engine/lib/CutFillColor.js +5 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +5 -0
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/assets/esri/core/workers/chunks/07a355a9c95154971aab.js +0 -1
- package/assets/esri/core/workers/chunks/22a66db7d73e733917e3.js +0 -1
- package/assets/esri/core/workers/chunks/49486c2e12e768b347ed.js +0 -1
- package/assets/esri/core/workers/chunks/66e0bc4acb18f00a433d.js +0 -1
- package/assets/esri/core/workers/chunks/76db75337044de8218c9.js +0 -353
- package/assets/esri/core/workers/chunks/978fab0f0b10edde4ff8.js +0 -1
- package/assets/esri/core/workers/chunks/a07321a901d6847d1a6b.js +0 -1
- package/assets/esri/core/workers/chunks/ae8dce1a43ca7019f81d.js +0 -1
- package/assets/esri/core/workers/chunks/cb3b88959b2f048e54a5.js +0 -1
- package/assets/esri/core/workers/chunks/da1a5537e2f2ca6cc247.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as d}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as p}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as C}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as q,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as F}from"../../../webgl/NoParameters.js";import{VertexBuffer as T}from"../../../webgl/VertexBuffer.js";let V=class extends h{constructor(e){super(e),this.consumes={required:[a.OPAQUE]},this.produces=n.CUTFILL_COLOR,this._vaoCut=null,this._vaoFill=null,this._countCut=0,this._countFill=0,this._maskParameters=new f,this._cutVolumeParameters=new _,this._fillVolumeParameters=new _,this._compositeParameters=new d;const t=1===e.view.state.viewingMode;this._cutVolumeTechniqueConfiguration=new g(t),this._cutVolumeTechniqueConfiguration.cullFace=1,this._cutVolumeTechniqueConfiguration.doubleSidedMode=1,this._fillVolumeTechniqueConfiguration=new g(t),this._fillVolumeTechniqueConfiguration.cullFace=2}initialize(){this.addHandles([s(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),o)])}destroy(){this._vaoCut=i(this._vaoCut),this._vaoFill=i(this._vaoFill)}precompile(){this.techniques.precompile(b,this._cutVolumeTechniqueConfiguration),this.techniques.precompile(b,this._fillVolumeTechniqueConfiguration),this.techniques.precompile(C),this.techniques.precompile(p)}render(e){const t=this.techniques.get(b,this._cutVolumeTechniqueConfiguration),i=this.techniques.get(b,this._fillVolumeTechniqueConfiguration),s=this.techniques.get(C),o=this.techniques.get(p),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;if(!(t&&i&&s.compiled&&o.compiled))return this.requestRender(1),r;const l=this.bindParameters,a=l.camera,n=a.fullViewport[2],u=a.fullViewport[3],c=this.renderingContext,h=this.fboCache,m=h.acquire(n,u,"cutfill color mask",2);m.attachDepth(r.getAttachment(q)),c.bindFramebuffer(m.fbo),c.setClearColor(0,0,0,1),c.clear(17408),c.setViewport(0,0,n,u);c.bindTechnique(s,l).bindDraw(l,F,this._maskParameters),c.setFaceCullingEnabled(!1),c.setStencilTestEnabled(!0),c.setStencilOpSeparate(1028,7680,34055,7680),c.setStencilOpSeparate(1029,7680,34056,7680),c.setDepthWriteEnabled(!1),c.bindVAO(this._vaoCut),c.setDepthTestEnabled(!0),c.setStencilWriteMask(255),c.setStencilFunction(519,0,255),c.setColorMask(!1,!1,!1,!1),c.drawArrays(v.TRIANGLES,0,this._countCut),c.setDepthTestEnabled(!1),c.setStencilWriteMask(0),c.setStencilFunction(517,0,255),c.setColorMask(!0,!0,!0,!0),c.drawArrays(v.TRIANGLES,0,this._countCut),c.bindVAO(this._vaoFill),c.setDepthTestEnabled(!0),c.setStencilWriteMask(255),c.setStencilFunction(519,0,255),c.setColorMask(!0,!0,!0,!0),c.drawArrays(v.TRIANGLES,0,this._countFill);const d=h.acquire(n,u,"cutfill color volumes",5);c.bindFramebuffer(d.fbo),c.setClearColor(0,0,0,0),c.clear(16384),c.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._maskParameters),c.bindVAO(this._vaoCut),c.drawArrays(v.TRIANGLES,0,this._countCut),d.attachDepth(r.getAttachment(q)),c.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._maskParameters),c.bindVAO(this._vaoFill),c.drawArrays(v.TRIANGLES,0,this._countFill);const f=this.fboCache.acquire(n,u,this.produces);return c.bindFramebuffer(f.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutFillVolumes=d.getTexture(),this._compositeParameters.cutFillMask=m.getTexture(),c.bindTechnique(o,l,this._compositeParameters),c.screen.draw(),m.release(),d.release(),f.attachDepth(r.getAttachment(q)),f}enable(){this.produces=n.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,s){this._vaoCut=i(this._vaoCut),this._vaoCut=this._createVao(e),this._countCut=e.indicesBottom.length+e.indicesExtruded.length,this._vaoFill=i(this._vaoFill),this._vaoFill=this._createVao(t),this._countFill=t.indicesBottom.length+t.indicesExtruded.length,this._maskParameters.origin=s,this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=t.toUnitRGB(this.cutColor),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=t.toUnitRGB(this.fillColor),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const t=this.renderingContext,{vertices:i,normals:s,indicesBottom:o,indicesExtruded:r}=e,l=w.createBuffer(o.length+r.length),{position:a,normal:n}=l;for(let u=0;u<o.length;u++){const e=3*o[u];a.set(u,0,i[e]),a.set(u,1,i[e+1]),a.set(u,2,i[e+2]),n.set(u,0,s[e]),n.set(u,1,s[e+1]),n.set(u,2,s[e+2])}for(let u=0;u<r.length;u++){const e=u+o.length,t=3*r[u];a.set(e,0,i[t]),a.set(e,1,i[t+1]),a.set(e,2,i[t+2]),n.set(e,0,s[t]),n.set(e,1,s[t+1]),n.set(e,2,s[t+2])}const c=new T(t,u(w),l.buffer);return new m(t,c)}};e([r()],V.prototype,"consumes",void 0),e([r()],V.prototype,"produces",void 0),e([r()],V.prototype,"cutColor",void 0),e([r()],V.prototype,"fillColor",void 0),V=e([l("esri.views.3d.webgl-engine.lib.CutFillColor")],V);const w=c().vec3f("position").vec3f("normal").freeze();class j{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{V as CutFillColor,j as VolumeGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as r,l as n,g as o,u as
|
|
5
|
+
import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as r,l as n,g as o,u as l,e as h,k as c,J as m,c as p}from"../../../../chunks/vec32.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g}from"../../../../chunks/vec42.js";import{create as _}from"../../../../geometry/support/plane.js";import{fromPoints as f}from"../../../../geometry/support/ray.js";import{j as b,i as P}from"../../../../chunks/sphere.js";import{RenderCategory as S}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import{getGaussianSplatQualitySettings as j}from"../../support/gaussianSplatting/GaussianSplatQualitySettings.js";import q from"../../webgl/RenderNode.js";import{IntersectorResult as w}from"./IntersectorResult.js";import{G as y}from"../../../../chunks/GaussianSplat.glsl.js";import{G as D}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as x}from"../shaders/GaussianSplatCompositionTechnique.js";import{G}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as T}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as R}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as A}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as V}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as E,PrimitiveType as I}from"../../../webgl/enums.js";var M;let k=class extends q{constructor(){super(...arguments),this.gaussianPosition=u(),this.intersectionRayDir=u(),this.intersectionPlane=_(),this._slicePlaneEnabled=!1,this._data=null,this.produces=S.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._gaussianSplatParameters=new y,this._gaussianSplatCompositionParameters=new D,this._gaussianSplatDepthCompositionParameters=new G,this._splatDepthTechniqueConfiguration=new V(!0),this._previousCameraPosition=u(),this._previousCameraDirection=u(),this._tanFov=a(),this._tempVec=u(),this._cameraDelta=u(),this._coarseCameraPosition=u()}static{M=this}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this.techniques.precompile(A),this.techniques.precompile(R,this._splatDepthTechniqueConfiguration),this.techniques.precompile(x),this.techniques.precompile(T)}render(t){const s=t.find(({name:t})=>t===S.OPAQUE);if(!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return s;const e=this.techniques.get(A),a=this.techniques.get(R,this._splatDepthTechniqueConfiguration),r=this.techniques.get(x),n=this.techniques.get(T);if(!(e.compiled&&a.compiled&&n.compiled&&r.compiled))return this.requestRender(1),s;const{fullWidth:o,fullHeight:l}=this.bindParameters.camera,h=this.fboCache,c=h.acquire(o,l,"gaussian color output");c.attachDepth(s.getAttachment(E));const m=this.renderingContext;m.bindFramebuffer(c.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this._gaussianSplatParameters.totalGaussians=this._data.visibleGaussians,this._gaussianSplatParameters.splatOrder=this._data.orderTexture.texture,this._gaussianSplatParameters.splatAtlas=this._data.textureAtlas.texture;const p=Math.tan(.5*this.camera.fovY),u=p/l*o;i(this._tanFov,u,p);const d=l/(2*p);this._gaussianSplatParameters.focalLength=d,this._gaussianSplatParameters.tanFov=this._tanFov;const g=j(this.view.qualityProfile),_=g.minimumSplatPixelRadius*Math.sqrt(o*l)/Math.sqrt(2073600);this._gaussianSplatParameters.minSplatRadius=_,this._gaussianSplatParameters.minSplatOpacity=g.minimumOpacity,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(e,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(I.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=h.acquire(o,l,"splat depth",8);f.attachDepth(s.getAttachment(E)),m.bindFramebuffer(f.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this.renderingContext.bindTechnique(a,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(I.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const b=h.acquire(o,l,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),b.attachDepth(s.getAttachment(E)),m.bindFramebuffer(b.fbo),m.bindTechnique(n,this.bindParameters,this._gaussianSplatDepthCompositionParameters),m.screen.draw(),this._gaussianSplatCompositionParameters.color=s.getTexture(),this._gaussianSplatCompositionParameters.splatColor=c.getTexture(),m.bindFramebuffer(b.fbo),m.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),m.screen.draw(),c.release(),f.release(),b}intersect(t,s,e,i){const{gaussianPosition:a,intersectionRayDir:m,intersectionPlane:p,layerViewUid:_}=this,S=f(e,i);r(m,i,e);const v=1/n(m);o(m,m,v);const j=u();l(j,m),g(p,m[0],m[1],m[2],-h(m,e));const q=new U,y=new U,D=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(p),l=r.obb.maximumDistancePlane(p),u=l<0,g=null!=q.dist&&null!=y.dist&&q.dist<o*v&&y.dist>l*v;if(u||g)return;const f=b(r.obb.center,r.obb.radius+n);if(!P(f,S,null))return;if(!r.obb.intersectRay(e,m,n))return;const{positions:C,squaredScales:w,gaussianAtlasIndices:x}=r,G=x.length;for(let p=0;p<G;p++){const r=3*p;a[0]=C[r]-e[0],a[1]=C[r+1]-e[1],a[2]=C[r+2]-e[2];const n=w[p],o=h(a,m),l=o*o;if(c(a)-l>n)continue;const u=o*v,g=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):d(a),t.dist=u,t.normal=j,t.layerViewUid=_,t);if((null==q.dist||u<q.dist)&&(null==s||s(e,i,u))&&g(q),0!==t.options.store&&(null==y.dist||u>y.dist)&&(null==s||s(e,i,u))&&g(y),2===t.options.store&&(null==s||s(e,i,u))){const t=new U;D.push(g(t))}}});const x=(t,s)=>{const{layerViewUid:e}=s,i=new C(s.point,e);t.set(0,i,s.dist,s.normal)};if(F(q)){const s=t.results.min;(null==s.distance||q.dist<s.distance)&&x(s,q)}if(F(y)&&0!==t.options.store){const s=t.results.max;(null==s.distance||y.dist>s.distance)&&x(s,y)}if(2===t.options.store)for(const r of D){const s=new w(S);x(s,r),t.results.all.push(s)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,s=this.view.state.camera.ray.direction,e=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>e||Math.abs(t[1]-this._previousCameraPosition[1])>e||Math.abs(t[2]-this._previousCameraPosition[2])>e||Math.abs(s[0]-this._previousCameraDirection[0])>e||Math.abs(s[1]-this._previousCameraDirection[1])>e||Math.abs(s[2]-this._previousCameraDirection[2])>e)&&this._data.requestSort()}_prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/M.tileSize),m(this._tempVec,this._tempVec),p(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,M.tileSize),r(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}static{this.tileSize=2.048}};function F(t){return null!=t.dist&&null!=t.point}k=M=t([e("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],k);class U{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{k as GaussianSplatRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as t,d as n,n as o,c as e,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as a,clone as c,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as y}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{timeStampsToAttribute as I,numTimeStampValuesPerVertex as P}from"../../support/engineContent/line.js";import{Attribute as x}from"./Attribute.js";import{scale as z,length as D,normalize as S,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";const O=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],V=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],k=[0,0,1,0,1,1,0,1],G=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],U=new Array(36);for(let It=0;It<6;It++)for(let t=0;t<6;t++)U[6*It+t]=It;const B=new Array(36);for(let It=0;It<6;It++)B[6*It]=0,B[6*It+1]=1,B[6*It+2]=2,B[6*It+3]=2,B[6*It+4]=3,B[6*It+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=O[e][0]*n[0],o[3*e+1]=O[e][1]*n[1],o[3*e+2]=O[e][2]*n[2];return new C(t,[["position",new x(o,G,3,!0)],["normal",new x(V,U,3)],["uv0",new x(k,B,2)]])}const H=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],J=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],K=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],L=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function N(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=H[e][0]*n[0],o[3*e+1]=H[e][1]*n[1],o[3*e+2]=H[e][2]*n[2];return new C(t,[["position",new x(o,K,3,!0)],["normal",new x(J,L,3)]])}const Q=a(-.5,0,-.5),R=a(.5,0,-.5),T=a(0,0,.5),W=a(0,.5,0),X=i(),Y=i(),Z=i(),$=i(),_=i();n(X,Q,W),n(Y,Q,R),l(Z,X,Y),o(Z,Z),n(X,R,W),n(Y,R,T),l($,X,Y),o($,$),n(X,T,W),n(Y,T,Q),l(_,X,Y),o(_,_);const tt=[Q,R,T,W],nt=[0,-1,0,Z[0],Z[1],Z[2],$[0],$[1],$[2],_[0],_[1],_[2]],ot=[0,1,2,3,1,0,3,2,1,3,0,2],et=[0,0,0,1,1,1,2,2,2,3,3,3];function st(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=tt[e][0]*n[0],o[3*e+1]=tt[e][1]*n[1],o[3*e+2]=tt[e][2]*n[2];return new C(t,[["position",new x(o,ot,3,!0)],["normal",new x(nt,et,3)]])}function rt(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,a=Math.max(3,Math.floor(o)),c=Math.max(2,Math.floor(e)),i=(a+1)*(c+1),p=m(3*i),f=m(3*i),w=m(2*i),g=[];let M=0;for(let m=0;m<=c;m++){const t=[],o=m/c,e=h+o*u,s=Math.cos(e);for(let h=0;h<=a;h++){const u=h/a,c=r+u*l,i=Math.cos(c)*s,g=Math.sin(e),m=-Math.sin(c)*s;p[3*M]=i*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=i,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const A=new Array;for(let m=0;m<c;m++)for(let t=0;t<a;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(A.push(n),A.push(e),A.push(s)):m===c-1?(A.push(n),A.push(o),A.push(e)):(A.push(n),A.push(o),A.push(e),A.push(e),A.push(s),A.push(n))}const b=[["position",new x(p,A,3,!0)],["normal",new x(f,A,3,!0)]];return s.uv&&b.push(["uv0",new x(w,A,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new x(Float64Array.from(s.offset),y(A.length),3,!0)])),new C(t,b)}function lt(t,n,o,e){const s=ht(n,o,e);return new C(t,s)}function ht(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<s.length;a+=3)z(s,a,t/D(s,a));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),z(s,r,t/D(s,r)),r/=3,l[e]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),a=h(s,t),c=4*o;n[c]=t,n[c+1]=l,n[c+2]=a,n[c+3]=e,n[c+4]=u,n[c+5]=l,n[c+6]=s,n[c+7]=a,n[c+8]=u,n[c+9]=l,n[c+10]=u,n[c+11]=a}r=n,l={}}const u=M(s);for(let a=0;a<u.length;a+=3)S(u,a);return[["position",new x(M(s),r,3,!0)],["normal",new x(u,r,3,!0)]]}function ut(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,olidColor:a=null}={}){const c=o?f(o):p(),i=n?f(n):w(0,0,1),g=e?[e[0],e[1],e[2],e.length>3?e[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],M=null!=s?[s]:[0],A=y(1),b=[["position",new x(c,A,3,!0)],["normal",new x(i,A,3,!0)],["color",new x(g,A,4,!0)],["size",new x(m,A,2)],["rotation",new x(M,A,1,!0)]];if(h&&b.push(["uvi",new x(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];b.push(["centerOffsetAndDistance",new x(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];b.push(["featureAttribute",new x(t,A,4)])}return new C(t,b,null,1,a)}const at=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=at){const o=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)o[3*a+t]=n[a][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new x(o,e,3,!0)],["normal",new x(s,r,3,!0)],["uv0",new x(l,e,2,!0)],["color",new x(h,r,4,!0)]];return new C(t,u)}function it(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let c=a(0,l,0),i=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,i=a(0,0,0),c=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[i,c],g=[p,f],M=o+2,A=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(e)}const y=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)y.push(1),y.push(t-1),y.push(t),b.push(0),b.push(0),b.push(0);y.push(w.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)y.push(t),y.push(t-1),y.push(0),b.push(t),b.push(t-1),b.push(1);y.push(0),y.push(2),y.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new x(j,y,3,!0)],["normal",new x(d,b,3,!0)]]}function pt(t,n,o,e,s,r=!0,l=!0){return new C(t,it(n,o,e,s,r,l))}function ft(n,e,h,p,f,w,g){const M=f?c(f):a(1,0,0),A=w?c(w):a(0,0,0);g??=!0;const y=i();o(y,M);const b=i();s(b,y,Math.abs(e));const j=i();s(j,b,-.5),r(j,j,A);const d=a(0,1,0);Math.abs(1-u(y,d))<.2&&t(d,0,0,1);const v=i();l(v,y,d),o(v,v),l(d,v,y);const I=2*p+(g?2:0),P=p+(g?2:0),z=m(3*I),D=m(3*P),S=m(2*I),q=new Array(3*p*(g?4:2)),F=new Array(3*p*(g?4:2));g&&(z[3*(I-2)]=j[0],z[3*(I-2)+1]=j[1],z[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,z[3*(I-1)]=z[3*(I-2)]+b[0],z[3*(I-1)+1]=z[3*(I-2)+1]+b[1],z[3*(I-1)+2]=z[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,D[3*(P-2)]=-y[0],D[3*(P-2)+1]=-y[1],D[3*(P-2)+2]=-y[2],D[3*(P-1)]=y[0],D[3*(P-1)+1]=y[1],D[3*(P-1)+2]=y[2]);const O=(t,n,o)=>{q[t]=n,F[t]=o};let V=0;const k=i(),G=i();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(k,d,Math.sin(n)),s(G,v,Math.cos(n)),r(k,k,G),D[3*t]=k[0],D[3*t+1]=k[1],D[3*t+2]=k[2],s(k,k,h),r(k,k,j),z[3*t]=k[0],z[3*t+1]=k[1],z[3*t+2]=k[2],S[2*t]=t/p,S[2*t+1]=0,z[3*(t+p)]=z[3*t]+b[0],z[3*(t+p)+1]=z[3*t+1]+b[1],z[3*(t+p)+2]=z[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;O(V++,t,t),O(V++,t+p,t),O(V++,o,o),O(V++,o,o),O(V++,t+p,t),O(V++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;O(V++,I-2,P-2),O(V++,t,P-2),O(V++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;O(V++,t+p,P-1),O(V++,I-1,P-1),O(V++,n+p,P-1)}}const U=[["position",new x(z,q,3,!0)],["normal",new x(D,F,3,!0)],["uv0",new x(S,q,2,!0)]];return new C(n,U)}function wt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let a=0;a<e;a++){h.push([0,-a-1,-(a+1)%e-1]);const t=a/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return gt(t,u,n,l,h,s,r)}function gt(h,u,c,i,f,w,g=a(0,0,0)){const M=u.length,A=m(c.length*M*3+(6*i.length||0)),y=m(c.length*M*3+(i?6:0)),I=new Array,P=new Array;let z=0,D=0;const S=p(),q=p(),F=p(),O=p(),V=p(),k=p(),G=p(),U=p(),B=p(),E=p(),H=p(),J=p(),K=p(),L=b();t(B,0,1,0),n(q,c[1],c[0]),o(q,q),w?(r(U,c[0],g),o(F,U)):t(F,0,0,1),jt(q,F,B,B,V,F,dt),e(O,F),e(J,V);for(let t=0;t<i.length;t++)s(k,V,i[t][0]),s(U,F,i[t][2]),r(k,k,U),r(k,k,c[0]),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2];y[D++]=-q[0],y[D++]=-q[1],y[D++]=-q[2];for(let t=0;t<f.length;t++)I.push(f[t][0]>0?f[t][0]:-f[t][0]-1+i.length),I.push(f[t][1]>0?f[t][1]:-f[t][1]-1+i.length),I.push(f[t][2]>0?f[t][2]:-f[t][2]-1+i.length),P.push(0),P.push(0),P.push(0);let N=i.length;const Q=i.length-1;for(let t=0;t<c.length;t++){let h=!1;if(t>0){e(S,q),t<c.length-1?(n(q,c[t+1],c[t]),o(q,q)):h=!0,r(E,S,q),o(E,E),r(H,c[t-1],O),j(c[t],E,L);d(L,v(H,S),U)?(n(U,U,c[t]),o(F,U),l(V,E,F),o(V,V)):jt(E,O,J,B,V,F,dt),e(O,F),e(J,V)}w&&(r(U,c[t],g),o(K,U));for(let n=0;n<M;n++)if(s(k,V,u[n][0]),s(U,F,u[n][1]),r(k,k,U),o(G,k),y[D++]=G[0],y[D++]=G[1],y[D++]=G[2],r(k,k,c[t]),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2],!h){const t=(n+1)%M;I.push(N+n),I.push(N+M+n),I.push(N+t),I.push(N+t),I.push(N+M+n),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=c[c.length-1];for(let t=0;t<i.length;t++)s(k,V,i[t][0]),s(U,F,i[t][1]),r(k,k,U),r(k,k,R),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2];const T=D/3;y[D++]=q[0],y[D++]=q[1],y[D++]=q[2];const W=N-M;for(let t=0;t<f.length;t++)I.push(f[t][0]>=0?N+f[t][0]:-f[t][0]-1+W),I.push(f[t][2]>=0?N+f[t][2]:-f[t][2]-1+W),I.push(f[t][1]>=0?N+f[t][1]:-f[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new x(A,I,3,!0)],["normal",new x(y,P,3,!0)]];return new C(h,X)}function mt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)r[h++]=n[c][t];c>0&&(l[u++]=c-1,l[u++]=c)}const a=[["position",new x(r,l,3,!0)]];if(o&&o.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];a.push(["normal",new x(t,l,3,!0)])}if(e&&a.push(["color",new x(e,A(e.length/4),4)]),s&&s.length===n.length){const t=I(s,1);a.push(["timeStamps",new x(t,l,P,!0)])}return new C(t,a,null,2)}function Mt(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let a=0;a<6;a++)l[3*a]=h[a][0],l[3*a+1]=h[a][1],l[3*a+2]=h[a][2];return new C(t,[["position",new x(l,u,3,!0)]])}function At(n,o){const e=n.getMutableAttribute("position").data;for(let s=0;s<e.length;s+=3){const n=e[s],r=e[s+1],l=e[s+2];t(vt,n,r,l),h(vt,vt,o),e[s]=vt[0],e[s+1]=vt[1],e[s+2]=vt[2]}}function yt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function bt(t,n,e,s,r){return!(Math.abs(u(n,t))>r)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function jt(t,n,o,e,s,r,l){return bt(t,n,s,r,l)||bt(t,o,s,r,l)||bt(t,e,s,r,l)}const dt=.99619469809,vt=p();export{yt as cgToGIS,E as createBoxGeometry,pt as createConeGeometry,it as createConeGeometryData,ft as createCylinderGeometry,N as createDiamondGeometry,Mt as createExtrudedTriangle,gt as createPathExtrusionGeometry,ut as createPointGeometry,ht as createPolySphereData,lt as createPolySphereGeometry,mt as createPolylineGeometry,rt as createSphereGeometry,ct as createSquareGeometry,st as createTetrahedronGeometry,wt as createTubeGeometry,jt as makeOrthoBasisDirUpFallback,At as transformInPlace};
|
|
5
|
+
import{i as t,d as n,n as o,c as e,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as a,clone as i,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as y}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{timeStampsToAttribute as I,numTimeStampValuesPerVertex as P}from"../../support/engineContent/line.js";import{Attribute as x}from"./Attribute.js";import{scale as D,length as z,normalize as S,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";import{getHUDMaterialBaseInstance as O}from"../materials/HUDMaterialBaseInstance.js";const U=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],V=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],k=[0,0,1,0,1,1,0,1],B=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],G=new Array(36);for(let Pt=0;Pt<6;Pt++)for(let t=0;t<6;t++)G[6*Pt+t]=Pt;const H=new Array(36);for(let Pt=0;Pt<6;Pt++)H[6*Pt]=0,H[6*Pt+1]=1,H[6*Pt+2]=2,H[6*Pt+3]=2,H[6*Pt+4]=3,H[6*Pt+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=U[e][0]*n[0],o[3*e+1]=U[e][1]*n[1],o[3*e+2]=U[e][2]*n[2];return new C(t,[["position",new x(o,B,3,!0)],["normal",new x(V,G,3)],["uv0",new x(k,H,2)]])}const J=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],K=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],L=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],N=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function Q(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=J[e][0]*n[0],o[3*e+1]=J[e][1]*n[1],o[3*e+2]=J[e][2]*n[2];return new C(t,[["position",new x(o,L,3,!0)],["normal",new x(K,N,3)]])}const R=a(-.5,0,-.5),T=a(.5,0,-.5),W=a(0,0,.5),X=a(0,.5,0),Y=c(),Z=c(),$=c(),_=c(),tt=c();n(Y,R,X),n(Z,R,T),l($,Y,Z),o($,$),n(Y,T,X),n(Z,T,W),l(_,Y,Z),o(_,_),n(Y,W,X),n(Z,W,R),l(tt,Y,Z),o(tt,tt);const nt=[R,T,W,X],ot=[0,-1,0,$[0],$[1],$[2],_[0],_[1],_[2],tt[0],tt[1],tt[2]],et=[0,1,2,3,1,0,3,2,1,3,0,2],st=[0,0,0,1,1,1,2,2,2,3,3,3];function rt(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=nt[e][0]*n[0],o[3*e+1]=nt[e][1]*n[1],o[3*e+2]=nt[e][2]*n[2];return new C(t,[["position",new x(o,et,3,!0)],["normal",new x(ot,st,3)]])}function lt(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,a=Math.max(3,Math.floor(o)),i=Math.max(2,Math.floor(e)),c=(a+1)*(i+1),p=m(3*c),f=m(3*c),w=m(2*c),g=[];let M=0;for(let m=0;m<=i;m++){const t=[],o=m/i,e=h+o*u,s=Math.cos(e);for(let h=0;h<=a;h++){const u=h/a,i=r+u*l,c=Math.cos(i)*s,g=Math.sin(e),m=-Math.sin(i)*s;p[3*M]=c*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=c,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const A=new Array;for(let m=0;m<i;m++)for(let t=0;t<a;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(A.push(n),A.push(e),A.push(s)):m===i-1?(A.push(n),A.push(o),A.push(e)):(A.push(n),A.push(o),A.push(e),A.push(e),A.push(s),A.push(n))}const b=[["position",new x(p,A,3,!0)],["normal",new x(f,A,3,!0)]];return s.uv&&b.push(["uv0",new x(w,A,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new x(Float64Array.from(s.offset),y(A.length),3,!0)])),new C(t,b)}function ht(t,n,o,e){const s=ut(n,o,e);return new C(t,s)}function ut(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<s.length;a+=3)D(s,a,t/z(s,a));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),D(s,r,t/z(s,r)),r/=3,l[e]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),a=h(s,t),i=4*o;n[i]=t,n[i+1]=l,n[i+2]=a,n[i+3]=e,n[i+4]=u,n[i+5]=l,n[i+6]=s,n[i+7]=a,n[i+8]=u,n[i+9]=l,n[i+10]=u,n[i+11]=a}r=n,l={}}const u=M(s);for(let a=0;a<u.length;a+=3)S(u,a);return[["position",new x(M(s),r,3,!0)],["normal",new x(u,r,3,!0)]]}function at(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,olidColor:a=null}={}){const i=o?f(o):p(),c=n?f(n):w(0,0,1),g=e?[e[0],e[1],e[2],e.length>3?e[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],M=null!=s?[s]:[0],A=y(1),b=[["position",new x(i,A,3,!0)],["normal",new x(c,A,3,!0)],["color",new x(g,A,4,!0)],["size",new x(m,A,2)],["rotation",new x(M,A,1,!0)]];if(h&&b.push(["uvi",new x(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];b.push(["centerOffsetAndDistance",new x(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];b.push(["featureAttribute",new x(t,A,4)])}return new C(t,b,null,1,a,void 0,O())}const it=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=it){const o=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)o[3*a+t]=n[a][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new x(o,e,3,!0)],["normal",new x(s,r,3,!0)],["uv0",new x(l,e,2,!0)],["color",new x(h,r,4,!0)]];return new C(t,u)}function pt(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let i=a(0,l,0),c=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,c=a(0,0,0),i=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[c,i],g=[p,f],M=o+2,A=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(e)}const y=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)y.push(1),y.push(t-1),y.push(t),b.push(0),b.push(0),b.push(0);y.push(w.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)y.push(t),y.push(t-1),y.push(0),b.push(t),b.push(t-1),b.push(1);y.push(0),y.push(2),y.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new x(j,y,3,!0)],["normal",new x(d,b,3,!0)]]}function ft(t,n,o,e,s,r=!0,l=!0){return new C(t,pt(n,o,e,s,r,l))}function wt(n,e,h,p,f,w,g){const M=f?i(f):a(1,0,0),A=w?i(w):a(0,0,0);g??=!0;const y=c();o(y,M);const b=c();s(b,y,Math.abs(e));const j=c();s(j,b,-.5),r(j,j,A);const d=a(0,1,0);Math.abs(1-u(y,d))<.2&&t(d,0,0,1);const v=c();l(v,y,d),o(v,v),l(d,v,y);const I=2*p+(g?2:0),P=p+(g?2:0),D=m(3*I),z=m(3*P),S=m(2*I),q=new Array(3*p*(g?4:2)),F=new Array(3*p*(g?4:2));g&&(D[3*(I-2)]=j[0],D[3*(I-2)+1]=j[1],D[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,D[3*(I-1)]=D[3*(I-2)]+b[0],D[3*(I-1)+1]=D[3*(I-2)+1]+b[1],D[3*(I-1)+2]=D[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,z[3*(P-2)]=-y[0],z[3*(P-2)+1]=-y[1],z[3*(P-2)+2]=-y[2],z[3*(P-1)]=y[0],z[3*(P-1)+1]=y[1],z[3*(P-1)+2]=y[2]);const O=(t,n,o)=>{q[t]=n,F[t]=o};let U=0;const V=c(),k=c();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(V,d,Math.sin(n)),s(k,v,Math.cos(n)),r(V,V,k),z[3*t]=V[0],z[3*t+1]=V[1],z[3*t+2]=V[2],s(V,V,h),r(V,V,j),D[3*t]=V[0],D[3*t+1]=V[1],D[3*t+2]=V[2],S[2*t]=t/p,S[2*t+1]=0,D[3*(t+p)]=D[3*t]+b[0],D[3*(t+p)+1]=D[3*t+1]+b[1],D[3*(t+p)+2]=D[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;O(U++,t,t),O(U++,t+p,t),O(U++,o,o),O(U++,o,o),O(U++,t+p,t),O(U++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;O(U++,I-2,P-2),O(U++,t,P-2),O(U++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;O(U++,t+p,P-1),O(U++,I-1,P-1),O(U++,n+p,P-1)}}const B=[["position",new x(D,q,3,!0)],["normal",new x(z,F,3,!0)],["uv0",new x(S,q,2,!0)]];return new C(n,B)}function gt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let a=0;a<e;a++){h.push([0,-a-1,-(a+1)%e-1]);const t=a/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return mt(t,u,n,l,h,s,r)}function mt(h,u,i,c,f,w,g=a(0,0,0)){const M=u.length,A=m(i.length*M*3+(6*c.length||0)),y=m(i.length*M*3+(c?6:0)),I=new Array,P=new Array;let D=0,z=0;const S=p(),q=p(),F=p(),O=p(),U=p(),V=p(),k=p(),B=p(),G=p(),H=p(),E=p(),J=p(),K=p(),L=b();t(G,0,1,0),n(q,i[1],i[0]),o(q,q),w?(r(B,i[0],g),o(F,B)):t(F,0,0,1),dt(q,F,G,G,U,F,vt),e(O,F),e(J,U);for(let t=0;t<c.length;t++)s(V,U,c[t][0]),s(B,F,c[t][2]),r(V,V,B),r(V,V,i[0]),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2];y[z++]=-q[0],y[z++]=-q[1],y[z++]=-q[2];for(let t=0;t<f.length;t++)I.push(f[t][0]>0?f[t][0]:-f[t][0]-1+c.length),I.push(f[t][1]>0?f[t][1]:-f[t][1]-1+c.length),I.push(f[t][2]>0?f[t][2]:-f[t][2]-1+c.length),P.push(0),P.push(0),P.push(0);let N=c.length;const Q=c.length-1;for(let t=0;t<i.length;t++){let h=!1;if(t>0){e(S,q),t<i.length-1?(n(q,i[t+1],i[t]),o(q,q)):h=!0,r(H,S,q),o(H,H),r(E,i[t-1],O),j(i[t],H,L);d(L,v(E,S),B)?(n(B,B,i[t]),o(F,B),l(U,H,F),o(U,U)):dt(H,O,J,G,U,F,vt),e(O,F),e(J,U)}w&&(r(B,i[t],g),o(K,B));for(let n=0;n<M;n++)if(s(V,U,u[n][0]),s(B,F,u[n][1]),r(V,V,B),o(k,V),y[z++]=k[0],y[z++]=k[1],y[z++]=k[2],r(V,V,i[t]),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2],!h){const t=(n+1)%M;I.push(N+n),I.push(N+M+n),I.push(N+t),I.push(N+t),I.push(N+M+n),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=i[i.length-1];for(let t=0;t<c.length;t++)s(V,U,c[t][0]),s(B,F,c[t][1]),r(V,V,B),r(V,V,R),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2];const T=z/3;y[z++]=q[0],y[z++]=q[1],y[z++]=q[2];const W=N-M;for(let t=0;t<f.length;t++)I.push(f[t][0]>=0?N+f[t][0]:-f[t][0]-1+W),I.push(f[t][2]>=0?N+f[t][2]:-f[t][2]-1+W),I.push(f[t][1]>=0?N+f[t][1]:-f[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new x(A,I,3,!0)],["normal",new x(y,P,3,!0)]];return new C(h,X)}function Mt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let i=0;i<n.length;i++){for(let t=0;t<3;t++)r[h++]=n[i][t];i>0&&(l[u++]=i-1,l[u++]=i)}const a=[["position",new x(r,l,3,!0)]];if(o&&o.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];a.push(["normal",new x(t,l,3,!0)])}if(e&&a.push(["color",new x(e,A(e.length/4),4)]),s&&s.length===n.length){const t=I(s,1);a.push(["timeStamps",new x(t,l,P,!0)])}return new C(t,a,null,2)}function At(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let a=0;a<6;a++)l[3*a]=h[a][0],l[3*a+1]=h[a][1],l[3*a+2]=h[a][2];return new C(t,[["position",new x(l,u,3,!0)]])}function yt(n,o){const e=n.getMutableAttribute("position").data;for(let s=0;s<e.length;s+=3){const n=e[s],r=e[s+1],l=e[s+2];t(It,n,r,l),h(It,It,o),e[s]=It[0],e[s+1]=It[1],e[s+2]=It[2]}}function bt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function jt(t,n,e,s,r){return!(Math.abs(u(n,t))>r)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function dt(t,n,o,e,s,r,l){return jt(t,n,s,r,l)||jt(t,o,s,r,l)||jt(t,e,s,r,l)}const vt=.99619469809,It=p();export{bt as cgToGIS,E as createBoxGeometry,ft as createConeGeometry,pt as createConeGeometryData,wt as createCylinderGeometry,Q as createDiamondGeometry,At as createExtrudedTriangle,mt as createPathExtrusionGeometry,at as createPointGeometry,ut as createPolySphereData,ht as createPolySphereGeometry,Mt as createPolylineGeometry,lt as createSphereGeometry,ct as createSquareGeometry,rt as createTetrahedronGeometry,gt as createTubeGeometry,dt as makeOrthoBasisDirUpFallback,yt as transformInPlace};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as
|
|
5
|
+
import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as t,ColorAttachment2 as n}from"../../../webgl/enums.js";import{defaultDepthWrite as s,separateBlendingParams as u,premultipliedAlpha as c,unpremultipliedAlphaToPremultipliedAlpha as o}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function a(r,e=!1){switch(r){case 0:return e?c:o;case 1:return f;case 2:case 3:return null}}function i(r){if(r.draped)return null;switch(r.oitPass){case 0:case 2:return r.writeDepth?s:null;case 1:case 3:return null}}const l=5e5,b={factor:-1,units:-2};function m({oitPass:r,enableOffset:e}){return e&&1===r?b:null}function p(r,e=513){return 0===r||2===r?e:515}function d(s,u){const c=r(u);return 1===s?c?{buffers:[e,t,n]}:{buffers:[e,t]}:c?{buffers:[e,t]}:null}export{b as OITPolygonOffset,l as OITPolygonOffsetLimit,a as blending,f as blendingColorAlpha,i as depthWrite,d as getDrawBuffers,p as oitDepthTest,m as oitPolygonOffset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as w,multiply as C}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>this._bindParameters.fadeLighting(),m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ee(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...we),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(l-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const w=Math.max(1-r,Math.abs(r-i)),C=Math.min(w*P/p,n);C>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*C,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this._plugins.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const f=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(f,g,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(f),this._renderTransparent(g,f,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const w=s&&!l&&!(d&&!i),C=this._pluginInput.get(I.COMPOSITE),T=w?M:this.fboCache.acquire(C.fbo.width,C.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(C,T,!1);let x;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),x=this._renderNodes(R.HIGHLIGHTS,S)):(x=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,x,u));const E=this._renderNodes(R.MAGNIFIER,x);return s&&d&&!i&&!l&&this.blitFBO(E),l?(E.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,E)),E.detachDepth()):this._pluginInput.set(I.FINAL,E),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ge),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...ge)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...we),this._bindParameters.oitPass=2,this._plugins.precompile(...we),this._bindParameters.oitPass=0):this._plugins.precompile(...we),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...we)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,E),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...ge);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(w(Se,this._bindParameters.camera.viewMatrix),w(Te,this._bindParameters.camera.projectionMatrix),C(xe,Se,Te),C(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),C(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([g()],me.prototype,"_edgeView",void 0),e([g()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],fe=[3,5],ge=[0,1,2,3],be=[4,5],Pe=[2,4,8],we=[16,13,14],Ce=[4,5,2,3,6,0,1],Te=S(),Se=S(),xe=S();function Ee(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
|
|
5
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as q,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>this._bindParameters.fadeLighting(),m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ee(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(l-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this._plugins.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const f=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(f,g,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(f),this._renderTransparent(g,f,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let x;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),x=this._renderNodes(R.HIGHLIGHTS,S)):(x=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,x,u));const E=this._renderNodes(R.MAGNIFIER,x);return s&&d&&!i&&!l&&this.blitFBO(E),l?(E.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,E)),E.detachDepth()):this._pluginInput.set(I.FINAL,E),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),q(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ge),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...ge)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,E),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...ge);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),q(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(xe,Se,Te),w(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),w(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([g()],me.prototype,"_edgeView",void 0),e([g()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],fe=[3,5],ge=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),xe=S();function Ee(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as u,t as f,n as p,d as h,g as d,c as m,l as g,j as b,f as v,a as x,o as S,e as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D,BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec2f as A,BufferViewVec4f as C}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as T}from"../../support/debugFlags.js";import{isColorEmissionHighlightOrOID as U,isColorOrColorEmission as E}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as B}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as q}from"../lib/GLTextureMaterial.js";import{Material as G}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as W}from"../lib/screenSizePerspectiveUtils.js";import{assert as H}from"../lib/Util.js";import{writePosition as N,writeNormal as X,writeColor as Y,writeBufferFloat as k,writeBufferVec4 as J,writeBufferVec4Zeros as K,writeOlidColor as Q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as $,f as ee}from"../../../../chunks/HUDMaterial.glsl.js";import{olidLayout as te,layout as ie,HUDMaterialTechnique as se}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as re}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class ne extends G{constructor(e,t){super(e,Ce),this.produces=new Map([[13,e=>U(e)&&!this.parameters.drawAsLabel],[14,e=>U(e)&&this.parameters.drawAsLabel],[12,()=>this.parameters.occlusionTest],[18,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new re(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=12===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||12===t.slot,E(e)&&(this._configuration.debugDrawLabelBorder=!!T.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,je),{scaleX:j,scaleY:M}=Te(P,y,S.pixelRatio);i(Se,t),e.attributes.has("featureAttribute")&&ue(Se);const F=e.attributes.get("position"),D=e.attributes.get("size"),R=e.attributes.get("normal"),V=e.attributes.get("rotation"),A=e.attributes.get("centerOffsetAndDistance");H(F.size>=3);const C=$(y),w="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<F.data.length/F.size;i++){const e=i*F.size;u(he,F.data[e],F.data[e+1],F.data[e+2]),f(he,he,t),f(he,he,S.viewMatrix);const a=i*A.size;if(u(_e,A.data[a],A.data[a+1],A.data[a+2]),!w&&(he[0]+=_e[0],he[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,he),h(he,he,d(_e,_e,e))}const n=i*R.size;if(u(de,R.data[n],R.data[n+1],R.data[n+2]),ce(de,Se,S,Me),Ue(this.parameters,he,Me,S,pe),S.applyProjection(he,me),me[0]>-1){w&&(_e[0]||_e[1])&&(me[0]+=_e[0]*S.pixelRatio,0!==_e[1]&&(me[1]+=pe.alignmentEvaluator.apply(_e[1])*S.pixelRatio),S.unapplyProjection(me,he)),me[0]+=this.parameters.screenOffset[0]*S.pixelRatio,me[1]+=this.parameters.screenOffset[1]*S.pixelRatio,me[0]=Math.floor(me[0]),me[1]=Math.floor(me[1]);const e=i*D.size;Re[0]=D.data[e],Re[1]=D.data[e+1],pe.evaluator.applyVec2(Re,Re);const t=Fe*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*Re[0])*S.pixelRatio/2}Re[0]*=j,Re[1]*=M;const n=i*V.size,l=y.rotation+V.data[n];if(fe(x,me[0],me[1],Re,t,a,l,y,C)){const e=s.ray;if(f(be,he,r(Oe,S.viewMatrix)),me[0]=x[0],me[1]=x[1],S.unprojectFromRenderScreen(me,he)){const t=O();m(t,e.direction);const i=1/g(t);d(t,t,i);o(b(e.origin,he)*i,t,-1,be)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=$(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,je),{scaleX:p,scaleY:h}=Te(f,l,e.screenToWorldRatio),d=De*e.screenToWorldRatio;for(let m=0;m<a.data.length/a.size;m++){const t=m*a.size,u=a.data[t],f=a.data[t+1],g=m*n.size;Re[0]=n.data[g],Re[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*Re[0])*e.screenToWorldRatio/2}Re[0]*=p,Re[1]*=h;const v=m*o.size,x=l.rotation+o.data[v];fe(i,u,f,Re,d,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new we}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ce(t,i,r,Me);return this._applyVerticalGroundOffsetView(e,o,r,n),Ue(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&m(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return m(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*L,o=d(he,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&m(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(de,i),x(i,i,d(de,de,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&m(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&m(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=ae||t>=ae&&i[3]>=ae;return this._visible&&s}createGLMaterial(e){return new oe(e)}calculateRelativeScreenBounds(e,t,i=F()){return le(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class oe extends q{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(se,e)}}function le(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ce(e,t,s,r){return M(t)&&(t=i(ye,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(ge,Ae),r}function ue(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function fe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,d=s-a-r[1]*f[1],m=d+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],d+=r[1]*g[1],h-=r[0]*(1-g[2]),m-=r[1]*(1-g[3]),p-=l,h+=l,d-=l,m+=l),n(xe,i,s),o(ve,e,xe,t(c)),ve[0]>p&&ve[0]<h&&ve[1]>d&&ve[1]<m}const pe=new W,he=O(),de=O(),me=P(),ge=O(),be=O(),ve=c(),xe=c(),Se=s(),ye=s(),Oe=a(),ze=P(),_e=O(),Pe=O(),je=P(),Me={normal:ge,cosAngle:0},Fe=1,De=2,Re=l(0,0),Ve=6,Ae=z(0,0,1);class Ce extends I{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class we{constructor(){this.layout=B()?te:ie}elementCount(e){return e.get("position").indices.length*Ve}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:u,rotation:f,centerOffsetAndDistance:p,featureAttribute:h}=r;N(i.get("position"),e,n,a,Ve),X(i.get("normal"),t,o,a,Ve);const d=i.get("uvi")?.data;let m=0,g=0,b=-1-ee,v=-1-ee;d&&d.length>=4&&(m=d[0],g=d[1],b=-1-d[2],v=-1-d[3]);let x=i.get("position").indices.length,S=a;for(let z=0;z<x;++z)l.set(S,0,m),l.set(S,1,g),S++,l.set(S,0,b),l.set(S,1,g),S++,l.set(S,0,b),l.set(S,1,v),S++,l.set(S,0,b),l.set(S,1,v),S++,l.set(S,0,m),l.set(S,1,v),S++,l.set(S,0,m),l.set(S,1,g),S++;Y(i.get("color"),4,c,a,Ve);const{data:y,indices:O}=i.get("size");x=O.length,S=a;for(let z=0;z<x;++z){const e=y[2*O[z]],t=y[2*O[z]+1];for(let i=0;i<Ve;++i)u.set(S,0,e),u.set(S,1,t),S++}if(k(i.get("rotation"),f,a,Ve),i.get("centerOffsetAndDistance")?J(i.get("centerOffsetAndDistance"),p,a,Ve):K(p,a,x*Ve),i.get("featureAttribute")?J(i.get("featureAttribute"),h,a,Ve):K(h,a,x*Ve),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);Q(s,i,t,a,Ve)}}return{numVerticesPerItem:Ve,numItems:x}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.layout.createView(e),_=z.getField("position",R),P=z.getField("normal",R),j=z.getField("rotation",V),M=z.getField("size",A),F=z.getField("featureAttribute",C),D=z.getField("centerOffsetAndDistance",C),w="screen"===t.centerOffsetUnits,T=$(t);if(null==_||null==P||null==j||null==M||null==D||null==y)return;const U=null==F?null:F.getVec(0,je),{scaleX:E,scaleY:L}=Te(U,t,y.pixelRatio),B=_.count/Ve;for(let R=0;R<B;R++){const e=R*Ve;if(_.getVec(e,he),null!=i&&v(he,he,i),f(he,he,y.viewMatrix),D.getVec(e,ze),u(_e,ze[0],ze[1],ze[2]),!w&&(he[0]+=_e[0],he[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,he),h(he,he,d(_e,_e,e))}if(P.getVec(e,de),ce(de,Se,y,Me),Ue(t,he,Me,y,pe),y.applyProjection(he,me),me[0]>-1){w&&(_e[0]||_e[1])&&(me[0]+=_e[0]*y.pixelRatio,0!==_e[1]&&(me[1]+=pe.alignmentEvaluator.apply(_e[1])*y.pixelRatio),y.unapplyProjection(me,he)),me[0]+=t.screenOffset[0]*y.pixelRatio,me[1]+=t.screenOffset[1]*y.pixelRatio,me[0]=Math.floor(me[0]),me[1]=Math.floor(me[1]),M.getVec(e,Re),pe.evaluator.applyVec2(Re,Re);const i=Fe*y.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Re[0])*y.pixelRatio/2}Re[0]*=E,Re[1]*=L;const n=j.get(e),l=t.rotation+n;if(fe(S,me[0],me[1],Re,i,a,l,t,T)){const e=s.ray;if(f(be,he,r(Oe,y.viewMatrix)),me[0]=S[0],me[1]=S[1],y.unprojectFromRenderScreen(me,he)){const t=O();m(t,e.direction);const i=1/g(t);d(t,t,i);o(b(e.origin,he)*i,t,R,be)}}}}}}function Te(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(w(Pe,t,e),{scaleX:Pe[0]*i,scaleY:Pe[1]*i})}function Ue(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=Z(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),d(i.normal,i.normal,o),v(t,t,i.normal)}export{ne as HUDMaterial,Ce as Parameters};
|
|
5
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as u,t as f,n as p,d as h,g as m,c as d,l as g,j as b,f as v,a as x,o as S,e as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as V}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorEmissionHighlightOrOID as C,isColorOrColorEmission as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as L}from"../lib/GLTextureMaterial.js";import{Material as E}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as U}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{writePosition as I,writeNormal as q,writeColor as G,writeBufferVec2 as W,writeBufferFloat as H,writeBufferVec4 as N,writeBufferVec4Zeros as X,writeOlidColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends E{constructor(e,t){super(e,Ve),this.produces=new Map([[13,e=>C(e)&&!this.parameters.drawAsLabel],[14,e=>C(e)&&this.parameters.drawAsLabel],[12,()=>this.parameters.occlusionTest],[18,e=>this.parameters.draped&&C(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=12===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||12===t.slot,w(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,Oe),{scaleX:j,scaleY:M}=Re(P,y,S.pixelRatio);i(ge,t),e.attributes.has("featureAttribute")&&ne(ge);const V=e.attributes.get("position"),D=e.attributes.get("size"),R=e.attributes.get("normal"),A=e.attributes.get("rotation"),C=e.attributes.get("centerOffsetAndDistance");B(V.size>=3);const w=J(y),F="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<V.data.length/V.size;i++){const e=i*V.size;u(ce,V.data[e],V.data[e+1],V.data[e+2]),f(ce,ce,t),f(ce,ce,S.viewMatrix);const a=i*C.size;if(u(Se,C.data[a],C.data[a+1],C.data[a+2]),!F&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}const n=i*R.size;if(u(ue,R.data[n],R.data[n+1],R.data[n+2]),ae(ue,ge,S,ze),Ae(this.parameters,ce,ze,S,le),S.applyProjection(ce,fe),fe[0]>-1){F&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*S.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*S.pixelRatio),S.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*S.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*S.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]);const e=i*D.size;je[0]=D.data[e],je[1]=D.data[e+1],le.evaluator.applyVec2(je,je);const t=_e*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*je[0])*S.pixelRatio/2}je[0]*=j,je[1]*=M;const n=i*A.size,l=y.rotation+A.data[n];if(oe(x,fe[0],fe[1],je,t,a,l,y,w)){const e=s.ray;if(f(he,ce,r(ve,S.viewMatrix)),fe[0]=x[0],fe[1]=x[1],S.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,-1,he)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Oe),{scaleX:p,scaleY:h}=Re(f,l,e.screenToWorldRatio),m=Pe*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,u=a.data[t],f=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const v=d*o.size,x=l.rotation+o.data[v];oe(i,u,f,je,m,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new De}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ae(t,i,r,ze);return this._applyVerticalGroundOffsetView(e,o,r,n),Ae(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*F,o=m(ce,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ue,i),x(i,i,m(ue,ue,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=V()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends L{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,s,r){return M(t)&&(t=i(be,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(pe,Me),r}function ne(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function oe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,m=s-a-r[1]*f[1],d=m+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(de,i,s),o(me,e,de,t(c)),me[0]>p&&me[0]<h&&me[1]>m&&me[1]<d}const le=new U,ce=O(),ue=O(),fe=P(),pe=O(),he=O(),me=c(),de=c(),ge=s(),be=s(),ve=a(),xe=P(),Se=O(),ye=O(),Oe=P(),ze={normal:pe,cosAngle:0},_e=1,Pe=2,je=l(0,0),Me=z(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class De{constructor(){this.layout=Q,this.instanceLayout=Z()}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),q(i.get("normal"),t,o,a);const m=i.get("position").indices.length;let d=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(d=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<m;++S){const e=a+S;h.setValues(e,d,g,b,v)}if(G(i.get("color"),4,l,a),W(i.get("size"),c,a),H(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?N(i.get("centerOffsetAndDistance"),f,a):X(f,a,m),i.get("featureAttribute")?N(i.get("featureAttribute"),p,a):X(p,a,m),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);Y(s,i,t,a)}}return{numVerticesPerItem:1,numItems:m}}writeBaseInstance(e,t){const{uv0:i}=t;W(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.instanceLayout.createView(e),{position:_,normal:P,rotation:j,size:M,featureAttribute:V,centerOffsetAndDistance:D}=z,R="screen"===t.centerOffsetUnits,A=J(t);if(null==_||null==P||null==j||null==M||null==D||null==y)return;const C=null==V?null:V.getVec(0,Oe),{scaleX:w,scaleY:F}=Re(C,t,y.pixelRatio),T=_.count;for(let L=0;L<T;L++){if(_.getVec(L,ce),null!=i&&v(ce,ce,i),f(ce,ce,y.viewMatrix),D.getVec(L,xe),u(Se,xe[0],xe[1],xe[2]),!R&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}if(P.getVec(L,ue),ae(ue,ge,y,ze),Ae(t,ce,ze,y,le),y.applyProjection(ce,fe),fe[0]>-1){R&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*y.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*y.pixelRatio),y.unapplyProjection(fe,ce)),fe[0]+=t.screenOffset[0]*y.pixelRatio,fe[1]+=t.screenOffset[1]*y.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),M.getVec(L,je),le.evaluator.applyVec2(je,je);const e=_e*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*je[0])*y.pixelRatio/2}je[0]*=w,je[1]*=F;const a=j.get(L),n=t.rotation+a;if(oe(S,fe[0],fe[1],je,e,i,n,t,A)){const e=s.ray;if(f(he,ce,r(ve,y.viewMatrix)),fe[0]=S[0],fe[1]=S[1],y.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,L,he)}}}}}}function Re(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ye,t,e),{scaleX:ye[0]*i,scaleY:ye[1]*i})}function Ae(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),m(i.normal,i.normal,o),v(t,t,i.normal)}export{ie as HUDMaterial,Ve as Parameters};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{Attribute as t}from"../lib/Attribute.js";import{GeometryBaseInstance as n}from"../lib/GeometryBaseInstance.js";function e(){return o??=r(),o}function r(){const e=0,r=255,o=new t([e,e,e,r,r,e,r,r],[0,1,2,3],2,!0);return new n([["uv0",o]])}let o=null;export{e as getHUDMaterialBaseInstance};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as
|
|
5
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../lib/GLMaterial.js";import{Material as i}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as a}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as o,instanceLayout as u,HeatmapDensityPassParameters as c,HeatmapDensityTechnique as l,baseLayout as f}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class p extends c{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends i{constructor(t){super(t,p),this.produces=new Map([[18,t=>0===t]]),this._configuration=new m}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new b(t)}intersect(){}intersectDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const r=h*o.size,s=t(v,o.data[r],o.data[r+1]);e(s,i)<m&&n(a.distance,a.normal,-1)}}createBufferWriter(){return new d(this.parameters.isAttributeDriven?o:u)}}class b extends s{beginSlot(t){return this.getTechnique(l,t)}}class d{constructor(t){this.instanceLayout=t,this.layout=f}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i,o){n(r.get("position"),t,i.position,o);const u="featureAttribute"in i?i.featureAttribute:null;return u&&a(r.get("featureAttribute"),u,o),null}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const v=r();export{g as HeatmapDensityMaterial,p as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r}from"../../../../core/time.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as a,d as o,e as n,g as l,f as h,c,l as m,j as p,t as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as d}from"../../../../chunks/vec42.js";import{ONES as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as _}from"../../../../geometry/support/float16.js";import{distance2 as S,fromPoints as v,create as P,closestLineSegmentPoint as y}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,create as E,signedDistance as w,getNormal as T}from"../../../../geometry/support/plane.js";import{isHighlightOrOID as z,isColorOrColorEmission as A,isDepth as C,isColorEmissionHighlightOIDOrDepth as O,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as x}from"../lib/Util.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as k}from"./internal/bufferWriterUtils.js";import{r as N}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as U,RibbonLineTechnique as D}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as B}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class J extends R{constructor(t,e){super(t,q),this.produces=new Map([[2,t=>z(t)||A(t)&&8===this.parameters.renderOccluded],[3,t=>C(t)],[10,t=>O(t)&&8===this.parameters.renderOccluded],[11,t=>O(t)&&8===this.parameters.renderOccluded],[4,t=>A(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,t=>A(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,t=>L(t)]]),this._configuration=new B(e)}getConfiguration(t,e){super.getConfiguration(t,e,this._configuration),this._configuration.oitPass=e.oitPass,this._configuration.draped=18===e.slot;const i=null!=this.parameters.stipplePattern&&9!==t;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&H(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=e.terrainDepthTest&&A(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,o){if(!r.options.selectionMode)return;const n=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else n&&(l*=n.data[0]);const h=s[0],c=s[1],m=(l/2+4)*i;let p=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=I(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=c-i,o=f[r]-t,n=f[r+1]-i,l=e((o*s+n*a)/(o*o+n*n),0,1),m=o*l-s,d=n*l-a,b=m*m+d*d;b<p&&(p=b,u=g/3)}p<m*m&&a(o.distance,o.normal,u)}intersect(i,r,u,f,d,g){const{options:b,camera:_,rayBegin:P,rayEnd:E}=u;if(!b.selectionMode||!i.visible||!_)return;if(!x(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const O=tt;s(O,u.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;a(mt[0],O[0]-L,O[1]+L,0),a(mt[1],O[0]+L,O[1]+L,0),a(mt[2],O[0]+L,O[1]-L,0),a(mt[3],O[0]-L,O[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(mt[t],pt[t]))return;j(_.eye,pt[0],pt[1],ut),j(_.eye,pt[1],pt[2],ft),j(_.eye,pt[2],pt[3],dt),j(_.eye,pt[3],pt[0],gt);let M=Number.MAX_VALUE,V=0;const R=I(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<R;t+=3){K[0]=A[t]+r[12],K[1]=A[t+1]+r[13],K[2]=A[t+2]+r[14];const e=(t+3)%A.length;if(Q[0]=A[e]+r[12],Q[1]=A[e+1]+r[13],Q[2]=A[e+2]+r[14],w(ut,K)<0&&w(ut,Q)<0||w(ft,K)<0&&w(ft,Q)<0||w(dt,K)<0&&w(dt,Q)<0||w(gt,K)<0&&w(gt,Q)<0)continue;const i=_.projectToRenderScreen(K,et),s=_.projectToRenderScreen(Q,it);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(Z,K,Q);const t=_.frustum,e=-w(t[4],K)/n(Z,T(t[4]));if(l(Z,Z,e),h(K,K,Z),!_.projectToRenderScreen(K,i))continue}else if(i[2]>0&&s[2]<0){o(Z,Q,K);const t=_.frustum,e=-w(t[4],Q)/n(Z,T(t[4]));if(l(Z,Z,e),h(Q,Q,Z),!_.projectToRenderScreen(Q,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=S(v(i,s,at),O);a<M&&(M=a,c(rt,K),c(st,Q),V=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(y(v(rt,st,at),v(P,E,ot),$)){o($,$,P);const e=m($);l($,$,1/e),t=e/p(P,E)}g(t,$,V)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new X(U(this.parameters),this.parameters)}createGLMaterial(t){return new Y(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){const{hasAnimation:e}=this.parameters;return!!e&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class Y extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const e=this._material.parameters.stipplePattern;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(D,t)}}class q extends F{constructor(){super(...arguments),this.width=0,this.color=g,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=0,this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=0,this.endTime=1/0,this.fadeInTime=0,this.fadeOutTime=1/0,this.emissiveStrength=0}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}}class X{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=N+i}}_isClosed(t){return I(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,o){const n=i.get("position"),l=n.indices,h=n.data.length/3,m=i.get("distanceToStart")?.data;l&&l.length!==2*(h-1)&&console.warn("RibbonLineMaterial does not support indices");const f=(this.layout.fields.has("sizeFeatureAttribute")?i.get("sizeFeatureAttribute")?.data[0]:i.get("size")?.data[0])??1;let g=[1,1,1,1],b=0;const S=this.layout.fields.has("colorFeatureAttribute");S?b=i.get("colorFeatureAttribute").data[0]:i.has("color")&&(g=i.get("color").data);const v=i.get("timeStamps")?.data,P=v&&this.layout.fields.has("timeStamps"),y=this.layout.fields.has("opacityFeatureAttribute"),j=y?i.get("opacityFeatureAttribute").data[0]:0,E=new Float32Array(s.buffer),w=_(s.buffer),T=new Uint8Array(s.buffer),z=this.layout.stride/4;let A=o*z;const C=A;let O=0;const L=m?(t,e,i)=>O=m[i]:(t,e,i)=>O+=p(t,e),V=E.BYTES_PER_ELEMENT/w.BYTES_PER_ELEMENT,R=4/V,x=(t,e,i,s,a,o,n,l)=>{E[A++]=e[0],E[A++]=e[1],E[A++]=e[2],k(t,e,w,A*V),A+=R,k(i,e,w,A*V),A+=R,E[A++]=l;let h=A*V;if(w[h++]=a,w[h++]=o,A=Math.ceil(h/V),S)E[A]=b;else{const t=Math.min(4*n,g.length-4),e=4*A;T[e]=255*g[t],T[e+1]=255*g[t+1],T[e+2]=255*g[t+2],T[e+3]=255*g[t+3]}if(A++,E[A++]=f,y&&(E[A++]=j),M()){let t=4*A;r?(T[t++]=r[0],T[t++]=r[1],T[t++]=r[2],T[t++]=r[3]):(T[t++]=0,T[t++]=0,T[t++]=0,T[t++]=0),A=Math.ceil(.25*t)}P&&(h=A*V,w[h++]=s[0],w[h++]=s[1],w[h++]=s[2],w[h++]=s[3],A=Math.ceil(h/V))};A+=z,a(lt,n.data[0],n.data[1],n.data[2]),P&&d(ct,v[0],v[1],v[2],v[3]),t&&u(lt,lt,t);const F=this._isClosed(i);if(F){const e=n.data.length-3;a(nt,n.data[e],n.data[e+1],n.data[e+2]),t&&u(nt,nt,t)}else a(ht,n.data[3],n.data[4],n.data[5]),t&&u(ht,ht,t),x(lt,lt,ht,ct,1,-4,0,0),x(lt,lt,ht,ct,1,4,0,0),c(nt,lt),c(lt,ht),P&&d(ct,v[4],v[5],v[6],v[7]);const N=F?0:1,U=F?h:h-1;for(let p=N;p<U;p++){const e=(p+1)%h*3;a(ht,n.data[e],n.data[e+1],n.data[e+2]),t&&u(ht,ht,t),L(nt,lt,p),x(nt,lt,ht,ct,0,-1,p,O),x(nt,lt,ht,ct,0,1,p,O);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);x(nt,lt,ht,ct,e,-1,p,O),x(nt,lt,ht,ct,e,1,p,O)}if(x(nt,lt,ht,ct,1,-2,p,O),x(nt,lt,ht,ct,1,2,p,O),c(nt,lt),c(lt,ht),P){const t=(p+1)%h*4;d(ct,v[t],v[t+1],v[t+2],v[t+3])}}F?(a(ht,n.data[3],n.data[4],n.data[5]),t&&u(ht,ht,t),O=L(nt,lt,U),x(nt,lt,ht,ct,0,-1,N,O),x(nt,lt,ht,ct,0,1,N,O)):(O=L(nt,lt,U),x(nt,lt,lt,ct,0,-5,U,O),x(nt,lt,lt,ct,0,5,U,O)),G(E,C+z,E,C,z);return A=G(E,A-z,E,A,z),this._parameters.wireframe&&this._addWireframeVertices(s,C,A,z),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let o=0;const n=t=>o=G(a,t,s,o,r);for(let l=0;l<a.length-1;l+=2*r)n(l),n(l+2*r),n(l+1*r),n(l+2*r),n(l+1*r),n(l+3*r)}}function G(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function I(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function H(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const K=f(),Q=f(),Z=f(),$=f(),tt=f(),et=i(),it=i(),rt=f(),st=f(),at=P(),ot=P(),nt=f(),lt=f(),ht=f(),ct=b(),mt=[i(),i(),i(),i()],pt=[f(),f(),f(),f()],ut=E(),ft=E(),dt=E(),gt=E();export{q as Parameters,J as RibbonLineMaterial};
|
|
5
|
+
import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r}from"../../../../core/time.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as a,d as n,e as o,g as l,f as h,c,l as m,j as p,t as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as d}from"../../../../chunks/vec42.js";import{ONES as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as _}from"../../../../geometry/support/float16.js";import{distance2 as S,fromPoints as v,create as P,closestLineSegmentPoint as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as E,create as w,signedDistance as y,getNormal as T}from"../../../../geometry/support/plane.js";import{isHighlightOrOID as z,isColorOrColorEmission as A,isDepth as C,isColorEmissionHighlightOIDOrDepth as O,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as x}from"../lib/Util.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as k}from"./internal/bufferWriterUtils.js";import{r as N}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as U,RibbonLineTechnique as D}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as B}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";class J extends R{constructor(t,e){super(t,q),this.produces=new Map([[2,t=>z(t)||A(t)&&8===this.parameters.renderOccluded],[3,t=>C(t)],[10,t=>O(t)&&8===this.parameters.renderOccluded],[11,t=>O(t)&&8===this.parameters.renderOccluded],[4,t=>A(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,t=>A(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,t=>L(t)]]),this._configuration=new B(e)}getConfiguration(t,e){super.getConfiguration(t,e,this._configuration),this._configuration.oitPass=e.oitPass,this._configuration.draped=18===e.slot;const i=null!=this.parameters.stipplePattern&&9!==t;return this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&H(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=e.terrainDepthTest&&A(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],c=s[1],m=(l/2+4)*i;let p=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=I(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=c-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<p&&(p=b,u=g/3)}p<m*m&&a(n.distance,n.normal,u)}intersect(i,r,u,f,d,g){const{options:b,camera:_,rayBegin:P,rayEnd:w}=u;if(!b.selectionMode||!i.visible||!_)return;if(!x(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const O=tt;s(O,u.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;a(mt[0],O[0]-L,O[1]+L,0),a(mt[1],O[0]+L,O[1]+L,0),a(mt[2],O[0]+L,O[1]-L,0),a(mt[3],O[0]-L,O[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(mt[t],pt[t]))return;E(_.eye,pt[0],pt[1],ut),E(_.eye,pt[1],pt[2],ft),E(_.eye,pt[2],pt[3],dt),E(_.eye,pt[3],pt[0],gt);let M=Number.MAX_VALUE,V=0;const R=I(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<R;t+=3){K[0]=A[t]+r[12],K[1]=A[t+1]+r[13],K[2]=A[t+2]+r[14];const e=(t+3)%A.length;if(Q[0]=A[e]+r[12],Q[1]=A[e+1]+r[13],Q[2]=A[e+2]+r[14],y(ut,K)<0&&y(ut,Q)<0||y(ft,K)<0&&y(ft,Q)<0||y(dt,K)<0&&y(dt,Q)<0||y(gt,K)<0&&y(gt,Q)<0)continue;const i=_.projectToRenderScreen(K,et),s=_.projectToRenderScreen(Q,it);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){n(Z,K,Q);const t=_.frustum,e=-y(t[4],K)/o(Z,T(t[4]));if(l(Z,Z,e),h(K,K,Z),!_.projectToRenderScreen(K,i))continue}else if(i[2]>0&&s[2]<0){n(Z,Q,K);const t=_.frustum,e=-y(t[4],Q)/o(Z,T(t[4]));if(l(Z,Z,e),h(Q,Q,Z),!_.projectToRenderScreen(Q,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=S(v(i,s,at),O);a<M&&(M=a,c(rt,K),c(st,Q),V=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(j(v(rt,st,at),v(P,w,nt),$)){n($,$,P);const e=m($);l($,$,1/e),t=e/p(P,w)}g(t,$,V)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new X(U(this.parameters),this.parameters)}createGLMaterial(t){return new Y(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){const{hasAnimation:e}=this.parameters;return!!e&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class Y extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const e=this._material.parameters.stipplePattern;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(D,t)}}class q extends F{constructor(){super(...arguments),this.width=0,this.color=g,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=0,this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=0,this.endTime=1/0,this.fadeInTime=0,this.fadeOutTime=1/0,this.emissiveStrength=0}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}}class X{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=N+i}}_isClosed(t){return I(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,n){const o=this.layout,l=i.get("position"),h=l.indices,m=l.data.length/3,f=i.get("distanceToStart")?.data;h&&h.length!==2*(m-1)&&console.warn("RibbonLineMaterial does not support indices");const g=o.fields.has("sizeFeatureAttribute");let b=1,S=null;if(g){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:S=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,j=null;const E=o.fields.has("colorFeatureAttribute");if(E){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:j=t.data}else v=i.get("color")?.data??v;const w=i.get("timeStamps")?.data,y=w&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),O=_(s.buffer),L=new Uint8Array(s.buffer),V=o.stride/4;let R=n*V;const x=R;let F=0;const N=f?(t,e,i)=>F=f[i]:(t,e,i)=>F+=p(t,e),U=C.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,D=4/U,B=M(),W=(t,e,i,s,a,n,o,l)=>{C[R++]=e[0],C[R++]=e[1],C[R++]=e[2],k(t,e,O,R*U),R+=D,k(i,e,O,R*U),R+=D,C[R++]=l;let h=R*U;if(O[h++]=a,O[h++]=n,R=Math.ceil(h/U),E)C[R]=j?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*R;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(R++,C[R++]=S?.[o]??b,T&&(C[R++]=A?.[o]??z),B){let t=4*R;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),R=Math.ceil(.25*t)}y&&(h=R*U,O[h++]=s[0],O[h++]=s[1],O[h++]=s[2],O[h++]=s[3],R=Math.ceil(h/U))};R+=V,a(lt,l.data[0],l.data[1],l.data[2]),y&&d(ct,w[0],w[1],w[2],w[3]),t&&u(lt,lt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;a(ot,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ot,ot,t)}else a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),W(lt,lt,ht,ct,1,-4,0,0),W(lt,lt,ht,ct,1,4,0,0),c(ot,lt),c(lt,ht),y&&d(ct,w[4],w[5],w[6],w[7]);const Y=J?0:1,q=J?m:m-1;for(let p=Y;p<q;p++){const e=(p+1)%m*3;a(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&u(ht,ht,t),N(ot,lt,p),W(ot,lt,ht,ct,0,-1,p,F),W(ot,lt,ht,ct,0,1,p,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ot,lt,ht,ct,e,-1,p,F),W(ot,lt,ht,ct,e,1,p,F)}if(W(ot,lt,ht,ct,1,-2,p,F),W(ot,lt,ht,ct,1,2,p,F),c(ot,lt),c(lt,ht),y){const t=(p+1)%m*4;d(ct,w[t],w[t+1],w[t+2],w[t+3])}}J?(a(ht,l.data[3],l.data[4],l.data[5]),t&&u(ht,ht,t),F=N(ot,lt,q),W(ot,lt,ht,ct,0,-1,Y,F),W(ot,lt,ht,ct,0,1,Y,F)):(F=N(ot,lt,q),W(ot,lt,lt,ct,0,-5,q,F),W(ot,lt,lt,ct,0,5,q,F)),G(C,x+V,C,x,V);return R=G(C,R-V,C,R,V),this._parameters.wireframe&&this._addWireframeVertices(s,x,R,V),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=G(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function G(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function I(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function H(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const K=f(),Q=f(),Z=f(),$=f(),tt=f(),et=i(),it=i(),rt=f(),st=f(),at=P(),nt=P(),ot=f(),lt=f(),ht=f(),ct=b(),mt=[i(),i(),i(),i()],pt=[f(),f(),f(),f()],ut=w(),ft=w(),dt=w(),gt=w();export{q as Parameters,J as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as
|
|
5
|
+
import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as l}from"../../../../webgl/VertexBuffer.js";class c{constructor(t,e){this._rctx=e,this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(s(this._bufferWriter.layout))}maxElements(t){return Math.floor(d/this._targetStrideFloats(t))}_targetStrideFloats(t){return this._targetStrideBytes(t)/4}_targetStrideBytes(t){return this._targetLayout(t)?.stride??0}_targetLayout(t){return"geometry"===t?this._bufferWriter.layout:this._bufferWriter.instanceLayout}endElement(t){return Math.floor((t.vao?.getByteLength(t.targetBuffer)??0)/this._targetStrideBytes(t.targetBuffer))}evaluateBufferAllocation(t,e,r,a){const o=this._targetStrideFloats(a.targetBuffer),s=e.reduce((t,{geometry:e})=>t+this.elementCount(e),0),n=r.reduce((t,{geometry:e})=>t+this.elementCount(e),0),i=Math.min((t+s-n)*o,d),f=a.vao?.buffer(a.targetBuffer),u=(f?.sizeBytes??0)/4;return i>h&&i<u/2?0:i>u?1:2}deleteBuffer(t){if("instances"===t.targetBuffer)return t.vao?.buffer("instances")?.dispose(),t.vao?.disposeVAOOnly(),void(t.vao=null);this._vaoCache.deleteVao(t.vao)}createBaseInstanceData(t){const{_bufferWriter:e}=this;if(null==t||null==e.writeBaseInstance||null==e.elementCountBaseInstance)return null;const r=e.layout,a=e.elementCountBaseInstance(t.attributes),o=a*this._targetStrideFloats("geometry"),n=new l(this._rctx,s(r));n.setSize(Math.ceil(4*o));const i=w(o),c=r.createView(i.buffer);e.writeBaseInstance(t.attributes,c),n.setSubData(i,0,0,o);const m=new f;return m.first=0,m.count=a,new u(t,n,m)}_allocateInstanceBuffer(t){const e=this._bufferWriter.instanceLayout;n(null!=e,"Trying to allocate an instance buffer, but the BufferWriter does not support instancing");const r=t*this._targetStrideFloats("instances"),a=new l(this._rctx,s(e,1));return a.setSize(S(r)),a}_createInstancedVao(t,e){return new i(this._rctx,new Map([["geometry",t],["instances",e]]))}reallocateBuffer(t,e,r){if(this.deleteBuffer(e),null!=t){const e=t.baseInstanceBuffer,a=this._allocateInstanceBuffer(r);return this._createInstancedVao(e,a)}const a=r*this._targetStrideFloats("geometry");return this._vaoCache.newVao(S(a))}elementCount(t){return this._bufferWriter.elementCount(t.attributes)}canGrow(t,e){const{targetBuffer:r,vao:a}=t;if(null==a)return!0;const o=4*(e*this._targetStrideFloats(r));return a.getByteLength(r)<S(d-h)&&o>a.getByteLength(r)}clearHoles(t,{vao:e,targetBuffer:r}){const a=this._targetStrideFloats(r),o=t.reduce((t,e)=>Math.max(t,e.numElements),0)*a,s=w(o);s.fill(0,0,o);const n=e.buffer(r);for(const i of t)n?.setSubData(s,i.from*a,0,i.numElements*a)}clearHolesMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=(r-e)*s,i=w(n),f=this._targetLayout(o).createView(i.buffer);i.fill(0,0,n);for(const u of t){if(!(u.from>=e&&u.to<=r))continue;const t=u.from-e;this._writeGeometry(u.geometry,f,t)}a.buffer(o)?.setSubData(i,e*s,0,n)}writeRandomInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0,f=0,u=0;const l=r.buffer(a);for(const m of e){if(!(u===m.from)){const t=u-f;t>0&&l?.setSubData(s,f*o,0,t*o),f=m.from,i=0}this._writeGeometry(m.geometry,n,i),i+=m.numElements,u=m.to}const c=u-f;c>0&&l?.setSubData(s,f*o,0,c*o)}writeInstanceRangeMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=t-e,i=n*s,f=w(i),u=this._targetLayout(o).createView(f.buffer);f.fill(0,0,i);for(const l of r){if(!(l.from>=e&&l.to<=t))continue;const r=l.from-e;this._writeGeometry(l.geometry,u,r)}n>0&&a.buffer(o)?.setSubData(f,e*s,0,i)}rebuildInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0;for(const f of e){this._writeGeometry(f.geometry,n,i);const t=i;i+=this.elementCount(f.geometry.geometry),f.from=t,f.to=i}return r?.buffer(a)?.setSubData(s,0,0,i*o),i}updateInstance(t,{vao:e,targetBuffer:r}){const{_bufferWriter:a}=this,o=this._targetStrideFloats(r),s=w(a.elementCount(t.geometry.geometry.attributes)*o),n=this._targetLayout(r).createView(s.buffer);this._writeGeometry(t.geometry,n,0),e.buffer(r)?.setSubData(s,t.from*o,0,t.numElements*o)}_writeGeometry(t,o,s){const{_bufferWriter:n}=this;null!=n&&(e(m,t.transformation),m[12]-=t.localOrigin.vec3[0],m[13]-=t.localOrigin.vec3[1],m[14]-=t.localOrigin.vec3[2],r(g,m),a(g,g),n.write(m,g,t.geometry.attributes,t.geometry.olidColor,o,s))}static prune(){B=new Float32Array(h)}}const m=o(),g=o(),h=65536,_=4*h,y=1024,b=16777216,d=b/4;let B=new Float32Array(h);function w(t){return B.length<t&&(B=new Float32Array(t)),B}function S(e){const r=4*e;return r<=y?y:r<_?t(r):Math.max(Math.min(Math.ceil(1.5*r/_)*_,b),r)}export{c as VaoWriter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillCompositionPassParameters,b as build}from"../../../../chunks/CutFillComposition.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as o}from"../lib/DefaultVertexBufferLayouts.js";import{a as i}from"../../../../chunks/CutFillComposition.glsl.js";import{makePipelineState as t,defaultColorWrite as s}from"../../../webgl/renderState.js";class l extends r{constructor(r,t){super(r,t,new e(i,()=>import("./CutFillComposition.glsl.js")),o)}initializePipeline(){return t({colorWrite:s})}}export{l as CutFillCompositionTechnique};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Matrix4DrawUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillMaskDrawParameters,b as build}from"../../../../chunks/CutFillMask.glsl.js";
|