@arcgis/core 5.0.0-next.37 → 5.0.0-next.39
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/Color.js +1 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/applications/Components/testUtils.d.ts +4 -0
- package/applications/Components/testUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02a65563779b4c64b2cf.js +1 -0
- package/assets/esri/core/workers/chunks/{328106e181e5957ceaa5.js → 09ac2bbc7327e6e6b5a2.js} +1 -1
- package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +1 -0
- package/assets/esri/core/workers/chunks/{b96af22ec1470905e4fb.js → 1c857191e5898aba50fe.js} +1 -1
- package/assets/esri/core/workers/chunks/2795e491f803654413d2.js +1 -0
- package/assets/esri/core/workers/chunks/{3904f8732c9953cb177d.js → 28b235b56a83c498d73f.js} +1 -1
- package/assets/esri/core/workers/chunks/36d15c35fbbd4dedd5cb.js +1 -0
- package/assets/esri/core/workers/chunks/48f805929fe6241952f5.js +1 -0
- package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +1 -0
- package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +1 -0
- package/assets/esri/core/workers/chunks/613cbac9cb925cd20b48.js +1 -0
- package/assets/esri/core/workers/chunks/{febce0d80f019dc2a427.js → 646f58b69d2354f1ef27.js} +1 -1
- package/assets/esri/core/workers/chunks/7eab0bb42f9f062522ef.js +1 -0
- package/assets/esri/core/workers/chunks/{5e34a183420e7007a989.js → 8e8d5422f57269d8c8d2.js} +1 -1
- package/assets/esri/core/workers/chunks/9100330ed4b4437c819d.js +1 -0
- package/assets/esri/core/workers/chunks/95cb062cae4c31c07124.js +1 -0
- package/assets/esri/core/workers/chunks/{ce8fc1ca229d53a4b68d.js → 96f798ee286b59396131.js} +50 -50
- package/assets/esri/core/workers/chunks/{e9bc3c6482ba778c9349.js → 9d95f38da21f97214f83.js} +1 -1
- package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +1 -0
- package/assets/esri/core/workers/chunks/{a8a017d7969562d21d2e.js → b48aceaeefa07214e430.js} +1 -1
- package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +1 -0
- package/assets/esri/core/workers/chunks/{d2a6f035022a3f060ffa.js → c320a29df40e85fb4a8e.js} +1 -1
- package/assets/esri/core/workers/chunks/{52c8687b473c9953c2f2.js → d9958654c6438f28237b.js} +1 -1
- package/assets/esri/core/workers/chunks/{27ec791318e81285c222.js → dca6a61fd239cf1ff90c.js} +1 -1
- package/assets/esri/core/workers/chunks/e66bcdfd75e0113d1cec.js +1 -0
- package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +1 -0
- package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +1 -0
- package/chunks/ChapmanAtmosphere.glsl.js +20 -20
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +38 -38
- package/chunks/Haze.glsl.js +23 -23
- package/config.js +1 -1
- package/core/Collection.js +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/geometry/support/buffer/BufferView.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/interfaces.d.ts +74 -0
- package/kernel.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/support/FeatureReductionCluster.js +1 -1
- package/layers/support/LabelClass.js +1 -1
- package/package.json +3 -3
- package/renderers/FlowRenderer.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/PieChartRenderer.js +1 -1
- package/rest/route/utils.js +1 -1
- package/rest/support/PointBarrier.js +1 -1
- package/rest/support/Stop.js +1 -1
- package/support/revision.js +1 -1
- package/support/tests/meshUtils.js +5 -0
- package/support/tests/serviceMockDependencies.js +5 -0
- package/support/tests/setupServiceMocksMesh.js +5 -0
- package/symbols/Font.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/LineSymbol.js +1 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/MarkerSymbol.js +1 -1
- package/symbols/PictureFillSymbol.js +1 -1
- package/symbols/PictureMarkerSymbol.js +1 -1
- package/symbols/TextSymbol.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/callouts/LineCallout3D.js +1 -1
- package/symbols/edges/Edges3D.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/Symbol3DVerticalOffset.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/layers/support/util.js +1 -1
- package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanApproximation.glsl.js +8 -8
- package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/environment/ChapmanRaymarching.glsl.js +16 -15
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +12 -12
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +8 -8
- package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +5 -0
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayoutField.js +5 -0
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +5 -0
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +5 -0
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +5 -0
- package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/views/BreakpointsOwner.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1d877c3c96c40eab906c.js +0 -1
- package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +0 -1
- package/assets/esri/core/workers/chunks/42f3e83826b3a3dedaaa.js +0 -1
- package/assets/esri/core/workers/chunks/44471962c30344dfafdf.js +0 -1
- package/assets/esri/core/workers/chunks/8ca83a9af9d24b192128.js +0 -1
- package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +0 -1
- package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +0 -1
- package/assets/esri/core/workers/chunks/ad3a4d139613b4c0e0b4.js +0 -1
- package/assets/esri/core/workers/chunks/c1c77a00f639eaee9c0d.js +0 -1
- package/assets/esri/core/workers/chunks/c5967133f3ba34a883f8.js +0 -1
- package/assets/esri/core/workers/chunks/c8d2cce4a426c72ab173.js +0 -1
- package/assets/esri/core/workers/chunks/e0a74250d22fa1d7dc18.js +0 -1
- package/assets/esri/core/workers/chunks/e3be67c762af672ec602.js +0 -1
- package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +0 -1
- package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +0 -1
- package/assets/esri/core/workers/chunks/f919f0db9f9ec0c649b9.js +0 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js +0 -26
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as m}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as _,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y,ZEROS as g,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as v}from"../../../../geometry/support/aaBoundingBox.js";import S from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as P}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as z}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as C}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as R}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as M}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as I}from"../../../../symbols/support/utils.js";import{transparentUnit as O}from"./constants.js";import{perObjectElevationAligner as j}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as T,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as E}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as U}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as V}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as L}from"./placementUtils.js";import{placePointOnGeometry as A,updateStageObjectGeometry as H,getLocalOriginForPoint as k,extendPointGraphicElevationContext as B,createStageObject as $}from"./pointUtils.js";import{initFastSymbolUpdatesState as N,updateFastSymbolUpdatesState as q,evaluateModelTransformScale as J,ConvertOptions as Z}from"../support/FastSymbolUpdates.js";import{createTexture as W,requiresHalfTexelOffset as K,defaultBoundingBox as Q,defaultSymbolSizeRatio as X,defaultTexSize as Y}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as ee}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as te}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as re}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as ie}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as se}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as oe}from"../../webgl-engine/materials/HUDMaterial.js";const ae=_(0,0,1),ne=16,le=1.5,ce=[Y*X,Y*X];class he extends V{static{this.PRIMITIVE_SIZE=ce}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,ye(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=I(this.symbolLayer),i=de(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ne);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let i=this._cimData;if(r&&i&&i.symbol||this.logger.error("Can't create texture, CIM data is undefined"),i.primitiveOverrides){i=s(i);const o=i.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(i.symbol,o)}const o=u(JSON.stringify(i));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(i.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?z(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&C(i.symbol,c,!0);const h=w.getEnvelope(i,null,n.resourceManager);if(h?.width&&h.height){const e=h.x+h.width/2,t=h.y+h.height/2,r=n.rasterize({type:"cim",data:i},h.width,h.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),s=new M({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=pe("relative",s),a=new ie(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new ie(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:pe(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;ue(t)&&(e.verticalOffset=new te(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!!has("enable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(me(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>W(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=K(t),e.distanceFieldBoundingBox=Q;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/X,this._createMaterial(e)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=_e(c,o),e.textureId=c.id}this._createMaterial(e)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,n=a?.symbol;w.fetchResources(n,s.resourceManager,o,r),w.fetchFonts(n,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await P(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new S(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return fe(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=me(this._getPrimitive())?le:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(me(this._getPrimitive()))return O;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const t=this._materialColor;if(null==t){return null==this._getPrimitive()?y:g}return e.toUnitRGBA(t)}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(c(t)):ne)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new oe(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=N(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new oe(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=E(e.color,r),e.outlineColor=E(e.outlineColor,r),this._materials[1]=new oe(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?c(r)/t:"number"==typeof s&&isFinite(s)?c(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=A(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getDrivenUInt8Color(a,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=d(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const o=A(r);if(!o)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const a=H(s,this._context,o,i);if(null==a)return!1;const n=k(this._context,o);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=a,B(t,o,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(he.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!q(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=de(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push(()=>{this._patchTask=o(this._patchTask),this._patchTask=r(e=>this._context.schedule(async(e,r)=>{const s=await t(u.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=_e(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},e))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ge}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=re(r,{normal:ae,color:i,rotation:s,size:o,centerOffsetAndDistance:xe,featureAttribute:l,olidColor:h}),m=$(this._context,t,u,a,n);if(null==m)return null;const d=new D(this,m.object,null,j,a);return d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),B(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=ee;const n=this._context.clippingExtent;if(null!=n&&!v(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=re(r,{normal:ae,position:a,color:i,rotation:s,size:o,featureAttribute:l,olidColor:u}),d=new se(m,{layerViewUid:h,graphicUid:c}),p=new U(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=J(be,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new Z({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:_(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function ue(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function me(e){return null!=e&&("cross"===e||"x"===e)}function de(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function pe(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in L?L[e]:L.center}function _e({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function fe(e){return e.resource?.href?null:e.resource?.primitive??R}function ye(e){return 1===(e.material?.color?.a??0)&&null!=fe(e)}const ge={mode:"relative-to-ground",offset:0},xe=x(0,0,0,1),be=f();export{he as Graphics3DIconSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as m}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as _,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y,ZEROS as g,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as v}from"../../../../geometry/support/aaBoundingBox.js";import S from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as P}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as z}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as C}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as R}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as M}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as I}from"../../../../symbols/support/utils.js";import{transparentUnit as O}from"./constants.js";import{perObjectElevationAligner as j}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as T,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as E}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as U}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as V}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as L}from"./placementUtils.js";import{placePointOnGeometry as A,updateStageObjectGeometry as H,getLocalOriginForPoint as k,extendPointGraphicElevationContext as B,createStageObject as $}from"./pointUtils.js";import{initFastSymbolUpdatesState as N,updateFastSymbolUpdatesState as q,evaluateModelTransformScale as J,ConvertOptions as Z}from"../support/FastSymbolUpdates.js";import{createTexture as W,requiresHalfTexelOffset as K,defaultBoundingBox as Q,defaultSymbolSizeRatio as X,defaultTexSize as Y}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as ee}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as te}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as re}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as ie}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as se}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as oe}from"../../webgl-engine/materials/HUDMaterial.js";const ae=_(0,0,1),ne=16,le=1.5,ce=[Y*X,Y*X];class he extends V{static{this.PRIMITIVE_SIZE=ce}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,ye(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=I(this.symbolLayer),i=de(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ne);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let i=this._cimData;if(r&&i&&i.symbol||this.logger.error("Can't create texture, CIM data is undefined"),i.primitiveOverrides){i=s(i);const o=i.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(i.symbol,o)}const o=u(JSON.stringify(i));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(i.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?z(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&C(i.symbol,c,!0);const h=w.getEnvelope(i,null,n.resourceManager);if(h?.width&&h.height){const e=h.x+h.width/2,t=h.y+h.height/2,r=n.rasterize({type:"cim",data:i},h.width,h.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),s=new M({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=pe("relative",s),a=new ie(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new ie(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:pe(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;ue(t)&&(e.verticalOffset=new te(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!!has("enable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(me(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>W(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=K(t),e.distanceFieldBoundingBox=Q;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/X,this._createMaterial(e)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=_e(c,o),e.textureId=c.id}this._createMaterial(e)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,n=a?.symbol;w.fetchResources(n,s.resourceManager,o,r),w.fetchFonts(n,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await P(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new S(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return fe(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=me(this._getPrimitive())?le:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(me(this._getPrimitive()))return O;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const t=this._materialColor;if(null==t){return null==this._getPrimitive()?y:g}return e.toUnitRGBA(t)}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(c(t)):ne)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new oe(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=N(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new oe(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=E(e.color,r),e.outlineColor=E(e.outlineColor,r),this._materials[1]=new oe(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?c(r)/t:"number"==typeof s&&isFinite(s)?c(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=A(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getDrivenUInt8Color(a,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=d(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const o=A(r);if(!o)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const a=H(s,this._context,o,i);if(null==a)return!1;const n=k(this._context,o);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=a,B(t,o,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(he.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!q(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=de(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push(()=>{this._patchTask=o(this._patchTask),this._patchTask=r(e=>this._context.schedule(async(e,r)=>{const s=await t(u.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=_e(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},e))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ge}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=re(r,{normal:ae,color:i,rotation:s,size:o,centerOffsetAndDistance:xe,featureAttribute:l,olidColor:h}),m=$(this._context,t,u,a,n);if(null==m)return null;const d=new D(this,m.object,null,j,a);return d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),B(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=ee;const n=this._context.clippingExtent;if(null!=n&&!v(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=re(r,{normal:ae,position:a,color:i,rotation:s,size:o,featureAttribute:l,olidColor:u}),d=new se(m,{layerViewUid:h,graphicUid:c}),p=new U(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=J(be,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new Z({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:_(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function ue(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function me(e){return null!=e&&("cross"===e||"x"===e)}function de(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function pe(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in L?L[e]:L.center}function _e({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function fe(e){return e.resource?.href?null:e.resource?.primitive??R}function ye(e){return 1===(e.material?.color?.a??0)&&null!=fe(e)}const ge={mode:"relative-to-ground",offset:0},xe=x(0,0,0,1),be=f();export{he as Graphics3DIconSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as s}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as a}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as o}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as h}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as m}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as d}from"./Graphics3DSymbolLayer.js";import{computeCentroid as f}from"./graphicUtils.js";import{createStageObject as u,extendPointGraphicElevationContext as g}from"./pointUtils.js";import{SymbolComplexity as v}from"./SymbolComplexity.js";import{Attribute as y}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as x,Parameters as _,uniqueMaterialIdentifier as C}from"../../webgl-engine/materials/LineCalloutMaterial.js";class O extends d{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,w),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new x(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const r=new _,n=this.symbol,s=n.callout;if(s.color){const t=e.toUnitRGBA(s.color);t[3]*=this._getLayerOpacity(),r.color=t}else r.color=i;if(r.size=t(s.size||0),n.verticalOffset){const{screenLength:e,minWorldLength:i,maxWorldLength:s}=n.verticalOffset;r.verticalOffset={screenLength:t(e),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}r.borderColor=null!=s.border?.color?e.toUnitRGBA(s.border.color):null;const a="object"===n.symbolLayers.at(0).type,o="label-3d"===n.type;return r.occlusionTest=!a&&!has("enable-feature:non-occluded-hud"),a&&(r.shaderPolygonOffset=0),r.hudDepthAlignStart=o,r.hasSlicePlane=this._context.slicePlaneEnabled,r.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,r}_defaultElevationInfoNoZ(){return G}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,i=this.createElevationContextForGraphic(n,r.elevationOffset||0),s=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===s.type||!s.symbolLayers.some(e=>"object"===e.type||"text"===e.type));if("label-3d"!==s.type&&o)return null;if("point-3d"===s.type&&s.symbolLayers.every(e=>"text"===e.type&&!a(e)))return null;const l=f(n.geometry);return null==l?null:this._createAs3DShape(l,i,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=l(O.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=c(r.mode)}computeComplexity(){return new v({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=C(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new x(r,this._context.spherical),t.set(n,e)),e}return new x(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const s=this._context.layerViewUid,a=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:s}),l=this._getOrCreateMaterial(r,i),h=new b(l,j(r),null,1,a),d=u(this._context,e,h,t,n);if(null==d)return null;const f=new p(this,d.object,null,o,t);return f.metadata=new m(r.elevationOffset),f.alignedSampledElevation=d.sampledElevation,f.needsElevationUpdates=c(t.mode),g(f,e,this._context.elevationProvider),f}}function j(e){const{translation:t,centerOffset:r}=e,n=new y(t?[t[0],t[1],t[2]]:[0,0,0],P,3,!0),i=new y(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],P,4,!0);return[["position",n],["normal",new y([0,0,1],P,3,!0)],["centerOffsetAndDistance",i]]}const P=[0],G={mode:"relative-to-ground",offset:0},w={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class E extends s{constructor(e,t,i=r(),s=n(),a=0,o="world",l=0){super(e,t),this.translation=i,this.centerOffset=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class S extends h{}export{O as Graphics3DLineCalloutSymbolLayer,S as LineCalloutCreationContext,E as LineCalloutSymbolLayerRenderingInfo};
|
|
5
|
+
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as s}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as a}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as o}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as h}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as m}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as d}from"./Graphics3DSymbolLayer.js";import{computeCentroid as f}from"./graphicUtils.js";import{createStageObject as u,extendPointGraphicElevationContext as g}from"./pointUtils.js";import{SymbolComplexity as v}from"./SymbolComplexity.js";import{Attribute as y}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as x,Parameters as _,uniqueMaterialIdentifier as C}from"../../webgl-engine/materials/LineCalloutMaterial.js";class O extends d{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,w),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new x(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const r=new _,n=this.symbol,s=n.callout;if(s.color){const t=e.toUnitRGBA(s.color);t[3]*=this._getLayerOpacity(),r.color=t}else r.color=i;if(r.size=t(s.size||0),n.verticalOffset){const{screenLength:e,minWorldLength:i,maxWorldLength:s}=n.verticalOffset;r.verticalOffset={screenLength:t(e),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}r.borderColor=null!=s.border?.color?e.toUnitRGBA(s.border.color):null;const a="object"===n.symbolLayers.at(0).type,o="label-3d"===n.type;return r.occlusionTest=!a&&!has("enable-feature:non-occluded-hud"),a&&(r.shaderPolygonOffset=0),r.hudDepthAlignStart=o,r.hasSlicePlane=this._context.slicePlaneEnabled,r.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,r}_defaultElevationInfoNoZ(){return G}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,i=this.createElevationContextForGraphic(n,r.elevationOffset||0),s=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===s.type||!s.symbolLayers.some(e=>"object"===e.type||"text"===e.type));if("label-3d"!==s.type&&o)return null;if("point-3d"===s.type&&s.symbolLayers.every(e=>"text"===e.type&&!a(e)))return null;const l=f(n.geometry);return null==l?null:this._createAs3DShape(l,i,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=l(O.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=c(r.mode)}computeComplexity(){return new v({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=C(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new x(r,this._context.spherical),t.set(n,e)),e}return new x(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const s=this._context.layerViewUid,a=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:s}),l=this._getOrCreateMaterial(r,i),h=new b(l,j(r),null,1,a),d=u(this._context,e,h,t,n);if(null==d)return null;const f=new p(this,d.object,null,o,t);return f.hiddenIfDeconflicted=!0,f.metadata=new m(r.elevationOffset),f.alignedSampledElevation=d.sampledElevation,f.needsElevationUpdates=c(t.mode),g(f,e,this._context.elevationProvider),f}}function j(e){const{translation:t,centerOffset:r}=e,n=new y(t?[t[0],t[1],t[2]]:[0,0,0],P,3,!0),i=new y(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],P,4,!0);return[["position",n],["normal",new y([0,0,1],P,3,!0)],["centerOffsetAndDistance",i]]}const P=[0],G={mode:"relative-to-ground",offset:0},w={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class E extends s{constructor(e,t,i=r(),s=n(),a=0,o="world",l=0){super(e,t),this.translation=i,this.centerOffset=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class S extends h{}export{O as Graphics3DLineCalloutSymbolLayer,S as LineCalloutCreationContext,E as LineCalloutSymbolLayerRenderingInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{p as e,i as t}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,setMin as a,setMax as n,isPoint as r,empty as
|
|
5
|
+
import{p as e,i as t}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,setMin as a,setMax as n,isPoint as r,empty as l,center as g,offset as c}from"../../../../geometry/support/aaBoundingBox.js";import{evaluateElevationInfoAtPoint as o}from"./elevationAlignmentUtils.js";import{demResolutionForBoundingBox as h}from"./graphicUtils.js";class d{constructor(e,t,i){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=i}}class b{_getFlag(e){return(this._flags&e)===e}_setFlag(e,t){t?this._flags|=e:this._flags&=~e}get needsElevationUpdates(){return this._getFlag(2)}set needsElevationUpdates(e){this._setFlag(2,e)}get useObjectOriginAsAttachmentOrigin(){return this._getFlag(4)}set useObjectOriginAsAttachmentOrigin(e){this._setFlag(4,e)}get hiddenIfDeconflicted(){return this._getFlag(8)}set hiddenIfDeconflicted(e){this._setFlag(8,e)}get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,i,s,a,n=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._sharedResource=i,this.elevationAligner=s,this.elevationContext=a,this._edgeState=n,this.type="object3d",this._stageLayer=null,this._flags=0,this.alignedSampledElevation=0}initialize(e){this._stageLayer=e}destroy(){if(!this._stageLayer)return;const e=this._stageLayer.stage;this._getFlag(1)&&(this._stageLayer.remove(this.stageObject),this._setFlag(1,!1)),e.renderer.edgeView?.removeObject(this.stageObject),this.stageObject.dispose(),this._sharedResource?.release(),this._stageLayer=null}get usedMemory(){return this.graphics3DSymbolLayer.usedMemory}layerOpacityChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;if(null==s)return;const n=u(s.baseMaterial);s.edgeMaterial.objectTransparency!==n&&(s.edgeMaterial.objectTransparency=n,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView(t=>t.updateAllComponentOpacities(i,[e]))}updateHighlights(e){}slicePlaneEnabledChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;null!=s&&a.stage.renderer.withEdgeView(a=>{a.updateAllComponentMaterials(i,s.edgeMaterial,e,!t),s.hasSlicePlane=e})}setVisibility(e){const{_edgeState:t,stageObject:i,_stageLayer:s}=this;null!=s&&this.visible!==e&&(i.visible=e,e&&!this._getFlag(1)&&(s.add(i),this._setFlag(1,!0)),null!=t&&s.stage.renderer.withEdgeView(s=>{s.hasObject(i)?s.updateObjectVisibility(i,e):e&&this._addOrUpdateEdgeObject(t,s,!1)}))}get visible(){return this._getFlag(1)&&this.stageObject.visible}alignWithElevation(e,t,i){if(null==this.elevationAligner)return;const s=(i,s)=>o(i,e,this.elevationContext,t,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,s,t),this.resetEdgeObject(i)}alignWithAbsoluteElevation(e,t,i){const s=(t,i)=>{i.sampledElevation=e,i.verticalDistanceToGround=0,i.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,this.graphics3DSymbolLayer.view.spatialReference,s,t),this.resetEdgeObject(i)}getCenterObjectSpace(){return this.stageObject.boundingVolumeObjectSpace.bounds.center}getBoundingBoxObjectSpace(e=s()){const t=this.stageObject.boundingVolumeObjectSpace;return a(e,t.min),n(e,t.max),e}computeAttachmentOrigin(i){const s=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)i.render.origin[0]+=s[12],i.render.origin[1]+=s[13],i.render.origin[2]+=s[14],i.render.num++;else for(const a of this.stageObject.geometries)a.computeAttachmentOrigin(m)&&(e(m,m,s),t(i.render.origin,i.render.origin,m),i.render.num++)}async getProjectedBoundingBox(t,i,s,a,n){const o=this.getBoundingBoxObjectSpace(n),d=p,b=r(o)?1:d.length;for(let r=0;r<b;r++){const t=d[r];j[0]=o[t[0]],j[1]=o[t[1]],j[2]=o[t[2]],e(j,j,this.stageObject.transformation),O[3*r]=j[0],O[3*r+1]=j[1],O[3*r+2]=j[2]}if(!t(O,0,b))return null;l(o);let u=null;this.calculateRelativeScreenBounds&&(u=this.calculateRelativeScreenBounds());for(let e=0;e<3*b;e+=3){for(let t=0;t<3;t++)o[t]=Math.min(o[t],O[e+t]),o[t+3]=Math.max(o[t+3],O[e+t]);u&&s.push({location:O.slice(e,e+3),screenSpaceBoundingRect:u})}if(i?.service&&"absolute-height"!==this.elevationContext.mode){g(o,m);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let t=0;if(i.useViewElevation)t=i.service.getElevation(m[0],m[1],e)??0;else try{const s=h(o,i.service.spatialReference,i);t=await i.service.queryElevation(m[0],m[1],a,s,e)??0}catch(v){}c(o,0,0,-this.alignedSampledElevation+t)}return o}addObjectState(e){0===e.stateType&&e.addObject(this.stageObject,this.stageObject.highlight(e.highlightName)),1===e.stateType&&e.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeByObject(this.stageObject)}resetEdgeObject(e){const{_edgeState:t,stageObject:i,_stageLayer:s,visible:a}=this;null!=t&&s.stage.renderer.withEdgeView(s=>{a?this._addOrUpdateEdgeObject(t,s,e):s.removeObject(i)})}_addOrUpdateEdgeObject(e,t,i){const s=u(e.baseMaterial);e.edgeMaterial.objectTransparency=s,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!i).then(()=>this._stageLayer?.sync())}}function u(e){return e.transparent?0:1}const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],j=i(),m=i(),p=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{b as Graphics3DObject3DGraphicLayer,d as Object3DEdgeState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as r}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as p}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as r}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as p}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as u}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as y}from"./graphicUtils.js";import{LabelPlacement as v,LabelParameters as x}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as b,verticalPlacementFromAlignment as O,textRenderAlignmentFromHorizontalPlacement as P,horizontalPlacementToAnchorX as w,anchorFromPlacements as j,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as _,updateStageObjectGeometry as E,getLocalOriginForPoint as z,extendPointGraphicElevationContext as C,createStageObject as F}from"./pointUtils.js";import{getFontMetrics as G}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as L}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import U from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as D}from"../../webgl-engine/materials/HUDMaterial.js";const R=a(0,0,1);class T extends g{constructor(e,t,r,s){super(e,t,r,s),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=y(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await A.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,r=_(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const s=this.view.focusAreasView?.containsGeometry(r)??!0,n=this.symbolLayer.text;if(null==n||""===n)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,a=new v(i);b(o,a.screenOffset);const l=new x(a,this.symbolLayer.horizontalAlignment,O(o));return l.isFocused=s??l.isFocused,this._createAs3DShape(t,r,n,l)}get needsUpdateFocus(){return!0}createLabel(e,t,r,s,n){const i=e.graphic,o=_(i.geometry);if(null==o)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(o)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,o,l,t,r,s,n))}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerScreenSizePerspectiveChanged(e,t){const r=!this.draped&&this._context.screenSizePerspectiveEnabled,s=r?this.view.screenSizePerspective.labelParameters:null,n=r?this.view.screenSizePerspective.parameters:null;I(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({screenSizePerspective:s,screenSizePerspectiveAlignment:n})})}layerElevationInfoChanged(e,t){return I(e,t,(e,t)=>{this.graphics3DGraphicLayerElevationInfoChanged(t,e)}),1}slicePlaneEnabledChanged(e,t){return I(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:s}=t;this.updateElevationContextForGraphic(r,e,s?.elevationOffset??0),t.needsElevationUpdates=h(r.mode)||"absolute-height"===r.mode}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:s,stageObject:n}=t;if(s.mode!==this.getGeometryElevationMode(r))return!1;const i=_(r);if(!i)return!1;s.updateFeatureExpressionFeature(e,this._context.layer);const o=E(n,this._context,i,s);if(null==o)return!1;const a=z(this._context,i);return n.geometries[0].localOrigin===a&&(t.alignedSampledElevation=o,C(t,i,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return H}_createAs3DShape(e,a,c,m,g,y=null,v=()=>m.placement.elevationOffset){const x=this.createElevationContextForGraphic(e,m.placement.elevationOffset),b=e.uid;let O=null,w=null;if(null==y){const e=P(m.horizontalPlacement);O=new U(c,e,this._textRenderParameters);let s=null;if(null!=this._context.sharedResources.textures){w=this._context.sharedResources.textures.fromData(O.key,()=>O.create()),w.managedTexture.events.on("unloaded",()=>s=t(s));const e=this._context.stage.renderView.textures.acquire(w.managedTexture.id);if(null==e||r(e))return w.release(),null;s=e}}const j=!!has("enable-feature:non-occluded-hud"),S=V(O,m),_={occlusionTest:!j,occludedFragmentFade:j,horizonCullingEnabled:j&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(_.shaderPolygonOffset=1e-4),y?_.textureId=y.id:w&&(_.textureId=w.managedTexture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.placement.verticalOffset;_.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}const E=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,z={screenOffset:_.screenOffset,anchorPosition:S,centerOffsetUnits:_.centerOffsetUnits,verticalOffset:_.verticalOffset,shaderPolygonOffset:_.shaderPolygonOffset,occlusionTest:_.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{parameters:e,labelParameters:t}=this.view.screenSizePerspective,r=G(this._textRenderParameters);_.screenSizePerspective=t,_.screenSizePerspectiveMinPixelReferenceSize=r.maxHeight,_.screenSizePerspectiveAlignment=e,z.fontHeight=r.maxHeight}_.hasSlicePlane=this._context.slicePlaneEnabled;const A=this._context.spherical,T=g?JSON.stringify(z):"";let I=g?.get(T);if(null==I){if(!m.isFocused&&E){const e=this.view.map?.focusAreas.style;_.color=p(_.color,e),_.outlineColor=p(_.outlineColor,e)}I=new D(_,A),g?.set(T,I)}const H=m.placement.translation,W=O?n(O.displayWidth,O.displayHeight):i,M=m.placement.centerOffset,$=R,k=y?l(0,0,0,0):null,N=L(I,{normal:$,position:H,size:W,centerOffsetAndDistance:M,uvi:k}),q=F(this._context,a,N,x,b);if(null==q)return null;const B=(t,r,s,n,i,o)=>{const a=v()||m.placement.elevationOffset;return this.updateElevationContextForGraphic(r,e,a),f(t,r,s,n,i,o)},J=new d(this,q.object,w,B,x);J.alignedSampledElevation=q.sampledElevation,J.hiddenIfDeconflicted=!0,J.needsElevationUpdates=h(x.mode)||"absolute-height"===x.mode,J.getScreenSize=(e=o())=>(e[0]=O?O.displayWidth:m.displaySize[0],e[1]=O?O.displayHeight:m.displaySize[1],e);const Y=new u(m.placement.elevationOffset,c);return J.metadata=Y,C(J,a,this._context.elevationProvider),J}}function I(e,t,r){e?.forEach(e=>{const s=t(e);null!=s&&r(s,e.graphic)})}function V(e,t){if("baseline"===t.verticalPlacement){const r=w[t.horizontalPlacement],s=null!=e?e.baselineAnchorY:0;return n(r,s)}const r=j(t.horizontalPlacement,t.verticalPlacement);return S[r]}const H={mode:"relative-to-ground",offset:0};export{T as Graphics3DTextSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{b as n,n as s,j as a,g as o,e as m}from"../../../chunks/vec32.js";import{create as
|
|
5
|
+
import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{b as n,n as s,j as a,g as o,e as m}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{create as u,fromValues as p}from"../../../geometry/support/ray.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";import{DepthRange as _}from"../webgl-engine/lib/DepthRange.js";function M(e,t,i){return 1===e?new y(t,i):new d(t,i)}class d{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,n,a){const{eye:c,center:l}=e;let u=c[2]*this._unitInMeters;const p=u,f=u-a,x=this._elevationProvider?.visibleElevationRange;x&&(u=f>=0?p-this._unitInMeters*x.minElevation:this._unitInMeters*x.maxElevation-p),r??=new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const _={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},M=Math.max(_.x,_.y,_.z);m(P,l,c),F[0]=P[0]>0?r.xmax:r.xmin,F[1]=P[1]>0?r.ymax:r.ymin,F[2]=P[2]>0?M/2:-M/2,m(F,F,c),s(P,P);const d=1.1*o(F,P)*this._unitInMeters,y=Math.sqrt(u*(u+2*this._referenceEllipsoid.radius)),E=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=E*w*this._unitInMeters,j=E*D*this._unitInMeters,b=i((u-j)/(g-j),0,1)**3,R=Math.min(t(y,d,b),y)*Math.max(Math.log(Math.abs(f)),1);return v(Math.min(R,Math.max(34064e4,M))/this._unitInMeters,I,this._unitInMeters,z)}}class y{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,c,l,h){const{eye:u}=r,f=n(u),M=f-this._referenceEllipsoid.radius,d=this._computeVirtualAltitude(M,h),y=this._elevationProvider?.visibleElevationRange.maxElevation??0,w=x(d),D=this._computeFarDistanceInternal(f,d,h),A=(Math.log(d)-E)/(g-E);v(D,i(I-A*(I-j),j,I),1,z);const V=this._referenceEllipsoid.radius+y,q=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,k=Math.max(V,q),H=f-k;if(w>0&&H>b){const i=s(F,a(F,r.eye,-1)),c=s(P,r.viewForward),h=e(o(i,c)),u=.5*r.fovY,f=Math.cos(u);let x=_.Infinite.near;if(h<=u)x=H*f;else{const e=s(F,r.viewUp),t=Math.tan(u),i=a(F,e,t),o=s(F,m(F,c,i)),l=p(r.eye,o,U);if(R.radius=k,R.intersectRay(l,F)){const e=m(F,F,r.eye);x=n(e)*f}}const M=.99*Math.min(l.near,x);if(M<_.Infinite.near&&M>z.near){const e=t(z.near,M,w);z.near=e}}return z}computeFarDistance(e,t){const i=n(e),r=i-this._referenceEllipsoid.radius,s=this._computeVirtualAltitude(r,t);return this._computeFarDistanceInternal(i,s,t)}_computeFarDistanceInternal(e,i,r){const n=this._referenceEllipsoid.radius+Math.min(0,r),s=x(i),a=Math.sqrt(i*(i+2*n)),o=e+this._referenceEllipsoid.radius;return 1.2*t(a,o,s)}_computeVirtualAltitude(e,t){const i=Math.abs(e-t);return Math.max(i,Math.abs(e))}}function v(e,t,i,r){const n=b/i,s=e/t;return s>n?(r.far=e,r.near=s):(r.near=n,r.far=r.near*t),r}const E=7.983,g=16.994,I=2e4,j=100,b=2,w=.001,D=1e-4,F=c(),P=c(),z={near:0,far:0},R=new f,U=u();export{y as NearFarHeuristicGlobal,M as createNearFarHeuristic,b as minNearDistanceInMeters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{watch as t,when as s,syncAndInitial as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as h}from"../../../2d/engine/flow/dataUtils.js";import u from"../../layers/FlowSubView3D.js";import{getFeatureTileId as p}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as f}from"./loadUtils.js";import{isRasterTile as T}from"../../terrain/TerrainData.js";import{descendantsAtLevel as g}from"../../terrain/tileUtils.js";const _={type:"delete"},y={type:"invalid"};let
|
|
5
|
+
import{__decorate as e}from"tslib";import{watch as t,when as s,syncAndInitial as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as h}from"../../../2d/engine/flow/dataUtils.js";import u from"../../layers/FlowSubView3D.js";import{getFeatureTileId as p}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as f}from"./loadUtils.js";import{isRasterTile as T}from"../../terrain/TerrainData.js";import{descendantsAtLevel as g}from"../../terrain/tileUtils.js";const _={type:"delete"},y={type:"invalid"};let D=class extends u{constructor(e){super(e),this._flowDataTiles=m(),this._resetTileData=!0,this._flowDataTilesSet=!1,this._throttledTriggerLoad=null,this._throttling=!1}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.addPromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.addPromise(t)},i),s(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.addPromise(e)},i),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=m();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=m();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i,workerHandle:l}=this,a=this.getSimulationSettings(e);if(null==a||null==l||0===s.size)return;const r=this._resetTileData;this._resetTileData=!1;const o=m();s.forEach((e,t)=>{"delete"===e.type?(o.set(t,_),s.delete(t)):(r||"on-worker"!==e.type&&"invalid"!==e.type)&&(o.set(t,e),s.set(t,"invalid"===e.type?y:{type:"on-worker",sourceLevel:e.sourceLevel}))});const n={simulationSettings:a,flowExtentInfo:e.flowExtentInfo,flowDataTiles:o,reset:r,needsMagnitude:i,startPositions:this.startPositions(e)},{streamlines:d}=await l.generateTiledStreamlines(n,t);return d}getUpdating(){return super.getUpdating()||this._throttling}get loadRequirementsMet(){return super.loadRequirementsMet&&this._flowDataTilesSet}_getLoadedState(e){const{_layerIndex:t}=this,s=e.isDisposed;if(null==t||s)return null;const i=e.getLayerInfo(t,1);if(null==i)return null;const l=this._getRasterTile(i,e,t);return null==l?this._upsampleFlowData(t,i.upsampleInfo,e.lij,e.extent):{type:"loaded",data:this._createFlowDataTile(l,e.lij,e.extent,this._pixelSize),sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),p=Math.floor((1-n[1]-o)*h.height);return{type:"loaded",data:this._createFlowDataTile(r,s,i,d,u,p),sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&T(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=h(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new f(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,_);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(w(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(w(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=g(n,o).map(e=>[p(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const u=1<<o-n[0],c=1/u,f=n[1]*u,T=n[2]*u,_=l.acquire();for(const[p,g]of h){if(w(r.get(p),e))continue;const l=d();i.getExtent(g[0],g[1],g[2],l);const a=1-(g[1]-f)*c-c,o=(g[2]-T)*c;_.init(e,o,a,c);const n=this._upsampleFlowData(t,_,g,l),h=this._setTileData(p,n);s||=h}return l.release(_),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){this._flowDataTiles=e,this._resetTileData=!0,this._flowDataTilesSet=!0}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const t of e.keys())e.set(t,y)}get usedMemory(){const e=9*this._pixelSize**2,t=(this._flowDataTiles.size??0)*e;return super.usedMemory+t}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function m(){return new Map}function w(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}e([r()],D.prototype,"_throttling",void 0),D=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],D);export{D 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{signal as
|
|
5
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{signal as r}from"../../../../core/signal.js";import{intersectsSphere as s}from"../../../../geometry/support/frustum.js";import{Sphere as t}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as i}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as n}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as a}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as o}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as u}from"./GaussianSplatTextureAtlas.js";class h{constructor(e){this._updating=r(!1),this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._minimumBoundingSphere=new t,this._renderer=e,this._orderTexture=new o(this._renderer.renderingContext),this._fadingTexture=new a(this._renderer.renderingContext),this._textureAtlas=new u(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new n(i(s))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}isUpdating(){return this._updating.value}destroy(){this._pendingSortTask=!1,this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>this._handleSortComplete()).catch(()=>this._handleSortComplete()))}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this.requestSort():this._updating.value=!1}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(r){if(this._bufferCapacity<r){const s=Math.ceil(r*e);this._atlasIndicesBuffer=new Uint32Array(s),this._sortedAtlasIndicesBuffer=new Uint32Array(s),this._distancesBuffer=new Float64Array(s),this._sortOrderBuffer=new Uint32Array(s),this._bufferCapacity=s}}async _sortOnWorker(){if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);let e=this._visibleGaussianTiles.reduce((e,r)=>e+r.gaussianAtlasIndices.length,0);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const r=this._renderer.camera.frustum,t=this._renderer.camera.eye,i=t[0],n=t[1],a=t[2];let o=0;if(this._visibleGaussianTiles.forEach(t=>{const u=t.gaussianAtlasIndices,h=t.positions;if(this._minimumBoundingSphere.center=t.obb.center,this._minimumBoundingSphere.radius=t.obb.radius+t.maxScale,s(r,this._minimumBoundingSphere))for(let e=0;e<u.length;e++){this._atlasIndicesBuffer[o]=u[e];const r=3*e,s=h[r]-i,t=h[r+1]-n,d=h[r+2]-a;this._distancesBuffer[o]=s*s+t*t+d*d,this._sortOrderBuffer[o]=o,o++}else e-=u.length}),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);const u={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:e,preciseSort:!1};await(this._workerHandle?.sort(u).then(r=>{this._distancesBuffer=r.distances,this._sortOrderBuffer=r.sortedOrderIndices;const s=this._sortedAtlasIndicesBuffer.subarray(0,e);for(let i=0;i<e;i++)s[i]=this._atlasIndicesBuffer[r.sortedOrderIndices[i]];this._orderTexture.setData(s,e);const t=this._renderer.view.qualitySettings.gaussianSplat.maxAllowedVisibleGaussians;this.visibleGaussians=Math.min(e,t),this._renderer.requestRender(1)}))}}export{h as GaussianSplatDataStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return
|
|
5
|
+
import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(i,e){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,i.fadeProgress=null)}_updateTileFading(i,t){const{fadeProgress:a,fadeDirection:s}=i;if(null==a)return;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),o=Math.min(a+r,1),u=n*(1-(0===s?e.fadeInEase:e.fadeOutEase)(o)),g=1===o;i.opacityModifier=g?d:d-u,g?this._stopTileFading(i):i.fadeProgress=o,this._updateOpacityModifier(i)}_updateOpacityModifier(i){const e=255*i.opacityModifier;for(let t=0;t<i.pageIds.length;t++){const a=i.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(e,a)}}_instantTileFading(i,e){i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){this.layerView.tileHandles.forEach(i=>{null!=i.fadeProgress&&this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection))}),this.layerView.updateGaussians(),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.isVisible=!1,this.layerView.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}}export{e as GaussianSplatFadeHelper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,on as h,syncAndInitial as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{h as m}from"../../../chunks/vec32.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as O,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as P}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as j}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as V,noBudget as A}from"../../support/Scheduler.js";import{Texture as k}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let I=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new x,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[19,e=>8!==e||this.hasHighlights],[20,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new j(t,e.state.viewingMode),i);const n=this._bindParameters;this.addHandles([a(()=>s.updating,()=>this.events.emit("content-changed"),d),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),d),h(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>O(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,r=>{n.highlights=r,n.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(V.OVERLAY_RENDERER,this)]);const o=this._camera;o.near=1,o.far=1e4,o.relativeElevation=null,n.slot=19,n.camera=o,n.updateLighting([new F(y())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?L:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(A,e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._renderContext.output;return this._renderContext.output=e,this._bindParameters.slot=2===e?20:19,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),8===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=L),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||2===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=L),!this.renders(o))return d.renderOccludedMask=P,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(8===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,z);const r=this._techniques.get(E,z);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,B[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(8===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(a,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=P,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new U(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new k(this._rctx,i,t)}get test(){}};e([u()],I.prototype,"hasHighlights",void 0),e([u()],I.prototype,"renderOccludedFlags",void 0),e([u()],I.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],I.prototype,"parent",void 0),e([u({readOnly:!0})],I.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isEmpty",null),I=e([p("esri.views.3d.terrain.OverlayRenderer")],I);class U{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const B=[[1,.5,.5],[.5,.5,1]],H=-2,L=4,z=new M;z.hasAlpha=!0;export{I as OverlayRenderer,H as drapedZ,L as overlayRenderOccludedFlag};
|
|
5
|
+
import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,on as h,syncAndInitial as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{h as m}from"../../../chunks/vec32.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as b,renderHighlightBuffer as O}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as S}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as P}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as j}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as V,noBudget as A}from"../../support/Scheduler.js";import{Texture as k}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let I=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new x,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[19,e=>8!==e||this.hasHighlights],[20,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new j(t,e.state.viewingMode),i),this.addHandles([a(()=>s.updating,()=>this.events.emit("content-changed"),d),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),d),h(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>b(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(V.OVERLAY_RENDERER,this)]);const n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=19,this._bindParameters.camera=n,this._bindParameters.updateLighting([new F(y())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new S(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?L:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(A,e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._renderContext.output;return this._renderContext.output=e,this._bindParameters.slot=2===e?20:19,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),8===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=L),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||2===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=L),!this.renders(o))return d.renderOccludedMask=P,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(8===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,z);const r=this._techniques.get(E,z);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,B[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(8===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),O(a,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=P,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new U(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new k(this._rctx,i,t)}get test(){}};e([u()],I.prototype,"hasHighlights",void 0),e([u()],I.prototype,"renderOccludedFlags",void 0),e([u()],I.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],I.prototype,"parent",void 0),e([u({readOnly:!0})],I.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isEmpty",null),I=e([p("esri.views.3d.terrain.OverlayRenderer")],I);class U{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const B=[[1,.5,.5],[.5,.5,1]],H=-2,L=4,z=new M;z.hasAlpha=!0;export{I as OverlayRenderer,H as drapedZ,L as overlayRenderOccludedFlag};
|