@arcgis/core 4.33.0-next.20250303 → 4.33.0-next.20250305

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 (158) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{b49af2e3a1a38a063ab9.js → 1bd4fe77ba6fb25322e7.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{2f818b9a6b1f2b61410d.js → 1e7a70a1871fea29169e.js} +27 -27
  4. package/assets/esri/core/workers/chunks/{3ebdd0701e77bb28c75d.js → 2079f9d28e4199714f22.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{0fd6a78b38b0e2dae8a5.js → 237a965bd41ba8903e03.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{618016fc1165bcfc2b0d.js → 42b862550c96cc1be956.js} +7 -9
  7. package/assets/esri/core/workers/chunks/4403b3f08907e88d0d91.js +1 -0
  8. package/assets/esri/core/workers/chunks/{4dbd4523281691401272.js → 4539a802cba77a7a7cc7.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{0e2d9cd4e8ee5a62b05c.js → 45eee326f7a649c5a15b.js} +7 -9
  10. package/assets/esri/core/workers/chunks/{99f90d085aa9eb13e4fb.js → 46fb6ba8900286d18b6f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{2a44a6e75b2799246257.js → 4fb4884d2de42792abe3.js} +1 -1
  12. package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +1 -0
  13. package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 6e6422eda398774acbc7.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{c9cb8a6ff01275bec713.js → 77845cd5d824c1004bfa.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{a73a262ddc959a59819f.js → 7d3b2bdc75525d47389c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{cc1aedb2b3aa3854b0de.js → 901c957c049f53318e87.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → 909be86782af3deb448e.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{7d93ff4f18fd21c7b9f2.js → 94f41ef15f6c61562e5e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8540fb31bd0b29ff1906.js → 968956284f44187f0622.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{92b48e3365d1cc933113.js → 96d2a0777f5c418055fb.js} +1 -1
  21. package/assets/esri/core/workers/chunks/988efc508c33ca341e49.js +1 -0
  22. package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → abfc5f9ac16c3e885c5f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{856b03020b2dd047291d.js → ad9b3b83aa96db7b79ea.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → afddb94ff4e1a70022c7.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{c409bb2acd846d3b1395.js → b2f9f0767dadf185120c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → ba917175ca2a6681501e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/c03e6e35082beaec02a6.js +1 -0
  28. package/assets/esri/core/workers/chunks/{759781cad91d31ab7bc4.js → db4c110ab4c26c4b768c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/dcb043986fb065de0366.js +1 -0
  30. package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → de16b771d2c8d816c738.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{3010a22d00f45fce5939.js → e0ac90b4ad8c36fb7d70.js} +1 -1
  32. package/assets/esri/core/workers/chunks/e3e049311bced533c853.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → e56647e61296643c5f84.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1bc22af4cc4effcbcf2b.js → e6a5911ea21bef32834b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f4111bb5e5a4910b684a.js +1 -0
  36. package/assets/esri/core/workers/chunks/{12d798775a96a45aada2.js → f46c4a69ef2f763e905b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5e80e10b7c7e66dd861e.js → febae745a29a17ca130a.js} +1 -1
  38. package/chunks/Bufferer-CicaNej1.js +1 -1
  39. package/chunks/Clouds.glsl.js +19 -23
  40. package/chunks/DefaultMaterial.glsl.js +22 -22
  41. package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
  42. package/chunks/Envelope.js +1 -1
  43. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  44. package/chunks/ImageMaterial.glsl.js +1 -1
  45. package/chunks/OperatorClip.js +1 -1
  46. package/chunks/OperatorCut.js +1 -1
  47. package/chunks/OperatorGeodesicBuffer.js +1 -1
  48. package/chunks/OperatorGeodeticArea.js +1 -1
  49. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  50. package/chunks/OperatorProximity.js +1 -1
  51. package/chunks/OperatorShapePreservingProject.js +1 -1
  52. package/chunks/ProjectionTransformation.js +1 -1
  53. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  54. package/chunks/disjointOperator.js +1 -1
  55. package/core/Accessor.js +1 -1
  56. package/core/accessorSupport/decorators/subclass.js +1 -1
  57. package/core/accessorSupport/interfaces.js +1 -1
  58. package/core/arrayUtils.js +1 -1
  59. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  60. package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
  61. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +5 -0
  62. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +5 -0
  63. package/geometry/operators/extendOperator.js +1 -1
  64. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  65. package/geometry/operators/gx/operatorBuffer.js +1 -1
  66. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  67. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  68. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  69. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  70. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  71. package/geometry/operators/gx/operatorSimplify.js +1 -1
  72. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  73. package/geometry/operators/gx/operatorUnion.js +1 -1
  74. package/geometry/operators/json/disjointOperator.js +1 -1
  75. package/geometry/operators/reshapeOperator.js +1 -1
  76. package/geometry/operators/support/apiConverter.js +1 -1
  77. package/geometry/operators/support/initNoPeFactory.js +1 -1
  78. package/geometry/operators/support/jsonConverter.js +1 -1
  79. package/interfaces.d.ts +20 -18
  80. package/layers/WMTSLayer.js +1 -1
  81. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  82. package/layers/graphics/dehydratedFeatures.js +1 -1
  83. package/layers/mixins/ArcGISImageService.js +1 -1
  84. package/layers/support/SubtypeSublayer.js +1 -1
  85. package/layers/support/featureLayerUtils.js +1 -1
  86. package/layers/support/wmtsUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/request.js +1 -1
  89. package/rest/support/IdentifyParameters.js +1 -1
  90. package/support/revision.js +1 -1
  91. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  92. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  93. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  94. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  95. package/views/3d/environment/Clouds.glsl.js +1 -1
  96. package/views/3d/environment/CloudsParameters.js +1 -1
  97. package/views/3d/environment/CloudsRenderer.js +1 -1
  98. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  99. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  100. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  101. package/views/3d/layers/I3SMeshView3D.js +1 -1
  102. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  103. package/views/3d/layers/MediaLayerView3D.js +1 -1
  104. package/views/3d/layers/SceneLayerView3D.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  106. package/views/3d/layers/support/FeatureTile.js +1 -1
  107. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  108. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  109. package/views/3d/layers/support/projectExtentUtils.js +1 -1
  110. package/views/3d/support/StreamTextureCollection.js +1 -1
  111. package/views/3d/support/TextureCollection.js +1 -1
  112. package/views/3d/terrain/TerrainRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainSurface.js +1 -1
  114. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +7 -7
  115. package/views/3d/webgl-engine/core/shaderLibrary/util/DoublePrecision.glsl.js +5 -7
  116. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCloudsFromTextureArray.glsl.js +51 -0
  117. package/views/3d/webgl-engine/lib/GLMaterialParameters.js +5 -0
  118. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  119. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  120. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  121. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  122. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  123. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  125. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  126. package/views/View.js +1 -1
  127. package/views/animation/pointToPoint/apex/planning.js +1 -1
  128. package/views/support/LayerLayerViewInfo.js +5 -0
  129. package/views/support/LayerViewManager.js +5 -0
  130. package/views/webgl/FramebufferObject.js +1 -1
  131. package/views/webgl/TextureDescriptor.js +1 -1
  132. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  133. package/widgets/Editor/Edits.js +1 -1
  134. package/widgets/Editor/workflowUtils.js +1 -1
  135. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  136. package/widgets/Feature/FeatureRelationship.js +1 -1
  137. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  138. package/widgets/Feature/support/featureUtils.js +1 -1
  139. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  140. package/widgets/FeatureForm/FieldInput.js +1 -1
  141. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  142. package/widgets/Features/FeaturesDrillIn.js +1 -1
  143. package/widgets/Features/FeaturesViewModel.js +1 -1
  144. package/widgets/Features.js +1 -1
  145. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  146. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  147. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  148. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  149. package/assets/esri/core/workers/chunks/0e6d338b0937724763c7.js +0 -1
  150. package/assets/esri/core/workers/chunks/10118666a5a5b141ece6.js +0 -1
  151. package/assets/esri/core/workers/chunks/64d3e683872791eb6ae9.js +0 -1
  152. package/assets/esri/core/workers/chunks/7d120f8b01fe719eb257.js +0 -1
  153. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +0 -1
  154. package/assets/esri/core/workers/chunks/960b12a6fd5b6933212f.js +0 -1
  155. package/assets/esri/core/workers/chunks/af005704f23088db3ded.js +0 -1
  156. package/editing/sharedTemplates/executor/support/createServiceEdit.js +0 -5
  157. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCubemapFromTextureArray.glsl.js +0 -39
  158. package/views/LayerViewManager.js +0 -5
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{earth as t}from"../../../../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as e}from"../../../../environment/Clouds.js";import{FadeState as r}from"../../../../environment/CloudsParameters.js";import{cloudsHeight as a}from"../../../../environment/weather.js";import{addMainLightDirection as i,addMainLightIntensity as c}from"../shading/MainLighting.glsl.js";import{LookupCubemapFromTextureArray as d}from"./LookupCubemapFromTextureArray.glsl.js";import{BooleanBindUniform as n}from"../../shaderModules/BooleanBindUniform.js";import{Float3BindUniform as l}from"../../shaderModules/Float3BindUniform.js";import{FloatBindUniform as s}from"../../shaderModules/FloatBindUniform.js";import{glsl as u}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as m}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DArrayBindUniform as h}from"../../shaderModules/Texture2DArrayBindUniform.js";function C(t){const a=t.fragment;a.constants.add("radiusCloudsSquared","float",p).code.add(u`vec3 intersectWithCloudLayer(vec3 dir, vec3 cameraPosition, vec3 spherePos) {
5
+ import{fromValues as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{earth as t}from"../../../../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as e}from"../../../../environment/Clouds.js";import{FadeState as r}from"../../../../environment/CloudsParameters.js";import{cloudsHeight as a}from"../../../../environment/weather.js";import{addMainLightDirection as i,addMainLightIntensity as d}from"../shading/MainLighting.glsl.js";import{LookupCloudsFromTextureArray as c}from"./LookupCloudsFromTextureArray.glsl.js";import{BooleanBindUniform as n}from"../../shaderModules/BooleanBindUniform.js";import{Float3BindUniform as l}from"../../shaderModules/Float3BindUniform.js";import{FloatBindUniform as s}from"../../shaderModules/FloatBindUniform.js";import{glsl as u}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as m}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DArrayBindUniform as h}from"../../shaderModules/Texture2DArrayBindUniform.js";function C(t){const a=t.fragment;a.constants.add("radiusCloudsSquared","float",v).code.add(u`vec3 intersectWithCloudLayer(vec3 dir, vec3 cameraPosition, vec3 spherePos) {
6
6
  float B = 2.0 * dot(cameraPosition, dir);
7
7
  float C = dot(cameraPosition, cameraPosition) - radiusCloudsSquared;
8
8
  float det = B * B - 4.0 * C;
@@ -13,11 +13,11 @@ dir.z = dir.z * (1.0 - radiusCurvatureCorrection) + radiusCurvatureCorrection;
13
13
  return dir;
14
14
  }`),a.code.add(u`vec3 rotateDirectionToAnchorPoint(mat4 rotMat, vec3 inVec) {
15
15
  return (rotMat * vec4(inVec, 0.0)).xyz;
16
- }`),i(a),c(a);const C=o(.28,.175,.035);a.constants.add("RIM_COLOR","vec3",C);const v=.3,f=140,g=.2,w=10,P=.3;a.code.add(u`
16
+ }`),i(a),d(a);const C=o(.28,.175,.035);a.constants.add("RIM_COLOR","vec3",C);const f=.3,p=140,g=.2,w=10,P=.3;a.code.add(u`
17
17
  vec3 calculateCloudColor(vec3 cameraPosition, vec3 worldSpaceRay, vec4 clouds) {
18
18
  float upDotLight = dot(cameraPosition, mainLightDirection);
19
19
  float dirDotLight = max(dot(worldSpaceRay, mainLightDirection), 0.0);
20
- float sunsetTransition = clamp(pow(max(upDotLight, 0.0), ${u.float(v)}), 0.0, 1.0);
20
+ float sunsetTransition = clamp(pow(max(upDotLight, 0.0), ${u.float(f)}), 0.0, 1.0);
21
21
 
22
22
  // Base color of the clouds that depends on lighting of the sun and sky
23
23
  vec3 ambientLight = calculateAmbientIrradiance(cameraPosition, 0.0);
@@ -27,15 +27,15 @@ return (rotMat * vec4(inVec, 0.0)).xyz;
27
27
  // Rim light around the edge of the clouds simulating scattering of the direct lun light
28
28
  float scatteringMod = max(clouds.a < 0.5 ? clouds.a / 0.5 : - clouds.a / 0.5 + 2.0, 0.0);
29
29
  float rimLightIntensity = 0.5 + 0.5 * pow(max(upDotLight, 0.0), 0.35);
30
- vec3 directSunScattering = RIM_COLOR * rimLightIntensity * (pow(dirDotLight, ${u.float(f)})) * scatteringMod;
30
+ vec3 directSunScattering = RIM_COLOR * rimLightIntensity * (pow(dirDotLight, ${u.float(p)})) * scatteringMod;
31
31
 
32
32
  // Brighten the clouds around the sun at the sunsets
33
33
  float additionalLight = ${u.float(g)} * pow(dirDotLight, ${u.float(w)}) * (1. - pow(sunsetTransition, ${u.float(P)})) ;
34
34
 
35
35
  return vec3(baseCloudColor * (1.0 + additionalLight) + directSunScattering);
36
36
  }
37
- `),t.include(d),a.uniforms.add(new n("readChannelsRG",(o=>o.clouds.readChannels===e.RG)),new h("cubeMap",(o=>o.clouds.data?.cubeMap?.colorTexture??null))).code.add(u`vec4 sampleCloud(vec3 rayDir, bool readOtherChannel) {
38
- vec4 s = lookupCubemapFromTextureArray(cubeMap, rayDir);
37
+ `),t.include(c),a.uniforms.add(new n("readChannelsRG",(o=>o.clouds.readChannels===e.RG)),new h("cubeMap",(o=>o.clouds.data?.cubeMap?.colorTexture??null))).code.add(u`vec4 sampleCloud(vec3 rayDir, bool readOtherChannel) {
38
+ vec4 s = lookupCloudsFromTextureArray(cubeMap, rayDir);
39
39
  bool readRG = readChannelsRG ^^ readOtherChannel;
40
40
  s = readRG ? vec4(vec3(s.r), s.g) : vec4(vec3(s.b), s.a);
41
41
  return length(s) == 0.0 ? vec4(s.rgb, 1.0) : s;
@@ -58,4 +58,4 @@ float totalTransmittance = length(cloudColor.rgb) == 0.0 ?
58
58
  1.0 :
59
59
  clamp(cloudColor.a * cloudsOpacity + (1.0 - cloudsOpacity), 0.0 , 1.0);
60
60
  return vec4(cloudColor.rgb, totalTransmittance);
61
- }`)}const p=(t.radius+a)**2;export{C as CloudsParallaxShading};
61
+ }`)}const v=(t.radius+a)**2;export{C as CloudsParallaxShading};
@@ -2,10 +2,8 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{glsl as e}from"../../shaderModules/glsl.js";function t({code:t}){t.add(e`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
6
- vec3 t1 = hiA + hiB;
7
- vec3 e = t1 - hiA;
8
- vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;
9
- vec3 result = t1 + t2;
10
- return result;
11
- }`)}export{t as DoublePrecision};
5
+ import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{glsl as d}from"../../shaderModules/glsl.js";function e({code:e,uniforms:i},l){i.add(new o("dpDummy",(()=>1))),e.add(d`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
6
+ vec3 hiD = hiA + hiB;
7
+ vec3 loD = loA + loB;
8
+ return dpDummy * hiD + loD;
9
+ }`)}export{e as DoublePrecision};
@@ -0,0 +1,51 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{FloatBindUniform as r}from"../../shaderModules/FloatBindUniform.js";import{glsl as a}from"../../shaderModules/glsl.js";function e(e){e.fragment.uniforms.add(new r("cloudAbsorption",(r=>r.clouds.absorption)),new r("cloudCoverage",(r=>r.clouds.coverage))).code.add(a`vec4 lookupCloudsFromTextureArray(sampler2DArray cubeMap, vec3 rayDir) {
6
+ int faceIndex;
7
+ vec2 uv;
8
+ if(rayDir.z <= 0.0) {
9
+ float hazeFactor = smoothstep(-0.01, mix(0.0, 0.075, cloudCoverage), abs(dot(rayDir, vec3(0, 0, 1))));
10
+ float shading = clamp(1.0 - cloudAbsorption, 0.6, 1.0) * (1.0 - hazeFactor);
11
+ float totalTransmittance = hazeFactor;
12
+ return vec4(shading, totalTransmittance, shading, totalTransmittance);
13
+ }
14
+ if (abs(rayDir.x) >= abs(rayDir.y) && abs(rayDir.x) >= abs(rayDir.z)) {
15
+ if(rayDir.x > 0.0) {
16
+ faceIndex = 0;
17
+ uv = rayDir.yz / rayDir.x;
18
+ uv = vec2(-uv.x, uv.y);
19
+ } else {
20
+ faceIndex = 1;
21
+ uv = rayDir.yz / rayDir.x;
22
+ uv = vec2(-uv.x, -uv.y);
23
+ }
24
+ } else if (abs(rayDir.y) >= abs(rayDir.x) && abs(rayDir.y) >= abs(rayDir.z)) {
25
+ if(rayDir.y > 0.0) {
26
+ faceIndex = 2;
27
+ uv = rayDir.xz / rayDir.y;
28
+ } else {
29
+ faceIndex = 3;
30
+ uv = rayDir.xz / rayDir.y;
31
+ uv = vec2(uv.x, -uv.y);
32
+ }
33
+ } else {
34
+ if(rayDir.y < 0.0) {
35
+ faceIndex = 4;
36
+ uv = rayDir.xy / rayDir.z;
37
+ uv = vec2(uv.x, -uv.y);
38
+ } else {
39
+ faceIndex = 5;
40
+ uv = rayDir.xy / rayDir.z;
41
+ uv = vec2(uv.x, -uv.y);
42
+ }
43
+ }
44
+ uv = 0.5 * (uv + 1.0);
45
+ if(faceIndex != 5) {
46
+ uv.y = uv.y - 0.5;
47
+ }
48
+ uv.y = uv.y * 2.0;
49
+ vec4 s = texture(cubeMap, vec3(uv, float(faceIndex)));
50
+ return s;
51
+ }`)}export{e as LookupCloudsFromTextureArray};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ class t{constructor(t,s,e,i){this.material=t,this.output=s,this.techniques=e,this.textures=i}}export{t as GLMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{NestedMap as r}from"../../../../core/NestedMap.js";import{assert as i}from"./Util.js";class s{constructor(e,t,i,s){this._textures=e,this._techniques=t,this.materialChanged=i,this.requestRender=s,this._id2glMaterialRef=new r}dispose(){this._textures.destroy()}acquire(e,t,r){this._ownMaterial(e);const i=e.produces.get(t);if(!i?.(r))return null;let s=this._id2glMaterialRef.get(r,e.id);if(null==s){const t=e.createGLMaterial({material:e,techniques:this._techniques,textures:this._textures,output:r});s=new a(t),this._id2glMaterialRef.set(r,e.id,s)}return s.ref(),s.glMaterial}release(e,r){const i=this._id2glMaterialRef.get(r,e.id);null!=i&&(i.unref(),i.referenced||(t(i.glMaterial),this._id2glMaterialRef.delete(r,e.id)))}_ownMaterial(t){t.repository&&t.repository!==this&&e.getLogger("esri.views.3d.webgl-engine.lib.GLMaterialRepository").error("Material is already owned by a different material repository"),t.repository=this}}class a{constructor(e){this.glMaterial=e,this._refCnt=0}ref(){++this._refCnt}unref(){--this._refCnt,i(this._refCnt>=0)}get referenced(){return this._refCnt>0}}export{s as GLMaterialRepository};
5
+ import e from"../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{NestedMap as r}from"../../../../core/NestedMap.js";import{GLMaterialParameters as i}from"./GLMaterialParameters.js";import{assert as s}from"./Util.js";class a{constructor(e,t,i,s){this._textures=e,this._techniques=t,this.materialChanged=i,this.requestRender=s,this._id2glMaterialRef=new r}dispose(){this._textures.destroy()}acquire(e,t,r){this._ownMaterial(e);const s=e.produces.get(t);if(!s?.(r))return null;let a=this._id2glMaterialRef.get(r,e.id);if(null==a){const t=e.createGLMaterial(new i(e,r,this._techniques,this._textures));a=new o(t),this._id2glMaterialRef.set(r,e.id,a)}return a.ref(),a.glMaterial}release(e,r){const i=this._id2glMaterialRef.get(r,e.id);null!=i&&(i.unref(),i.referenced||(t(i.glMaterial),this._id2glMaterialRef.delete(r,e.id)))}_ownMaterial(t){t.repository&&t.repository!==this&&e.getLogger("esri.views.3d.webgl-engine.lib.GLMaterialRepository").error("Material is already owned by a different material repository"),t.repository=this}}class o{constructor(e){this.glMaterial=e,this._refCnt=0}ref(){++this._refCnt}unref(){--this._refCnt,s(this._refCnt>=0)}get referenced(){return this._refCnt>0}}export{a as GLMaterialRepository};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as i}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as t}from"../../../webgl/RenderingContext.js";class a extends t{constructor(s,i){super(s,i),this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=i.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const i=Array.from(e).join("."),t=JSON.stringify(r),a=this._vaoCaches.get(i,t);if(a)return a;const o=new s(this,e,r);return this._vaoCaches.set(i,t,o),o}bindTechnique(e,r,s,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(r),s&&(e.program.bindPass(s,r),i&&e.program.bindDraw(r,s,i)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new i(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),r=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=r??!0}return this._isAssumedMetalDriver}get test(){}}export{a as RenderingContext};
5
+ import has from"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as s}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as r}from"./glUtil3D.js";import{VaoCache as i}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as a}from"../../../webgl/RenderingContext.js";class o extends a{constructor(i,t){super(i,t),this.emptyTexture=r(this),this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new s(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.emptyTexture.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,s){const r=Array.from(e).join("."),t=JSON.stringify(s),a=this._vaoCaches.get(r,t);if(a)return a;const o=new i(this,e,s);return this._vaoCaches.set(r,t,o),o}bindTechnique(e,s,r,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(s),r&&(e.program.bindPass(r,s),i&&e.program.bindDraw(s,r,i)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{o as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{textTextureAtlas as u}from"./testUtils.js";import{applyTextureResizeModuloCeil as m}from"./textureUtils.js";import{TaskPriority as p}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{TextureWrapMode as f,TextureSamplingMode as x}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";const T=4096;let k=class extends t{constructor(e){super(e),this.type=d.Texture,this.id=h(),this.events=new s,this._glTexture=null,this._atlas=new A(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view._stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get glTexture(){return this._glTexture}static get maxSize(){return j=u.stableRendering?R:0,[T-R-j,T-R-j-y]}load(e){if(this._glTexture)return this._glTexture;const t=new w;return t.wrapMode=f.CLAMP_TO_EDGE,t.samplingMode=x.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new v(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new C(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find((e=>r.width>=e.x+s));if(null==n){if(r.height<r.nextY+i)return!1;n=new C(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+R,n=r+R+y;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=m(Math.max(h,1.5*s.width),T);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=m(Math.max(e,1.5*s.height),T);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<T){const e=m(1.5*s.width,T);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-R,t[1]-R,s.renderedWidth+2*R,s.renderedHeight+2*R),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return g;for(;this._needsRepack&&(this._canRepack||this._atlas.height<T&&this._atlas.height<T);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new b(this._atlas,e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([n({constructOnly:!0})],k.prototype,"view",void 0),e([n({type:Boolean})],k.prototype,"updating",void 0),k=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],k);const R=2,y=2;class b{constructor(e,t){this._atlas=e,this.textRenderer=t,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset/this._atlas.width,(this._yOffset+t)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class A{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=j}}class C{constructor(e){this.y=e,this.x=j}}let j=0;export{k as TextTextureAtlas};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{textTextureAtlas as u}from"./testUtils.js";import{applyTextureResizeModuloCeil as m}from"./textureUtils.js";import{TaskPriority as p}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{TextureWrapMode as f,TextureSamplingMode as x}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";const T=4096;let k=class extends t{constructor(e){super(e),this.type=d.Texture,this.id=h(),this.events=new s,this._glTexture=null,this._atlas=new A(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view._stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return j=u.stableRendering?R:0,[T-R-j,T-R-j-y]}load(e){if(this._glTexture)return this._glTexture;const t=new w;return t.wrapMode=f.CLAMP_TO_EDGE,t.samplingMode=x.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new v(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new C(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find((e=>r.width>=e.x+s));if(null==n){if(r.height<r.nextY+i)return!1;n=new C(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+R,n=r+R+y;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=m(Math.max(h,1.5*s.width),T);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=m(Math.max(e,1.5*s.height),T);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<T){const e=m(1.5*s.width,T);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-R,t[1]-R,s.renderedWidth+2*R,s.renderedHeight+2*R),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return g;for(;this._needsRepack&&(this._canRepack||this._atlas.height<T&&this._atlas.height<T);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new b(this._atlas,e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([n({constructOnly:!0})],k.prototype,"view",void 0),e([n({type:Boolean})],k.prototype,"updating",void 0),k=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],k);const R=2,y=2;class b{constructor(e,t){this._atlas=e,this.textRenderer=t,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset/this._atlas.width,(this._yOffset+t)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class A{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=j}}class C{constructor(e){this.y=e,this.x=j}}let j=0;export{k as TextTextureAtlas};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import t from"../../../../core/Error.js";import e from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as c,createTextureBasis as u,estimateMemoryKTX2 as g,estimateMemoryBasis as A}from"./BasisUtil.js";import{ContentObject as E}from"./ContentObject.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as D}from"./textureUtils.js";import{assert as x}from"./Util.js";import{TextureWrapMode as y,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as U}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class N extends E{constructor(t,r){super(),this._data=t,this.type=T.Texture,this.events=new e,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this._parameters={...R,...r},this._startPreload(t)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(t){null!=t&&(t instanceof HTMLVideoElement?(this.frameUpdate=e=>this._frameUpdate(t,e),this._startPreloadVideoElement(t)):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){if(!(m(t.src)||"auto"===t.preload&&t.crossOrigin)){t.preload="auto",t.crossOrigin="anonymous";const e=!t.paused;if(t.src=t.src,e&&t.autoplay){const e=()=>{t.removeEventListener("canplay",e),t.play()};t.addEventListener("canplay",e)}}}_startPreloadImageElement(t){h(t.src)||m(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}_createDescriptor(t){const e=new C;return e.wrapMode=this._parameters.wrap??y.REPEAT,e.flipped=!this._parameters.noUnpackFlip,e.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,e.hasMipmap=!!this._parameters.mipmap,e.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,e.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?t.parameters.maxMaxAnisotropy:1),e}get glTexture(){return this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||w(this._data,this._parameters)}load(t){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const e=this._data;return null==e?(this._glTexture=new U(t,this._createDescriptor(t),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),"string"==typeof e?this._loadFromURL(t,e):e instanceof Image?this._loadFromImageElement(t,e):e instanceof HTMLVideoElement?this._loadFromVideoElement(t,e):e instanceof ImageData||e instanceof HTMLCanvasElement?this._loadFromImage(t,e):n(e)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(t,e):l(e)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(t,new Uint8Array(e)):(l(e)||n(e))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(t,e):(l(e)||n(e))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(t,e):n(e)?this._loadFromPixelData(t,e):l(e)?this._loadFromPixelData(t,new Uint8Array(e)):null)}_frameUpdate(t,e){return null==this._glTexture||t.readyState<M.HAVE_CURRENT_DATA||e===t.currentTime?e:(this._glTexture.setData(t),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),t.currentTime)}_loadFromDDSData(t,e){return this._glTexture=f(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>c(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>u(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){x(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new U(t,r,e),this._glTexture}_loadFromURL(t,e){return this._loadAsync((async r=>{const s=await _(e,{signal:r});return a(r),this._loadFromImage(t,s)}))}_loadFromImageElement(t,e){return e.complete?this._loadFromImage(t,e):this._loadAsync((async r=>{const s=await p(e,e.src,!1,r);return a(r),this._loadFromImage(t,s)}))}_loadFromVideoElement(t,e){return e.readyState>=M.HAVE_CURRENT_DATA?this._loadFromImage(t,e):this._loadFromVideoElementAsync(t,e)}_loadFromVideoElementAsync(e,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=M.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(e,r)))},_=e=>{m(),l(e||new t("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(t,e){let r=e;r instanceof HTMLVideoElement||(r=D(r,t.parameters));const s=H(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.shouldCompress=this._parameters.shouldCompress,this._glTexture=new U(t,a,r),this._glTexture}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const s=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),null!=this._loadingController){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function w(t,e){if(null==t)return 0;if(l(t)||n(t))return e.encoding===d.KTX2_ENCODING?g(t,!!e.mipmap):e.encoding===d.BASIS_ENCODING?A(t,!!e.mipmap):t.byteLength;const{width:r,height:s}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?H(t):e;return(e.mipmap?4/3:1)*r*s*(e.components||4)||0}function H(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}var M;!function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(M||(M={}));const R={wrap:{s:y.REPEAT,t:y.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,shouldCompress:!1};export{N as Texture};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as u,createTextureBasis as c,estimateMemoryKTX2 as g,estimateMemoryBasis as T}from"./BasisUtil.js";import{ContentObject as A}from"./ContentObject.js";import{ContentObjectType as E}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as D}from"./textureUtils.js";import{assert as x}from"./Util.js";import{TextureWrapMode as y,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as U}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class N extends A{constructor(e,r){super(),this._data=e,this.type=E.Texture,this.events=new t,this._parameters={...R,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(m(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){h(e.src)||m(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new C;return t.wrapMode=this._parameters.wrap??y.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||w(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new U(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<M.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>u(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>c(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){x(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new U(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return a(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await p(t,t.src,!1,r);return a(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=M.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=M.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},_=t=>{m(),l(t||new e("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=D(r,e.parameters));const s=H(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(e);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.shouldCompress=this._parameters.shouldCompress,this._glTexture=new U(e,a,r),this._emptyTexture=null,this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function w(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===d.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===d.BASIS_ENCODING?T(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?H(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function H(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}var M;!function(e){e[e.HAVE_NOTHING=0]="HAVE_NOTHING",e[e.HAVE_METADATA=1]="HAVE_METADATA",e[e.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",e[e.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",e[e.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(M||(M={}));const R={wrap:{s:y.REPEAT,t:y.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,shouldCompress:!1};export{N as Texture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as u}from"./basicInterfaces.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{isFrameUpdateTexture as l}from"./ITexture.js";import{TaskPriority as p}from"../../../support/Scheduler.js";let h=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new r,this._frameTask=e.view.resourceController.scheduler.registerTask(p.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(d.Texture,(e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach((t=>{const r=t.texture.frameUpdate(t.previousToken);r>=0&&r!==t.previousToken&&(t.previousToken=r,e=!0)})),e&&this.events.emit("changed",u.BACKGROUND)}_createNewRef(e){const t=this._stage.getObject(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(e)})),n=new c(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.glTexture?(this._updateGLTexture(n,t.glTexture),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const r=t.load(this._stage.renderView.renderingContext),a=r=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,r),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n),u=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(r)?r.then(a,u):a(r)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",u.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};e([n()],h.prototype,"_loadingCount",void 0),e([n()],h.prototype,"_frameTask",void 0),e([n()],h.prototype,"updating",null),h=e([a("esri.views.3d.webgl-engine.lib.TextureRepository")],h);class c{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{h as TextureRepository};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as u}from"./basicInterfaces.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{isFrameUpdateTexture as l}from"./ITexture.js";import{TaskPriority as p}from"../../../support/Scheduler.js";let h=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new r,this._frameTask=e.view.resourceController.scheduler.registerTask(p.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(d.Texture,(e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach((t=>{const r=t.texture.frameUpdate(t.previousToken);r>=0&&r!==t.previousToken&&(t.previousToken=r,e=!0)})),e&&this.events.emit("changed",u.BACKGROUND)}_createNewRef(e){const t=this._stage.getObject(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(e)})),n=new c(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.loaded?(this._updateGLTexture(n,t.glTexture),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const r=t.load(this._stage.renderView.renderingContext),a=r=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,r),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n),u=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(r)?r.then(a,u):a(r)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",u.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};e([n()],h.prototype,"_loadingCount",void 0),e([n()],h.prototype,"_frameTask",void 0),e([n()],h.prototype,"updating",null),h=e([a("esri.views.3d.webgl-engine.lib.TextureRepository")],h);class c{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{h as TextureRepository};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,i as r,c as t,n as i,d as s,l as a,h as o,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as l,create as u,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as S}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as M}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as C}from"../lib/Material.js";import{OITPolygonOffsetLimit as R}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as y}from"../lib/RayIntersections.js";import{RenderSlot as A}from"../lib/RenderSlot.js";import{VertexAttribute as I}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as P}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as j}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as L,DefaultMaterialPassParameters as N}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as V}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class z extends C{constructor(e,r){super(e,q),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.parameters.transparent],[A.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.parameters.transparent&&this.parameters.writeDepth],[A.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=k(this.parameters),this._configuration=new E(r.spherical)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(e.layerOpacity<B)return!1;const{hasInstancedColor:r,hasVertexColors:t,hasSymbolColors:i,vvColor:s}=e,a=r||s||i,o="replace"===e.colorMixMode,n=e.opacity>=B;if(t&&a)return o||n;const c=e.externalColor&&e.externalColor[3]>=B;return t?o?c:n:a?o||n:o?c:n}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,r){const t=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:a}=t;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!t.normalTextureId,this._configuration.hasColorTexture=!!t.textureId,this._configuration.hasVertexTangents=!i&&t.hasVertexTangents,this._configuration.instanced=t.isInstanced,this._configuration.instancedDoublePrecision=t.instancedDoublePrecision,this._configuration.vvSize=!!t.vvSize,this._configuration.hasVerticalOffset=null!=t.verticalOffset,this._configuration.hasScreenSizePerspective=null!=t.screenSizePerspective,this._configuration.hasSlicePlane=t.hasSlicePlane,this._configuration.alphaDiscardMode=t.textureAlphaMode,this._configuration.normalType=i?_.Attribute:t.normalType,this._configuration.transparent=t.transparent,this._configuration.writeDepth=t.writeDepth,null!=t.customDepthTest&&(this._configuration.customDepthTest=t.customDepthTest),this._configuration.hasOccludees=r.hasOccludees,this._configuration.cullFace=t.hasSlicePlane?M.None:t.cullFace,this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=t.modelTransformation,this._configuration.hasVertexColors=t.hasVertexColors,this._configuration.hasSymbolColors=t.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===a?b.View:s&&"winding-order"===a?b.WindingOrder:b.None,this._configuration.instancedColor=t.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=r.terrainDepthTest,this._configuration.receiveShadows=t.receiveShadows,this._configuration.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!t.vvColor,this._configuration.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,this._configuration.pbrMode=t.usePBR?t.isSchematic?S.Schematic:S.Normal:S.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!t.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=t.emissiveTextureId?v.Texture:t.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!t.occlusionTextureId,this._configuration.offsetBackfaces=!(!t.transparent||!t.offsetTransparentBackfaces),this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<R,this._configuration.snowCover=W(r),this._configuration.hasColorTextureTransform=!!t.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,l,u,h,m,p){if(null!=this.parameters.verticalOffset){const e=u.camera;r(Q,l[12],l[13],l[14]);let p=null;switch(u.viewingMode){case f.Global:p=i(Y,Q);break;case f.Local:p=t(Y,H)}let d=0;const g=s(K,Q,e.eye),T=a(g),x=o(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=D(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),o(p,p,d),c(J,p,u.transform.inverseRotation),h=s(F,h,J),m=s(G,m,J)}y(e,u,h,m,P(u.verticalOffset),p)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new j(this._vertexBufferLayout)}}class U extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const i=e.camera.viewInverseTransposeMatrix;return r(t.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?V:L,e)}}class q extends N{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function k(e){const r=m().vec3f(I.POSITION);e.normalType===_.Compressed?r.vec2i16(I.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(I.NORMAL),e.hasVertexTangents&&r.vec4f(I.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f(I.UV0),e.hasVertexColors&&r.vec4u8(I.COLOR),e.hasSymbolColors&&r.vec4u8(I.SYMBOLCOLOR),O()&&r.vec4u8(I.OBJECTANDLAYERIDCOLOR),r}const F=u(),G=u(),H=h(0,0,1),Y=u(),J=u(),Q=u(),K=u();export{U as DefaultGLMaterial,z as DefaultMaterial,q as DefaultMaterialParameters};
5
+ import{p as e,i as t,c as r,n as i,d as s,l as a,h as o,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as u,create as l,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as S}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as M}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as R}from"../lib/Material.js";import{OITPolygonOffsetLimit as A}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as y}from"../lib/RayIntersections.js";import{RenderSlot as I}from"../lib/RenderSlot.js";import{VertexAttribute as P}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as j}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as L,DefaultMaterialPassParameters as N}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as V}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class z extends R{constructor(e,t){super(e,q),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[I.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.parameters.transparent],[I.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.parameters.transparent&&this.parameters.writeDepth],[I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=k(this.parameters),this._configuration=new E(t.spherical)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t?1:i[3])>=B}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,u)}getConfiguration(e,t){const r=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:a}=r;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!r.normalTextureId,this._configuration.hasColorTexture=!!r.textureId,this._configuration.hasVertexTangents=!i&&r.hasVertexTangents,this._configuration.instanced=r.isInstanced,this._configuration.instancedDoublePrecision=r.instancedDoublePrecision,this._configuration.vvSize=!!r.vvSize,this._configuration.hasVerticalOffset=null!=r.verticalOffset,this._configuration.hasScreenSizePerspective=null!=r.screenSizePerspective,this._configuration.hasSlicePlane=r.hasSlicePlane,this._configuration.alphaDiscardMode=r.textureAlphaMode,this._configuration.normalType=i?_.Attribute:r.normalType,this._configuration.transparent=r.transparent,this._configuration.writeDepth=r.writeDepth,null!=r.customDepthTest&&(this._configuration.customDepthTest=r.customDepthTest),this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=r.hasSlicePlane?M.None:r.cullFace,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=r.modelTransformation,this._configuration.hasVertexColors=r.hasVertexColors,this._configuration.hasSymbolColors=r.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===a?b.View:s&&"winding-order"===a?b.WindingOrder:b.None,this._configuration.instancedColor=r.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.receiveShadows=r.receiveShadows,this._configuration.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!r.vvColor,this._configuration.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,this._configuration.pbrMode=r.usePBR?r.isSchematic?S.Schematic:S.Normal:S.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!r.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=r.emissiveTextureId?v.Texture:r.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!r.occlusionTextureId,this._configuration.offsetBackfaces=!(!r.transparent||!r.offsetTransparentBackfaces),this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<A,this._configuration.snowCover=W(t),this._configuration.hasColorTextureTransform=!!r.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,u,l,h,m,p){if(null!=this.parameters.verticalOffset){const e=l.camera;t(Q,u[12],u[13],u[14]);let p=null;switch(l.viewingMode){case f.Global:p=i(Y,Q);break;case f.Local:p=r(Y,H)}let d=0;const g=s(K,Q,e.eye),T=a(g),x=o(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=D(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),o(p,p,d),c(J,p,l.transform.inverseRotation),h=s(F,h,J),m=s(G,m,J)}y(e,l,h,m,j(l.verticalOffset),p)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new C(this._vertexBufferLayout)}}class U extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const i=e.camera.viewInverseTransposeMatrix;return t(r.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?V:L,e)}}class q extends N{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function k(e){const t=m().vec3f(P.POSITION);e.normalType===_.Compressed?t.vec2i16(P.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(P.NORMAL),e.hasVertexTangents&&t.vec4f(P.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(P.UV0),e.hasVertexColors&&t.vec4u8(P.COLOR),e.hasSymbolColors&&t.vec4u8(P.SYMBOLCOLOR),O()&&t.vec4u8(P.OBJECTANDLAYERIDCOLOR),t}const F=l(),G=l(),H=h(0,0,1),Y=l(),J=l(),Q=l(),K=l();export{U as DefaultGLMaterial,z as DefaultMaterial,q as DefaultMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import{GLTextureMaterial as s}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as h}from"./TriangleMaterial.js";import{writeBufferFloat as f,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as g,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as d}from"../shaders/ImageMaterialTechniqueConfiguration.js";class I extends h{constructor(e){super(e,b),this._configuration=new d,this.vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new _(e)}createBufferWriter(){const e=p.clone();return this.parameters.perspectiveInterpolation&&e.f32(l.PERSPECTIVEDIVIDE),new E(e)}}class _ extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(T,e)}}class E extends c{write(t,r,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=a.getField(n,e);t&&f(s,t,o)}else m(n,s,t,r,a,o)}return null}}class b extends a{constructor(e){super(),this.textureId=e,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.perspectiveInterpolation=!1}}export{I as ImageMaterial,b as Parameters};
5
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as o}from"../lib/Material.js";import{OITPolygonOffsetLimit as a}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as g,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as d}from"../shaders/ImageMaterialTechniqueConfiguration.js";class E extends f{constructor(e){super(e,A),this._configuration=new d,this.vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]])}dispose(){this.setParameters({texture:void 0})}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<a,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=p.clone();return this.parameters.perspectiveInterpolation&&e.f32(l.PERSPECTIVEDIVIDE),new b(e)}}class I extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.getTechnique(T,e)}}class b extends c{write(t,r,i,s,o,a){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=o.getField(n,e);t&&h(s,t,a)}else m(n,s,t,r,o,a)}return null}}class A extends o{constructor(e){super(),this.texture=e,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.perspectiveInterpolation=!1}get glTexture(){return this.texture.glTexture}}export{E as ImageMaterial,A as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../core/Accessor.js";import{createTask as r}from"../core/asyncUtils.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Error.js";import l from"../core/Evented.js";import p from"../core/Handles.js";import has from"../core/has.js";import h from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import m from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,whenOnce as f,when as w,sync as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import j from"../geometry/Extent.js";import T from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as F}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as k}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as b}from"../time/constants.js";import O from"../time/TimeExtent.js";import{isTimeZoneValid as L}from"../time/timeZoneUtils.js";import C from"./BasemapView.js";import Z from"./LayerViewManager.js";import I from"./Magnifier.js";import H from"./SelectionManager.js";import W from"./Theme.js";import{ToolViewManager as D}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as q}from"./3d/support/DefaultHighlights.js";import P from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import A from"./navigation/Navigation.js";import{DefaultsFromMap as z}from"./support/DefaultsFromMap.js";import G from"./support/HighlightOptions.js";import N from"./support/RequiredFieldsOptions.js";var $;let B=class extends(l.EventedMixin(m.EsriPromiseMixin(i))){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.handles=new p,this.updatingHandles=new S,this.allLayerViews=new a({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:Q}),this.groundView=null,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.analyses=new k,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new P,this.navigation=new A,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.persistableViewModels=new s,this.requiredFieldsOptions=new N,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g((()=>this.preconditionsReady),(e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask((()=>{this.fatalError=new n("startup-error",null,i)}))}null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach()}}),v))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then((()=>(this._isValid=!0,f((()=>this.ready)))))),this.basemapView=new C({view:this}),this.layerViewManager=new Z({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new D({view:this}),this.selectionManager=new H({view:this}),this.addHandles([w((()=>"map-content-error"===this.readyState&&!this.spatialReference),(()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),g((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),_),g((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),v),g((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),_)])}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new z({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??q()}set highlights(e){this._set("highlights",o(e,this._get("highlights"),s.ofType(G)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,i=this.map.basemap?.loaded??!0;return e&&i&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=r((e=>c(has("view-readyState-waiting-delay"),null,e))),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!F(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,L(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._cursor??"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new W}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(w((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new s}};e([M()],B.prototype,"_userSpatialReference",void 0),e([M()],B.prototype,"activeTool",null),e([M({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([M()],B.prototype,"groundView",void 0),e([M()],B.prototype,"animation",null),e([M()],B.prototype,"basemapView",void 0),e([M()],B.prototype,"center",null),e([M()],B.prototype,"defaultsFromMapSettings",null),e([M()],B.prototype,"defaultsFromMap",null),e([M()],B.prototype,"displayFilterEnabled",void 0),e([M()],B.prototype,"fatalError",void 0),e([M({type:j})],B.prototype,"extent",null),e([M(R(x,"graphics"))],B.prototype,"graphics",void 0),e([M(R(k,"analyses"))],B.prototype,"analyses",void 0),e([M({readOnly:!0,type:T})],B.prototype,"heightModelInfo",null),e([M({type:s.ofType(G)})],B.prototype,"highlights",null),e([M({readOnly:!0})],B.prototype,"interacting",null),e([M({readOnly:!0})],B.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([M({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:s,readOnly:!0})],B.prototype,"layerViews",void 0),e([M()],B.prototype,"resolution",null),e([M({type:I})],B.prototype,"magnifier",void 0),e([M({value:null,type:t})],B.prototype,"map",null),e([M()],B.prototype,"padding",void 0),e([M({readOnly:!0})],B.prototype,"ready",void 0),e([M()],B.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],B.prototype,"readyState",null),e([M({type:E})],B.prototype,"spatialReference",null),e([M()],B.prototype,"stationary",null),e([M({readOnly:!0})],B.prototype,"supportsGround",void 0),e([M({type:O})],B.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([M()],B.prototype,"tools",null),e([M()],B.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],B.prototype,"type",void 0),e([M({type:Number})],B.prototype,"scale",void 0),e([M({readOnly:!0})],B.prototype,"updating",void 0),e([M({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],B.prototype,"initialExtent",null),e([M()],B.prototype,"cursor",null),e([M({readOnly:!0})],B.prototype,"input",void 0),e([M({type:A,nonNullable:!0})],B.prototype,"navigation",void 0),e([M()],B.prototype,"layerViewManager",void 0),e([M()],B.prototype,"analysisViewManager",void 0),e([M()],B.prototype,"selectionManager",void 0),e([M()],B.prototype,"width",void 0),e([M()],B.prototype,"height",void 0),e([M({readOnly:!0})],B.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],B.prototype,"size",null),e([M({readOnly:!0})],B.prototype,"suspended",void 0),e([M({readOnly:!0})],B.prototype,"viewEvents",void 0),e([M({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([M()],B.prototype,"_isValid",void 0),e([M()],B.prototype,"_readyCycleForced",void 0),e([M()],B.prototype,"_lockedSpatialReference",void 0),e([M()],B.prototype,"_userTimeZone",void 0),e([M()],B.prototype,"_lockedTimeZone",void 0),e([M()],B.prototype,"_userTimeExtent",void 0),e([M()],B.prototype,"_lockedTimeExtent",void 0),e([M({type:W})],B.prototype,"theme",void 0),e([M({readOnly:!0,type:W})],B.prototype,"effectiveTheme",null),B=$=e([V("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../core/Accessor.js";import{createTask as r}from"../core/asyncUtils.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Error.js";import l from"../core/Evented.js";import p from"../core/Handles.js";import has from"../core/has.js";import h from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import m from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,whenOnce as f,when as w,sync as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import j from"../geometry/Extent.js";import T from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as F}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as k}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as b}from"../time/constants.js";import O from"../time/TimeExtent.js";import{isTimeZoneValid as L}from"../time/timeZoneUtils.js";import C from"./BasemapView.js";import Z from"./Magnifier.js";import I from"./SelectionManager.js";import H from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as D}from"./3d/support/DefaultHighlights.js";import q from"./input/Input.js";import{ViewEvents as P}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import{DefaultsFromMap as A}from"./support/DefaultsFromMap.js";import z from"./support/HighlightOptions.js";import G from"./support/LayerViewManager.js";import N from"./support/RequiredFieldsOptions.js";var $;let B=class extends(l.EventedMixin(m.EsriPromiseMixin(i))){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.handles=new p,this.updatingHandles=new S,this.allLayerViews=new a({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:Q}),this.groundView=null,this.basemapView=null,this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.analyses=new k,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new Z,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.supportsGround=!0,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new P(this),this.persistableViewModels=new s,this.requiredFieldsOptions=new N,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g((()=>this.preconditionsReady),(e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask((()=>{this.fatalError=new n("startup-error",null,i)}))}null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach()}}),v))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then((()=>(this._isValid=!0,f((()=>this.ready)))))),this.basemapView=new C({view:this}),this.layerViewManager=new G({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new W({view:this}),this.selectionManager=new I({view:this}),this.addHandles([w((()=>"map-content-error"===this.readyState&&!this.spatialReference),(()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),g((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),_),g((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),v),g((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),_)])}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new A({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??D()}set highlights(e){this._set("highlights",o(e,this._get("highlights"),s.ofType(z)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,i=this.map.basemap?.loaded??!0;return e&&i&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=r((e=>c(has("view-readyState-waiting-delay"),null,e))),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!F(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??b}set timeZone(e){this._userTimeZone=e,L(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._cursor??"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new H}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(w((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new s}};e([M()],B.prototype,"_userSpatialReference",void 0),e([M()],B.prototype,"activeTool",null),e([M({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([M()],B.prototype,"groundView",void 0),e([M()],B.prototype,"animation",null),e([M()],B.prototype,"basemapView",void 0),e([M()],B.prototype,"center",null),e([M()],B.prototype,"defaultsFromMapSettings",null),e([M()],B.prototype,"defaultsFromMap",null),e([M()],B.prototype,"displayFilterEnabled",void 0),e([M()],B.prototype,"fatalError",void 0),e([M({type:j})],B.prototype,"extent",null),e([M(R(x,"graphics"))],B.prototype,"graphics",void 0),e([M(R(k,"analyses"))],B.prototype,"analyses",void 0),e([M({readOnly:!0,type:T})],B.prototype,"heightModelInfo",null),e([M({type:s.ofType(z)})],B.prototype,"highlights",null),e([M({readOnly:!0})],B.prototype,"interacting",null),e([M({readOnly:!0})],B.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([M({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:s,readOnly:!0})],B.prototype,"layerViews",void 0),e([M()],B.prototype,"resolution",null),e([M({type:Z})],B.prototype,"magnifier",void 0),e([M({value:null,type:t})],B.prototype,"map",null),e([M()],B.prototype,"padding",void 0),e([M({readOnly:!0})],B.prototype,"ready",void 0),e([M()],B.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],B.prototype,"readyState",null),e([M({type:E})],B.prototype,"spatialReference",null),e([M()],B.prototype,"stationary",null),e([M({readOnly:!0})],B.prototype,"supportsGround",void 0),e([M({type:O})],B.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([M()],B.prototype,"tools",null),e([M()],B.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],B.prototype,"type",void 0),e([M({type:Number})],B.prototype,"scale",void 0),e([M({readOnly:!0})],B.prototype,"updating",void 0),e([M({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],B.prototype,"initialExtent",null),e([M()],B.prototype,"cursor",null),e([M({readOnly:!0})],B.prototype,"input",void 0),e([M({type:U,nonNullable:!0})],B.prototype,"navigation",void 0),e([M()],B.prototype,"layerViewManager",void 0),e([M()],B.prototype,"analysisViewManager",void 0),e([M()],B.prototype,"selectionManager",void 0),e([M()],B.prototype,"width",void 0),e([M()],B.prototype,"height",void 0),e([M({readOnly:!0})],B.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],B.prototype,"size",null),e([M({readOnly:!0})],B.prototype,"suspended",void 0),e([M({readOnly:!0})],B.prototype,"viewEvents",void 0),e([M({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([M()],B.prototype,"_isValid",void 0),e([M()],B.prototype,"_readyCycleForced",void 0),e([M()],B.prototype,"_lockedSpatialReference",void 0),e([M()],B.prototype,"_userTimeZone",void 0),e([M()],B.prototype,"_lockedTimeZone",void 0),e([M()],B.prototype,"_userTimeExtent",void 0),e([M()],B.prototype,"_lockedTimeExtent",void 0),e([M({type:H})],B.prototype,"theme",void 0),e([M({readOnly:!0,type:H})],B.prototype,"effectiveTheme",null),B=$=e([V("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{tBaseLine as o,tPanion as e,dtPanion as n,ddtPanion as a,tAscensionZoomOnly as t,tAscensionZoomPan as c,dtAscensionZoomOnly as s,dtAscensionZoomPan as r,ddtAscensionZoomOnly as i,ddtAscensionZoomPan as m,tDescensionZoomOnly as u,tDescensionZoomPan as l,dtDescensionZoomOnly as d,dtDescensionZoomPan as p,ddtDescensionZoomOnly as x,ddtDescensionZoomPan as F}from"./functions.js";function f(f,Z){let b=D(f,Z);const h={ascensionFactor:null!=Z.ascensionFactor?Z.ascensionFactor:.5,descensionFactor:null!=Z.descensionFactor?Z.descensionFactor:.5},M=0===h.ascensionFactor,P=0===h.descensionFactor,g=M?t:c,k=M?s:r,N=M?i:m,j=P?u:l,w=P?d:p,z=P?x:F,A=o=>g(f,o,h)+e(f,o,h)+j(f,o,h),I=o=>k(f,o,h)+n(f,o,h)+w(f,o,h),S=o=>N(f,o,h)+a(f,o,h)+z(f,o,h);let q=A(b);const v=o(f);let y;const B=Z.maximumIterations||20,C=null!=Z.maximumDistance?Z.maximumDistance:1/0;for(y=0;y<B;y++){const o=Z.desiredSlope??1e-6;let e=I(b);Math.abs(e)>o&&(e+=o);const n=e/S(b);if(isNaN(n)||b>=C&&n<0){if(!isFinite(C))return null;b=C,q=A(b);break}if(b-=n,b<f.compared.sourceZoom||b<f.compared.targetZoom)return null;const a=A(b);if(Math.abs(a-q)/q<=.005)break;q=a}return q>v*(1-.3)||b<f.compared.sourceZoom||b<f.compared.targetZoom?null:b}function D(o,e){const n=Math.max(o.compared.sourceZoom,o.compared.targetZoom),a=o.source.zoomAtPixelsPerPan(o.desiredPixelFlow/o.compared.pan)/2;return a<n?null!=e.maximumDistance?n+(e.maximumDistance-n)/2:1.5*n:e.maximumDistance?Math.min(e.maximumDistance,a):a}export{f as optimalDistance};
5
+ import{tBaseLine as o,tPanion as e,dtPanion as n,ddtPanion as a,tAscensionZoomOnly as t,tAscensionZoomPan as s,dtAscensionZoomOnly as c,dtAscensionZoomPan as i,ddtAscensionZoomOnly as r,ddtAscensionZoomPan as m,tDescensionZoomOnly as u,tDescensionZoomPan as l,dtDescensionZoomOnly as d,dtDescensionZoomPan as p,ddtDescensionZoomOnly as x,ddtDescensionZoomPan as F}from"./functions.js";function f(f,Z){let b=D(f,Z);const h={ascensionFactor:null!=Z.ascensionFactor?Z.ascensionFactor:.5,descensionFactor:null!=Z.descensionFactor?Z.descensionFactor:.5},M=0===h.ascensionFactor,N=0===h.descensionFactor,P=M?t:s,g=M?c:i,k=M?r:m,j=N?u:l,w=N?d:p,z=N?x:F,A=o=>P(f,o,h)+e(f,o,h)+j(f,o,h),I=o=>g(f,o,h)+n(f,o,h)+w(f,o,h),S=o=>k(f,o,h)+a(f,o,h)+z(f,o,h);let q=A(b);const v=o(f);let y;const B=Z.maximumIterations||20,C=null!=Z.maximumDistance?Z.maximumDistance:1/0;for(y=0;y<B;y++){const o=Z.desiredSlope??1e-6;let e=I(b);Math.abs(e)>o&&(e+=o);const n=e/S(b);if(isNaN(n)||b>=C&&n<0){if(!isFinite(C))return null;b=C,q=A(b);break}if(b-=n,b<=f.compared.sourceZoom||b<=f.compared.targetZoom)return null;const a=A(b);if(Math.abs(a-q)/q<=.005)break;q=a}const E=.3;return isNaN(q)||q>v*(1-E)||b<=f.compared.sourceZoom||b<=f.compared.targetZoom?null:b}function D(o,e){const n=Math.max(o.compared.sourceZoom,o.compared.targetZoom),a=o.source.zoomAtPixelsPerPan(o.desiredPixelFlow/o.compared.pan)/2;return a<n?null!=e.maximumDistance?n+(e.maximumDistance-n)/2:1.5*n:e.maximumDistance?Math.min(e.maximumDistance,a):a}export{f as optimalDistance};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../core/Error.js";import{removeMaybe as r}from"../../core/maybe.js";import{createResolver as t,onAbort as i,throwIfAborted as l,createAbortError as a}from"../../core/promiseUtils.js";import s from"../../layers/Layer.js";function o(e){return"tryRecycleWith"in e}class n{constructor(r,l,a){this.layer=r,this.view=l,this.layerViewImporter=a,this._controller=new AbortController,this._deferred=t(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,i(this._controller.signal,(()=>{const t=new e("cancelled:layerview-create","layerview creation cancelled",{layer:r});this._deferred.reject(t)}))}tryRecycle(e){if(!this.done||!this.layerView||!o(this.layerView))return null;const r=this.layer.type,t=this._controller.signal;for(let s=0;s<e.length;s++){const o=e[s];if(o.type!==r)continue;const n=this.layerView.tryRecycleWith(o,{signal:t});if(n){e.splice(s,1),this.layer=o;const r=this.layerView,t=r.view;return this.promise=Promise.race([n.then((()=>(l(this._controller.signal),o.emit("layerview-destroy",{view:t,layerView:r}),t.emit("layerview-destroy",{view:t,layerView:r}),o.emit("layerview-create",{view:t,layerView:r}),t.emit("layerview-create",{view:t,layerView:r}),r))),new Promise(((e,r)=>i(this._controller.signal,(()=>r(a())))))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:r,view:t}=this;r.emit("layerview-destroy",{view:t,layerView:e}),t.emit("layerview-destroy",{layer:r,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){if(this._started)return;this._started=!0;const{_controller:{signal:t},layer:a,view:s}=this;this._map=s.map;try{let n,w;if(await a.load({signal:t}),a.prefetchResources&&await a.prefetchResources({signal:t}),y(a))n=await a.createLayerView(s,{signal:t});else{if(!this.layerViewImporter.hasLayerViewModule(a))throw new e("layer:view-not-supported","No layerview implementation was found");const r=await this.layerViewImporter.importLayerView(a);l(t),n="default"in r?new r.default({layer:a,view:s}):new r({layer:a,view:s})}const c=()=>{w=r(w),n.destroyed||n.destroy(),n.layer=null,n.parent=null,n.view=null,this.done=!0};w=i(t,c),l(t);try{await n.when()}catch(o){throw c(),o}const h=this._map?.allLayers?.includes(a);if(!h)return c(),void this._deferred.reject(new e("view:no-layerview-for-layer","The layer has been removed from the map",{layer:a}));this.layerView=n,a.emit("layerview-create",{view:s,layerView:n}),s.emit("layerview-create",{layer:a,layerView:n}),this.done=!0,this._deferred.resolve(n)}catch(o){a.emit("layerview-create-error",{view:s,error:o}),s.emit("layerview-create-error",{layer:a,error:o}),this.done=!0,this._deferred.reject(new e("layerview:create-error","layerview creation failed",{layer:a,error:o}))}}}function y(e){return e.createLayerView!==s.prototype.createLayerView}export{n as LayerLayerViewInfo};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createResolver as o,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as h,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as p}from"../../core/scheduling.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as m}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(p(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(w(this,a));for(const[a,n]of this._layerLayerViewInfoMap)if(!r.has(a)){this._layerLayerViewInfoMap.delete(n.layer);const e=n.tryRecycle(i);e?(this.notifyChange("updating"),this._recyclingInfoMap.set(n.layer,n),e.then((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),this._layerLayerViewInfoMap.set(n.layer,n),this._reschedule()})).catch((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy(),this._reschedule()}))):n.destroy()}for(const[a,n]of this._recyclingInfoMap)r.has(a)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy());for(const a of i)this._createLayerView(a);this._refreshCollections();const o=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&o.push(e.layers))),this.addHandles(o.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([l((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),h((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),y)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),m(this._recyclingInfoMap),m(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(m(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some((e=>this.isCreatingLayerViewsForLayer(e,t)))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const o=e.layerView;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&g(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),t+=1}t<r.length&&r.splice(t,r.length)}_createLayerView(e){e.load().catch((()=>{})),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);r.promise.then((()=>this._refreshCollections()),(r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()})),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],_.prototype,"_workPromise",void 0),e([c({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],_.prototype,"_layersToLayerViews",null),e([c({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([c()],_.prototype,"layerViewImporter",void 0),e([c()],_.prototype,"supportsGround",void 0),e([c({readOnly:!0})],_.prototype,"updating",null),e([c({readOnly:!0})],_.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{BufferObject as i}from"./BufferObject.js";import{webglDebugEnabled as r}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment as h,TextureType as n,FramebufferTarget as o,PixelFormat as c,PixelType as a,DepthStencilAttachment as _,Usage as f,BufferType as u,RenderbufferFormat as l}from"./enums.js";import{GLObjectType as T}from"./GLObjectType.js";import{Renderbuffer as d}from"./Renderbuffer.js";import{Texture as m}from"./Texture.js";const E=()=>t.getLogger("esri.views.webgl.FramebufferObject");class x{constructor(t,e,i=null){this._context=t,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,t.instanceCounter.increment(s.FramebufferObject,this);const r=p(e)?e:new m(this._context,e);if(this._colorAttachments.set(h.COLOR_ATTACHMENT0,r),this._validateTextureDescriptor(r.descriptor),this._validateColorAttachmentPoint(h.COLOR_ATTACHMENT0),null!=i)if(g(i))this._depthStencilTexture=p(i)?i:new m(this._context,i),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=A(i)?i:new d(this._context,i);this._depthStencilBuffer=t,this._validateRenderBufferDescriptor(t.descriptor)}}dispose(){if(0===this._colorAttachments.size&&!this._glName)return;const t=this._context.getBoundFramebufferObject();if(this._colorAttachments.forEach(((t,e)=>this.detachColorTexture(e)?.dispose())),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(h.COLOR_ATTACHMENT0)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const t=this._colorAttachments.get(h.COLOR_ATTACHMENT0);return t?.descriptor?.width??0}get height(){const t=this._colorAttachments.get(h.COLOR_ATTACHMENT0);return t?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+i.usedMemory),this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&p(e)?e:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(t,e=h.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);const i=t.descriptor;this._validateTextureDescriptor(i),this.detachColorTexture(e)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=h.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(e){if(this._initialized){const e=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t),this._context.bindFramebuffer(e)}return this._colorAttachments.delete(t),e}}setColorTextureTarget(t,e=h.COLOR_ATTACHMENT0,i=0){const r=this._colorAttachments.get(e);r&&(t===n.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(r.glName,e,o.FRAMEBUFFER,0,i):this._framebufferTexture2D(r.glName,e,t,o.FRAMEBUFFER,0))}attachDepthStencil(t){if(t)switch(t.type){case T.Texture:return this._attachDepthStencilTexture(t);case T.RenderBuffer:return this._attachDepthStencilBuffer(t)}}_attachDepthStencilTexture(t){if(null==t)return;const e=t.descriptor;e.pixelFormat!==c.DEPTH_STENCIL&&e.pixelFormat!==c.DEPTH24_STENCIL8&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==a.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._validateTextureDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,_)),this._depthStencilTexture?.dispose(),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;if(t&&this._initialized){const t=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,_),this._context.bindFramebuffer(t)}return this._depthStencilTexture=null,t}_attachDepthStencilBuffer(t){if(null==t)return;const e=t.descriptor;if(this._validateRenderBufferDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(e);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,t.glName)}this._depthStencilBuffer=t}detachDepthStencilBuffer(){const t=this._depthStencilBuffer;if(t&&this._initialized){const e=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(t.descriptor);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,null),this._context.bindFramebuffer(e)}return this._depthStencilBuffer=null,t}copyToTexture(t,e,i,r,s,h,o){(t<0||e<0||s<0||h<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=o.descriptor;o.descriptor.target!==n.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(null==c?.width||null==c?.height||t+i>this.width||e+r>this.height||s+i>c.width||h+r>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const a=this._context,_=a.bindTexture(o,m.TEXTURE_UNIT_FOR_UPDATES);a.setActiveTexture(m.TEXTURE_UNIT_FOR_UPDATES),a.bindFramebuffer(this),a.gl.copyTexSubImage2D(n.TEXTURE_2D,0,s,h,t,e,i,r),a.bindTexture(_,m.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,s,h,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(t,e,i,r,s,h,n)}async readPixelsAsync(t,e,r,s,h,n,o){const{gl:c}=this._context,a=i.createPixelPack(this._context,f.STREAM_READ,o.byteLength);this._context.bindBuffer(a);const _=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(t,e,r,s,h,n,0),this._context.unbindBuffer(u.PIXEL_PACK_BUFFER),this._context.bindFramebuffer(_),await a.getSubDataAsync(o),a.dispose()}resize(t,e){if(this.width===t&&this.height===e)return;const i={width:t,height:e};b(i,this._context.parameters.maxTextureSize),this._colorAttachments.forEach((t=>t.resize(i.width,i.height))),this._depthStencilTexture?.resize(i.width,i.height),this._initialized&&(b(i,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(i.width,i.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(t=o.FRAMEBUFFER){const e=this._context.gl;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const i=e.createFramebuffer();if(e.bindFramebuffer(t,i),this._colorAttachments.forEach(((e,i)=>this._framebufferTexture2D(e.glName,i,R(e),t))),this._depthStencilBuffer){const i=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(t,i,e.RENDERBUFFER,this._depthStencilBuffer.glName)}else this._depthStencilTexture&&this._framebufferTexture2D(this._depthStencilTexture.glName,e.DEPTH_STENCIL_ATTACHMENT,R(this._depthStencilTexture),t);if(r()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=i,this._initialized=!0}_framebufferTexture2D(t,e=h.COLOR_ATTACHMENT0,i=n.TEXTURE_2D,r=o.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(r,e,i,t,s)}_framebufferTextureLayer(t,e=h.COLOR_ATTACHMENT0,i=o.FRAMEBUFFER,r=0,s=0){this._context.gl.framebufferTextureLayer(i,e,t,r,s)}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const e=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(o.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthStencilBuffer=e(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture=e(this._depthStencilTexture))}_validateTextureDescriptor(t){t.target!==n.TEXTURE_2D&&t.target!==n.TEXTURE_CUBE_MAP&&t.target!==n.TEXTURE_2D_ARRAY&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),b(t,this._context.parameters.maxTextureSize),this._validateBufferDimensions(t)}_validateRenderBufferDescriptor(t){b(t,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(t)}_validateBufferDimensions(t){t.width<=0&&(t.width=this.width),t.height<=0&&(t.height=this.height),this.width>0&&this.height>0&&(this.width===t.width&&this.height===t.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(t){switch(t.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return this._context.gl.DEPTH_ATTACHMENT;case l.DEPTH24_STENCIL8:case l.DEPTH32F_STENCIL8:case l.DEPTH_STENCIL:return this._context.gl.DEPTH_STENCIL_ATTACHMENT;case l.STENCIL_INDEX8:return this._context.gl.STENCIL_ATTACHMENT}}_validateColorAttachmentPoint(e){if(-1===x._MAX_COLOR_ATTACHMENTS){const{gl:t}=this._context;x._MAX_COLOR_ATTACHMENTS=t.getParameter(t.MAX_COLOR_ATTACHMENTS)}const i=e-h.COLOR_ATTACHMENT0;i+1>x._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${x._MAX_COLOR_ATTACHMENTS} color attachments`)}}function p(t){return null!=t&&"type"in t&&t.type===T.Texture}function A(t){return null!=t&&"type"in t&&t.type===T.RenderBuffer}function g(t){return p(t)||null!=t&&"pixelFormat"in t}function b(t,e){const i=Math.max(t.width,t.height);if(i>e){E().warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const r=e/i;return t.width=Math.round(t.width*r),t.height=Math.round(t.height*r),!1}return!0}function R(t){return t.descriptor.target===n.TEXTURE_CUBE_MAP?n.TEXTURE_CUBE_MAP_POSITIVE_X:t.descriptor.target===n.TEXTURE_2D_ARRAY?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}export{x as FramebufferObject,b as ensureAttachmentMaxSize};
5
+ import"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{BufferObject as i}from"./BufferObject.js";import{webglDebugEnabled as r}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment as h,TextureType as n,FramebufferTarget as o,PixelFormat as c,PixelType as a,DepthStencilAttachment as _,Usage as f,BufferType as u,RenderbufferFormat as l}from"./enums.js";import{GLObjectType as T}from"./GLObjectType.js";import{Renderbuffer as d}from"./Renderbuffer.js";import{Texture as m}from"./Texture.js";const E=()=>t.getLogger("esri.views.webgl.FramebufferObject");class x{constructor(t,e,i=null){this._context=t,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,t.instanceCounter.increment(s.FramebufferObject,this);const r=p(e)?e:new m(this._context,e);if(this._colorAttachments.set(h.COLOR_ATTACHMENT0,r),this._validateTextureDescriptor(r.descriptor),this._validateColorAttachmentPoint(h.COLOR_ATTACHMENT0),null!=i)if(g(i))this._depthStencilTexture=p(i)?i:new m(this._context,i),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=A(i)?i:new d(this._context,i);this._depthStencilBuffer=t,this._validateRenderBufferDescriptor(t.descriptor)}}dispose(){if(0===this._colorAttachments.size&&!this._glName)return;const t=this._context.getBoundFramebufferObject();if(this._colorAttachments.forEach(((t,e)=>this.detachColorTexture(e)?.dispose())),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(h.COLOR_ATTACHMENT0)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const t=this._colorAttachments.get(h.COLOR_ATTACHMENT0);return t?.descriptor?.width??0}get height(){const t=this._colorAttachments.get(h.COLOR_ATTACHMENT0);return t?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+i.usedMemory),this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&p(e)?e:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(t,e=h.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);const i=t.descriptor;this._validateTextureDescriptor(i),this.detachColorTexture(e)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=h.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(e){if(this._initialized){const e=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t),this._context.bindFramebuffer(e)}return this._colorAttachments.delete(t),e}}setColorTextureTarget(t,e=h.COLOR_ATTACHMENT0,i=0){const r=this._colorAttachments.get(e);r&&(t===n.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(r.glName,e,o.FRAMEBUFFER,0,i):this._framebufferTexture2D(r.glName,e,t,o.FRAMEBUFFER,0))}attachDepthStencil(t){if(t)switch(t.type){case T.Texture:return this._attachDepthStencilTexture(t);case T.RenderBuffer:return this._attachDepthStencilBuffer(t)}}_attachDepthStencilTexture(t){if(null==t)return;const e=t.descriptor;e.pixelFormat!==c.DEPTH_STENCIL&&e.pixelFormat!==c.DEPTH24_STENCIL8&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==a.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._validateTextureDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,_)),this._depthStencilTexture?.dispose(),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;if(t&&this._initialized){const t=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,_),this._context.bindFramebuffer(t)}return this._depthStencilTexture=null,t}_attachDepthStencilBuffer(t){if(null==t)return;const e=t.descriptor;if(this._validateRenderBufferDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(e);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,t.glName)}this._depthStencilBuffer=t}detachDepthStencilBuffer(){const t=this._depthStencilBuffer;if(t&&this._initialized){const e=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(t.descriptor);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,null),this._context.bindFramebuffer(e)}return this._depthStencilBuffer=null,t}copyToTexture(t,e,i,r,s,h,o){(t<0||e<0||s<0||h<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=o.descriptor;o.descriptor.target!==n.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(null==c?.width||null==c?.height||t+i>this.width||e+r>this.height||s+i>c.width||h+r>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const a=this._context,_=a.bindTexture(o,m.TEXTURE_UNIT_FOR_UPDATES);a.setActiveTexture(m.TEXTURE_UNIT_FOR_UPDATES),a.bindFramebuffer(this),a.gl.copyTexSubImage2D(n.TEXTURE_2D,0,s,h,t,e,i,r),a.bindTexture(_,m.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,s,h,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(t,e,i,r,s,h,n)}async readPixelsAsync(t,e,r,s,h,n,o){const{gl:c}=this._context,a=i.createPixelPack(this._context,f.STREAM_READ,o.byteLength);this._context.bindBuffer(a);const _=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(t,e,r,s,h,n,0),this._context.unbindBuffer(u.PIXEL_PACK_BUFFER),this._context.bindFramebuffer(_),await a.getSubDataAsync(o),a.dispose()}resize(t,e){if(this.width===t&&this.height===e)return;const i={width:t,height:e};b(i,this._context.parameters.maxTextureSize),this._colorAttachments.forEach((t=>t.resize(i.width,i.height))),this._depthStencilTexture?.resize(i.width,i.height),this._initialized&&(b(i,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(i.width,i.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(t=o.FRAMEBUFFER){const e=this._context.gl;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const i=e.createFramebuffer();if(e.bindFramebuffer(t,i),this._colorAttachments.forEach(((e,i)=>{const r=R(e);r===n.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(e.glName,i,t,0,0):this._framebufferTexture2D(e.glName,i,r,t)})),this._depthStencilBuffer){const i=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(t,i,e.RENDERBUFFER,this._depthStencilBuffer.glName)}else this._depthStencilTexture&&this._framebufferTexture2D(this._depthStencilTexture.glName,e.DEPTH_STENCIL_ATTACHMENT,R(this._depthStencilTexture),t);if(r()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=i,this._initialized=!0}_framebufferTexture2D(t,e=h.COLOR_ATTACHMENT0,i=n.TEXTURE_2D,r=o.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(r,e,i,t,s)}_framebufferTextureLayer(t,e=h.COLOR_ATTACHMENT0,i=o.FRAMEBUFFER,r=0,s=0){this._context.gl.framebufferTextureLayer(i,e,t,r,s)}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const e=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(o.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthStencilBuffer=e(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture=e(this._depthStencilTexture))}_validateTextureDescriptor(t){t.target!==n.TEXTURE_2D&&t.target!==n.TEXTURE_CUBE_MAP&&t.target!==n.TEXTURE_2D_ARRAY&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),b(t,this._context.parameters.maxTextureSize),this._validateBufferDimensions(t)}_validateRenderBufferDescriptor(t){b(t,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(t)}_validateBufferDimensions(t){t.width<=0&&(t.width=this.width),t.height<=0&&(t.height=this.height),this.width>0&&this.height>0&&(this.width===t.width&&this.height===t.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(t){switch(t.internalFormat){case l.DEPTH_COMPONENT16:case l.DEPTH_COMPONENT24:case l.DEPTH_COMPONENT32F:return this._context.gl.DEPTH_ATTACHMENT;case l.DEPTH24_STENCIL8:case l.DEPTH32F_STENCIL8:case l.DEPTH_STENCIL:return this._context.gl.DEPTH_STENCIL_ATTACHMENT;case l.STENCIL_INDEX8:return this._context.gl.STENCIL_ATTACHMENT}}_validateColorAttachmentPoint(e){if(-1===x._MAX_COLOR_ATTACHMENTS){const{gl:t}=this._context;x._MAX_COLOR_ATTACHMENTS=t.getParameter(t.MAX_COLOR_ATTACHMENTS)}const i=e-h.COLOR_ATTACHMENT0;i+1>x._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${x._MAX_COLOR_ATTACHMENTS} color attachments`)}}function p(t){return null!=t&&"type"in t&&t.type===T.Texture}function A(t){return null!=t&&"type"in t&&t.type===T.RenderBuffer}function g(t){return p(t)||null!=t&&"pixelFormat"in t}function b(t,e){const i=Math.max(t.width,t.height);if(i>e){E().warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const r=e/i;return t.width=Math.round(t.width*r),t.height=Math.round(t.height*r),!1}return!0}function R(t){return t.descriptor.target===n.TEXTURE_CUBE_MAP?n.TEXTURE_CUBE_MAP_POSITIVE_X:t.descriptor.target===n.TEXTURE_2D_ARRAY?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}export{x as FramebufferObject,b as ensureAttachmentMaxSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{TextureType as t,PixelFormat as i,PixelType as h,TextureSamplingMode as s,TextureWrapMode as a}from"./enums.js";import{getBytesPerElementFormat as e}from"./Util.js";class p{constructor(e=0,p=e){this.width=e,this.height=p,this.target=t.TEXTURE_2D,this.pixelFormat=i.RGBA,this.dataType=h.UNSIGNED_BYTE,this.samplingMode=s.LINEAR,this.wrapMode=a.REPEAT,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.shouldCompress=!1,this.depth=1,this.isImmutable=!1}}function r(i){return i.width<=0||i.height<=0?0:Math.round(i.width*i.height*i.depth*(i.hasMipmap?4/3:1)*(null==i.internalFormat?4:e(i.internalFormat))*(i.target===t.TEXTURE_CUBE_MAP?6:1))}export{p as TextureDescriptor,r as estimateMemory};
5
+ import{TextureType as t,PixelFormat as i,PixelType as h,TextureSamplingMode as s,TextureWrapMode as e}from"./enums.js";import{getBytesPerElementFormat as p}from"./Util.js";class a{constructor(p=0,a=p){this.width=p,this.height=a,this.target=t.TEXTURE_2D,this.pixelFormat=i.RGBA,this.dataType=h.UNSIGNED_BYTE,this.samplingMode=s.LINEAR,this.wrapMode=e.REPEAT,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.shouldCompress=!1,this.depth=1,this.isImmutable=!1}}function r(i){return i.width<=0||i.height<=0||i.depth<=0?0:Math.round(i.width*i.height*i.depth*(i.hasMipmap?4/3:1)*(null==i.internalFormat?4:p(i.internalFormat))*(i.target===t.TEXTURE_CUBE_MAP?6:1))}export{a as TextureDescriptor,r as estimateMemory};