@arcgis/core 5.1.0-next.80 → 5.1.0-next.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d5fd99ee40bba9b48a54.js → 1e2c0c6d724f7639d4c1.js} +27 -27
- package/assets/esri/core/workers/chunks/2bd69a7734d170e190ed.js +1 -0
- package/assets/esri/core/workers/chunks/{c1d4110aa494a1dba3c4.js → 455d08294e0f5c5509ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{5da2051f548c2942e01a.js → 4af39fa53bc0b79101ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{87d2021e91d025a2a142.js → 5c7ba4b8a9ec2e2e02b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f82a0f134ea912fc686.js → 66fe1634c6e8f72fc653.js} +1 -1
- package/assets/esri/core/workers/chunks/{96b13b6042cdf5833d39.js → 67abbe81c16de26f61d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f6f5dad52747d252aac.js → 7cee7ffaf941a4fe23b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb9e3e7cd532ac4353f1.js → 84821dff3bcc51161802.js} +2 -2
- package/assets/esri/core/workers/chunks/{6a0352d20596ca3f4b64.js → 88eb1e4320c4ada01711.js} +1 -1
- package/assets/esri/core/workers/chunks/97719271a3e4c9f2b2c9.js +1 -0
- package/assets/esri/core/workers/chunks/9cac70164d8528c283af.js +1 -0
- package/assets/esri/core/workers/chunks/ac5999c88c27b49cd760.js +1 -0
- package/assets/esri/core/workers/chunks/b811d62284be95f4beb6.js +1 -0
- package/assets/esri/core/workers/chunks/{3b9100c59a8050f4834e.js → bbc27d9285162696d089.js} +1 -1
- package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +1 -0
- package/assets/esri/core/workers/chunks/{d7324a00ed576e7a37b1.js → c758e16b57c96ce88294.js} +1 -1
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +1 -0
- package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +1 -0
- package/assets/esri/core/workers/chunks/d9c3f14eee4db7a7137b.js +1 -0
- package/assets/esri/core/workers/chunks/{3f242f8d092f601c3abf.js → f77d23ee60c876b01e4b.js} +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/config.js +1 -1
- package/form/elements/inputs.js +1 -1
- package/geometry/SpatialReference.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +2 -0
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.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/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +2 -0
- package/views/VideoView.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPen.js +2 -0
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/types.d.ts +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/support/unnormalizationUtils.js +2 -0
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/assets/esri/core/workers/chunks/2da62687ff678b690839.js +0 -1
- package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +0 -1
- package/assets/esri/core/workers/chunks/4f9d027055f3a616173c.js +0 -1
- package/assets/esri/core/workers/chunks/63381d81adce0a0d2089.js +0 -1
- package/assets/esri/core/workers/chunks/6dbddf5ab1867ac2ac80.js +0 -1
- package/assets/esri/core/workers/chunks/99c189e1de2b1f14799b.js +0 -1
- package/assets/esri/core/workers/chunks/9aa6b32cb65fbaa93218.js +0 -1
- package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +0 -1
- package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +0 -1
- package/views/interactive/editGeometry/unnormalizationHelper.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import{makeHandle as i}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{rad2deg as n}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,watch as r,sync as d,initial as c}from"../../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as g,len as m,set as v,angle as w,dot as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../geometry/Point.js";import{fromPositionAndNormal as b,projectPoint as y,create as S}from"../../../../geometry/support/plane.js";import{creationElevationInfo as T}from"./ViewshedConfiguration.js";import{ViewshedSubTool as C}from"./ViewshedSubTool.js";import{Manipulator3D as D}from"../../interactive/Manipulator3D.js";import{Settings as M}from"../../interactive/editingTools/settings.js";import{ExtendedLineVisualElement as H}from"../../interactive/visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as I}from"../../interactive/visualElements/LaserlineVisualElement.js";import{toGraphic as j}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{AnalysisToolBase as P}from"../../../interactive/AnalysisToolBase.js";import{sketchKeys as E}from"../../../interactive/keybindings.js";import{newToolIntersector as L}from"../../../interactive/ToolIntersector.js";import{createScreenPointArrayFromEvent as k}from"../../../support/screenUtils.js";const A=Symbol("interactionVisuals");let O=class extends P{constructor(e){super(e),this.removeIncompleteOnCancel=!1,this.automaticManipulatorSelection=!1,this.multiTouchEnabled=!1,this._stagedViewshed=null,this._stagedViewshedComputedData=null,this._placementMode=G,this._creationState=!1,this._interactionVisualElements=null,this._settings=new M({getTheme:()=>this.view.effectiveTheme}),this._selectedManipulator=null}initialize(){this._intersector=L(this.view.state.viewingMode),this._createInteractionVisuals();const e=this.analysisViewData.viewshedComputedDataHandles;this.subToolHandles=s(()=>e,({viewshedComputedData:e})=>{const t=new C({analysis:this.analysis,analysisViewData:this.analysisViewData,parentTool:this,view:this.view,viewshedComputedData:e});return{subTool:t,remove:()=>{this.selectedViewshed===e.viewshed&&(this.selectedViewshed=null),t.destroy()}}}),this.addHandles([o(()=>this._valid,()=>this.finishToolCreation(),l),r(()=>this._stagedViewshed,e=>{const t=this.analysisViewData.viewshedComputedDataHandles;this._stagedViewshedComputedData=null!=e&&null!=t?this._findSubTool(e)?.viewshedComputedData:null},l),this.analysis.viewsheds.on("after-remove",e=>{const t=this._stagedViewshed;null!=t&&e.item===t&&this.analysis.viewsheds.add(t)}),r(()=>this.firstGrabbedManipulator,e=>{if(null!=e){const t=this._findSubTool(e)?.viewshed;this.selectedViewshed=t,this._selectManipulator(e)}else this._selectedSubTool?.onManipulatorSelectionChanged()},d),r(()=>this.view.activeTool,e=>{e!==this&&null!=e&&(this.selectedViewshed=null)}),o(()=>{const e=this.selectedViewshedComputedData;return null==e?null:{subTool:this._selectedSubTool,observer:e.elevationAlignedObserverRenderSpace,target:e.elevationAlignedTargetRenderSpace}},e=>{const{subTool:t,observer:i,target:s}=e;t?.moveInteractionState.dragging?this._updateInteractionVisualsLocation(i,!0):t?.scaleOrientInteractionState.dragging&&this._updateInteractionVisualsLocation(s,!1)},c),r(()=>this.creating,()=>this.updateInteractionVisualsVisibility()),r(()=>this.selectedViewshed,e=>{const t=this._selectedManipulator,i=this._selectedSubTool;null==e?this._selectManipulator(null):null!=t&&i.hasManipulator(t)||this._selectManipulator(i.discManipulator)},c)])}destroy(){this.subToolHandles=a(this.subToolHandles),this.removeHandles(A)}onDeactivate(){this.removeStaged(),this._creationState=!1}get updating(){return this.subToolHandles.some(({subTool:e})=>e.updating)}get _valid(){return this.analysisViewData.viewshedComputedDataHandles?.some(e=>e.viewshedComputedData.valid)??!1}get cursor(){return this.creating?"crosshair":null}get _selectedSubTool(){return this._findSubTool(this.selectedViewshed)}_selectManipulator(e){const t=this._selectedManipulator;t!==e&&(this._selectedManipulator=e,null!=t&&(t.selected=!1),null!=e&&(e.selected=!0),this._findSubTool(t)?.onManipulatorSelectionChanged(),this._selectedSubTool?.onManipulatorSelectionChanged())}get selectedViewshed(){return this.analysisViewData.selectedViewshed}set selectedViewshed(e){this.analysisViewData.selectedViewshed=e}get selectedViewshedComputedData(){return this._selectedSubTool?.viewshedComputedData}get stagedViewshed(){return this._stagedViewshed}get grabbing(){return this.subToolHandles.some(({subTool:e})=>e.grabbing)}get creating(){return this._creationState&&this.active}get isPlacingTarget(){return"placing-target"===this._creationState}place(e){this.selectedViewshed=null,this._placementMode=e,this._creationState="placing-observer",this._finishToolCreationIfValid()}onManipulatorSelectionChanged(){this.subToolHandles.forEach(e=>e.subTool.onManipulatorSelectionChanged())}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":E.cancel===e.key?this._cancelKeyHandler(e):E.delete.includes(e.key)&&this._deleteKeyHandler();break;case"hold":this.updateInteractionVisualsVisibility(!0)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickPlacementHandler(e)}onActivate(){this._placementMode=G}_clickPlacementHandler(e){if(!this.creating||this.hasFocusedManipulators)return;const i=this._intersectScreen(e,B);if(null!=i){if("placing-observer"===this._creationState){const e=new t({observer:i.mapPoint.clone(),elevationInfo:T,feature:i.feature});this.analysis.viewsheds.add(e),this._stagedViewshed=e,this._creationState="placing-target",this._updateStagedViewshed(i.scenePoint)}else if("placing-target"===this._creationState){this._updateStagedViewshed(i.scenePoint);const e=this._stagedViewshed;this._stagedViewshed=null,"multiple"===this._placementMode?this._creationState="placing-observer":(this._creationState=!1,this._stagedViewshed=null,this._finishToolCreationIfValid(),this.view.activeTool=null),this.selectedViewshed=e}e.stopPropagation()}}_doubleClickHandler(e){this.creating&&(this.removeStaged(),this._creationState=!1,this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(!this.creating)return;const t=this._intersectScreen(e,B);null!=t&&(this._updateInteractionVisualsLocation(t.scenePoint,!1),this._updateStagedViewshed(t.scenePoint))}_cancelKeyHandler(e){this.creating?this._onCancelWhileCreating(e):this.grabbing||(this.selectedViewshed=null,e.stopPropagation())}_onCancelWhileCreating(e){const t=this.removeStaged();this._finishToolCreationIfValid(),t?(this._creationState="placing-observer",this.selectedViewshed=null,"multiple"===this._placementMode&&e.stopPropagation()):this._creationState=!1}_deleteKeyHandler(){this.creating&&(this.removeStaged(),this._creationState="placing-observer"),null!=this.selectedViewshed&&this.analysis.viewsheds.remove(this.selectedViewshed)}_finishToolCreationIfValid(){this._valid&&this.finishToolCreation()}_updateStagedViewshed(e){const t=this._stagedViewshed,i=this._stagedViewshedComputedData;if(null==t||null==i)return;const{heading:s,tilt:n,farDistance:a}=x(this.view,i,e);t.farDistance=a,t.tilt=n,t.heading=s}removeStaged(){const e=this._stagedViewshed;return null!=e&&(this._stagedViewshed=null,this.analysis.viewsheds.remove(e),!0)}_intersectScreen(e,t){const i=k(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,n=t.scenePoint;if(!s.getIntersectionPoint(n))return null;const a=t.mapPoint;return a.spatialReference=this.view.spatialReference,this.view.renderCoordsHelper.fromRenderCoords(n,a),null==a?null:(t.feature=j(s,this.view),t)}_createInteractionVisuals(){this.removeHandles(A);const e=this._settings.visualElements,t=new I({view:this.view,attached:!1,style:{glowWidth:e.heightPlane.glowWidth,innerWidth:e.heightPlane.innerWidth},isDecoration:!0}),s=new H({view:this.view,extensionType:e.zVerticalLine.extensionType,attached:!1,innerWidth:1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._interactionVisualElements={laserline:t,verticalLine:s},this.addHandles([r(()=>e.zVerticalLine,e=>e.apply(s),l),r(()=>e.heightPlane,e=>e.apply(t),l),i(()=>{t.destroy(),s.destroy(),this._interactionVisualElements=null})],A)}updateInteractionVisualsVisibility(e=!1){const t=this.creating,i=this.analysisViewData.visible,s=this._selectedSubTool,n=this.selectedViewshedComputedData,a=(e,t)=>{const i=this._interactionVisualElements;null!=i&&(i.verticalLine.attached=t,i.laserline.attached=e)};if(t)return void a(i,!1);if(null==s||null==n)return void a(!1,!1);const o=s.moveInteractionState,l=e?o.grabbing:o.dragging,r=s.scaleOrientInteractionState,d=e?r.grabbing:r.dragging,c=i&&(l||d);if(a(c,l),c){const e=l?n.elevationAlignedObserverRenderSpace:n.elevationAlignedTargetRenderSpace;this._updateInteractionVisualsLocation(e,l)}}_updateInteractionVisualsLocation(e,t){const i=this._interactionVisualElements;if(null==i)return;const{laserline:s,verticalLine:n}=i;s.heightManifoldTarget=e,s.intersectsWorldUpAtLocation=t?e:null,null!=e&&n.setStartEndFromWorldDownAtLocation(e)}_findSubTool(e){if(null==e)return null;const t=e instanceof D?t=>t.subTool.hasManipulator(e):t=>t.subTool.viewshed===e;return this.subToolHandles?.find(t)?.subTool}get test(){}};function x(e,t,i){const s=t.elevationAlignedObserverRenderSpace,a=g(W,i,s),o=m(a)*t.metersPerUnit,l=e.renderCoordsHelper.basisMatrixAtPosition(s,z),r=v(R,l[8],l[9],l[10]),d=b(s,r,F),c=y(d,i,U),h=g(c,c,s),u=(m(h)<1e-4?90:n(w(a,h)))*(_(r,a)<0?-1:1)+90,p=v(K,l[4],l[5],l[6]),V=n(w(p,h)),f=v(K,l[0],l[1],l[2]);return{heading:_(h,f)<0?360-V:V,tilt:u,farDistance:o}}e([h()],O.prototype,"updating",null),e([h({constructOnly:!0})],O.prototype,"view",void 0),e([h()],O.prototype,"analysisViewData",void 0),e([h()],O.prototype,"removeIncompleteOnCancel",void 0),e([h()],O.prototype,"automaticManipulatorSelection",void 0),e([h()],O.prototype,"multiTouchEnabled",void 0),e([h({constructOnly:!0})],O.prototype,"analysis",void 0),e([h()],O.prototype,"subToolHandles",void 0),e([h()],O.prototype,"_stagedViewshed",void 0),e([h()],O.prototype,"_stagedViewshedComputedData",void 0),e([h()],O.prototype,"_placementMode",void 0),e([h()],O.prototype,"_creationState",void 0),e([h()],O.prototype,"_valid",null),e([h({readOnly:!0})],O.prototype,"cursor",null),e([h()],O.prototype,"_selectedManipulator",void 0),e([h()],O.prototype,"_selectedSubTool",null),e([h()],O.prototype,"selectedViewshed",null),e([h()],O.prototype,"selectedViewshedComputedData",null),e([h()],O.prototype,"stagedViewshed",null),e([h()],O.prototype,"grabbing",null),e([h()],O.prototype,"creating",null),e([h()],O.prototype,"isPlacingTarget",null),O=e([u("esri.views.3d.analysis.Viewshed.ViewshedTool")],O);const W=V(),R=V(),U=V(),K=V(),z=p(),F=S(),B={mapPoint:new f,scenePoint:V(),feature:null},G="multiple";export{O as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import{makeHandle as i}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{rad2deg as n}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,watch as r,sync as d,initial as c}from"../../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as g,len as m,set as v,angle as w,dot as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../geometry/Point.js";import{fromPositionAndNormal as b,projectPoint as y,create as S}from"../../../../geometry/support/plane.js";import{creationElevationInfo as T}from"./ViewshedConfiguration.js";import{ViewshedSubTool as C}from"./ViewshedSubTool.js";import{Manipulator3D as D}from"../../interactive/Manipulator3D.js";import{Settings as M}from"../../interactive/editingTools/settings.js";import{ExtendedLineVisualElement as H}from"../../interactive/visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as I}from"../../interactive/visualElements/LaserlineVisualElement.js";import{toGraphic as j}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{AnalysisToolBase as P}from"../../../interactive/AnalysisToolBase.js";import{sketchKeys as E}from"../../../interactive/keybindings.js";import{newToolIntersector as L}from"../../../interactive/ToolIntersector.js";import{createScreenPointArrayFromEvent as k}from"../../../support/screenUtils.js";const A=Symbol("interactionVisuals");let O=class extends P{constructor(e){super(e),this.removeIncompleteOnCancel=!1,this.automaticManipulatorSelection=!1,this.multiTouchEnabled=!1,this._stagedViewshed=null,this._stagedViewshedComputedData=null,this._placementMode=G,this._creationState=!1,this._interactionVisualElements=null,this._settings=new M({getTheme:()=>this.view.effectiveTheme}),this._selectedManipulator=null}initialize(){this._intersector=L(this.view.state.viewingMode),this._createInteractionVisuals();const e=this.analysisViewData.viewshedComputedDataHandles;this.subToolHandles=s(()=>e,({viewshedComputedData:e})=>{const t=new C({analysis:this.analysis,analysisViewData:this.analysisViewData,parentTool:this,view:this.view,viewshedComputedData:e});return{subTool:t,remove:()=>{this.selectedViewshed===e.viewshed&&(this.selectedViewshed=null),t.destroy()}}}),this.addHandles([o(()=>this._valid,()=>this.finishToolCreation(),l),r(()=>this._stagedViewshed,e=>{const t=this.analysisViewData.viewshedComputedDataHandles;this._stagedViewshedComputedData=null!=e&&null!=t?this._findSubTool(e)?.viewshedComputedData:null},l),this.analysis.viewsheds.on("after-remove",e=>{const t=this._stagedViewshed;null!=t&&e.item===t&&this.analysis.viewsheds.add(t)}),r(()=>this.firstGrabbedManipulator,e=>{if(null!=e){const t=this._findSubTool(e)?.viewshed;this.selectedViewshed=t,this._selectManipulator(e)}else this._selectedSubTool?.onManipulatorSelectionChanged()},d),r(()=>this.view.activeTool,e=>{e!==this&&null!=e&&(this.selectedViewshed=null)}),o(()=>{const e=this.selectedViewshedComputedData;return null==e?null:{subTool:this._selectedSubTool,observer:e.elevationAlignedObserverRenderSpace,target:e.elevationAlignedTargetRenderSpace}},e=>{const{subTool:t,observer:i,target:s}=e;t?.moveInteractionState.dragging?this._updateInteractionVisualsLocation(i,!0):t?.scaleOrientInteractionState.dragging&&this._updateInteractionVisualsLocation(s,!1)},c),r(()=>this.creating,()=>this.updateInteractionVisualsVisibility()),r(()=>this.selectedViewshed,e=>{const t=this._selectedManipulator,i=this._selectedSubTool;null==e?this._selectManipulator(null):null!=t&&i.hasManipulator(t)||this._selectManipulator(i.discManipulator)},c)])}destroy(){this.subToolHandles=a(this.subToolHandles),this.removeHandles(A)}onDeactivate(){this.removeStaged(),this._creationState=!1}get updating(){return this.subToolHandles.some(({subTool:e})=>e.updating)}get _valid(){return this.analysisViewData.viewshedComputedDataHandles?.some(e=>e.viewshedComputedData.valid)??!1}get cursor(){return this.creating?"crosshair":null}get _selectedSubTool(){return this._findSubTool(this.selectedViewshed)}_selectManipulator(e){const t=this._selectedManipulator;t!==e&&(this._selectedManipulator=e,null!=t&&(t.selected=!1),null!=e&&(e.selected=!0),this._findSubTool(t)?.onManipulatorSelectionChanged(),this._selectedSubTool?.onManipulatorSelectionChanged())}get selectedViewshed(){return this.analysisViewData.selectedViewshed}set selectedViewshed(e){this.analysisViewData.selectedViewshed=e}get selectedViewshedComputedData(){return this._selectedSubTool?.viewshedComputedData}get stagedViewshed(){return this._stagedViewshed}get grabbing(){return this.subToolHandles.some(({subTool:e})=>e.grabbing)}get creating(){return this._creationState&&this.active}get isPlacingTarget(){return"placing-target"===this._creationState}place(e){this.selectedViewshed=null,this._placementMode=e,this._creationState="placing-observer",this._finishToolCreationIfValid()}onManipulatorSelectionChanged(){this.subToolHandles.forEach(e=>e.subTool.onManipulatorSelectionChanged())}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":E.cancel===e.key?this._cancelKeyHandler(e):E.delete.includes(e.key)&&this._deleteKeyHandler();break;case"hold":this.updateInteractionVisualsVisibility(!0)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickPlacementHandler(e)}onActivate(){this._placementMode=G}_clickPlacementHandler(e){if(!this.creating||this.hasFocusedManipulators)return;const i=this._intersectScreen(e,B);if(null!=i){if("placing-observer"===this._creationState){const e=new t({observer:i.mapPoint.clone(),elevationInfo:T.clone(),feature:i.feature});this.analysis.viewsheds.add(e),this._stagedViewshed=e,this._creationState="placing-target",this._updateStagedViewshed(i.scenePoint)}else if("placing-target"===this._creationState){this._updateStagedViewshed(i.scenePoint);const e=this._stagedViewshed;this._stagedViewshed=null,"multiple"===this._placementMode?this._creationState="placing-observer":(this._creationState=!1,this._stagedViewshed=null,this._finishToolCreationIfValid(),this.view.activeTool=null),this.selectedViewshed=e}e.stopPropagation()}}_doubleClickHandler(e){this.creating&&(this.removeStaged(),this._creationState=!1,this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(!this.creating)return;const t=this._intersectScreen(e,B);null!=t&&(this._updateInteractionVisualsLocation(t.scenePoint,!1),this._updateStagedViewshed(t.scenePoint))}_cancelKeyHandler(e){this.creating?this._onCancelWhileCreating(e):this.grabbing||(this.selectedViewshed=null,e.stopPropagation())}_onCancelWhileCreating(e){const t=this.removeStaged();this._finishToolCreationIfValid(),t?(this._creationState="placing-observer",this.selectedViewshed=null,"multiple"===this._placementMode&&e.stopPropagation()):this._creationState=!1}_deleteKeyHandler(){this.creating&&(this.removeStaged(),this._creationState="placing-observer"),null!=this.selectedViewshed&&this.analysis.viewsheds.remove(this.selectedViewshed)}_finishToolCreationIfValid(){this._valid&&this.finishToolCreation()}_updateStagedViewshed(e){const t=this._stagedViewshed,i=this._stagedViewshedComputedData;if(null==t||null==i)return;const{heading:s,tilt:n,farDistance:a}=x(this.view,i,e);t.farDistance=a,t.tilt=n,t.heading=s}removeStaged(){const e=this._stagedViewshed;return null!=e&&(this._stagedViewshed=null,this.analysis.viewsheds.remove(e),!0)}_intersectScreen(e,t){const i=k(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,n=t.scenePoint;if(!s.getIntersectionPoint(n))return null;const a=t.mapPoint;return a.spatialReference=this.view.spatialReference,this.view.renderCoordsHelper.fromRenderCoords(n,a),null==a?null:(t.feature=j(s,this.view),t)}_createInteractionVisuals(){this.removeHandles(A);const e=this._settings.visualElements,t=new I({view:this.view,attached:!1,style:{glowWidth:e.heightPlane.glowWidth,innerWidth:e.heightPlane.innerWidth},isDecoration:!0}),s=new H({view:this.view,extensionType:e.zVerticalLine.extensionType,attached:!1,innerWidth:1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._interactionVisualElements={laserline:t,verticalLine:s},this.addHandles([r(()=>e.zVerticalLine,e=>e.apply(s),l),r(()=>e.heightPlane,e=>e.apply(t),l),i(()=>{t.destroy(),s.destroy(),this._interactionVisualElements=null})],A)}updateInteractionVisualsVisibility(e=!1){const t=this.creating,i=this.analysisViewData.visible,s=this._selectedSubTool,n=this.selectedViewshedComputedData,a=(e,t)=>{const i=this._interactionVisualElements;null!=i&&(i.verticalLine.attached=t,i.laserline.attached=e)};if(t)return void a(i,!1);if(null==s||null==n)return void a(!1,!1);const o=s.moveInteractionState,l=e?o.grabbing:o.dragging,r=s.scaleOrientInteractionState,d=e?r.grabbing:r.dragging,c=i&&(l||d);if(a(c,l),c){const e=l?n.elevationAlignedObserverRenderSpace:n.elevationAlignedTargetRenderSpace;this._updateInteractionVisualsLocation(e,l)}}_updateInteractionVisualsLocation(e,t){const i=this._interactionVisualElements;if(null==i)return;const{laserline:s,verticalLine:n}=i;s.heightManifoldTarget=e,s.intersectsWorldUpAtLocation=t?e:null,null!=e&&n.setStartEndFromWorldDownAtLocation(e)}_findSubTool(e){if(null==e)return null;const t=e instanceof D?t=>t.subTool.hasManipulator(e):t=>t.subTool.viewshed===e;return this.subToolHandles?.find(t)?.subTool}get test(){}};function x(e,t,i){const s=t.elevationAlignedObserverRenderSpace,a=g(W,i,s),o=m(a)*t.metersPerUnit,l=e.renderCoordsHelper.basisMatrixAtPosition(s,z),r=v(R,l[8],l[9],l[10]),d=b(s,r,F),c=y(d,i,U),h=g(c,c,s),u=(m(h)<1e-4?90:n(w(a,h)))*(_(r,a)<0?-1:1)+90,p=v(K,l[4],l[5],l[6]),V=n(w(p,h)),f=v(K,l[0],l[1],l[2]);return{heading:_(h,f)<0?360-V:V,tilt:u,farDistance:o}}e([h()],O.prototype,"updating",null),e([h({constructOnly:!0})],O.prototype,"view",void 0),e([h()],O.prototype,"analysisViewData",void 0),e([h()],O.prototype,"removeIncompleteOnCancel",void 0),e([h()],O.prototype,"automaticManipulatorSelection",void 0),e([h()],O.prototype,"multiTouchEnabled",void 0),e([h({constructOnly:!0})],O.prototype,"analysis",void 0),e([h()],O.prototype,"subToolHandles",void 0),e([h()],O.prototype,"_stagedViewshed",void 0),e([h()],O.prototype,"_stagedViewshedComputedData",void 0),e([h()],O.prototype,"_placementMode",void 0),e([h()],O.prototype,"_creationState",void 0),e([h()],O.prototype,"_valid",null),e([h({readOnly:!0})],O.prototype,"cursor",null),e([h()],O.prototype,"_selectedManipulator",void 0),e([h()],O.prototype,"_selectedSubTool",null),e([h()],O.prototype,"selectedViewshed",null),e([h()],O.prototype,"selectedViewshedComputedData",null),e([h()],O.prototype,"stagedViewshed",null),e([h()],O.prototype,"grabbing",null),e([h()],O.prototype,"creating",null),e([h()],O.prototype,"isPlacingTarget",null),O=e([u("esri.views.3d.analysis.Viewshed.ViewshedTool")],O);const W=V(),R=V(),U=V(),K=V(),z=p(),F=S(),B={mapPoint:new f,scenePoint:V(),feature:null},G="multiple";export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as e,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as s}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as d}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as g}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as c}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as u}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as
|
|
2
|
+
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as e,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as s}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as d}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as g}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as c}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as u}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as l}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as w}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as v,ViewEventPriorities as y}from"../../input/InputManager.js";import{PreventContextMenu as _}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as D}from"../../input/handlers/support.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as P}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as j}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as M}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as b}from"../../input/recognizers/VerticalTwoFingerDrag.js";let T=class extends r{constructor(){super(...arguments),this.mode="default",this._updateMode=({mode:o,dragPrimary:r,dragSecondary:t,dragTertiary:e})=>{"pro"===o&&(t="zoom",e="pan"===r?"rotate":"pan");const i={dragPrimary:r,dragSecondary:t,dragTertiary:e};this._modeDragPan&&(this._modeDragPan.pointerActions=D("pan",i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=D("rotate",i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=D("zoom",i))}}destroy(){this.disconnect()}get primaryDragAction(){return this.view.navigation.actionMap.dragPrimary}set primaryDragAction(o){const{actionMap:r}=this.view.navigation;r.dragPrimary=o,r.dragSecondary="pan"===o?"rotate":"pan"}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get latestPenInfo(){return this._inputManager?.latestPenInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=t(this._inputManager),this._source=t(this._source)}connect(){const o=this.view;this._source=new f(this.view.surface,o.input);const r=[new P,new j,new M,new A(this.view.navigation),new b],t=new v({eventSource:this._source,recognizers:r});this._inputManager=t,t.installHandlers("prevent-context-menu",[new _],y.INTERNAL);const a={fov:"Shift",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:["u","U"],down:["j","J"]},lookAround:{headingLeft:["a","A"],headingRight:["d","D"],tiltUp:["w","W"],tiltDown:["s","S"],modifier:"b"},zoom:{zoomIn:["+","="],zoomOut:["-","_"]},reset:{heading:["n","N"],tilt:["p","P"]}};this._modeDragPan=new l(o,["primary"]),this._modeDragRotate=new m(o,["secondary"],0),this._modeDragZoom=new p(o,["tertiary"],a.fov),this._modeKeyboardNavigation=new c(o,a),t.installHandlers("navigation",[new h(o),new d(o),new g(o),new u(o,a.fov),new m(o,["primary"],1,[a.lookAround.modifier]),new l(o,["secondary"],[a.lookAround.modifier],!0),new l(o,["tertiary"],[a.lookAround.modifier]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new w(o)],y.INTERNAL),this.view.viewEvents.connect(t),this.addHandles([e(()=>this.view.navigation?.browserTouchPanEnabled,o=>{this._source.browserTouchPanningEnabled=!o},i),e(()=>{const{actionMap:o}=this.view.navigation,{dragPrimary:r,dragSecondary:t,dragTertiary:e}=o;return{mode:this.mode,dragPrimary:r,dragSecondary:t,dragTertiary:e}},this._updateMode,n)])}isModifierKeyDown(o){return this._inputManager?.isModifierKeyDown(o)??!1}get test(){}};o([a()],T.prototype,"view",void 0),o([a({type:["default","pro"]})],T.prototype,"mode",void 0),o([a({readOnly:!0})],T.prototype,"updating",null),o([a()],T.prototype,"latestPointerInfo",null),o([a()],T.prototype,"latestPenInfo",null),o([a()],T.prototype,"multiTouchActive",null),o([a()],T.prototype,"_inputManager",void 0),T=o([s("esri.views.3d.input.SceneInputManager")],T);const I=T;export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as C,clone as M,fromValues as O,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as R,fromValues as V,ONES as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as U,isMars as H,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as A}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as P}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as F,BufferViewVec4u8 as G,BufferViewVec4u16 as N,BufferViewVec3f as z,BufferViewVec3u8 as q,BufferViewVec3u16 as W,BufferViewVec2f as $,BufferViewUint32 as Z,BufferViewUint16 as J,BufferViewVec2i16 as X}from"../../../geometry/support/buffer/BufferView.js";import Y from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as Q}from"../../../support/elevationInfoUtils.js";import{computeNormals as K,writeAddedVerticesAndNormals as ee,NormalData as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ce}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as de,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as pe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as fe}from"../state/Frustum.js";import{ElevationRange as be}from"../support/ElevationRange.js";import{toBoundingRect as ye}from"../support/extentUtils.js";import{Obb as ge,compute as _e}from"../support/orientedBoundingBox.js";import{glLayout as ve}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as we,createVertexBufferLayout as xe,ComponentGeometryParameters as Te,SourceGeometry as je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ce}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Me}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Oe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Ee}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Re}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ue,isInEffectiveScaleRange as He,validateScaleRange as ke}from"../../support/layerViewUtils.js";import{TaskPriority as Ae}from"../../support/Scheduler.js";import{TextureCompressionTracker as Le}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Pe}from"../../../webscene/support/AlphaCutoff.js";var De;let Ie=class extends(ie(Se)){static{De=ce}constructor(e){super(e),this[De]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Le,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Ae.TILES3D,this),this._frustum=new fe(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new pe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ye(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,Q(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ke(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ge(t),Ge(e),Ge(s),Ge(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return Q(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new be(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new be;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||U(i)||H(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=k(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(j(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");return this._createRenderable(e)}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(!Qe(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(n){throw i.forEach(e=>this._stage.removeTexture(e)),n}const r=new Array,o=new be;try{const n=await this._frameTask.schedule(()=>this._createRenderableMain(t,s,i,r,o),null);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(s.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const a=r.reduce((e,t)=>{const{baseColorTexture:i,metallicRoughnessTexture:s,emissionTexture:r,occlusionTexture:o,normalTexture:n}=t.renderable.material.parameters;return e+(i?.texture?.usedMemory??0)+(s?.texture?.usedMemory??0)+(r?.texture?.usedMemory??0)+(o?.texture?.usedMemory??0)+(n?.texture?.usedMemory??0)},0),l=new Fe(e.handle,r,n.textures,n.cpuMemoryUsage,n.vboMemoryUsage,a,n.tileObb,e.stableNodeId,e.nodeDepth,o);this._lyrHandleToObjects.set(e.handle,l),this._memCache.put(We(l.handle),l);const{usedMemory:c}=l;return this._cacheMemory+=c,{memUsageBytes:c}}catch(n){throw s.forEach(e=>e.cleanup()),r.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),n}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{for(let r=0;r<s;r++){const s=e.desc.prims[r],o=e.desc.materials&&null!=s.materialId?e.desc.materials[s.materialId]:null;let n=Promise.resolve($e),a=null,l=null,c=null,d=null,h=null;if(o){const i="Pbr"===o.lightingModel;a=this._getTexture(o.baseColorTex,e,t),l=i?this._getTexture(o.metalTex,e,t):null,c=i?this._getTexture(o.emissiveTex,e,t):null,d=i?this._getTexture(o.occlusionTex,e,t):null,h=i?this._getTexture(o.normalTex,e,t):null;const s=[a,l,c,d,h].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Ze(n,a,l,c,d,h))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}_createRenderableMain(e,t,i,s,r){let o=0;const n=e.desc,a=e.data.buffer,l=n.prims.length,c=n.materials,d=C(...n.origin),m=this.view.basemapTerrain.spatialReference,y=this.view.state.isGlobal;let g=f;if(y){const e=b();L(A,d,e,m),g=h(p(),e)}if(null==n.obb)throw new Error("meshData.desc.obb undefined");const _=qe(n.obb),v=y?k(this.view.spatialReference).radius:0,x=g!==f,T=x?u(p(),g)??f:f,E=j();for(let h=0;h<l;h++){const e=n.prims[h],i=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==de[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),i.cleanup();continue}const l=c&&null!=e.materialId?c[e.materialId]:null,u=null!=l?l.lightingModel:"Unlit",{positionView:p,normalsData:f,colorView:b,texCoord0Data:C,indicesView:U}=this.getBufferViews(e,a);if(null==p||null==U){i.cleanup();continue}const H=p.count,k=(e,t)=>null==e||e===H||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(null!=C?C.length/2:void 0,"numTexcoord")||!k(b?.count,"numColors")||!k(f?.length,"normals")){i.cleanup();continue}const A=null!=b,L=null!=f||this._imVertexNormals,I=new we(A,L,C?1:0),B=this._imVertexNormals&&null==f?K(U.typedBuffer,p.typedBuffer,p.typedBufferStride):null,F=B?.outputVertexCount??H,G=xe(I),N=G.createBuffer(F),z=B?G.fields.get("normalCompressed"):null;if(null!=B&&null==z)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");const q=B?B.packedNormals:f;Ye(new Xe(d,v,y,g),{texCoord0Data:C,colorView:b,packedNormalsSource:q},N,{positionView:p,tileObb:_,obbHalfSizeAccumulator:E,elevationRange:r});const W=_?.clone()??ze(new Oe(p.typedBuffer,3),d);let $;if(null!=B){const e=G.stride/4,t=z.offset/4,i=H,s=new Uint32Array(N.buffer);ee(s,e,t,s,e,i,F,B.appendedVertexToOriginal,B.packedNormals),$=new te(N.buffer,B.indices)}else $=new te(N.buffer,U.typedBuffer);const Z=ve(G),J=new Uint32Array([0,U.typedBuffer.length]),X=new Te(Z,this._imShading?2:0,I.textureCoordinateType,x?1:0,0),Y=new je({interleavedVertexData:$.data,vertexCount:$.data.byteLength/Z[0].stride,indexData:$.indices},{positions:p.typedBuffer,indices:U.typedBuffer},J,X),Q=this.view.renderSpatialReference,ie=j(),se=[1,1,1];P(d,Q,se,m)||this._dbg(3,"Unsupported coordinate system for IM overlay"),D(d,Q,ie,m);let re=S,oe=Pe,ne=null,ae=null,le=null,ce=null,me=null,pe=1,fe=!1,be=2,ye=!1,ge=O(0,0,0);const _e=M(Ve),Me="Pbr"===u;if(l&&(ne=i.baseColorTexture,me=i.metallicRoughnessTexture,ae=i.emissionTexture,ce=i.occlusionTexture,le=i.normalTexture,re=R(l.baseColorFactor),oe=l.alphaCutoff??Pe,Me&&(w(_e,l.metallicFactor,l.roughnessFactor,0),l.emissiveFactor&&(ge=l.emissiveFactor)),pe=he[l.alphaMode],fe=l.isDoubleSided,be=ue[l.faceCulling??"NotSet"],ye=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ne||this._dbg(3,"No colour texture 1");const Ee=this._collection.createObject({toMapSpace:V(ie[0],ie[1],se[0],se[1]),transform:new Ce(d,T),obb:W,geometry:Y,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:re,textureAlphaCutoff:oe,mrrFactors:_e,baseColorTexture:ne,metallicRoughnessTexture:me,normalTexture:le,occlusionTexture:ce,emissionTexture:ae,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:pe,doubleSided:fe,cullFace:be,isGround:ye,emissiveBaseColor:ge,usePBR:Me,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});o+=this._collection.getObjectGPUMemoryUsage(Ee),s.push(Ee)}const U=Array.from(i.values()),{fullExtent:H}=this.layer;H?.hasZ&&H.zmax&&H.zmin&&(r.minElevation=Math.max(r.minElevation,H.zmin),r.maxElevation=Math.min(r.maxElevation,H.zmax));const I=s.reduce((e,t)=>e+t.intersectionGeometry.usedMemory,0);return new Je(o,_,U,I)}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=We(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(We(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(We(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Me(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,n=me[e.wrapMode??"None"];let a=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,a=6403,d=""):"Rgb8"===s.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new Ee(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:n,pixelFormat:a,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t){let i,s,r,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new z(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new z(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Re(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new $(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new F(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new N(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new z(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new q(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new W(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new J(t,i.byteOffset,s,r);break;case"U32":n=new Z(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new J(new Uint16Array(e).buffer):new Z(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],Ie.prototype,"fullOpacity",null),e([c({readOnly:!0})],Ie.prototype,"ready",null),e([c({type:[Y]})],Ie.prototype,"_modifications",void 0),e([c()],Ie.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],Ie.prototype,"layer",void 0),e([c({readOnly:!0})],Ie.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],Ie.prototype,"_collection",null),e([c()],Ie.prototype,"elevationOffset",null),e([c({readOnly:!0})],Ie.prototype,"visibleElevationRange",null),Ie=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ie);const Be=Ie;class Fe{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ge(e){return Math.round(e/1048.576)/1e3}const Ne=j();function ze(e,t){const i=_e(e);return T(Ne,i.center,t),i.center=Ne,i}function qe(e){return new ge(e.center,e.halfSize,y(...e.quaternion))}function We(e){return`${e}`}const $e=new Array;class Ze{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}class Je{constructor(e,t,i,s){this.vboMemoryUsage=e,this.tileObb=t,this.textures=i,this.cpuMemoryUsage=s}}class Xe{constructor(e,t,i,s){this.origin=e,this.ellipsoidRadius=t,this.isGlobal=i,this.ecefRotation=s}}function Ye(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Data:l,colorView:c,packedNormalsSource:d}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",z),g=y.typedBuffer,_=y.typedBufferStride,v=null!=l?i.getField("uv0",$):null,w=v?.typedBuffer,T=v?.typedBufferStride??0,j=c?.typedBuffer,C=c?.elementCount??0,M=null!=c?i.getField("color",G):null,O=M?.typedBuffer,R=M?.typedBufferStride??0,V=null!=d?i.getField("normalCompressed",X):null,S=null!=V?new Uint32Array(V.typedBuffer.buffer,V.typedBuffer.byteOffset,V.typedBuffer.length/2):null,U=null!=V?V.typedBufferStride/2:0,H=null!=u?m(et,u.quaternionConjugate):f,k=x(Ke,u?.center??E,H),A=H[0],L=H[1],P=H[2],D=H[3],I=H[4],B=H[5],F=H[6],N=H[7],q=H[8],W=k[0],Z=k[1],J=k[2],Y=a[0],Q=a[1],K=a[2],ee=a[3],te=a[4],ie=a[5],se=a[6],re=a[7],oe=a[8],ne=a!==f,ae=r[0],le=r[1],ce=r[2],de=h.count,he=h.typedBufferStride,ue=h.typedBuffer,me=null!=w&&null!=l,pe=null!=O&&null!=j&&(3===C||4===C),fe=4===C,be=null!=S&&null!=d,ye=null!=p;let ge=ye?p[0]:0,_e=ye?p[1]:0,ve=ye?p[2]:0;for(let m=0;m<de;++m){const e=m*he,t=ue[e],i=ue[e+1],s=ue[e+2],r=t+ae,a=i+le,c=s+ce,h=n?Math.sqrt(r*r+a*a+c*c)-o:c;if(b.expandElevationRangeValues(h,h),ye){const e=Math.abs(r*A+a*D+c*F-W),t=Math.abs(r*L+a*I+c*N-Z),i=Math.abs(r*P+a*B+c*q-J);ge=Math.max(ge,e),_e=Math.max(_e,t),ve=Math.max(ve,i)}const u=m*_;if(ne){const r=t*Y+i*ee+s*se,o=t*Q+i*te+s*re,n=t*K+i*ie+s*oe;ue[e]=r,ue[e+1]=o,ue[e+2]=n,g[u]=r,g[u+1]=o,g[u+2]=n}else g[u]=t,g[u+1]=i,g[u+2]=s;if(me){const e=2*m,t=m*T;w[t]=l[e],w[t+1]=l[e+1]}if(pe){const e=m*R;if(fe){const t=4*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=j[t+3]}else{const t=3*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=255}}be&&(S[m*U]=d[m])}u&&ye&&(p[0]=ge,p[1]=_e,p[2]=ve,u.setHalfSize(ge,_e,ve))}function Qe(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}const Ke=j(),et=p();export{Be as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as x,add as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as C,clone as M,fromValues as O,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as R,fromValues as V,ONES as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as U,isMars as H,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as D}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as F,BufferViewVec4u8 as G,BufferViewVec4u16 as N,BufferViewVec3f as z,BufferViewVec3u8 as q,BufferViewVec3u16 as W,BufferViewVec2f as $,BufferViewUint32 as Z,BufferViewUint16 as J,BufferViewVec2i16 as X}from"../../../geometry/support/buffer/BufferView.js";import Y from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as Q}from"../../../support/elevationInfoUtils.js";import{computeNormals as K,writeAddedVerticesAndNormals as ee,NormalData as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ce}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as de,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as pe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as fe}from"../state/Frustum.js";import{ElevationRange as be}from"../support/ElevationRange.js";import{toBoundingRect as ye}from"../support/extentUtils.js";import{Obb as ge,compute as _e}from"../support/orientedBoundingBox.js";import{glLayout as ve}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as we,createVertexBufferLayout as xe,ComponentGeometryParameters as Te,SourceGeometry as je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ce}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Me}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Oe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Ee}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Re}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ue,isInEffectiveScaleRange as He,validateScaleRange as ke}from"../../support/layerViewUtils.js";import{TaskPriority as Pe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ae}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Le}from"../../../webscene/support/AlphaCutoff.js";var Ie;let De=class extends(ie(Se)){static{Ie=ce}constructor(e){super(e),this[Ie]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ae,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Pe.TILES3D,this),this._frustum=new fe(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ue("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new pe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=D();this._layerClippingArea=ye(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,Q(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ke(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ge(t),Ge(e),Ge(s),Ge(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return Q(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new be(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new be;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||U(i)||H(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=k(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(j(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Qe(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(n){throw i.forEach(e=>this._stage.removeTexture(e)),n}const r=new Array,o=new be;try{const n=await this._frameTask.schedule(()=>this._createRenderableMain(t,s,i,r,o),null);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");if(await Promise.all(s.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const a=r.reduce((e,t)=>{const{texture:i,textureMetallicRoughness:s,textureEmissive:r,textureOcclusion:o,textureNormal:n}=t.renderable.drawParameters;return e+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0)+(n?.usedMemory??0)},0),l=new Fe(e.handle,r,n.textures,n.cpuMemoryUsage,n.vboMemoryUsage,a,n.tileObb,e.stableNodeId,e.nodeDepth,o);this._lyrHandleToObjects.set(e.handle,l),this._memCache.put(We(l.handle),l);const{usedMemory:c}=l;return this._cacheMemory+=c,{memUsageBytes:c}}catch(n){throw s.forEach(e=>e.cleanup()),r.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage.removeTexture(e)),n}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{for(let r=0;r<s;r++){const s=e.desc.prims[r],o=e.desc.materials&&null!=s.materialId?e.desc.materials[s.materialId]:null;let n=Promise.resolve($e),a=null,l=null,c=null,d=null,h=null;if(o){const i="Pbr"===o.lightingModel;a=this._getTexture(o.baseColorTex,e,t),l=i?this._getTexture(o.metalTex,e,t):null,c=i?this._getTexture(o.emissiveTex,e,t):null,d=i?this._getTexture(o.occlusionTex,e,t):null,h=i?this._getTexture(o.normalTex,e,t):null;const s=[a,l,c,d,h].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Ze(n,a,l,c,d,h))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}_createRenderableMain(e,t,i,s,r){let o=0;const n=e.desc,a=e.data.buffer,l=n.prims.length,c=n.materials,d=C(...n.origin),m=this.view.basemapTerrain.spatialReference,y=this.view.state.isGlobal;let g=f;if(y){const e=b();A(P,d,e,m),g=h(p(),e)}if(null==n.obb)throw new Error("meshData.desc.obb undefined");const _=qe(n.obb),v=y?k(this.view.spatialReference).radius:0,x=g!==f,T=x?u(p(),g)??f:f,E=j();for(let h=0;h<l;h++){const e=n.prims[h],i=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==de[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),i.cleanup();continue}const l=c&&null!=e.materialId?c[e.materialId]:null,u=null!=l?l.lightingModel:"Unlit",{positionView:p,normalsData:f,colorView:b,texCoord0Data:C,indicesView:U}=this.getBufferViews(e,a);if(null==p||null==U){i.cleanup();continue}const H=p.count,k=(e,t)=>null==e||e===H||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(null!=C?C.length/2:void 0,"numTexcoord")||!k(b?.count,"numColors")||!k(f?.length,"normals")){i.cleanup();continue}const P=null!=b,A=null!=f||this._imVertexNormals,D=new we(P,A,C?1:0),B=this._imVertexNormals&&null==f?K(U.typedBuffer,p.typedBuffer,p.typedBufferStride):null,F=B?.outputVertexCount??H,G=xe(D),N=G.createBuffer(F),z=B?G.fields.get("normalCompressed"):null;if(null!=B&&null==z)throw new Error("computeNormals requires a reserved NORMALCOMPRESSED attribute in layout");const q=B?B.packedNormals:f;Ye(new Xe(d,v,y,g),{texCoord0Data:C,colorView:b,packedNormalsSource:q},N,{positionView:p,tileObb:_,obbHalfSizeAccumulator:E,elevationRange:r});const W=_?.clone()??ze(new Oe(p.typedBuffer,3),d);let $;if(null!=B){const e=G.stride/4,t=z.offset/4,i=H,s=new Uint32Array(N.buffer);ee(s,e,t,s,e,i,F,B.appendedVertexToOriginal,B.packedNormals),$=new te(N.buffer,B.indices)}else $=new te(N.buffer,U.typedBuffer);const Z=ve(G),J=new Uint32Array([0,U.typedBuffer.length]),X=new Te(Z,this._imShading?2:0,D.textureCoordinateType,x?1:0,0),Y=new je({interleavedVertexData:$.data,vertexCount:$.data.byteLength/Z[0].stride,indexData:$.indices},{positions:p.typedBuffer,indices:U.typedBuffer},J,X),Q=this.view.renderSpatialReference,ie=j(),se=[1,1,1];L(d,Q,se,m)||this._dbg(3,"Unsupported coordinate system for IM overlay"),I(d,Q,ie,m);let re=S,oe=Le,ne=null,ae=null,le=null,ce=null,me=null,pe=1,fe=!1,be=2,ye=!1,ge=O(0,0,0);const _e=M(Ve),Me="Pbr"===u;if(l&&(ne=i.baseColorTexture,me=i.metallicRoughnessTexture,ae=i.emissionTexture,ce=i.occlusionTexture,le=i.normalTexture,re=R(l.baseColorFactor),oe=l.alphaCutoff??Le,Me&&(w(_e,l.metallicFactor,l.roughnessFactor,0),l.emissiveFactor&&(ge=l.emissiveFactor)),pe=he[l.alphaMode],fe=l.isDoubleSided,be=ue[l.faceCulling??"NotSet"],ye=this.layer.replacesTerrain),this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ne||this._dbg(3,"No colour texture 1");const Ee=this._collection.createObject({toMapSpace:V(ie[0],ie[1],se[0],se[1]),transform:new Ce(d,T),obb:W,geometry:Y,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:re,textureAlphaCutoff:oe,mrrFactors:_e,baseColorTexture:ne,metallicRoughnessTexture:me,normalTexture:le,occlusionTexture:ce,emissionTexture:ae,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:pe,doubleSided:fe,cullFace:be,isGround:ye,emissiveBaseColor:ge,usePBR:Me,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});o+=this._collection.getObjectGPUMemoryUsage(Ee),s.push(Ee)}const U=Array.from(i.values()),{fullExtent:H}=this.layer;H?.hasZ&&H.zmax&&H.zmin&&(r.minElevation=Math.max(r.minElevation,H.zmin),r.maxElevation=Math.min(r.maxElevation,H.zmax));const D=s.reduce((e,t)=>e+t.intersectionGeometry.usedMemory,0);return new Je(o,_,U,D)}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=We(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(We(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(We(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Me(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,n=me[e.wrapMode??"None"];let a=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,a=6403,d=""):"Rgb8"===s.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=new Ee(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:n,pixelFormat:a,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t){let i,s,r,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new z(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new z(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Re(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new $(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new F(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new N(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new z(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new q(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new W(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new J(t,i.byteOffset,s,r);break;case"U32":n=new Z(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new J(new Uint16Array(e).buffer):new Z(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],De.prototype,"fullOpacity",null),e([c({readOnly:!0})],De.prototype,"ready",null),e([c({type:[Y]})],De.prototype,"_modifications",void 0),e([c()],De.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],De.prototype,"layer",void 0),e([c({readOnly:!0})],De.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],De.prototype,"_collection",null),e([c()],De.prototype,"elevationOffset",null),e([c({readOnly:!0})],De.prototype,"visibleElevationRange",null),De=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],De);const Be=De;class Fe{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?M(n.center):E}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ge(e){return Math.round(e/1048.576)/1e3}const Ne=j();function ze(e,t){const i=_e(e);return T(Ne,i.center,t),i.center=Ne,i}function qe(e){return new ge(e.center,e.halfSize,y(...e.quaternion))}function We(e){return`${e}`}const $e=new Array;class Ze{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}class Je{constructor(e,t,i,s){this.vboMemoryUsage=e,this.tileObb=t,this.textures=i,this.cpuMemoryUsage=s}}class Xe{constructor(e,t,i,s){this.origin=e,this.ellipsoidRadius=t,this.isGlobal=i,this.ecefRotation=s}}function Ye(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Data:l,colorView:c,packedNormalsSource:d}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",z),g=y.typedBuffer,_=y.typedBufferStride,v=null!=l?i.getField("uv0",$):null,w=v?.typedBuffer,T=v?.typedBufferStride??0,j=c?.typedBuffer,C=c?.elementCount??0,M=null!=c?i.getField("color",G):null,O=M?.typedBuffer,R=M?.typedBufferStride??0,V=null!=d?i.getField("normalCompressed",X):null,S=null!=V?new Uint32Array(V.typedBuffer.buffer,V.typedBuffer.byteOffset,V.typedBuffer.length/2):null,U=null!=V?V.typedBufferStride/2:0,H=null!=u?m(et,u.quaternionConjugate):f,k=x(Ke,u?.center??E,H),P=H[0],A=H[1],L=H[2],I=H[3],D=H[4],B=H[5],F=H[6],N=H[7],q=H[8],W=k[0],Z=k[1],J=k[2],Y=a[0],Q=a[1],K=a[2],ee=a[3],te=a[4],ie=a[5],se=a[6],re=a[7],oe=a[8],ne=a!==f,ae=r[0],le=r[1],ce=r[2],de=h.count,he=h.typedBufferStride,ue=h.typedBuffer,me=null!=w&&null!=l,pe=null!=O&&null!=j&&(3===C||4===C),fe=4===C,be=null!=S&&null!=d,ye=null!=p;let ge=ye?p[0]:0,_e=ye?p[1]:0,ve=ye?p[2]:0;for(let m=0;m<de;++m){const e=m*he,t=ue[e],i=ue[e+1],s=ue[e+2],r=t+ae,a=i+le,c=s+ce,h=n?Math.sqrt(r*r+a*a+c*c)-o:c;if(b.expandElevationRangeValues(h,h),ye){const e=Math.abs(r*P+a*I+c*F-W),t=Math.abs(r*A+a*D+c*N-Z),i=Math.abs(r*L+a*B+c*q-J);ge=Math.max(ge,e),_e=Math.max(_e,t),ve=Math.max(ve,i)}const u=m*_;if(ne){const r=t*Y+i*ee+s*se,o=t*Q+i*te+s*re,n=t*K+i*ie+s*oe;ue[e]=r,ue[e+1]=o,ue[e+2]=n,g[u]=r,g[u+1]=o,g[u+2]=n}else g[u]=t,g[u+1]=i,g[u+2]=s;if(me){const e=2*m,t=m*T;w[t]=l[e],w[t+1]=l[e+1]}if(pe){const e=m*R;if(fe){const t=4*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=j[t+3]}else{const t=3*m;O[e]=j[t],O[e+1]=j[t+1],O[e+2]=j[t+2],O[e+3]=255}}be&&(S[m*U]=d[m])}u&&ye&&(p[0]=ge,p[1]=_e,p[2]=ve,u.setHalfSize(ge,_e,ve))}function Qe(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}const Ke=j(),et=p();export{Be as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{ONES as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as r,scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as o,ZEROS as n,fromArray as s,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as l}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as p}from"./defaultSymbolComplexity.js";import{ElevationContext as c}from"./ElevationContext.js";import{zeroContext as u}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{Loadable as h}from"./Loadable.js";import{getSizeAttributeValue as y,getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as g}from"../support/symbolColorUtils.js";const v=()=>e.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class m extends h{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=v(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new c,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,n="polygonIndices"in e?e.polygonIndices:null,s=`${i} geometry failed to be created`;o
|
|
2
|
+
import e from"../../../../core/Logger.js";import{ONES as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as r,scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as o,ZEROS as n,fromArray as s,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as l}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as p}from"./defaultSymbolComplexity.js";import{ElevationContext as c}from"./ElevationContext.js";import{zeroContext as u}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{Loadable as h}from"./Loadable.js";import{getSizeAttributeValue as y,getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as g}from"../support/symbolColorUtils.js";const v=()=>e.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class m extends h{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=v(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new c,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,n="polygonIndices"in e?e.polygonIndices:null,s=`${i} geometry failed to be created`;o?this._logGeometryValidationWarnings(t,r,i)||0===n?.length&&"rings"===r&&t.length>0&&t[0].length>2&&v().warnOncePerTick(`${s} (rings are faulty and failed to triangulate)`):v().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(v().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(v().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return v().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":l(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.setFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.setFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}createElevationContextForGraphic(e){const t=new c;return this.updateElevationContextForGraphic(t,e),t}updateElevationContextForGraphic(e,t){const r=t.geometry,i=this.getDefaultElevationInfo(r);e.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,e.mode=this.getGeometryElevationMode(r,i),e.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===e.mode;o&&(e.mode="relative-to-ground",e.offsetMeters=0);const n=o?u:this._elevationContext.featureExpressionInfoContext;n?e.updateFeatureExpressionInfoContextForGraphic(n,t,this._context.layer):e.setFeatureExpressionInfoContext(null)}prepareSymbolLayerPatch(e){}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(e,r=b){const i=this._getCombinedOpacity(e,r);if(this._drivenProperties.color)return d(null,i);const o=e?.toUnitRGB()??t;return d(o,i)}_getDrivenUInt8Color({color:e,opacity:t},r,i){const{color:s,opacity:a}=this._drivenProperties,l=r?.toUnitRGBA()??(i?o:n),p=s?e?.output??l:null,c=e||r||i,u=s?null:l[3];return d(p,a&&c?t?.output??u:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:e,opacity:t},o,n){const l=o?s(o.toUnitRGBA()):a(NaN,NaN,NaN,n?NaN:0);return this._drivenProperties.color&&null!=e&&r(l,e.output),this._drivenProperties.opacity&&null!=t&&(l[3]=t.output),i(l,l,255),g(l,l)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return p(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"screenSizePerspectiveEnabled":return this.layerScreenSizePerspectiveChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;case"terrainTransparency":return this.terrainTransparencyChanged();default:return!1}}terrainTransparencyChanged(){return!0}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.updateElevationContextForGraphic(o.elevationContext,t),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=y(t.size,e.size),i=f(t.color,e.color),o=f(t.opacity,e.opacity);return a(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&v().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.source??null,color:this._fastUpdates?.visualVariables.color?.source??null,opacity:this._fastUpdates?.visualVariables.opacity?.source??null,rotation:this._fastUpdates?.visualVariables.rotation?.source??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function _(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=a(NaN,NaN,NaN,NaN);export{m as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as t}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as n}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as s,triangulateIndexedF64 as i}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as
|
|
2
|
+
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as t}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as n}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as s,triangulateIndexedF64 as i}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as c,newIndexArray as h}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as g}from"../../../../geometry/support/polygonUtils.js";const f=1e-5,p=100,d={method:"auto",projectionAxis:void 0,outlines:void 0};function a(t,n){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:s}=n,i=n.axis??m(t,e,s),r=t.length,c=[],h=[],g=[],f=t.reduce((t,n)=>t+n.length,0);let p=0;const d=u(3*f);let a=0;const y=o&&t[0]&&x(t[0],e,i);for(let u=r-1;u>=0;u--){const n=t[u],s=U(n,e);if(s<3){s>1&&(g.push({index:a,count:n.length}),a=S(n,d,a,n.length,e,y));continue}const r=!!o&&x(n,e,i);if(y?!r:r)c[p++]=n;else{let t=n.length;for(let n=0;n<p;++n)t+=c[n].length;const o={index:a,pathLengths:new Array(p+1),count:t,holeIndices:new Array(p)};o.pathLengths[0]=n.length,n.length>0&&g.push({index:a,count:n.length}),a=S(n,d,a,n.length,e,y);for(let n=0;n<p;++n){const t=c[n];o.holeIndices[n]=a,o.pathLengths[n+1]=t.length,t.length>0&&g.push({index:a,count:t.length}),a=S(t,d,a,t.length,e,y)}p=0,o.count>0&&h.push(o)}}return{positions:3*a===d.length?d:l(d,0,3*a),polygons:h,outlines:g}}function m(t,n,e){if(!n)return 2;const o=t.map(t=>{const o=U(t,n);return o<3?2:g(t,o,e)}),s=o[0];return o.every(t=>t===s)?s:2}function x(t,n,e){if(!n)return!r(t);if(t.length<3)return!1;switch(e){case 0:return!r(t,1,2);case 1:return!r(t,0,2);case 2:return!r(t,0,1)}}const y=new n;function L(n,e){const o=j(n,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(t(y),v()):o}async function v(){try{await o(),y.notify()}catch(t){throw t}}function j(t,n){const e={...d,...n},{projectionAxis:o}=e,s=null!=o&&2!==o;s&&w(t.positions,o,2);const i=I(t,e);if(s){const n=i.succeeded?i.positions:null;null!=n&&n!==t.positions&&w(n,2,o),w(t.positions,2,o)}return i.succeeded,i}function I(t,n){if("libtess"===n.method||"auto"===n.method&&B(t)>p)return b(t,n);const o=Array();let s=0;for(const u of t.polygons){const i=k(t.positions,u),r=(u.holeIndices??[]).map(t=>t-u.index),l=r.length>0?r:null,c=e(i,l,3),h=e.deviation(i,r,3,c);if("auto"===n.method&&h>f)return b(t,n);for(let t=0;t<c.length;t++)o.push(c[t]+u.index);s=Math.max(s,h)}const{outlineIndexBuffer:i,outlineRingLengths:r}=null!=n.outlines?A(n.outlines,t.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:t.positions,indices:c(o),outlineIndexBuffer:i,outlineRingLengths:r,vertexCount:t.positions.length/3,method:"earcut",deviation:s}}function b(t,n){if(!s())return D("libtess-not-loaded");const e=null!=n.outlines,o=R(t.polygons),{vertices:r,indices:u,outlineIndices:l,outlineRingLengths:c}=i(t.positions,o,3,e);return r.length%3!=0?D("positions-not-multiple-of-3"):{succeeded:!0,positions:r,indices:u,outlineIndexBuffer:e?l:void 0,outlineRingLengths:e?c:void 0,vertexCount:r.length/3,method:"libtess"}}function w(t,n,e){for(let o=0;o<t.length;o+=3){const s=t[o+n];t[o+n]=t[o+e],t[o+e]=s}}function A(t,n){const e=h(t.length);let o=0;for(let r=0;r<t.length;r++){const s=t[r],i=s.count;if(i<=0){e[r]=0;continue}const u=3*s.index,l=3*(s.index+i-1),c=i>1&&n[u]===n[l]&&n[u+1]===n[l+1]&&n[u+2]===n[l+2]?i-1:i,h=c>0?c+1:0;e[r]=h,o+=h}const s=h(o);let i=0;for(let r=0;r<t.length;r++){const n=e[r];if(0===n)continue;const o=t[r].index,u=n-1;for(let t=0;t<u;t++)s[i++]=o+t;s[i++]=o}return{outlineIndexBuffer:s,outlineRingLengths:e}}function R(t){const n=t.reduce((t,n)=>t+n.pathLengths.length,0),e=new Array(n);let o=0;for(let s=0;s<t.length;s++){const n=t[s].pathLengths;for(let t=0;t<n.length;t++)e[o++]=n[t]}return e}function B(t){return t.polygons.reduce((t,n)=>{if(null==n.holeIndices)return t;if(0===n.pathLengths.length)return t;let e=0;for(let o=0;o<n.pathLengths.length;o++)e+=n.pathLengths[o];return t+(e-n.pathLengths[0])},0)}function k(t,{index:n,count:e}){return l(t,3*n,3*e)}function S(t,n,e,o,s,i){let r=i?t.length-1:0;const u=i?-1:1;e*=3;for(let l=0;l<o;++l){const o=t[r];n[e++]=o[0],n[e++]=o[1],n[e++]=s&&null!=o[2]?o[2]:0,r+=u}return e/3}function C(t,n){const e=t.length;if(e<2)return!1;const o=t[0],s=t[e-1];return o[0]===s[0]&&o[1]===s[1]&&(!n||o[2]===s[2])}function U(t,n){return C(t,n)?t.length-1:t.length}function D(t){return{succeeded:!1,message:t}}export{m as axisFromRings,x as isCounterClockwise,v as load,a as ringsToOutlinedTessellationInfo,j as tessellate,L as tessellateOrLoad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{set as t,transformMat3 as a,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../../geometry/support/aaBoundingBox.js";import{encodeSymbolColor as s}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as n}from"../../../support/orientedBoundingBox.js";import{ComponentParametersUniform as l,ComponentParametersVarying as m}from"./ComponentDrawParameters.js";import{UniformComponentParameters as
|
|
2
|
+
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{set as t,transformMat3 as a,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../../geometry/support/aaBoundingBox.js";import{encodeSymbolColor as s}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as n}from"../../../support/orientedBoundingBox.js";import{ComponentParametersUniform as l,ComponentParametersVarying as m}from"./ComponentDrawParameters.js";import{UniformComponentParameters as c}from"./UniformComponentParameters.js";import{olidEnabled as h}from"../../effects/geometry/olidUtils.js";import{defaultHighlightName as d}from"../../../../support/HighlightDefaults.js";class p{constructor(e,t,a,r,o,i){this._collection=e,this.transform=t,this.obb=a,this._componentData=r,this._renderable=o,this._intersectionGeometry=i,this.visible=!1,this.offsetObb=null,this._aabbInWorldCoordinates=null}destroy(){this._collection.materials.release(this._renderable.material),this._intersectionGeometry=e(this._intersectionGeometry),this._renderable=e(this._renderable),this._componentData=e(this._componentData)}get componentData(){return this._componentData}get renderable(){return this._renderable}get intersectionGeometry(){return this._intersectionGeometry}updateMaterial(e,t){const{_renderable:a}=this,r=a.material,{opacity:o,useFloatBlend:i,...s}=e,n=o??a.opacity,l=this._collection.materials.acquire({...r.parameters,...s,isObjectTransparent:n<1},a.geometry.parameters,t??a.drawParameters.componentParameters);this._collection.materials.release(r),l!==r&&a.updateMaterial(l)}get opacity(){return this.renderable.opacity}updateOpacity(e){this.opacity!==e&&(this._renderable.updateOpacity(e),this.updateMaterial({opacity:e}))}updateCameraDerivedParameters(e){const{eye:t}=e,{centerX:a,centerY:r,centerZ:o}=this.obb;this._renderable.meta.cameraDepthSquared=(t[0]-a)**2+(t[1]-r)**2+(t[2]-o)**2}setComponentData(e,t){const a=this._componentData,{materialDataBuffer:r,materialDataIndices:o}=a,i=new c,d=r.textureBuffer,p=d.getVec4Field("colorAndCastShadows"),f=d.getScalarField("elevationOffset"),b=d.getScalarField("emissiveStrength"),g=d.getScalarField("emissiveSourceMode"),y=d.getVec4Field("olidColor"),_=new Uint8Array(4),v=new Uint32Array(_.buffer);let M,w=0,C=0,S=0,x=0,D=0,O=a.verticalOffsets,P=1/0,j=-1/0,A=!1,I=!1,k=!1,B=0;for(let n=0;n<a.count;n++){e(n,i),w+=+(i.externalColor[3]<1),C+=+(3===i.externalColorMixMode&&1===i.externalColor[3]),x+=+(i.emissiveStrength>0),D+=+(1===i.emissiveSource),I||=1!==i.emissiveStrength,S+=+i.castShadows,s(i.externalColor,i.externalColorMixMode,_),_[2]=254&_[2]|+i.castShadows,p.setArray(o[n],_),A||=n>0&&B!==v[0],B=v[0],k||=0!==i.elevationOffset,k&&null==O&&(O=new Array(n).fill(0)),null!=O&&(O[n]=i.elevationOffset),P=Math.min(P,i.elevationOffset),j=Math.max(j,i.elevationOffset),f.set(o[n],i.elevationOffset),b.set(o[n],i.emissiveStrength),g.set(o[n],0===i.emissiveSource?0:255);const t=i.olidColor;null!=t&&y.setArray(o[n],t),i.pickable!==a.isPickable(n)&&a.updatePickabilityWithCount(n,i.pickable)}if(a.verticalOffsets=k?O:null,this.offsetObb=k?n(this.obb,P,j,t,this.offsetObb??this.obb.clone()):null,A||k||h()||(I||D>0)&&x>0){const{count:e}=a;M=new m(u(w,e),u(C,e),u(x,e),u(D,e),u(S,e)),d.updateTexture(),this._renderable.updateComponentParametersVarying(M,d)}else M=new l(i.externalColor,i.externalColorMixMode,i.emissiveStrength,i.emissiveSource,i.castShadows?0:2),this._renderable.updateComponentParametersUniform(M);this.updateMaterial({},M)}addHighlight(e,t){return this._componentData.addComponentHighlight(e,t)}removeHighlight(e,t){return this._componentData.removeComponentHighlight(e,t)}clearHighlights(){this._componentData.clearHighlights()}get aabbInWorldCoordinates(){let e=this._aabbInWorldCoordinates;return e||(e=this._computeAabbInWorldCoordinates(),this._aabbInWorldCoordinates=e),e}_computeAabbInWorldCoordinates(){const e=i(),{positions:o}=this._intersectionGeometry;if(Math.floor(o.length/3)>0){const{rotationScale:i,position:s}=this.transform;let n=1/0,l=1/0,m=1/0,c=-1/0,h=-1/0,d=-1/0;const p=g;for(let e=0;e<o.length;e+=3)t(p,o[e+0],o[e+1],o[e+2]),a(p,p,i),r(p,p,s),n=Math.min(n,p[0]),l=Math.min(l,p[1]),m=Math.min(m,p[2]),c=Math.max(c,p[0]),h=Math.max(h,p[1]),d=Math.max(d,p[2]);e[0]=n,e[1]=l,e[2]=m,e[3]=c,e[4]=h,e[5]=d}return e}submit(e,t){const{componentData:a,renderable:r}=this;if(r.drawParameters.opacity<=0)return;const{geometry:o,drawParameters:i,material:s}=r,n=r.meta.cameraDepthSquared,{geometryRanges:l,highlightRangesMap:m,shadowmapRanges:c}=a,h=e=>e.submitDraw(s,i,o,l,n);switch(s.materialPass){case 0:h(e.opaque);break;case 1:h(e.transparent);break;case 2:h(e.opaque),h(e.transparent);break;case 3:h(e.integratedMesh),f(t)&&h(e.occludedGround),b(t)&&h(e.highlightIntegratedMesh);break;case 4:h(e.transparentIntegratedMesh)}if(i.castAnyShadows){if(null!=m)for(const t of m)t[0]===d&&e.highlightShadowMap.submitDraw(s,i,o,t[1],n,t[0]);null!=c&&e.defaultShadowMap.submitDraw(s,i,o,c,n),h(e.shadowMap)}if(null!=m)for(const d of m)e.highlight.submitDraw(s,i,o,d[1],n,d[0]);t.viewshedEnabled&&h(e.viewshedShadowMap)}}function u(e,t){return e===t?0:0===e?2:1}function f(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}function b(e){return null!=e.overlay?.getTexture(2)}const g=o();export{p as ComponentObject};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as s,sync as o}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{c as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialRepository as j}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as C}from"../../lib/SamplerRepository.js";import{VertexArrayObject as M}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as w}from"../../lib/verticalOffsetUtils.js";import{BufferManager as R}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as x,IndexGlLayout as H}from"../../materials/DefaultLayouts.js";import{BufferObject as D}from"../../../../webgl/BufferObject.js";import{PrimitiveType as A}from"../../../../webgl/enums.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";const E=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let B=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new R(r,x());const l=2===this._viewingMode?0:i?1:2;this.materials=new j(a,l),this.samplers=new C(r.gl),this.addHandles(s(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},o))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),s=this._createRenderable(e,t,n),o=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,s,o);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const s=e,o=s.componentData.verticalOffsets;if(n||null==o)return i;const r=o[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=w(r);return a.localOrigin=s.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let s=0;s<i;++s)if(t[s]!==e[s].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const s=e,{componentData:o}=s,r=o.count,{verticalOffsets:a}=o,{intersectionGeometry:l}=s,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,o=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+o+t,l=c[e+5]+o+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==o){const e=w(o);e.localOrigin=s.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersect(e,t,i,n,s,o){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;return null!=n&&(n.localOrigin=a.position),h.intersect(t,i,n,l.verticalOffsets,a,s,o)}addEdges(e,t,i,n,s){const o=e,{indices:r,positions:a}=o.intersectionGeometry,l=o.componentData.offsets;return t.addComponentObject(o,a,r,l,i,n,s)}async extractEdgeInformation(e,t,i){const n=e,s=n.componentData.visibility;if(s.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:o,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,o,a);const p=c.count,d=this._computeVisibilityIndices(o,s,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let s=0;s<i.length-1;s++){const o=i[s],r=i[s+1];for(let i=o;i<r;i++){const s=t?t[i]:i;e.set(s,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let s=0;t.forEachComponentRange((e,t)=>(s+=i[t]-i[e],!0));const o=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(s):new Uint32Array(s):new Array(s);let a=0;return t.forEachComponentRange((t,n)=>{const s=i[t],r=i[n];for(let i=s;i<r;i++)o[a++]=e?e[i]:i;return!0}),o}addHighlight(e,t,i){const n=e,s=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,s+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)E().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&E().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,s=e.geometry,o=s.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=s.renderGeometryData,h=new I(n,o,r),c=a?D.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],s=i.offsets[n+1],o=i.materialDataIndices[n];if(null!=a)for(let i=t;i<s;i++){e[a[i]]=o}else for(let i=t;i<s;i++)e[i]=o}const t=new I(n,H,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new M(n,new Map(g),c),u=a?.length??l,b=new y(p,A.TRIANGLES,s.parameters,null!=c,u),O=this.materials.acquire(t,b.parameters,d),j=new _(h.usedMemory+m+(c?.usedMemory??0)),C=this.samplers.addFromTexture(t.baseColorTexture?.texture),w=new f(e,t,C);return new v(O,w,b,j)}_requestRender(){this._renderPassManager.requestRender()}};B=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],B);const V=h();export{B as ComponentObjectCollection};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as s,sync as o}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{c as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialParameters as j}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as M}from"../../lib/SamplerRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as R}from"../../lib/verticalOffsetUtils.js";import{BufferManager as x}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as H,IndexGlLayout as D}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as I}from"../../../../webgl/enums.js";import{VertexBuffer as E}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let V=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new x(r,H());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new M(r.gl),this.addHandles(s(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},o))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),s=this._createRenderable(e,t,n),o=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,s,o);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const s=e,o=s.componentData.verticalOffsets;if(n||null==o)return i;const r=o[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=R(r);return a.localOrigin=s.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let s=0;s<i;++s)if(t[s]!==e[s].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const s=e,{componentData:o}=s,r=o.count,{verticalOffsets:a}=o,{intersectionGeometry:l}=s,h=2===this._viewingMode,c=l.getComponentAabbs(),m=P;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,o=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+o+t,l=c[e+5]+o+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==o){const e=R(o);e.localOrigin=s.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersect(e,t,i,n,s,o){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;return null!=n&&(n.localOrigin=a.position),h.intersect(t,i,n,l.verticalOffsets,a,s,o)}addEdges(e,t,i,n,s){const o=e,{indices:r,positions:a}=o.intersectionGeometry,l=o.componentData.offsets;return t.addComponentObject(o,a,r,l,i,n,s)}async extractEdgeInformation(e,t,i){const n=e,s=n.componentData.visibility;if(s.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:o,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,o,a);const p=c.count,d=this._computeVisibilityIndices(o,s,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let s=0;s<i.length-1;s++){const o=i[s],r=i[s+1];for(let i=o;i<r;i++){const s=t?t[i]:i;e.set(s,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let s=0;t.forEachComponentRange((e,t)=>(s+=i[t]-i[e],!0));const o=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(s):new Uint32Array(s):new Array(s);let a=0;return t.forEachComponentRange((t,n)=>{const s=i[t],r=i[n];for(let i=s;i<r;i++)o[a++]=e?e[i]:i;return!0}),o}addHighlight(e,t,i){const n=e,s=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,s+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,s=e.geometry,o=s.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=s.renderGeometryData,h=new E(n,o,r),c=a?A.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],s=i.offsets[n+1],o=i.materialDataIndices[n];if(null!=a)for(let i=t;i<s;i++){e[a[i]]=o}else for(let i=t;i<s;i++)e[i]=o}const t=new E(n,D,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new w(n,new Map(g),c),u=a?.length??l,b=new y(p,I.TRIANGLES,s.parameters,null!=c,u),O=new j(t),C=this.materials.acquire(O,b.parameters,d),M=new _(h.usedMemory+m+(c?.usedMemory??0)),R=this.samplers.addFromTexture(t.baseColorTexture?.texture),x=new f(e,t,R);return new v(C,x,b,M)}_requestRender(){this._renderPassManager.requestRender()}};V=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],V);const P=h();export{V as ComponentObjectCollection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{ComponentTechnique as e}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as t}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as s}from"../../../core/material/MaterialBase.js";import{isColor as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";class i extends s{constructor(e,s,r,a,i){super(),this.parameters=e,this.key=i;const n=l(e,r);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=0!==n?3:0,this.materialPass=o(e,r),this._configuration=new t(a),this._initializeMaterialConfiguration(e,s,r)}destroy(){}acquireTechnique(t,s,r,a){const i=this._updateConfiguration(s,r);return t.get(e,i,a.layout)}_initializeMaterialConfiguration(e,t,s){const r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture,r.sphereDepthInterpolate=e.sphereDepthInterpolate&&r.spherical,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=e.doubleSided?1:0,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.vertexNormalRotationType=t.vertexNormalRotationType,r.componentDataType=s.componentDataType,r.emissionSource=l(e,s)}_updateConfiguration(e,t){const s=this._configuration,{identifier:i}=e,o=0===i;s.output=t.output,s.enableOITOffset=t.enableOITOffset,s.hasEmission=t.hasEmission&&o,s.renderOccluded=9===t.slot;const n=this.isIntegratedMesh?c(t)?u(t)?3:2:1:0;s.integratedMeshMode=n,s.pbrMode=3===n?4:this.usePBR?this.hasParametersFromSource?0!==s.shadeNormals&&this.isIntegratedMesh?0:2:1:0,s.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,s.isGroundSlice=s.hasSlicePlane&&this.isGround;const{materialPass:l}=this;s.transparent=o&&(1===l||2===l&&e.transparent||4===l)||s.isGroundSlice,s.hasHighlightMixTexture=2===i&&null!=t.highlightMixTexture,s.snowCover=o&&t.snowCover>0,s.vertexDiscardMode=o&&2===l?e.transparent?2:1:0;const h=r(t.output);return s.receiveAmbientOcclusion=h&&this.applySSAO&&!s.renderOccluded&&null!=t.ssao?.getTexture(),s.receiveGlobalIllumination=h&&this.applySSAO&&!s.renderOccluded&&t.globalIlluminationEnabled,s.hasOccludees=h&&t.hasOccludees,s.receiveShadows=h&&t.shadowMap.ready,s.hasShadowHighlights=a(s,t),s.screenSpaceReflections=t.hasScreenSpaceReflections,s.cloudReflections=h&&null!=t.clouds.data?.cubeMap?.colorTexture,s}}function o(e,t){const{alphaDiscardMode:s,isIntegratedMesh:r,slicePlaneEnabled:a}=e,{transparent:i,opaqueOverride:o}=t,n=e.isObjectTransparent,l=e.hasBaseColorTransparency;if(r)return n||a?4:3;if(n)return 1;if(0===o)return 0;if(l||0===s||3===s)return 1;switch(i){case 2:return 0;case 0:return 1;case 1:return 2}}function n(e){return e.hasEmissionTexture||e.hasEmissiveBaseColor}function l(e,t){const s=e.hasEmissionTexture,{emissiveSourceOverride:r}=t,a=1===r,i=2===r;return 2!==t.emissiveOverride&&(n(e)||2!==r)?n(e)?i?s?4:2:a?s?5:7:6:a?7:6:0}function u(e){return null!=e.overlay?.getTexture(3)}function c(e){return null!=e.overlay?.getTexture(1)}export{i as ComponentMaterial,o as computeMaterialPass,l as getEmissionSource};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
class e{constructor(e){this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.sphereDepthInterpolate=e.sphereDepthInterpolate,this.doubleSided=e.doubleSided,this.cullFace=e.cullFace,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.alphaDiscardMode=e.alphaDiscardMode,this.isIntegratedMesh=e.isIntegratedMesh,this.polygonOffset=e.polygonOffset,this.ellipsoidMode=e.ellipsoidMode,this.applySSAO=e.applySSAO}}class s extends e{constructor(e){super(e),this.hasBaseColorTransparency=e.baseColor[3]<1,this.hasEmissiveBaseColor=0!==e.emissiveBaseColor[0]||0!==e.emissiveBaseColor[1]||0!==e.emissiveBaseColor[2],this.isObjectTransparent=e.opacity<1,this.hasBaseColorTexture=null!=e.baseColorTexture,this.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,this.hasNormalTexture=null!=e.normalTexture,this.hasOcclusionTexture=null!=e.occlusionTexture,this.hasEmissionTexture=null!=e.emissionTexture}}export{e as ComponentMaterialBaseParameters,s as ComponentMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{ComponentMaterial as e,computeMaterialPass as r,
|
|
2
|
+
import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{ComponentMaterial as e,computeMaterialPass as r,getEmissionSource as t}from"./ComponentMaterial.js";import{ComponentMaterialGlobalParameters as o}from"./ComponentMaterialGlobalParameters.js";class s{constructor(e,r){this._store=new Map,this.globals=new o(e,r)}destroy(){this._store.forEach(({material:e})=>e.destroy()),this._store.clear()}acquire(r,t,o){const s=this.globals,i=a(r,t,o,s),n=this._store.get(i);if(n)return n.refCount++,n.material.key,n.material;const l=new e(r,t,o,s,i);return this._store.set(i,{material:l,refCount:1}),l}release(e){const{key:r}=e,t=this._store.get(r);if(!t||t.refCount<1)throw new Error("Internal error in material repository");1===t.refCount?this._store.delete(r):t.refCount--}}function a(e,o,s,a){const i=r(e,s),n=t(e,s);return"|"+ +a.useFloatBlend+`|${+e.usePBR}|${+e.hasParametersFromSource}|${+e.isGround}`+`|${+e.slicePlaneEnabled}|${+e.isIntegratedMesh}|${+e.applySSAO}`+`|${+i}|${+s.componentDataType}|${+n}`+`|${+e.sphereDepthInterpolate}|${+e.ellipsoidMode}|${+e.doubleSided}`+`|${+e.cullFace}|${+e.alphaDiscardMode}`+`|${+o.hasVertexColors}|${+o.textureCoordinateType}`+`|${+o.shadeNormals}|${+o.hasNormals}`+`|${e.polygonOffset}|${+o.vertexPositionRotationType}|${+o.vertexNormalRotationType}|`+ +e.hasBaseColorTexture+"|"+ +e.hasEmissionTexture+"|"+ +e.hasMetallicRoughnessTexture+"|"+ +e.hasOcclusionTexture+"|"+ +e.hasNormalTexture+"|"+ +s.emissiveOverride}export{s as ComponentMaterialRepository,a as makeMaterialKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as
|
|
2
|
+
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as f,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as g,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as _}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{A as j}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as A,ColorAttachment0 as q,PrimitiveType as x}from"../../../../webgl/enums.js";import C from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new j,this._vao=null,this._passParameters=new g,this._configuration=new _}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof C?e.color.toUnitRGBA():c;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._configuration.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??c,this.requestRender(1)},o),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(b,this._configuration),this.techniques.precompile(v)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=w(s,1);const i=r.getAttachment(A);this._update();const o=this.techniques.getCompiled(b,this._configuration);if(!o)return this.requestRender(1),r;if(!this._configuration.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._passParameters),s.setDrawBuffers([q]),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const a=this.techniques.get(v);if(!a.compiled)return this.requestRender(1),r;const n=s.getViewport(),m=this.bindParameters.camera,c=h(m.eye)-p.radius;let u;const f=p.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));u=t(.3,.6,e)}const l=this.renderingContext.parameters.maxTextureSize,g=P(Math.round(u*m.fullViewport[2]),l),_=P(Math.round(u*m.fullViewport[3]),l);s.setViewport(0,0,g,_);const j=this.fboCache.acquire(g,_,"chapman",5);return s.bindFramebuffer(j.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(o,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=j.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([q]),s.screen.draw(),r.attachDepth(i),j.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+p.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=f(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};T=e([a("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as p}from"../OpaqueEnvironment.js";import{S as f}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h,layout as
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as p}from"../OpaqueEnvironment.js";import{S as f}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h,layout as c}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as l}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as u}from"./SimpleAtmosphereTexture.js";import{createPolySphereData as b}from"../../lib/GeometryUtil.js";import{VertexArrayObject as _}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as d,PrimitiveType as g}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as w}from"../../../../webgl/VertexBuffer.js";let x=class extends p{constructor(){super(...arguments),this._configuration=new l,this._passParameters=new f,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=1,this.addHandles([r(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(h,this._configuration)}render(e){const t=e.find(({name:e})=>e===m.OPAQUE_ENVIRONMENT),r=this.techniques.getCompiled(h,this._configuration);if(!r)return this.requestRender(1),t;const s=this.renderingContext;if(this._vao||(this._vao=A(s),this._vaoCount=this._vao.vertexCount("geometry")),!this._passParameters.texture){const e=new j(1,512);e.wrapMode=33071,e.flipped=!0,this._passParameters.texture=new v(s,e,u)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return s.setDrawBuffers([d]),P(C,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",C),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(g.TRIANGLES,0,this._vaoCount),t}};function A(e){const t=b(1,2,!1),{data:r,indices:s}=t[0][1],i=c.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new _(e,new w(e,n(c),i.buffer))}function P(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}x=e([i("esri.views.3d.webgl-engine.effects.atmosphere.LocalAtmosphere")],x);const C=a();export{x as LocalAtmosphere};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{lerp as e,clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as m}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as p,scale as c,add as l,distance as u,cross as _,squaredLength as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as x}from"../../../../../geometry/support/FloatArray.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{makePiecewiseLinearFunction as j}from"../../../support/mathUtils.js";import{glLayout as V}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as P}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as
|
|
2
|
+
import{__decorate as t}from"tslib";import{lerp as e,clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as m}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as p,scale as c,add as l,distance as u,cross as _,squaredLength as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as x}from"../../../../../geometry/support/FloatArray.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{makePiecewiseLinearFunction as j}from"../../../support/mathUtils.js";import{glLayout as V}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as P}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as w}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as R}from"./MarsAtmosphereTexture.js";import{S as A}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as y,layout as S}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as q}from"./SimpleAtmosphereTechniqueConfiguration.js";import{createQuadVAO as F}from"../../lib/glUtil3D.js";import{project as M}from"../../lib/Util.js";import{VertexArrayObject as T}from"../../lib/VertexArrayObject.js";import{PrimitiveType as U}from"../../../../webgl/enums.js";import E from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as O}from"../../../../webgl/VertexBuffer.js";const N=128,I=-w,W=0,B=50,D=()=>1-511/512,G=j([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let L=class extends P{constructor(t){super(t),this._passParameters=new A,this._configuration=new q,this._vao=null,this._fadeVao=null,this._texV1=1;const e=t.view,r=g(e.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+I/i,this._middleRimFactor=1+W/i,this._outerRimFactor=1+s/i,this._texV0=W/s,this._texVScale=this._texV1-this._texV0;const o=e.stage.renderView.techniques;o.precompile(y,this._configuration),this._configuration.geometry=2,o.precompile(y,this._configuration)}initialize(){this.addHandles(i(()=>this.view.environment.atmosphereEnabled,t=>t?this._enable():this._disable(),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT);this._update();const r=this.renderingContext;if(!this._passParameters.texture){const t=new C(1,512);t.wrapMode=33071,t.flipped=!0,this._passParameters.texture=new E(r,t,R)}if(this._passParameters.undergroundFadeAlpha<1){this._vao??=this._createRibbon(r),this._configuration.geometry=0;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(U.TRIANGLES,0,this._vao.vertexCount("geometry"))}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao??=F(r),this._configuration.geometry=2;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(U.TRIANGLE_STRIP,0,this._fadeVao.vertexCount("geometry"))}return e}_update(){const t=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(t.eye),a=o-i;if(a<0){const t=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=t}else this._passParameters.undergroundFadeAlpha=0;const m=Math.max(B,a),n=i+I;this._passParameters.innerScale=J(i+m,i,n)-1,this._passParameters.altitudeFade=v(a),c(s,t.eye,(i+B)/o),k(s,t.center,t.up,i,this._passParameters.silhouette);const l=this._computeScreenRimWidth(t,s,t.up,this._passParameters.silhouette),u=D(),_=G(a);let f=this._texV0+u*this._texVScale,g=this._texV0+l*_*this._texVScale;if(a>B){k(t.eye,t.center,t.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(t,t.eye,t.up,this._passParameters.silhouette),o=r((s-1.5)/(l-1.5),0,1);f=this._texV0+o*u*this._texVScale,g=this._texV0+e(this._texV1,l*_,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(t){const e=x(3+3*N*3),r=new Uint32Array(3*N*5);e[0]=0,e[1]=0,e[2]=-1;for(let o=0;o<N;o++){const t=9*o+3;e[t]=o,e[t+1]=this._innerRimFactor,e[t+2]=-1,e[t+3]=o,e[t+4]=this._middleRimFactor,e[t+5]=0,e[t+6]=o,e[t+7]=this._outerRimFactor,e[t+8]=1;const s=3*o+1,i=o===N-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=S.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const t=3*r[o];i.set(o,0,e[t]),i.set(o,1,e[t+1]),i.set(o,2,e[t+2])}return new T(t,new O(t,V(S),s.buffer))}_computeScreenRimWidth(t,e,r,s){return l(H,s.center,s.v2),c(Q,H,this._outerRimFactor),m(z,e,H,r),M(H,z,t.projectionMatrix,t.viewport,H),M(Q,z,t.projectionMatrix,t.viewport,Q),u(H,Q)/t.height}};function k(t,e,r,s,i){const o=p(t),a=s*Math.sqrt(o*o-s*s)/o,m=Math.sqrt(s*s-a*a),n=i.v1,h=i.v2;return c(i.center,t,m/o),_(n,t,e),f(n)<1&&_(n,t,r),c(n,n,a/p(n)),_(h,n,t),c(h,h,a/p(h)),a}L=t([a("esri.views.3d.webgl-engine.effects.atmosphere.MarsAtmosphere")],L);const z=n(),H=d(),Q=d();function J(t,e,r){return t*t/(Math.sqrt(t*t-e*e)*Math.sqrt(t*t-r*r)+e*r)}export{L as MarsAtmosphere};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}precompile(){this.bindParameters.clouds.data&&this.techniques.precompile(n)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
|