@arcgis/core 5.2.0-next.68 → 5.2.0-next.69

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.
Files changed (96) hide show
  1. package/arcgisGlobal.d.ts +2 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/7dd672c25beb8813cc75.js +2 -0
  4. package/assets/esri/core/workers/chunks/{d7267f429a051943187b.js → 873d8332e2149eb1b36a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/b526055794e64b0227ca.js +256 -0
  6. package/assets/esri/core/workers/chunks/be291d920ebc68fde02b.js +2 -0
  7. package/assets/esri/core/workers/chunks/c10a0eebd935472d8fae.js +1 -0
  8. package/assets/esri/core/workers/chunks/d198ecb1fe3690d6092f.js +2 -0
  9. package/assets/esri/core/workers/chunks/d303621c902330be5035.js +1 -0
  10. package/assets/esri/core/workers/chunks/f4e813ead56d963b16b8.js +1 -0
  11. package/assets/esri/core/workers/chunks/{8a12bb50b3ac9e651625.js → f6f1122bed931f1d960b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/f82cd34a79c8aa58d40c.js +2 -0
  13. package/chunks/GaussianSplat.glsl.js +10 -9
  14. package/chunks/GaussianSplatDepth.glsl.js +11 -0
  15. package/chunks/GaussianSplatShadow.glsl.js +7 -16
  16. package/config.js +1 -1
  17. package/kernel.js +1 -1
  18. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  19. package/networks/RulesTable.js +1 -1
  20. package/networks/UtilityNetwork.js +1 -1
  21. package/networks/support/utils.js +1 -1
  22. package/package.json +2 -2
  23. package/support/revision.js +1 -1
  24. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  25. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  26. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  27. package/views/2d/layers/support/MediaLayerInteractionOptions.d.ts +46 -0
  28. package/views/2d/layers/support/MediaLayerInteractionOptions.js +1 -1
  29. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +22 -0
  30. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.js +2 -0
  31. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  32. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  33. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  34. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  35. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  36. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  37. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  38. package/views/3d/layers/I3SMeshView3D.js +1 -1
  39. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  40. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  41. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  42. package/views/3d/layers/i3s/SweptSphereVolume.js +2 -0
  43. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +0 -1
  44. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  45. package/views/3d/support/hitTest.js +1 -1
  46. package/views/3d/webgl/RenderCamera.js +1 -1
  47. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  48. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  49. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  50. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  51. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  52. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  53. package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +2 -0
  54. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  55. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  56. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  57. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  58. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  59. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  60. package/views/3d/webgl-engine/shaders/GaussianSplatDepth.glsl.js +2 -0
  61. package/views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js +2 -0
  62. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +2 -0
  63. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +97 -0
  64. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  65. package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
  66. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  67. package/views/3d/webgl.js +1 -1
  68. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  69. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  70. package/widgets/Editor/legacy/AddAssociationWorkflow.js +1 -1
  71. package/widgets/Editor/legacy/AddAssociationWorkflowData.js +1 -1
  72. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  73. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  74. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  75. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  76. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  77. package/widgets/Search/support/locatorUtils.js +1 -1
  78. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  79. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  80. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  81. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  82. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  83. package/widgets/support/UtilityNetworkAssociations/utils/isFromElement.js +1 -1
  84. package/assets/esri/core/workers/chunks/2426601b8cae7f06af4d.js +0 -256
  85. package/assets/esri/core/workers/chunks/45de90b78485d9326791.js +0 -1
  86. package/assets/esri/core/workers/chunks/581318d4d3b3152fd93f.js +0 -2
  87. package/assets/esri/core/workers/chunks/7bd3a11d3ade0b948db7.js +0 -1
  88. package/assets/esri/core/workers/chunks/8a9d782aee5ab47ba07f.js +0 -2
  89. package/assets/esri/core/workers/chunks/c270b29307e04c4dafae.js +0 -2
  90. package/assets/esri/core/workers/chunks/f276c6f5cbc1aaec0403.js +0 -1
  91. package/assets/esri/core/workers/chunks/fac8add42aa317f8f514.js +0 -2
  92. package/views/3d/layers/i3s/SphereCone.js +0 -2
  93. /package/assets/esri/core/workers/chunks/{8a9d782aee5ab47ba07f.js.LICENSE.txt → 7dd672c25beb8813cc75.js.LICENSE.txt} +0 -0
  94. /package/assets/esri/core/workers/chunks/{fac8add42aa317f8f514.js.LICENSE.txt → be291d920ebc68fde02b.js.LICENSE.txt} +0 -0
  95. /package/assets/esri/core/workers/chunks/{c270b29307e04c4dafae.js.LICENSE.txt → d198ecb1fe3690d6092f.js.LICENSE.txt} +0 -0
  96. /package/assets/esri/core/workers/chunks/{581318d4d3b3152fd93f.js.LICENSE.txt → f82cd34a79c8aa58d40c.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d,sphereCSO as p}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as g}from"./debugFlags.js";import{getElevationAtPoint as y}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as h,resolveOrderedIntersectionHits as w}from"./intersectionHitUtils.js";import{Intersector as b}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as S}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../webgl-engine/lib/verticalOffsetUtils.js";async function j(e,n,t,o){const l=t?C(e,t):o;if(i(n))return I(e,n,l,t?.excludeLabels);if(r(n))return I(e,T(n),l,t?.excludeLabels);const a=n,c=s(a.x,a.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new b(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(c,u,l);const d=await P(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>L(e,n),stopAtSupportSurface:!0}),p=u.results.ground,f=E(p,e),y=null!=f&&"type"in f&&m(f)?f:null,h={screenPoint:a,results:d,ground:{mapPoint:L(e,p),distance:S(p)?p.distanceInRenderSpace:0,layer:y}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=u),h}async function I(e,n,i,r){i.enableDraped=!0;const s=new b(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o={screenPoint:null,results:await P(e,R(e,s.polygonResults.all),i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}),ground:{mapPoint:null,distance:0,layer:null}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(o.intersector=s),o}function*R(e,n){const t=V(e);if(null!=t)for(const i of n)null!=i.distance&&i.distance<=t&&(yield i);else yield*n}function V(e){const n=e.basemapTerrain,t=e.state.camera;if(1!==e.state.viewingMode||!t.aboveGround||!n?.opaque)return null;z.radius=n.getLowerBoundRadius();return p.distanceToSilhouette(z,t.eye)*F}function T(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function M(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),a=t(n);s.enableDraped=s.include&&!s.include.has(U)||s.exclude?.has(U);const c=e.sceneIntersectionHelper,u=new b(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,c.intersectIntersectorScreen(a,u,s),o||l){for(const n of u.results.all){const t=x(n,e);if(null==t)return L(e,n);if(o&&("graphic"!==t.type||D(s.graphics,t.graphic)))return L(e,n);if(l&&("media"!==t.type||G(s.mediaElements,t.element)))return L(e,n)}return null}return L(e,u.results.min)}async function P(e,n,t,i){const r=w(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=E(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&m(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?v(e.graphic):null,filterHit:e=>"graphic"!==e.type||D(t,e.graphic)}),s=new Array;for await(const{input:o,hit:l}of r){const e=i.getMapPoint(o),n=i.getDistance(o);if("media"===l.type){const t=e?l.element.toSource(e):null;s.push({...l,mapPoint:e,distance:n,sourcePoint:t})}else s.push({...l,mapPoint:e,distance:n})}return s}function L(e,n,t){return n.getIntersectionPoint(q)?(t=H(e,q,t),7===n.intersector&&e.basemapTerrain&&(t.z=y(e.basemapTerrain,t)??0),t):null}function v(e){const n=e.getObjectId()??e.attributes?.[f];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${h(e)}`}function D(e,n){return G(e,v(n))}function G(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function H(e,n,t){let i=e.spatialReference||c.WGS84;return u(n,e.renderSpatialReference,q,i)?n=q:(i=c.WGS84,u(n,e.renderSpatialReference,q,i)&&(n=q)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new a(n,i),t}function C(e,n){const t=N(e,n.include,0),i=N(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function N(t,i,r,s=new _){if(!i)return s;if(i instanceof e)$(s,v(i)),0===r&&(null!=t.graphicsView&&i.layer===t?W(s,t.graphicsView.uid):i.layer&&O(s,t,i.layer.uid));else if("layer"in i&&"element"in i)k(s,i.element),0===r&&O(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?W(s,t.graphicsView.uid):e===t.map.ground?(W(s,U),t.map.ground.integratedMeshGround&&O(s,t,t.map.ground.integratedMeshGround.uid)):N(t,e,r,s);else"layer"in i&&A(s,t,i),"uid"in i&&O(s,t,i.uid);return s}class _{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function O(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&W(e,i.uid)}function W(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function A(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function $(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function k(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const q=l(),z=new d,F=1.2;export{H as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,j as hitTest,L as intersectResultToMapPoint,D as testGraphicUidFilter,M as toMap};
2
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d,sphereCSO as p}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as g}from"./debugFlags.js";import{getElevationAtPoint as y}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as h,resolveOrderedIntersectionHits as w}from"./intersectionHitUtils.js";import{Intersector as b}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as S}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../webgl-engine/lib/verticalOffsetUtils.js";async function j(e,n,t,o){const l=t?C(e,t):o;if(i(n))return I(e,n,l,t?.excludeLabels);if(r(n))return I(e,V(n),l,t?.excludeLabels);const c=n,a=s(c.x,c.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new b(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(a,u,l);const d=await Array.fromAsync(M(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>L(e,n),stopAtSupportSurface:!0})),p=u.results.ground,f=E(p,e),y=null!=f&&"type"in f&&m(f)?f:null,h={screenPoint:c,results:d,ground:{mapPoint:L(e,p),distance:S(p)?p.distanceInRenderSpace:0,layer:y}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=u),h}async function I(e,n,i,r){i.enableDraped=!0;const s=new b(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o=new Array;await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(n){for await(const t of M(e,R(e,s.polygonResults.all),i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(t),n.done&&(n=yield)});const l={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(l.intersector=s),l}function*R(e,n){const t=T(e);if(null!=t)for(const i of n)null!=i.distance&&i.distance<=t&&(yield i);else yield*n}function T(e){const n=e.basemapTerrain,t=e.state.camera;if(1!==e.state.viewingMode||!t.aboveGround||!n?.opaque)return null;z.radius=n.getLowerBoundRadius();return p.distanceToSilhouette(z,t.eye)*F}function V(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function P(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(U)||s.exclude?.has(U);const a=e.sceneIntersectionHelper,u=new b(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const t=x(n,e);if(null==t)return L(e,n);if(o&&("graphic"!==t.type||G(s.graphics,t.graphic)))return L(e,n);if(l&&("media"!==t.type||H(s.mediaElements,t.element)))return L(e,n)}return null}return L(e,u.results.min)}async function*M(e,n,t,i){const r=w(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=E(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&m(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?v(e.graphic):null,filterHit:e=>"graphic"!==e.type||G(t,e.graphic)});for await(const{input:s,hit:o}of r){const e=i.getMapPoint(s),n=i.getDistance(s);if("media"===o.type){const t=e?o.element.toSource(e):null;yield{...o,mapPoint:e,distance:n,sourcePoint:t}}else yield{...o,mapPoint:e,distance:n}}}function L(e,n,t){return n.getIntersectionPoint(q)?(t=D(e,q,t),7===n.intersector&&e.basemapTerrain&&(t.z=y(e.basemapTerrain,t)??0),t):null}function v(e){const n=e.getObjectId()??e.attributes?.[f];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${h(e)}`}function G(e,n){return H(e,v(n))}function H(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function D(e,n,t){let i=e.spatialReference||a.WGS84;return u(n,e.renderSpatialReference,q,i)?n=q:(i=a.WGS84,u(n,e.renderSpatialReference,q,i)&&(n=q)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new c(n,i),t}function C(e,n){const t=N(e,n.include,0),i=N(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function N(t,i,r,s=new _){if(!i)return s;if(i instanceof e)k(s,v(i)),0===r&&(null!=t.graphicsView&&i.layer===t?O(s,t.graphicsView.uid):i.layer&&A(s,t,i.layer.uid));else if("layer"in i&&"element"in i)$(s,i.element),0===r&&A(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?O(s,t.graphicsView.uid):e===t.map.ground?(O(s,U),t.map.ground.integratedMeshGround&&A(s,t,t.map.ground.integratedMeshGround.uid)):N(t,e,r,s);else"layer"in i&&W(s,t,i),"uid"in i&&A(s,t,i.uid);return s}class _{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function A(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&O(e,i.uid)}function O(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function W(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function k(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function $(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const q=l(),z=new d,F=1.2;export{D as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,j as hitTest,L as intersectResultToMapPoint,G as testGraphicUidFilter,P as toMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as y,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as P,sqrLen as V,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as H,copy as z,squaredDistance as W,transformMat4 as q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=d(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=d(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=d(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(d(),this.viewMatrix)||this._get("inverseViewMatrix")||d()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){H(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),z(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(d(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||d()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(d(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,z(this._viewport,t.viewport),this.notifyChange("_viewport"),z(this._padding,t.padding),this.notifyChange("_padding"),y(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),z(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&H(this._viewport,t.viewport)&&H(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||W(t.screenPadding,this.screenPadding)>=i||W(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(ot,t.eye,t.center),R(nt,this.eye,this.center);const e=P(ot,nt),r=V(ot),s=V(nt),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(ot,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==rt&&D(rt,t),rt[3]=1,q(rt,rt,this.projectionMatrix);const e=Math.abs(rt[3]);C(rt,rt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*rt[0]),i[1]=r(0,s[1]+s[3],.5+.5*rt[1]),i[2]=.5*(rt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;rt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],rt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],rt[2]=(2*t[2]-1)*t[3],rt[3]=t[3],null!=this.inverseProjectionMatrix&&(q(rt,rt,this.inverseProjectionMatrix),i[0]=rt[0],i[1]=rt[1],i[2]=rt[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,ht)?null:(this.renderToScreen(ht,i),i)}projectToRenderScreen(t,i){if(rt[0]=t[0],rt[1]=t[1],rt[2]=t[2],rt[3]=1,q(rt,rt,this.viewProjectionMatrix),0===rt[3])return null;const e=rt;C(e,e,1/Math.abs(rt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ht),i)}unprojectFromRenderScreen(t,i){if(u(st,this.projectionMatrix,this.viewMatrix),!l(st,st))return null;const e=this.fullViewport;return rt[0]=2*(t[0]-e[0])/e[2]-1,rt[1]=2*(t[1]-e[1])/e[3]-1,rt[2]=2*t[2]-1,rt[3]=1,q(rt,rt,st),0===rt[3]?null:(i[0]=rt[0]/rt[3],i[1]=rt[1]/rt[3],i[2]=rt[2]/rt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(ot,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(P(ot,this.center))>.9999*b(ot)*t||(S(nt,ot,this.center),S(nt,nt,ot),T(nt,nt),j(this._up,nt)||(D(this._up,nt),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(ot,this.eye,this.center),Math.abs(ot[2])<=.9999&&(C(ot,ot,ot[2]),x(ot,-ot[0],-ot[1],1-ot[2]),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=it,rt=k(),st=d(),ot=E(),nt=E(),ht=o();export{et as default};
2
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as V,sqrLen as P,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(ot,t.eye,t.center),R(nt,this.eye,this.center);const e=V(ot,nt),r=P(ot),s=P(nt),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(ot,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==rt&&D(rt,t),rt[3]=1,W(rt,rt,this.projectionMatrix);const e=Math.abs(rt[3]);C(rt,rt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*rt[0]),i[1]=r(0,s[1]+s[3],.5+.5*rt[1]),i[2]=.5*(rt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;rt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],rt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],rt[2]=(2*t[2]-1)*t[3],rt[3]=t[3],null!=this.inverseProjectionMatrix&&(W(rt,rt,this.inverseProjectionMatrix),i[0]=rt[0],i[1]=rt[1],i[2]=rt[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,ht)?null:(this.renderToScreen(ht,i),i)}projectToRenderScreen(t,i){if(rt[0]=t[0],rt[1]=t[1],rt[2]=t[2],rt[3]=1,W(rt,rt,this.viewProjectionMatrix),0===rt[3])return null;const e=rt;C(e,e,1/Math.abs(rt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ht),i)}unprojectFromRenderScreen(t,i){if(u(st,this.projectionMatrix,this.viewMatrix),!l(st,st))return null;const e=this.fullViewport;return rt[0]=2*(t[0]-e[0])/e[2]-1,rt[1]=2*(t[1]-e[1])/e[3]-1,rt[2]=2*t[2]-1,rt[3]=1,W(rt,rt,st),0===rt[3]?null:(i[0]=rt[0]/rt[3],i[1]=rt[1]/rt[3],i[2]=rt[2]/rt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(ot,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(V(ot,this.center))>.9999*b(ot)*t||(S(nt,ot,this.center),S(nt,nt,ot),T(nt,nt),j(this._up,nt)||(D(this._up,nt),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(ot,this.eye,this.center),Math.abs(ot[2])<=.9999&&(C(ot,ot,ot[2]),x(ot,-ot[0],-ot[1],1-ot[2]),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=it,rt=k(),st=y(),ot=E(),nt=E(),ht=o();export{et as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{d as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialParameters as j}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as M}from"../../lib/SamplerRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as R}from"../../lib/verticalOffsetUtils.js";import{BufferManager as x}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as D,IndexGlLayout as H}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as I}from"../../../../webgl/enums.js";import{VertexBuffer as E}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let P=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new x(r,D());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new M(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=R(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let o=0;o<i;++o)if(t[o]!==e[o].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,s=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+s+t,l=c[e+5]+s+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==s){const e=R(s);e.localOrigin=o.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersectRay(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;null!=n&&(n.localOrigin=a.position),h.intersectRay(t,i,n,l.verticalOffsets,a,o,s)}intersectScreenPolygon(e,t,i,n,o){const s=e,{transform:r,componentData:a,intersectionGeometry:l}=s;null!=n&&(n.localOrigin=r.position),l.intersectScreenPolygon(t,i,n,a.verticalOffsets,r,o)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,s,a);const p=c.count,d=this._computeVisibilityIndices(s,o,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,h=new E(n,s,r),c=a?A.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new E(n,H,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new w(n,new Map(g),c),u=a?.length??l,b=new y(p,I.TRIANGLES,o.parameters,null!=c,u),O=new j(t),C=this.materials.acquire(O,b.parameters,d),M=new _(h.usedMemory+m+(c?.usedMemory??0)),R=this.samplers.addFromTexture(t.baseColorTexture?.texture),x=new f(e,t,R);return new v(C,x,b,M)}_requestRender(){this._renderPassManager.requestRender()}};P=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],P);const V=h();export{P as ComponentObjectCollection};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{d as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialParameters as j}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as M}from"../../lib/SamplerRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as R}from"../../lib/verticalOffsetUtils.js";import{BufferManager as x}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as D,IndexGlLayout as H}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as I}from"../../../../webgl/enums.js";import{VertexBuffer as E}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let P=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new x(r,D());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new M(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=R(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let o=0;o<i;++o)if(t[o]!==e[o].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,s=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+s+t,l=c[e+5]+s+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==s){const e=R(s);e.localOrigin=o.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersectRay(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;null!=n&&(n.localOrigin=a.position),h.intersectRay(t,i,n,l.verticalOffsets,a,o,s)}*intersectScreenPolygon(e,t,i,n,o){const s=e,{transform:r,componentData:a,intersectionGeometry:l}=s;null!=n&&(n.localOrigin=r.position),yield*l.intersectScreenPolygon(t,i,n,a.verticalOffsets,r,o)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,s,a);const p=c.count,d=this._computeVisibilityIndices(s,o,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,h=new E(n,s,r),c=a?A.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new E(n,H,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new w(n,new Map(g),c),u=a?.length??l,b=new y(p,I.TRIANGLES,o.parameters,null!=c,u),O=new j(t),C=this.materials.acquire(O,b.parameters,d),M=new _(h.usedMemory+m+(c?.usedMemory??0)),R=this.samplers.addFromTexture(t.baseColorTexture?.texture),x=new f(e,t,R);return new v(C,x,b,M)}_requestRender(){this._renderPassManager.requestRender()}};P=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],P);const V=h();export{P as ComponentObjectCollection};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as s,expandWithAABB as i}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustum.js";import{intersectTriangleRangeForComponent as l,intersectTriangleRangeScreenPolygonForComponent as c,ComponentObjectElevationAgnosticComponentGeometryBVH as h}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as m}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as p,computeInvDir as _,intersectAabbInvDir as f}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as b}from"../../lib/triangleIntersectionUtils.js";class u{constructor(t,e,o,s,i,r,a,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=r,this.planetCenterZ=a,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=P,this._ray1=v,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=I,this._callback=A,this._screenPolygonCallback=O,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new S,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=A,this._componentIndexMap=null,this._bvh=new m(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=r(4*t),s=this._componentAabbs3D;for(let i=0;i<t;++i){const t=6*i,r=s[t+0],a=s[t+1],l=s[t+2],c=s[t+3],h=s[t+4],m=n/(l-e),p=n/(s[t+5]-e),_=Math.min(r*m,r*p),f=Math.min(a*m,a*p),b=Math.max(c*m,c*p),u=Math.max(h*m,h*p),y=4*i;o[y+0]=_,o[y+1]=f,o[y+2]=b,o[y+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=r(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],r=n[t+3],a=n[t+4],l=4*o;e[l+0]=s,e[l+1]=i,e[l+2]=r,e[l+3]=a}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:r}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,_(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,r),this._callback=A,this._intersectComponent=A}intersectScreenPolygon(t,e,n,o,s,i){this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._screenPolygonIntersector=t,this._screenPolygonQuery=e,this._screenPolygonTransformation=n,this._screenPolygonCallback=o,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,this._bvh.intersectNodes((t,e)=>this._intersectScreenPolygonNode(t,e)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=O,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=A}intersectRange(t,e){this._forEachIntersectableComponent(t,e,t=>{this._intersectComponent(t)})}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponentRay(n){const o=this.getComponentAabb3D(n,y);let s=!1;const{localMode:i,_componentVerticalOffsets:r,_verticalOffset:a,_ray0:c,_ray1:h,_invDir:m,planetCenterZ:p,_tolerance:_,rayDirectionC:u}=this,{isVerticalRay:g}=this._intersectionOptions,D=this._componentData.offsets,d=t(C,c),P=t(x,h),v=r?.[n]??0,A=v+(a?.offset??0);if(0!==A&&(i?(d[2]=c[2]-A,P[2]=h[2]-A,s=!0):(null!=a&&(a.componentOffset=v),g&&(b(d,-A,p,c),b(P,-A,p,h),s=!0))),null==a||s||0===A||a.applyToAabb(o),!f(o,d,m,_))return;e(u,P,d);const O=D[n]/3,I=D[n+1]/3,S=I-O,T=(t,e,o,s)=>this._callback(t,e,o,s,n),{vertexData:V,vertexStride:R,indexData:N,_intersectionOptions:j}=this,{normalRequired:B}=j;if(S>M){this._getOrCreateComponentGeometryBvh(n,O,I).intersectRay(d,P,g,s?0:A,T,B)}else{l(d,u,O,I,N,V,R,s?0:A,p,B,T)}}_intersectComponentScreenPolygon(t){const e=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(null==e||null==n)return;const o=this.getComponentAabb3D(t,y),{_screenPolygonTransformation:i,_screenPolygonCallback:r,vertexData:l,vertexStride:h,indexData:m}=this,p=this._getScreenPolygonElevationDisplacement(t),_=null!=p?p.applyToAabb(s(g,o)):o;if(!a(n.broadPhaseFrustum,_,i))return;const f=this._componentData.offsets,b=f[t]/3,u=f[t+1]/3;if(u-b>M){return void this._getOrCreateComponentGeometryBvh(t,b,u).intersectScreenPolygon(e,i,n,p,(e,n,o)=>{r(e,n,t,o)})}const D=c(e,i,n,b,u,m,l,h,p);null!=D&&r(D.distance,D.primitiveIndex,t,D.point)}_intersectScreenPolygonNode(t,e){const n=this._screenPolygonQuery;if(null==n)return!1;const o=this._getScreenPolygonNodeAabb(t,e,g),{_screenPolygonTransformation:s}=this;return a(n.broadPhaseFrustum,o,s)}_forEachIntersectableComponent(t,e,n){const o=this._componentIndexMap,s=this._componentData;for(let i=t;i<e;++i){const t=o?o[i]:i;s.isPickable(t)&&s.isVisible(t)&&n(t)}}_getOrCreateComponentGeometryBvh(t,e,n){let o=this.componentIntersectionData[t];return null==o&&(o=new h(t,this.vertexData,this.vertexStride,this.indexData,e,n,this._componentAabbs3D[6*t+2],this._componentAabbs3D[6*t+5],this.geometryMinZ,this.planetCenterZ,this.localMode),this.componentIntersectionData[t]=o),o}_getScreenPolygonElevationDisplacement(t){const e=this._componentVerticalOffsets?.[t]??0;return this._getScreenPolygonDisplacementForOffset(e)}_getScreenPolygonDisplacementForOffset(t){const e=this._verticalOffset;return null!=e?0===t&&0===e.offset?null:(e.componentOffset=t,e):this.localMode&&0!==t?(this._localModeOffsetDisplacement.offset=t,this._localModeOffsetDisplacement):null}_getScreenPolygonNodeAabb(t,e,n){const o=this._getNodeAabb3D(t,e,n),[r,a]=this._getNodeComponentOffsetRange(t);if(r===a)return this._applyScreenPolygonDisplacementToAabb(o,r);const l=this._applyScreenPolygonDisplacementToAabb(s(D,o),r),c=this._applyScreenPolygonDisplacementToAabb(s(d,o),a);return i(l,c,n),n}_applyScreenPolygonDisplacementToAabb(t,e){const n=this._getScreenPolygonDisplacementForOffset(e);return null!=n?n.applyToAabb(t):t}_getNodeAabb3D(t,e,n){const r=this._nodeAabbs3D??=[],a=r[e];if(null!=a)return s(n,a);const l=this._componentIndexMap;let c=!1;for(let o=t.minIndexIndex;o<t.maxIndexIndex;++o){const t=l?l[o]:o,e=this.getComponentAabb3D(t,D);c?i(n,e):(s(n,e),c=!0)}const h=o();return s(h,n),r[e]=h,n}_getNodeComponentOffsetRange(t){const e=this._componentVerticalOffsets;if(null==e)return[0,0];const n=this._componentIndexMap;let o=0,s=0,i=!1;for(let r=t.minIndexIndex;r<t.maxIndexIndex;++r){const t=e[n?n[r]:r]??0;i?(o=Math.min(o,t),s=Math.max(s,t)):(o=t,s=t,i=!0)}return i?[o,s]:[0,0]}}const y=o(),g=o(),D=o(),d=o(),C=n(),x=n(),P=n(),v=n(),A=()=>{},O=()=>{},I=new p,M=40;class S{constructor(){this.offset=0}applyToVertex(t,e,n,o){return t[0]=e,t[1]=n,t[2]=o+this.offset,t}applyToAabb(t){return t[2]+=this.offset,t[5]+=this.offset,t}}export{u as ComponentObjectElevationAgnosticComponentBVH};
2
+ import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as s,expandWithAABB as i}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustum.js";import{intersectTriangleRangeForComponent as l,intersectTriangleRangeScreenPolygonForComponent as c,ComponentObjectElevationAgnosticComponentGeometryBVH as h}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as m}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as p,computeInvDir as _,intersectAabbInvDir as f}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as b}from"../../lib/triangleIntersectionUtils.js";class u{constructor(t,e,o,s,i,r,a,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=r,this.planetCenterZ=a,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=P,this._ray1=v,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=I,this._callback=A,this._screenPolygonCallback=O,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new S,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=A,this._componentIndexMap=null,this._bvh=new m(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=r(4*t),s=this._componentAabbs3D;for(let i=0;i<t;++i){const t=6*i,r=s[t+0],a=s[t+1],l=s[t+2],c=s[t+3],h=s[t+4],m=n/(l-e),p=n/(s[t+5]-e),_=Math.min(r*m,r*p),f=Math.min(a*m,a*p),b=Math.max(c*m,c*p),u=Math.max(h*m,h*p),y=4*i;o[y+0]=_,o[y+1]=f,o[y+2]=b,o[y+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=r(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],r=n[t+3],a=n[t+4],l=4*o;e[l+0]=s,e[l+1]=i,e[l+2]=r,e[l+3]=a}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:r}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,_(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,r),this._callback=A,this._intersectComponent=A}*intersectScreenPolygon(t,e,n,o,s,i){this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._screenPolygonIntersector=t,this._screenPolygonQuery=e,this._screenPolygonTransformation=n,this._screenPolygonCallback=o,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,yield*this._bvh.intersectNodesGenerator((t,e)=>this._intersectScreenPolygonNode(t,e)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=O,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=A}intersectRange(t,e){this._forEachIntersectableComponent(t,e,t=>{this._intersectComponent(t)})}*intersectRangeGenerator(t,e){const n=this._componentIndexMap,o=this._componentData;for(let s=t;s<e;++s){const t=n?n[s]:s;o.isPickable(t)&&o.isVisible(t)&&(this._intersectComponent(t),yield)}}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponentRay(n){const o=this.getComponentAabb3D(n,y);let s=!1;const{localMode:i,_componentVerticalOffsets:r,_verticalOffset:a,_ray0:c,_ray1:h,_invDir:m,planetCenterZ:p,_tolerance:_,rayDirectionC:u}=this,{isVerticalRay:g}=this._intersectionOptions,d=this._componentData.offsets,D=t(C,c),P=t(x,h),v=r?.[n]??0,A=v+(a?.offset??0);if(0!==A&&(i?(D[2]=c[2]-A,P[2]=h[2]-A,s=!0):(null!=a&&(a.componentOffset=v),g&&(b(D,-A,p,c),b(P,-A,p,h),s=!0))),null==a||s||0===A||a.applyToAabb(o),!f(o,D,m,_))return;e(u,P,D);const O=d[n]/3,I=d[n+1]/3,S=I-O,T=(t,e,o,s)=>this._callback(t,e,o,s,n),{vertexData:V,vertexStride:R,indexData:N,_intersectionOptions:j}=this,{normalRequired:k}=j;if(S>M){this._getOrCreateComponentGeometryBvh(n,O,I).intersectRay(D,P,g,s?0:A,T,k)}else{l(D,u,O,I,N,V,R,s?0:A,p,k,T)}}_intersectComponentScreenPolygon(t){const e=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(null==e||null==n)return;const o=this.getComponentAabb3D(t,y),{_screenPolygonTransformation:i,_screenPolygonCallback:r,vertexData:l,vertexStride:h,indexData:m}=this,p=this._getScreenPolygonElevationDisplacement(t),_=null!=p?p.applyToAabb(s(g,o)):o;if(!a(n.broadPhaseFrustum,_,i))return;const f=this._componentData.offsets,b=f[t]/3,u=f[t+1]/3;if(u-b>M){return void this._getOrCreateComponentGeometryBvh(t,b,u).intersectScreenPolygon(e,i,n,p,(e,n,o)=>{r(e,n,t,o)})}const d=c(e,i,n,b,u,m,l,h,p);null!=d&&r(d.distance,d.primitiveIndex,t,d.point)}_intersectScreenPolygonNode(t,e){const n=this._screenPolygonQuery;if(null==n)return!1;const o=this._getScreenPolygonNodeAabb(t,e,g),{_screenPolygonTransformation:s}=this;return a(n.broadPhaseFrustum,o,s)}_forEachIntersectableComponent(t,e,n){const o=this._componentIndexMap,s=this._componentData;for(let i=t;i<e;++i){const t=o?o[i]:i;s.isPickable(t)&&s.isVisible(t)&&n(t)}}_getOrCreateComponentGeometryBvh(t,e,n){let o=this.componentIntersectionData[t];return null==o&&(o=new h(t,this.vertexData,this.vertexStride,this.indexData,e,n,this._componentAabbs3D[6*t+2],this._componentAabbs3D[6*t+5],this.geometryMinZ,this.planetCenterZ,this.localMode),this.componentIntersectionData[t]=o),o}_getScreenPolygonElevationDisplacement(t){const e=this._componentVerticalOffsets?.[t]??0;return this._getScreenPolygonDisplacementForOffset(e)}_getScreenPolygonDisplacementForOffset(t){const e=this._verticalOffset;return null!=e?0===t&&0===e.offset?null:(e.componentOffset=t,e):this.localMode&&0!==t?(this._localModeOffsetDisplacement.offset=t,this._localModeOffsetDisplacement):null}_getScreenPolygonNodeAabb(t,e,n){const o=this._getNodeAabb3D(t,e,n),[r,a]=this._getNodeComponentOffsetRange(t);if(r===a)return this._applyScreenPolygonDisplacementToAabb(o,r);const l=this._applyScreenPolygonDisplacementToAabb(s(d,o),r),c=this._applyScreenPolygonDisplacementToAabb(s(D,o),a);return i(l,c,n),n}_applyScreenPolygonDisplacementToAabb(t,e){const n=this._getScreenPolygonDisplacementForOffset(e);return null!=n?n.applyToAabb(t):t}_getNodeAabb3D(t,e,n){const r=this._nodeAabbs3D??=[],a=r[e];if(null!=a)return s(n,a);const l=this._componentIndexMap;let c=!1;for(let o=t.minIndexIndex;o<t.maxIndexIndex;++o){const t=l?l[o]:o,e=this.getComponentAabb3D(t,d);c?i(n,e):(s(n,e),c=!0)}const h=o();return s(h,n),r[e]=h,n}_getNodeComponentOffsetRange(t){const e=this._componentVerticalOffsets;if(null==e)return[0,0];const n=this._componentIndexMap;let o=0,s=0,i=!1;for(let r=t.minIndexIndex;r<t.maxIndexIndex;++r){const t=e[n?n[r]:r]??0;i?(o=Math.min(o,t),s=Math.max(s,t)):(o=t,s=t,i=!0)}return i?[o,s]:[0,0]}}const y=o(),g=o(),d=o(),D=o(),C=n(),x=n(),P=n(),v=n(),A=()=>{},O=()=>{},I=new p,M=40;class S{constructor(){this.offset=0}applyToVertex(t,e,n,o){return t[0]=e,t[1]=n,t[2]=o+this.offset,t}applyToAabb(t){return t[2]+=this.offset,t[5]+=this.offset,t}}export{u as ComponentObjectElevationAgnosticComponentBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,o,s,i,r){this._componentOffsets=r,this._intersectionData=new n(s,i,new t(e,3,o))}intersectRay(t,n,e,s){const i=(t,n,e,i)=>{const r=o(this._componentOffsets,i);s(t,n,e,i,r)};this._intersectionData.intersectRay(t,n,e,i)}intersectScreenPolygon(t,n,e,s){this._intersectionData.forEachScreenPolygonHit(t,e,n,null,(t,n,e)=>{const i=o(this._componentOffsets,n);i<0||i>=this._componentOffsets.length-1||s(t,n,i,e)})}}function o(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let o=0,s=e-1;for(;s-o>1;){const e=Math.round(.5*(o+s));n<=t[e]?s=e:o=e}return o}export{e as ComponentObjectFixedBVH};
2
+ import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,o,s,i,r){this._componentOffsets=r,this._intersectionData=new n(s,i,new t(e,3,o))}intersectRay(t,n,e,s){const i=(t,n,e,i)=>{const r=o(this._componentOffsets,i);s(t,n,e,i,r)};this._intersectionData.intersectRay(t,n,e,i)}*intersectScreenPolygon(t,n,e,s){this._intersectionData.forEachScreenPolygonHit(t,e,n,null,(t,n,e)=>{const i=o(this._componentOffsets,n);i<0||i>=this._componentOffsets.length-1||s(t,n,i,e)}),yield}}function o(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let o=0,s=e-1;for(;s-o>1;){const e=Math.round(.5*(o+s));n<=t[e]?s=e:o=e}return o}export{e as ComponentObjectFixedBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}intersectNodes(t){if(this.elementCount<1)return;if(this._skipBVH)return void this._intersectRange(0,this.elementCount);this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:o,minMidIndexIndex:a,maxMidIndexIndex:r,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):this._intersectRange(o,a),this._intersectRange(a,r),-1!==h?e.push(h):this._intersectRange(r,c)):this._intersectRange(o,c)}}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:o,minIndexIndex:a,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:d,aabb2D:m}=t;if(e<m[0]||e>m[2]||n<m[1]||n>m[3])break;if(-1===o||-1===t.child0&&-1===t.child1){this._intersectRange(a,d);break}{this._intersectRange(r,c);const i=(0===o?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(a,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,d);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],o=n[1];const{geometryMinZ:a}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,a),d=e[2],m=n[2];if(d<c&&m<c)return;if(d<c&&(t=(c-d)/(m-d)),m<c&&(r=(c-d)/(m-d)),t>r)return;const l=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],p=(1-r)*e[0]+r*n[0],M=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:_}=this,g=a-_,I=g/(u-_);i=l*I,s=x*I;const B=g/(f-_);h=p*B,o=M*B}const r=h-i,c=o-s,d=this._bspNodes;let m=1;{const{aabb2D:t}=d[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,o=t+m*e;return(s?o<h:o>h)&&(m=Math.max((h-t)/e,m),!0)},n=()=>e(i,r,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(r)>=Math.abs(c)?n()||h():h()||n()}const l=[0,0,m];let x=0;for(;x<l.length;){const e=l[x];let n=l[x+1],h=l[x+2];if(x+=3,n>h)continue;const o=d[e],{minIndexIndex:a,maxIndexIndex:u}=o,{child0:p,child1:M,minMidIndexIndex:f,maxMidIndexIndex:_,aabb2D:g,d:I,dim:B}=o;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),o=Math.max(t,e),a=g[0],c=g[2];if(o<a||c<s)continue;if(s<a){const t=(a-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<o){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),o=Math.max(t,e),a=g[1],r=g[3];if(o<a||r<i)continue;if(i<a){const t=(a-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<o){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===p&&-1===M)this._intersectRange(a,u);else{const e=0===B?i:s,o=0===B?r:c,d=e+n*o,x=e+h*o,g=Math.min(d,x),b=Math.max(d,x),R=t((I-e)/o,0,m);a<f&&g<=I&&(-1!==p?(l.push(p),l.push(o>=0?n:Math.max(n,R)),l.push(o>=0?Math.min(h,R):h)):this._intersectRange(a,f)),this._intersectRange(f,_),_<u&&I<=b&&(-1!==M?(l.push(M),l.push(o>=0?Math.max(n,R):n),l.push(o>=0?h:Math.min(h,R))):this._intersectRange(_,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let r=0;const m=this._bspNodes;m.length=0;const{localMode:l}=this;let x=!1;if(!l){const{planetCenterZ:t,geometryMinZ:e}=this;x=t>=0||e<.5*t}const u=[],p=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:f}=this,_=(t,i,r,u,_)=>{const g=m.length;if(g>0&&(x||r>=M||i-t<f))return;const I=n();c(I,t,i,e,s);const{d:B,dim:b}=l?h(I):o(I),{rangeMidStart:R,rangeMidEnd:V}=a(t,i,b,B,e,s),C=r===M-1,H=!C&&R>=t+f,y=!C&&i>=V+f;if(H||y||0===g){const e=new d(t,R,V,i,b,B,I);if(H&&p(t,R,r+1,g,!0),y&&p(V,i,r+1,g,!1),m.push(e),-1!==u){const t=m[u];_?t.child0=g:t.child1=g}}};for(p(0,t,0,-1,!1);r<u.length;){const t=u[r],e=u[r+1],n=u[r+2],i=u[r+3];r+=4;const s=i>>1;_(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(o=.5*(e+i),h=0):(o=.5*(n+s),h=1),{d:o,dim:h}}function o(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(h=0,o=.5*(e+i)):(h=1,o=.5*(n+s)),{dim:h,d:o}}function a(t,e,n,i,s,h){let o=t;{let t=e;for(;o<t;){const e=s[o];r(e,n,i,h)<0?++o:(--t,s[o]=s[t],s[t]=e)}}const a=o;let c=o,d=e;for(;c<d;){const t=s[d-1];r(t,n,i,h)>0?--d:(s[d-1]=s[c],s[c]=t,++c)}return{rangeMidStart:a,rangeMidEnd:d}}function r(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,o=1/0,a=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),o=Math.min(o,s[t+1]),a=Math.max(a,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=o,t[2]=a,t[3]=r}class d{constructor(t,e,n,i,s,h,o){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=o,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
2
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}intersectNodes(t){if(this.elementCount<1)return;if(this._skipBVH)return void this._intersectRange(0,this.elementCount);this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:r,minMidIndexIndex:o,maxMidIndexIndex:a,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):this._intersectRange(r,o),this._intersectRange(o,a),-1!==h?e.push(h):this._intersectRange(a,c)):this._intersectRange(r,c)}}*intersectNodesGenerator(t){if(this.elementCount<1)return;if(this._skipBVH)return void(yield*this._intersectRangeGenerator(0,this.elementCount));this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:r,minMidIndexIndex:o,maxMidIndexIndex:a,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):yield*this._intersectRangeGenerator(r,o),yield*this._intersectRangeGenerator(o,a),-1!==h?e.push(h):yield*this._intersectRangeGenerator(a,c)):yield*this._intersectRangeGenerator(r,c)}}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}*_intersectRangeGenerator(t,e){this.model.intersectRangeGenerator?yield*this.model.intersectRangeGenerator(t,e):(this._intersectRange(t,e),yield)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:r,minIndexIndex:o,minMidIndexIndex:a,maxMidIndexIndex:c,maxIndexIndex:d,aabb2D:l}=t;if(e<l[0]||e>l[2]||n<l[1]||n>l[3])break;if(-1===r||-1===t.child0&&-1===t.child1){this._intersectRange(o,d);break}{this._intersectRange(a,c);const i=(0===r?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(o,a);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,d);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],r=n[1];const{geometryMinZ:o}=this;if(!this.localMode){let t=0,a=1;const c=Math.min(.5*this.planetCenterZ,o),d=e[2],l=n[2];if(d<c&&l<c)return;if(d<c&&(t=(c-d)/(l-d)),l<c&&(a=(c-d)/(l-d)),t>a)return;const m=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],p=(1-a)*e[0]+a*n[0],M=(1-a)*e[1]+a*n[1],_=(1-a)*e[2]+a*n[2],{planetCenterZ:g}=this,f=o-g,I=f/(u-g);i=m*I,s=x*I;const R=f/(_-g);h=p*R,r=M*R}const a=h-i,c=r-s,d=this._bspNodes;let l=1;{const{aabb2D:t}=d[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,r=t+l*e;return(s?r<h:r>h)&&(l=Math.max((h-t)/e,l),!0)},n=()=>e(i,a,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(a)>=Math.abs(c)?n()||h():h()||n()}const m=[0,0,l];let x=0;for(;x<m.length;){const e=m[x];let n=m[x+1],h=m[x+2];if(x+=3,n>h)continue;const r=d[e],{minIndexIndex:o,maxIndexIndex:u}=r,{child0:p,child1:M,minMidIndexIndex:_,maxMidIndexIndex:g,aabb2D:f,d:I,dim:R}=r;{const t=i+n*a,e=i+h*a,s=Math.min(t,e),r=Math.max(t,e),o=f[0],c=f[2];if(r<o||c<s)continue;if(s<o){const t=(o-i)/a;a>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<r){const t=(c-i)/a;a>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),r=Math.max(t,e),o=f[1],a=f[3];if(r<o||a<i)continue;if(i<o){const t=(o-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(a<r){const t=(a-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===p&&-1===M)this._intersectRange(o,u);else{const e=0===R?i:s,r=0===R?a:c,d=e+n*r,x=e+h*r,f=Math.min(d,x),B=Math.max(d,x),b=t((I-e)/r,0,l);o<_&&f<=I&&(-1!==p?(m.push(p),m.push(r>=0?n:Math.max(n,b)),m.push(r>=0?Math.min(h,b):h)):this._intersectRange(o,_)),this._intersectRange(_,g),g<u&&I<=B&&(-1!==M?(m.push(M),m.push(r>=0?Math.max(n,b):n),m.push(r>=0?h:Math.min(h,b))):this._intersectRange(g,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let a=0;const l=this._bspNodes;l.length=0;const{localMode:m}=this;let x=!1;if(!m){const{planetCenterZ:t,geometryMinZ:e}=this;x=t>=0||e<.5*t}const u=[],p=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:_}=this,g=(t,i,a,u,g)=>{const f=l.length;if(f>0&&(x||a>=M||i-t<_))return;const I=n();c(I,t,i,e,s);const{d:R,dim:B}=m?h(I):r(I),{rangeMidStart:b,rangeMidEnd:y}=o(t,i,B,R,e,s),V=a===M-1,C=!V&&b>=t+_,H=!V&&i>=y+_;if(C||H||0===f){const e=new d(t,b,y,i,B,R,I);if(C&&p(t,b,a+1,f,!0),H&&p(y,i,a+1,f,!1),l.push(e),-1!==u){const t=l[u];g?t.child0=f:t.child1=f}}};for(p(0,t,0,-1,!1);a<u.length;){const t=u[a],e=u[a+1],n=u[a+2],i=u[a+3];a+=4;const s=i>>1;g(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,r;return i-e>=s-n?(r=.5*(e+i),h=0):(r=.5*(n+s),h=1),{d:r,dim:h}}function r(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,r;return i-e>=s-n?(h=0,r=.5*(e+i)):(h=1,r=.5*(n+s)),{dim:h,d:r}}function o(t,e,n,i,s,h){let r=t;{let t=e;for(;r<t;){const e=s[r];a(e,n,i,h)<0?++r:(--t,s[r]=s[t],s[t]=e)}}const o=r;let c=r,d=e;for(;c<d;){const t=s[d-1];a(t,n,i,h)>0?--d:(s[d-1]=s[c],s[c]=t,++c)}return{rangeMidStart:o,rangeMidEnd:d}}function a(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,r=1/0,o=-1/0,a=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),r=Math.min(r,s[t+1]),o=Math.max(o,s[t+2]),a=Math.max(a,s[t+3])}t[0]=h,t[1]=r,t[2]=o,t[3]=a}class d{constructor(t,e,n,i,s,h,r){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=r,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{transpose as t,invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as o,negate as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as m,floatArrayByteSize as c,newFloatArray as p}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as _,getContinuousIndexArray as l,indexArrayByteSize as b}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as u}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as f}from"./ComponentObjectFixedBVH.js";class g{constructor(t,e,s,n){this.viewingMode=t,this._components=s,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=a(),this._componentBvh=null,this._aabb=h();const{indices:i,positions:o}=e,r=o.length/3;this._indices=i?_(i,r):l(r),this._positions=m(o)}get usedMemory(){return c(this._positions)+b(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,e){const s=this._ensureComponentAabbs(),n=6*t;return e[0]=s[n],e[1]=s[n+1],e[2]=s[n+2],e[3]=s[n+3],e[4]=s[n+4],e[5]=s[n+5],e}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,e){e.indices=this._indices,e.data=this._positions,e.stride=3,e.startIndex=this._components.offsets[t],e.endIndex=this._components.offsets[t+1]}intersectRay(e,s,n,a,h,m,c){const p=v;this._setupIntersect(n,a,h,p);const{position:_}=h,l=i(d,e,_),b=i(C,s,_);o(l,l,p),o(b,b,p);const u=t(x,p);if(1===this.viewingMode){const t=this._planetCenter;r(t,_),o(t,t,p)}const f=(t,e,s,n,i)=>{c(t,e,s?o(A,s,u):null,n,i)};this._intersectComponents(l,b,a,n,f,m)}intersectScreenPolygon(t,e,s,n,i,o){this._setupIntersect(s,n,i);this._ensureComponentBvh().intersectScreenPolygon(t,e,i.toMat4(M),(t,e,s,n)=>o(s,t,n,e),n??void 0,s??void 0)}_setupIntersect(t,s,n,i=v){if(this.verticalOffset=t,this.componentVerticalOffsets=s,e(i,n.rotationScale),1===this.viewingMode){const t=this._planetCenter;r(t,n.position),o(t,t,i)}}_computePerComponentAabbs(){const t=this._aabb,e=.5*(t[0]+t[3]),s=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=p(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,c=1/0,_=1/0,l=1/0,b=-1/0,u=-1/0,f=-1/0;for(let p=0;p<i;p++){const t=h[p],i=h[p+1];let g=1/0,d=1/0,C=1/0,v=-1/0,M=-1/0,A=-1/0;if(t<i)for(let e=t;e<i;e++){const t=3*r[e],s=a[t],n=a[t+1],i=a[t+2];g=Math.min(g,s),d=Math.min(d,n),C=Math.min(C,i),v=Math.max(v,s),M=Math.max(M,n),A=Math.max(A,i)}else g=e,d=s,C=n,v=e,M=s,A=n;o[m++]=g,o[m++]=d,o[m++]=C,o[m++]=v,o[m++]=M,o[m++]=A,c=Math.min(c,g),_=Math.min(_,d),l=Math.min(l,C),b=Math.max(b,v),u=Math.max(u,M),f=Math.max(f,A)}return this._aabb[0]=c,this._aabb[1]=_,this._aabb[2]=l,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,e,s,n,i,o){this._ensureComponentBvh().intersectRay(t,e,o,i,s??void 0,n??void 0)}_ensureComponentBvh(){let t=this._componentBvh;return null==t&&(t=this._needsElevationAlignment?new u(this._positions,j,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new f(this._positions,j,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=t),t}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const d=a(),C=a(),v=s(),M=n(),A=a(),x=s(),j=3;export{g as IntersectionGeometry};
2
+ import{transpose as t,invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as o,negate as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as m,floatArrayByteSize as c,newFloatArray as p}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as l,getContinuousIndexArray as _,indexArrayByteSize as b}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as u}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as f}from"./ComponentObjectFixedBVH.js";class d{constructor(t,e,s,n){this.viewingMode=t,this._components=s,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=a(),this._componentBvh=null,this._aabb=h();const{indices:i,positions:o}=e,r=o.length/3;this._indices=i?l(i,r):_(r),this._positions=m(o)}get usedMemory(){return c(this._positions)+b(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,e){const s=this._ensureComponentAabbs(),n=6*t;return e[0]=s[n],e[1]=s[n+1],e[2]=s[n+2],e[3]=s[n+3],e[4]=s[n+4],e[5]=s[n+5],e}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,e){e.indices=this._indices,e.data=this._positions,e.stride=3,e.startIndex=this._components.offsets[t],e.endIndex=this._components.offsets[t+1]}intersectRay(e,s,n,a,h,m,c){const p=v;this._setupIntersect(n,a,h,p);const{position:l}=h,_=i(g,e,l),b=i(C,s,l);o(_,_,p),o(b,b,p);const u=t(x,p);if(1===this.viewingMode){const t=this._planetCenter;r(t,l),o(t,t,p)}const f=(t,e,s,n,i)=>{c(t,e,s?o(A,s,u):null,n,i)};this._intersectComponents(_,b,a,n,f,m)}*intersectScreenPolygon(t,e,s,n,i,o){this._setupIntersect(s,n,i);const r=this._ensureComponentBvh();yield*r.intersectScreenPolygon(t,e,i.toMat4(M),(t,e,s,n)=>o(s,t,n,e),n??void 0,s??void 0)}_setupIntersect(t,s,n,i=v){if(this.verticalOffset=t,this.componentVerticalOffsets=s,e(i,n.rotationScale),1===this.viewingMode){const t=this._planetCenter;r(t,n.position),o(t,t,i)}}_computePerComponentAabbs(){const t=this._aabb,e=.5*(t[0]+t[3]),s=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=p(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,c=1/0,l=1/0,_=1/0,b=-1/0,u=-1/0,f=-1/0;for(let p=0;p<i;p++){const t=h[p],i=h[p+1];let d=1/0,g=1/0,C=1/0,v=-1/0,M=-1/0,A=-1/0;if(t<i)for(let e=t;e<i;e++){const t=3*r[e],s=a[t],n=a[t+1],i=a[t+2];d=Math.min(d,s),g=Math.min(g,n),C=Math.min(C,i),v=Math.max(v,s),M=Math.max(M,n),A=Math.max(A,i)}else d=e,g=s,C=n,v=e,M=s,A=n;o[m++]=d,o[m++]=g,o[m++]=C,o[m++]=v,o[m++]=M,o[m++]=A,c=Math.min(c,d),l=Math.min(l,g),_=Math.min(_,C),b=Math.max(b,v),u=Math.max(u,M),f=Math.max(f,A)}return this._aabb[0]=c,this._aabb[1]=l,this._aabb[2]=_,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,e,s,n,i,o){this._ensureComponentBvh().intersectRay(t,e,o,i,s??void 0,n??void 0)}_ensureComponentBvh(){let t=this._componentBvh;return null==t&&(t=this._needsElevationAlignment?new u(this._positions,y,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new f(this._positions,y,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=t),t}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const g=a(),C=a(),v=s(),M=n(),A=a(),x=s(),y=3;export{d as IntersectionGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=i(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=i(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get emissions(){return this._emissions.value}set emissions(t){this._emissions.value=t}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(t){this._camera.value=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=i(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=i(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get emissions(){return this._emissions.value}set emissions(t){this._emissions.value=t}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(t){this._camera.value=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../webgl.js";import s from"../../webgl/RenderNode.js";import{prepareGaussianSplatPerspectiveParameters as n,canRenderGaussianSplats as a}from"./GaussianSplatRenderUtils.js";import{GaussianSplatDepthTechnique as o}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatPassParameters as l}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechniqueConfiguration as d}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as h}from"../../../webgl/enums.js";let p=class extends s{constructor(e){super(e),this.consumes={required:[r.GAUSSIAN_SPLAT_DEPTH]},this.produces=r.GAUSSIAN_SPLAT_DEPTH,this.layerView=null,this._passParameters=new l,this._configuration=new d(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(o,this._configuration))}render(){const e=this.bindRenderTarget();if(this.layerView.fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;this._updateConfiguration(),n(this._passParameters,this.layerView,this.bindParameters.camera);const i=this.techniques.get(o,this._configuration);return this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(h.TRIANGLE_STRIP,0,4,this.layerView.data.visibleGaussians),e}get _canRender(){return a(this.layerView.data)}_updateConfiguration(){this._configuration.fadingEnabled=this.layerView.fadeHelper.fadingEnabled,this._configuration.clippingEnabled=null!=this.layerView.clippingBox,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.needsFragmentPosition=this._configuration.clippingEnabled||this._configuration.hasSlicePlane}};e([i()],p.prototype,"consumes",void 0),e([i()],p.prototype,"produces",void 0),e([i({constructOnly:!0})],p.prototype,"layerView",void 0),p=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatDepthRenderer")],p);export{p as GaussianSplatDepthRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as n,positiveInfinity as h,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as c}from"../../layers/i3s/I3SUtil.js";import p from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as m,prepareGaussianSplatPerspectiveParameters as d}from"./GaussianSplatRenderUtils.js";import{G as _}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as g}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as f}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as C}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as P}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as v,DepthStencilAttachment as w,PrimitiveType as R}from"../../../webgl/enums.js";let x=class extends p{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new P,this._compositionPassParameters=new _,this._depthCompositionPassParameters=new C,this._compositionConfiguration=new f,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new q(e.view.state.isGlobal),n(this._clipBox,h)}async initialize(){this.addHandles([i(()=>this.view.state.camera,()=>this._onCameraChange()),i(()=>2===this.view.state.mode,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(S,this._configuration),this.techniques.precompile(g,this._compositionConfiguration),this.techniques.precompile(b))}render(){const e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;const i=e.getAttachment(v);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=i;const{fullWidth:t,fullHeight:s}=this.bindParameters.camera;this._prepareParameters();const r=this.renderingContext,a=this.fboCache,o=a.acquire(t,s,"gaussian color output"),n=e.getAttachment(w);o.attachDepth(n);const h=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,h);const l=a.acquire(t,s,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(v),l.attachDepth(e.getAttachment(w)),r.bindFramebuffer(l.fbo);const u=this.techniques.get(b);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),i?(l.acquireColor(v,8,"emissive"),this._compositionPassParameters.emission=e.getTexture(v)):this._compositionPassParameters.emission=null,r.bindFramebuffer(l.fbo);const c=this.techniques.get(g,this._compositionConfiguration);return r.bindTechnique(c,this.bindParameters,this._compositionPassParameters),r.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const i=e||h;this._hasSameClipBox(i)||(n(this._clipBox,i),this._tileCullingRevision=c(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,h,(e,i)=>e===i)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _canRender(){return m(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){const{idleMinimumOpacity:e,nonIdleMinimumOpacity:i}=this.view.qualitySettings.gaussianSplat;this._configuration.alphaCutoff=this._isIdle?e:i,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=c(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),r(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){d(this._passParameters,this.layerView,this.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,i)=>e===i)}_renderGaussianColorAndDepth(e,i){const t=this.renderingContext;e.acquireColor(v,5,"gaussian depth output"),t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(R.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([t()],x.prototype,"consumes",void 0),e([t()],x.prototype,"produces",void 0),e([t({constructOnly:!0})],x.prototype,"layerView",void 0),x=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderer")],x);export{x as GaussianSplatRenderer};
2
+ import{__decorate as e}from"tslib";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as n,positiveInfinity as h,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as c}from"../../layers/i3s/I3SUtil.js";import p from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as m,prepareGaussianSplatPerspectiveParameters as d}from"./GaussianSplatRenderUtils.js";import{G as _}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as g}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as f}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as C}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as P}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as v,DepthStencilAttachment as w,PrimitiveType as R}from"../../../webgl/enums.js";let x=class extends p{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new P,this._compositionPassParameters=new _,this._depthCompositionPassParameters=new C,this._compositionConfiguration=new f,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new q(e.view.state.isGlobal),n(this._clipBox,h)}async initialize(){this.addHandles([i(()=>this.view.state.camera,()=>this._onCameraChange()),i(()=>2===this.view.state.mode,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(S,this._configuration),this.techniques.precompile(g,this._compositionConfiguration),this.techniques.precompile(b))}render(){const e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;const i=e.getAttachment(v);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=i;const{fullWidth:t,fullHeight:s}=this.bindParameters.camera;this._prepareParameters();const r=this.renderingContext,a=this.fboCache,o=a.acquire(t,s,"gaussian color output"),n=e.getAttachment(w);o.attachDepth(n);const h=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,h);const l=a.acquire(t,s,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(v),l.attachDepth(e.getAttachment(w)),r.bindFramebuffer(l.fbo);const u=this.techniques.get(b);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),i?(l.acquireColor(v,8,"emissive"),this._compositionPassParameters.emission=e.getTexture(v)):this._compositionPassParameters.emission=null,r.bindFramebuffer(l.fbo);const c=this.techniques.get(g,this._compositionConfiguration);return r.bindTechnique(c,this.bindParameters,this._compositionPassParameters),r.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const i=e||h;this._hasSameClipBox(i)||(n(this._clipBox,i),this._tileCullingRevision=c(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,h,(e,i)=>e===i)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _canRender(){return m(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){const{idleMinimumOpacity:e,nonIdleMinimumOpacity:i}=this.view.qualitySettings.gaussianSplat;this._configuration.alphaCutoff=this._isIdle?e:i,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.needsFragmentPosition=this._configuration.receiveShadows||this._configuration.clippingEnabled||this._configuration.hasSlicePlane}_onCameraChange(){this._tileCullingRevision=c(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),r(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){d(this._passParameters,this.layerView,this.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,i)=>e===i)}_renderGaussianColorAndDepth(e,i){const t=this.renderingContext;e.acquireColor(v,5,"gaussian depth output"),t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(R.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([t()],x.prototype,"consumes",void 0),e([t()],x.prototype,"produces",void 0),e([t({constructOnly:!0})],x.prototype,"layerView",void 0),x=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderer")],x);export{x as GaussianSplatRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as a}from"../../webgl.js";import n from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as o,prepareGaussianSplatRenderParameters as p}from"./GaussianSplatRenderUtils.js";import{GaussianSplatRenderParameters as h}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatShadowTechnique as l}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as d}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as u}from"../../../webgl/enums.js";let c=class extends n{constructor(e){super(e),this.consumes={required:[a.SHADOWMAP]},this.produces=a.SHADOWMAP,this.layerView=null,this._passParameters=new h,this._cameraPosition=r(),this._configuration=new d(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(l,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&o(this._data)}_render(){const e=this.techniques.get(l,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(u.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=this.bindParameters.output}_prepareShadowParameters(e){this._updateShadowCameraPosition(e),p(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;s(this._cameraPosition,i[3],i[7],i[11])}};e([i()],c.prototype,"consumes",void 0),e([i()],c.prototype,"produces",void 0),e([i({constructOnly:!0})],c.prototype,"layerView",void 0),c=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],c);export{c as GaussianSplatShadows};
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as r}from"../../webgl.js";import n from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as o,prepareGaussianSplatRenderParameters as h}from"./GaussianSplatRenderUtils.js";import{gaussianSplatDepthPolicy as p}from"../shaders/GaussianSplatDepthPolicy.js";import{G as l}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as d}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as u}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as c}from"../../../webgl/enums.js";let m=class extends n{constructor(e){super(e),this.consumes={required:[r.SHADOWMAP]},this.produces=r.SHADOWMAP,this.layerView=null,this._passParameters=new l,this._cameraPosition=a(),this._configuration=new u(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(d,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&o(this._data)}_render(){const e=this.techniques.get(d,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(c.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=this.bindParameters.output}_prepareShadowParameters(e){const i=this.bindParameters.renderingShadowAnalysisMap?p.analysis:p.direct;this._passParameters.alphaCutoff=i.alphaCutoff,this._passParameters.depthBias=i.depthBias,this._updateShadowCameraPosition(e),h(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;t(this._cameraPosition,i[3],i[7],i[11])}};e([i()],m.prototype,"consumes",void 0),e([i()],m.prototype,"produces",void 0),e([i({constructOnly:!0})],m.prototype,"layerView",void 0),m=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],m);export{m as GaussianSplatShadows};