@arcgis/core 4.32.0-next.20250107 → 4.32.0-next.20250108
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/WebLinkChart.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
- package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
- package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
- package/assets/esri/core/workers/chunks/{f6d6bc43ac1c13892d44.js → 58485909e1cfeb52c01e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c49707b577f3805f0142.js → 5b61a1e7ac60a02a906d.js} +1 -1
- package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
- package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
- package/assets/esri/core/workers/chunks/{dca0eb66116e4b5403fc.js → 7df076d15b7b7a66dcee.js} +1 -1
- package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
- package/assets/esri/core/workers/chunks/{4423aac6e44c3dbf184e.js → 89286d8f59844724cd16.js} +1 -1
- package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
- package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/interfaces.d.ts +175 -91
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapNotesLayer.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/support/ImageElement.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/linkChart/OrganicLayoutSettings.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/support/mediaLayerUtils.js +5 -0
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/views/2d/AnimationManager.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/support/HighlightGroup.js +1 -1
- package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/placementUtils.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/HighlightGroup.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TilePerLayerInfo.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/layers/MediaLayerView.js +1 -1
- package/views/support/HighlightGroup.d.ts +4 -0
- package/views/support/HighlightGroup.js +5 -0
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/FeatureTable/support/exportUtils.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
- package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
- package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +0 -1
- package/assets/esri/core/workers/chunks/c05e0bd145a1c27d6857.js +0 -2
- package/views/2d/support/HighlightGroup.d.ts +0 -4
- /package/assets/esri/core/workers/chunks/{c05e0bd145a1c27d6857.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{isIterable as s}from"../../../core/iteratorUtils.js";import{getProjectiveTransform as a}from"../../../core/perspectiveUtils.js";import{debounce as o,isPromiseLike as d}from"../../../core/promiseUtils.js";import{watch as l,on as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toExtent as u}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import{DrapeSourceType as _}from"./interfaces.js";import{LayerView3D as f}from"./LayerView3D.js";import{MediaLayerInteraction as E}from"./support/MediaLayerInteraction.js";import{drapedZ as D}from"../terrain/OverlayRenderer.js";import{Attribute as w}from"../webgl-engine/lib/Attribute.js";import{Geometry as v}from"../webgl-engine/lib/Geometry.js";import{DirtyState as b,DirtyOperation as j}from"../webgl-engine/lib/ModelDirtyTypes.js";import{Object3DHighlightStateID as R}from"../webgl-engine/lib/Object3DStateID.js";import{RenderGeometry as I}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as H}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as A}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as T}from"../webgl-engine/materials/ImageMaterial.js";import x from"../../layers/LayerView.js";import M from"../../layers/MediaLayerView.js";import{defaultHighlightName as P}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";import{TextureWrapMode as L}from"../../webgl/enums.js";let V=class extends(f(M(x))){get interactive(){return this._interaction.enabled}set interactive(e){this._interaction&&(this._interaction.enabled=e)}get selectedElement(){return this._interaction.selectedElement}set selectedElement(e){this._interaction&&(this._interaction.selectedElement=e)}get visibleAtCurrentScale(){return S(this.layer.effectiveScaleRange,this.view.scale)}constructor(e){super(e),this.type="media-3d",this.drapeSourceType=_.Features,this.updatePolicy=G.ASYNC,this._uidToElement=new Map,this._highlightedElements=new Map,this._elementsInHighlightedId=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=o((async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)}),0);const{view:t,layer:r}=e;this._interaction=new E({view:t,layer:r}),this.addHandles(l((()=>this.interactionOptions),(e=>this._interaction.options=e),h))}initialize(){const{view:e,layer:t}=this;this._renderer=e.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const i=()=>this._updateWithLastDrapingExtent();this.addHandles([r((()=>e.basemapTerrain.overlayManager.unregisterDrapeSource(this))),m((()=>t.effectiveSource),"change",i),m((()=>t.effectiveSource),"refresh",i)]),this._updatingHandles.add((()=>this.suspended),i)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}highlight(e,t){const i=new R(t??P),n=s(e)?Array.from(e):[e];this._elementsInHighlightedId.set(i,n);for(const r of n){const e=this._highlightedElements.get(r);e?e.add(i):this._highlightedElements.set(r,new Set([i]));const t=this._renderedElements.get(r);t?.renderData&&(t.renderData.renderGeometry.geometry.addHighlight(i),this._renderer.modifyGeometries([t.renderData.renderGeometry],b.HIGHLIGHT))}return r((()=>{const e=this._elementsInHighlightedId.get(i);if(e){for(const t of e){const e=this._highlightedElements.get(t);if(!e)continue;e.delete(i);const r=this._renderedElements.get(t);r?.renderData&&(r.renderData.renderGeometry.geometry.removeHighlight(i),this._renderer.modifyGeometries([r.renderData.renderGeometry],b.HIGHLIGHT)),0===e.size&&this._highlightedElements.delete(t)}this._elementsInHighlightedId.delete(i)}}))}isUpdating(){return super.isUpdating()||this._interaction.updating}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch((()=>{})))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(u(e.extent,t),{signal:r}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){this._renderedElements.forEach(((t,r)=>{e.has(r)||(this._removeElement(r,t),this.emit("element-render-changed",{element:r}))}))}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(e,t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new y({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:i([this._updatingHandles.add((()=>e.opacity),(e=>{null!=r.renderData&&r.renderData.material.setParameters({opacity:e})})),this._updatingHandles.add((()=>t.coords),(()=>{null!=r.renderData?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)})),this._updatingHandles.add((()=>e.content),(()=>this._initializeRenderData(t,r))),n(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e,{contentWidth:n,contentHeight:s}=i;if(null==r||null==i.content)return void(t.renderData=this._destroyRenderData(i,t.renderData));if(null!=t.renderData)return;const a=this._createTexture(i.content),o=a.load(this.view._stage.renderView.renderingContext);this.view._stage.add(a),d(o)&&this._updatingHandles.addPromise(o);const l=new T({initTextureTransparent:!0,textureId:a.id,opacity:i.opacity,perspectiveInterpolation:!0}),m=this._getPositionAttributeArray(r),h=[0,0,1,0,1,1,0,1],c=this._getPerspectiveDivideAttributeArray(m,n,s),p=[0,1,2,0,2,3],g=new v(l,[[A.POSITION,new w(m,p,3,!0)],[A.UV0,new w(h,p,2,!0)],[A.PERSPECTIVEDIVIDE,new w(c,p,1,!0)]]),u=new I(g,{layerUid:this.layer.uid,graphicUid:i.uid}),y=this._highlightedElements.get(i);y?.forEach((e=>{u.geometry.addHighlight(e)})),this._renderer.addGeometries([u],j.ADD),t.renderData={renderGeometry:u,texture:a,material:l},this.emit("element-render-changed",{element:i})}_updateGeometry(e,t,r){const{coords:i,element:n}=e;if(null==i||null==n.content)return void(t.renderData=this._destroyRenderData(n,t.renderData));const s=this._getPositionAttributeArray(i);r.renderGeometry.geometry.setAttributeData(A.POSITION,s);const a=this._getPerspectiveDivideAttributeArray(s,n.contentWidth,n.contentHeight);r.renderGeometry.geometry.setAttributeData(A.PERSPECTIVEDIVIDE,a),r.renderGeometry.geometry.invalidateBoundingInfo(),this._renderer.modifyGeometries([r.renderGeometry],b.GEOMETRY),this.emit("element-render-changed",{element:n})}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],D,n[0],n[1],D,i[0],i[1],D,r[0],r[1],D]}_getPerspectiveDivideAttributeArray(e,t,r){a(z,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=z[6]/z[8]*t,n=z[7]/z[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e,t){if(null==t)return null;const r=t.texture;return r.unload(),this.view._stage.remove(r),this._renderer.removeGeometries([t.renderGeometry],j.REMOVE),this.emit("element-render-changed",{element:e}),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new H(e,{wrap:{s:L.CLAMP_TO_EDGE,t:L.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){}};e([c({readOnly:!0})],V.prototype,"type",void 0),e([c()],V.prototype,"layer",void 0),e([c()],V.prototype,"interactive",null),e([c()],V.prototype,"selectedElement",null),e([c({readOnly:!0})],V.prototype,"visibleAtCurrentScale",null),V=e([p("esri.views.3d.layers.MediaLayerView3D")],V);const z=g(),O=V;export{O as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextRenderAlignment as c,textVerticalPaddingPx as n}from"../../webgl-engine/lib/TextRenderer.js";const i=Object.freeze({left:0,center:.5,right:1}),s=Object.freeze({"bottom-left":r(0,0),bottom:r(.5,0),"bottom-right":r(1,0),left:r(0,.5),center:r(.5,.5),right:r(1,.5),"top-left":r(0,1),top:r(.5,1),"top-right":r(1,1)});function f(t){switch(t){case"left":return c.Left;case"right":return c.Right;default:return c.Center}}function a(t){switch(t){case"bottom-left":case"left":case"top-left":return"left";case"bottom":case"center":case"top":return"center";case"bottom-right":case"right":case"top-right":return"right"}}function l(t){switch(t){case"bottom-left":case"bottom":case"bottom-right":return"bottom";case"left":case"center":case"right":return"center";case"top-left":case"top":case"top-right":return"top"}}function m(t,e){switch(e){case"bottom":return"left"===t?"bottom-left":"right"===t?"bottom-right":"bottom";case"center":return t;case"top":return"left"===t?"top-left":"right"===t?"top-right":"top"}}function u(t){return"middle"===t?"center":t}function h(r,c){switch(r){case"top":return e(c,0,n);case"bottom":return e(c,0,-
|
|
5
|
+
import{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextRenderAlignment as c,textVerticalPaddingPx as n}from"../../webgl-engine/lib/TextRenderer.js";const i=Object.freeze({left:0,center:.5,right:1}),s=Object.freeze({"bottom-left":r(0,0),bottom:r(.5,0),"bottom-right":r(1,0),left:r(0,.5),center:r(.5,.5),right:r(1,.5),"top-left":r(0,1),top:r(.5,1),"top-right":r(1,1)});function f(t){switch(t){case"left":return c.Left;case"right":return c.Right;default:return c.Center}}function a(t){switch(t){case"bottom-left":case"left":case"top-left":return"left";case"bottom":case"center":case"top":return"center";case"bottom-right":case"right":case"top-right":return"right"}}function l(t){switch(t){case"bottom-left":case"bottom":case"bottom-right":return"bottom";case"left":case"center":case"right":return"center";case"top-left":case"top":case"top-right":return"top"}}function m(t,e){switch(e){case"bottom":return"left"===t?"bottom-left":"right"===t?"bottom-right":"bottom";case"center":return t;case"top":return"left"===t?"top-left":"right"===t?"top-right":"top"}}function u(t){return"middle"===t?"center":t}function h(r,c){switch(r){case"top":return e(c,0,n);case"bottom":return e(c,0,-1);default:return t(c,o)}}export{m as anchorFromPlacements,a as horizontalPlacementFromAnchor,i as horizontalPlacementToAnchorX,s as namedAnchorToHUDMaterialAnchorPos,f as textRenderAlignmentFromHorizontalPlacement,u as verticalPlacementFromAlignment,l as verticalPlacementFromAnchor,h as verticalScreenOffsetFromAlignment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as s}from"../../../../core/typedArrayUtil.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as l,t as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as y,expandPointInPlace as h,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{a as S}from"../../../../chunks/sphere.js";import b from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as v,compute as j}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as M}from"../../../support/layerViewUtils.js";import C from"../../../../geometry/SpatialReference.js";function U(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&F(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function D(e,t,r){let o=0,n=0;for(let s=0;s<t.length&&o<e.length;s++)e[o]===t[s]&&(r(s)&&(e[n]=e[o],n++),o++);e.length=n}function W(e,r,o){let n=0,s=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[s]=o[n],s++),n++}o.length=s}function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();var q;function F(e,t){const r=t[0],o=t[1],n=t[3],s=e[0]-r,i=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(s,i,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(s,i,a,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function L(e,t,r){const o=[],n=r?.missingFields,s=r?.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,s&&s.push(i);break}!r&&n&&n.push(i)}return o}async function A(e,t,r,n,s,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await P(e.associatedLayer,t,r,n,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const l=K(t,r,s);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>G(c,a,t.node,t.indices,n,e.apiKey,e.customParameters,i).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],s=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<s.length;t++){const r=s[t],a=r.featureIds.indexOf(e);if(a>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(a),e.graphics.push(i);for(let r=t;r>0;r--)s[r]=s[r-1];s[0]=r;break}}}return n}async function P(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const s=t.map((e=>e.attributes[r])),i=[],a=L(o,e.fields,{originalFields:i}),l=await B(e,s,a,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function B(e,t,n,s){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>B(e,t,n,s)))).then((e=>e.flat()))}const a=new b({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a,s).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function G(e,t,r,o,n,s,i,a){return V(e,t,r.resources.attributes,o,n,s,i,a)}async function V(t,r,o,n,s,i,a,l){const c=[];for(const e of r)if(e&&s.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...a,token:i},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=Q(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const $=-32768,z=-(2**31);function Q(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(s(e))return r===z?null:r;return r!=r?null:r}function Z(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function H(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function J(e,t,r){if(!p(e,t))throw M("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Y(e,t))throw M("scene layer",e?.wkid,t?.wkid)}function X(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function Y(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,r){const o=Z(e),n=H(e);J(o,t,r),J(n,t,r)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function re(e){if(null==e.store?.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function oe(e,t){ee(e,t.spatialReference,t.viewingMode)}function ne(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ne(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ie(e,t){J(e.spatialReference,t.spatialReference,t.viewingMode)}function ae(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function le(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!ae(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!le(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ue=T({color:[0,0,0,0],opacity:0});class fe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){const t=new fe;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,s=n.edges;if(null!=e&&!r){const o=e.color,s=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:s}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==s||o||(t.edgeMaterial=E(s,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function me(e,t){return(0|e)+(0|t)|0}function de(e,t,r,o,n,s,a){if(!s||0===s.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,n,"none",r,t);i(Ee,f);let p=null;const d=()=>{if(!p)if(p=ge,y(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(we,r,t,n,a),we.getCorners(p);for(const e of p)c(e,e,Ee),h(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const s=o[3];m(S(o),r,Ie,t),c(Ie,Ie,Ee),Ie[2]+=n;for(let e=0;e<8;++e){const t=1&e?s:-s,r=2&e?s:-s,o=4&e?s:-s,n=p[e];u(n,[Ie[0]+t,Ie[1]+r,Ie[2]+o]),h(be,n)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Se);const n=r.spatialReference||o,s=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Ie,r[0],r[1],r[2]),m(Ie,n,Ie,t),c(Ie,Ie,Ee),h(Se,Ie),Math.min(Ie[2],e))),e)),1/0);d(),g(be,Se)&&(b=Math.min(b,s),w=Math.max(w,s))};if(s.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=b,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=w,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2]};for(let i=0;i<8;++i)E(Te.data,3*i,p[i]);return j(Te)}function ye(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ge=[f(),f(),f(),f(),f(),f(),f(),f()],Se=d(),be=d(),we=new v,Ie=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ee=a();export{q as MbsIntersectResult,fe as SymbolInfo,me as addWraparound,ie as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,X as checkRecyclable,oe as checkSceneLayerCompatibleWithView,re as checkSceneLayerValid,J as checkSpatialReference,ee as checkSpatialReferences,de as computeVisibilityObb,k as containsDraco,U as extractWkid,D as filterInPlace,L as findFieldsCaseInsensitive,N as findIntersectingNodes,Q as getCachedAttributeValue,_ as getClipRect,Z as getIndexCrs,pe as getSymbolInfo,H as getVertexCrs,F as intersectBoundingRectWithMbs,he as invalidateMbs,Y as isSupportedLocalModeProjection,ye as isValidMbs,W as objectIdFilter,V as queryAttributesFromCachedAttributesId,ce as rendererNeedsTextures,ue as transparentEdgeMaterial,A as whenGraphicAttributes};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as s}from"../../../../core/typedArrayUtil.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as l,t as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as y,expandPointInPlace as h,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{a as S}from"../../../../chunks/sphere.js";import b from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as v,compute as j}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as M}from"../../../support/layerViewUtils.js";import C from"../../../../geometry/SpatialReference.js";function U(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&F(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function D(e,t,r){let o=0,n=0;for(let s=0;s<t.length&&o<e.length;s++)e[o]===t[s]&&(r(s)&&(e[n]=e[o],n++),o++);e.length=n}function W(e,r,o){let n=0,s=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[s]=o[n],s++),n++}o.length=s}function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();var q;function F(e,t){const r=t[0],o=t[1],n=t[3],s=e[0]-r,i=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(s,i,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(s,i,a,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function L(e,t,r){const o=[],n=r?.missingFields,s=r?.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,s&&s.push(i);break}!r&&n&&n.push(i)}return o}async function A(e,t,r,n,s,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await P(e.associatedLayer,t,r,n,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const l=K(t,r,s);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>G(c,a,t.node,t.indices,n,e.apiKey,e.customParameters,i).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],s=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<s.length;t++){const r=s[t],a=r.featureIds.indexOf(e);if(a>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(a),e.graphics.push(i);for(let r=t;r>0;r--)s[r]=s[r-1];s[0]=r;break}}}return n}async function P(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const s=t.map((e=>e.attributes[r])),i=[],a=L(o,e.fields,{originalFields:i}),l=await B(e,s,a,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function B(e,t,n,s){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>B(e,t,n,s)))).then((e=>e.flat()))}const a=new b({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a,s).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function G(e,t,r,o,n,s,i,a){return V(e,t,r.resources.attributes,o,n,s,i,a)}async function V(t,r,o,n,s,i,a,l){const c=[];for(const e of r)if(e&&s.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...a,token:i},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=Q(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const $=-32768,z=-2147483648;function Q(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(s(e))return r===z?null:r;return r!=r?null:r}function Z(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function H(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function J(e,t,r){if(!p(e,t))throw M("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Y(e,t))throw M("scene layer",e?.wkid,t?.wkid)}function X(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function Y(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,r){const o=Z(e),n=H(e);J(o,t,r),J(n,t,r)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function re(e){if(null==e.store?.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function oe(e,t){ee(e,t.spatialReference,t.viewingMode)}function ne(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ne(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ie(e,t){J(e.spatialReference,t.spatialReference,t.viewingMode)}function ae(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function le(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!ae(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!le(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ue=T({color:[0,0,0,0],opacity:0});class fe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){const t=new fe;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,s=n.edges;if(null!=e&&!r){const o=e.color,s=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:s}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==s||o||(t.edgeMaterial=E(s,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function me(e,t){return(0|e)+(0|t)|0}function de(e,t,r,o,n,s,a){if(!s||0===s.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,n,"none",r,t);i(Ee,f);let p=null;const d=()=>{if(!p)if(p=ge,y(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(we,r,t,n,a),we.getCorners(p);for(const e of p)c(e,e,Ee),h(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const s=o[3];m(S(o),r,Ie,t),c(Ie,Ie,Ee),Ie[2]+=n;for(let e=0;e<8;++e){const t=1&e?s:-s,r=2&e?s:-s,o=4&e?s:-s,n=p[e];u(n,[Ie[0]+t,Ie[1]+r,Ie[2]+o]),h(be,n)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Se);const n=r.spatialReference||o,s=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Ie,r[0],r[1],r[2]),m(Ie,n,Ie,t),c(Ie,Ie,Ee),h(Se,Ie),Math.min(Ie[2],e))),e)),1/0);d(),g(be,Se)&&(b=Math.min(b,s),w=Math.max(w,s))};if(s.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=b,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=w,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2]};for(let i=0;i<8;++i)E(Te.data,3*i,p[i]);return j(Te)}function ye(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ge=[f(),f(),f(),f(),f(),f(),f(),f()],Se=d(),be=d(),we=new v,Ie=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ee=a();export{q as MbsIntersectResult,fe as SymbolInfo,me as addWraparound,ie as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,X as checkRecyclable,oe as checkSceneLayerCompatibleWithView,re as checkSceneLayerValid,J as checkSpatialReference,ee as checkSpatialReferences,de as computeVisibilityObb,k as containsDraco,U as extractWkid,D as filterInPlace,L as findFieldsCaseInsensitive,N as findIntersectingNodes,Q as getCachedAttributeValue,_ as getClipRect,Z as getIndexCrs,pe as getSymbolInfo,H as getVertexCrs,F as intersectBoundingRectWithMbs,he as invalidateMbs,Y as isSupportedLocalModeProjection,ye as isValidMbs,W as objectIdFilter,V as queryAttributesFromCachedAttributesId,ce as rendererNeedsTextures,ue as transparentEdgeMaterial,A as whenGraphicAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as t,c as r,a as e,f as n,b as i,i as s,G as o,e as u,g as c,h as f,H as a}from"../../../../chunks/vec32.js";import{create as l,freeze as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as S}from"../../../../geometry/support/frustum.js";import{fromValues as b,signedDistance as F}from"../../../../geometry/support/plane.js";import{ViewingMode as G}from"../../../ViewingMode.js";import{Visibility as M}from"./FeatureTileDescriptor.js";import{Frustum as R}from"../../state/Frustum.js";class T{constructor(t,r){this._renderCoordsHelper=t,this._getIsGroundOpaque=r,this._isGroundOpaque=!1,this._cache=new Map,this._cameraForward=l(),this._cameraEye=l(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=l(),this._frustumBoundingSphereRadius=0,this._frustum=new R(t),this._renderSR=t.spatialReference;const e=d(this._renderSR);this._renderSREllipsoidRadius=p(e).radius}begin(e){this._aboveGround=e.aboveGround,this._isGroundOpaque=this._getIsGroundOpaque(),this._frustum.update(e),t(this._cameraForward,e.viewForward),r(this._cameraEye,e.eye),this._cameraFovY=e.fovY,this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(t){return this._getOrCalculateSingleTileVisibility(t)}_getOrCalculateSingleTileVisibility(t){const r=this._cache.get(t.id);if(null!=r)return r;const e=this._calculateSingleTileVisibility(t);return this._cache.set(t.id,e),e}_calculateSingleTileVisibility(t){return this._calculateSingleTileVisibilitySided(t)}_isTileVisibleInFrustum(t){return this._renderCoordsHelper.viewingMode===G.Local?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const r=this._frustum,s=r.origin,o=D;t(o,r.direction);const u=r.points,c=N;e(c,u[4],s);const f=.5*n(c,c)/n(o,c),a=this._frustumBoundingSphereCenter;i(a,s,o,f);const l=1+f;this._frustumBoundingSphereRadius=l}_isTileVisibleInFrustumLocal(t){const r=t.tilingScheme.spatialReference,u=t.extent,c=this._renderSR,f=C;if(f[0]=u[0],f[1]=u[1],f[2]=0,f[3]=u[2],f[4]=u[3],f[5]=0,!_(f,r,0,f,c,0))return!1;const a=x;s(a[0],f[0],f[1],0),s(a[1],f[3],f[1],0),s(a[2],f[3],f[4],0),s(a[3],f[0],f[4],0);const l=L;s(l,.5*(f[0]+f[3]),.5*(f[1]+f[4]),.5*(f[2]+f[5]));const h=Rt,m=.5*o(a[0],a[2]),p=this._frustum,d=this._frustumBoundingSphereRadius,g=this._frustumBoundingSphereCenter,S=z;e(S,g,l);const b=n(h,S),F=W;i(F,l,h,b);if(o(F,g)>m+d)return!1;const G=this._cameraForward,M=n(G,Rt),R=this._cameraFovY,T=this._cameraEye;if(Math.abs(M)<Math.abs(Math.cos(.5*R))){let t=!0;const r=s(Tt,G[0],G[1],0),e=n(T,r);for(let i=0;i<4;++i){const s=a[i];if(n(s,r)-e>0){t=!1;break}}if(t)return!1}{const t=a[0],r=a[2];if(t[0]<=T[0]&&T[0]<=r[0]&&t[1]<=T[1]&&T[1]<=r[1])return!0}const j=E,y=this._isGroundOpaque&&this._aboveGround,V=this._isGroundOpaque&&!this._aboveGround,I=Math.min(V?bt:1/0,b+d),v=Math.max(y?-
|
|
5
|
+
import{n as t,c as r,a as e,f as n,b as i,i as s,G as o,e as u,g as c,h as f,H as a}from"../../../../chunks/vec32.js";import{create as l,freeze as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as S}from"../../../../geometry/support/frustum.js";import{fromValues as b,signedDistance as F}from"../../../../geometry/support/plane.js";import{ViewingMode as G}from"../../../ViewingMode.js";import{Visibility as M}from"./FeatureTileDescriptor.js";import{Frustum as R}from"../../state/Frustum.js";class T{constructor(t,r){this._renderCoordsHelper=t,this._getIsGroundOpaque=r,this._isGroundOpaque=!1,this._cache=new Map,this._cameraForward=l(),this._cameraEye=l(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=l(),this._frustumBoundingSphereRadius=0,this._frustum=new R(t),this._renderSR=t.spatialReference;const e=d(this._renderSR);this._renderSREllipsoidRadius=p(e).radius}begin(e){this._aboveGround=e.aboveGround,this._isGroundOpaque=this._getIsGroundOpaque(),this._frustum.update(e),t(this._cameraForward,e.viewForward),r(this._cameraEye,e.eye),this._cameraFovY=e.fovY,this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(t){return this._getOrCalculateSingleTileVisibility(t)}_getOrCalculateSingleTileVisibility(t){const r=this._cache.get(t.id);if(null!=r)return r;const e=this._calculateSingleTileVisibility(t);return this._cache.set(t.id,e),e}_calculateSingleTileVisibility(t){return this._calculateSingleTileVisibilitySided(t)}_isTileVisibleInFrustum(t){return this._renderCoordsHelper.viewingMode===G.Local?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const r=this._frustum,s=r.origin,o=D;t(o,r.direction);const u=r.points,c=N;e(c,u[4],s);const f=.5*n(c,c)/n(o,c),a=this._frustumBoundingSphereCenter;i(a,s,o,f);const l=1+f;this._frustumBoundingSphereRadius=l}_isTileVisibleInFrustumLocal(t){const r=t.tilingScheme.spatialReference,u=t.extent,c=this._renderSR,f=C;if(f[0]=u[0],f[1]=u[1],f[2]=0,f[3]=u[2],f[4]=u[3],f[5]=0,!_(f,r,0,f,c,0))return!1;const a=x;s(a[0],f[0],f[1],0),s(a[1],f[3],f[1],0),s(a[2],f[3],f[4],0),s(a[3],f[0],f[4],0);const l=L;s(l,.5*(f[0]+f[3]),.5*(f[1]+f[4]),.5*(f[2]+f[5]));const h=Rt,m=.5*o(a[0],a[2]),p=this._frustum,d=this._frustumBoundingSphereRadius,g=this._frustumBoundingSphereCenter,S=z;e(S,g,l);const b=n(h,S),F=W;i(F,l,h,b);if(o(F,g)>m+d)return!1;const G=this._cameraForward,M=n(G,Rt),R=this._cameraFovY,T=this._cameraEye;if(Math.abs(M)<Math.abs(Math.cos(.5*R))){let t=!0;const r=s(Tt,G[0],G[1],0),e=n(T,r);for(let i=0;i<4;++i){const s=a[i];if(n(s,r)-e>0){t=!1;break}}if(t)return!1}{const t=a[0],r=a[2];if(t[0]<=T[0]&&T[0]<=r[0]&&t[1]<=T[1]&&T[1]<=r[1])return!0}const j=E,y=this._isGroundOpaque&&this._aboveGround,V=this._isGroundOpaque&&!this._aboveGround,I=Math.min(V?bt:1/0,b+d),v=Math.max(y?-430:-1/0,b-d);for(let e=0;e<4;++e)i(j[e],a[e],h,I),i(j[e+4],a[e],h,v);if(B(p.planes,j,8))return!1;if(O(p.planes,j,8))return!0;for(let e=0;e<4;++e){const t=j[e],r=j[e+4];if(jt(p.planes,t,r))return!0;const n=j[(e+1)%4];if(jt(p.planes,t,n))return!0;const i=j[4+(e+1)%4];if(jt(p.planes,r,i))return!0}if(It[0][3]=+a[0][0],It[1][3]=-a[2][0],It[2][3]=+a[0][1],It[3][3]=-a[2][1],It[4][3]=+v,It[5][3]=-I,O(It,p.points))return!0;if(O(It,p.points))return!0;for(let e=0;e<4;++e){const t=T,r=p.points[e+4];if(yt(It,t,r))return!0;const n=p.points[4+(e+1)%4];if(yt(It,r,n))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.lij[0]<q)return!0;const h=r.tilingScheme.spatialReference,p=r.extent,d=this._isGroundOpaque&&this._aboveGround,_=this._isGroundOpaque&&!this._aboveGround,S=x,b=.5*(p[0]+p[2]);if(s(S[0],p[0],p[1],0),s(S[1],p[2],p[1],0),s(S[2],p[2],p[3],0),s(S[3],p[0],p[3],0),s(S[4],b,p[1],0),s(S[5],b,p[3],0),!g(S,h,0,S,this._renderSR,0,6))return!1;const G=S[0][2]>0,M=S[3][2]<0,R=G||M,T=this._renderSREllipsoidRadius;if(R){const t=m(0,0,1),r=k;j(r,t,S[0]);const e=H;if(j(e,t,S[1]),G){const n=P,i=S[4],s=Y;j(s,i,t),j(n,s,i);const o=S[0];u(o,r,n),V(o,T);const c=S[1];u(c,e,n),V(c,T)}else if(M){const n=P,i=S[5],s=Y;j(s,i,t),j(n,i,s);const o=S[3];u(o,n,r),V(o,T);const c=S[2];u(c,n,e),V(c,T)}}const I=L;{const r=e(Z,S[3],S[0]);t(r,r);const s=c($,S[0],S[3]);f(s,s,.5);const o=-n(s,r),u=c(tt,S[0],S[1]);f(u,u,.5);const a=c(rt,S[2],S[3]);f(a,a,.5);const l=e(et,a,u);t(l,l);const h=-(o+n(r,u))/n(r,l);i(I,u,l,h),V(I,T)}const v=this._frustumBoundingSphereRadius,O=this._frustumBoundingSphereCenter,E=this._frustum,C=E.planes,D=A;t(D,I);const N=n(S[0],D)/a(S[0]),W=E.origin,z=E.points;let ut=!1;if(d){{ut=!0;const r=t(l(),W);for(let i=0;i<4;++i){const s=z[4+i],o=e(l(),s,W);t(o,o);const c=u(l(),r,o);t(c,c);const f=u(l(),o,c);t(f,f);if(n(W,f)>T){ut=!1;break}}}if(ut){if(n(W,D)<T*N-bt)return!1}const r=t(Ft,E.origin);if(n(r,D)<0)return!1;{const r=t(Gt,E.direction);if(n(r,D)>Mt)return!1}}const dt=Math.sqrt(1-N*N);if(dt>.9)return!0;let _t=!1;{const t=n(D,O),r=a(O);if(r<=v&&!C.some((t=>F(t,J)>0))){if(!d)return!0;_t=!0}const e=t/r;if(!_t&&t<=0){if(-t>v)return!1}const i=v/r;if(Math.sqrt(1-e*e)*Math.sqrt(1-i*i)-i*e>dt)return!1}if(!ut){if(S.some((t=>E.intersectsPoint(t))))return!0;if(E.intersectsPoint(I))return!0}const gt=K;e(gt,O,J);const Rt=n(gt,D),Tt=U;f(Tt,D,Rt);const jt=o(Tt,O),yt=h.isWGS84,Vt=r.lij,It=yt&&Vt[2]===2**Vt[0]-1,vt=yt&&0===Vt[2],Bt=vt?ht:It?at:ct,Ot=vt?mt:It?lt:ft;if(!_t){const t=S,r=pt,e=nt,n=it,i=J;for(const s of Bt){const o=t[s];if(y(e,t[(s+1)%4],o),y(n,i,o),j(r,n,e),w(r,z,1))return!1}}let qt=null;if(!d&&Rt<1.01*v){const t=2.5*v;if(jt>N*t+v)return!1;const r=X,e=t/N;for(let n=0;n<4;++n)f(r[n],S[n],e/T);s(r[4],0,0,0),qt=r}else{const t=(_?T+bt:Rt+v)/N,r=d?T-bt:(Rt-v)/N,e=Q;for(let n=0;n<4;++n){const i=S[n];f(e[n],i,r/T),f(e[n+4],i,t/T)}qt=e}if(B(C,qt,qt.length))return!1;const wt=E.lines,Et=st,Ct=ot;for(const n of wt){t(Ct,n.direction);for(const r of Ot){const n=qt[r];if(t(Et,n),St(Ct,Et,qt,z))return!1;const i=(r+1)%4;if(d){const r=qt[i];if(e(Et,r,n),t(Et,Et),St(Ct,Et,qt,z))return!1}if(_){const n=qt[4+r],s=qt[4+i];if(e(Et,s,n),t(Et,Et),St(Ct,Et,qt,z))return!1}}}return!0}_calculateSingleTileVisibilitySided(t){return this._isTileVisibleInFrustum(t)?M.VISIBLE:M.INVISIBLE}}function j(r,e,n){return u(r,e,n),t(r,r),r}function y(r,n,i){return e(r,n,i),t(r,r),r}function V(t,r){return f(t,t,r/a(t)),t}const I=[S.LEFT,S.RIGHT,S.BOTTOM,S.TOP,S.FAR];function v(t,r,e){for(let n=0;n<e;++n)if(F(t,r[n])<=0)return!1;return!0}function B(t,r,e){for(const n of I)if(v(t[n],r,e))return!0;return!1}function O(t,r,e=r.length){for(let n=0;n<e;++n){const e=r[n];let i=!0;for(const r of t){if(F(r,e)>0){i=!1;break}}if(i)return!0}return!1}const q=2;function w(t,r,e){for(const i of r)if(n(i,t)<e)return!1;return!0}const E=[l(),l(),l(),l(),l(),l(),l(),l()],C=[0,0,0,0,0,0],x=[l(),l(),l(),l(),l(),l()],L=l(),P=l(),k=l(),H=l(),Y=l(),A=l(),U=l(),D=l(),N=l(),W=l(),z=l(),J=h(0,0,0),K=l(),Q=[l(),l(),l(),l(),l(),l(),l(),l()],X=[l(),l(),l(),l(),l()],Z=l(),$=l(),tt=l(),rt=l(),et=l(),nt=l(),it=l(),st=l(),ot=l(),ut=l(),ct=[0,1,2,3],ft=[0,1,2,3],at=[0,1,3],lt=[0,1,3],ht=[1,2,3],mt=[1,2,3],pt=l();function dt(t,r,e){let i=1/0,s=-1/0;for(const o of e){const t=n(r,o);i=Math.min(i,t),s=Math.max(s,t)}t[0]=i,t[1]=s}function _t(t,r,e,i){let s=1/0,o=-1/0;for(const u of i){const i=n(e,u);if(s=Math.min(s,i),o=Math.max(o,i),s<=r&&o>=t)return!1}return!0}const gt=[0,0];function St(t,r,e,n){if(0===e.length||0===n.length)return!0;const i=ut;j(i,t,r);const s=n[0]<e[0],o=s?e:n,u=gt;return dt(u,i,s?n:e),_t(u[0],u[1],i,o)}const bt=430,Ft=l(),Gt=l(),Mt=Math.cos(.25*Math.PI),Rt=m(0,0,1),Tt=l();function jt(t,r,e){const n={t0:0,t1:1};for(const i of I){if(!Vt(t[i],r,e,n))return!1}return n.t0<n.t1}function yt(t,r,e){const n={t0:0,t1:1};for(const i of t){if(!Vt(i,r,e,n))return!1}return n.t0<n.t1}function Vt(t,r,e,n){let{t0:i,t1:s}=n;const o=F(t,r),u=F(t,e);if(o>=0&&u>=0)return!1;if(o<0&&u>=0){const t=-o/(u-o);if(t<i)return!1;t<s&&(s=t)}else if(o>=0&&u<0){const t=o/(o-u);if(t>s)return!1;t>i&&(i=t)}return n.t0=i,n.t1=s,!0}const It=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)];export{T as FeatureTileVisibility3D,q as globalTileLevelThreshold,O as isAnyVertexInPolyhedron,B as isConvexHullOutsideOfFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as y}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as v}from"../../support/geometryUtils/ray.js";import{defaultTolerance as I,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=I,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(N,r,i),N[0]+=.0466,N[1]-=.0123,_(e,N,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=I){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return v(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==f.Local||null==e||n(t,e.origin,s(g.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=y(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:f}=c.state;if("absolute-height"===d){const t=u?.getAltitude(f.eye),r=o(s(S,e.direction),u.worldUpAtPosition(f.eye,D));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,S)){const e=R(c,S);return e.z??=0,e.z-=p,e}return null}const _=t(g.get());f.projectToRenderScreen(e.origin,_);const v=new k(null,this._forEachLayer),{slicePlane:I}=c,j=null!=I?M(I):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(g.get(),x,e.direction);U.reset(x,T,f),U.point=_;const E=a?"type"in a&&"graphics"===a.type?e=>e.layerUid!==a.uid:e=>e.graphicUid!==a.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(v.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(S)){const e=R(c,S);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(g.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(g.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of n){!a.filterLayerUid(s)?i&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=g.get(),y=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=y.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=y.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=g.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,y.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),g=Math.min(h(n)+2*T,o-a),y=Math.min(d(n)+2*T,l-m),f=g>0&&y>0?new Uint8Array(g*y*4):null;f&&this._view._stage.renderer.readHUDVisibility(a,m,g,y,f);let R=!0;const _=null==e.results.max.dist;let v=0;for(const{item:c,occlusionTest:u}of i){let t=!u;if(u&&f)for(const e of E){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-n[0]+(Math.min(c.screenPoint[1]+e[1],l)-n[1])*g);if(r>=0&&r<f.length&&f[r]){t=!0;break}}t&&(R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===w.ALL&&e.results.all.splice(v++,0,c.result))}}}const T=1,E=(()=>{const e=[],t=T;for(let r=-
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{g as n,n as s,f as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as y}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as v}from"../../support/geometryUtils/ray.js";import{defaultTolerance as I,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";class x{constructor(t,r,i){this.viewingMode=t,this._forEachLayer=r,this._view=i,this._externalIntersectionHandlers=new e,this._tolerance=I,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),A(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,A(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(N,r,i),N[0]+=.0466,N[1]-=.0123,_(e,N,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(i)&&i.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=I){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return v(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==f.Local||null==e||n(t,e.origin,s(g.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(e,r,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=i(c.spatialReference),d=null!=r?r.mode:"absolute-height",p=y(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:f}=c.state;if("absolute-height"===d){const t=u?.getAltitude(f.eye),r=o(s(S,e.direction),u.worldUpAtPosition(f.eye,D));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,S)){const e=R(c,S);return e.z??=0,e.z-=p,e}return null}const _=t(g.get());f.projectToRenderScreen(e.origin,_);const v=new k(null,this._forEachLayer),{slicePlane:I}=c,j=null!=I?M(I):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,T=n(g.get(),x,e.direction);U.reset(x,T,f),U.point=_;const E=a?"type"in a&&"graphics"===a.type?e=>e.layerUid!==a.uid:e=>e.graphicUid!==a.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!E||E(e))&&!!e.lastValidElevationBB;U.intersect(v.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(S)){const e=R(c,S);return e.z=l,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(g.get());o.projectToRenderScreen(e.origin,l);const a=new k(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,u=n(g.get(),e.origin,e.direction);r.reset(c,u,o),r.intersect(a.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(a.sliceableLayers,l,this._tolerance,d);const p=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,i=Array.isArray(t),n=i?t:[t];i&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of n){!a.filterLayerUid(s)?i&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,c,u,l,s)}}));const m=g.get(),y=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=y.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=y.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=g.get();this._view.renderCoordsHelper.fromRenderCoords(m,i,y.spatialReference),i[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,i,r.results.ground,(e=>a.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,i=[],n=this._tmpRegion,s=e=>{const t=new H(e),s=t.result.target.object.geometries.every((e=>e.material instanceof U&&e.material.parameters.occlusionTest));i.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),p(n,t.screenPoint))};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!i.length)return;n[0]===n[2]&&(n[2]+=1),n[1]===n[3]&&(n[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,n[0]-T),m=Math.max(0,n[1]-T),g=Math.min(h(n)+2*T,o-a),y=Math.min(d(n)+2*T,l-m),f=g>0&&y>0?new Uint8Array(g*y*4):null;f&&this._view._stage.renderer.readHUDVisibility(a,m,g,y,f);let R=!0;const _=null==e.results.max.dist;let v=0;for(const{item:c,occlusionTest:u}of i){let t=!u;if(u&&f)for(const e of E){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-n[0]+(Math.min(c.screenPoint[1]+e[1],l)-n[1])*g);if(r>=0&&r<f.length&&f[r]){t=!0;break}}t&&(R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===w.ALL&&e.results.all.splice(v++,0,c.result))}}}const T=1,E=(()=>{const e=[],t=T;for(let r=-1;r<=t;r++)for(let i=-1;i<=t;i++)e.push([i+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function A(e){return L&&L.viewingMode===e||(L=b(e)),L}class k{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function F(e){return"object"==typeof e&&"intersect"in e}const S=l(),D=l(),N=r();export{x as SceneIntersectionHelper,F as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./HighlightOptions.js";import{defaultHighlightName as p,temporaryHighlightName as i,temporaryHighlightColor as n}from"../../support/HighlightDefaults.js";import m from"../../support/HighlightGroup.js";var c;let l=c=class extends m{constructor(o){super(o)}clone(){return new c({name:this.name,options:this.options.clone()})}};function a(){return new(r.ofType(l))(has("enable-feature:multiple-highlights")?[new l({name:p,options:new s}),new l({name:i,options:new s({color:n})})]:[new l({name:p,options:new s})])}o([t({type:s})],l.prototype,"options",void 0),l=c=o([e("esri.views.3d.support.HighlightGroup")],l);export{l as HighlightGroup,a as makeDefaultHighlightGroups};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,g as s,h as o,H as n,e as r,f as a,G as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f,PlaneIndex as m}from"../../../geometry/support/frustum.js";import{c as g,a as x}from"../../../chunks/sphere.js";import{PatchType as $}from"./interfaces.js";import{createSphericalGlobePatch as _,updateCornerSpherical as v,updateEdgesAndCornersSpherical as M,updateEdgeElevationsAndResolutionsSpherical as S}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as b,internalAssert as j,almostEquals as T}from"./terrainUtils.js";import{Tile as E,CenterPosition as H}from"./Tile.js";import{TileFrustumVisibility as B}from"./TileFrustumVisibility.js";import{compareTilesByLij as I}from"./tileUtils.js";class y extends E{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=g(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const a=this.ellipsoid.radius,l=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(l,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-l)*Math.cos(m)*a,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=a-Math.sqrt(a*a-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])i(x(t[H.MIDDLE]),0,0,0),i(t[H.TOP],0,0,0),i(t[H.BOTTOM],0,0,0),t[H.MIDDLE][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[H.MIDDLE],i=this.convexHull;let s=0;for(let t=0;t<8;++t)s=Math.max(s,D(x(e),i,3*t));t[H.MIDDLE][3]=Math.sqrt(s)}}_calculateFrustumVisibilityStatus(t){if(!p(t,this._boundingSphere))return B.OUTSIDE;if(this.lij[0]<10)return B.INTERSECTS;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=o===m.NEAR,r=t[o],a=r[0],l=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(a*e[i]+l*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return B.OUTSIDE}return s?B.INSIDE:B.INTERSECTS}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){_(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),b&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=x(t),r=this.elevationBoundsMin,a=this.elevationBoundsMax,l=this.ellipsoid.radius,h=a;if(0===this.level)i(e,0,0,0),t[3]=l+h;else{const i=this.extentInRadians,h=.5*(i[0]+i[2]),u=i[1],d=i[3];O(V,h,u,l),O(A,h,d,l),s(e,V,A);o(e,e,(l+.5*(r+a))/n(e));const c=this.convexHull;let p=0;const f=(t,e)=>{const i=t[0]-c[3*e],s=t[1]-c[3*e+1],o=t[2]-c[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const i=f(e,t);p=Math.max(p,i)}const m=p;t[3]=m+2}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const l=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&c===$.HAS_NORTH_POLE,m=p&&c===$.HAS_SOUTH_POLE,g=m||f,x=Math.PI/2,_=t[0],v=t[2],M=m?-x:t[1],S=f?x:t[3],b=.5*(_+v),E=l,H=i+(g?Math.min(0,E-1):E),B=(t,e,i)=>O(t,e,i,H),I=u(),y=u(),L=u(),D=u();B(I,_,M),B(y,_,S),B(L,v,S),B(D,v,M);const R=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};R(I,0),R(y,1),R(L,2),R(D,3);const V=d,A=i+(g?Math.max(0,V+1):V),C=u(),F=u(),N=u();O(F,b,S,H),O(N,b,M,H),s(C,F,N),e(C,C);const U=u(),k=u(),w=(t,i)=>{h(k,t,i),e(k,k);const n=-a(t,U)/a(k,U);j(n>=0),o(k,k,n),s(t,t,k)};if(2**this.lij[0]>2*this.lij[1]){const t=N,i=u();r(i,P,t),e(i,i),r(U,t,i),e(U,U),j(T(a(U,t)/n(t),0)),w(I,y),w(D,L),R(I,0),R(D,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=F,i=u();r(i,P,t),e(i,i),r(U,i,t),e(U,U),w(y,I),w(L,D),R(y,1),R(L,2)}const q=(t,e)=>{const i=A/a(e,C);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};q(4,I),q(5,y),q(6,L),q(7,D)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?$.HAS_BOTH_POLES:$.HAS_NORTH_POLE:i?$.HAS_SOUTH_POLE:$.REGULAR}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=o[0]-t[0],l=o[1]-t[1],h=o[2]-t[2],u=(a*e[0]+l*e[1]+h*e[2])/r,d=e[0]*u-a,c=e[1]*u-l,p=e[2]*u-h;return d*d+c*c+p*p<n*n}get minimumVerticesPerSide(){return this.level<L.length?L[this.level]+1:2}updateCornerElevations(){v(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){M(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){S(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!b)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=x(t),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,$=1,_=0,v=this._center[H.MIDDLE][3],M=this.convexHull,S=(t,e)=>{for(let i=0;i<3;++i)t[i]=M[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),l=(l,u,d,c)=>{S(i,l),S(s,u),S(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=a(t,s);S(n,c);const f=a(t,n),m=Math.abs(f-p);j(T(m,0),`Non coplanar ${l},${u},${d},${c} diff = ${m}`)};l(0,1,2,3),l(4,5,6,7),l(0,1,4,5),l(1,2,5,6),l(2,3,6,7),l(3,0,7,4)}const E=c(24),B=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)E[s+o]=e[o];E[s+3]=i},y=u(),L=u(),D=u(),P=u(),V=(t,i,s,o)=>{S(y,i),S(L,s),S(D,o),h(y,y,L),e(y,y),h(D,D,L),e(D,D),r(P,y,D),e(P,P);const n=a(P,L);B(t,P,n)};V(0,0,1,2),V(1,1,0,4),V(2,1,5,2),V(3,3,2,6),V(4,4,0,3),V(5,4,6,5);const A=
|
|
5
|
+
import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,g as s,h as o,H as n,e as r,f as a,G as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f,PlaneIndex as m}from"../../../geometry/support/frustum.js";import{c as g,a as x}from"../../../chunks/sphere.js";import{PatchType as $}from"./interfaces.js";import{createSphericalGlobePatch as _,updateCornerSpherical as v,updateEdgesAndCornersSpherical as M,updateEdgeElevationsAndResolutionsSpherical as S}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as b,internalAssert as j,almostEquals as T}from"./terrainUtils.js";import{Tile as E,CenterPosition as H}from"./Tile.js";import{TileFrustumVisibility as B}from"./TileFrustumVisibility.js";import{compareTilesByLij as I}from"./tileUtils.js";class y extends E{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=g(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const a=this.ellipsoid.radius,l=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(l,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-l)*Math.cos(m)*a,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=a-Math.sqrt(a*a-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])i(x(t[H.MIDDLE]),0,0,0),i(t[H.TOP],0,0,0),i(t[H.BOTTOM],0,0,0),t[H.MIDDLE][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[H.MIDDLE],i=this.convexHull;let s=0;for(let t=0;t<8;++t)s=Math.max(s,D(x(e),i,3*t));t[H.MIDDLE][3]=Math.sqrt(s)}}_calculateFrustumVisibilityStatus(t){if(!p(t,this._boundingSphere))return B.OUTSIDE;if(this.lij[0]<10)return B.INTERSECTS;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=o===m.NEAR,r=t[o],a=r[0],l=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(a*e[i]+l*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return B.OUTSIDE}return s?B.INSIDE:B.INTERSECTS}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){_(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),b&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=x(t),r=this.elevationBoundsMin,a=this.elevationBoundsMax,l=this.ellipsoid.radius,h=a;if(0===this.level)i(e,0,0,0),t[3]=l+h;else{const i=this.extentInRadians,h=.5*(i[0]+i[2]),u=i[1],d=i[3];O(V,h,u,l),O(A,h,d,l),s(e,V,A);o(e,e,(l+.5*(r+a))/n(e));const c=this.convexHull;let p=0;const f=(t,e)=>{const i=t[0]-c[3*e],s=t[1]-c[3*e+1],o=t[2]-c[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const i=f(e,t);p=Math.max(p,i)}const m=p;t[3]=m+2}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const l=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&c===$.HAS_NORTH_POLE,m=p&&c===$.HAS_SOUTH_POLE,g=m||f,x=Math.PI/2,_=t[0],v=t[2],M=m?-x:t[1],S=f?x:t[3],b=.5*(_+v),E=l,H=i+(g?Math.min(0,E-1):E),B=(t,e,i)=>O(t,e,i,H),I=u(),y=u(),L=u(),D=u();B(I,_,M),B(y,_,S),B(L,v,S),B(D,v,M);const R=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};R(I,0),R(y,1),R(L,2),R(D,3);const V=d,A=i+(g?Math.max(0,V+1):V),C=u(),F=u(),N=u();O(F,b,S,H),O(N,b,M,H),s(C,F,N),e(C,C);const U=u(),k=u(),w=(t,i)=>{h(k,t,i),e(k,k);const n=-a(t,U)/a(k,U);j(n>=0),o(k,k,n),s(t,t,k)};if(2**this.lij[0]>2*this.lij[1]){const t=N,i=u();r(i,P,t),e(i,i),r(U,t,i),e(U,U),j(T(a(U,t)/n(t),0)),w(I,y),w(D,L),R(I,0),R(D,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=F,i=u();r(i,P,t),e(i,i),r(U,i,t),e(U,U),w(y,I),w(L,D),R(y,1),R(L,2)}const q=(t,e)=>{const i=A/a(e,C);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};q(4,I),q(5,y),q(6,L),q(7,D)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?$.HAS_BOTH_POLES:$.HAS_NORTH_POLE:i?$.HAS_SOUTH_POLE:$.REGULAR}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=o[0]-t[0],l=o[1]-t[1],h=o[2]-t[2],u=(a*e[0]+l*e[1]+h*e[2])/r,d=e[0]*u-a,c=e[1]*u-l,p=e[2]*u-h;return d*d+c*c+p*p<n*n}get minimumVerticesPerSide(){return this.level<L.length?L[this.level]+1:2}updateCornerElevations(){v(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){M(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){S(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!b)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=x(t),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,$=1,_=0,v=this._center[H.MIDDLE][3],M=this.convexHull,S=(t,e)=>{for(let i=0;i<3;++i)t[i]=M[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),l=(l,u,d,c)=>{S(i,l),S(s,u),S(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=a(t,s);S(n,c);const f=a(t,n),m=Math.abs(f-p);j(T(m,0),`Non coplanar ${l},${u},${d},${c} diff = ${m}`)};l(0,1,2,3),l(4,5,6,7),l(0,1,4,5),l(1,2,5,6),l(2,3,6,7),l(3,0,7,4)}const E=c(24),B=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)E[s+o]=e[o];E[s+3]=i},y=u(),L=u(),D=u(),P=u(),V=(t,i,s,o)=>{S(y,i),S(L,s),S(D,o),h(y,y,L),e(y,y),h(D,D,L),e(D,D),r(P,y,D),e(P,P);const n=a(P,L);B(t,P,n)};V(0,0,1,2),V(1,1,0,4),V(2,1,5,2),V(3,3,2,6),V(4,4,0,3),V(5,4,6,5);const A=(t,e,i,s)=>{const o=4*t;return E[o]*e+E[o+1]*i+E[o+2]*s-E[o+3]},C=(t,e,i,s)=>A(t,e,i,s)>=-1,F=(t,e)=>C(t,e[0],e[1],e[2]),N=2**this.lij[0]>2*this.lij[1],U=(t,e,s)=>Math.sqrt(R(t,e,s,o[0],o[1],o[2]))<i,k=t=>U(t[0],t[1],t[2]),w=(t,e)=>U(t[e],t[e+1],t[e+2]),q=this.extentInRadians,G=.5*(q[0]+q[2]),z=q[1],W=q[3],J=u(),K=u();O(J,G,W,g),O(K,G,z,g);const Q=N?"Upper":"Lower";let X=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=C(e,M[i],M[i+1],M[i+2]);X&&=s,j(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}j(F(e,K),`Tile[${this.lij}] (${Q}) bottom mid outside of plane ${e}`),j(F(e,J),`Tile[${this.lij}] (${Q}) top mid outside of plane ${e}`)}j(X,"Not all convex hull points are inside convex hull polyhedron"),j(k(K),`Tile[${this.lij}] (${Q}) bottom mid outside of bounding sphere`),j(k(J),`Tile[${this.lij}] (${Q}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=w(M,3*e);j(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;C(e,M[i],M[i+1],M[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:Y}=this,Z=Math.max(Y[2]-Y[0],Y[3]-Y[1]),tt=Math.round(Z*p),{renderData:et}=this;if(!et)return;const{geometry:it,geometryState:st,localOrigin:ot}=et,nt=it.vertexAttributes?.position;if(!nt)return;const rt=u(),at=it.numVerticesPerSide-2,{indices:lt,indexCount:ht,edgeVerticesStartIndex:ut,poleVerticesStartIndex:dt}=it;if(!lt)return;const ct=new Set;for(let e=0;e<ht;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const r=t<dt,a=t>=ut;let h=!1,u=-1;if(a){let e=ut;for(let i=0;i<4;++i){const s=st.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){u=i;break}}}const c=a?st.edgePeerNeighbors[u]:null,g=a&&c&&I(this,c)>0;nt.getVec(t,d),s(rt,d,ot);const x=n(rt)-p;let M=0,S=!1;const b=f-x,j=x-m,T=b>$,E=j>$,H=T||E,B=()=>{const e=r?"internal":a&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(T?"(below)":E?"(above)":"")+(g?"(Neighbor)":"")},y=l(rt,o);if(y>=i+_){const t=y-i;H||(console.error(`${B()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${_}] h=${x.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),S=!0)}for(let e=0;e<6;++e)if(!C(e,rt[0],rt[1],rt[2])){const s=A(e,rt[0],rt[1],rt[2]),o=t%at,n=(t-o)/at;0===e&&b||5===e&&j||(console.error(`${B()} (${o},${n})|${at}] is out of the bounding trapezoid plane ${e} h=${Math.round(x)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(v)}} : maxL = ${tt}`),++M)}if(S||M>0)break}}get convexHull(){return this._convexHull}}const L=[128,64,64,32,16,8,8,4];function D(t,e,i){return R(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function R(t,e,i,s,o,n){const r=s-t,a=o-e,l=n-i;return r*r+a*a+l*l}const O=(t,e,i,s)=>{const o=Math.cos(e),n=Math.sin(e),r=Math.cos(i),a=Math.sin(i);t[0]=s*r*o,t[1]=s*r*n,t[2]=s*a},P=[0,0,1],V=u(),A=u();export{y as SphericalPatch};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as t,abortMaybe as s}from"../../../core/maybe.js";import e from"../../../core/ObjectPool.js";import i from"../../../core/PooledArray.js";import{releaseTerrainData as a}from"./terrainUtils.js";import{computeUpsampleInfo as n}from"./tileUtils.js";class
|
|
5
|
+
import{disposeMaybe as t,abortMaybe as s}from"../../../core/maybe.js";import e from"../../../core/ObjectPool.js";import i from"../../../core/PooledArray.js";import{releaseTerrainData as a}from"./terrainUtils.js";import{computeUpsampleInfo as n}from"./tileUtils.js";class o{constructor(){this.waitingAgents=new i,this.pendingUpdates=0}static acquire(t){const s=l.acquire();return s._init(t),s}release(){this.dispose(),p.delete(this),l.release(this)}dispose(){this.loadingAgent=t(this.loadingAgent),this.abortRequest(),this._unsetUpsampleInfo(),this.pendingUpdates=0,this._data=a(this._data)}static prune(){l.prune(0)}_init(t){this.waitingAgents.clear(),this._data=a(this._data),this.dataMissing=!1,this.dataInvalidated=!1,this._unsetUpsampleInfo(),this.abortRequest(),this.loadingAgent=null,this.pendingUpdates=0,this._pool=t,this.elevationBounds=null}invalidateSourceData(){this.dataInvalidated=!0,this.dataMissing=!1,this._unsetUpsampleInfo()}abortRequest(){this.requestAbort=s(this.requestAbort),this.requestPromise=null}_unsetUpsampleInfo(){this.upsampleInfo&&(this.upsampleInfo.tile?.unrefMapData(),this._pool.release(this.upsampleInfo),this.upsampleInfo=null)}setUpsampleInfo(t,s){if(t!==s&&null!=s){if(null==this.upsampleInfo)this.upsampleInfo=this._pool.acquire();else{if(this.upsampleInfo.tile===s)return;this.upsampleInfo.tile?.unrefMapData()}s.refMapData(),n(t,s,this.upsampleInfo)}else this._unsetUpsampleInfo()}get data(){return this._data}set data(t){a(this._data),this._data=t}}const l=new e(o,null,(()=>{})),p=new Map;function r(){p.size>0&&(console.log(`${p.size} live TilePerLayerInfo allocations:`),p.forEach((t=>console.log(t,"\n"))))}export{o as TilePerLayerInfo,r as printAllocations};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as x,isVectorTileRenderInfo as b,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as j,isVectorTilePerLayerInfo as A}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as C}from"./TextureReference.js";import{TileCompositor as P}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import D from"./TileTexture.js";import{TileUpdate as E}from"./TileUpdate.js";import{fallsWithinLayerView as L}from"./tileUtils.js";import{blendModeFromString as R}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressionCandidate as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new P(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!L(e,t),b=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===b)&&!p){l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING);continue}++i;const w=x(t),j=z(e,h,w);if(j){if(l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(j)&&j.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,b=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,b,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new C(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,_.MAP),r=t.layer,T=x(t),y=z(e,j,T),w=r.opacity,A=!L(e,t);if(!y||(0===w||A)&&!c)continue;const O=!d(r)&&!l;O&&(l=!0);let C=!1;n.forEach((e=>{e.start===j&&(e.output=s?M.Composite:a&&O?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=O?u:1,K.push(e),this._compositor.openGroup(o),C=!0)}));const P=0===f,k=C?M.GroupBackgroundComposite:a&&P?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,D=R[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=O&&!C&&u<1?u:1,this._passParameters.opacity=w,b(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,D,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,D,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,D));K.length>0&&K[K.length-1].end===j;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,R[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new C(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return j(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx;let i;if("number"==typeof e)s.width=s.height=e,i=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),i=this._buildTileTexture(s,e.element.width,e.element);else try{s.width=e.width,s.height=e.height,i=this._buildTileTexture(s,e.width,e)}catch(n){i=new D(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=o.bindTexture(i.texture,v.TEXTURE_UNIT_FOR_UPDATES);return i.generateMipmap(),o.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),i}_buildTileTexture(e,t,r){const s=`${t} ${e.pixelFormat}`,a=this.cache.pop(s),n=B(r);if(a)return a.retain(),n&&a.texture.enableCompression(!0),a.texture.setData(r),a;e.shouldCompress=n;const c=new v(this.rctx,e);return c.setData(r)&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new D(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!A(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,M.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new C(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as x,isVectorTileRenderInfo as b,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as j,isVectorTilePerLayerInfo as A}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as C}from"./TextureReference.js";import{TileCompositor as P}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import D from"./TileTexture.js";import{TileUpdate as E}from"./TileUpdate.js";import{fallsWithinLayerView as L}from"./tileUtils.js";import{blendModeFromString as R}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressionCandidate as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new P(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!L(e,t),b=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===b)&&!p){l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING);continue}++i;const w=x(t),j=z(e,h,w);if(j){if(l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(j)&&j.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,b=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,b,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new C(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,_.MAP),r=t.layer,T=x(t),y=z(e,j,T),w=r.opacity,A=!L(e,t);if(!y||(0===w||A)&&!c)continue;const O=!d(r)&&!l;O&&(l=!0);let C=!1;n.forEach((e=>{e.start===j&&(e.output=s?M.Composite:a&&O?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=O?u:1,K.push(e),this._compositor.openGroup(o),C=!0)}));const P=0===f,k=C?M.GroupBackgroundComposite:a&&P?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,D=R[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=O&&!C&&u<1?u:1,this._passParameters.opacity=w,b(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,D,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,D,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,D));K.length>0&&K[K.length-1].end===j;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,R[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new C(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return j(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx;let i;if("number"==typeof e)s.width=s.height=e,i=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),i=this._buildTileTexture(s,e.element.width,e.element);else try{s.width=e.width,s.height=e.height,i=this._buildTileTexture(s,e.width,e)}catch(n){i=new D(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=o.bindTexture(i.texture,v.TEXTURE_UNIT_FOR_UPDATES);return i.generateMipmap(),o.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),i}_buildTileTexture(e,t,r){const s=`${t} ${e.pixelFormat}`,a=this.cache.pop(s)??this.cache.pop(s+"compressed"),n=B(r);if(a)return a.retain(),n&&a.texture.enableCompression(!0),a.texture.setData(r),a;e.shouldCompress=n;const c=new v(this.rctx,e);return c.setData(r)&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new D(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!A(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i&&o.tile?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,M.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new C(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t
|
|
5
|
+
import{isCompressedTexture as e}from"../../webgl/textureUtils.js";class t{constructor(e,t){this._texture=e,this._cache=t,this.type="tile-texture",this._refCount=1}retain(){++this._refCount}release(){--this._refCount,0===this._refCount&&(this._cache?(this._texture.isCompressing&&this._texture.abortCompression(),this._cache.put(this._generateCacheKey(),this)):this.dispose())}dispose(){this._texture.dispose()}get texture(){return this._texture}generateMipmap(){this._texture.generateMipmap()}_generateCacheKey(){return`${this._texture.descriptor.width} ${this._texture.descriptor.pixelFormat}`+(e(this._texture)?"compressed":"")}get descriptor(){return this._texture.descriptor}get cachedMemory(){return this._texture.usedMemory}}export{t as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n,MeshIntersectionOptions as r}from"../../lib/RayIntersections.js";const s=200,o=40,a=.8,c=10,h=1e-6;function l(t,e,i){const n=e,r=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(r[a]<=h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]<=-
|
|
5
|
+
import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n,MeshIntersectionOptions as r}from"../../lib/RayIntersections.js";const s=200,o=40,a=.8,c=10,h=1e-6;function l(t,e,i){const n=e,r=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(r[a]<=h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]<=-1e-6){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}{const e=t[a+3];if(n[a]>e){if(r[a]>=-1e-6)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]>=h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}}return!0}class d{constructor(t,e,i,n,r){this.aabb=t,this.axis=e,this.d=i,this.midStartIndex=n,this.rightStartIndex=r}}class f{constructor(i,n,r,s){this.globalTriangleVertexIndices=i,this.firstTriangleIndex=n,this.positions=s,this._rayDirection=e(),this._callback=R,this._intersectionOptions=I,this.bspNodeTree=new Array;const h=r-n,l=new(h<N?Uint8Array:h<b?Uint16Array:Uint32Array)(h);this.triangleIndexMap=l;for(let t=0;t<h;++t)l[t]=t;{const e=p(i,n,r,s.data,s.stride),f=t(Math.log2(h/o),2,c),m=(t,i,n)=>{const r=x(l,e,t,i),s=i-t;if(s<=o){const e=new d(r,void 0,0,t,i);return this.bspNodeTree.push(e),e}const{axis:c,midValue:h}=y(r),u=g(l,e,t,i,c,h),p=(t,e)=>{if(n>f)return;const i=e-t;return i<o||i>=a*s?void 0:m(t,e,n+1)},N=new d(r,c,h,u.next,u.mid);return this.bspNodeTree.push(N),N.leftNode=p(t,u.next),N.rightNode=p(u.mid,i),N};m(0,h,0)}}intersectRayTriangleRange(t,e){if(t>=e)return;const i=this.positions;n(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,i.data,i.stride,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap,this.firstTriangleIndex),f.numFacesTested+=e-t}intersectRay(t,e,i,n){f.numFacesTested=0;const r=t,s=e,o=s[0]-r[0],a=s[1]-r[1],c=s[2]-r[2];if(o*o+a*a+c*c<h)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const d=this.triangleIndexMap.length;this._callback=n,this._intersectionOptions=i,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=R,this._intersectionOptions=I}intersectRayBSP(t,e,i){const n=this._rayFrom,r=this._rayDirection;if(!l(t.aabb,n,r))return;const s=t.axis,o=t.d;if(n[s]<o||r[s]<0){const i=e,n=t.midStartIndex;if(i<n){const e=t.leftNode;void 0!==e?this.intersectRayBSP(e,i,n):this.intersectRayTriangleRange(i,n)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),n[s]>o||r[s]>0){const e=t.rightStartIndex,n=i;if(e<n){const i=t.rightNode;void 0!==i?this.intersectRayBSP(i,e,n):this.intersectRayTriangleRange(e,n)}}}get estimatedMemoryUsage(){return this.triangleIndexMap.byteLength}}f.numFacesTested=0;const m=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0];function g(t,e,i,n,r,s){let o=i,a=n;for(;o<a;){const i=t[o];e[6*i+r+3]<=s?++o:(--a,t[o]=t[a],t[a]=i)}let c=o;for(a=n;c<a;){const i=t[a-1];e[6*i+r]>=s?--a:(t[a-1]=t[c],t[c]=i,++c)}return{next:o,mid:c}}function x(t,e,n,r){if(r<=n)return i(NaN,NaN,NaN,NaN,NaN,NaN);{const i=6*t[n];for(let t=0;t<3;++t)m[t]=e[i+0+t],u[t]=e[i+3+t]}for(let i=n+1;i<r;++i){const n=6*t[i];for(let t=0;t<3;++t)m[t]=Math.min(m[t],e[n+0+t]),u[t]=Math.max(u[t],e[n+3+t])}return i(m[0],m[1],m[2],u[0],u[1],u[2])}function y(t){const e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2],r=e>i?e>n?0:i>n?1:2:i>n?1:n>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function p(t,e,i,n,r){const s=i-e,o=new Float32Array(6*s);for(let a=0;a<s;++a){const i=3*(a+e),s=t[i]*r,c=t[i+1]*r,h=t[i+2]*r;for(let t=0;t<3;++t){const e=n[s+t],i=n[c+t],r=n[h+t];o[6*a+t]=Math.min(e,i,r),o[6*a+3+t]=Math.max(e,i,r)}}return o}const N=255,b=65535,I=new r,R=()=>{};export{f as ComponentIntersectionData,s as componentMinimalSizeForIntersectionData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{a as i,B as a}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechniqueConfiguration as l}from"./BloomCompositionTechniqueConfiguration.js";import{BloomCompositionTechnique as m}from"./BloomTechnique.js";import{RenderRequestType as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{a as i,B as a}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechniqueConfiguration as l}from"./BloomCompositionTechniqueConfiguration.js";import{BloomCompositionTechnique as m}from"./BloomTechnique.js";import{RenderRequestType as u}from"../../lib/basicInterfaces.js";import{ColorAttachment as n,FramebufferBit as c}from"../../../../webgl/enums.js";let h=class extends s{get techniques(){return this.view._stage.renderView.techniques}constructor(e){super(e),this.consumes={required:[r.COMPOSITE,"emissive"]},this.produces=r.COMPOSITE,this._configuration=new l,this._bloomParameters=new i,this._blurScale=3.06,this._bloomResults=new Array}destroy(){}precompile(){this._configuration.bloomStage=a.BlurHorizontal,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.BlurVertical,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.Composite,this.techniques.precompile(m,this._configuration)}render(e){const t=e.find((({name:e})=>e===r.COMPOSITE)),o=t.getAttachment(n.COLOR_ATTACHMENT1)?.attachment;if(!o)return t;this._configuration.bloomStage=a.BlurHorizontal;const s=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.BlurVertical;const i=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.Composite;const l=this.techniques.acquire(m,this._configuration);if(!(s.compiled&&i.compiled&&l.compiled))return s.release(),i.release(),l.release(),this.requestRender(u.UPDATE),t;const h=t.getTexture(),b=this.renderingContext,p=this.fboCache,_=this.bindParameters,{fullWidth:g,fullHeight:f}=this.bindParameters.camera,T=(e,t,o,r,s)=>{b.bindFramebuffer(e.fbo),b.setViewport(0,0,o,r),b.setClearColor(0,0,0,0),b.clear(c.COLOR),b.bindTechnique(t,_,s),b.screen.draw()};let d=Math.round(g/2),C=Math.round(f/2);const P=5,q=this._bloomParameters.blurRadius;let R=o;for(let r=0;r<P;r++){const e=p.acquire(d,C,"bloomHorizontal");this._bloomParameters.colorTexture=R,T(e,s,d,C,this._bloomParameters);const t=p.acquire(d,C,"bloomVertical");this._bloomParameters.colorTexture=e.getTexture(),T(t,i,d,C,this._bloomParameters),e.release(),this._bloomResults[r]=t,d=Math.ceil(d/2),C=Math.ceil(C/2),R=this._bloomResults[r].getTexture(),this._bloomParameters.blurRadius*=this._blurScale}s.release(),i.release();const x=this.acquireOutputFramebuffer();this._bloomParameters.colorTexture=h;for(let r=0;r<P;r++)this._bloomParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._bloomParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._bloomParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._bloomParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._bloomParameters.bloomTexture4=this._bloomResults[4].getTexture();return this._bloomParameters.blurRadius=q,T(x,l,g,f,this._bloomParameters),this._bloomResults.forEach((e=>e.release())),l.release(),x.attachDepth(t.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),x.attachColor(t.getAttachment(n.COLOR_ATTACHMENT1),n.COLOR_ATTACHMENT1),x}};e([t()],h.prototype,"consumes",void 0),e([t()],h.prototype,"produces",void 0),e([t({readOnly:!0})],h.prototype,"techniques",null),h=e([o("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],h);export{h as BloomRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as e,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumCircleProfileSubdivisions as o}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";class r{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(t,e){return this.vertices.push(s(t)),this.normals.push(s(e)),this.vertices.length-1}addPole(t,e=null){return this.poles.push({position:s(t),normal:e?s(e):null}),this.poles.length-1}addSegment(t,e=null){this.indices.push(t.v0),this.indices.push(t.v1),e&&(this.poleIndices.push(e.v0),this.poleIndices.push(e.v1))}get numSegments(){return this.indices.length/2}translate(t,e){for(const s of this.vertices)s[0]+=t,s[1]+=e;for(const s of this.poles)s.position[0]+=t,s.position[1]+=e}get usedMemory(){return this.vertices.length*t(this.vertices[0])*2+t(this.indices)}}const n={top:[0,-.5],bottom:[0,.5]};function i(t){const s=.5,i=o,d=new r,a={v0:0,v1:0};d.addPole(e(0,0));for(let o=0;o<i;++o){const t=2*o*Math.PI/i,r=Math.cos(t),n=Math.sin(t),a=e(r*s,n*s),c=e(r,n);d.addVertex(a,c)}for(let e=0;e<i-1;++e){const t={v0:e,v1:e+1};d.addSegment(t,a)}const c={v0:i-1,v1:0};if(d.addSegment(c,a),"center"!==t){const e=n[t];d.translate(e[0],e[1])}return d}const d={center:i("center"),top:i("top"),bottom:i("bottom")},a={center:c("center"),top:c("top"),bottom:c("bottom")};function c(t){const s=1,o=1,i=new r,d=e(
|
|
5
|
+
import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as e,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumCircleProfileSubdivisions as o}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";class r{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(t,e){return this.vertices.push(s(t)),this.normals.push(s(e)),this.vertices.length-1}addPole(t,e=null){return this.poles.push({position:s(t),normal:e?s(e):null}),this.poles.length-1}addSegment(t,e=null){this.indices.push(t.v0),this.indices.push(t.v1),e&&(this.poleIndices.push(e.v0),this.poleIndices.push(e.v1))}get numSegments(){return this.indices.length/2}translate(t,e){for(const s of this.vertices)s[0]+=t,s[1]+=e;for(const s of this.poles)s.position[0]+=t,s.position[1]+=e}get usedMemory(){return this.vertices.length*t(this.vertices[0])*2+t(this.indices)}}const n={top:[0,-.5],bottom:[0,.5]};function i(t){const s=.5,i=o,d=new r,a={v0:0,v1:0};d.addPole(e(0,0));for(let o=0;o<i;++o){const t=2*o*Math.PI/i,r=Math.cos(t),n=Math.sin(t),a=e(r*s,n*s),c=e(r,n);d.addVertex(a,c)}for(let e=0;e<i-1;++e){const t={v0:e,v1:e+1};d.addSegment(t,a)}const c={v0:i-1,v1:0};if(d.addSegment(c,a),"center"!==t){const e=n[t];d.translate(e[0],e[1])}return d}const d={center:i("center"),top:i("top"),bottom:i("bottom")},a={center:c("center"),top:c("top"),bottom:c("bottom")};function c(t){const s=1,o=1,i=new r,d=e(-.5,-.5),a=e(.5*s,-.5),c=e(.5*s,.5*o),h=e(-.5,.5*o),l=e(0,-1),v=e(1,0),m=e(0,1),p=e(-1,0);if(i.addPole(e(0,.5*o),m),i.addPole(e(0,.5*o)),i.addPole(e(0,-.5)),i.addPole(e(0,-.5),l),i.addVertex(d,l),i.addVertex(a,l),i.addSegment({v0:0,v1:1},{v0:3,v1:3}),i.addVertex(a,v),i.addVertex(c,v),i.addSegment({v0:2,v1:3},{v0:2,v1:1}),i.addVertex(c,m),i.addVertex(h,m),i.addSegment({v0:4,v1:5},{v0:0,v1:0}),i.addVertex(h,p),i.addVertex(d,p),i.addSegment({v0:6,v1:7},{v0:1,v1:2}),"center"!==t){const e=n[t];i.translate(e[0],e[1])}return i}export{r as PathProfile,d as circleProfiles,a as quadProfiles};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as _,c as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{a as v,g as x}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,vertexAttributeLocations as V,glVertexLayout as q}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as H,SilhouetteEdgeBufferWriter as G}from"./edgeBufferWriters.js";import{EdgeRenderer as N,lineWidthFractionFactor as W,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=Q(t),o=N.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let i=0,o=0;if(this._renderers.forEach((r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1).release(),t.silhouette&&r.acquireTechnique(e,!0).release())}),t),--this.techniques.precompiling):this._renderers.delete(r.key)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new k(this.rctx,V,new Map([["vertices",q],["instances",t===ee.REGULAR?H.glLayout:G.glLayout]]),new Map([["vertices",this._verticesBufferObject],["instances",te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)]])),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.cachedMemory??0)+(a?.vao.cachedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o||!1,!1),h=B.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=N.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new N(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.get("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*W),0,255),c=i(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!pe(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)}),i),s?.release()}function fe(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!be(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)}),i),s?.release()}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as _,c as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{a as v,g as x}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,vertexAttributeLocations as V,glVertexLayout as q}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as H,SilhouetteEdgeBufferWriter as G}from"./edgeBufferWriters.js";import{EdgeRenderer as N,lineWidthFractionFactor as W,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=Q(t),o=N.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let i=0,o=0;if(this._renderers.forEach((r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1).release(),t.silhouette&&r.acquireTechnique(e,!0).release())}),t),--this.techniques.precompiling):this._renderers.delete(r.key)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new k(this.rctx,V,new Map([["vertices",q],["instances",t===ee.REGULAR?H.glLayout:G.glLayout]]),new Map([["vertices",this._verticesBufferObject],["instances",te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)]])),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.cachedMemory??0)+(a?.vao.cachedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o||!1,!1),h=B.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=N.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new N(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.get("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*W),0,255),c=i(e.extensionLength,-128,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!pe(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)}),i),s?.release()}function fe(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!be(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)}),i),s?.release()}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
|