@arcgis/core 4.23.0-next.20220130 → 4.23.0-next.20220131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{357033117dfe61eb81ea.js → 0c15d77d8e817cf45a9a.js} +1 -1
- package/assets/esri/core/workers/chunks/{e93dfdede0532a89ffa5.js → 2b25fc7945a187c2bb9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{7903a3e2e0faff0f86c0.js → 56657f890e0f79f5d2ad.js} +1 -1
- package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
- package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
- package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
- package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +1 -0
- package/assets/esri/core/workers/chunks/{ff6abdc72076f3994659.js → f7150547d7e3259a0f29.js} +1 -1
- package/assets/esri/core/workers/chunks/{386f86f961146f530aa7.js → fc046a15466c25d081ff.js} +1 -1
- package/assets/esri/images/portal/mediaservice16.png +0 -0
- package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/interfaces.d.ts +449 -45
- package/layers/RouteLayer.d.ts +4 -0
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/rest/support/DirectionLine.d.ts +4 -0
- package/rest/support/DirectionPoint.d.ts +4 -0
- package/rest/support/RouteInfo.d.ts +4 -0
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/RouteSolveResult.d.ts +4 -0
- package/support/revision.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/support/directionsUtils.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
- package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
- package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
- package/widgets/Directions/support/CostSummary.js +0 -5
- package/widgets/Directions/support/RouteSection.js +0 -5
- package/widgets/Directions/support/RouteSections.js +0 -5
- package/widgets/Directions/support/maneuverUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import s from"../../../core/has.js";import{lerp as r}from"../../../core/mathUtils.js";import{releaseMaybe as o,disposeMaybe as h,destroyMaybe as a,isNone as n}from"../../../core/maybe.js";import{init as c}from"../../../core/watchUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{f as m}from"../../../chunks/mat3.js";import{c as d}from"../../../chunks/mat3f64.js";import{x as f}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{f as _,z as g}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as y}from"../../../geometry/projectionEllipsoid.js";import{cloudPresets as v}from"./CloudsPresets.js";import{CloudsTechniqueConfiguration as b,CloudsTechnique as x}from"./CloudsTechnique.js";import{NoiseTextureAtlas as S}from"./NoiseTextureAtlas.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as w}from"../../support/Scheduler.js";import{TextureType as z,PixelFormat as M,PixelType as j,TextureWrapMode as C,TextureSamplingMode as U,TargetType as E}from"../../webgl/enums.js";import{FramebufferObject as q}from"../../webgl/FramebufferObject.js";let R=class extends t{constructor(e){super(e),this._frameTask=null,this._handles=new i,this._cubeMapSize=s("esri-mobile")?1024:2048,this._techniques=[],this._techniqueConfiguration=new b,this.coverage=r(H.coverage[0],H.coverage[1],.5),this.density=r(H.density[0],H.density[1],.5),this.absorption=r(H.absorption[0],H.absorption[1],.5),this.cloudSize=r(H.cloudSize[0],H.cloudSize[1],.5),this.detailSize=r(H.detailSize[0],H.detailSize[1],.5),this.smoothness=r(H.smoothness[0],H.smoothness[1],.5),this.cloudHeight=r(H.cloudHeight[0],H.cloudHeight[1],.5),this.raymarchingStepType=H.raymarchingStepType,this._cloudRadius=0,this._viewMatrix=l(),this._viewMatrix3=d(),this.running=!1}_getTechnique(e){const t=this._techniques[e];return t||(this._techniqueConfiguration.steps=e,this._techniques[e]=new x({rctx:this.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[e])}initialize(){this._vao=T(this.rctx);const e=y(this.view.spatialReference);this._cloudRadius=.5*e.radius,this.setDirty(),this._frameTask=this.view.resourceController.scheduler.registerTask(w.CLOUDS_GENERATOR,this),this._handles.add(this._frameTask),this._handles.add(c(this,"coverage",(()=>this.setDirty())));["coverage","density","absorption","cloudSize","detailSize","smoothness","cloudHeight","raymarchingStepType"].forEach((e=>this._handles.add(c(this,e,(()=>this.setDirty())))))}destroy(){this._handles.destroy(),this._techniques.forEach((e=>o(e))),this._techniques=null,this._frameBufferCube=h(this._frameBufferCube),this._vao=h(this._vao),this._noiseTexture=a(this._noiseTexture)}_ensureNoiseTexture(){return n(this._noiseTexture)&&(this._noiseTexture=new S(this.rctx,this.view),this._noiseTexture.render(this.rctx)),this._noiseTexture}get frameBufferCube(){if(n(this._frameBufferCube)){const e={target:z.TEXTURE_CUBE_MAP,pixelFormat:M.RGBA,dataType:j.UNSIGNED_BYTE,wrapMode:C.CLAMP_TO_EDGE,samplingMode:U.LINEAR,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new q(this.rctx,{colorTarget:E.CUBEMAP,width:this._cubeMapSize,height:this._cubeMapSize},e)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}applyPreset(e,t){const i=e.median,s=e=>{const s=r(e[0],e[1],i);return t<.5?r(e[0],s,2*t):r(s,e[1],2*(t-.5))};this.coverage=s(e.coverage),this.density=s(e.density),this.absorption=s(e.absorption),this.cloudSize=s(e.cloudSize),this.detailSize=s(e.detailSize),this.smoothness=s(e.smoothness),this.cloudHeight=s(e.cloudHeight),this.raymarchingStepType=e.raymarchingStepType}setDirty(){this.running=!0}runTask(e){if(0===this.coverage||n(this._vao))return void(this.running=!1);const t=this._ensureNoiseTexture().textureAtlas;if(n(t))return void(this.running=!1);const i=this.rctx.getViewport();this.rctx.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),this.rctx.bindFramebuffer(this.frameBufferCube);const s=this._getTechnique(this.raymarchingStepType),o=this.rctx.useTechnique(s),h=1+this.absorption,a=r(35,120,this.absorption);o.bindTexture(t,"cloudShapeTexture"),o.setUniform1f("cloudRadius",this._cloudRadius),o.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),o.setUniform1f("power",a),o.setUniform1f("sigmaE",h),o.setUniform1f("density",r(0,.3,this.density)),o.setUniform1f("cloudSize",r(0,.02,Math.max(.01,1-this.cloudSize))),o.setUniform1f("detailSize",r(0,.2,Math.max(.01,1-this.detailSize))),o.setUniform1f("smoothness",r(0,.5,1-this.smoothness)),o.setUniform1f("cloudHeight",r(0,1500,this.cloudHeight)),o.setUniform1f("coverage",this.coverage),this.rctx.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao);for(let r=0;r<5;r++){const e=A[r],t=B[r];f(this._viewMatrix,k,e,t),m(this._viewMatrix3,this._viewMatrix),o.setUniformMatrix3fv("view",this._viewMatrix3);const i=z.TEXTURE_CUBE_MAP_POSITIVE_X+r;this.frameBufferCube.setColorTextureTarget(i),this.rctx.gl.drawArrays(this.rctx.gl.TRIANGLE_STRIP,0,4),this.rctx.gl.flush()}this.running=!1,this.rctx.setViewport(i.x,i.y,i.width,i.height),this.requestRender(),e.madeProgress()}};e([u({constructOnly:!0})],R.prototype,"rctx",void 0),e([u({constructOnly:!0})],R.prototype,"view",void 0),e([u({constructOnly:!0})],R.prototype,"requestRender",void 0),e([u()],R.prototype,"_frameTask",void 0),e([u()],R.prototype,"coverage",void 0),e([u()],R.prototype,"density",void 0),e([u()],R.prototype,"absorption",void 0),e([u()],R.prototype,"cloudSize",void 0),e([u()],R.prototype,"detailSize",void 0),e([u()],R.prototype,"smoothness",void 0),e([u()],R.prototype,"cloudHeight",void 0),e([u()],R.prototype,"raymarchingStepType",void 0),e([u()],R.prototype,"running",void 0),R=e([p("esri.views.3d.environment.CloudsGenerator")],R);const A=[_(1,0,0),_(-1,0,0),_(0,1,0),_(0,-1,0),_(0,0,1)],B=[_(0,1,0),_(0,1,0),_(0,0,-1),_(0,0,1),_(0,1,0)],k=g(),H=v.sunny;export{R as CloudsGenerator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{smoothstep as e,lerp as t}from"../../../core/mathUtils.js";import{isNone as i,releaseMaybe as
|
|
5
|
+
import{smoothstep as e,lerp as t}from"../../../core/mathUtils.js";import{isNone as i,releaseMaybe as s,disposeMaybe as r}from"../../../core/maybe.js";import{a}from"../../../chunks/mat4.js";import{c as h}from"../../../chunks/mat4f64.js";import{s as n}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{l as c}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as u}from"../../../geometry/projectionEllipsoid.js";import{atmosphereHeight as _}from"./atmosphereUtils.js";import{FogTechniqueConfiguration as f,FogTechnique as m}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";import{Pos2Tex as d}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as p}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as l}from"../../webgl/enums.js";class v{constructor(e,t){this._projectionInverse=h(),this._viewInverse=h(),this._nearFar=o(),this._darkenHaze=!1,this._hazeMultiplier=1,this._foggyFadeStart=.3,this._foggyFadeEnd=.6,this._hazeFadeStart=.7,this._hazeFadeEnd=1,this._hazeFadeBuffer=500,this._strength=4e-6,this._view=t;const i=e.renderContext.rctx;this._vao=p(i,d),this._shaderTechniqueRepository=e.shaderTechniqueRep;const s=u(t.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+_}set strength(e){this._strength=e}get strength(){return this._strength}get foggyWeatherTechnique(){if(i(this._foggyWeatherTechnique)){const e=new f;e.haze=!1,this._foggyWeatherTechnique=this._shaderTechniqueRepository.acquire(m,e)}return this._foggyWeatherTechnique}get distanceFogTechnique(){if(i(this._distanceFogTechnique)){const e=new f;e.haze=!0,this._distanceFogTechnique=this._shaderTechniqueRepository.acquire(m,e)}return this._distanceFogTechnique}destroy(){this._distanceFogTechnique=s(this._distanceFogTechnique),this._foggyWeatherTechnique=s(this._foggyWeatherTechnique),this._vao=r(this._vao)}when(){return Promise.resolve()}render(e,t,i){if(0===this._view.basemapTerrain.baseOpacity&&!t)return;if(this._darkenHaze=i,this._update(e.camera,t),this._fogAmount<=0)return;const s=e.offscreenRenderingHelper,r=t?this.foggyWeatherTechnique:this.distanceFogTechnique,a=e.rctx.useTechnique(r);s.renderDepthDetached((()=>{a.bindTexture(s.depthTexture,"depthTex"),this._renderFog(r.program,e)}))}_renderFog(e,t){if(i(this._vao))return!1;const s=t.rctx;return t.scenelightingData.setLightDirectionUniform(e),e.setUniform3fv("cameraPosition",t.camera.eye),e.setUniformMatrix4fv("inverseProjectionMatrix",this._projectionInverse),e.setUniformMatrix4fv("inverseViewMatrix",this._viewInverse),e.setUniform2fv("nearFar",this._nearFar),e.setUniform1f("atmosphereC",this._atmosphereC),e.setUniform1f("fogStrength",this._strength),e.setUniform1f("fogAmount",this._hazeMultiplier*this._fogAmount),s.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(l.TRIANGLE_STRIP,0,4),!0}_update(s,r){if(i(s))return;a(this._projectionInverse,s.projectionMatrix),a(this._viewInverse,s.viewMatrix),n(this._nearFar,s.near,s.far);const h=c(s.eye),o=h*h;this._atmosphereC=o-this._atmosphereRadius*this._atmosphereRadius,this._fogAmount=r?1-e(this._foggyFadeStart*g,this._foggyFadeEnd*g,Math.abs(h-this._planetRadius)):1-e(this._hazeFadeStart*g,this._hazeFadeEnd*g,Math.abs(h-this._planetRadius)),this._hazeMultiplier=this._darkenHaze?t(.4,1,e(g-this._hazeFadeBuffer,g+this._hazeFadeBuffer,Math.abs(h-this._planetRadius))):1}static isSupported(e){return e.capabilities.depthTexture}}export{v as Fog};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i,isNone as r}from"../../../core/maybe.js";import{NoiseTextureAtlasTechnique as s}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as o}from"../webgl-engine/lib/glUtil3D.js";import{TargetType as a,TextureType as h,PixelFormat as f,PixelType as m,TextureWrapMode as n,TextureSamplingMode as
|
|
5
|
+
import e from"../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i,isNone as r}from"../../../core/maybe.js";import{NoiseTextureAtlasTechnique as s}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as o}from"../webgl-engine/lib/glUtil3D.js";import{TargetType as a,TextureType as h,PixelFormat as f,PixelType as m,TextureWrapMode as n,TextureSamplingMode as u}from"../../webgl/enums.js";import{FramebufferObject as l}from"../../webgl/FramebufferObject.js";const c=e("esri-mobile")?64:128,_=c/128,g=Math.ceil(Math.sqrt(c)),p=(c+2)*g;class w{constructor(e,t){this._frameBuffer=new l(e,{colorTarget:a.TEXTURE,width:p,height:p},{target:h.TEXTURE_2D,pixelFormat:f.RGBA,dataType:m.UNSIGNED_BYTE,wrapMode:n.CLAMP_TO_EDGE,samplingMode:u.LINEAR,hasMipmap:!1,width:p,height:p}),this._vao=o(e),this._technique=new s({rctx:e,viewingMode:t.state.viewingMode},null)}get textureAtlas(){return this._frameBuffer.colorTexture}destroy(){this._technique=t(this._technique),this._frameBuffer=i(this._frameBuffer),this._vao=i(this._vao)}render(e){if(r(this._vao)||r(this.textureAtlas))return;const t=e.getViewport();e.setViewport(0,0,p,p),e.bindFramebuffer(this._frameBuffer);const i=e.useTechnique(this._technique);i.setUniform1f("tileSize",c),i.setUniform1f("tileRows",g),e.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),e.gl.drawArrays(e.gl.TRIANGLE_STRIP,0,4),e.setViewport(t.x,t.y,t.width,t.height)}}export{p as ATLAS_SIZE,w as NoiseTextureAtlas,_ as TEXTURE_SCALE,g as TILE_ROWS,c as TILE_SIZE};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,isAbortError as i}from"../../../core/promiseUtils.js";import{c as s}from"../../../chunks/mat4.js";import{c as n}from"../../../chunks/mat4f64.js";import{requestImage as a}from"../../../support/requestImageUtils.js";import{S as m}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechniqueConfiguration as l,SimpleAtmosphereTechnique as
|
|
5
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,isAbortError as i}from"../../../core/promiseUtils.js";import{c as s}from"../../../chunks/mat4.js";import{c as n}from"../../../chunks/mat4f64.js";import{requestImage as a}from"../../../support/requestImageUtils.js";import{S as m}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechniqueConfiguration as l,SimpleAtmosphereTechnique as c}from"./SimpleAtmosphereTechnique.js";import h from"./resources/SimpleAtmosphereTexture.js";import{glLayout as u}from"../support/buffer/glUtil.js";import{newLayout as p}from"../support/buffer/InterleavedLayout.js";import{bindProjectionMatrix as f}from"../webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Default3D as g}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import _ from"../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as d}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{PixelFormat as y,PixelType as j,TextureWrapMode as x,TextureSamplingMode as v,PrimitiveType as w,Usage as A}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as T}from"../../webgl/Util.js";import{VertexArrayObject as R}from"../../webgl/VertexArrayObject.js";const q=e.getLogger("esri.views.3d.environment.PanoramicAtmosphere");class I{constructor(){this.type="panoramic",this._techniqueConfig=new l,this._readyResolver=o(),this._readyController=new AbortController}destroy(){this._readyResolver.reject(),this._texture=t(this._texture),this._vao=t(this._vao),this._readyController=r(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(e){this._techniqueConfig.geometry=m.Cylinder,this._technique=e.shaderTechniqueRep.acquire(c,this._techniqueConfig);const t=e.renderContext.rctx;this._vao=this._createVertexArrayObject(t),this._vaoCount=T(this._vao,"geometry"),a(h,{signal:this._readyController.signal}).then((r=>{this._texture=new C(t,{pixelFormat:y.RGBA,dataType:j.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:v.LINEAR,flipped:!0},r),e.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((e=>{i(e)||q.error("Unable to initialize atmosphere: image request failed",e),this._readyResolver.reject()}))}get canRender(){return null!=this._texture}render(e){const t=e.rctx,r=t.useTechnique(this._technique);r.bindTexture(this._texture,"tex"),f(r,e.camera.projectionMatrix),O(S,e.camera.viewMatrix),r.setUniformMatrix4fv("view",S),r.setUniform4f("uColor",1,1,1,1),e.scenelightingData.setLightDirectionUniform(r),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(w.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=_.createPolySphereGeometry(1,2,!1),r=t.indices.get(d.POSITION);for(let n=0;n<r.length;n+=3){const e=r[n];r[n]=r[n+2],r[n+2]=e}const o=t.vertexAttributes.get(d.POSITION).data,i=L.createBuffer(r.length),s=i.position;for(let n=0;n<r.length;++n){const e=3*r[n];s.set(n,0,o[e]),s.set(n,1,o[e+1]),s.set(n,2,o[e+2])}return new R(e,g,{geometry:u(L)},{geometry:b.createVertex(e,A.STATIC_DRAW,i.buffer)})}}function O(e,t){s(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const S=n(),L=p().vec3f(d.POSITION);export{I as PanoramicAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t,disposeMaybe as r,isSome as i}from"../../../core/maybe.js";import{secondsFromMilliseconds as s}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t,disposeMaybe as r,isSome as i}from"../../../core/maybe.js";import{secondsFromMilliseconds as s}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as a}from"../../../geometry/projectionEllipsoid.js";import{P as c}from"../../../chunks/Precipitation.glsl.js";import{PrecipitationTechniqueConfiguration as h,PrecipitationTechnique as u}from"./PrecipitationTechnique.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as m}from"../support/buffer/InterleavedLayout.js";import{AnimationTimer as _}from"../webgl-engine/lib/AnimationTimer.js";import{VertexAttribute as d}from"../webgl-engine/lib/VertexAttribute.js";import{WatchUpdatingTracking as f}from"../../support/WatchUpdatingTracking.js";import{BufferObject as T}from"../../webgl/BufferObject.js";import{PrimitiveType as l,Usage as g}from"../../webgl/enums.js";import{bindVertexBufferLayout as y,unbindVertexBufferLayout as b}from"../../webgl/Util.js";import{VertexArrayObject as j}from"../../webgl/VertexArrayObject.js";let w=class{constructor(e,t){this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._renderParameters={camera:null,time:0,radius:1},this._animation=new _,this._updatingTracking=new f,this._renderParameters.time=0,this._renderParameters.radius=a(t.spatialReference).radius,this._shaderTechniqueRepository=e.shaderTechniqueRep}get updating(){return this._updatingTracking.updating}get rainTechnique(){if(t(this._rainTechnique)){const e=new h;e.type=c.RAIN,this._rainTechnique=this._shaderTechniqueRepository.acquire(u,e)}return this._rainTechnique}get snowTechnique(){if(t(this._snowTechnique)){const e=new h;e.type=c.SNOW,this._snowTechnique=this._shaderTechniqueRepository.acquire(u,e)}return this._snowTechnique}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechnique=r(this._snowTechnique),this._rainTechnique=r(this._rainTechnique),this._vao=r(this._vao),this._instanceIdBuffer=r(this._instanceIdBuffer)}update(e){return this._animation.advance(e)}render(e,r,i){const{rctx:n,camera:o}=e;this._ensureResources(n);const a=i===c.RAIN?this.rainTechnique:this.snowTechnique;if(t(a)||t(this._vao)||t(this._instanceIdBuffer))return;const h=n.useTechnique(a);this._renderParameters.camera=o,this._renderParameters.time=(i===c.RAIN?this._rainSpeed:this._snowSpeed)*s(this._animation.time),a.bindPass(this._renderParameters),n.bindVAO(this._vao);const p=u.attributeLocation;h.assertCompatibleVertexAttributeLocations(this._vao),y(n,p,this._instanceIdBuffer,I,0),n.capabilities.instancing.drawArraysInstanced(l.TRIANGLES,0,3,this._numParticles*r),b(n,p,this._instanceIdBuffer,I)}_ensureResources(e){i(this._vao)||(this._vao=this._createVertexArrayObject(e),i(this._instanceIdBuffer)||(this._instanceIdBuffer=this._createInstanceIndices(e)))}_createInstanceIndices(e){const t=[];for(let r=0;r<this._numParticles;r++)t.push(r);return T.createVertex(e,g.STATIC_DRAW,new Float32Array(t))}_createVertexArrayObject(e){const t=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new j(e,u.attributeLocation,{geometry:p(q)},{geometry:T.createVertex(e,g.STATIC_DRAW,t)})}};e([n({constructOnly:!0})],w.prototype,"requestRender",void 0),e([n({readOnly:!0})],w.prototype,"updating",null),e([n()],w.prototype,"_updatingTracking",void 0),w=e([o("esri.views.3d.environment.Precipitation")],w);const q=m().vec3f(d.POSITION),I=p(m().f32(d.INSTANCEFEATUREATTRIBUTE),1);export{w as Precipitation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as o,isNone as a}from"../../../core/maybe.js";import{createResolver as n,isAbortError as h}from"../../../core/promiseUtils.js";import{init as
|
|
5
|
+
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as o,isNone as a}from"../../../core/maybe.js";import{createResolver as n,isAbortError as h}from"../../../core/promiseUtils.js";import{init as c}from"../../../core/watchUtils.js";import{n as l}from"../../../chunks/mat4.js";import{c as m}from"../../../chunks/mat4f64.js";import{s as d}from"../../../chunks/vec2.js";import{a as u}from"../../../chunks/vec2f64.js";import{l as p,a as f,b as _,i as g,c as R,p as x}from"../../../chunks/vec3.js";import{c as V}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as j}from"../../../geometry/projectionEllipsoid.js";import{isMars as C}from"../../../geometry/support/spatialReferenceUtils.js";import{requestImage as y}from"../../../support/requestImageUtils.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as b}from"./atmosphereUtils.js";import{S as A}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechniqueConfiguration as T,SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import D from"./resources/MarsAtmosphereTexture.js";import q from"./resources/SimpleAtmosphereTexture.js";import{makePiecewiseLinearFunction as U}from"../support/mathUtils.js";import{glLayout as S}from"../support/buffer/glUtil.js";import{newLayout as F}from"../support/buffer/InterleavedLayout.js";import{Default3D as M}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as I}from"../webgl-engine/lib/glUtil3D.js";import{project as L}from"../webgl-engine/lib/Util.js";import{VertexAttribute as O}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as E}from"../../webgl/BufferObject.js";import{PixelFormat as W,PixelType as k,TextureWrapMode as N,TextureSamplingMode as G,PrimitiveType as B,Usage as H}from"../../webgl/enums.js";import{Texture as P}from"../../webgl/Texture.js";import{vertexCount as z}from"../../webgl/Util.js";import{VertexArrayObject as Y}from"../../webgl/VertexArrayObject.js";const J=e.getLogger("esri.views.3d.environment.SimpleAtmosphere"),K=128,Q=-b,X=0,Z=50,$=()=>1-511/512,ee=U([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class te{constructor(e){this.view=e,this.type="simple",this._renderData={texV:u(),silCircleCenter:V(),silCircleV1:V(),silCircleV2:V(),altitudeFade:0,innerScale:0,undergroundFadeAlpha:0},this._fadeVaoCount=0,this._readyResolver=n(),this._readyController=new AbortController,this.texV1=1,this.canRender=!0,this.isOnMars=C(e.spatialReference);const t=j(e.spatialReference);this.planetRadius=t.radius,this.outerRimWidth=t.outerAtmosphereRimWidth,this.innerRimFactor=(this.planetRadius+Q)/this.planetRadius,this.middleRimFactor=(this.planetRadius+X)/this.planetRadius,this.outerRimFactor=(this.planetRadius+this.outerRimWidth)/this.planetRadius,this.texV0=X/this.outerRimWidth,this.texVScale=this.texV1-this.texV0}destroy(){this._readyResolver.reject(),this._cameraChangeHandle=i(this._cameraChangeHandle),this._texture=s(this._texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao),this._readyController=o(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(e){this._shaderTechniqueRepository=e.shaderTechniqueRep;const t=e.renderContext.rctx;this._cameraChangeHandle=c(this.view,"state.camera",(()=>e.requestRender()),!0),this._vao=this._createRibbon(t),this._vaoCount=z(this._vao,"geometry"),this._fadeVao=I(t),this._fadeVaoCount=z(this._fadeVao,"geometry"),y(this.isOnMars?D:q,{signal:this._readyController.signal}).then((r=>{this._texture=new P(t,{pixelFormat:W.RGBA,dataType:k.UNSIGNED_BYTE,wrapMode:N.CLAMP_TO_EDGE,samplingMode:G.LINEAR,flipped:!0},r),e.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((e=>{h(e)||J.error("Unable to initialize simple atmosphere: image request failed",e),this._readyResolver.reject(e)}))}get coneTechnique(){if(a(this._coneTechnique)){const e=new T;e.geometry=A.Cone,this._coneTechnique=this._shaderTechniqueRepository.acquire(w,e)}return this._coneTechnique}get undergroundTechnique(){if(a(this._undergroundTechnique)){const e=new T;e.geometry=A.Underground,this._undergroundTechnique=this._shaderTechniqueRepository.acquire(w,e)}return this._undergroundTechnique}render(e){this._update(e.camera);const t=e.rctx;if(this._renderData.undergroundFadeAlpha<1){const r=t.useTechnique(this.coneTechnique);r.setUniformMatrix4fv("proj",e.camera.projectionMatrix),r.setUniformMatrix4fv("view",e.camera.viewMatrix),r.setUniform3fv("silCircleCenter",this._renderData.silCircleCenter),r.setUniform3fv("silCircleV1",this._renderData.silCircleV1),r.setUniform3fv("silCircleV2",this._renderData.silCircleV2),r.setUniform2fv("texV",this._renderData.texV),r.bindTexture(this._texture,"tex"),e.scenelightingData.setLightDirectionUniform(r),r.setUniform1f("altitudeFade",this._renderData.altitudeFade),r.setUniform1f("innerScale",this._renderData.innerScale),t.bindVAO(this._vao),t.drawArrays(B.TRIANGLES,0,this._vaoCount)}if(this._renderData.undergroundFadeAlpha>0){const r=t.useTechnique(this.undergroundTechnique);r.setUniform1f("undergroundFadeAlpha",this._renderData.undergroundFadeAlpha),e.scenelightingData.setLightDirectionUniform(r),r.setUniform3fv("cameraPosition",e.camera.eye),t.bindVAO(this._fadeVao),t.drawArrays(B.TRIANGLE_STRIP,0,this._fadeVaoCount)}}renderHaze(){return!1}_update(e){const i=V(),s=this.planetRadius,o=p(e.eye),a=o-s;if(a<0){const e=Math.min(-a/5e3,1);this._renderData.undergroundFadeAlpha=e}else this._renderData.undergroundFadeAlpha=0;const n=Math.max(Z,a),h=s+Q;this._renderData.innerScale=ae(s+n,s,h)-1,this._renderData.altitudeFade=v(a),f(i,e.eye,(s+Z)/o),re(i,e.center,e.up,s,this._renderData);const c=this._computeScreenRimWidth(e,i,e.up,this._renderData),l=$(),m=ee(a);let u=this.texV0+l*this.texVScale,_=this.texV0+c*m*this.texVScale;if(a>Z){re(e.eye,e.center,e.up,s,this._renderData);const i=this._computeScreenRimWidth(e,e.eye,e.up,this._renderData),o=r((i-1.5)/(c-1.5),0,1);u=this.texV0+o*l*this.texVScale,_=this.texV0+t(this.texV1,c*m,o)*this.texVScale}d(this._renderData.texV,u,_)}_createRibbon(e){const t=new Float32Array(3+3*K*3),r=new Uint32Array(3*K*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<K;o++){const e=9*o+3;t[e+0]=o,t[e+1]=this.innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this.middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this.outerRimFactor,t[e+8]=1;const i=3*o+1,s=o===K-1?1:i+3,a=15*o;r[a+0]=i,r[a+1]=i+1,r[a+2]=s+1,r[a+3]=s+1,r[a+4]=s,r[a+5]=i,r[a+6]=i+1,r[a+7]=i+2,r[a+8]=s+2,r[a+9]=s+2,r[a+10]=s+1,r[a+11]=i+1,r[a+12]=i,r[a+13]=s,r[a+14]=0}const i=ne.createBuffer(r.length),s=i.position;for(let o=0;o<r.length;++o){const e=3*r[o];s.set(o,0,t[e]),s.set(o,1,t[e+1]),s.set(o,2,t[e+2])}return new Y(e,M,{geometry:S(ne)},{geometry:E.createVertex(e,H.STATIC_DRAW,i.buffer)})}_computeScreenRimWidth(e,t,r,i){return _(se,i.silCircleCenter,i.silCircleV2),f(oe,se,this.outerRimFactor),l(ie,t,se,r),L(se,ie,e.projectionMatrix,e.viewport),L(oe,ie,e.projectionMatrix,e.viewport),g(se,oe)/e.height}}function re(e,t,r,i,s){const o=p(e),a=i*Math.sqrt(o*o-i*i)/o,n=Math.sqrt(i*i-a*a),h=s.silCircleV1,c=s.silCircleV2;return f(s.silCircleCenter,e,n/o),R(h,e,t),x(h)<1&&R(h,e,r),f(h,h,a/p(h)),R(c,h,e),f(c,c,a/p(c)),a}const ie=m(),se=V(),oe=V();function ae(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const ne=F().vec3f(O.POSITION);export{te as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import r from"../../../core/Accessor.js";import s from"../../../core/Error.js";import
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{fetchAsset as e}from"../../../assets.js";import r from"../../../core/Accessor.js";import s from"../../../core/Error.js";import a from"../../../core/Logger.js";import{isSome as i,abortMaybe as o,disposeMaybe as n,isNone as c}from"../../../core/maybe.js";import{createTask as f,isAbortError as u}from"../../../core/promiseUtils.js";import{initial as h}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{c as p,g as l,m as g}from"../../../chunks/mat4.js";import{c as _,f as b}from"../../../chunks/mat4f64.js";import{StarsTechnique as v}from"./StarsTechnique.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as j}from"../support/buffer/InterleavedLayout.js";import{Default3D as w}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexAttribute as T}from"../webgl-engine/lib/VertexAttribute.js";import{WatchUpdatingTracking as k}from"../../support/WatchUpdatingTracking.js";import{BufferObject as D}from"../../webgl/BufferObject.js";import{PrimitiveType as P,Usage as x}from"../../webgl/enums.js";import{VertexArrayObject as A}from"../../webgl/VertexArrayObject.js";const O=a.getLogger("esri.views.3d.environment.Stars");let S=class extends r{constructor(t){super(t),this._loadDataTask=null,this._numPoints=0,this._renderParameter={camera:null,modelMatrix:_()},this._updatingTracking=new k}get updating(){return this._updatingTracking.updating||this.loading}get loading(){return i(this._loadDataTask)&&!this._loadDataTask.finished}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=o(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=n(this._technique),this._vao=n(this._vao)}render(t){const{rctx:e,camera:r}=t;if(this._ensureResources(e),c(this._technique)||c(this._vao))return;const s=e.useTechnique(this._technique);this._renderParameter.camera=r,this._technique.bindPass(this._renderParameter),e.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),e.drawArrays(P.POINTS,0,this._numPoints)}_ensureResources(t){if(i(this._technique)||c(U))return;this._technique=new v({rctx:t,viewingMode:this.view.state.viewingMode},null),this._numPoints=U.byteLength/L;const e=new Float32Array(U,0,2*this._numPoints),r=new Uint8Array(U,2*this._numPoints*4,this._numPoints);this._vao=this._createVertexArrayObject(t,e,r,this._numPoints),this._updatingTracking.add((()=>{var t,e,r;return null==(t=this.view)||null==(e=t.environment)||null==(r=e.lighting)?void 0:r.date}),(t=>this._update(t)),h)}_computeDayDuration(t){const e=t,r=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+r)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+r)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,r=2*this._computeDayDuration(t),s=this._renderParameter.modelMatrix;p(s,I),l(s,s,-r*Math.PI),g(s,M,s),l(s,s,-e*Math.PI),this.requestRender()}_hexToRGB(t){return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}_unpackUint8Attributes(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}_createVertexArrayObject(t,e,r,s){const a=R.createBuffer(s),i=a.position,o=a.color,n=a.size;for(let c=0;c<s;c++){const t=e[2*c+0],s=e[2*c+1];i.set(c,0,-Math.cos(t)*Math.sin(s)),i.set(c,1,-Math.sin(t)*Math.sin(s)),i.set(c,2,-Math.cos(s));const a=this._unpackUint8Attributes(r[c]),f=this._hexToRGB(q[a[1]]);o.set(c,0,255*f[0]),o.set(c,1,255*f[1]),o.set(c,2,255*f[2]),o.set(c,3,255),n.set(c,a[0])}return new A(t,w,{geometry:y(R)},{geometry:D.createVertex(t,x.STATIC_DRAW,a.buffer)})}_createLoadDataTask(){if(i(U))return null;const t=f((async t=>{const{data:r}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});this._verifyStarData(r),U=r}));return t.promise.catch((t=>{u(t)||O.error(t)})).then((()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))})),t}_verifyStarData(t){if(!t)throw new s("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/L;if(e%1!=0||e>5e4||e<5e3)throw new s("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}};t([d({constructOnly:!0})],S.prototype,"view",void 0),t([d({constructOnly:!0})],S.prototype,"requestRender",void 0),t([d({readOnly:!0})],S.prototype,"updating",null),t([d()],S.prototype,"_loadDataTask",void 0),t([d()],S.prototype,"_updatingTracking",void 0),S=t([m("esri.views.3d.environment.Stars")],S);const q=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],M=b(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),I=b(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),L=9,R=j().vec3f(T.POSITION).vec4u8(T.COLOR).f32(T.SIZE);let U=null;export{S as Stars};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as _}from"../../../core/maybe.js";import m from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as N,g as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as A,localLinearScaleFactors as P,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as _e}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as me,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,createTexture as ve,configureMaterial as Me}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Ce,NodeState as xe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Oe,getLocalOrigin as Se}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ee,checkSceneLayerValid as je,checkSceneLayerCompatibleWithView as we,getCacheKeySuffix as Ne,whenGraphicAttributes as De,computeVisibilityObb as Re,filterInPlace as Te,getCachedAttributeValue as Fe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Pe,addWraparound as Ve,getSymbolInfo as Ue,transparentEdgeMaterial as He,getClipRect as Ge}from"./i3s/I3SUtil.js";import{IDBCache as Le}from"./i3s/IDBCache.js";import{attributeLookup as Be}from"./support/attributeUtils.js";import{ColorMixModeEnum as ke}from"./support/symbolColorUtils.js";import qe from"../support/debugFlags.js";import{toBoundingRect as ze}from"../support/extentUtils.js";import{create as Ke,clone as We}from"../support/orientedBoundingBox.js";import{updatingProgress as $e}from"../support/updatingProperties.js";import{glLayout as Xe}from"../support/buffer/glUtil.js";import{State as Ye}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Qe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Je}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as Ze}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as et}from"../webgl-engine/lib/edgeRendering/interfaces.js";const tt=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),it=[1,1,1,1];class st extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var rt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(rt||(rt={}));const ot=19,at=100*s.MEGABYTES,nt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new Le("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new me(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ee(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new _e(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),je(this.i3slayer),we(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(qe,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&qe.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||qe.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(qe,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=Ne(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>tt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new m:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Ce.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!qe.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&Ze()}_getVertexBufferLayout(e,t){const i={hasTexture:gt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Xe(Qe(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Be(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Be(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return De(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ot}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)}));return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=bt(s.transformedGeometry,s.textureData),s.textureData.every(ft)&&yt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>tt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return pt(t)?this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Oe(e.mbs,this.elevationOffset,l,d);e.geometryObb=Ke([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.prototype.slice.call(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:bt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&yt(e,_)){const t=h(_.textureData)?_.textureData.map((e=>ft(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>tt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Re(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Se(o,a,n),u=Oe(o,a,n,d),_=A(n,l),m=A(l,d);if(c(_)||c(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=We(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Ye.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:a,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&l.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await Ze(),e.memory=0;const{componentOffsets:d,geometries:u,featureIds:m}=r,g=this._collection,p=u[0],{layout:f,indices:b,interleavedVertexData:y,positionData:I,hasColors:v}=a,M=this._materialParameters(p,f),C=d||new Uint32Array([0,b?b.length:y.byteLength/f[0].stride]),N={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:M.geometryParams},positionData:{positions:I.data,indices:I.indices},indices:b,componentOffsets:C},D=p.transformation?j(p.transformation):w();S(D,n,D);const T=E(R(),D),F=x(O(),D),A=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,H=R(),G=[1,1,1];P(T,A,G,U)||tt.errorOnce("Unsupported coordinate system for IM overlay"),V(T,A,H,U);const L=g.createObject({toMapSpace:[H[0],H[1],G[0],G[1]],geometry:N,obb:_(e.geometryObb),transform:{position:T,rotationScale:F}}),B=M.geometryParams.textureCoordinates===Je.Atlas,{textures:k,texturePromise:q}=this._initMaterialAndTextures(L,M.material,l,B);e.memory+=this._memEstimateGeometryAdded(L),e.memory+=k.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const z=!!M.material.hasParametersFromSource,K="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,W=new st(e,m,L,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:z,isOpaque:K},k);s.meta=W,!this._hasTextures&&t.requiredTextures.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||v,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const $=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(W),q]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(W.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,W),this._addNodeMeta(e.index,W),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(L,Ye.Visible),h(t)&&t.updateObjectVisibility(W.objectHandle,!0),W.attributeInfo=i.attributeInfo;const s=W.cachedRendererVersion!==this._rendererVersion,r=$!==this.slicePlaneEnabled;this._setObjectSymbolColors(W);const o=this._applyFiltersToNode(W);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering(W),this._visibleGeometryChanged(W),this._highlights.objectCreated(W),this._updateMaterial(W),this._setNewNodeOpacity(W),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){tt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Mt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=e.params.material,s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=gt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>ve(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Me(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Je.Atlas:Je.Default:Je.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=ze(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Te(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Fe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,mt,this.view.renderSpatialReference),Ae(t,mt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,lt),B(lt,dt),q(i,dt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Pe.INSIDE)return;if(r===Pe.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ht,i,t.objectHandle);Te(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Mt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Ye.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===xe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ve(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ve(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ve(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:tt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&tt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<rt.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<rt.CastShadows),i.pickable=0!=(t[s+4]&1<<rt.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ue(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:ut,castShadows:!0,pickable:!0,colorMixMode:ke.Multiply,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=et.OPAQUE,p=He,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Fe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=ut,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,it,ut):de(u,y,null,null,it,ut)}if(c(u)&&(u=ut,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:ke.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?et.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===ke.Replace)?et.OPAQUE:et.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=He;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<rt.CastShadows|+d.pickable<<rt.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Mt(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==He)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?He:(s=s||t!==He,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Mt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Pe.OUTSIDE)return re.CONTINUE;if(i===Pe.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Ge(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Fe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Be(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return vt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Mt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=It(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==Ce.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M($e)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},lt=H(),dt=k(),ht=k(),ct=Ke(),ut=[0,0,0,0],_t=new t([0,0,0,0]),mt=[0,0,0,0];function gt(e){const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function pt(e){return"geometryData"in e}function ft(e){return h(e)&&y(e.data)}function bt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function yt(e,t){return t.byteSize>at?(tt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function It(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=ct,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const vt={remove(){},pause(){},resume(){}};function Mt(e,t){e.forEach((e=>e.opacity=t))}export{nt as I3SMeshView3D};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as N,g as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as P,localLinearScaleFactors as A,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as me}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as _e,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,defaultMaterial as ve,createTexture as Me,configureMaterial as Ce}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as xe,NodeState as Oe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Se,getLocalOrigin as Ee}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as je,checkSceneLayerValid as we,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as De,whenGraphicAttributes as Re,computeVisibilityObb as Te,filterInPlace as Fe,getCachedAttributeValue as Pe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Ve,addWraparound as Ue,getSymbolInfo as He,transparentEdgeMaterial as Ge,getClipRect as Le}from"./i3s/I3SUtil.js";import{IDBCache as Be}from"./i3s/IDBCache.js";import{attributeLookup as ke}from"./support/attributeUtils.js";import{ColorMixModeEnum as qe}from"./support/symbolColorUtils.js";import ze from"../support/debugFlags.js";import{toBoundingRect as Ke}from"../support/extentUtils.js";import{create as We,clone as $e}from"../support/orientedBoundingBox.js";import{updatingProgress as Xe}from"../support/updatingProperties.js";import{glLayout as Ye}from"../support/buffer/glUtil.js";import{State as Qe}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Ze}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as et}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as tt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const it=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),st=[1,1,1,1];class rt extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ot;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ot||(ot={}));const at=19,nt=100*s.MEGABYTES,lt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new Be("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new _e(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return je(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new me(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),we(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(ze,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ze.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ze.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(ze,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=De(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>it.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==xe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ze.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&et()}_getVertexBufferLayout(e,t){const i={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ye(Je(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=ke(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ke(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Re(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${at}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=yt(s.transformedGeometry,s.textureData),s.textureData.every(bt)&&It(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>it.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return ft(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Se(e.mbs,this.elevationOffset,l,d);e.geometryObb=We([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.prototype.slice.call(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:yt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&It(e,m)){const t=h(m.textureData)?m.textureData.map((e=>bt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>it.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Te(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ee(o,a,n),u=Se(o,a,n,d),m=P(n,l),_=P(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=$e(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Qe.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await et(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),N=u||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),D={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:N},T=f.transformation?j(f.transformation):w();S(T,l,T);const F=E(R(),T),P=x(O(),T),U=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,G=R(),L=[1,1,1];A(F,U,L,H)||it.errorOnce("Unsupported coordinate system for IM overlay"),V(F,U,G,H);const B=p.createObject({toMapSpace:[G[0],G[1],L[0],L[1]],geometry:D,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),k=C.geometryParams.textureCoordinates===Ze.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(B,C.material,d,k);e.memory+=this._memEstimateGeometryAdded(B),e.memory+=q.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!C.material.hasParametersFromSource,W="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,$=new rt(e,g,B,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);r.meta=$,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(h(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(B,Qe.Visible),h(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){it.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ct(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:ve(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=pt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Me(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ce(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Ze.Atlas:Ze.Default:Ze.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=Ke(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=Ke(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Fe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Pe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),Ae(t,gt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,dt),B(dt,ht),q(i,ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ve.INSIDE)return;if(r===Ve.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ct,i,t.objectHandle);Fe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Ct(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Qe.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Oe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ue(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ue(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ue(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:it.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&it.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<ot.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<ot.CastShadows),i.pickable=0!=(t[s+4]&1<<ot.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=He(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:mt,castShadows:!0,pickable:!0,colorMixMode:qe.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=tt.OPAQUE,p=Ge,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Pe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=mt,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,st,mt):de(u,y,null,null,st,mt)}if(c(u)&&(u=mt,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?tt.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===qe.Replace)?tt.OPAQUE:tt.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Ge;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ot.CastShadows|+d.pickable<<ot.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Ct(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ge)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ge:(s=s||t!==Ge,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Ct(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ve.OUTSIDE)return re.CONTINUE;if(i===Ve.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Le(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Pe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>ke(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Mt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Ct(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=vt(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==xe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Xe)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},dt=H(),ht=k(),ct=k(),ut=We(),mt=[0,0,0,0],_t=new t([0,0,0,0]),gt=[0,0,0,0];function pt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function ft(e){return"geometryData"in e}function bt(e){return h(e)&&y(e.data)}function yt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function It(e,t){return t.byteSize>nt?(it.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function vt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=ut,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Mt={remove(){},pause(){},resume(){}};function Ct(e,t){e.forEach((e=>e.opacity=t))}export{lt as I3SMeshView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeMaybe as e,isSome as s}from"../../../../core/maybe.js";import{addFrameTask as
|
|
5
|
+
import{removeMaybe as e,isSome as s,isNone as o}from"../../../../core/maybe.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{FadeDirection as i}from"../support/I3SLayerView.js";class t{constructor(){this.lodCrossfadeSignedDuration=0}}class a{constructor(e){this.view=e,this._preRenderFrameTaskHandle=null,this._currentFrameStartTime=null,this._numFadingNodes=0}get updating(){return this._numFadingNodes>0}stopNodeFading(s){null!=s.lodCrossfadeProgress&&(this._numFadingNodes--,s.lodCrossfadeProgress=null,0===this._numFadingNodes&&(null!=this._preRenderFrameTaskHandle&&(this._preRenderFrameTaskHandle=e(this._preRenderFrameTaskHandle)),this.view.notifyLODUpdate(),this.view.notifyUpdate()))}_startNodeFading(e,s,o){0===this._numFadingNodes&&(this._preRenderFrameTaskHandle=d({preRender:e=>this._updateAllNodeFading(e)}),this.view.notifyLODUpdate()),null==e.lodCrossfadeProgress&&(this._numFadingNodes++,this.view.notifyUpdate()),e.lodCrossfadeSignedDuration=o,e.lodCrossfadeProgress=s}_updateAllNodeFading(e){const o=this.view.nodeCrossfadingEnabled;this.view.foreachCrossfadeNode(((d,i)=>{if(s(i)&&s(i.lodCrossfadeProgress)){const s=i.lodCrossfadeSignedDuration,t=s>0?this.view.fullOpacity:0,a=e.deltaTime/s,r=i.lodCrossfadeProgress+Math.abs(a),n=!o||r>=1||0===s,l=t-(n?0:s>0?1:-1)*(1-r);n?(this.stopNodeFading(i),s<0&&this.view.markNodeToRemove(d)):i.lodCrossfadeProgress=r,this.view.setNodeOpacityByIndex(d,l)}})),this.view.removeMarkedNodes()}stopAllNodeFading(){this.view.foreachCrossfadeNode(((e,o)=>{if(s(o)&&s(o.lodCrossfadeProgress)){this.stopNodeFading(o);const s=o.lodCrossfadeSignedDuration;s<0&&this.view.markNodeToRemove(e);const d=s>0?this.view.fullOpacity:0;this.view.setNodeOpacityByIndex(e,d)}})),this.view.removeMarkedNodes()}fadeNode(e,s,o,d){null==this._currentFrameStartTime&&(this._currentFrameStartTime=Date.now());const t=this.view,a=t.nodeCrossfadingEnabled,n=o===i.FadeIn?t.fullOpacity:0,l=a?d?o===i.FadeIn?t.lodCrossfadeinDuration:t.lodCrossfadeoutDuration:t.lodCrossfadeUncoveredDuration:0,h=this.view.getNodeOpacityByIndex(e);if(a&&h!==n&&l>0){const e=1-Math.abs(n-h);this._startNodeFading(s,e,r(o)*l)}else this.stopNodeFading(s),this.view.setNodeOpacityByIndex(e,n),o===i.FadeOut&&this.view.removeNode(e)}isNodeFullyFadedIn(e){const s=this.view.getNodeCrossfadeMetaData(e);return o(s)||null==s.lodCrossfadeProgress&&this.view.getNodeOpacityByIndex(e)===this.view.fullOpacity}}function r(e){return e===i.FadeIn?1:-1}export{a as I3SCrossfadeHelper,t as NodeCrossfadeMetaData};
|