@arcgis/core 4.33.0-next.20250403 → 4.33.0-next.20250405

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 (142) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{361a3253877acd3b4f07.js → 1014513c0ec85f9414a4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{18f8b41bd761e9ab60d0.js → 114599ed0752d9a70eef.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{30a047bd66f333bb7d2d.js → 1364744b15b327abd5a1.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{5beb525b4adde1d98532.js → 27b7ef3442700f6d6123.js} +84 -84
  7. package/assets/esri/core/workers/chunks/{628395830c78b95b46dc.js → 290aed587aa647226b46.js} +1 -1
  8. package/assets/esri/core/workers/chunks/358a3a9326615d5e6d3b.js +1 -0
  9. package/assets/esri/core/workers/chunks/35ab75010817f1525e54.js +1 -0
  10. package/assets/esri/core/workers/chunks/386ea90e87254b0282ec.js +1 -0
  11. package/assets/esri/core/workers/chunks/{2a654d8de99be40dd0e6.js → 3f6dc811b5d515c2725c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{8d421e0a01e2c3f6980c.js → 4275dcec730a11173661.js} +1 -1
  13. package/assets/esri/core/workers/chunks/43b19c58b2d16ae8e7cc.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ddfb5a2055a36576ba0d.js → 4523ba4a3c8987abca56.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{0b6ceb0194a07bbc3433.js → 4baef5262ce401bf81bb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{5660f479c005149bce8d.js → 4de3d692557120a4bbf7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{5e79642851e888eddfe4.js → 4e3b60156bee3b8b3367.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4dc135e0133d58a06d67.js → 519028f42b817d3e9933.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{1377ddd582518e5fa051.js → 60472225a228e499b1a2.js} +1 -1
  20. package/assets/esri/core/workers/chunks/61737e442b1f8e86164e.js +1 -0
  21. package/assets/esri/core/workers/chunks/69e606267dc5842ebf9d.js +1 -0
  22. package/assets/esri/core/workers/chunks/7099564a8853b81ba181.js +1 -0
  23. package/assets/esri/core/workers/chunks/{3db517369c5dd891a75f.js → 72f4cea853ce9fcf2cb6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/7ccc02a4ec6d3552ecca.js +1 -0
  25. package/assets/esri/core/workers/chunks/8221f2e540abe1e0f048.js +1 -0
  26. package/assets/esri/core/workers/chunks/8fecd1337d84c26c692b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{6280e1fe944ea4a71b91.js → 9643a9516783e8c32180.js} +1 -1
  28. package/assets/esri/core/workers/chunks/b06e3ba73f353592c81d.js +1 -0
  29. package/assets/esri/core/workers/chunks/c2d0fc13f4b746318a38.js +1 -0
  30. package/assets/esri/core/workers/chunks/{6ab96eaaad0aaad46db9.js → cc307d34a68e44e3cbc5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/d46c82a55219b27c301b.js +1 -0
  32. package/assets/esri/core/workers/chunks/{1df34b7fd68f5ab55bd3.js → d89f105b8a0b13dd8e5f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/eaead9e927ebadcf2cc3.js +1 -0
  34. package/assets/esri/core/workers/chunks/ed517687b3728fd2eb64.js +1 -0
  35. package/assets/esri/core/workers/chunks/f41a9ceb8e49baafe9fa.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e3b0bb6850d5252d5f24.js → f7d33d18bf1bd4db9df8.js} +1 -1
  37. package/assets/esri/themes/base/_core.scss +2 -0
  38. package/assets/esri/themes/base/widgets/_SelectionList.scss +61 -0
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList.json +1 -0
  43. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_en.json +1 -0
  44. package/core/MultiOriginJSONSupport.js +1 -1
  45. package/core/accessorSupport/DefaultsStore.js +1 -1
  46. package/core/accessorSupport/MultiOriginStore.js +1 -1
  47. package/core/accessorSupport/Properties.js +1 -1
  48. package/core/accessorSupport/Store.js +1 -1
  49. package/core/unitUtils.js +1 -1
  50. package/geometry/support/HalfFloatArray.js +1 -1
  51. package/geometry/support/buffer/BufferView.js +1 -1
  52. package/geometry/support/float16.js +5 -0
  53. package/interfaces.d.ts +630 -26
  54. package/layers/BuildingSceneLayer.js +1 -1
  55. package/layers/ParquetLayer.d.ts +4 -0
  56. package/layers/SceneLayer.js +1 -1
  57. package/layers/WMSLayer.js +1 -1
  58. package/layers/support/VideoElement.js +1 -1
  59. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  60. package/package.json +2 -2
  61. package/portal/schemas/definitions.js +1 -1
  62. package/smartMapping/statistics/types.d.ts +4 -0
  63. package/smartMapping/statistics/types.js +5 -0
  64. package/support/revision.js +1 -1
  65. package/versionManagement/VersioningState.js +1 -1
  66. package/views/2d/engine/Stage.js +1 -1
  67. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  68. package/views/2d/engine/webgl/Painter.js +1 -1
  69. package/views/2d/engine/webgl/effects/highlight/HighlightSurfaces.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  71. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  72. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  73. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  74. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  76. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  77. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  78. package/views/3d/terrain/support/MultiSizeFramebuffer.js +1 -1
  79. package/views/3d/webgl/formats.js +1 -1
  80. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  81. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +15 -15
  82. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +5 -5
  83. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  84. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  85. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  86. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  87. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  88. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  89. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  90. package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
  91. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  92. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  93. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  94. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  95. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  98. package/views/FocusAreas.js +1 -1
  99. package/views/SceneView.js +1 -1
  100. package/views/View.js +1 -1
  101. package/views/ViewAnimation.js +1 -1
  102. package/views/layers/ParquetLayerView.d.ts +4 -0
  103. package/views/support/TextureCompressionWorker.js +1 -1
  104. package/views/webgl/FramebufferObject.js +1 -1
  105. package/views/webgl/ShaderBuilder.js +1 -1
  106. package/views/webgl/Texture.js +1 -1
  107. package/views/webgl/Util.js +1 -1
  108. package/views/webgl/checkWebGLError.js +1 -1
  109. package/views/webgl/enums.js +1 -1
  110. package/views/webgl/textureUtils.js +1 -1
  111. package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
  112. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  113. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  114. package/widgets/FeatureTable.js +1 -1
  115. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  116. package/widgets/support/SelectionList/SelectionListFeatureItem.js +5 -0
  117. package/widgets/support/SelectionList/SelectionListGroupLayerItem.js +5 -0
  118. package/widgets/support/SelectionList/SelectionListItemBase.js +5 -0
  119. package/widgets/support/SelectionList/SelectionListLayerItem.js +5 -0
  120. package/widgets/support/SelectionList/SelectionListViewModel.js +5 -0
  121. package/widgets/support/SelectionList/VisibleElements.js +5 -0
  122. package/widgets/support/SelectionList/selectionListUtils.js +5 -0
  123. package/widgets/support/SelectionList.js +5 -0
  124. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  125. package/widgets/support/UtilityNetworkAssociations/utils/getFeatureTitle.js +1 -1
  126. package/widgets/support/iconUtils.js +1 -1
  127. package/assets/esri/core/workers/chunks/0cd5f15b8558b23e5fcd.js +0 -1
  128. package/assets/esri/core/workers/chunks/1d322685016263f86cf5.js +0 -1
  129. package/assets/esri/core/workers/chunks/2219d970ece5676ca6ee.js +0 -1
  130. package/assets/esri/core/workers/chunks/222446da9cb58c3c3b7e.js +0 -1
  131. package/assets/esri/core/workers/chunks/401ff3c83789c72e9ac9.js +0 -1
  132. package/assets/esri/core/workers/chunks/555c95b149e3a82a4460.js +0 -1
  133. package/assets/esri/core/workers/chunks/6828e4936db0121a9638.js +0 -1
  134. package/assets/esri/core/workers/chunks/6b0a6469673417563616.js +0 -1
  135. package/assets/esri/core/workers/chunks/6e679703b5d6fc1b91a5.js +0 -1
  136. package/assets/esri/core/workers/chunks/6f3731f19497cbc6ea74.js +0 -1
  137. package/assets/esri/core/workers/chunks/7649d59b0b7d53818a29.js +0 -1
  138. package/assets/esri/core/workers/chunks/7b8f0b63b968ff40d00d.js +0 -1
  139. package/assets/esri/core/workers/chunks/c977a47cabc419610277.js +0 -1
  140. package/assets/esri/core/workers/chunks/e8312c999b3f0c9ef09e.js +0 -1
  141. package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +0 -1
  142. package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +0 -1
@@ -2,18 +2,18 @@
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 e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as i}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as r}from"../../shaderModules/Float4sPassUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as v}from"../../shaderModules/FloatsPassUniform.js";import{glsl as l}from"../../shaderModules/glsl.js";import{VertexAttribute as s}from"../../../lib/VertexAttribute.js";import{vvColorNumber as c,VisualVariablePassParameters as p}from"../../../materials/VisualVariablePassParameters.js";const f=8;function n(e,p){e.attributes.add(s.POSITION,"vec3"),e.attributes.add(s.FEATUREVALUE,"vec3"),e.attributes.add(s.PROFILEVERTEXANDNORMAL,"vec4"),e.attributes.add(s.PROFILEAUXDATA,"vec3"),e.attributes.add(s.PROFILERIGHT,"vec2"),e.attributes.add(s.PROFILEUP,"vec2");const n=e.vertex;n.code.add(l`bool isCapVertex() {
5
+ import{fromValues as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as i}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as r}from"../../shaderModules/Float4sPassUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as v}from"../../shaderModules/FloatsPassUniform.js";import{glsl as l}from"../../shaderModules/glsl.js";import{VertexAttribute as s}from"../../../lib/VertexAttribute.js";import{vvColorNumber as c,VisualVariablePassParameters as p}from"../../../materials/VisualVariablePassParameters.js";const n=8;function f(e,p){const{attributes:f,vertex:d}=e;f.add(s.POSITION,"vec3"),f.add(s.PROFILEVERTEXANDNORMAL,"vec4"),f.add(s.PROFILEAUXDATA,"vec3"),f.add(s.PROFILERIGHT,"vec2"),f.add(s.PROFILEUP,"vec2"),d.code.add(l`bool isCapVertex() {
6
6
  return profileAuxData.z == 1.0;
7
- }`),n.uniforms.add(new o("size",(e=>e.size))),p.vvSize?(n.uniforms.add(new a("vvSizeMinSize",(e=>e.vvSize.minSize)),new a("vvSizeMaxSize",(e=>e.vvSize.maxSize)),new a("vvSizeOffset",(e=>e.vvSize.offset)),new a("vvSizeFactor",(e=>e.vvSize.factor)),new a("vvSizeFallback",(e=>e.vvSize.fallback))),n.code.add(l`vec2 getSize() {
8
- float value = featureValue.x;
7
+ }`),d.uniforms.add(new o("size",(e=>e.size)));const{vvSize:u,vvColor:m,vvOpacity:x}=p;u?(f.add(s.SIZEFEATUREATTRIBUTE,"float"),d.uniforms.add(new a("vvSizeMinSize",(e=>e.vvSize.minSize)),new a("vvSizeMaxSize",(e=>e.vvSize.maxSize)),new a("vvSizeOffset",(e=>e.vvSize.offset)),new a("vvSizeFactor",(e=>e.vvSize.factor)),new a("vvSizeFallback",(e=>e.vvSize.fallback))),d.code.add(l`vec2 getSize() {
8
+ float value = sizeFeatureAttribute;
9
9
  if (isnan(value)) {
10
10
  return vvSizeFallback.xz;
11
11
  }
12
12
  return size * clamp(vvSizeOffset + value * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz;
13
- }`)):n.code.add(l`vec2 getSize(){
13
+ }`)):d.code.add(l`vec2 getSize(){
14
14
  return size;
15
- }`),p.vvOpacity?(n.constants.add("vvOpacityNumber","int",f),n.uniforms.add(new v("vvOpacityValues",(e=>e.vvOpacity.values),f),new v("vvOpacityOpacities",(e=>e.vvOpacity.opacityValues),f),new t("vvOpacityFallback",(e=>e.vvOpacity.fallback))),n.code.add(l`vec4 applyOpacity(vec4 color) {
16
- float value = featureValue.z;
15
+ }`),x?(f.add(s.OPACITYFEATUREATTRIBUTE,"float"),d.constants.add("vvOpacityNumber","int",n),d.uniforms.add(new v("vvOpacityValues",(e=>e.vvOpacity.values),n),new v("vvOpacityOpacities",(e=>e.vvOpacity.opacityValues),n),new t("vvOpacityFallback",(e=>e.vvOpacity.fallback))),d.code.add(l`vec4 applyOpacity(vec4 color) {
16
+ float value = opacityFeatureAttribute;
17
17
  if (isnan(value)) {
18
18
  return vec4(color.rgb, vvOpacityFallback);
19
19
  }
@@ -27,10 +27,10 @@ return vec4( color.xyz, mix(vvOpacityOpacities[i-1], vvOpacityOpacities[i], f));
27
27
  }
28
28
  }
29
29
  return vec4( color.xyz, vvOpacityOpacities[vvOpacityNumber - 1]);
30
- }`)):n.code.add(l`vec4 applyOpacity(vec4 color){
30
+ }`)):d.code.add(l`vec4 applyOpacity(vec4 color){
31
31
  return color;
32
- }`),p.vvColor?(n.constants.add("vvColorNumber","int",c),n.uniforms.add(new v("vvColorValues",(e=>e.vvColor.values),c),new r("vvColorColors",(e=>e.vvColor.colors),c),new i("vvColorFallback",(e=>e.vvColor.fallback))),n.code.add(l`vec4 getColor() {
33
- float value = featureValue.y;
32
+ }`),m?(f.add(s.COLORFEATUREATTRIBUTE,"float"),d.constants.add("vvColorNumber","int",c),d.uniforms.add(new v("vvColorValues",(e=>e.vvColor.values),c),new r("vvColorColors",(e=>e.vvColor.colors),c),new i("vvColorFallback",(e=>e.vvColor.fallback))),d.code.add(l`vec4 getColor() {
33
+ float value = colorFeatureAttribute;
34
34
  if (isnan(value)) {
35
35
  return applyOpacity(vvColorFallback);
36
36
  }
@@ -44,9 +44,9 @@ return applyOpacity(mix(vvColorColors[i-1], vvColorColors[i], f));
44
44
  }
45
45
  }
46
46
  return applyOpacity(vvColorColors[vvColorNumber - 1]);
47
- }`)):n.code.add(l`vec4 getColor(){
47
+ }`)):d.code.add(l`vec4 getColor(){
48
48
  return applyOpacity(vec4(1, 1, 1, 1));
49
- }`),n.code.add(l`vec3 decompressAxis(vec2 axis) {
49
+ }`),d.code.add(l`vec3 decompressAxis(vec2 axis) {
50
50
  float z = 1.0 - abs(axis.x) - abs(axis.y);
51
51
  return normalize(vec3(axis + sign(axis) * min(z, 0.0), z));
52
52
  }
@@ -55,14 +55,14 @@ vec2 size = getSize();
55
55
  vec3 origin = position;
56
56
  vec3 right = decompressAxis(profileRight);
57
57
  vec3 up = decompressAxis(profileUp);
58
- vec2 profileVertex = profileVertexAndNormal.xy * size;`),n.code.add(l`if(isCapVertex()) {
58
+ vec2 profileVertex = profileVertexAndNormal.xy * size;`),d.code.add(l`if(isCapVertex()) {
59
59
  float positionOffsetAlongProfilePlaneNormal = profileAuxData.x * size[0];
60
60
  vec3 forward = cross(up, right);
61
61
  vec3 offset = right * profileVertex.x + up * profileVertex.y + forward * positionOffsetAlongProfilePlaneNormal;
62
62
  return origin + offset;
63
63
  }
64
64
  vec2 rotationRight = vec2(profileAuxData.x, profileAuxData.y);
65
- float maxDistance = length(rotationRight);`),n.code.add(l`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
65
+ float maxDistance = length(rotationRight);`),d.code.add(l`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
66
66
  float rx = dot(profileVertex, rotationRight);
67
67
  if (abs(rx) > maxDistance) {
68
68
  vec2 rotationUp = vec2(-rotationRight.y, rotationRight.x);
@@ -71,7 +71,7 @@ profileVertex = rotationRight * maxDistance * sign(rx) + rotationUp * ry;
71
71
  }
72
72
  vec3 offset = right * profileVertex.x + up * profileVertex.y;
73
73
  return origin + offset;
74
- }`),n.code.add(l`vec3 localNormal() {
74
+ }`),d.code.add(l`vec3 localNormal() {
75
75
  vec3 right = decompressAxis(profileRight);
76
76
  vec3 up = decompressAxis(profileUp);
77
77
  vec3 normal = right * profileVertexAndNormal.z + up * profileVertexAndNormal.w;
@@ -80,4 +80,4 @@ vec3 forward = cross(up, right);
80
80
  normal += forward * profileAuxData.y;
81
81
  }
82
82
  return normal;
83
- }`)}class u extends p{constructor(){super(...arguments),this.size=e(1,1)}}export{n as PathVertexPosition,u as PathVertexPositionPassParameters};
83
+ }`)}class d extends p{constructor(){super(...arguments),this.size=e(1,1)}}export{f as PathVertexPosition,d as PathVertexPositionPassParameters};
@@ -2,14 +2,14 @@
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{VisualVariables as i}from"../shading/VisualVariables.glsl.js";import{Float3PassUniform as t}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as e}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as a}from"../../shaderModules/FloatsPassUniform.js";import{glsl as v}from"../../shaderModules/glsl.js";import{VertexAttribute as r}from"../../../lib/VertexAttribute.js";const o=8;function c(c,l){const s=c.vertex;s.uniforms.add(new e("intrinsicWidth",(i=>i.width))),l.vvSize?(c.attributes.add(r.SIZEFEATUREATTRIBUTE,"float"),s.uniforms.add(new t("vvSizeMinSize",(i=>i.vvSize.minSize)),new t("vvSizeMaxSize",(i=>i.vvSize.maxSize)),new t("vvSizeOffset",(i=>i.vvSize.offset)),new t("vvSizeFactor",(i=>i.vvSize.factor)),new t("vvSizeFallback",(i=>i.vvSize.fallback))),s.code.add(v`float getSize() {
5
+ import{VisualVariables as i}from"../shading/VisualVariables.glsl.js";import{Float3PassUniform as e}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as a}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as t}from"../../shaderModules/FloatsPassUniform.js";import{glsl as v}from"../../shaderModules/glsl.js";import{VertexAttribute as r}from"../../../lib/VertexAttribute.js";const o=8;function c(c,l){const{vertex:s,attributes:n}=c;s.uniforms.add(new a("intrinsicWidth",(i=>i.width))),l.vvSize?(n.add(r.SIZEFEATUREATTRIBUTE,"float"),s.uniforms.add(new e("vvSizeMinSize",(i=>i.vvSize.minSize)),new e("vvSizeMaxSize",(i=>i.vvSize.maxSize)),new e("vvSizeOffset",(i=>i.vvSize.offset)),new e("vvSizeFactor",(i=>i.vvSize.factor)),new e("vvSizeFallback",(i=>i.vvSize.fallback))),s.code.add(v`float getSize() {
6
6
  if (isnan(sizeFeatureAttribute)) {
7
7
  return vvSizeFallback.x;
8
8
  }
9
9
  return intrinsicWidth * clamp(vvSizeOffset + sizeFeatureAttribute * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).x;
10
- }`)):(c.attributes.add(r.SIZE,"float"),s.code.add(v`float getSize(){
10
+ }`)):(n.add(r.SIZE,"float"),s.code.add(v`float getSize(){
11
11
  return intrinsicWidth * size;
12
- }`)),l.vvOpacity?(c.attributes.add(r.OPACITYFEATUREATTRIBUTE,"float"),s.constants.add("vvOpacityNumber","int",8),s.uniforms.add(new a("vvOpacityValues",(i=>i.vvOpacity.values),o),new a("vvOpacityOpacities",(i=>i.vvOpacity.opacityValues),o),new e("vvOpacityFallback",(i=>i.vvOpacity.fallback))),s.code.add(v`float interpolateOpacity(float value){
12
+ }`)),l.vvOpacity?(n.add(r.OPACITYFEATUREATTRIBUTE,"float"),s.constants.add("vvOpacityNumber","int",8),s.uniforms.add(new t("vvOpacityValues",(i=>i.vvOpacity.values),o),new t("vvOpacityOpacities",(i=>i.vvOpacity.opacityValues),o),new a("vvOpacityFallback",(i=>i.vvOpacity.fallback))),s.code.add(v`float interpolateOpacity(float value){
13
13
  if (isnan(value)) {
14
14
  return vvOpacityFallback;
15
15
  }
@@ -28,8 +28,8 @@ vec4 applyOpacity( vec4 color ){
28
28
  return vec4(color.xyz, interpolateOpacity(opacityFeatureAttribute));
29
29
  }`)):s.code.add(v`vec4 applyOpacity( vec4 color ){
30
30
  return color;
31
- }`),l.vvColor?(c.include(i,l),c.attributes.add(r.COLORFEATUREATTRIBUTE,"float"),s.code.add(v`vec4 getColor(){
31
+ }`),l.vvColor?(c.include(i,l),n.add(r.COLORFEATUREATTRIBUTE,"float"),s.code.add(v`vec4 getColor(){
32
32
  return applyOpacity(interpolateVVColor(colorFeatureAttribute));
33
- }`)):(c.attributes.add(r.COLOR,"vec4"),s.code.add(v`vec4 getColor(){
33
+ }`)):(n.add(r.COLOR,"vec4"),s.code.add(v`vec4 getColor(){
34
34
  return applyOpacity(color);
35
35
  }`))}export{c as RibbonVertexPosition};
@@ -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/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class o{constructor(e){this.context=e,this._debug=!1,this._precompiling=this._debug?0:1,this._cache=new t}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}get viewingMode(){return this.context.viewingMode}destroy(){this._cache.forAll((e=>e.destroy())),this._cache.clear()}precompile(e,t=c){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=c){const o=i.key.code;let r=this._cache.get(t,o);if(null==r){if(0===this._precompiling){let o=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${i.decode()}`;const r=this._cache.getInner(t);throw r?.size&&(o+="\n\n cached configurations:\n",o+=Array.from(r.values()).map((e=>i.decode(e.key))).sort().join("\n\n")),console.log(o),new e("shader",o)}r=new t(this.context,i),this._cache.set(t,o,r)}return r}async reloadAll(){const e=new Array;this._cache.forEach((t=>e.push(r(t)))),await Promise.all(e)}}async function r(e){let t=!0;e.forEach((async e=>{await e.reload(t),t=!1}))}const c=new i;export{c as NoConfiguration,o as ShaderTechniqueRepository};
5
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class o{constructor(e){this.context=e,this._debug=!1,this._precompiling=this._debug?0:1,this._cache=new t}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}get viewingMode(){return this.context.viewingMode}destroy(){this._cache.forAll((e=>e.destroy())),this._cache.clear()}precompile(e,t=r){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=r){const o=i.key.code;let c=this._cache.get(t,o);if(null==c){if(0===this._precompiling){let o=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${i.decode()}`;const c=this._cache.getInner(t);throw c?.size&&(o+="\n\n cached configurations:\n",o+=Array.from(c.values()).map((e=>i.decode(e.key))).sort().join("\n\n")),console.log(o),new e("shader:uncached-compile",o)}c=new t(this.context,i),this._cache.set(t,o,c)}return c}async reloadAll(){const e=new Array;this._cache.forEach((t=>e.push(c(t)))),await Promise.all(e)}}async function c(e){let t=!0;e.forEach((async e=>{await e.reload(t),t=!1}))}const r=new i;export{r as NoConfiguration,o as ShaderTechniqueRepository};
@@ -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{isFloat16Array as r,Float16Array as t}from"@petamoriken/float16";import{nativeArrayMaxSize as o,isUint16Array as a}from"../../../../core/typedArrayUtil.js";function e(e){if(e.length<o)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return r(e)?t.from(e):a(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}export{e as cloneAttributeData};
5
+ import{nativeArrayMaxSize as r,isFloat16Array as t,isUint16Array as o}from"../../../../core/typedArrayUtil.js";import{getFloat16ArrayConstructor as a}from"../../../../geometry/support/float16.js";function e(e){if(e.length<r)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return t(e)?a().from(e):o(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}export{e as cloneAttributeData};
@@ -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{copy as t,set as e,length as s,normalize as i,dot as o,scale as r,add as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,i as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as m}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{Attribute as f,Vertices as d}from"./Attribute.js";import{decompressNormal as b,compressNormal as A}from"./Normals.js";import{intersectTriangles as g}from"./RayIntersections.js";import{VertexAttribute as v}from"./VertexAttribute.js";class x{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class I extends x{constructor(t){super(t),this.color=p(255,255,255,255),this._size=n(),this.positions=m(3*this.builder.numVerticesTotal),this.normals=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.color[0]=255*t[0],this.color[1]=255*t[1],this.color[2]=255*t[2],this.color[3]=255*(t.length>3?t[3]:1)}bake(n){t(this._size,n);const{numVerticesTotal:c,pathVertexData:p,positions:m,profileRightAxes:u,profileUpAxes:f,profileVertexAndNormals:d,profileAuxData:g}=this.builder;for(let t=0;t<c;++t){let c=p[t];c*=3;const v=V;let x=0,I=0;const O=b(w,u,t),E=b(j,f,t),T=4*t,C=e(P,d[T]*n[0],d[T+1]*n[1]),N=3*t;if(1===g[N+2])h(v,E,O),x=g[N]*n[0],I=g[N+1];else{const t=D,n=R;e(t,g[N],g[N+1]);const h=s(t);i(t,t);const c=o(C,t);if(Math.abs(c)>h){e(n,-t[1],t[0]);const s=o(C,n);r(t,t,h*Math.sign(c)),r(n,n,s),a(C,t,n)}l(v,0,0,0)}const _=O[0]*C[0]+E[0]*C[1],y=O[1]*C[0]+E[1]*C[1],L=O[2]*C[0]+E[2]*C[1];this.positions[N]=m[c]+_+v[0]*x,this.positions[N+1]=m[c+1]+y+v[1]*x,this.positions[N+2]=m[c+2]+L+v[2]*x;const z=d[T+2],F=d[T+3];A(this.normals,t,O[0]*z+E[0]*F+v[0]*I,O[1]*z+E[1]*F+v[1]*I,O[2]*z+E[2]*F+v[2]*I)}}createGeometryData(){const t=this.builder.vertexIndices;return[[v.POSITION,new f(this.positions,t,3,!0)],[v.NORMALCOMPRESSED,new f(this.normals,t,2,!0)],[v.COLOR,new f(this.color,u(t.length),4,!0)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,s,i){const o=this.builder.vertexIndices,r=new d(this.positions,3),a=o.length/3;g(t,e,0,a,o,r,void 0,s,((t,e,s)=>i(t,s,e,!1)))}get size(){return this._size}}class O extends x{constructor(t,e,s,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=s,this.opacityAttributeValue=i,this.baked=new I(t),this._vvData=m(3*this.builder.path.vertices.length);for(let o=0;o<this._vvData.length;o+=3)this._vvData[o]=e,this._vvData[o+1]=s,this._vvData[o+2]=i}createGeometryData(){const t=this.builder,{pathVertexIndices:e,vertexIndices:s}=t;return[[v.POSITION,new f(t.positions,e,3,!0)],[v.FEATUREVALUE,new f(this._vvData,e,3,!0)],[v.PROFILEVERTEXANDNORMAL,new f(t.profileVertexAndNormals,s,4,!0)],[v.PROFILEAUXDATA,new f(t.profileAuxData,s,3,!0)],[v.PROFILERIGHT,new f(t.profileRightAxes,s,2,!0)],[v.PROFILEUP,new f(t.profileUpAxes,s,2,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(v.POSITION);e&&(e.data=this.builder.positions)}}const P=n(),D=n(),R=n(),V=c(),w=c(),j=c();export{O as FastUpdatePathGeometry,x as PathGeometryData,I as StaticPathGeometry};
5
+ import{copy as t,set as e,length as s,normalize as i,dot as r,scale as o,add as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as l,i as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as m}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as u}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as f}from"../../../../geometry/support/Indices.js";import{Attribute as d,Vertices as A}from"./Attribute.js";import{decompressNormal as b,compressNormal as g}from"./Normals.js";import{intersectTriangles as v}from"./RayIntersections.js";import{VertexAttribute as I}from"./VertexAttribute.js";class x{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class T extends x{constructor(t){super(t),this.color=p(255,255,255,255),this._size=a(),this.positions=m(3*this.builder.numVerticesTotal),this.normals=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.color[0]=255*t[0],this.color[1]=255*t[1],this.color[2]=255*t[2],this.color[3]=255*(t.length>3?t[3]:1)}bake(a){t(this._size,a);const{numVerticesTotal:c,pathVertexData:p,positions:m,profileRightAxes:u,profileUpAxes:f,profileVertexAndNormals:d,profileAuxData:A}=this.builder;for(let t=0;t<c;++t){let c=p[t];c*=3;const v=w;let I=0,x=0;const T=b(C,u,t),O=b(V,f,t),j=4*t,y=e(R,d[j]*a[0],d[j+1]*a[1]),U=3*t;if(1===A[U+2])l(v,O,T),I=A[U]*a[0],x=A[U+1];else{const t=E,a=P;e(t,A[U],A[U+1]);const l=s(t);i(t,t);const c=r(y,t);if(Math.abs(c)>l){e(a,-t[1],t[0]);const s=r(y,a);o(t,t,l*Math.sign(c)),o(a,a,s),n(y,t,a)}h(v,0,0,0)}const F=T[0]*y[0]+O[0]*y[1],N=T[1]*y[0]+O[1]*y[1],_=T[2]*y[0]+O[2]*y[1];this.positions[U]=m[c]+F+v[0]*I,this.positions[U+1]=m[c+1]+N+v[1]*I,this.positions[U+2]=m[c+2]+_+v[2]*I;const z=d[j+2],D=d[j+3];g(this.normals,t,T[0]*z+O[0]*D+v[0]*x,T[1]*z+O[1]*D+v[1]*x,T[2]*z+O[2]*D+v[2]*x)}}createGeometryData(){const t=this.builder.vertexIndices;return[[I.POSITION,new d(this.positions,t,3,!0)],[I.NORMALCOMPRESSED,new d(this.normals,t,2,!0)],[I.COLOR,new d(this.color,f(t.length),4,!0)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,s,i){const r=this.builder.vertexIndices,o=new A(this.positions,3),n=r.length/3;v(t,e,0,n,r,o,void 0,s,((t,e,s)=>i(t,s,e,!1)))}get size(){return this._size}}class O extends x{constructor(t,e,s,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=s,this.opacityAttributeValue=i,this.baked=new T(t),this._vvSize=m(this.builder.path.vertices.length).fill(e),this._vvColor=u(this.builder.path.vertices.length).fill(s),this._vvOpacity=u(this.builder.path.vertices.length).fill(i)}createGeometryData(){const t=this.builder,{pathVertexIndices:e,vertexIndices:s}=t;return[[I.POSITION,new d(t.positions,e,3,!0)],[I.PROFILEVERTEXANDNORMAL,new d(t.profileVertexAndNormals,s,4,!0)],[I.PROFILEAUXDATA,new d(t.profileAuxData,s,3,!0)],[I.PROFILERIGHT,new d(t.profileRightAxes,s,2,!0)],[I.PROFILEUP,new d(t.profileUpAxes,s,2,!0)],[I.SIZEFEATUREATTRIBUTE,new d(this._vvSize,e,1,!0)],[I.COLORFEATUREATTRIBUTE,new d(this._vvColor,e,1,!0)],[I.OPACITYFEATUREATTRIBUTE,new d(this._vvOpacity,e,1,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(I.POSITION);e&&(e.data=this.builder.positions)}}const R=a(),E=a(),P=a(),w=c(),C=c(),V=c();export{O as FastUpdatePathGeometry,x as PathGeometryData,T as StaticPathGeometry};
@@ -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 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 i,onAbort as a,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 p}from"../../../../support/requestImageUtils.js";import{loadImageAsync as d}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as _}from"./basicInterfaces.js";import{createTextureKTX2 as u,createTextureBasis as c,estimateMemoryKTX2 as g,estimateMemoryBasis as T}from"./BasisUtil.js";import{ContentObject as E}from"./ContentObject.js";import{ContentObjectType as x}from"./ContentObjectType.js";import{createDDSTexture as y}from"./DDSUtil.js";import{ensureImageMaxSize as f}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class L extends E{constructor(e,r){super(),this._data=e,this.type=x.Texture,this.events=new t,this._parameters={...P,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(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 w;return t.wrapMode=this._parameters.wrap??D.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||C(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 M(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===_.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===_.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===_.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===_.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.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=y(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){A(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 M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await p(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await d(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=f(r,e.parameters));const s=j(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,i.width=s.width,i.height=s.height,i.compressionHandle=this._parameters.compressionHandle,this._glTexture=new M(e,i,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 C(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===_.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===_.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?j(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function j(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const P={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{L 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 i,onAbort as a,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 p}from"../../../../support/requestImageUtils.js";import{loadImageAsync as d}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as _}from"./basicInterfaces.js";import{createTextureKTX2 as u,createTextureBasis as c,estimateMemoryKTX2 as g,estimateMemoryBasis as T}from"./BasisUtil.js";import{ContentObject as E}from"./ContentObject.js";import{ContentObjectType as x}from"./ContentObjectType.js";import{createDDSTexture as y}from"./DDSUtil.js";import{ensureImageMaxSize as f}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class L extends E{constructor(e,r){super(),this._data=e,this.type=x.Texture,this.events=new t,this._parameters={...P,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(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 w;return t.wrapMode=this._parameters.wrap??D.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||C(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 M(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===_.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===_.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===_.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===_.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.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=y(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){A(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 M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await p(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await d(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=f(r,e.parameters));const s=j(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,i.width=s.width,i.height=s.height,i.compressionHandle=this._parameters.compressionHandle,this._glTexture=new M(e,i,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 C(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===_.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===_.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?j(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function j(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const P={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{L 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
- var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.UVI="uvi",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.NEXTDELTA="nextDelta",e.PREVIOUSDELTA="previousDelta",e.U0="u0",e.LINEPARAMETERS="lineParameters",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.PROFILEAUXDATA="profileAuxData",e.FEATUREVALUE="featureValue",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OLIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
5
+ var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.UVI="uvi",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.NEXTDELTA="nextDelta",e.PREVIOUSDELTA="previousDelta",e.U0="u0",e.LINEPARAMETERS="lineParameters",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.PROFILEAUXDATA="profileAuxData",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OLIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
@@ -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{Float16Array as e}from"@petamoriken/float16";import{Default3D as o}from"./DefaultVertexAttributeLocations.js";import{Pos2 as r,Pos2Tex as t}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as s}from"./VertexArrayObject.js";import{BufferObject as n}from"../../../webgl/BufferObject.js";import{Usage as f,TextureSamplingMode as m}from"../../../webgl/enums.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function u(r,t=w.Pos2,m=o,a=-1,i=1){const u=t===w.Pos2?new Float32Array([a,a,i,a,a,i,i,i]):new Float32Array([a,a,0,i,a,0,a,i,0,i,i,0]);if(t===w.Pos2Tex){const o=new e(u.buffer);o[10]=o[17]=o[22]=o[23]=1}return new s(r,m,new Map([["geometry",x.get(t)]]),new Map([["geometry",n.createVertex(r,f.STATIC_DRAW,u)]]))}const p=4;function c(e){const o=new i(p);return o.samplingMode=m.NEAREST,new a(e,o)}var w;!function(e){e[e.Pos2=0]="Pos2",e[e.Pos2Tex=1]="Pos2Tex"}(w||(w={}));const x=new Map([[w.Pos2,r],[w.Pos2Tex,t]]);export{w as Layout,c as createEmptyTexture,u as createQuadVAO};
5
+ import{makeFloat16Array as e}from"../../../../geometry/support/float16.js";import{Default3D as o}from"./DefaultVertexAttributeLocations.js";import{Pos2 as r,Pos2Tex as t}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as s}from"./VertexArrayObject.js";import{BufferObject as n}from"../../../webgl/BufferObject.js";import{Usage as f,TextureSamplingMode as m}from"../../../webgl/enums.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";function i(r,t=w.Pos2,m=o,a=-1,u=1){const i=t===w.Pos2?new Float32Array([a,a,u,a,a,u,u,u]):new Float32Array([a,a,0,u,a,0,a,u,0,u,u,0]);if(t===w.Pos2Tex){const o=e(i.buffer);o[10]=o[17]=o[22]=o[23]=1}return new s(r,m,new Map([["geometry",x.get(t)]]),new Map([["geometry",n.createVertex(r,f.STATIC_DRAW,i)]]))}const p=4;function c(e){const o=new u(p);return o.samplingMode=m.NEAREST,new a(e,o)}var w;!function(e){e[e.Pos2=0]="Pos2",e[e.Pos2Tex=1]="Pos2Tex"}(w||(w={}));const x=new Map([[w.Pos2,r],[w.Pos2Tex,t]]);export{w as Layout,c as createEmptyTexture,i as createQuadVAO};
@@ -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{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,f as u,t as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorInterfaces.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const p=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[p].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal","Internal error in lodRenderer");t[p].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),f=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}f|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),f|=j.DEFAULT_ACTIVE;o.state.set(h,f),o.lodLevel.set(h,e)}else f=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,f);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(f&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=f(),Q=p(),Z=h(),$=f(),X=f(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,f as u,t as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorInterfaces.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const p=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[p].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[p].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),f=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}f|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),f|=j.DEFAULT_ACTIVE;o.state.set(h,f),o.lodLevel.set(h,e)}else f=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,f);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(f&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=f(),Q=p(),Z=h(),$=f(),X=f(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
@@ -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 t from"../../../../core/Error.js";const e=16;function n(t,n){return n=Math.floor(n/e)*e,Math.min(Math.round(t/e)*e,n)}function r(t,n){return n=Math.floor(n/e)*e,Math.min(Math.ceil(t/e)*e,n)}function a(t,{maxPreferredTextureSize:e,maxTextureSize:r}){const a=Math.max(t.width,t.height),o=t.width*t.height,i=e*e;if(a<=r&&o<=i)return t;const c=Math.min(Math.sqrt(i/o),r/a);return h(t,n(Math.round(t.width*c),r),n(Math.round(t.height*c),r))}function h(t,e,n){if(t instanceof ImageData)return h(o(t),e,n);const r=document.createElement("canvas");r.width=e,r.height=n;return r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function o(e){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(null==r)throw new t("texture","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),n}export{n as applyTextureResizeModulo,r as applyTextureResizeModuloCeil,a as ensureImageMaxSize};
5
+ import t from"../../../../core/Error.js";const e=16;function n(t,n){return n=Math.floor(n/e)*e,Math.min(Math.round(t/e)*e,n)}function r(t,n){return n=Math.floor(n/e)*e,Math.min(Math.ceil(t/e)*e,n)}function a(t,{maxPreferredTextureSize:e,maxTextureSize:r}){const a=Math.max(t.width,t.height),o=t.width*t.height,i=e*e;if(a<=r&&o<=i)return t;const c=Math.min(Math.sqrt(i/o),r/a);return h(t,n(Math.round(t.width*c),r),n(Math.round(t.height*c),r))}function h(t,e,n){if(t instanceof ImageData)return h(o(t),e,n);const r=document.createElement("canvas");r.width=e,r.height=n;return r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function o(e){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(null==r)throw new t("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),n}export{n as applyTextureResizeModulo,r as applyTextureResizeModuloCeil,a as ensureImageMaxSize};
@@ -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{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmissionOrOID as e,isDepth as s,is2DGeometryOutput as i,isColorOrColorEmission as a,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as l}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as f}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as g}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as O}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class A extends m{constructor(t){super(t,P),this._configuration=new O,this.supportsEdges=!0,this.produces=new Map([[u.OPAQUE_MATERIAL,t=>this._isOpaqueMaterialPass(t)],[u.OPAQUE_MATERIAL_WITHOUT_NORMALS,t=>this._isOpaqueNoSSAODepthPass(t)],[u.TRANSPARENT_MATERIAL,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,t=>s(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[u.DRAPED_MATERIAL,t=>i(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<l,this._configuration.terrainDepthTest=r.terrainDepthTest&&a(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=T}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return t===o.Highlight||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return s(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new d(t)}createBufferWriter(){const t=r().vec3f(c.POSITION);return n()&&t.vec4u8(c.OLIDCOLOR),this.parameters.vvColor?t.f32(c.COLORFEATUREATTRIBUTE):t.vec4u8(c.COLOR),new f(t)}}class d extends p{beginSlot(t){return this.getTechnique(g,t)}}class P extends _{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=h.None,this.draped=!1,this.discardInvisibleFragments=!1}}export{A as ColorMaterial,P as Parameters};
5
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmissionOrOID as e,isDepth as s,is2DGeometryOutput as i,isColorOrColorEmission as a,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as l}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as f}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as g}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as O}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class A extends m{constructor(t){super(t,P),this._configuration=new O,this.supportsEdges=!0,this.produces=new Map([[u.OPAQUE_MATERIAL,t=>this._isOpaqueMaterialPass(t)],[u.OPAQUE_MATERIAL_WITHOUT_NORMALS,t=>this._isOpaqueNoSSAODepthPass(t)],[u.TRANSPARENT_MATERIAL,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,t=>s(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[u.DRAPED_MATERIAL,t=>i(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<l,this._configuration.terrainDepthTest=r.terrainDepthTest&&a(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=T}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return t===o.Highlight||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return s(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new d(t)}createBufferWriter(){const t=r().vec3f(c.POSITION);return n()&&t.vec4u8(c.OLIDCOLOR),this.parameters.vvColor?t.f16(c.COLORFEATUREATTRIBUTE):t.vec4u8(c.COLOR),new f(t)}}class d extends p{beginSlot(t){return this.getTechnique(g,t)}}class P extends _{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=h.None,this.draped=!1,this.discardInvisibleFragments=!1}}export{A as ColorMaterial,P 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{Float16Array as e}from"@petamoriken/float16";import{i as t,H as r,t as i}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n,isColor as o,isDepth as h,isColorHighlightOrDepth as c,isColorOrColorEmission as p}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,RenderOccludedFlag as u}from"../lib/Material.js";import{RenderSlot as T}from"../lib/RenderSlot.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as A}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as v,LineMarkerTechnique as _}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as E,LineMarkerSpace as g,LineMarkerAnchor as O}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as S}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class I extends m{constructor(e){super(e,C),this._configuration=new E,this.vertexAttributeLocations=v,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>e===n.Highlight||o(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>h(e)],[T.OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_MATERIAL,e=>o(e)&&this.parameters.writeDepth],[T.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>o(e)&&!this.parameters.writeDepth],[T.DRAPED_MATERIAL,e=>p(e)||e===n.Highlight]]),this._layout=this.createLayout()}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.space=t.slot===T.DRAPED_MATERIAL?g.Draped:this.parameters.worldSpace?g.World:g.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==S.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===u.OccludeAndTransparentStencil,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&p(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color[3]>=R}intersect(){}createLayout(){const e=s().vec3f(f.POSITION).vec4f16(f.PREVIOUSDELTA).vec2f16(f.UV0);return this.parameters.worldSpace&&e.vec3f16(f.NORMAL),this.parameters.vvSize?e.f16(f.SIZEFEATUREATTRIBUTE):e.f16(f.SIZE),this.parameters.vvColor?e.f16(f.COLORFEATUREATTRIBUTE):e.vec4u8(f.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(f.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new P(this._layout,this.parameters)}createGLMaterial(e){return new L(e)}}class L extends l{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(_,e)}}class C extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=S.BUTT,this.anchor=O.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.markerTexture=null}}class P{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(a,s,n,o,h,c){const p=n.get(f.POSITION).data,l=p.length/3;let m=[1,0,0];const u=n.get(f.NORMAL);this._parameters.worldSpace&&null!=u&&(m=u.data);let T=1,d=0;this._parameters.vvSize?d=n.get(f.SIZEFEATUREATTRIBUTE).data[0]:n.has(f.SIZE)&&(T=n.get(f.SIZE).data[0]);let v=[1,1,1,1],_=0;this._parameters.vvColor?_=n.get(f.COLORFEATUREATTRIBUTE).data[0]:n.has(f.COLOR)&&(v=n.get(f.COLOR).data);let E=0;this._parameters.vvOpacity&&(E=n.get(f.OPACITYFEATUREATTRIBUTE).data[0]);const g=new Float32Array(h.buffer),O=new e(h.buffer),S=new Uint8Array(h.buffer);let R=c*(this.vertexBufferLayout.stride/4);const I=(e,t,r,i)=>{g[R++]=e[0],g[R++]=e[1],g[R++]=e[2],A(t,e,O,2*R),R+=2;let a=2*R;if(O[a++]=r[0],O[a++]=r[1],this._parameters.worldSpace&&(O[a++]=m[0],O[a++]=m[1],O[a++]=m[2]),this._parameters.vvSize?O[a++]=d:O[a++]=T,this._parameters.vvColor)O[a++]=_;else{const e=Math.min(4*i,v.length-4),t=2*a;a+=2,S[t]=255*v[e],S[t+1]=255*v[e+1],S[t+2]=255*v[e+2],S[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(O[a++]=E),R=Math.ceil(.5*a)};let L;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(L||(L={}));const C=(e,s)=>{const n=t(b,p[3*e],p[3*e+1],p[3*e+2]),o=D;let h=e+s;do{t(o,p[3*h],p[3*h+1],p[3*h+2]),h+=s}while(r(n,o)&&h>=0&&h<l);a&&(i(n,n,a),i(o,o,a)),I(n,o,[-1,-1],e),I(n,o,[1,-1],e),I(n,o,[1,1],e),I(n,o,[-1,-1],e),I(n,o,[1,1],e),I(n,o,[-1,1],e)},P=this._parameters.placement;return"begin"!==P&&"begin-end"!==P||C(0,L.ASCENDING),"end"!==P&&"begin-end"!==P||C(l-1,L.DESCENDING),null}}const b=a(),D=a();export{I as LineMarkerMaterial,C as Parameters};
5
+ import{i as e,H as t,t as r}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as a}from"../../../../geometry/support/float16.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as n,isColor as o,isDepth as h,isColorHighlightOrDepth as c,isColorOrColorEmission as p}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,RenderOccludedFlag as u}from"../lib/Material.js";import{RenderSlot as T}from"../lib/RenderSlot.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as A}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as v,LineMarkerTechnique as _}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as E,LineMarkerSpace as g,LineMarkerAnchor as O}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as S}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class I extends m{constructor(e){super(e,C),this._configuration=new E,this.vertexAttributeLocations=v,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>e===n.Highlight||o(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>h(e)],[T.OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_OCCLUDER_MATERIAL,e=>c(e)&&this.parameters.renderOccluded===u.OccludeAndTransparentStencil],[T.TRANSPARENT_MATERIAL,e=>o(e)&&this.parameters.writeDepth],[T.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>o(e)&&!this.parameters.writeDepth],[T.DRAPED_MATERIAL,e=>p(e)||e===n.Highlight]]),this._layout=this.createLayout()}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.space=t.slot===T.DRAPED_MATERIAL?g.Draped:this.parameters.worldSpace?g.World:g.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==S.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===u.OccludeAndTransparentStencil,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest&&p(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color[3]>=R}intersect(){}createLayout(){const e=s().vec3f(f.POSITION).vec4f16(f.PREVIOUSDELTA).vec2f16(f.UV0);return this.parameters.worldSpace&&e.vec3f16(f.NORMAL),this.parameters.vvSize?e.f16(f.SIZEFEATUREATTRIBUTE):e.f16(f.SIZE),this.parameters.vvColor?e.f16(f.COLORFEATUREATTRIBUTE):e.vec4u8(f.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(f.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new P(this._layout,this.parameters)}createGLMaterial(e){return new L(e)}}class L extends l{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(_,e)}}class C extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=S.BUTT,this.anchor=O.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.markerTexture=null}}class P{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,n,o,h,c){const p=n.get(f.POSITION).data,l=p.length/3;let m=[1,0,0];const u=n.get(f.NORMAL);this._parameters.worldSpace&&null!=u&&(m=u.data);let T=1,d=0;this._parameters.vvSize?d=n.get(f.SIZEFEATUREATTRIBUTE).data[0]:n.has(f.SIZE)&&(T=n.get(f.SIZE).data[0]);let v=[1,1,1,1],_=0;this._parameters.vvColor?_=n.get(f.COLORFEATUREATTRIBUTE).data[0]:n.has(f.COLOR)&&(v=n.get(f.COLOR).data);let E=0;this._parameters.vvOpacity&&(E=n.get(f.OPACITYFEATUREATTRIBUTE).data[0]);const g=new Float32Array(h.buffer),O=a(h.buffer),S=new Uint8Array(h.buffer);let R=c*(this.vertexBufferLayout.stride/4);const I=(e,t,r,i)=>{g[R++]=e[0],g[R++]=e[1],g[R++]=e[2],A(t,e,O,2*R),R+=2;let a=2*R;if(O[a++]=r[0],O[a++]=r[1],this._parameters.worldSpace&&(O[a++]=m[0],O[a++]=m[1],O[a++]=m[2]),this._parameters.vvSize?O[a++]=d:O[a++]=T,this._parameters.vvColor)O[a++]=_;else{const e=Math.min(4*i,v.length-4),t=2*a;a+=2,S[t]=255*v[e],S[t+1]=255*v[e+1],S[t+2]=255*v[e+2],S[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(O[a++]=E),R=Math.ceil(.5*a)};let L;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(L||(L={}));const C=(a,s)=>{const n=e(b,p[3*a],p[3*a+1],p[3*a+2]),o=D;let h=a+s;do{e(o,p[3*h],p[3*h+1],p[3*h+2]),h+=s}while(t(n,o)&&h>=0&&h<l);i&&(r(n,n,i),r(o,o,i)),I(n,o,[-1,-1],a),I(n,o,[1,-1],a),I(n,o,[1,1],a),I(n,o,[-1,-1],a),I(n,o,[1,1],a),I(n,o,[-1,1],a)},P=this._parameters.placement;return"begin"!==P&&"begin-end"!==P||C(0,L.ASCENDING),"end"!==P&&"begin-end"!==P||C(l-1,L.DESCENDING),null}}const b=i(),D=i();export{I as LineMarkerMaterial,C 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{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as l}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import f from"../lib/GLMaterial.js";import{Material as d}from"../lib/Material.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as v}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as _}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as y}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as A,PathTechnique as O,PathPassParameters as j}from"./PathTechnique.js";import{PathTechniqueConfiguration as P}from"./PathTechniqueConfiguration.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class R extends d{constructor(e,t){super(e,x),this._vertexBufferLayout=T(),this.vertexAttributeLocations=A,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&!this.transparent],[S.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&this.transparent]]),this._configuration=new P(t.spherical)}get hasEmissions(){return!i(this.parameters.emissiveFactor,r)}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?m.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?m.WindingOrder:m.None,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?l.Schematic:l.Disabled,this._configuration.emissionSource=this.parameters.usePBR?u.Value:u.None,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}isVisibleForOutput(e){return e!==h.Shadow&&e!==h.ShadowExcludeHighlight&&e!==h.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=L}intersect(i,r,a,o,n,c){const h=i;if(!b(h))return;const u=h.path,m=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=u.sizeAttributeValue;Number.isNaN(o)?(m[0]*=a[0],m[1]*=a[2]):(m[0]*=e(t[0]+o*i[0],r[0],s[0]),m[1]*=e(t[2]+o*i[2],r[2],s[2]))}const l=new g(!1,a.options.normalRequired),p=Math.max(m[0],m[1]),f=i.boundingInfo;if(null==f)return void M(u,m,o,n,l,c);const d=s(f.bbMin[0]-p,f.bbMin[1]-p,f.bbMin[2]-p,f.bbMax[0]+p,f.bbMax[1]+p,f.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],_=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),y=[_/S[0],_/S[1],_/S[2]];v(d,o,y,a.tolerance)&&M(u,m,o,n,l,c)}createBufferWriter(){return new y(this._vertexBufferLayout)}createGLMaterial(e){return new w(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}function T(){const e=a().vec3f(_.POSITION).vec3f(_.FEATUREVALUE).vec4f16(_.PROFILEVERTEXANDNORMAL).vec3f16(_.PROFILEAUXDATA).vec2i16(_.PROFILERIGHT,{glNormalized:!0}).vec2i16(_.PROFILEUP,{glNormalized:!0});return p()&&e.vec4u8(_.OLIDCOLOR),e}class w extends f{beginSlot(e){return this.getTechnique(O,e)}}function M(e,t,i,r,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(i,r,s,a)}class x extends j{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{x as Parameters,R as PathMaterial};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as i}from"../../../../chunks/vec32.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as o,is3DGeometryOutputMRT as n,isColorOrColorEmission as c,ShaderOutput as h}from"../core/shaderLibrary/ShaderOutput.js";import{EmissionSource as u}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as m}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import f from"../lib/GLMaterial.js";import{Material as d}from"../lib/Material.js";import{isPathGeometry as b}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as v}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{VertexAttribute as T}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as A}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as O,PathTechnique as R,PathPassParameters as E}from"./PathTechnique.js";import{PathTechniqueConfiguration as y}from"./PathTechniqueConfiguration.js";import{alphaCutoff as _}from"../../../../webscene/support/AlphaCutoff.js";class P extends d{constructor(e,t){super(e,I),this.vertexAttributeLocations=O,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&!this.transparent],[S.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&o(e)||n(e))&&this.transparent]]),this._configuration=new y(t.spherical)}get hasEmissions(){return!i(this.parameters.emissiveFactor,r)}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?m.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?m.WindingOrder:m.None,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?p.Schematic:p.Disabled,this._configuration.emissionSource=this.parameters.usePBR?u.Value:u.None,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}isVisibleForOutput(e){return e!==h.Shadow&&e!==h.ShadowExcludeHighlight&&e!==h.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=_}intersect(i,r,a,o,n,c){const h=i;if(!b(h))return;const u=h.path,m=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=u.sizeAttributeValue;Number.isNaN(o)?(m[0]*=a[0],m[1]*=a[2]):(m[0]*=e(t[0]+o*i[0],r[0],s[0]),m[1]*=e(t[2]+o*i[2],r[2],s[2]))}const p=new g(!1,a.options.normalRequired),l=Math.max(m[0],m[1]),f=i.boundingInfo;if(null==f)return void w(u,m,o,n,p,c);const d=s(f.bbMin[0]-l,f.bbMin[1]-l,f.bbMin[2]-l,f.bbMax[0]+l,f.bbMax[1]+l,f.bbMax[2]+l),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],T=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),A=[T/S[0],T/S[1],T/S[2]];v(d,o,A,a.tolerance)&&w(u,m,o,n,p,c)}createBufferWriter(){return new A(this._layout)}get _layout(){const e=a().vec3f(T.POSITION).vec4f16(T.PROFILEVERTEXANDNORMAL).vec3f16(T.PROFILEAUXDATA).vec2i16(T.PROFILERIGHT,{glNormalized:!0}).vec2i16(T.PROFILEUP,{glNormalized:!0});return this.parameters.vvSize&&e.f32(T.SIZEFEATUREATTRIBUTE),this.parameters.vvColor&&e.f16(T.COLORFEATUREATTRIBUTE),this.parameters.vvOpacity&&e.f16(T.OPACITYFEATUREATTRIBUTE),l()&&e.vec4u8(T.OLIDCOLOR),e}createGLMaterial(e){return new j(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}class j extends f{beginSlot(e){return this.getTechnique(R,e)}}function w(e,t,i,r,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(i,r,s,a)}class I extends E{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{I as Parameters,P as PathMaterial};
@@ -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{freeze as r,create as e,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isColorOrColorEmission as t,ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as o}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{NormalsDoubleSidedMode as l}from"../core/shaderLibrary/shading/Normals.glsl.js";import{ReloadableShaderModule as n}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as m}from"../lib/OITPass.js";import{blending as c,oitDepthTest as p,getDrawBuffers as u,OITPolygonOffset as h}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as d,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{advancedMRRFactors as O}from"./pbrUtils.js";import{P as j}from"../../../../chunks/Path.glsl.js";import{SpecialDrawBuffers as P}from"../../../webgl/enums.js";import{makePipelineState as T,frontFaceCullingParams as g,defaultDepthWrite as E,defaultColorWrite as L}from"../../../webgl/renderState.js";class I extends o{constructor(){super(...arguments),this.ambient=r(.2,.2,.2),this.diffuse=r(.8,.8,.8),this.specular=r(0,0,0),this.opacity=1,this.origin=e(),this.modelTransformation=null,this.mrrFactors=O,this.emissiveFactor=s}}class R extends a{constructor(r,e){super(r,e,new n(j,(()=>import("../shaders/Path.glsl.js"))),F)}initializePipeline(r){const{output:e,transparent:s,hasSlicePlane:o,doubleSidedMode:n,hasOccludees:a,oitPass:b}=r,O=b===m.NONE,j=b===m.FrontFace;return T({blending:t(e)&&s?c(b):null,culling:o&&!s&&n!==l.None?g:null,depthTest:{func:p(b)},depthWrite:O||j?E:null,drawBuffers:e===i.Depth?{buffers:[P.NONE]}:u(b,e),colorWrite:L,stencilWrite:a?d:null,stencilTest:a?f:null,polygonOffset:O||j?null:h})}}const F=new Map([[b.POSITION,0],[b.FEATUREVALUE,1],[b.PROFILEVERTEXANDNORMAL,2],[b.PROFILEAUXDATA,3],[b.PROFILERIGHT,4],[b.PROFILEUP,5],[b.OLIDCOLOR,6]]);export{I as PathPassParameters,R as PathTechnique,F as vertexAttributeLocations};
5
+ import{freeze as r,create as e,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isColorOrColorEmission as t,ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as o}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{NormalsDoubleSidedMode as l}from"../core/shaderLibrary/shading/Normals.glsl.js";import{ReloadableShaderModule as n}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as m}from"../lib/OITPass.js";import{blending as c,oitDepthTest as p,getDrawBuffers as u,OITPolygonOffset as h}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as d,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VertexAttribute as T}from"../lib/VertexAttribute.js";import{advancedMRRFactors as O}from"./pbrUtils.js";import{P as b}from"../../../../chunks/Path.glsl.js";import{SpecialDrawBuffers as E}from"../../../webgl/enums.js";import{makePipelineState as P,frontFaceCullingParams as R,defaultDepthWrite as j,defaultColorWrite as I}from"../../../webgl/renderState.js";class A extends o{constructor(){super(...arguments),this.ambient=r(.2,.2,.2),this.diffuse=r(.8,.8,.8),this.specular=r(0,0,0),this.opacity=1,this.origin=e(),this.modelTransformation=null,this.mrrFactors=O,this.emissiveFactor=s}}class g extends a{constructor(r,e){super(r,e,new n(b,(()=>import("../shaders/Path.glsl.js"))),F)}initializePipeline(r){const{output:e,transparent:s,hasSlicePlane:o,doubleSidedMode:n,hasOccludees:a,oitPass:T}=r,O=T===m.NONE,b=T===m.FrontFace;return P({blending:t(e)&&s?c(T):null,culling:o&&!s&&n!==l.None?R:null,depthTest:{func:p(T)},depthWrite:O||b?j:null,drawBuffers:e===i.Depth?{buffers:[E.NONE]}:u(T,e),colorWrite:I,stencilWrite:a?d:null,stencilTest:a?f:null,polygonOffset:O||b?null:h})}}const F=new Map([[T.POSITION,0],[T.PROFILEVERTEXANDNORMAL,1],[T.PROFILEAUXDATA,2],[T.PROFILERIGHT,3],[T.PROFILEUP,4],[T.SIZEFEATUREATTRIBUTE,5],[T.COLORFEATUREATTRIBUTE,6],[T.OPACITYFEATUREATTRIBUTE,7],[T.OLIDCOLOR,8]]);export{A as PathPassParameters,g as PathTechnique,F as vertexAttributeLocations};
@@ -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{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as t,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as i,isColorOrColorEmission as o,isDepth as a,isColorEmissionHighlightOrOID as n}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as f}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as c}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as u}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{assert as h}from"../lib/Util.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as d}from"./DefaultBufferWriter.js";import{Style as g}from"./PatternStyle.js";import{TriangleMaterial as A}from"./TriangleMaterial.js";import{VisualVariablePassParameters as T}from"./VisualVariablePassParameters.js";import{writeDefaultAttributes as b,writeBufferVec4 as v}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocationsOID as O,vertexAttributeLocations as _,PatternTechnique as j}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as C}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class R extends A{constructor(e){super(e,I),this._configuration=new C,this.vertexAttributeLocations=f()?O:_,this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>i(e)],[p.TRANSPARENT_MATERIAL,e=>o(e)],[p.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,e=>a(e)],[p.DRAPED_MATERIAL,e=>this.parameters.draped&&n(e)]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<u,this._configuration.terrainDepthTest=t.terrainDepthTest&&o(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}get visible(){return this.parameters.color[3]>=P}createGLMaterial(e){return new y(e)}createBufferWriter(){const e=s().vec3f(m.POSITION).vec4f(m.UVMAPSPACE);return this.parameters.draped||e.mat3f(m.BOUNDINGRECT),this.parameters.vvColor?e.f32(m.COLORFEATUREATTRIBUTE):e.vec4u8(m.COLOR),f()&&e.vec4u8(m.OLIDCOLOR),new E(e)}}class y extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends d{write(e,s,i,o,a,n){const f=b(i,o,this.vertexBufferLayout,e,s,a,n);for(const c of this.vertexBufferLayout.fields.keys()){const s=i.get(c),o=s?.indices;if(s&&o)switch(c){case m.UVMAPSPACE:{h(4===s.size);const e=a.getField(c,r);e&&v(s,e,n);break}case m.BOUNDINGRECT:{h(9===s.size);const r=a.getField(c,t);r&&L(s,e,r,n);break}}}return f}}function L(e,t,r,s){const{data:i,indices:o}=e,a=t,n=r.typedBuffer,f=r.typedBufferStride,c=o.length;s*=f;for(let l=0;l<c;++l){const e=9*o[l],t=i[e],r=i[e+1],c=i[e+2];n[s]=a[0]*t+a[4]*r+a[8]*c+a[12],n[s+1]=a[1]*t+a[5]*r+a[9]*c+a[13],n[s+2]=a[2]*t+a[6]*r+a[10]*c+a[14];for(let o=3;o<9;++o)n[s+o]=i[e+o];s+=f}}class I extends T{constructor(){super(...arguments),this.color=e(1,1,1,1),this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=c.None,this.hasOccludees=!1,this.style=g.Cross,this.draped=!0}}export{I as Parameters,R as PatternMaterial};
5
+ import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as t,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as i,isColorOrColorEmission as o,isDepth as a,isColorEmissionHighlightOrOID as n}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as f}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as c}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as u}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{assert as h}from"../lib/Util.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as d}from"./DefaultBufferWriter.js";import{Style as g}from"./PatternStyle.js";import{TriangleMaterial as A}from"./TriangleMaterial.js";import{VisualVariablePassParameters as T}from"./VisualVariablePassParameters.js";import{writeDefaultAttributes as b,writeBufferVec4 as v}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocationsOID as O,vertexAttributeLocations as _,PatternTechnique as j}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as C}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class R extends A{constructor(e){super(e,I),this._configuration=new C,this.vertexAttributeLocations=f()?O:_,this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>i(e)],[p.TRANSPARENT_MATERIAL,e=>o(e)],[p.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,e=>a(e)],[p.DRAPED_MATERIAL,e=>this.parameters.draped&&n(e)]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<u,this._configuration.terrainDepthTest=t.terrainDepthTest&&o(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}get visible(){return this.parameters.color[3]>=P}createGLMaterial(e){return new y(e)}createBufferWriter(){const e=s().vec3f(m.POSITION).vec4f(m.UVMAPSPACE);return this.parameters.draped||e.mat3f(m.BOUNDINGRECT),this.parameters.vvColor?e.f16(m.COLORFEATUREATTRIBUTE):e.vec4u8(m.COLOR),f()&&e.vec4u8(m.OLIDCOLOR),new E(e)}}class y extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends d{write(e,s,i,o,a,n){const f=b(i,o,this.vertexBufferLayout,e,s,a,n);for(const c of this.vertexBufferLayout.fields.keys()){const s=i.get(c),o=s?.indices;if(s&&o)switch(c){case m.UVMAPSPACE:{h(4===s.size);const e=a.getField(c,r);e&&v(s,e,n);break}case m.BOUNDINGRECT:{h(9===s.size);const r=a.getField(c,t);r&&L(s,e,r,n);break}}}return f}}function L(e,t,r,s){const{data:i,indices:o}=e,a=t,n=r.typedBuffer,f=r.typedBufferStride,c=o.length;s*=f;for(let l=0;l<c;++l){const e=9*o[l],t=i[e],r=i[e+1],c=i[e+2];n[s]=a[0]*t+a[4]*r+a[8]*c+a[12],n[s+1]=a[1]*t+a[5]*r+a[9]*c+a[13],n[s+2]=a[2]*t+a[6]*r+a[10]*c+a[14];for(let o=3;o<9;++o)n[s+o]=i[e+o];s+=f}}class I extends T{constructor(){super(...arguments),this.color=e(1,1,1,1),this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=c.None,this.hasOccludees=!1,this.style=g.Cross,this.draped=!0}}export{I as Parameters,R as PatternMaterial};
@@ -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{Float16Array as e}from"@petamoriken/float16";import t from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as a,d as n,f as o,h as l,g as c,c as p,l as h,j as f,t as m}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as E,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as w}from"../lib/Material.js";import{RenderSlot as F}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as x}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as B}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[F.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[F.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==w.OccludeAndTransparentStencil],[F.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===F.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===w.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:t},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(x.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const t=e.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(t)?c*=this.parameters.vvSize.fallback[0]:c*=r(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],f=(c/2+4)*t;let m=Number.MAX_VALUE,u=0;const T=e.get(x.POSITION).data,d=ee(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],t=T[_+1],i=(_+3)%T.length,s=p-e,a=h-t,n=T[i]-e,o=T[i+1]-t,l=r((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,f=o*l-a,d=c*c+f*f;d<m&&(m=d,u=_/3)}m<f*f&&n(o.dist,o.normal,u,!1)}intersect(e,i,m,u,T,_){if(!m.options.selectionMode||!e.visible)return;if(!M(i))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=e.attributes,v=g.get(x.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=r(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(x.SIZE)&&(P*=g.get(x.SIZE).data[0]);const N=m.camera,L=ne;s(L,m.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;a(de[0],L[0]-b,L[1]+b,0),a(de[1],L[0]+b,L[1]+b,0),a(de[2],L[0]+b,L[1]-b,0),a(de[3],L[0]-b,L[1]-b,0);for(let t=0;t<4;t++)if(!N.unprojectFromRenderScreen(de[t],_e[t]))return;S(N.eye,_e[0],_e[1],Ee),S(N.eye,_e[1],_e[2],Ae),S(N.eye,_e[2],_e[3],Re),S(N.eye,_e[3],_e[0],ge);let C=Number.MAX_VALUE,U=0;const y=ee(this.parameters,g)?v.length-2:v.length-5;for(let t=0;t<y;t+=3){re[0]=v[t]+i[12],re[1]=v[t+1]+i[13],re[2]=v[t+2]+i[14];const e=(t+3)%v.length;if(ie[0]=v[e]+i[12],ie[1]=v[e+1]+i[13],ie[2]=v[e+2]+i[14],O(Ee,re)<0&&O(Ee,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(N.projectToRenderScreen(re,oe),N.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){n(se,re,ie);const e=N.frustum,t=-O(e[d.NEAR],re)/o(se,I(e[d.NEAR]));l(se,se,t),c(re,re,se),N.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){n(se,ie,re);const e=N.frustum,t=-O(e[d.NEAR],ie)/o(se,I(e[d.NEAR]));l(se,se,t),c(ie,ie,se),N.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=E(A(oe,le,he),L);r<C&&(C=r,p(ce,re),p(pe,ie),U=t/3)}const j=m.rayBegin,D=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(ce,pe,he),A(j,D,fe),ae)){n(ae,ae,j);const t=h(ae);l(ae,ae,1/t),e=t/f(j,D)}_(e,ae,U,!1)}}get _layout(){const e=v().vec3f(x.POSITION).vec4f16(x.PREVIOUSDELTA).vec4f16(x.NEXTDELTA).f32(x.U0).vec2f16(x.LINEPARAMETERS);return this.parameters.vvSize?e.f32(x.SIZEFEATUREATTRIBUTE):e.f16(x.SIZE),this.parameters.vvColor?e.f16(x.COLORFEATUREATTRIBUTE):e.vec4u8(x.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(x.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(x.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends B{constructor(){super(...arguments),this.width=0,this.color=T,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(x.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,r,i,s,n,o){const l=i.get(x.POSITION),c=l.indices,h=l.data.length/3,u=i.get(x.DISTANCETOSTART)?.data;c&&c.length!==2*(h-1)&&console.warn("RibbonLineMaterial does not support indices");const T=this.vertexBufferLayout.fields.has(x.SIZEFEATUREATTRIBUTE),d=(T?i.get(x.SIZEFEATUREATTRIBUTE)?.data[0]:i.get(x.SIZE)?.data[0])??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(x.COLORFEATUREATTRIBUTE);A?E=i.get(x.COLORFEATUREATTRIBUTE).data[0]:i.has(x.COLOR)&&(_=i.get(x.COLOR).data);const R=this.vertexBufferLayout.fields.has(x.OPACITYFEATUREATTRIBUTE),g=R?i.get(x.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(n.buffer),O=new e(n.buffer),I=new Uint8Array(n.buffer),v=this.vertexBufferLayout.stride/4;let P=o*v;const N=P;let L=0;const b=u?(e,t,r)=>L=u[r]:(e,t,r)=>L+=f(e,t),C=(e,t,r,i,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,2*P),P+=2,J(r,t,O,2*P),P+=2,S[P++]=o;let l=2*P;if(O[l++]=i,O[l++]=a,T?(P=Math.ceil(.5*l),S[P]=d,l+=2):O[l++]=d,A)O[l++]=E;else{const e=Math.min(4*n,_.length-4),t=2*l;l+=2,I[t]=255*_[e],I[t+1]=255*_[e+1],I[t+2]=255*_[e+2],I[t+3]=255*_[e+3]}R&&(O[l++]=g);let c=2*l;y()&&s&&(I[c++]=s[0],I[c++]=s[1],I[c++]=s[2],I[c++]=s[3]),P=Math.ceil(.25*c)};P+=v,a(ue,l.data[0],l.data[1],l.data[2]),t&&m(ue,ue,t);const U=this._isClosed(i);if(U){const e=l.data.length-3;a(me,l.data[e],l.data[e+1],l.data[e+2]),t&&m(me,me,t)}else a(Te,l.data[3],l.data[4],l.data[5]),t&&m(Te,Te,t),C(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),C(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),p(me,ue),p(ue,Te);const j=U?0:1,D=U?h:h-1;for(let e=j;e<D;e++){const r=(e+1)%h*3;a(Te,l.data[r],l.data[r+1],l.data[r+2]),t&&m(Te,Te,t),b(me,ue,e),C(me,ue,Te,0,Y.LEFT_JOIN_END,e,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,e,L);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const r=(t+1)/(i+1);C(me,ue,Te,r,Y.LEFT_JOIN_END,e,L),C(me,ue,Te,r,Y.RIGHT_JOIN_END,e,L)}C(me,ue,Te,1,Y.LEFT_JOIN_START,e,L),C(me,ue,Te,1,Y.RIGHT_JOIN_START,e,L),p(me,ue),p(ue,Te)}U?(a(Te,l.data[3],l.data[4],l.data[5]),t&&m(Te,Te,t),L=b(me,ue,D),C(me,ue,Te,0,Y.LEFT_JOIN_END,j,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,j,L)):(L=b(me,ue,D),C(me,ue,ue,0,Y.LEFT_CAP_END,D,L),C(me,ue,ue,0,Y.RIGHT_CAP_END,D,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(n,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(x.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=u(),ie=u(),se=u(),ae=u(),ne=u(),oe=i(),le=i(),ce=u(),pe=u(),he=_(),fe=_(),me=u(),ue=u(),Te=u(),de=[i(),i(),i(),i()],_e=[u(),u(),u(),u()],Ee=g(),Ae=g(),Re=g(),ge=g();export{Q as Parameters,q as RibbonLineMaterial};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,f as n,h as o,g as l,c,l as p,j as h,t as f}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as E,fromPoints as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as F}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as x}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as B}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[w.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[w.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===w.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===F.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n,o){if(!s.options.selectionMode)return;const l=e.get(x.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?c*=this.parameters.vvSize.fallback[0]:c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const p=a[0],h=a[1],f=(c/2+4)*r;let m=Number.MAX_VALUE,u=0;const T=e.get(x.POSITION).data,d=ee(this.parameters,e)?T.length-2:T.length-5;for(let _=0;_<d;_+=3){const e=T[_],r=T[_+1],i=(_+3)%T.length,s=p-e,a=h-r,n=T[i]-e,o=T[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,f=o*l-a,d=c*c+f*f;d<m&&(m=d,u=_/3)}m<f*f&&n(o.dist,o.normal,u,!1)}intersect(r,f,m,u,T,_){if(!m.options.selectionMode||!r.visible)return;if(!M(f))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,v=g.get(x.POSITION).data;let P=this.parameters.width;if(this.parameters.vvSize){const e=g.get(x.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(P*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else g.has(x.SIZE)&&(P*=g.get(x.SIZE).data[0]);const N=m.camera,L=ne;i(L,m.point);const b=P*N.pixelRatio/2+4*N.pixelRatio;s(de[0],L[0]-b,L[1]+b,0),s(de[1],L[0]+b,L[1]+b,0),s(de[2],L[0]+b,L[1]-b,0),s(de[3],L[0]-b,L[1]-b,0);for(let e=0;e<4;e++)if(!N.unprojectFromRenderScreen(de[e],_e[e]))return;S(N.eye,_e[0],_e[1],Ee),S(N.eye,_e[1],_e[2],Ae),S(N.eye,_e[2],_e[3],Re),S(N.eye,_e[3],_e[0],ge);let C=Number.MAX_VALUE,U=0;const y=ee(this.parameters,g)?v.length-2:v.length-5;for(let e=0;e<y;e+=3){re[0]=v[e]+f[12],re[1]=v[e+1]+f[13],re[2]=v[e+2]+f[14];const t=(e+3)%v.length;if(ie[0]=v[t]+f[12],ie[1]=v[t+1]+f[13],ie[2]=v[t+2]+f[14],O(Ee,re)<0&&O(Ee,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(N.projectToRenderScreen(re,oe),N.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){a(se,re,ie);const e=N.frustum,t=-O(e[d.NEAR],re)/n(se,I(e[d.NEAR]));o(se,se,t),l(re,re,se),N.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){a(se,ie,re);const e=N.frustum,t=-O(e[d.NEAR],ie)/n(se,I(e[d.NEAR]));o(se,se,t),l(ie,ie,se),N.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=E(A(oe,le,he),L);r<C&&(C=r,c(ce,re),c(pe,ie),U=e/3)}const j=m.rayBegin,D=m.rayEnd;if(C<b*b){let e=Number.MAX_VALUE;if(R(A(ce,pe,he),A(j,D,fe),ae)){a(ae,ae,j);const t=p(ae);o(ae,ae,1/t),e=t/h(j,D)}_(e,ae,U,!1)}}get _layout(){const e=v().vec3f(x.POSITION).vec4f16(x.PREVIOUSDELTA).vec4f16(x.NEXTDELTA).f32(x.U0).vec2f16(x.LINEPARAMETERS);return this.parameters.vvSize?e.f32(x.SIZEFEATUREATTRIBUTE):e.f16(x.SIZE),this.parameters.vvColor?e.f16(x.COLORFEATUREATTRIBUTE):e.vec4u8(x.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(x.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(x.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends B{constructor(){super(...arguments),this.width=0,this.color=u,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(x.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=r.get(x.POSITION),l=o.indices,p=o.data.length/3,m=r.get(x.DISTANCETOSTART)?.data;l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=this.vertexBufferLayout.fields.has(x.SIZEFEATUREATTRIBUTE),d=(u?r.get(x.SIZEFEATUREATTRIBUTE)?.data[0]:r.get(x.SIZE)?.data[0])??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(x.COLORFEATUREATTRIBUTE);A?E=r.get(x.COLORFEATUREATTRIBUTE).data[0]:r.has(x.COLOR)&&(_=r.get(x.COLOR).data);const R=this.vertexBufferLayout.fields.has(x.OPACITYFEATUREATTRIBUTE),g=R?r.get(x.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),O=T(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let P=n*v;const N=P;let L=0;const b=m?(e,t,r)=>L=m[r]:(e,t,r)=>L+=h(e,t),C=(e,t,r,s,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,2*P),P+=2,J(r,t,O,2*P),P+=2,S[P++]=o;let l=2*P;if(O[l++]=s,O[l++]=a,u?(P=Math.ceil(.5*l),S[P]=d,l+=2):O[l++]=d,A)O[l++]=E;else{const e=Math.min(4*n,_.length-4),t=2*l;l+=2,I[t]=255*_[e],I[t+1]=255*_[e+1],I[t+2]=255*_[e+2],I[t+3]=255*_[e+3]}R&&(O[l++]=g);let c=2*l;y()&&i&&(I[c++]=i[0],I[c++]=i[1],I[c++]=i[2],I[c++]=i[3]),P=Math.ceil(.25*c)};P+=v,s(ue,o.data[0],o.data[1],o.data[2]),e&&f(ue,ue,e);const U=this._isClosed(r);if(U){const t=o.data.length-3;s(me,o.data[t],o.data[t+1],o.data[t+2]),e&&f(me,me,e)}else s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),C(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),C(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),c(me,ue),c(ue,Te);const j=U?0:1,D=U?p:p-1;for(let h=j;h<D;h++){const t=(h+1)%p*3;s(Te,o.data[t],o.data[t+1],o.data[t+2]),e&&f(Te,Te,e),b(me,ue,h),C(me,ue,Te,0,Y.LEFT_JOIN_END,h,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(me,ue,Te,t,Y.LEFT_JOIN_END,h,L),C(me,ue,Te,t,Y.RIGHT_JOIN_END,h,L)}C(me,ue,Te,1,Y.LEFT_JOIN_START,h,L),C(me,ue,Te,1,Y.RIGHT_JOIN_START,h,L),c(me,ue),c(ue,Te)}U?(s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),L=b(me,ue,D),C(me,ue,Te,0,Y.LEFT_JOIN_END,j,L),C(me,ue,Te,0,Y.RIGHT_JOIN_END,j,L)):(L=b(me,ue,D),C(me,ue,ue,0,Y.LEFT_CAP_END,D,L),C(me,ue,ue,0,Y.RIGHT_CAP_END,D,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(a,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(x.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=m(),ie=m(),se=m(),ae=m(),ne=m(),oe=r(),le=r(),ce=m(),pe=m(),he=_(),fe=_(),me=m(),ue=m(),Te=m(),de=[r(),r(),r(),r()],_e=[m(),m(),m(),m()],Ee=g(),Ae=g(),Re=g(),ge=g();export{Q as Parameters,q as RibbonLineMaterial};