@arcgis/core 4.33.0-next.20250317 → 4.33.0-next.20250319

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 (118) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0b7331613f91a3258352.js +1 -0
  3. package/assets/esri/core/workers/chunks/2219d970ece5676ca6ee.js +1 -0
  4. package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +1 -0
  5. package/assets/esri/core/workers/chunks/630a9afdf0523c27ddb6.js +1 -0
  6. package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +1 -0
  7. package/assets/esri/core/workers/chunks/{23aa7254fffe67e3f1bc.js → 6a97bdd46715fc12e1b4.js} +239 -160
  8. package/assets/esri/core/workers/chunks/8063e35dacf8f99471d8.js +1 -0
  9. package/assets/esri/core/workers/chunks/8e20ec4e8e2cfc582fe7.js +319 -0
  10. package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +1 -0
  11. package/assets/esri/core/workers/chunks/d787474e78360c925fd9.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7ded83eb64eff069b761.js → d8b903b4147b090576f2.js} +1 -1
  13. package/assets/esri/core/workers/chunks/e4290719c8afc2a4ee8c.js +1 -0
  14. package/assets/esri/core/workers/chunks/e5e1f8ac53c70427a60b.js +1 -0
  15. package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +1 -0
  16. package/assets/esri/core/workers/chunks/fef46b841e8369b30227.js +1 -0
  17. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  18. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +20 -0
  19. package/assets/esri/themes/dark/main.css +1 -1
  20. package/assets/esri/themes/light/main.css +1 -1
  21. package/assets/esri/themes/light/view.css +1 -1
  22. package/chunks/HUDMaterial.glsl.js +80 -75
  23. package/chunks/RibbonLine.glsl.js +37 -37
  24. package/chunks/ShadowCastAccumulate.glsl.js +5 -21
  25. package/chunks/ShadowHighlight.glsl.js +8 -30
  26. package/chunks/Terrain.glsl.js +33 -34
  27. package/copyright.txt +29 -0
  28. package/core/has.js +1 -1
  29. package/core/typedArrayUtil.js +1 -1
  30. package/geometry/support/HalfFloatArray.js +5 -0
  31. package/geometry/support/buffer/BufferView.js +1 -1
  32. package/geometry/support/buffer/types.js +1 -1
  33. package/geometry/support/densifyUtils.js +1 -1
  34. package/interfaces.d.ts +18 -40
  35. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  36. package/package.json +2 -1
  37. package/renderers/support/RasterSymbolizer.js +1 -1
  38. package/support/revision.js +1 -1
  39. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  40. package/views/2d/layers/graphics/GraphicStoreItem.js +1 -1
  41. package/views/2d/layers/graphics/densificationConstants.js +1 -1
  42. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  43. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  44. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  45. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  46. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  47. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  48. package/views/3d/layers/graphics/Labeler.js +1 -1
  49. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  50. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  51. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  52. package/views/3d/support/buffer/glUtil.js +1 -1
  53. package/views/3d/terrain/PatchGeometry.js +1 -1
  54. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  55. package/views/3d/terrain/TerrainAttributes.js +1 -1
  56. package/views/3d/terrain/TerrainSurface.js +1 -1
  57. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  58. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  59. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -9
  60. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  61. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +4 -3
  62. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +125 -40
  63. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  64. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  65. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  66. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  67. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  68. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  69. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  70. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  71. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  72. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  73. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  74. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  75. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  76. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  77. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  78. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  79. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  81. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  82. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  83. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  86. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  87. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  88. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  89. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  90. package/views/3d/webgl-engine/shaders/ReadShadowMapConfiguration.js +1 -1
  91. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  92. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  93. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  94. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  95. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  96. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  97. package/widgets/Editor/UpdateWorkflow.js +1 -1
  98. package/widgets/Editor.js +1 -1
  99. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  100. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  101. package/widgets/Features/FeaturesDrillIn.js +1 -1
  102. package/widgets/Features.js +1 -1
  103. package/widgets/Print/PrintViewModel.js +1 -1
  104. package/widgets/Print/TemplateOptions.js +1 -1
  105. package/widgets/support/LabeledSwitch.js +1 -1
  106. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  107. package/assets/esri/core/workers/chunks/048121d433aa9175348c.js +0 -1
  108. package/assets/esri/core/workers/chunks/0f4a2bdf5bb2f4303b7f.js +0 -1
  109. package/assets/esri/core/workers/chunks/147e412de9972da16a1d.js +0 -1
  110. package/assets/esri/core/workers/chunks/1545bd7d6ac7800c71b6.js +0 -1
  111. package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +0 -1
  112. package/assets/esri/core/workers/chunks/385dd6466fd967ce3ae9.js +0 -1
  113. package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +0 -1
  114. package/assets/esri/core/workers/chunks/c43c273725b1a33712ec.js +0 -314
  115. package/assets/esri/core/workers/chunks/c8cd9a3175f516624842.js +0 -1
  116. package/assets/esri/core/workers/chunks/d630e64463687090db92.js +0 -1
  117. package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +0 -1
  118. package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +0 -1
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{addVerticalOffset as e}from"../attributes/VerticalOffset.glsl.js";import{ScreenSizePerspective as t,addScreenSizePerspectiveAlignment as o}from"../util/ScreenSizePerspective.glsl.js";import{addProjViewLocalOrigin as a,addCameraPosition as s,addViewNormal as i,addPixelRatio as r}from"../util/View.glsl.js";import{Float4BindUniform as n}from"../../shaderModules/Float4BindUniform.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as f}from"../../shaderModules/FloatPassUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";import{VertexAttribute as p}from"../../../lib/VertexAttribute.js";const d=.5;function u(u,v){u.include(t),u.attributes.add(p.POSITION,"vec3"),u.attributes.add(p.NORMAL,"vec3"),u.attributes.add(p.CENTEROFFSETANDDISTANCE,"vec4");const m=u.vertex;a(m,v),s(m,v),m.uniforms.add(new n("viewport",(e=>e.camera.fullViewport)),new f("polygonOffset",(e=>e.shaderPolygonOffset)),new l("cameraGroundRelative",(e=>e.camera.aboveGround?1:-1))),v.hasVerticalOffset&&e(m),m.constants.add("smallOffsetAngle","float",.984807753012208),m.code.add(c`struct ProjectHUDAux {
5
+ import{addVerticalOffset as e}from"../attributes/VerticalOffset.glsl.js";import{ScreenSizePerspective as t,addScreenSizePerspectiveAlignment as o}from"../util/ScreenSizePerspective.glsl.js";import{addProjViewLocalOrigin as a,addCameraPosition as s,addViewNormal as i,addPixelRatio as r}from"../util/View.glsl.js";import{Float4BindUniform as n}from"../../shaderModules/Float4BindUniform.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as f}from"../../shaderModules/FloatPassUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";import{VertexAttribute as p}from"../../../lib/VertexAttribute.js";const d=.5;function u(u,v){u.include(t),u.attributes.add(p.POSITION,"vec3"),u.attributes.add(p.NORMAL,"vec3"),u.attributes.add(p.CENTEROFFSETANDDISTANCE,"vec4");const m=u.vertex;a(m,v),s(m,v),m.uniforms.add(new n("viewport",(e=>e.camera.fullViewport)),new f("polygonOffset",(e=>e.shaderPolygonOffset)),new l("cameraGroundRelative",(e=>e.camera.aboveGround?1:-1))),v.hasVerticalOffset&&e(m),m.code.add(c`struct ProjectHUDAux {
6
6
  vec3 posModel;
7
7
  vec3 posView;
8
8
  vec3 vnormal;
@@ -2,12 +2,13 @@
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{ShaderOutput as t}from"../ShaderOutput.js";import{Rgba4FloatEncoding as a}from"../util/RgbaFloat16Encoding.glsl.js";import{glsl as o}from"../../shaderModules/glsl.js";function e(e,l){switch(l.output){case t.Shadow:case t.ShadowHighlight:case t.ShadowExcludeHighlight:case t.ViewshedShadow:e.fragment.include(a),e.fragment.code.add(o`float _calculateFragDepth(const in float depth) {
5
+ import{ShaderOutput as t}from"../ShaderOutput.js";import{Rgba4FloatEncoding as a}from"../util/RgbaFloat16Encoding.glsl.js";import{glsl as e}from"../../shaderModules/glsl.js";function o(o,d){switch(d.output){case t.Shadow:case t.ShadowHighlight:case t.ShadowExcludeHighlight:case t.ViewshedShadow:o.outputs.add("oFragDepth","vec4",0),o.fragment.include(a),o.fragment.code.add(e`float _calculateFragDepth(const in float depth) {
6
6
  const float SLOPE_SCALE = 2.0;
7
7
  const float BIAS = 20.0 * .000015259;
8
8
  float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
9
9
  return depth + SLOPE_SCALE * m + BIAS;
10
10
  }
11
11
  void outputDepth(float _linearDepth) {
12
- fragColor = floatToRgba4(_calculateFragDepth(_linearDepth));
13
- }`)}}export{e as OutputDepth};
12
+ float fragDepth = _calculateFragDepth(_linearDepth);
13
+ oFragDepth = floatToRgba4(fragDepth);
14
+ }`)}}export{o as OutputDepth};
@@ -2,43 +2,128 @@
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{IDENTITY as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as s}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Rgba4FloatEncoding as a}from"../util/RgbaFloat16Encoding.glsl.js";import{Float4BindUniform as t}from"../../shaderModules/Float4BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";import{IntegerBindUniform as i}from"../../shaderModules/IntegerBindUniform.js";import{Matrix4sDrawUniform as r}from"../../shaderModules/Matrix4sDrawUniform.js";import{Matrix4sPassUniform as d}from"../../shaderModules/Matrix4sPassUniform.js";import{Texture2DBindUniform as c}from"../../shaderModules/Texture2DBindUniform.js";import{NoParameters as p}from"../../../../../webgl/NoParameters.js";class n extends p{constructor(){super(...arguments),this.origin=s()}}class l extends n{}class v extends p{constructor(){super(...arguments),this.modelTransformation=e}}class h extends v{constructor(){super(...arguments),this.origin=s()}}function m(e,s){s.receiveShadows&&(e.fragment.uniforms.add(new d("shadowMapMatrix",((e,s)=>s.shadowMap.getShadowMapMatrices(e.origin)),4)),f(e))}function x(e,s){s.receiveShadows&&(e.fragment.uniforms.add(new r("shadowMapMatrix",((e,s)=>s.shadowMap.getShadowMapMatrices(e.origin)),4)),f(e))}function f(e){const s=e.fragment;s.include(a),s.uniforms.add(new c("shadowMap",(e=>e.shadowMap.depthTexture)),new i("numCascades",(e=>e.shadowMap.numCascades)),new t("cascadeDistances",(e=>e.shadowMap.cascadeDistances))).code.add(o`int chooseCascade(float depth, out mat4 mat) {
6
- vec4 distance = cascadeDistances;
7
- int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3;
8
- mat = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3];
9
- return i;
10
- }
11
- vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
12
- vec4 lv = mat * vec4(_vpos, 1.0);
13
- lv.xy /= lv.w;
14
- return 0.5 * lv.xyz + vec3(0.5);
15
- }
16
- vec2 cascadeCoordinates(int i, ivec2 textureSize, vec3 lvpos) {
17
- float xScale = float(textureSize.y) / float(textureSize.x);
18
- return vec2((float(i) + lvpos.x) * xScale, lvpos.y);
19
- }
20
- float readShadowMapDepth(ivec2 uv, sampler2D _depthTex) {
21
- return rgba4ToFloat(texelFetch(_depthTex, uv, 0));
22
- }
23
- float posIsInShadow(ivec2 uv, vec3 lvpos, sampler2D _depthTex) {
24
- return readShadowMapDepth(uv, _depthTex) < lvpos.z ? 1.0 : 0.0;
25
- }
26
- float filterShadow(vec2 uv, vec3 lvpos, ivec2 texSize, sampler2D _depthTex) {
27
- vec2 st = fract(uv * vec2(texSize) + vec2(0.5));
28
- ivec2 base = ivec2(uv * vec2(texSize) - vec2(0.5));
29
- float s00 = posIsInShadow(ivec2(base.x, base.y), lvpos, _depthTex);
30
- float s10 = posIsInShadow(ivec2(base.x + 1, base.y), lvpos, _depthTex);
31
- float s11 = posIsInShadow(ivec2(base.x + 1, base.y + 1), lvpos, _depthTex);
32
- float s01 = posIsInShadow(ivec2(base.x, base.y + 1), lvpos, _depthTex);
33
- return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
34
- }
35
- float readShadowMap(const in vec3 _vpos, float _linearDepth) {
36
- mat4 mat;
37
- int i = chooseCascade(_linearDepth, mat);
38
- if (i >= numCascades) { return 0.0; }
39
- vec3 lvpos = lightSpacePosition(_vpos, mat);
40
- if (lvpos.z >= 1.0 || lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) { return 0.0; }
41
- ivec2 size = textureSize(shadowMap, 0);
42
- vec2 uv = cascadeCoordinates(i, size, lvpos);
43
- return filterShadow(uv, lvpos, size, shadowMap);
44
- }`)}export{x as ReadShadowMapDraw,l as ReadShadowMapDrawParameters,v as ReadShadowMapParameters,m as ReadShadowMapPass,h as ReadShadowMapPassParameters};
5
+ import{IDENTITY as a}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadDepth as o}from"../output/ReadDepth.glsl.js";import{CameraSpace as t}from"../util/CameraSpace.glsl.js";import{Rgba4FloatEncoding as s}from"../util/RgbaFloat16Encoding.glsl.js";import{Float4BindUniform as r}from"../../shaderModules/Float4BindUniform.js";import{glsl as i,If as d}from"../../shaderModules/glsl.js";import{IntegerBindUniform as c}from"../../shaderModules/IntegerBindUniform.js";import{Matrix4sDrawUniform as p}from"../../shaderModules/Matrix4sDrawUniform.js";import{Matrix4sPassUniform as h}from"../../shaderModules/Matrix4sPassUniform.js";import{Texture2DBindUniform as l}from"../../shaderModules/Texture2DBindUniform.js";import{NoParameters as n}from"../../../../../webgl/NoParameters.js";class v extends n{constructor(){super(...arguments),this.origin=e()}}class u extends v{}class w extends n{constructor(){super(...arguments),this.modelTransformation=a}}class m extends w{constructor(){super(...arguments),this.origin=e()}}function x(a,e){e.receiveShadows&&(a.fragment.uniforms.add(new h("shadowMapMatrix",((a,e)=>e.shadowMap.getShadowMapMatrices(a.origin)),4)),S(a,e))}function M(a,e){e.receiveShadows&&(a.fragment.uniforms.add(new p("shadowMapMatrix",((a,e)=>e.shadowMap.getShadowMapMatrices(a.origin)),4)),S(a,e))}function S(a,e){const{fragment:p}=a;p.include(s);const h=e.worldPositionFromDepthMap??!1;h&&(p.include(o),a.include(t)),p.uniforms.add(new l("shadowMap",(a=>a.shadowMap.depthTexture)),new c("numCascades",(a=>a.shadowMap.numCascades)),new r("cascadeDistances",(a=>a.shadowMap.cascadeDistances))),p.code.add(i`
6
+ // Private
7
+
8
+ int chooseCascade(float depth, out mat4 mat) {
9
+ // choose correct cascade
10
+ vec4 distance = cascadeDistances;
11
+ int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3;
12
+
13
+ mat = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3];
14
+
15
+ return i;
16
+ }
17
+
18
+ vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
19
+ vec4 lv = mat * vec4(_vpos, 1.0);
20
+ lv.xy /= lv.w;
21
+ return 0.5 * lv.xyz + vec3(0.5);
22
+ }
23
+
24
+ vec2 cascadeCoordinates(int i, ivec2 textureSize, vec3 lvpos) {
25
+ float xScale = float(textureSize.y) / float(textureSize.x);
26
+ return vec2((float(i) + lvpos.x) * xScale, lvpos.y);
27
+ }
28
+
29
+ float readShadowMapDepth(ivec2 uv, sampler2D _shadowMap) {
30
+ return rgba4ToFloat(texelFetch(_shadowMap, uv, 0));
31
+ }
32
+
33
+ float posIsInShadow(ivec2 uv, float lvposZ, sampler2D _shadowMap) {
34
+ return readShadowMapDepth(uv, _shadowMap) < lvposZ ? 1.0 : 0.0;
35
+ }
36
+
37
+ float filterShadow(vec3 uvzShadow, sampler2D _shadowMap) {
38
+ ivec2 texSize = textureSize(_shadowMap, 0);
39
+ vec2 uv = uvzShadow.xy;
40
+ vec2 st = fract(uv * vec2(texSize) + vec2(0.5));
41
+ ivec2 base = ivec2(uv * vec2(texSize) - vec2(0.5));
42
+
43
+ float s00 = posIsInShadow(ivec2(base.x, base.y ), uvzShadow.z, _shadowMap);
44
+ float s10 = posIsInShadow(ivec2(base.x + 1, base.y ), uvzShadow.z, _shadowMap);
45
+ float s11 = posIsInShadow(ivec2(base.x + 1, base.y + 1), uvzShadow.z, _shadowMap);
46
+ float s01 = posIsInShadow(ivec2(base.x, base.y + 1), uvzShadow.z, _shadowMap);
47
+
48
+ return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
49
+ }
50
+
51
+ // Public
52
+
53
+ bool posIsInShadowF(vec3 uvzShadow, sampler2D _shadowMap) {
54
+ ivec2 texSize = textureSize(_shadowMap, 0);
55
+ ivec2 iuvShadow = ivec2(uvzShadow.xy * vec2(texSize));
56
+
57
+ float depthShadow = readShadowMapDepth(iuvShadow, _shadowMap);
58
+ return depthShadow < uvzShadow.z;
59
+ }
60
+
61
+ const vec3 invalidShadowmapUVZ = vec3(0.0,0.0,-1.0);
62
+
63
+ // Returns a uvzShadow: uv in shadowMap texture and z in lvpos
64
+ vec3 calculateShadowmapUVZ(
65
+ in vec3 _worldPos,
66
+ in float _linearDepth,
67
+ in sampler2D _shadowMap
68
+ )
69
+ {
70
+ mat4 shadowMatrix;
71
+ int i = chooseCascade(_linearDepth, shadowMatrix);
72
+ if (i >= numCascades) {
73
+ return invalidShadowmapUVZ;
74
+ }
75
+
76
+ vec3 lvpos = lightSpacePosition(_worldPos, shadowMatrix);
77
+
78
+ // vertex completely outside? -> no shadow
79
+ if (lvpos.z >= 1.0 || lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) {
80
+ return invalidShadowmapUVZ;
81
+ }
82
+
83
+ // calc coord in cascade texture
84
+ ivec2 texSize = textureSize(_shadowMap, 0);
85
+ vec2 uvShadow = cascadeCoordinates(i, texSize, lvpos);
86
+ return vec3(uvShadow, lvpos.z);
87
+ }
88
+
89
+ ${d(h,i`
90
+ vec3 calculateShadowmapUVZFromDepthMap_currentPixelPos(
91
+ in vec2 _uv,
92
+ in sampler2D _shadowMap,
93
+ in sampler2D _depthMap,
94
+ out vec4 currentPixelPos
95
+ ) {
96
+ // 1.0 is the clear value of depthMap, which means nothing has been drawn there and we should discard
97
+ float depth = depthFromTexture(_depthMap, _uv);
98
+ if (depth >= 1.0 || depth <= 0.0) {
99
+ return invalidShadowmapUVZ;
100
+ }
101
+
102
+ float currentPixelDepth = linearizeDepth(depth);
103
+ currentPixelPos = vec4(reconstructPosition(gl_FragCoord.xy, currentPixelDepth), 1.0);
104
+ vec4 worldSpacePos = inverseViewMatrix * currentPixelPos;
105
+
106
+ float linearDepth = -currentPixelDepth;
107
+
108
+ return calculateShadowmapUVZ(worldSpacePos.xyz, linearDepth, _shadowMap);
109
+ }
110
+
111
+ vec3 calculateShadowmapUVZFromDepthMap(
112
+ in vec2 _uv,
113
+ in sampler2D _shadowMap,
114
+ in sampler2D _depthMap
115
+ ) {
116
+ vec4 currentPixelPos;
117
+ return calculateShadowmapUVZFromDepthMap_currentPixelPos(_uv, _shadowMap, _depthMap, currentPixelPos);
118
+ }
119
+ `)}
120
+
121
+ float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
122
+ vec3 uvzShadow = calculateShadowmapUVZ(_worldPos, _linearDepth, shadowMap);
123
+ if (uvzShadow.z < 0.0) {
124
+ return 0.0;
125
+ }
126
+
127
+ return filterShadow(uvzShadow, shadowMap);
128
+ }
129
+ `)}export{M as ReadShadowMapDraw,u as ReadShadowMapDrawParameters,w as ReadShadowMapParameters,x as ReadShadowMapPass,m as ReadShadowMapPassParameters};
@@ -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{nativeArrayMaxSize as r,isUint16Array as t}from"../../../../core/typedArrayUtil.js";function a(a){if(a.length<r)return Array.from(a);if(Array.isArray(a))return Float64Array.from(a);if(!("BYTES_PER_ELEMENT"in a))return Array.from(a);switch(a.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(a);case 2:return t(a)?Uint16Array.from(a):Int16Array.from(a);case 4:return Float32Array.from(a);default:return Float64Array.from(a)}}export{a as cloneAttributeData};
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};
@@ -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{VertexAttribute as E}from"./VertexAttribute.js";const O=new Map([[E.POSITION,0],[E.NORMAL,1],[E.NORMALCOMPRESSED,1],[E.UV0,2],[E.COLOR,3],[E.COLORFEATUREATTRIBUTE,3],[E.SIZE,4],[E.TANGENT,4],[E.CENTEROFFSETANDDISTANCE,5],[E.SYMBOLCOLOR,5],[E.FEATUREATTRIBUTE,6],[E.INSTANCEFEATUREATTRIBUTE,6],[E.INSTANCECOLOR,7],[E.OBJECTANDLAYERIDCOLOR,7],[E.INSTANCEOBJECTANDLAYERIDCOLOR,7],[E.ROTATION,8],[E.INSTANCEMODEL,8],[E.INSTANCEMODELNORMAL,12],[E.INSTANCEMODELORIGINHI,11],[E.INSTANCEMODELORIGINLO,15]]);export{O as Default3D};
5
+ import{VertexAttribute as O}from"./VertexAttribute.js";const E=new Map([[O.POSITION,0],[O.NORMAL,1],[O.NORMALCOMPRESSED,1],[O.UV0,2],[O.UVI,2],[O.COLOR,3],[O.COLORFEATUREATTRIBUTE,3],[O.SIZE,4],[O.TANGENT,4],[O.CENTEROFFSETANDDISTANCE,5],[O.SYMBOLCOLOR,5],[O.FEATUREATTRIBUTE,6],[O.INSTANCEFEATUREATTRIBUTE,6],[O.INSTANCECOLOR,7],[O.OLIDCOLOR,7],[O.INSTANCEOBJECTANDLAYERIDCOLOR,7],[O.ROTATION,8],[O.INSTANCEMODEL,8],[O.INSTANCEMODELNORMAL,12],[O.INSTANCEMODELORIGINHI,11],[O.INSTANCEMODELORIGINLO,15]]);export{E as Default3D};
@@ -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{VertexAttribute as e}from"./VertexAttribute.js";import{DataType as r}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const O=[],o=[new t(e.POSITION,3,r.FLOAT,0,12)],m=[new t(e.POSITION,2,r.FLOAT,0,8)],n=[new t(e.POSITION,2,r.FLOAT,0,16),new t(e.UV0,2,r.FLOAT,8,16)];export{O as NoVertex,m as Pos2,n as Pos2Tex,o as Pos3};
5
+ import{VertexAttribute as e}from"./VertexAttribute.js";import{DataType as r}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const O=[],o=[new t(e.POSITION,3,r.FLOAT,0,12)],m=[new t(e.POSITION,2,r.FLOAT,0,8)],n=[new t(e.POSITION,2,r.FLOAT,0,12),new t(e.UV0,2,r.HALF_FLOAT,8,12)];export{O as NoVertex,m as Pos2,n as Pos2Tex,o as Pos3};
@@ -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{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as e}from"../../../../chunks/vec32.js";import{compactIndices as s,getContinuousIndexArray as n}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as h}from"./AttributeArray.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as g}from"./ContentObjectType.js";import{computeAttachmentOriginTriangles as a,computeAttachmentOriginLines as u,computeAttachmentOriginPoints as l}from"./geometryDataUtils.js";import{Object3DHighlightStateID as c}from"./Object3DStateID.js";import{assert as m}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";class f extends r{constructor(t,i,e=null,n=g.Mesh,h=null,o=-1){super(),this.material=t,this.mapPositions=e,this.type=n,this.objectAndLayerIdColor=h,this.edgeIndicesLength=o,this.highlights=new Set,this._highlightOptionsCounts=new Map,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[r,g]of i)this._attributes.set(r,{...g,indices:s(g.indices)}),r===d.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(r).indices.length:this.edgeIndicesLength)}instantiate(t={}){const i=new f(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)})),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:h(i.data)},this._attributes.set(t,i)),i}setAttributeData(t,i){const e=this._attributes.get(t);e&&this._attributes.set(t,{...e,exclusive:!0,data:i})}get indexCount(){const t=this._attributes.values().next().value?.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===g.Mesh?this._computeAttachmentOriginTriangles(t):this.type===g.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){const i=this.attributes.get(d.POSITION);return a(i,t)}_computeAttachmentOriginLines(t){const i=this.attributes.get(d.POSITION);return u(i,p(this.material.parameters,i),t)}_computeAttachmentOriginPoints(t){const i=this.attributes.get(d.POSITION);return l(i,t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(d.POSITION);if(!t||0===t.indices.length)return null;const i=this.type===g.Mesh?3:1;m(t.indices.length%i==0,"Indexing error: "+t.indices.length+" not divisible by "+i);const e=n(t.indices.length/i);return new o(e,i,t)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}get highlightNames(){return this._highlightOptionsCounts}get hasHighlights(){return this._highlightOptionsCounts.size>0}foreachHighlightOptions(t){this._highlightOptionsCounts.forEach(((i,e)=>t(e)))}allocateIdAndHighlight(t){const i=new c(t);return this.addHighlight(i)}addHighlight(t){this.highlights.add(t);const{highlightName:i}=t,e=(this._highlightOptionsCounts.get(i)??0)+1;return this._highlightOptionsCounts.set(i,e),t}removeHighlight(t){if(this.highlights.delete(t)){const{highlightName:i}=t,e=this._highlightOptionsCounts.get(i)??0;e<=1?this._highlightOptionsCounts.delete(i):this._highlightOptionsCounts.set(i,e-1)}}}function p(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i.indices.length>2}export{f as Geometry};
5
+ import{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as e}from"../../../../chunks/vec32.js";import{compactIndices as s,getContinuousIndexArray as n}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as h}from"./AttributeArray.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{computeAttachmentOriginTriangles as g,computeAttachmentOriginLines as u,computeAttachmentOriginPoints as l}from"./geometryDataUtils.js";import{Object3DHighlightStateID as c}from"./Object3DStateID.js";import{assert as m}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";import{webglDebugEnabled as f}from"../../../webgl/checkWebGLError.js";class p extends r{constructor(t,i,e=null,n=a.Mesh,h=null,o=-1){super(),this.material=t,this.mapPositions=e,this.type=n,this.objectAndLayerIdColor=h,this.edgeIndicesLength=o,this.highlights=new Set,this._highlightOptionsCounts=new Map,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[r,a]of i)this._attributes.set(r,{...a,indices:s(a.indices)}),r===d.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(r).indices.length:this.edgeIndicesLength)}instantiate(t={}){const i=new p(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)})),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:h(i.data)},this._attributes.set(t,i)),i}setAttributeData(t,i){const e=this._attributes.get(t);e?this._attributes.set(t,{...e,exclusive:!0,data:i}):f()&&console.warn(`Setting undefined attribute ${t} data`)}get indexCount(){const t=this._attributes.values().next().value?.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===a.Mesh?this._computeAttachmentOriginTriangles(t):this.type===a.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){const i=this.attributes.get(d.POSITION);return g(i,t)}_computeAttachmentOriginLines(t){const i=this.attributes.get(d.POSITION);return u(i,b(this.material.parameters,i),t)}_computeAttachmentOriginPoints(t){const i=this.attributes.get(d.POSITION);return l(i,t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(d.POSITION);if(!t||0===t.indices.length)return null;const i=this.type===a.Mesh?3:1;m(t.indices.length%i==0,"Indexing error: "+t.indices.length+" not divisible by "+i);const e=n(t.indices.length/i);return new o(e,i,t)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}get highlightNames(){return this._highlightOptionsCounts}get hasHighlights(){return this._highlightOptionsCounts.size>0}foreachHighlightOptions(t){this._highlightOptionsCounts.forEach(((i,e)=>t(e)))}allocateIdAndHighlight(t){const i=new c(t);return this.addHighlight(i)}addHighlight(t){this.highlights.add(t);const{highlightName:i}=t,e=(this._highlightOptionsCounts.get(i)??0)+1;return this._highlightOptionsCounts.set(i,e),t}removeHighlight(t){if(this.highlights.delete(t)){const{highlightName:i}=t,e=this._highlightOptionsCounts.get(i)??0;e<=1?this._highlightOptionsCounts.delete(i):this._highlightOptionsCounts.set(i,e-1)}}}function b(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i.indices.length>2}export{p as Geometry};
@@ -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{d as t,e as n,n as e,h as o,g as s,f as r,i as l,c as h,t as u}from"../../../../chunks/vec32.js";import{fromValues as c,create as a,clone as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as A,getContinuousIndexArray as M}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as b}from"./Geometry.js";import{assert as L}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";const j=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],x=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)x[6*Nt+t]=Nt;const C=new Array(36);for(let Nt=0;Nt<6;Nt++)C[6*Nt]=0,C[6*Nt+1]=1,C[6*Nt+2]=2,C[6*Nt+3]=2,C[6*Nt+4]=3,C[6*Nt+5]=0;function F(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=E[o][0]*n[0],e[3*o+1]=E[o][1]*n[1],e[3*o+2]=E[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,v,3,!0)],[d.NORMAL,new T(U,x,3)],[d.UV0,new T(V,C,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],z=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function B(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=G[o][0]*n[0],e[3*o+1]=G[o][1]*n[1],e[3*o+2]=G[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,q,3,!0)],[d.NORMAL,new T(D,z,3)]])}const k=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=a(),Q=a(),W=a(),X=a(),Y=a();t(K,k,J),t(Q,k,Z),n(W,K,Q),e(W,W),t(K,Z,J),t(Q,Z,H),n(X,K,Q),e(X,X),t(K,H,J),t(Q,H,k),n(Y,K,Q),e(Y,Y);const $=[k,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=$[o][0]*n[0],e[3*o+1]=$[o][1]*n[1],e[3*o+2]=$[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,tt,3,!0)],[d.NORMAL,new T(_,nt,3)]])}function ot(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,g=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const M=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],o=g[O+1][t+1],s=g[O+1][t];0===O?(M.push(n),M.push(o),M.push(s)):O===a-1?(M.push(n),M.push(e),M.push(o)):(M.push(n),M.push(e),M.push(o),M.push(o),M.push(s),M.push(n))}const I=[[d.POSITION,new T(p,M,3,!0)],[d.NORMAL,new T(i,M,3,!0)]];return s.uv&&I.push([d.UV0,new T(w,M,2,!0)]),s.offset&&(I[0][0]=d.OFFSET,I.push([d.POSITION,new T(Float64Array.from(s.offset),A(M.length),3,!0)])),new b(t,I)}function st(t,n,e,o){const s=rt(n,e,o);return new b(t,s)}function rt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)j.scale(s,c,t/j.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,j.add(s,3*n,s,3*e,s,r),j.scale(s,r,t/j.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(s);for(let c=0;c<u.length;c+=3)j.normalize(u,c);return[[d.POSITION,new T(m(s),r,3,!0)],[d.NORMAL,new T(u,r,3,!0)]]}function lt(t,n={}){const{normal:e,position:o,color:s,rotation:r,size:l,centerOffsetAndDistance:h,uvs:u,featureAttribute:c,objectAndLayerIdColor:a=null}=n,f=o?p(o):i(),g=e?p(e):w(0,0,1),O=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],m=null!=l&&2===l.length?l:[1,1],M=null!=r?[r]:[0],I=A(1),y=[[d.POSITION,new T(f,I,3,!0)],[d.NORMAL,new T(g,I,3,!0)],[d.COLOR,new T(O,I,4,!0)],[d.SIZE,new T(m,I,2)],[d.ROTATION,new T(M,I,1,!0)]];if(u&&y.push([d.UV0,new T(u,I,u.length)]),null!=h){const t=[h[0],h[1],h[2],h[3]];y.push([d.CENTEROFFSETANDDISTANCE,new T(t,I,4)])}if(c){const t=[c[0],c[1],c[2],c[3]];y.push([d.FEATUREATTRIBUTE,new T(t,I,4)])}return new b(t,y,null,R.Point,a)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[d.POSITION,new T(e,o,3,!0)],[d.NORMAL,new T(s,r,3,!0)],[d.UV0,new T(l,o,2,!0)],[d.COLOR,new T(h,r,4,!0)]];return new b(t,u)}function ct(t,n,e,o,s=!0,r=!0){let l=0;const h=n,u=t;let a=c(0,l,0),f=c(0,l+u,0),p=c(0,-1,0),i=c(0,1,0);o&&(l=u,f=c(0,0,0),a=c(0,l,0),p=c(0,1,0),i=c(0,-1,0));const w=[f,a],g=[p,i],m=e+2,A=Math.sqrt(u*u+h*h);if(o)for(let O=e-1;O>=0;O--){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(o)}else for(let O=0;O<e;O++){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(o)}const M=new Array,I=new Array;if(s){for(let t=3;t<w.length;t++)M.push(1),M.push(t-1),M.push(t),I.push(0),I.push(0),I.push(0);M.push(w.length-1),M.push(2),M.push(1),I.push(0),I.push(0),I.push(0)}if(r){for(let t=3;t<w.length;t++)M.push(t),M.push(t-1),M.push(0),I.push(t),I.push(t-1),I.push(1);M.push(0),M.push(2),M.push(w.length-1),I.push(1),I.push(2),I.push(g.length-1)}const y=O(3*m);for(let c=0;c<m;c++)y[3*c]=w[c][0],y[3*c+1]=w[c][1],y[3*c+2]=w[c][2];const N=O(3*m);for(let c=0;c<m;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];return[[d.POSITION,new T(y,M,3,!0)],[d.NORMAL,new T(N,I,3,!0)]]}function at(t,n,e,o,s,r=!0,l=!0){return new b(t,ct(n,e,o,s,r,l))}function ft(t,h,u,p,i,w,g){const m=i?f(i):c(1,0,0),A=w?f(w):c(0,0,0);g??=!0;const M=a();e(M,m);const I=a();o(I,M,Math.abs(h));const y=a();o(y,I,-.5),s(y,y,A);const N=c(0,1,0);Math.abs(1-r(M,N))<.2&&l(N,0,0,1);const P=a();n(P,M,N),e(P,P),n(N,P,M);const S=2*p+(g?2:0),R=p+(g?2:0),L=O(3*S),j=O(3*R),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(L[3*(S-2)]=y[0],L[3*(S-2)+1]=y[1],L[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,L[3*(S-1)]=L[3*(S-2)]+I[0],L[3*(S-1)+1]=L[3*(S-2)+1]+I[1],L[3*(S-1)+2]=L[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,j[3*(R-2)]=-M[0],j[3*(R-2)+1]=-M[1],j[3*(R-2)+2]=-M[2],j[3*(R-1)]=M[0],j[3*(R-1)+1]=M[1],j[3*(R-1)+2]=M[2]);const v=(t,n,e)=>{U[t]=n,V[t]=e};let x=0;const C=a(),F=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);o(C,N,Math.sin(t)),o(F,P,Math.cos(t)),s(C,C,F),j[3*n]=C[0],j[3*n+1]=C[1],j[3*n+2]=C[2],o(C,C,u),s(C,C,y),L[3*n]=C[0],L[3*n+1]=C[1],L[3*n+2]=C[2],E[2*n]=n/p,E[2*n+1]=0,L[3*(n+p)]=L[3*n]+I[0],L[3*(n+p)+1]=L[3*n+1]+I[1],L[3*(n+p)+2]=L[3*n+2]+I[2],E[2*(n+p)]=n/p,E[2*n+1]=1;const e=(n+1)%p;v(x++,n,n),v(x++,n+p,n),v(x++,e,e),v(x++,e,e),v(x++,n+p,n),v(x++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,S-2,R-2),v(x++,t,R-2),v(x++,n,R-2)}for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,t+p,R-1),v(x++,S-1,R-1),v(x++,n+p,R-1)}}const G=[[d.POSITION,new T(L,U,3,!0)],[d.NORMAL,new T(j,V,3,!0)],[d.UV0,new T(E,U,2,!0)]];return new b(t,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,L(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(r,u,a,f,p,w,g=c(0,0,0)){const m=u.length,A=O(a.length*m*3+(6*f.length||0)),M=O(a.length*m*3+(f?6:0)),S=new Array,R=new Array;let L=0,j=0;const E=i(),U=i(),V=i(),v=i(),x=i(),C=i(),F=i(),G=i(),D=i(),q=i(),z=i(),B=i(),k=i(),Z=I();l(D,0,1,0),t(U,a[1],a[0]),e(U,U),w?(s(G,a[0],g),e(V,G)):l(V,0,0,1),Mt(U,V,D,D,x,V,It),h(v,V),h(B,x);for(let t=0;t<f.length;t++)o(C,x,f[t][0]),o(G,V,f[t][2]),s(C,C,G),s(C,C,a[0]),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2];M[j++]=-U[0],M[j++]=-U[1],M[j++]=-U[2];for(let t=0;t<p.length;t++)S.push(p[t][0]>0?p[t][0]:-p[t][0]-1+f.length),S.push(p[t][1]>0?p[t][1]:-p[t][1]-1+f.length),S.push(p[t][2]>0?p[t][2]:-p[t][2]-1+f.length),R.push(0),R.push(0),R.push(0);let H=f.length;const J=f.length-1;for(let l=0;l<a.length;l++){let r=!1;if(l>0){h(E,U),l<a.length-1?(t(U,a[l+1],a[l]),e(U,U)):r=!0,s(q,E,U),e(q,q),s(z,a[l-1],v),y(a[l],q,Z);N(Z,P(z,E),G)?(t(G,G,a[l]),e(V,G),n(x,q,V),e(x,x)):Mt(q,v,B,D,x,V,It),h(v,V),h(B,x)}w&&(s(G,a[l],g),e(k,G));for(let t=0;t<m;t++)if(o(C,x,u[t][0]),o(G,V,u[t][1]),s(C,C,G),e(F,C),M[j++]=F[0],M[j++]=F[1],M[j++]=F[2],s(C,C,a[l]),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2],!r){const n=(t+1)%m;S.push(H+t),S.push(H+m+t),S.push(H+n),S.push(H+n),S.push(H+m+t),S.push(H+m+n);for(let t=0;t<6;t++){const n=S.length-6;R.push(S[n+t]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)o(C,x,f[t][0]),o(G,V,f[t][1]),s(C,C,G),s(C,C,K),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2];const Q=j/3;M[j++]=U[0],M[j++]=U[1],M[j++]=U[2];const W=H-m;for(let t=0;t<p.length;t++)S.push(p[t][0]>=0?H+p[t][0]:-p[t][0]-1+W),S.push(p[t][2]>=0?H+p[t][2]:-p[t][2]-1+W),S.push(p[t][1]>=0?H+p[t][1]:-p[t][1]-1+W),R.push(Q),R.push(Q),R.push(Q);const X=[[d.POSITION,new T(A,S,3,!0)],[d.NORMAL,new T(M,R,3,!0)]];return new b(r,X)}function wt(t,n,e,o){L(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),L(3===n[0].length,"createPolylineGeometry(): malformed vertex"),L(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),L(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[d.POSITION,new T(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([d.NORMAL,new T(t,r,3,!0)])}return o&&u.push([d.COLOR,new T(o,M(o.length/4),4)]),new b(t,u,null,R.Line)}function gt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new b(t,[[d.POSITION,new T(l,u,3,!0)]])}function Ot(t,n){const e=t.getMutableAttribute(d.POSITION).data;for(let o=0;o<e.length;o+=3){const t=e[o],s=e[o+1],r=e[o+2];l(yt,t,s,r),u(yt,yt,n),e[o]=yt[0],e[o+1]=yt[1],e[o+2]=yt[2]}}function mt(t,n=t){const e=t.attributes,o=e.get(d.POSITION).data,s=e.get(d.NORMAL).data;if(s){const t=n.getMutableAttribute(d.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(d.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function At(t,o,s,l,h){return!(Math.abs(r(o,t))>h)&&(n(s,t,o),e(s,s),n(l,s,t),e(l,l),!0)}function Mt(t,n,e,o,s,r,l){return At(t,n,s,r,l)||At(t,e,s,r,l)||At(t,o,s,r,l)}const It=.99619469809,yt=i();export{mt as cgToGIS,F as createBoxGeometry,at as createConeGeometry,ct as createConeGeometryData,ft as createCylinderGeometry,B as createDiamondGeometry,gt as createExtrudedTriangle,it as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,st as createPolySphereGeometry,wt as createPolylineGeometry,ot as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,pt as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
5
+ import{d as t,e as n,n as e,h as o,g as s,f as r,i as l,c as h,t as u}from"../../../../chunks/vec32.js";import{fromValues as c,create as a,clone as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as A,getContinuousIndexArray as M}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as b}from"./Geometry.js";import{assert as L}from"./Util.js";import{VertexAttribute as d}from"./VertexAttribute.js";const j=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],x=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)x[6*Nt+t]=Nt;const C=new Array(36);for(let Nt=0;Nt<6;Nt++)C[6*Nt]=0,C[6*Nt+1]=1,C[6*Nt+2]=2,C[6*Nt+3]=2,C[6*Nt+4]=3,C[6*Nt+5]=0;function F(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=E[o][0]*n[0],e[3*o+1]=E[o][1]*n[1],e[3*o+2]=E[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,v,3,!0)],[d.NORMAL,new T(U,x,3)],[d.UV0,new T(V,C,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],z=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function B(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=G[o][0]*n[0],e[3*o+1]=G[o][1]*n[1],e[3*o+2]=G[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,q,3,!0)],[d.NORMAL,new T(D,z,3)]])}const k=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=a(),Q=a(),W=a(),X=a(),Y=a();t(K,k,J),t(Q,k,Z),n(W,K,Q),e(W,W),t(K,Z,J),t(Q,Z,H),n(X,K,Q),e(X,X),t(K,H,J),t(Q,H,k),n(Y,K,Q),e(Y,Y);const $=[k,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=$[o][0]*n[0],e[3*o+1]=$[o][1]*n[1],e[3*o+2]=$[o][2]*n[2];return new b(t,[[d.POSITION,new T(e,tt,3,!0)],[d.NORMAL,new T(_,nt,3)]])}function ot(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,g=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const M=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],o=g[O+1][t+1],s=g[O+1][t];0===O?(M.push(n),M.push(o),M.push(s)):O===a-1?(M.push(n),M.push(e),M.push(o)):(M.push(n),M.push(e),M.push(o),M.push(o),M.push(s),M.push(n))}const I=[[d.POSITION,new T(p,M,3,!0)],[d.NORMAL,new T(i,M,3,!0)]];return s.uv&&I.push([d.UV0,new T(w,M,2,!0)]),s.offset&&(I[0][0]=d.OFFSET,I.push([d.POSITION,new T(Float64Array.from(s.offset),A(M.length),3,!0)])),new b(t,I)}function st(t,n,e,o){const s=rt(n,e,o);return new b(t,s)}function rt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)j.scale(s,c,t/j.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,j.add(s,3*n,s,3*e,s,r),j.scale(s,r,t/j.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(s);for(let c=0;c<u.length;c+=3)j.normalize(u,c);return[[d.POSITION,new T(m(s),r,3,!0)],[d.NORMAL,new T(u,r,3,!0)]]}function lt(t,{normal:n,position:e,color:o,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,objectAndLayerIdColor:c=null}={}){const a=e?p(e):i(),f=n?p(n):w(0,0,1),g=o?[255*o[0],255*o[1],255*o[2],o.length>3?255*o[3]:255]:[255,255,255,255],O=null!=r&&2===r.length?r:[1,1],m=null!=s?[s]:[0],M=A(1),I=[[d.POSITION,new T(a,M,3,!0)],[d.NORMAL,new T(f,M,3,!0)],[d.COLOR,new T(g,M,4,!0)],[d.SIZE,new T(O,M,2)],[d.ROTATION,new T(m,M,1,!0)]];if(h&&I.push([d.UVI,new T(h,M,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];I.push([d.CENTEROFFSETANDDISTANCE,new T(t,M,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];I.push([d.FEATUREATTRIBUTE,new T(t,M,4)])}return new b(t,I,null,R.Point,c)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[d.POSITION,new T(e,o,3,!0)],[d.NORMAL,new T(s,r,3,!0)],[d.UV0,new T(l,o,2,!0)],[d.COLOR,new T(h,r,4,!0)]];return new b(t,u)}function ct(t,n,e,o,s=!0,r=!0){let l=0;const h=n,u=t;let a=c(0,l,0),f=c(0,l+u,0),p=c(0,-1,0),i=c(0,1,0);o&&(l=u,f=c(0,0,0),a=c(0,l,0),p=c(0,1,0),i=c(0,-1,0));const w=[f,a],g=[p,i],m=e+2,A=Math.sqrt(u*u+h*h);if(o)for(let O=e-1;O>=0;O--){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(o)}else for(let O=0;O<e;O++){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(o)}const M=new Array,I=new Array;if(s){for(let t=3;t<w.length;t++)M.push(1),M.push(t-1),M.push(t),I.push(0),I.push(0),I.push(0);M.push(w.length-1),M.push(2),M.push(1),I.push(0),I.push(0),I.push(0)}if(r){for(let t=3;t<w.length;t++)M.push(t),M.push(t-1),M.push(0),I.push(t),I.push(t-1),I.push(1);M.push(0),M.push(2),M.push(w.length-1),I.push(1),I.push(2),I.push(g.length-1)}const y=O(3*m);for(let c=0;c<m;c++)y[3*c]=w[c][0],y[3*c+1]=w[c][1],y[3*c+2]=w[c][2];const N=O(3*m);for(let c=0;c<m;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];return[[d.POSITION,new T(y,M,3,!0)],[d.NORMAL,new T(N,I,3,!0)]]}function at(t,n,e,o,s,r=!0,l=!0){return new b(t,ct(n,e,o,s,r,l))}function ft(t,h,u,p,i,w,g){const m=i?f(i):c(1,0,0),A=w?f(w):c(0,0,0);g??=!0;const M=a();e(M,m);const I=a();o(I,M,Math.abs(h));const y=a();o(y,I,-.5),s(y,y,A);const N=c(0,1,0);Math.abs(1-r(M,N))<.2&&l(N,0,0,1);const P=a();n(P,M,N),e(P,P),n(N,P,M);const S=2*p+(g?2:0),R=p+(g?2:0),L=O(3*S),j=O(3*R),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(L[3*(S-2)]=y[0],L[3*(S-2)+1]=y[1],L[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,L[3*(S-1)]=L[3*(S-2)]+I[0],L[3*(S-1)+1]=L[3*(S-2)+1]+I[1],L[3*(S-1)+2]=L[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,j[3*(R-2)]=-M[0],j[3*(R-2)+1]=-M[1],j[3*(R-2)+2]=-M[2],j[3*(R-1)]=M[0],j[3*(R-1)+1]=M[1],j[3*(R-1)+2]=M[2]);const v=(t,n,e)=>{U[t]=n,V[t]=e};let x=0;const C=a(),F=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);o(C,N,Math.sin(t)),o(F,P,Math.cos(t)),s(C,C,F),j[3*n]=C[0],j[3*n+1]=C[1],j[3*n+2]=C[2],o(C,C,u),s(C,C,y),L[3*n]=C[0],L[3*n+1]=C[1],L[3*n+2]=C[2],E[2*n]=n/p,E[2*n+1]=0,L[3*(n+p)]=L[3*n]+I[0],L[3*(n+p)+1]=L[3*n+1]+I[1],L[3*(n+p)+2]=L[3*n+2]+I[2],E[2*(n+p)]=n/p,E[2*n+1]=1;const e=(n+1)%p;v(x++,n,n),v(x++,n+p,n),v(x++,e,e),v(x++,e,e),v(x++,n+p,n),v(x++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,S-2,R-2),v(x++,t,R-2),v(x++,n,R-2)}for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,t+p,R-1),v(x++,S-1,R-1),v(x++,n+p,R-1)}}const G=[[d.POSITION,new T(L,U,3,!0)],[d.NORMAL,new T(j,V,3,!0)],[d.UV0,new T(E,U,2,!0)]];return new b(t,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,L(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(r,u,a,f,p,w,g=c(0,0,0)){const m=u.length,A=O(a.length*m*3+(6*f.length||0)),M=O(a.length*m*3+(f?6:0)),S=new Array,R=new Array;let L=0,j=0;const E=i(),U=i(),V=i(),v=i(),x=i(),C=i(),F=i(),G=i(),D=i(),q=i(),z=i(),B=i(),k=i(),Z=I();l(D,0,1,0),t(U,a[1],a[0]),e(U,U),w?(s(G,a[0],g),e(V,G)):l(V,0,0,1),Mt(U,V,D,D,x,V,It),h(v,V),h(B,x);for(let t=0;t<f.length;t++)o(C,x,f[t][0]),o(G,V,f[t][2]),s(C,C,G),s(C,C,a[0]),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2];M[j++]=-U[0],M[j++]=-U[1],M[j++]=-U[2];for(let t=0;t<p.length;t++)S.push(p[t][0]>0?p[t][0]:-p[t][0]-1+f.length),S.push(p[t][1]>0?p[t][1]:-p[t][1]-1+f.length),S.push(p[t][2]>0?p[t][2]:-p[t][2]-1+f.length),R.push(0),R.push(0),R.push(0);let H=f.length;const J=f.length-1;for(let l=0;l<a.length;l++){let r=!1;if(l>0){h(E,U),l<a.length-1?(t(U,a[l+1],a[l]),e(U,U)):r=!0,s(q,E,U),e(q,q),s(z,a[l-1],v),y(a[l],q,Z);N(Z,P(z,E),G)?(t(G,G,a[l]),e(V,G),n(x,q,V),e(x,x)):Mt(q,v,B,D,x,V,It),h(v,V),h(B,x)}w&&(s(G,a[l],g),e(k,G));for(let t=0;t<m;t++)if(o(C,x,u[t][0]),o(G,V,u[t][1]),s(C,C,G),e(F,C),M[j++]=F[0],M[j++]=F[1],M[j++]=F[2],s(C,C,a[l]),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2],!r){const n=(t+1)%m;S.push(H+t),S.push(H+m+t),S.push(H+n),S.push(H+n),S.push(H+m+t),S.push(H+m+n);for(let t=0;t<6;t++){const n=S.length-6;R.push(S[n+t]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)o(C,x,f[t][0]),o(G,V,f[t][1]),s(C,C,G),s(C,C,K),A[L++]=C[0],A[L++]=C[1],A[L++]=C[2];const Q=j/3;M[j++]=U[0],M[j++]=U[1],M[j++]=U[2];const W=H-m;for(let t=0;t<p.length;t++)S.push(p[t][0]>=0?H+p[t][0]:-p[t][0]-1+W),S.push(p[t][2]>=0?H+p[t][2]:-p[t][2]-1+W),S.push(p[t][1]>=0?H+p[t][1]:-p[t][1]-1+W),R.push(Q),R.push(Q),R.push(Q);const X=[[d.POSITION,new T(A,S,3,!0)],[d.NORMAL,new T(M,R,3,!0)]];return new b(r,X)}function wt(t,n,e,o){L(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),L(3===n[0].length,"createPolylineGeometry(): malformed vertex"),L(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),L(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[d.POSITION,new T(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([d.NORMAL,new T(t,r,3,!0)])}return o&&u.push([d.COLOR,new T(o,M(o.length/4),4)]),new b(t,u,null,R.Line)}function gt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new b(t,[[d.POSITION,new T(l,u,3,!0)]])}function Ot(t,n){const e=t.getMutableAttribute(d.POSITION).data;for(let o=0;o<e.length;o+=3){const t=e[o],s=e[o+1],r=e[o+2];l(yt,t,s,r),u(yt,yt,n),e[o]=yt[0],e[o+1]=yt[1],e[o+2]=yt[2]}}function mt(t,n=t){const e=t.attributes,o=e.get(d.POSITION).data,s=e.get(d.NORMAL).data;if(s){const t=n.getMutableAttribute(d.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(d.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function At(t,o,s,l,h){return!(Math.abs(r(o,t))>h)&&(n(s,t,o),e(s,s),n(l,s,t),e(l,l),!0)}function Mt(t,n,e,o,s,r,l){return At(t,n,s,r,l)||At(t,e,s,r,l)||At(t,o,s,r,l)}const It=.99619469809,yt=i();export{mt as cgToGIS,F as createBoxGeometry,at as createConeGeometry,ct as createConeGeometryData,ft as createCylinderGeometry,B as createDiamondGeometry,gt as createExtrudedTriangle,it as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,st as createPolySphereGeometry,wt as createPolylineGeometry,ot as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,pt as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{textTextureAtlas as u}from"./testUtils.js";import{applyTextureResizeModuloCeil as m}from"./textureUtils.js";import{TaskPriority as p}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{TextureWrapMode as f,TextureSamplingMode as x}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";const T=4096;let k=class extends t{constructor(e){super(e),this.type=d.Texture,this.id=h(),this.events=new s,this._glTexture=null,this._atlas=new A(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return j=u.stableRendering?R:0,[T-R-j,T-R-j-y]}load(e){if(this._glTexture)return this._glTexture;const t=new w;return t.wrapMode=f.CLAMP_TO_EDGE,t.samplingMode=x.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new v(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new C(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find((e=>r.width>=e.x+s));if(null==n){if(r.height<r.nextY+i)return!1;n=new C(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+R,n=r+R+y;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=m(Math.max(h,1.5*s.width),T);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=m(Math.max(e,1.5*s.height),T);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<T){const e=m(1.5*s.width,T);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-R,t[1]-R,s.renderedWidth+2*R,s.renderedHeight+2*R),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return g;for(;this._needsRepack&&(this._canRepack||this._atlas.height<T&&this._atlas.height<T);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new b(this._atlas,e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([n({constructOnly:!0})],k.prototype,"view",void 0),e([n({type:Boolean})],k.prototype,"updating",void 0),k=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],k);const R=2,y=2;class b{constructor(e,t){this._atlas=e,this.textRenderer=t,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset/this._atlas.width,(this._yOffset+t)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class A{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=j}}class C{constructor(e){this.y=e,this.x=j}}let j=0;export{k as TextTextureAtlas};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{textTextureAtlas as u}from"./testUtils.js";import{applyTextureResizeModuloCeil as m}from"./textureUtils.js";import{TaskPriority as p}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{TextureWrapMode as f,TextureSamplingMode as x}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";const T=4096;let k=class extends t{constructor(e){super(e),this.type=d.Texture,this.id=n(),this.events=new s,this._glTexture=null,this._atlas=new A(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return j=u.stableRendering?R:0,[T-R-j,T-R-j-y]}load(e){if(this._glTexture)return this._glTexture;const t=new w;return t.wrapMode=f.CLAMP_TO_EDGE,t.samplingMode=x.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new v(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let n=r.cursors.get(i);if(!n){if(r.height<r.nextY+i)return!1;n=[new C(r.nextY)],r.cursors.set(i,n),r.nextY+=i}let h=n.find((e=>r.width>=e.x+s));if(null==h){if(r.height<r.nextY+i)return!1;h=new C(r.nextY),r.nextY+=i,n.push(h)}return e.setNewPosition(h),this._elements.set(t,e),this._elementsToRender.set(t,e),h.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,n=i+R,h=r+R+y;if(!this._addAtlasElement(e,t,n,h)){if(this._canRepack)this._reset();else if(s.width<n){const e=m(Math.max(n,1.5*s.width),T);this._resizeAtlas(e,s.height)}else{const e=s.nextY+h,t=m(Math.max(e,1.5*s.height),T);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<T){const e=m(1.5*s.width,T);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-R,t[1]-R,s.renderedWidth+2*R,s.renderedHeight+2*R),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return g;for(;this._needsRepack&&(this._canRepack||this._atlas.height<T&&this._atlas.height<T);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new b(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([h({constructOnly:!0})],k.prototype,"view",void 0),e([h({type:Boolean})],k.prototype,"updating",void 0),k=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],k);const R=2,y=2;class b{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class A{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=j}}class C{constructor(e){this.y=e,this.x=j}}let j=0;export{k as TextTextureAtlas};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",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.PREVPOSITION="prevPosition",e.NEXTPOSITION="nextPosition",e.SUBDIVISIONFACTOR="subdivisionFactor",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.OBJECTANDLAYERIDCOLOR="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.PREVPOSITION="prevPosition",e.NEXTPOSITION="nextPosition",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};
@@ -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{Default3D as e}from"./DefaultVertexAttributeLocations.js";import{Pos2 as r,Pos2Tex as t}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as o}from"./VertexArrayObject.js";import{BufferObject as s}from"../../../webgl/BufferObject.js";import{Usage as n,TextureSamplingMode as m}from"../../../webgl/enums.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";function u(r,t=c.Pos2,m=e,a=-1,f=1){const u=t===c.Pos2?new Float32Array([a,a,f,a,a,f,f,f]):new Float32Array([a,a,0,0,f,a,1,0,a,f,0,1,f,f,1,1]);return new o(r,m,new Map([["geometry",w.get(t)]]),new Map([["geometry",s.createVertex(r,n.STATIC_DRAW,u)]]))}const i=4;function p(e){const r=new f(i);return r.samplingMode=m.NEAREST,new a(e,r)}var c;!function(e){e[e.Pos2=0]="Pos2",e[e.Pos2Tex=1]="Pos2Tex"}(c||(c={}));const w=new Map([[c.Pos2,r],[c.Pos2Tex,t]]);export{c as Layout,p as createEmptyTexture,u as createQuadVAO};
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};
@@ -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 t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{reallocGrowthFactor as s}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as o,invert as n,transpose as h}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewMat4f64 as d,BufferViewVec3f64 as p,BufferViewMat3f as _,BufferViewVec2f as T,BufferViewVec4f64 as u,BufferViewVec4f as L,BufferViewVec4u8 as O,BufferViewUint8 as A}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as E}from"../../../support/mathUtils.js";import{newLayout as v}from"../../../support/buffer/InterleavedLayout.js";import{assert as M}from"../Util.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{initialCapacity as F}from"./RenderInstanceData.js";var S;function C(t){let e=v().mat4f64(I.LOCALTRANSFORM).mat4f64(I.GLOBALTRANSFORM).vec4f64(I.BOUNDINGSPHERE).vec3f64(I.MODELORIGIN).mat3f(I.INSTANCEMODEL).mat3f(I.INSTANCEMODELNORMAL).vec2f(I.MODELSCALEFACTORS);return t.includes(I.FEATUREATTRIBUTE)&&(e=e.vec4f(I.FEATUREATTRIBUTE)),t.includes(I.COLOR)&&(e=e.vec4u8(I.COLOR)),t.includes(I.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(I.OBJECTANDLAYERIDCOLOR)),e=e.u8(I.STATE).u8(I.LODLEVEL),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(S||(S={}));class R{constructor(t){this.localTransform=t.getField(I.LOCALTRANSFORM,d),this.globalTransform=t.getField(I.GLOBALTRANSFORM,d),this.modelOrigin=t.getField(I.MODELORIGIN,p),this.model=t.getField(I.INSTANCEMODEL,_),this.modelNormal=t.getField(I.INSTANCEMODELNORMAL,_),this.modelScaleFactors=t.getField(I.MODELSCALEFACTORS,T),this.boundingSphere=t.getField(I.BOUNDINGSPHERE,u),this.featureAttribute=t.getField(I.FEATUREATTRIBUTE,L),this.color=t.getField(I.COLOR,O),this.objectAndLayerIdColor=t.getField(I.OBJECTANDLAYERIDCOLOR,O),this.state=t.getField(I.STATE,A),this.lodLevel=t.getField(I.LODLEVEL,A)}}let b=class extends e{constructor(t,e){super(t),this.events=new i,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=C(e),this._capacity=F,this._buffer=this._layout.createBuffer(this._capacity),this._view=new R(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,S.ALLOCATED),this._size++,this.events.emit("instances-changed"),t}removeInstance(t){const e=this._view.state;M(t>=0&&t<this._capacity&&!!(e.get(t)&S.ALLOCATED),"invalid instance handle"),this._getStateFlag(t,S.ACTIVE)?this._setStateFlags(t,S.REMOVE):this.freeInstance(t),this.events.emit("instances-changed")}freeInstance(t){const e=this._view.state;M(t>=0&&t<this._capacity&&!!(e.get(t)&S.ALLOCATED),"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const e=this._view,s=y,i=N;e.localTransform.getMat(t,D),e.globalTransform.getMat(t,H);const a=c(H,H,D);m(s,a[12],a[13],a[14]),e.modelOrigin.setVec(t,s),o(i,a),e.model.setMat(t,i);const r=E(y,a);r.sort(),e.modelScaleFactors.set(t,0,r[1]),e.modelScaleFactors.set(t,1,r[2]),n(i,i),h(i,i),e.modelNormal.setMat(t,i),this._setStateFlags(t,S.TRANSFORM_CHANGED),this.events.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,N),s.modelOrigin.getVec(t,y),e[0]=N[0],e[1]=N[1],e[2]=N[2],e[3]=0,e[4]=N[3],e[5]=N[4],e[6]=N[5],e[7]=0,e[8]=N[6],e[9]=N[7],e[10]=N[8],e[11]=0,e[12]=y[0],e[13]=y[1],e[14]=y[2],e[15]=1}applyShaderTransformation(t,e){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){this._view.localTransform.getMat(t,e),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e)}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(y,this,t),e*=Math.max(y[0],y[1],y[2])),e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(y,this,t),e*=w(y[0],y[1],y[2])),e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}setObjectAndLayerIdColor(t,e){this._view.objectAndLayerIdColor.setVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,S.VISIBLE,e),this.events.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,S.VISIBLE)}setHighlight(t,e){const{_highlightOptionsMap:s}=this,i=s.get(t);e?e!==i&&(s.set(t,e),this._setStateFlag(t,S.HIGHLIGHT,!0),this.events.emit("instance-highlight-changed")):i&&(s.delete(t),this._setStateFlag(t,S.HIGHLIGHT,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(t){return this._getStateFlag(t,S.HIGHLIGHT)}geHighlightOptionsPrev(t){const e=this._highlightOptionsMapPrev.get(t)??null;return this._highlightOptionsMapPrev.delete(t),e}getHighlightName(t){const e=this.highlightOptionsMap.get(t)??null;return e?this._highlightOptionsMapPrev.set(t,e):this._highlightOptionsMapPrev.delete(t),e}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){this._capacity=Math.max(F,Math.floor(this._capacity*s)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new R(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&S.ALLOCATED;)e=e+1===this._capacity?0:e+1;return this._next=e+1===this._capacity?0:e+1,e}};function w(t,e,s){return Math.max(Math.min(t,e),Math.min(Math.max(t,e),s))}t([a({constructOnly:!0})],b.prototype,"shaderTransformation",void 0),t([a()],b.prototype,"_size",void 0),t([a({readOnly:!0})],b.prototype,"size",null),b=t([r("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],b);const y=f(),N=l(),D=g(),H=g();export{b as InstanceData,R as InstanceDataView,S as StateFlags};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{reallocGrowthFactor as s}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as o,invert as n,transpose as h}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewMat4f64 as d,BufferViewVec3f64 as p,BufferViewMat3f as _,BufferViewVec2f as T,BufferViewVec4f64 as u,BufferViewVec4f as L,BufferViewVec4u8 as O,BufferViewUint8 as A}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as E}from"../../../support/mathUtils.js";import{newLayout as v}from"../../../support/buffer/InterleavedLayout.js";import{assert as M}from"../Util.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{initialCapacity as F}from"./RenderInstanceData.js";var S;function b(t){let e=v().mat4f64(I.LOCALTRANSFORM).mat4f64(I.GLOBALTRANSFORM).vec4f64(I.BOUNDINGSPHERE).vec3f64(I.MODELORIGIN).mat3f(I.INSTANCEMODEL).mat3f(I.INSTANCEMODELNORMAL).vec2f(I.MODELSCALEFACTORS);return t.includes(I.FEATUREATTRIBUTE)&&(e=e.vec4f(I.FEATUREATTRIBUTE)),t.includes(I.COLOR)&&(e=e.vec4u8(I.COLOR)),t.includes(I.OLIDCOLOR)&&(e=e.vec4u8(I.OLIDCOLOR)),e=e.u8(I.STATE).u8(I.LODLEVEL),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(S||(S={}));class C{constructor(t){this.localTransform=t.getField(I.LOCALTRANSFORM,d),this.globalTransform=t.getField(I.GLOBALTRANSFORM,d),this.modelOrigin=t.getField(I.MODELORIGIN,p),this.model=t.getField(I.INSTANCEMODEL,_),this.modelNormal=t.getField(I.INSTANCEMODELNORMAL,_),this.modelScaleFactors=t.getField(I.MODELSCALEFACTORS,T),this.boundingSphere=t.getField(I.BOUNDINGSPHERE,u),this.featureAttribute=t.getField(I.FEATUREATTRIBUTE,L),this.color=t.getField(I.COLOR,O),this.objectAndLayerIdColor=t.getField(I.OLIDCOLOR,O),this.state=t.getField(I.STATE,A),this.lodLevel=t.getField(I.LODLEVEL,A)}}let R=class extends e{constructor(t,e){super(t),this.events=new i,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=b(e),this._capacity=F,this._buffer=this._layout.createBuffer(this._capacity),this._view=new C(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,S.ALLOCATED),this._size++,this.events.emit("instances-changed"),t}removeInstance(t){const e=this._view.state;M(t>=0&&t<this._capacity&&!!(e.get(t)&S.ALLOCATED),"invalid instance handle"),this._getStateFlag(t,S.ACTIVE)?this._setStateFlags(t,S.REMOVE):this.freeInstance(t),this.events.emit("instances-changed")}freeInstance(t){const e=this._view.state;M(t>=0&&t<this._capacity&&!!(e.get(t)&S.ALLOCATED),"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const e=this._view,s=y,i=H;e.localTransform.getMat(t,N),e.globalTransform.getMat(t,D);const a=c(D,D,N);m(s,a[12],a[13],a[14]),e.modelOrigin.setVec(t,s),o(i,a),e.model.setMat(t,i);const r=E(y,a);r.sort(),e.modelScaleFactors.set(t,0,r[1]),e.modelScaleFactors.set(t,1,r[2]),n(i,i),h(i,i),e.modelNormal.setMat(t,i),this._setStateFlags(t,S.TRANSFORM_CHANGED),this.events.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,H),s.modelOrigin.getVec(t,y),e[0]=H[0],e[1]=H[1],e[2]=H[2],e[3]=0,e[4]=H[3],e[5]=H[4],e[6]=H[5],e[7]=0,e[8]=H[6],e[9]=H[7],e[10]=H[8],e[11]=0,e[12]=y[0],e[13]=y[1],e[14]=y[2],e[15]=1}applyShaderTransformation(t,e){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){this._view.localTransform.getMat(t,e),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,t,e)}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(y,this,t),e*=Math.max(y[0],y[1],y[2])),e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(y,this,t),e*=w(y[0],y[1],y[2])),e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}setObjectAndLayerIdColor(t,e){this._view.objectAndLayerIdColor.setVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,S.VISIBLE,e),this.events.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,S.VISIBLE)}setHighlight(t,e){const{_highlightOptionsMap:s}=this,i=s.get(t);e?e!==i&&(s.set(t,e),this._setStateFlag(t,S.HIGHLIGHT,!0),this.events.emit("instance-highlight-changed")):i&&(s.delete(t),this._setStateFlag(t,S.HIGHLIGHT,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(t){return this._getStateFlag(t,S.HIGHLIGHT)}geHighlightOptionsPrev(t){const e=this._highlightOptionsMapPrev.get(t)??null;return this._highlightOptionsMapPrev.delete(t),e}getHighlightName(t){const e=this.highlightOptionsMap.get(t)??null;return e?this._highlightOptionsMapPrev.set(t,e):this._highlightOptionsMapPrev.delete(t),e}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){this._capacity=Math.max(F,Math.floor(this._capacity*s)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new C(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&S.ALLOCATED;)e=e+1===this._capacity?0:e+1;return this._next=e+1===this._capacity?0:e+1,e}};function w(t,e,s){return Math.max(Math.min(t,e),Math.min(Math.max(t,e),s))}t([a({constructOnly:!0})],R.prototype,"shaderTransformation",void 0),t([a()],R.prototype,"_size",void 0),t([a({readOnly:!0})],R.prototype,"size",null),R=t([r("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],R);const y=f(),H=l(),N=g(),D=g();export{R as InstanceData,C as InstanceDataView,S as StateFlags};
@@ -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 r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends p{constructor(r){super(r,m),this._configuration=new f,this.produces=new Map([[o.OPAQUE_MATERIAL,r=>e(r)&&!this.transparent],[o.TRANSPARENT_MATERIAL,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[o.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new l(r)}createBufferWriter(){return new a(n)}}class l extends i{beginSlot(r){return this.getTechnique(h,r)}}class m extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m as Parameters};
5
+ import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUvLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends p{constructor(r){super(r,m),this._configuration=new f,this.produces=new Map([[o.OPAQUE_MATERIAL,r=>e(r)&&!this.transparent],[o.TRANSPARENT_MATERIAL,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[o.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new l(r)}createBufferWriter(){return new a(n)}}class l extends i{beginSlot(r){return this.getTechnique(h,r)}}class m extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m 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{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 T}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class A extends m{constructor(t){super(t,P),this._configuration=new T,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 this._configuration.output=t,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]>=O}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.OBJECTANDLAYERIDCOLOR),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 this._configuration.output=t,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};
@@ -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{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{VertexAttribute as O}from"../lib/VertexAttribute.js";const t=e().vec3f(O.POSITION),f=e().vec3f(O.POSITION).vec2f(O.UV0),r=e().vec3f(O.POSITION).vec4u8(O.COLOR),I=e().vec3f(O.POSITION).vec2f(O.UV0).vec4u8(O.OBJECTANDLAYERIDCOLOR);export{r as PositionColorLayout,t as PositionLayout,f as PositionUVLayout,I as PositionUVLayoutObjectAndLayerId};
5
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{VertexAttribute as O}from"../lib/VertexAttribute.js";const t=e().vec3f(O.POSITION),f=e().vec3f(O.POSITION).vec2f16(O.UV0),r=e().vec3f(O.POSITION).vec4u8(O.COLOR),I=e().vec3f(O.POSITION).vec2f16(O.UV0).vec4u8(O.OLIDCOLOR);export{r as PositionColorLayout,t as PositionLayout,f as PositionUvLayout,I as PositionUvOlidLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,i as t,c as r,n as i,d as s,l as a,h as o,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as l,create as u,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as O}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as S,AlphaDiscardMode as w}from"../lib/basicInterfaces.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as A}from"../lib/Material.js";import{OITPolygonOffsetLimit as R}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as I}from"../lib/RayIntersections.js";import{RenderSlot as P}from"../lib/RenderSlot.js";import{VertexAttribute as C}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as j}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as L}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as N,DefaultMaterialPassParameters as E}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as V}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as B}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as z}from"../../../../webscene/support/AlphaCutoff.js";class q extends A{constructor(e,t){super(e,k),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[P.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.transparent],[P.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.transparent&&this.parameters.writeDepth],[P.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new V(t.spherical)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t?1:i[3])>=z}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,t){const r=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:a}=r;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!r.normalTextureId,this._configuration.hasColorTexture=!!r.textureId,this._configuration.hasVertexTangents=!i&&r.hasVertexTangents,this._configuration.instanced=r.isInstanced,this._configuration.instancedDoublePrecision=r.instancedDoublePrecision,this._configuration.vvSize=!!r.vvSize,this._configuration.hasVerticalOffset=null!=r.verticalOffset,this._configuration.hasScreenSizePerspective=null!=r.screenSizePerspective,this._configuration.hasSlicePlane=r.hasSlicePlane,this._configuration.alphaDiscardMode=r.textureAlphaMode,this._configuration.normalType=i?_.Attribute:r.normalType,this._configuration.transparent=this.transparent,this._configuration.writeDepth=r.writeDepth,null!=r.customDepthTest&&(this._configuration.customDepthTest=r.customDepthTest),this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=r.hasSlicePlane?S.None:r.cullFace,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=r.modelTransformation,this._configuration.hasVertexColors=r.hasVertexColors,this._configuration.hasSymbolColors=r.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===a?b.View:s&&"winding-order"===a?b.WindingOrder:b.None,this._configuration.instancedColor=r.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.receiveShadows=r.receiveShadows,this._configuration.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!r.vvColor,this._configuration.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,this._configuration.pbrMode=r.usePBR?r.isSchematic?O.Schematic:O.Normal:O.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!r.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=r.emissiveTextureId?v.Texture:r.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!r.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<R,this._configuration.snowCover=W(t),this._configuration.hasColorTextureTransform=!!r.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,l,u,h,m,p){if(null!=this.parameters.verticalOffset){const e=u.camera;t(K,l[12],l[13],l[14]);let p=null;switch(u.viewingMode){case f.Global:p=i(J,K);break;case f.Local:p=r(J,Y)}let d=0;const g=s(X,K,e.eye),T=a(g),x=o(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=L(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),o(p,p,d),c(Q,p,u.transform.inverseRotation),h=s(G,h,Q),m=s(H,m,Q)}I(e,u,h,m,j(u.verticalOffset),p)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new D(this._vertexBufferLayout)}get transparent(){const{parameters:{drivenOpacity:e,opacity:t,externalColor:[r,i,s,a],layerOpacity:o,texture:n,textureId:c,textureAlphaMode:l,colorMixMode:u}}=this;return e||t<1&&"replace"!==u||a<1&&"ignore"!==u||o<1||(null!=n||null!=c)&&l!==w.Opaque&&l!==w.Mask&&"replace"!==u}}class U extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const i=e.camera.viewInverseTransposeMatrix;return t(r.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?B:N,e)}}class k extends E{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function F(e){const t=m().vec3f(C.POSITION);e.normalType===_.Compressed?t.vec2i16(C.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(C.NORMAL),e.hasVertexTangents&&t.vec4f(C.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(C.UV0),e.hasVertexColors&&t.vec4u8(C.COLOR),e.hasSymbolColors&&t.vec4u8(C.SYMBOLCOLOR),M()&&t.vec4u8(C.OBJECTANDLAYERIDCOLOR),t}const G=u(),H=u(),Y=h(0,0,1),J=u(),Q=u(),K=u(),X=u();export{U as DefaultGLMaterial,q as DefaultMaterial,k as DefaultMaterialParameters};
5
+ import{p as e,i as t,c as r,n as i,d as s,l as a,h as o,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as l,create as u,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as O}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as S,AlphaDiscardMode as w}from"../lib/basicInterfaces.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as R}from"../lib/Material.js";import{OITPolygonOffsetLimit as A}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as I}from"../lib/RayIntersections.js";import{RenderSlot as P}from"../lib/RenderSlot.js";import{VertexAttribute as j}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as C}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as L}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as N,DefaultMaterialPassParameters as E}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as V}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as B}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as z}from"../../../../webscene/support/AlphaCutoff.js";class q extends R{constructor(e,t){super(e,k),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[P.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.transparent],[P.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.transparent&&this.parameters.writeDepth],[P.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new V(t.spherical)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t?1:i[3])>=z}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,t){const r=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:a}=r;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!r.normalTextureId,this._configuration.hasColorTexture=!!r.textureId,this._configuration.hasVertexTangents=!i&&r.hasVertexTangents,this._configuration.instanced=r.isInstanced,this._configuration.instancedDoublePrecision=r.instancedDoublePrecision,this._configuration.vvSize=!!r.vvSize,this._configuration.hasVerticalOffset=null!=r.verticalOffset,this._configuration.hasScreenSizePerspective=null!=r.screenSizePerspective,this._configuration.hasSlicePlane=r.hasSlicePlane,this._configuration.alphaDiscardMode=r.textureAlphaMode,this._configuration.normalType=i?_.Attribute:r.normalType,this._configuration.transparent=this.transparent,this._configuration.writeDepth=r.writeDepth,null!=r.customDepthTest&&(this._configuration.customDepthTest=r.customDepthTest),this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=r.hasSlicePlane?S.None:r.cullFace,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=r.modelTransformation,this._configuration.hasVertexColors=r.hasVertexColors,this._configuration.hasSymbolColors=r.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===a?b.View:s&&"winding-order"===a?b.WindingOrder:b.None,this._configuration.instancedColor=r.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.receiveShadows=r.receiveShadows,this._configuration.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!r.vvColor,this._configuration.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,this._configuration.pbrMode=r.usePBR?r.isSchematic?O.Schematic:O.Normal:O.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!r.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=r.emissiveTextureId?v.Texture:r.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!r.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<A,this._configuration.snowCover=W(t),this._configuration.hasColorTextureTransform=!!r.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,l,u,h,m,p){if(null!=this.parameters.verticalOffset){const e=u.camera;t(K,l[12],l[13],l[14]);let p=null;switch(u.viewingMode){case f.Global:p=i(Y,K);break;case f.Local:p=r(Y,Q)}let d=0;const g=s(X,K,e.eye),T=a(g),x=o(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=D(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),o(p,p,d),c(J,p,u.transform.inverseRotation),h=s(G,h,J),m=s(H,m,J)}I(e,u,h,m,C(u.verticalOffset),p)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new L(this._vertexBufferLayout)}get transparent(){const{parameters:{drivenOpacity:e,opacity:t,externalColor:[r,i,s,a],layerOpacity:o,texture:n,textureId:c,textureAlphaMode:l,colorMixMode:u}}=this;return e||t<1&&"replace"!==u||a<1&&"ignore"!==u||o<1||(null!=n||null!=c)&&l!==w.Opaque&&l!==w.Mask&&"replace"!==u}}class U extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const i=e.camera.viewInverseTransposeMatrix;return t(r.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?B:N,e)}}class k extends E{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function F(e){const t=m().vec3f(j.POSITION);e.normalType===_.Compressed?t.vec2i16(j.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(j.NORMAL),e.hasVertexTangents&&t.vec4f(j.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f16(j.UV0),e.hasVertexColors&&t.vec4u8(j.COLOR),e.hasSymbolColors&&t.vec4u8(j.SYMBOLCOLOR),M()&&t.vec4u8(j.OLIDCOLOR),t}const G=u(),H=u(),Q=h(0,0,1),Y=u(),J=u(),K=u(),X=u();export{U as DefaultGLMaterial,q as DefaultMaterial,k as DefaultMaterialParameters};