@arcgis/core 4.33.0-next.20250320 → 4.33.0-next.20250322
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/1034155c525d2b7baaa1.js +1 -0
- package/assets/esri/core/workers/chunks/2b9ce6648823f6962f58.js +1 -0
- package/assets/esri/core/workers/chunks/{9e11307b4cc3b523d178.js → 9cfce9414b874878d761.js} +1 -1
- package/assets/esri/core/workers/chunks/{285e573aa6f3acf70b32.js → accd0661a6dd297fab6b.js} +1 -1
- package/assets/esri/themes/base/_mixins.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/chunks/BlendLayers.glsl.js +5 -1
- package/chunks/BloomBlur.glsl.js +7 -7
- package/chunks/BloomComposition.glsl.js +2 -2
- package/geometry/support/buffer/BufferView.js +1 -1
- package/interfaces.d.ts +12 -0
- package/layers/support/layerUtils.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/deconflictorDebug.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.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/shaderLibrary/terrain/TerrainTexture.glsl.js +12 -7
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/ElevationProfile/support/visualizationUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/support/globalCss.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +0 -1
- package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as g,fromValues as _,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as C}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as q,ComponentIntersectionData as F}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as M,ConsumesDepth as L,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as oe}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends M{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new ae(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>o.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),o))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?L:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get tileRenderer(){return this._tileRenderer}get texturesBeingCompressed(){return this._tileRenderer?this._tileRenderer?.texturesBeingCompressed:null}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return g;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=ge,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,a=e.results.max,l=e.results.ground,g=e.options.store===W.MIN,_=!!e.results.ground.target,p=re(e.verticalOffset),f=e.tolerance;let m,b=g&&null!=o.dist?o.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const _=h.renderData;if(!_?.vao)return;const v=_.geometry;y(he,v.boundingBox);const w=_.localOrigin;null!=p&&(p.localOrigin=w,p.applyToAabb(he));const P=he;if(pe[0]=i[0]-w[0],pe[1]=i[1]-w[1],pe[2]=i[2]-w[2],!K(P,pe,n,f,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=g&&null!=o.dist?o.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==o.dist||n<o.dist)&&D(o,n,d),R.store!==W.MIN&&(null==a.dist||n>a.dist)&&D(a,n,d)}},C=fe;d(C,r,w);const{indices:E,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>q){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new F(E,0,I,B)),e.intersectionData.intersectRay(pe,C,O,S)}else Z(pe,C,0,I,E,B,p,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,this._configuration.renderOccluded=!1,e.output){case U.Color:case U.ColorEmission:{this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===$.OCCLUDED_TERRAIN;return this._configuration.renderOccluded=t,this._configuration.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case U.Shadow:case U.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(U.Shadow):null;case U.ViewshedShadow:return this._inViewshed?this._acquireTechnique(U.ViewshedShadow):null;case U.Depth:case U.Normal:return this._acquireTechnique(e.output);case U.ObjectAndLayerIdColor:return this._acquireTechnique(U.ObjectAndLayerIdColor);case U.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(U.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case U.Color:case U.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case U.Depth:case U.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case U.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break}case U.Shadow:case U.ShadowExcludeHighlight:case U.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case U.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const o=this._stencilEnabledLayerExtents.length>0,a=i===v.Occluded;a&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",g),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:g;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!a){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,o,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a?.indexBuffer;if(!a||null==l)return void(C&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=o.geometry.indexCount;e.rctx.bindVAO(a),c.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(oe,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],ue.prototype,"_isGlobal",null),e([a()],ue.prototype,"renderOccludedFlags",void 0),e([a({value:!1})],ue.prototype,"renderingDisabled",null),e([a({value:!0})],ue.prototype,"visible",null),e([a()],ue.prototype,"texturesBeingCompressed",null),e([a()],ue.prototype,"renderPatchBorders",null),e([a()],ue.prototype,"visualizeNormals",null),e([a()],ue.prototype,"cullBackFaces",null),e([a({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([a()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const ge=p(),_e=p(),pe=p(),fe=p();export{ue as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as g,fromValues as p,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as C}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as U,ComponentIntersectionData as q}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as F}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as M,ConsumesDepth as L,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as oe}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";import{isCompressedWithPremultiplyAlpha as ce}from"../../webgl/textureUtils.js";const de=7,he=10,ue=b();let ge=class extends M{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new ae(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>o.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),o))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?L:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get tileRenderer(){return this._tileRenderer}get texturesBeingCompressed(){return this._tileRenderer?this._tileRenderer?.texturesBeingCompressed:null}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=he-de,i=Math.max(0,Math.floor((e.level-t)/de)*de);if(this._isGlobal&&0===i)return g;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=pe,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,a=e.results.max,l=e.results.ground,g=e.options.store===W.MIN,p=!!e.results.ground.target,_=re(e.verticalOffset),f=e.tolerance;let m,b=g&&null!=o.dist?o.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const p=h.renderData;if(!p?.vao)return;const v=p.geometry;y(ue,v.boundingBox);const w=p.localOrigin;null!=_&&(_.localOrigin=w,_.applyToAabb(ue));const P=ue;if(fe[0]=i[0]-w[0],fe[1]=i[1]-w[1],fe[2]=i[2]-w[2],!K(P,fe,n,f,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=g&&null!=o.dist?o.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==o.dist||n<o.dist)&&D(o,n,d),R.store!==W.MIN&&(null==a.dist||n>a.dist)&&D(a,n,d)}},C=me;d(C,r,w);const{indices:E,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!_&&I>U){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new q(E,0,I,B)),e.intersectionData.intersectRay(fe,C,O,S)}else Z(fe,C,0,I,E,B,_,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==_&&!e.intersectsRay(i,s,f,b)||p&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,this._configuration.renderOccluded=!1,e.output){case F.Color:case F.ColorEmission:{this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===$.OCCLUDED_TERRAIN;return this._configuration.renderOccluded=t,this._configuration.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case F.Shadow:case F.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(F.Shadow):null;case F.ViewshedShadow:return this._inViewshed?this._acquireTechnique(F.ViewshedShadow):null;case F.Depth:case F.Normal:return this._acquireTechnique(e.output);case F.ObjectAndLayerIdColor:return this._acquireTechnique(F.ObjectAndLayerIdColor);case F.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(F.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case F.Color:case F.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case F.Depth:case F.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case F.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break}case F.Shadow:case F.ShadowExcludeHighlight:case F.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case F.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=p(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const o=this._stencilEnabledLayerExtents.length>0,a=i===v.Occluded;a&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",g),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:g;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!a){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture),n.setUniform1b("premultiplyAlpha",ce(l.texture.texture));const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,o,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a?.indexBuffer;if(!a||null==l)return void(C&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=o.geometry.indexCount;e.rctx.bindVAO(a),c.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(oe,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],ge.prototype,"_isGlobal",null),e([a()],ge.prototype,"renderOccludedFlags",void 0),e([a({value:!1})],ge.prototype,"renderingDisabled",null),e([a({value:!0})],ge.prototype,"visible",null),e([a()],ge.prototype,"texturesBeingCompressed",null),e([a()],ge.prototype,"renderPatchBorders",null),e([a()],ge.prototype,"visualizeNormals",null),e([a()],ge.prototype,"cullBackFaces",null),e([a({value:D.FRONT_TO_BACK})],ge.prototype,"renderOrder",null),e([a()],ge.prototype,"wireframe",null),ge=e([l("esri.views.3d.terrain.TerrainRenderer")],ge);const pe=_(),_e=_(),fe=_(),me=_();export{ge as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as m,isGroupLayer as d}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as m,isGroupLayer as d,isReferenceLayer as h}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as f}from"../support/flowUtils.js";import{BlendLayersPassParameters as _}from"./BlendLayersTechnique.js";import{TextureUpdate as T}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{NeighborIndex as g}from"./NeighborIndex.js";import{isImageWithType as b}from"./TerrainData.js";import{isBlendableLayerView as x,isVectorTileLayerView as I,isVectorTileRenderInfo as w,isImageryTileRenderInfo as A,isImageSourceRenderInfo as j,isTextureTileRenderInfo as P,isVectorTilePerLayerInfo as C}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as k}from"./TextureReference.js";import{TileCompositor as E}from"./TileCompositor.js";import{TileRenderInfo as L}from"./TileRenderInfo.js";import R from"./TileTexture.js";import{TileUpdate as M}from"./TileUpdate.js";import{fallsWithinLayerView as D}from"./tileUtils.js";import{blendModeFromString as N}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as B}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as U}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as S}from"../webgl-engine/lib/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as G,TextureWrapMode as v,PixelFormat as F}from"../../webgl/enums.js";import{Texture as H}from"../../webgl/Texture.js";import{TextureDescriptor as q}from"../../webgl/TextureDescriptor.js";class z{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let V=class extends t{constructor(e){super(e),this._passParameters=new _,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new E(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;Q.clear(),Y.length=0;const l=e.layerInfo[y.MAP];let _=0,g=null;for(;_<l.length;_++){const t=r.layerViewByIndex(_,y.MAP),T=t.layer,b=!D(e,t),w=T.opacity,A=t.fullOpacity;if(c=c||m(T),f(t))continue;if(x(t)){let e="normal"!==t.layer.blendMode;if(d(T.parent)){const t=T.parent.uid;null!=t&&""!==t&&(e=$(T.parent)||e)}e&&(p=e,n=!1)}if((b||0===w)&&!p){l[_].pendingUpdates&=~(M.TEXTURE_NOFADING&M.TEXTURE_FADING);continue}++i;const j=I(t),P=X(e,_,j);if(P){if(l[_].pendingUpdates&=~(M.TEXTURE_NOFADING&M.TEXTURE_FADING),d(T.parent)){const e=T.parent.uid;null!=e&&""!==e&&J(T.parent,_)}j?a=Math.max(a,this.tileSize*u):1===s&&1===A&&(t.isOpaque||this._dataToTexture(P,h(T))&&P.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===g&&(g=_)}}const b=a/this.tileSize,w=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==g?1===o&&!p&&this._useLayerTexture(e,g)||this._composeLayers(e,t,_-1,c,a,b,!n||p,Q,p):K(e,i,w,t!==T.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,y.MAP),s=m(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=X(e,t,!1);return!!this._dataToTexture(n,h(r.layer))&&(e.renderData.setTextureReference(new k(n.sourceLayerInfo.data,T.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,d=G.LINEAR_MIPMAP_LINEAR,f=!1,_=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,y.MAP),r=t.layer,T=I(t),g=X(e,j,T),b=r.opacity,P=!D(e,t);if(!g||(0===b||P)&&!c)continue;const C=!m(r)&&!l;C&&(l=!0);let O=!1;n.forEach((e=>{e.start===j&&(e.output=s?B.Composite:a&&C?this.backgroundIsGrid?B.GridComposite:B.ColorComposite:B.Composite,e.baseOpacity=C?u:1,Y.push(e),this._compositor.openGroup(o),O=!0)}));const k=0===_,E=O?B.GroupBackgroundComposite:a&&k?this.backgroundIsGrid?B.GridComposite:B.ColorComposite:B.Composite,L=N[x(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=C&&!O&&u<1?u:1,this._passParameters.opacity=b,w(g)?f=this._compositor.drawVectorData(this._passParameters,E,o,L,g,i,this.tileSize,f):A(g)?(this._compositor.drawRasterData(this._passParameters,E,o,L,g),W(g)&&(d=G.NEAREST)):this._dataToTexture(g,h(r))&&(this._passParameters.texture=g.sourceLayerInfo.data.texture,this._passParameters.offset=g.offset,this._passParameters.scale=g.scale,this._compositor.drawImageData(this._passParameters,E,o,L));Y.length>0&&Y[Y.length-1].end===j;){const e=Y.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,N[e.blendMode])}_++}const T=e.renderData,g=c||l&&u<1,b=T.ensureTexture(o,g,t,(()=>this._buildTexture(o,g,d)));this._compositor.copyFBOToTexture(b),this._compositor.unbind(),T.setTextureReference(new k(b,t,ee,l?1:u,0,1))}_dataToTexture(e,t){if(j(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s),e.tile.setMemoryDirty()}return P(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=G.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new q;s.wrapMode=v.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?G.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=F.RGB);const o=this.rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(b(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=F.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(c){a=new R(U(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,H.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,H.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const a=`${t} ${e.pixelFormat}`,n=this.cache.pop(a)??this.cache.pop(a+"compressed");if(r&&=S(s),n)return n.retain(),r&&n.texture.enableCompression(!0),n.texture.setData(s),n;e.shouldCompress=r;const c=new H(this.rctx,e,s);return c.isCompressing&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new R(c,this.cache)}get test(){}};function X(e,t,r){Z.layerIndex=t,Z.vtlNeighborInfos.clear();const s=e.layerInfo[y.MAP][t];if(c(Z.offset,0,0),Z.tile=e,Z.scale=1,Z.sourceLod=e.lij,Z.sourceLayerInfo=s,Z.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[y.MAP][t];if(!C(i)||s.data===i.data)return;const a=Z.vtlNeighborInfos.pushNew();a.offset=te[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Z;const o=s.upsampleInfo,i=o?.tile?.layerInfo[y.MAP][t];return i&&o.tile?(Z.tile=o.tile,u(Z.offset,o.offset),Z.scale=o.scale,Z.sourceLod=o.tile.lij,Z.sourceLayerInfo=i,Z):r?Z:null}function W(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function $(e){let t="normal"!==e.blendMode;return d(e.parent)&&(t=$(e.parent)||t),t}function J(e,t){d(e.parent)&&J(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=Q.get(r);s?s.start=t:Q.set(r,new z(t,t,e.blendMode,e.opacity,B.Composite,1))}}function K(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new k(r,T.FADING,ee,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],V.prototype,"rctx",void 0),e([a({constructOnly:!0})],V.prototype,"techniques",void 0),e([a({constructOnly:!0})],V.prototype,"cache",void 0),e([a()],V.prototype,"tileSize",void 0),e([a()],V.prototype,"texturesBeingCompressed",void 0),V=e([n("esri.views.3d.terrain.TileRenderer")],V);const Q=new Map,Y=new Array,Z=new L,ee=l(0,0,1,1),te=new Array;te[g.NORTH]=[0,-1],te[g.NORTH_EAST]=[-1,-1],te[g.EAST]=[-1,0],te[g.SOUTH_EAST]=[-1,1],te[g.SOUTH]=[0,1],te[g.SOUTH_WEST]=[1,1],te[g.WEST]=[1,0],te[g.NORTH_WEST]=[1,-1];export{z as GroupInfo,V as TileRenderer};
|
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ReadShadowMapPassParameters as e}from"../shading/ReadShadowMap.glsl.js";import{BackgroundGrid as t}from"./BackgroundGrid.glsl.js";import{TileBlendInput as o}from"./TileBlendInput.js";import{glsl as r,If as c}from"../../shaderModules/glsl.js";import{Uniform as
|
|
5
|
+
import{ReadShadowMapPassParameters as e}from"../shading/ReadShadowMap.glsl.js";import{BackgroundGrid as t}from"./BackgroundGrid.glsl.js";import{TileBlendInput as o}from"./TileBlendInput.js";import{glsl as r,If as c}from"../../shaderModules/glsl.js";import{Uniform as s}from"../../../../../webgl/Uniform.js";class a extends e{constructor(){super(...arguments),this.overlayOpacity=1}}function n(e,s){const{vertex:a,fragment:n,varyings:x}=e;x.add("vtc","vec2"),a.uniforms.add(new l("texOffsetAndScale")),n.uniforms.add(new u("tex")),n.uniforms.add(new p("premultiplyAlpha")),n.uniforms.add(new i("textureOpacities"));const f=s.textureFadingEnabled&&!s.renderOccluded;f&&(a.uniforms.add(new l("nextTexOffsetAndScale")),x.add("nvtc","vec2"),n.uniforms.add(new u("texNext")),n.uniforms.add(new i("nextTexOpacities")),n.uniforms.add(new d("fadeFactor")));const v=s.tileBlendInput===o.ColorComposite,m=s.tileBlendInput===o.GridComposite;m&&n.include(t),v&&n.uniforms.add(new i("backgroundColor")),a.code.add(r`
|
|
6
6
|
void forwardTextureCoordinatesWithTransform(in vec2 uv) {
|
|
7
7
|
vtc = texOffsetAndScale.xy + uv * texOffsetAndScale.zw;
|
|
8
8
|
${c(f,"nvtc = nextTexOffsetAndScale.xy + uv * nextTexOffsetAndScale.zw;")}
|
|
9
|
-
}`),
|
|
9
|
+
}`),n.code.add(r`
|
|
10
10
|
vec4 getColor(vec4 color, vec2 uv, vec3 opacities) {
|
|
11
|
-
${c(
|
|
11
|
+
${c(m||v,r`if (opacities.y <= 0.0) {
|
|
12
12
|
return color * opacities.z * opacities.x;
|
|
13
13
|
}
|
|
14
14
|
vec4 bg = vec4(${v?r`backgroundColor`:r`gridColor(uv)`} * opacities.y, opacities.y);
|
|
15
15
|
vec4 layer = color * opacities.z;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// we need to manually apply alpha premultiplication for compressed textures
|
|
17
|
+
// since gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL is not supported for compressed formats
|
|
18
|
+
if(premultiplyAlpha) {
|
|
19
|
+
return (bg * (1.0 - layer.a) + layer * color.a) * opacities.x;
|
|
20
|
+
}
|
|
21
|
+
return (bg * (1.0 - layer.a) + layer) * opacities.x;`,"return color * color.a;")}
|
|
22
|
+
}`),f?n.code.add(r`vec4 getTileColor() {
|
|
18
23
|
vec4 color = getColor(texture(tex, vtc), vtc, textureOpacities);
|
|
19
24
|
if (fadeFactor >= 1.0) {
|
|
20
25
|
return color;
|
|
21
26
|
}
|
|
22
27
|
vec4 nextColor = getColor(texture(texNext, nvtc), nvtc, nextTexOpacities);
|
|
23
28
|
return mix(nextColor, color, fadeFactor);
|
|
24
|
-
}`):
|
|
29
|
+
}`):n.code.add(r`vec4 getTileColor() {
|
|
25
30
|
return getColor(texture(tex, vtc), vtc, textureOpacities);
|
|
26
|
-
}`)}class
|
|
31
|
+
}`)}class d extends s{constructor(e){super(e,"float")}}class i extends s{constructor(e){super(e,"vec3")}}class l extends s{constructor(e){super(e,"vec4")}}class u extends s{constructor(e){super(e,"sampler2D")}}class p extends s{constructor(e){super(e,"bool")}}export{p as BooleanUniform,i as Float3Uniform,a as OverlayTerrainPassParameters,n as TerrainTexture,u as Texture2DUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../terrain/BackgroundGrid.glsl.js";import"../terrain/BlendLayersOutput.js";import"../terrain/TileBackground.glsl.js";import"../terrain/TileComposite.glsl.js";import"../../shaderModules/Float3PassUniform.js";import"../../shaderModules/FloatPassUniform.js";import"../../shaderModules/glsl.js";import"../../shaderModules/Texture2DPassUniform.js";import"../../../../../webgl/ShaderBuilder.js";export{a as BackgroundMode,b as build}from"../../../../../../chunks/BlendLayers.glsl.js";
|
|
5
|
+
import"../terrain/BackgroundGrid.glsl.js";import"../terrain/BlendLayersOutput.js";import"../terrain/TileBackground.glsl.js";import"../terrain/TileComposite.glsl.js";import"../../shaderModules/BooleanPassUniform.js";import"../../shaderModules/Float3PassUniform.js";import"../../shaderModules/FloatPassUniform.js";import"../../shaderModules/glsl.js";import"../../shaderModules/Texture2DPassUniform.js";import"../../../../../webgl/ShaderBuilder.js";import"../../../../../webgl/textureUtils.js";export{a as BackgroundMode,b as build}from"../../../../../../chunks/BlendLayers.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{b as BloomBlurPassParameters,a as BlurDirection,c as
|
|
5
|
+
import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{b as BloomBlurPassParameters,a as BlurDirection,c as build}from"../../../../../chunks/BloomBlur.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters
|
|
5
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const n={sunny:25,cloudy:25,rainy:15,snowy:15,foggy:15},y={sunny:5e-4,cloudy:5e-4,rainy:5e-4,snowy:.0022,foggy:.0022};class o{constructor(n,y){this.near=n,this.far=y}}const s={sunny:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),cloudy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),rainy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),snowy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05]),foggy:new o([.15,.05,.01,0,0],[1,.4,.2,.1,.05])};export{y as blurRadiusPresets,n as exposurePresets,s as lodFactorsPresets};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as l,a as n}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as u}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{a as c}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as p}from"./BloomCompositionTechnique.js";import{a as d}from"../../../../../chunks/BloomDepthAdjust.glsl.js";import{BloomDepthAdjustTechnique as b}from"./BloomDepthAdjustTechnique.js";import{blurRadiusPresets as _,exposurePresets as g,lodFactorsPresets as f}from"./BloomPresets.glsl.js";import{RenderRequestType as P}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as j,DepthStencilAttachment as T,FramebufferBit as q}from"../../../../webgl/enums.js";let C=class extends m{constructor(e){super(e),this.consumes={required:[a.COMPOSITE,"emissive"]},this.produces=a.COMPOSITE,this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionParameters=new c,this._depthAdjustParameters=new d,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),s)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=_[e.type],this._compositionParameters.exposure=g[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(_.cloudy,_[e.type],r),this._compositionParameters.exposure=t(g[e.type],3,r)}this._compositionParameters.lodFactors=f[e.type].far,this._compositionParameters.lodFactorsFront=f[e.type].near,this.requestRender(P.UPDATE)}precompile(){this._blurHorizontalConfiguration.bloomStage=n.Horizontal,this._blurVerticalConfiguration.bloomStage=n.Vertical,this.techniques.precompile(u,this._blurHorizontalConfiguration),this.techniques.precompile(u,this._blurVerticalConfiguration),this.techniques.precompile(p),this.techniques.precompile(b)}render(e){const t=e.find((({name:e})=>e===a.COMPOSITE)),r=t.getAttachment(j)?.attachment;if(!r)return t;const s=this.techniques.get(u,this._blurHorizontalConfiguration),o=this.techniques.get(u,this._blurVerticalConfiguration),i=this.techniques.get(p),m=this.techniques.get(b);if(!(s.compiled&&o.compiled&&i.compiled&&m.compiled))return this.requestRender(P.UPDATE),t;const l=t.getTexture(),n=this.fboCache,{fullWidth:h,fullHeight:c}=this.bindParameters.camera,d=this.renderingContext,_=n.acquire(h,c,"emissiveDepthAdjusted");this._depthAdjustParameters.color=r,this._prepareFBO(_,h,c),d.bindTechnique(m,this.bindParameters,this._depthAdjustParameters),d.screen.draw();let g=_.getTexture(),f=Math.round(h/2),q=Math.round(c/2);const C=5,x=this._blurParameters.blurRadius;for(let a=0;a<C;a++){const e=n.acquire(f,q,"bloomHorizontal");this._blurParameters.color=g,this._prepareFBO(e,f,q),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),0===a&&_.release();const t=n.acquire(f,q,"bloomVertical");this._blurParameters.color=e.getTexture(),this._prepareFBO(t,f,q),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._bloomResults[a]=t,f=Math.ceil(f/2),q=Math.ceil(q/2),g=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=x,this._compositionParameters.color=l,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=this.acquireOutputFramebuffer();return this._prepareFBO(R,h,c),d.bindTechnique(i,this.bindParameters,this._compositionParameters),d.screen.draw(),this._bloomResults.forEach((e=>e.release())),R.attachDepth(t.getAttachment(T)),R.attachColor(t.getAttachment(j),j),R}_prepareFBO(e,t,r){const s=this.renderingContext;s.bindFramebuffer(e.fbo),s.setViewport(0,0,t,r),s.setClearColor(0,0,0,0),s.clear(q.COLOR)}get test(){return{compositionParameters:this._compositionParameters,depthAdjustParameters:this._depthAdjustParameters,blurParameters:this._blurParameters}}};e([o()],C.prototype,"consumes",void 0),e([o()],C.prototype,"produces",void 0),C=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],C);export{C as BloomRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as l}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import f from"../lib/GLMaterial.js";import{Material as d}from"../lib/Material.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as v}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as _}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as y}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as A,PathTechnique as O,PathPassParameters as j}from"./PathTechnique.js";import{PathTechniqueConfiguration as P}from"./PathTechniqueConfiguration.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class R extends d{constructor(e,t){super(e,x),this._vertexBufferLayout=T(),this.vertexAttributeLocations=A,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&!this.transparent],[S.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&this.transparent]]),this._configuration=new P(t.spherical)}get hasEmissions(){return!i(this.parameters.emissiveFactor,r)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?m.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?m.WindingOrder:m.None,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?l.Schematic:l.Disabled,this._configuration.emissionSource=this.parameters.usePBR?u.Value:u.None,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}isVisibleForOutput(e){return e!==h.Shadow&&e!==h.ShadowExcludeHighlight&&e!==h.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=L}intersect(i,r,a,o,n,c){const h=i;if(!b(h))return;const u=h.path,m=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=u.sizeAttributeValue;Number.isNaN(o)?(m[0]*=a[0],m[1]*=a[2]):(m[0]*=e(t[0]+o*i[0],r[0],s[0]),m[1]*=e(t[2]+o*i[2],r[2],s[2]))}const l=new g(!1,a.options.normalRequired),p=Math.max(m[0],m[1]),f=i.boundingInfo;if(null==f)return void M(u,m,o,n,l,c);const d=s(f.bbMin[0]-p,f.bbMin[1]-p,f.bbMin[2]-p,f.bbMax[0]+p,f.bbMax[1]+p,f.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],_=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),y=[_/S[0],_/S[1],_/S[2]];v(d,o,y,a.tolerance)&&M(u,m,o,n,l,c)}createBufferWriter(){return new y(this._vertexBufferLayout)}createGLMaterial(e){return new w(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}function T(){const e=a().vec3f(_.POSITION).vec4f(_.PROFILEVERTEXANDNORMAL).
|
|
5
|
+
import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as l}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import f from"../lib/GLMaterial.js";import{Material as d}from"../lib/Material.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as v}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as _}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as y}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as A,PathTechnique as O,PathPassParameters as j}from"./PathTechnique.js";import{PathTechniqueConfiguration as P}from"./PathTechniqueConfiguration.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class R extends d{constructor(e,t){super(e,x),this._vertexBufferLayout=T(),this.vertexAttributeLocations=A,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&!this.transparent],[S.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&this.transparent]]),this._configuration=new P(t.spherical)}get hasEmissions(){return!i(this.parameters.emissiveFactor,r)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?m.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?m.WindingOrder:m.None,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?l.Schematic:l.Disabled,this._configuration.emissionSource=this.parameters.usePBR?u.Value:u.None,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}isVisibleForOutput(e){return e!==h.Shadow&&e!==h.ShadowExcludeHighlight&&e!==h.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=L}intersect(i,r,a,o,n,c){const h=i;if(!b(h))return;const u=h.path,m=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=u.sizeAttributeValue;Number.isNaN(o)?(m[0]*=a[0],m[1]*=a[2]):(m[0]*=e(t[0]+o*i[0],r[0],s[0]),m[1]*=e(t[2]+o*i[2],r[2],s[2]))}const l=new g(!1,a.options.normalRequired),p=Math.max(m[0],m[1]),f=i.boundingInfo;if(null==f)return void M(u,m,o,n,l,c);const d=s(f.bbMin[0]-p,f.bbMin[1]-p,f.bbMin[2]-p,f.bbMax[0]+p,f.bbMax[1]+p,f.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],_=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),y=[_/S[0],_/S[1],_/S[2]];v(d,o,y,a.tolerance)&&M(u,m,o,n,l,c)}createBufferWriter(){return new y(this._vertexBufferLayout)}createGLMaterial(e){return new w(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}function T(){const e=a().vec3f(_.POSITION).vec4f(_.PROFILEVERTEXANDNORMAL).vec4f16(_.FEATUREVALUE).vec2f(_.PROFILEAUXDATA).vec2i16(_.PROFILERIGHT,{glNormalized:!0}).vec2i16(_.PROFILEUP,{glNormalized:!0});return p()&&e.vec4u8(_.OLIDCOLOR),e}class w extends f{beginSlot(e){return this.getTechnique(O,e)}}function M(e,t,i,r,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(i,r,s,a)}class x extends j{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{x as Parameters,R as PathMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Float16Array as e}from"@petamoriken/float16";import t from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as a,d as n,f as o,h as l,g as c,c as p,l as h,j as m,t as f}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as E,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as O,signedDistance as S,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as w}from"../lib/Material.js";import{RenderSlot as F}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as x}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as B}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as z}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as H,RibbonLineTechnique as G}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as k,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";var W;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(W||(W={}));class Y extends D{constructor(e){super(e,X),this._configuration=new k,this.vertexAttributeLocations=H,this.produces=new Map([[F.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[F.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){this._configuration.output=e,this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===F.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ee(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===w.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}intersectDraped({attributes:e,screenToWorldRatio:t},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(x.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const t=e.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(t)?c*=this.parameters.vvSize.fallback[0]:c*=r(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],m=(c/2+4)*t;let f=Number.MAX_VALUE,u=0;const T=e.get(x.POSITION).data,d=$(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],t=T[_+1],i=(_+3)%T.length,s=p-e,a=h-t,n=T[i]-e,o=T[i+1]-t,l=r((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,m=o*l-a,d=c*c+m*m;d<f&&(f=d,u=_/3)}f<m*m&&n(o.dist,o.normal,u,!1)}intersect(e,i,f,u,T,_){if(!f.options.selectionMode||!e.visible)return;if(!M(i))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=e.attributes,v=g.get(x.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=r(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(x.SIZE)&&(P*=g.get(x.SIZE).data[0]);const N=f.camera,L=ae;s(L,f.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;a(Te[0],L[0]-b,L[1]+b,0),a(Te[1],L[0]+b,L[1]+b,0),a(Te[2],L[0]+b,L[1]-b,0),a(Te[3],L[0]-b,L[1]-b,0);for(let t=0;t<4;t++)if(!N.unprojectFromRenderScreen(Te[t],de[t]))return;O(N.eye,de[0],de[1],_e),O(N.eye,de[1],de[2],Ee),O(N.eye,de[2],de[3],Ae),O(N.eye,de[3],de[0],Re);let C=Number.MAX_VALUE,U=0;const y=$(this.parameters,g)?v.length-2:v.length-5;for(let t=0;t<y;t+=3){te[0]=v[t]+i[12],te[1]=v[t+1]+i[13],te[2]=v[t+2]+i[14];const e=(t+3)%v.length;if(re[0]=v[e]+i[12],re[1]=v[e+1]+i[13],re[2]=v[e+2]+i[14],S(_e,te)<0&&S(_e,re)<0||S(Ee,te)<0&&S(Ee,re)<0||S(Ae,te)<0&&S(Ae,re)<0||S(Re,te)<0&&S(Re,re)<0)continue;if(N.projectToRenderScreen(te,ne),N.projectToRenderScreen(re,oe),ne[2]<0&&oe[2]>0){n(ie,te,re);const e=N.frustum,t=-S(e[d.NEAR],te)/o(ie,I(e[d.NEAR]));l(ie,ie,t),c(te,te,ie),N.projectToRenderScreen(te,ne)}else if(ne[2]>0&&oe[2]<0){n(ie,re,te);const e=N.frustum,t=-S(e[d.NEAR],re)/o(ie,I(e[d.NEAR]));l(ie,ie,t),c(re,re,ie),N.projectToRenderScreen(re,oe)}else if(ne[2]<0&&oe[2]<0)continue;ne[2]=0,oe[2]=0;const r=E(A(ne,oe,pe),L);r<C&&(C=r,p(le,te),p(ce,re),U=t/3)}const j=f.rayBegin,D=f.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(le,ce,pe),A(j,D,he),se)){n(se,se,j);const t=h(se);l(se,se,1/t),e=t/m(j,D)}_(e,se,U,!1)}}get _layout(){const e=v().vec3f(x.POSITION).vec3f(x.PREVPOSITION).vec3f(x.NEXTPOSITION).vec2f16(x.LINEPARAMETERS).f32(x.U0);return this.parameters.vvSize?e.f32(x.SIZEFEATUREATTRIBUTE):e.f32(x.SIZE),this.parameters.vvColor?e.f32(x.COLORFEATUREATTRIBUTE):e.vec4u8(x.COLOR),this.parameters.vvOpacity&&e.f32(x.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(x.OLIDCOLOR),e}createBufferWriter(){return new Q(this._layout,this.parameters)}createGLMaterial(e){return new q(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class q extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(G,e)}}class X extends J{constructor(){super(...arguments),this.width=0,this.color=T,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class Q{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=z+r}}_isClosed(e){return $(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(x.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,r,i,s,n,o){const l=me,c=fe,h=ue,u=i.get(x.POSITION),T=u.indices,d=u.data.length/3,_=i.get(x.DISTANCETOSTART)?.data;T&&T.length!==2*(d-1)&&console.warn("RibbonLineMaterial does not support indices");const E=i.get(x.SIZEFEATUREATTRIBUTE)?.data[0]??i.get(x.SIZE)?.data[0]??1;let A=[1,1,1,1],R=0;const g=this.vertexBufferLayout.fields.has(x.COLORFEATUREATTRIBUTE);g?R=i.get(x.COLORFEATUREATTRIBUTE).data[0]:i.has(x.COLOR)&&(A=i.get(x.COLOR).data);const O=this.vertexBufferLayout.fields.has(x.OPACITYFEATUREATTRIBUTE),S=O?i.get(x.OPACITYFEATUREATTRIBUTE).data[0]:0,I=new Float32Array(n.buffer),v=new e(n.buffer),P=new Uint8Array(n.buffer),N=this.vertexBufferLayout.stride/4;let L=o*N;const b=L;let C=0;const U=_?(e,t,r)=>C=_[r]:(e,t,r)=>C+=m(e,t),j=(e,t,r,i,a,n,o)=>{I[L++]=t[0],I[L++]=t[1],I[L++]=t[2],I[L++]=e[0],I[L++]=e[1],I[L++]=e[2],I[L++]=r[0],I[L++]=r[1],I[L++]=r[2];const l=2*L;if(L++,v[l]=i,v[l+1]=a,I[L++]=o,I[L++]=E,g)I[L++]=R;else{const e=Math.min(4*n,A.length-4),t=4*L;L++,P[t]=A[e],P[t+1]=A[e+1],P[t+2]=A[e+2],P[t+3]=A[e+3]}if(O&&(I[L++]=S),y()){const e=4*L;L++,s&&(P[e]=s[0],P[e+1]=s[1],P[e+2]=s[2],P[e+3]=s[3])}};L+=N,a(c,u.data[0],u.data[1],u.data[2]),t&&f(c,c,t);const D=this._isClosed(i);if(D){const e=u.data.length-3;a(l,u.data[e],u.data[e+1],u.data[e+2]),t&&f(l,l,t)}else a(h,u.data[3],u.data[4],u.data[5]),t&&f(h,h,t),j(c,c,h,1,W.LEFT_CAP_START,0,0),j(c,c,h,1,W.RIGHT_CAP_START,0,0),p(l,c),p(c,h);const w=D?0:1,F=D?d:d-1;for(let e=w;e<F;e++){const r=(e+1)%d*3;a(h,u.data[r],u.data[r+1],u.data[r+2]),t&&f(h,h,t),U(l,c,e),j(l,c,h,0,W.LEFT_JOIN_END,e,C),j(l,c,h,0,W.RIGHT_JOIN_END,e,C);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const r=(t+1)/(i+1);j(l,c,h,r,W.LEFT_JOIN_END,e,C),j(l,c,h,r,W.RIGHT_JOIN_END,e,C)}j(l,c,h,1,W.LEFT_JOIN_START,e,C),j(l,c,h,1,W.RIGHT_JOIN_START,e,C),p(l,c),p(c,h)}D?(a(h,u.data[3],u.data[4],u.data[5]),t&&f(h,h,t),C=U(l,c,F),j(l,c,h,0,W.LEFT_JOIN_END,w,C),j(l,c,h,0,W.RIGHT_JOIN_END,w,C)):(C=U(l,c,F),j(l,c,c,0,W.LEFT_CAP_END,F,C),j(l,c,c,0,W.RIGHT_CAP_END,F,C)),K(I,b+N,I,b,N);return L=K(I,L-N,I,L,N),this._parameters.wireframe&&this._addWireframeVertices(n,b,L,N),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=K(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function K(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function $(e,t){if(!e.isClosed)return!1;return t.get(x.POSITION).indices.length>2}function ee(e){return e.anchor===B.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const te=u(),re=u(),ie=u(),se=u(),ae=u(),ne=i(),oe=i(),le=u(),ce=u(),pe=_(),he=_(),me=u(),fe=u(),ue=u(),Te=[i(),i(),i(),i()],de=[u(),u(),u(),u()],_e=g(),Ee=g(),Ae=g(),Re=g();export{X as Parameters,Y as RibbonLineMaterial};
|
|
5
|
+
import{Float16Array as e}from"@petamoriken/float16";import t from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as a,d as n,f as o,h as l,g as c,c as p,l as h,j as m,t as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as E,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as O,signedDistance as S,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as w}from"../lib/Material.js";import{RenderSlot as F}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as x}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as B}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as z}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as H,RibbonLineTechnique as G}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as k,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";var W;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(W||(W={}));class Y extends D{constructor(e){super(e,X),this._configuration=new k,this.vertexAttributeLocations=H,this.produces=new Map([[F.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[F.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){this._configuration.output=e,this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===F.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ee(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===w.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}intersectDraped({attributes:e,screenToWorldRatio:t},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(x.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const t=e.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(t)?c*=this.parameters.vvSize.fallback[0]:c*=r(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],m=(c/2+4)*t;let u=Number.MAX_VALUE,f=0;const T=e.get(x.POSITION).data,d=$(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],t=T[_+1],i=(_+3)%T.length,s=p-e,a=h-t,n=T[i]-e,o=T[i+1]-t,l=r((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,m=o*l-a,d=c*c+m*m;d<u&&(u=d,f=_/3)}u<m*m&&n(o.dist,o.normal,f,!1)}intersect(e,i,u,f,T,_){if(!u.options.selectionMode||!e.visible)return;if(!M(i))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=e.attributes,v=g.get(x.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=r(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(x.SIZE)&&(P*=g.get(x.SIZE).data[0]);const N=u.camera,L=ae;s(L,u.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;a(Te[0],L[0]-b,L[1]+b,0),a(Te[1],L[0]+b,L[1]+b,0),a(Te[2],L[0]+b,L[1]-b,0),a(Te[3],L[0]-b,L[1]-b,0);for(let t=0;t<4;t++)if(!N.unprojectFromRenderScreen(Te[t],de[t]))return;O(N.eye,de[0],de[1],_e),O(N.eye,de[1],de[2],Ee),O(N.eye,de[2],de[3],Ae),O(N.eye,de[3],de[0],Re);let C=Number.MAX_VALUE,U=0;const y=$(this.parameters,g)?v.length-2:v.length-5;for(let t=0;t<y;t+=3){te[0]=v[t]+i[12],te[1]=v[t+1]+i[13],te[2]=v[t+2]+i[14];const e=(t+3)%v.length;if(re[0]=v[e]+i[12],re[1]=v[e+1]+i[13],re[2]=v[e+2]+i[14],S(_e,te)<0&&S(_e,re)<0||S(Ee,te)<0&&S(Ee,re)<0||S(Ae,te)<0&&S(Ae,re)<0||S(Re,te)<0&&S(Re,re)<0)continue;if(N.projectToRenderScreen(te,ne),N.projectToRenderScreen(re,oe),ne[2]<0&&oe[2]>0){n(ie,te,re);const e=N.frustum,t=-S(e[d.NEAR],te)/o(ie,I(e[d.NEAR]));l(ie,ie,t),c(te,te,ie),N.projectToRenderScreen(te,ne)}else if(ne[2]>0&&oe[2]<0){n(ie,re,te);const e=N.frustum,t=-S(e[d.NEAR],re)/o(ie,I(e[d.NEAR]));l(ie,ie,t),c(re,re,ie),N.projectToRenderScreen(re,oe)}else if(ne[2]<0&&oe[2]<0)continue;ne[2]=0,oe[2]=0;const r=E(A(ne,oe,pe),L);r<C&&(C=r,p(le,te),p(ce,re),U=t/3)}const j=u.rayBegin,D=u.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(le,ce,pe),A(j,D,he),se)){n(se,se,j);const t=h(se);l(se,se,1/t),e=t/m(j,D)}_(e,se,U,!1)}}get _layout(){const e=v().vec3f(x.POSITION).vec3f(x.PREVPOSITION).vec3f(x.NEXTPOSITION).vec2f16(x.LINEPARAMETERS).f32(x.U0);return this.parameters.vvColor?e.f32(x.COLORFEATUREATTRIBUTE):e.vec4u8(x.COLOR),this.parameters.vvSize?e.f16(x.SIZEFEATUREATTRIBUTE):e.f16(x.SIZE),this.parameters.vvOpacity&&e.f16(x.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(x.OLIDCOLOR),e}createBufferWriter(){return new Q(this._layout,this.parameters)}createGLMaterial(e){return new q(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class q extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(G,e)}}class X extends J{constructor(){super(...arguments),this.width=0,this.color=T,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class Q{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=z+r}}_isClosed(e){return $(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(x.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,r,i,s,n,o){const l=i.get(x.POSITION),c=l.indices,h=l.data.length/3,f=i.get(x.DISTANCETOSTART)?.data;c&&c.length!==2*(h-1)&&console.warn("RibbonLineMaterial does not support indices");const T=i.get(x.SIZEFEATUREATTRIBUTE)?.data[0]??i.get(x.SIZE)?.data[0]??1;let d=[1,1,1,1],_=0;const E=this.vertexBufferLayout.fields.has(x.COLORFEATUREATTRIBUTE);E?_=i.get(x.COLORFEATUREATTRIBUTE).data[0]:i.has(x.COLOR)&&(d=i.get(x.COLOR).data);const A=this.vertexBufferLayout.fields.has(x.OPACITYFEATUREATTRIBUTE),R=A?i.get(x.OPACITYFEATUREATTRIBUTE).data[0]:0,g=new Float32Array(n.buffer),O=new e(n.buffer),S=new Uint8Array(n.buffer),I=this.vertexBufferLayout.stride/4;let v=o*I;const P=v;let N=0;const L=f?(e,t,r)=>N=f[r]:(e,t,r)=>N+=m(e,t),b=(e,t,r,i,a,n,o)=>{g[v++]=t[0],g[v++]=t[1],g[v++]=t[2],g[v++]=e[0],g[v++]=e[1],g[v++]=e[2],g[v++]=r[0],g[v++]=r[1],g[v++]=r[2];let l=2*v;if(O[l]=i,O[l+1]=a,v++,g[v++]=o,E)g[v++]=_;else{const e=Math.min(4*n,d.length-4),t=4*v;v++,S[t]=d[e],S[t+1]=d[e+1],S[t+2]=d[e+2],S[t+3]=d[e+3]}l=2*v,O[l++]=T,A&&(O[l++]=R);let c=2*l;y()&&s&&(S[c++]=s[0],S[c++]=s[1],S[c++]=s[2],S[c++]=s[3]),v=Math.ceil(.25*c)};v+=I;const C=a(me,l.data[0],l.data[1],l.data[2]);t&&u(C,C,t);const U=this._isClosed(i),j=ue,D=fe;if(U){const e=l.data.length-3;a(j,l.data[e],l.data[e+1],l.data[e+2]),t&&u(j,j,t)}else a(D,l.data[3],l.data[4],l.data[5]),t&&u(D,D,t),b(C,C,D,1,W.LEFT_CAP_START,0,0),b(C,C,D,1,W.RIGHT_CAP_START,0,0),p(j,C),p(C,D);const w=U?0:1,F=U?h:h-1;for(let e=w;e<F;e++){const r=(e+1)%h*3;a(D,l.data[r],l.data[r+1],l.data[r+2]),t&&u(D,D,t),L(j,C,e),b(j,C,D,0,W.LEFT_JOIN_END,e,N),b(j,C,D,0,W.RIGHT_JOIN_END,e,N);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const r=(t+1)/(i+1);b(j,C,D,r,W.LEFT_JOIN_END,e,N),b(j,C,D,r,W.RIGHT_JOIN_END,e,N)}b(j,C,D,1,W.LEFT_JOIN_START,e,N),b(j,C,D,1,W.RIGHT_JOIN_START,e,N),p(j,C),p(C,D)}U?(a(D,l.data[3],l.data[4],l.data[5]),t&&u(D,D,t),N=L(j,C,F),b(j,C,D,0,W.LEFT_JOIN_END,w,N),b(j,C,D,0,W.RIGHT_JOIN_END,w,N)):(N=L(j,C,F),b(j,C,C,0,W.LEFT_CAP_END,F,N),b(j,C,C,0,W.RIGHT_CAP_END,F,N)),K(g,P+I,g,P,I);return v=K(g,v-I,g,v,I),this._parameters.wireframe&&this._addWireframeVertices(n,P,v,I),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=K(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function K(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function $(e,t){if(!e.isClosed)return!1;return t.get(x.POSITION).indices.length>2}function ee(e){return e.anchor===B.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const te=f(),re=f(),ie=f(),se=f(),ae=f(),ne=i(),oe=i(),le=f(),ce=f(),pe=_(),he=_(),me=f(),ue=f(),fe=f(),Te=[i(),i(),i(),i()],de=[f(),f(),f(),f()],_e=g(),Ee=g(),Ae=g(),Re=g();export{X as Parameters,Y as RibbonLineMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{hasIdentityRotation as e,isOrthoNormal as t}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as f,BufferViewVec2f as r,
|
|
5
|
+
import{hasIdentityRotation as e,isOrthoNormal as t}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as f,BufferViewVec2f as r,BufferViewVec4f16 as o,BufferViewVec4f as i,BufferViewFloat as s,BufferViewVec2i16 as n,BufferViewVec2f16 as c,BufferViewVec3f as l}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as d}from"../../lib/Util.js";import{VertexAttribute as u}from"../../lib/VertexAttribute.js";function a(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l)s[f]=o[i[l]],f+=n;else for(let l=0;l<c;++l){const e=o[i[l]];for(let t=0;t<r;t++)s[f]=e,f+=n}}function p(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=2*o[c];i[f]=r[e],i[f+1]=r[e+1],f+=s}}function g(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=3*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],f+=n}}function y(e,t,f,r=1){const{data:o,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===r)for(let l=0;l<c;++l){const e=4*i[l];s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<r;++t)s[f]=o[e],s[f+1]=o[e+1],s[f+2]=o[e+2],s[f+3]=o[e+3],f+=n}}function B(e,t,f){const r=e.typedBuffer,o=e.typedBufferStride;t*=o;for(let i=0;i<f;++i)r[t]=0,r[t+1]=0,r[t+2]=0,r[t+3]=0,t+=o}function b(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=9*o[c];for(let t=0;t<9;++t)i[f+t]=r[e+t];f+=s}}function O(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length;f*=s;for(let c=0;c<n;++c){const e=16*o[c];for(let t=0;t<16;++t)i[f+t]=r[e+t];f+=s}}function h(t,f,r,o,i=1){if(!f)return void g(t,r,o,i);const{data:s,indices:n}=t,c=r.typedBuffer,l=r.typedBufferStride,d=n.length,u=f[0],a=f[1],p=f[2],y=f[4],B=f[5],b=f[6],O=f[8],h=f[9],m=f[10],N=f[12],S=f[13],F=f[14];o*=l;let I=0,R=0,z=0;const E=e(f)?e=>{I=s[e]+N,R=s[e+1]+S,z=s[e+2]+F}:e=>{const t=s[e],f=s[e+1],r=s[e+2];I=u*t+y*f+O*r+N,R=a*t+B*f+h*r+S,z=p*t+b*f+m*r+F};if(1===i)for(let e=0;e<d;++e)E(3*n[e]),c[o]=I,c[o+1]=R,c[o+2]=z,o+=l;else for(let e=0;e<d;++e){E(3*n[e]);for(let e=0;e<i;++e)c[o]=I,c[o+1]=R,c[o+2]=z,o+=l}}function m(f,r,o,i,s=1){if(!r)return void g(f,o,i,s);const{data:n,indices:c}=f,l=r,d=o.typedBuffer,u=o.typedBufferStride,a=c.length,p=l[0],y=l[1],B=l[2],b=l[4],O=l[5],h=l[6],m=l[8],N=l[9],S=l[10],F=!t(l),I=1e-6,R=1-I;i*=u;let z=0,E=0,v=0;const w=e(l)?e=>{z=n[e],E=n[e+1],v=n[e+2]}:e=>{const t=n[e],f=n[e+1],r=n[e+2];z=p*t+b*f+m*r,E=y*t+O*f+N*r,v=B*t+h*f+S*r};if(1===s)if(F)for(let e=0;e<a;++e){w(3*c[e]);const t=z*z+E*E+v*v;if(t<R&&t>I){const e=1/Math.sqrt(t);d[i]=z*e,d[i+1]=E*e,d[i+2]=v*e}else d[i]=z,d[i+1]=E,d[i+2]=v;i+=u}else for(let e=0;e<a;++e)w(3*c[e]),d[i]=z,d[i+1]=E,d[i+2]=v,i+=u;else for(let e=0;e<a;++e){if(w(3*c[e]),F){const e=z*z+E*E+v*v;if(e<R&&e>I){const t=1/Math.sqrt(e);z*=t,E*=t,v*=t}}for(let e=0;e<s;++e)d[i]=z,d[i+1]=E,d[i+2]=v,i+=u}}function N(e,f,r,o,i=1){if(!f)return void y(e,r,o,i);const{data:s,indices:n}=e,c=f,l=r.typedBuffer,d=r.typedBufferStride,u=n.length,a=c[0],p=c[1],g=c[2],B=c[4],b=c[5],O=c[6],h=c[8],m=c[9],N=c[10],S=!t(c),F=1e-6,I=1-F;if(o*=d,1===i)for(let t=0;t<u;++t){const e=4*n[t],f=s[e],r=s[e+1],i=s[e+2],c=s[e+3];let u=a*f+B*r+h*i,y=p*f+b*r+m*i,R=g*f+O*r+N*i;if(S){const e=u*u+y*y+R*R;if(e<I&&e>F){const t=1/Math.sqrt(e);u*=t,y*=t,R*=t}}l[o]=u,l[o+1]=y,l[o+2]=R,l[o+3]=c,o+=d}else for(let t=0;t<u;++t){const e=4*n[t],f=s[e],r=s[e+1],c=s[e+2],u=s[e+3];let y=a*f+B*r+h*c,R=p*f+b*r+m*c,z=g*f+O*r+N*c;if(S){const e=y*y+R*R+z*z;if(e<I&&e>F){const t=1/Math.sqrt(e);y*=t,R*=t,z*=t}}for(let t=0;t<i;++t)l[o]=y,l[o+1]=R,l[o+2]=z,l[o+3]=u,o+=d}}function S(e,t,f,r,o=1){const{data:i,indices:s}=e,n=f.typedBuffer,c=f.typedBufferStride,l=s.length;if(r*=c,t!==i.length||4!==t)if(1!==o)if(4!==t)for(let d=0;d<l;++d){const e=3*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=255,r+=c}else for(let d=0;d<l;++d){const e=4*s[d];for(let t=0;t<o;++t)n[r]=i[e],n[r+1]=i[e+1],n[r+2]=i[e+2],n[r+3]=i[e+3],r+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=i[t+3],r+=c}return}for(let e=0;e<l;++e){const t=3*s[e];n[r]=i[t],n[r+1]=i[t+1],n[r+2]=i[t+2],n[r+3]=255,r+=c}}else{n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,s=e[r/=4];r+=t;const d=l*o;for(let f=1;f<d;++f)e[r]=s,r+=t}}function F(e,t,f){const{data:r,indices:o}=e,i=t.typedBuffer,s=t.typedBufferStride,n=o.length,c=r[0];f*=s;for(let l=0;l<n;++l)i[f]=c,f+=s}function I(e,t,f,r,o=1){const i=t.typedBuffer,s=t.typedBufferStride;if(r*=s,1===o)for(let n=0;n<f;++n)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s;else for(let n=0;n<f;++n)for(let t=0;t<o;++t)i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2],i[r+3]=e[3],r+=s}function R(e,t,r,o,i,s,n){let c={numItems:0,numVerticesPerItem:0};for(const l of r.fields.keys()){const r=e.get(l),d=r?.indices;if(r&&d)l===u.POSITION&&(c={numItems:1,numVerticesPerItem:d.length}),z(l,r,o,i,s,n);else if(l===u.OLIDCOLOR&&null!=t){const r=e.get(u.POSITION)?.indices;if(r){const e=r.length;I(t,s.getField(l,f),e,n)}}}return c}function z(e,t,a,g,B,b){switch(e){case u.POSITION:{d(3===t.size);const f=B.getField(e,l);d(!!f,`No buffer view for ${e}`),f&&h(t,a,f,b);break}case u.NORMAL:{d(3===t.size);const f=B.getField(e,l);d(!!f,`No buffer view for ${e}`),f&&m(t,g,f,b);break}case u.NORMALCOMPRESSED:case u.PROFILERIGHT:case u.PROFILEUP:{d(2===t.size);const f=B.getField(e,n);d(!!f,`No buffer view for ${e}`),f&&p(t,f,b);break}case u.UV0:{d(2===t.size);const f=B.getField(e,c);d(!!f,`No buffer view for ${e}`),f&&p(t,f,b);break}case u.UVI:{d(2===t.size);const f=B.getField(e,n);d(!!f,`No buffer view for ${e}`),f&&p(t,f,b);break}case u.COLOR:case u.SYMBOLCOLOR:{const r=B.getField(e,f);d(!!r,`No buffer view for ${e}`),d(3===t.size||4===t.size),!r||3!==t.size&&4!==t.size||S(t,t.size,r,b);break}case u.COLORFEATUREATTRIBUTE:{const f=B.getField(e,s);d(!!f,`No buffer view for ${e}`),d(1===t.size),f&&1===t.size&&F(t,f,b);break}case u.TANGENT:{d(4===t.size);const f=B.getField(e,i);d(!!f,`No buffer view for ${e}`),f&&N(t,a,f,b);break}case u.PROFILEVERTEXANDNORMAL:{d(4===t.size);const f=B.getField(e,i);d(!!f,`No buffer view for ${e}`),f&&y(t,f,b)}break;case u.FEATUREVALUE:{d(4===t.size);const f=B.getField(e,o);d(!!f,`No buffer view for ${e}`),f&&y(t,f,b)}break;case u.PROFILEAUXDATA:{d(2===t.size);const f=B.getField(e,r);d(!!f,`No buffer view for ${e}`),f&&p(t,f,b)}}}export{a as writeBufferFloat,b as writeBufferMat3f,O as writeBufferMat4f,p as writeBufferVec2,g as writeBufferVec3,y as writeBufferVec4,B as writeBufferVec4Zeros,S as writeColor,F as writeColorFeatureAttribute,z as writeDefaultAttribute,R as writeDefaultAttributes,m as writeNormal,I as writeOlidColor,h as writePosition,N as writeTangent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Error.js";import e from"../../core/Logger.js";import{SizedPixelFormat as r,CompressedTextureFormat as n,TextureType as i,PixelFormat as o,PixelType as a}from"./enums.js";const
|
|
5
|
+
import t from"../../core/Error.js";import e from"../../core/Logger.js";import{SizedPixelFormat as r,CompressedTextureFormat as n,TextureType as i,PixelFormat as o,PixelType as a}from"./enums.js";const l=()=>e.getLogger("esri/views/webgl/textureUtils");function u(t){(null!=t.width&&t.width<0||null!=t.height&&t.height<0||null!=t.depth&&t.depth<0)&&l().error("Negative dimension parameters are not allowed!")}function c(t){return t in r}function h(t){return t in n}function d(t){return null!=t&&"type"in t&&"compressed"===t.type}function s(t){return!!t.descriptor.internalFormat&&h(t.descriptor.internalFormat)}function m(t){return null!=t&&"byteLength"in t}function p(t){return null!=t&&!d(t)&&!m(t)}function f(t){return t===i.TEXTURE_3D||t===i.TEXTURE_2D_ARRAY}function E(t,e,r,n=1){let o=Math.max(e,r);return t===i.TEXTURE_3D&&(o=Math.max(o,n)),Math.floor(Math.log2(o))+1}function T(e){if(null!=e.internalFormat)return e.internalFormat===o.DEPTH_STENCIL?o.DEPTH24_STENCIL8:e.internalFormat;switch(e.dataType){case a.FLOAT:switch(e.pixelFormat){case o.RGBA:return r.RGBA32F;case o.RGB:return r.RGB32F;default:throw new t("Unable to derive format")}case a.UNSIGNED_BYTE:switch(e.pixelFormat){case o.RGBA:return r.RGBA8;case o.RGB:return r.RGB8}}return e.internalFormat=e.pixelFormat===o.DEPTH_STENCIL?o.DEPTH24_STENCIL8:e.pixelFormat}function g(t){let e="width"in t?t.width:t.codedWidth,r="height"in t?t.height:t.codedHeight;const n=1;return t instanceof HTMLVideoElement&&(e=t.videoWidth,r=t.videoHeight),{width:e,height:r,depth:n}}function F(t){return!!(t?.descriptor.preMultiplyAlpha&&t.descriptor.internalFormat&&t.descriptor.internalFormat in n)}export{E as calcMipmapLevels,T as deriveInternalFormat,g as getDimensions,f as is3DTarget,m as isArrayBufferView,d as isCompressedData,h as isCompressedFormat,s as isCompressedTexture,F as isCompressedWithPremultiplyAlpha,c as isSizedPixelFormat,p as isTexImageSource,u as validateTexture};
|
package/widgets/Daylight.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Logger.js";import{watch as i,syncAndInitial as s}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import{css as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Logger.js";import{watch as i,syncAndInitial as s}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{onLocaleChange as a}from"../intl/locale.js";import n from"./Widget.js";import{css as r}from"./Daylight/css.js";import d from"./Daylight/DaylightViewModel.js";import c from"./Daylight/VisibleElements.js";import{orderedSeasons as p}from"./Daylight/support/daylightUtils.js";import h from"./Daylight/support/SliderWithDropdown.js";import{css as g}from"./Slider/css.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as y}from"./support/Heading.js";import{onPrimaryTickCreated as b,onSecondaryTickCreated as S,adjustTimeSliderForLocale as v,useAmPm as w}from"./support/timeWidgetUtils.js";import"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{tsx as _,tsxFragment as C}from"./support/jsxFactory.js";const D="date";let M=class extends n{constructor(e,t){super(e,t),this.headingLevel=3,this.viewModel=new d,this.visibleElements=new c,this.dateOrSeason=D,this._timeSlider=new h({viewModel:this.viewModel.timeSliderViewModel,steps:this.timeSliderSteps,labelInputsEnabled:!1,visibleElements:{labels:!0},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(e,t,i)=>b({tickElement:t,labelElement:i,tickClasses:f,onClick:this._makeGoToTime(e)})},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(e,t)=>S({tickElement:t,tickClasses:f,onClick:this._makeGoToTime(e)})}]}),this._onPlayDayClick=()=>{this.viewModel.toggleDayPlaying()},this._onDateChange=e=>{const t=e.currentTarget.valueAsDate;this.viewModel.onDateChange(Array.isArray(t)?t[0]:t)},this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()},this._onSeasonChange=e=>{this.viewModel.currentSeason=e.currentTarget.value},this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()},this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get icon(){return"brightness"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.title??""}set label(e){this._overrideIfSome("label",e)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(e){this.viewModel.playSpeedMultiplier=e}get timeSliderSteps(){return this._timeSlider?.steps??5}set timeSliderSteps(e){this._timeSlider.steps=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}postInitialize(){this.viewModel.isSupported&&(this.addHandles([i((()=>this.viewModel.timeSliderViewModel),(e=>this._timeSlider.viewModel=e),s),i((()=>this.visibleElements?.timezone),(e=>this._timeSlider.showDropDown=e),s),i((()=>!this.viewModel.sunLightingEnabled),(e=>{this._timeSlider.disabled=e}),s),a((()=>this._adjustTimeSliderPadding()))]),this._adjustTimeSliderPadding())}destroy(){this._timeSlider.destroy()}render(){const{messages:e,viewModel:t,visibleElements:i}=this,s=t.isSupported;return _("div",{class:this.classes(r.base,u.widget)},s?_(C,null,i.header?_(y,{level:this.headingLevel},e.title):null,this._renderTimeOptions(),i.datePicker?this._renderDateOrSeason():null,i.sunLightingToggle?this._renderSunLightingToggle():null,i.shadowsToggle?this._renderShadowsToggle():null):_("div",{class:r.panelError,key:"unsupported"},_("p",null,e.unsupported)))}loadDependencies(){return m({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select")})}_adjustTimeSliderPadding(){v(this.domNode?.querySelector(`.${g.base}`))}_renderTimeOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{directShadowsEnabled:s,dayPlaying:o}=e,l=!e.sunLightingEnabled;return _("div",{class:this.classes(r.dayContainer,{[r.sliderShadowOn]:s,[r.sliderShadowOff]:!s,[r.sliderDateOn]:t.datePicker,[r.sliderDateOff]:!t.datePicker,[r.sliderAmPmOn]:w(),[r.containerDisabled]:l}),key:"daylight-time-options"},this._timeSlider.render(),t.playButtons?this._renderPlayPauseButton({playing:o,disabled:l,label:i.playDay,onClick:this._onPlayDayClick}):null)}_renderDateOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{yearPlaying:s}=e,o=!e.sunLightingEnabled;return _("div",{class:this.classes(r.dateContainer,o&&r.containerDisabled),key:r.dateContainer},_("calcite-input-date-picker",{class:r.datePicker,"data-testid":"daylight-date-picker",disabled:o,key:r.datePicker,overlayPositioning:"fixed",placement:"bottom",valueAsDate:e.localDate,onCalciteInputDatePickerChange:this._onDateChange}),t.playButtons?this._renderPlayPauseButton({playing:s,disabled:o,label:i.playYear,onClick:this._onYearPlayClick}):null)}_renderPlayPauseButton({playing:e,disabled:t,label:i,onClick:s}){return _("calcite-button",{appearance:"solid",class:r.playPauseButton,disabled:t,iconStart:e?"pause-f":"play-f",label:i,onclick:s,round:!0,title:i,type:"button"})}_renderSeasonSelect(){const{messages:e,viewModel:t}=this,i=!t.sunLightingEnabled;return _("calcite-select",{class:this.classes(r.seasonPicker),disabled:i,label:e.season,onCalciteSelectChange:this._onSeasonChange},p.map((i=>_("calcite-option",{selected:t.currentSeason===i,value:i},e[i]))))}_renderDateOrSeason(){return"date"===this.dateOrSeason?this._renderDateOptions():this._renderSeasonSelect()}_renderSunLightingToggle(){const e=this.messages?.sunLightingToggle;return _("calcite-label",{key:"date-time-toggle",layout:"inline",scale:"s",title:e?.tooltip},_("calcite-checkbox",{checked:this.viewModel.sunLightingEnabled,class:r.sunLightingCheckbox,onCalciteCheckboxChange:this._onSunLightingCheckboxChange}),e?.label)}_renderShadowsToggle(){const e=this.messages.shadowsToggle;return _("calcite-label",{key:"shadow-toggle",layout:"inline",scale:"s",title:e?.tooltip},_("calcite-checkbox",{checked:this.viewModel.directShadowsEnabled,class:r.shadowsCheckbox,onCalciteCheckboxChange:this._onShadowCheckboxChange}),e.label)}_makeGoToTime(e){return()=>{this.viewModel.timeSliderPosition=e}}};e([o(),k("esri/widgets/Daylight/t9n/Daylight")],M.prototype,"messages",void 0),e([o(),k("esri/widgets/support/t9n/timezone")],M.prototype,"timezoneMessages",void 0),e([o()],M.prototype,"headingLevel",void 0),e([o()],M.prototype,"icon",null),e([o()],M.prototype,"label",null),e([o()],M.prototype,"playSpeedMultiplier",null),e([o()],M.prototype,"timeSliderSteps",null),e([o()],M.prototype,"view",null),e([o({type:d})],M.prototype,"viewModel",void 0),e([o({type:c,nonNullable:!0})],M.prototype,"visibleElements",void 0),e([o({cast(e){return"season"===e||"date"===e?e:(t.getLogger(this).warn(`"${e}" is not a valid option. Acceptable values are only "date" or "season". Defaulting to "${D}".`),D)}})],M.prototype,"dateOrSeason",void 0),e([o()],M.prototype,"_timeSlider",void 0),M=e([l("esri.widgets.Daylight")],M);const f=[u.interactive,u.anchor],P=M;export{P 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{createPolyline as t}from"../../../views/draw/support/createUtils.js";function e(e,l){const s=e.samples??[],n=s.length-1,r=[];let o=[];for(let t=0;t<=n;t++){const{x:e,y:l,z:p}=s[t];null!=p&&o.push([e,l,p]),t!==n&&null!=p||!o.length||(r.push(o),o=[])}return t(r,l,!0)}export{e as createLineGeometry};
|