@arcgis/core 5.2.0-next.163 → 5.2.0-next.165

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 (216) hide show
  1. package/Graphic.d.ts +47 -14
  2. package/PopupTemplate.js +1 -1
  3. package/WebScene.d.ts +3 -0
  4. package/analysis/LineOfSightAnalysis.d.ts +1 -1
  5. package/analysis/LineOfSightAnalysisObserver.d.ts +5 -4
  6. package/analysis/LineOfSightAnalysisTarget.d.ts +4 -4
  7. package/analysis/Viewshed.d.ts +4 -4
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{97d6ef9e34a43ad2e556.js → 02e10f44edf911832c2a.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{97b5f4302fb867c829f4.js → 07f7177bfaf9de73bc25.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{612345f17f5eeb99ea8f.js → 0d9c4c6c571ce26d356b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{8e19629899a5becf8e19.js → 150e7a7bd5df25693da7.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{12a7997a40c77f5c9160.js → 151e5799ede763a03ee2.js} +1 -1
  14. package/assets/esri/core/workers/chunks/196979cc6a765be3c5cd.js +1 -0
  15. package/assets/esri/core/workers/chunks/1ab59a97ffa49e9e1659.js +1 -0
  16. package/assets/esri/core/workers/chunks/{8715661a838361d4211a.js → 1b24a40c0fa197014873.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{83f29a159b8b5197e76a.js → 266c90d8d56a2da42fcf.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{b1d989b72203113a06fe.js → 2a36fe3f3f257a779a1b.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{fcaf9450642fcef83286.js → 3048e74e6246324ce6fc.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{95b82cbbe355266c65d7.js → 30af63b3b750142faadb.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{74137ffec5265628c33b.js → 36c780a9527c75b36725.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{6a0ec102962d2c7b4368.js → 40d803584eeade4df433.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{a546ec82ba149e12f7bf.js → 41773d858e212468db88.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{129e04d24ced77c9bb6d.js → 49b967d89d2841cea675.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{b59aaf30c7fe2c8d1aaa.js → 4b99b4cf729881e616bc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{2e096537a3a5555a4a93.js → 4cb751dc8d00bdaeb04c.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a09d2e1e2540921e4717.js → 4d3d7ec407ee5cd5f036.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{85bba551057366cd00ae.js → 4db829a0238024736fe6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{2c626f525f3483c03477.js → 548b8f74a6883e364931.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{25a3bd8bede2d07d3a54.js → 5af8fb4ec2c72697e35b.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{340256866f524cb069f6.js → 5d2f043ebe1051326c56.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{3f46acfda693c70abbdd.js → 61552b4b8111a8624d84.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{e653c81ffb3d818645dd.js → 632fdf1d95ad69109427.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{434a8ba841a59e0deab9.js → 67e533748435253aaba6.js} +1 -1
  35. package/assets/esri/core/workers/chunks/69d5f8ef78b9b8b3d33d.js +1 -0
  36. package/assets/esri/core/workers/chunks/{feb41abc03d677df6f73.js → 6b9961261241fdce0e94.js} +1 -1
  37. package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +1 -0
  38. package/assets/esri/core/workers/chunks/{8aa80b892fde552577e8.js → 700b1d5bc67b7e1b3ff3.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{e251921bc5367258c4d2.js → 710b8251a59884aee31e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{f528ac5c648ca6a98582.js → 711cfb84659cb4437679.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{af349c7bc8ef41a0e1bd.js → 7748c2886d0122b40eeb.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{8a7b02037151767542f1.js → 7dbf4c7480bf9c72820d.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 7dfbc31f3b56728485a4.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{c19f238b55ff2893f7c2.js → 82a022cc21364c9a8539.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{5cb26bbaa08114aec5ce.js → 89cc1a5539b82fb46216.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{8ab57cb1bfd3dc8d3c2a.js → 8b8118ab56cc808b5a71.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{542e5640ea1b80ef801a.js → 9189dfe19a2a2ccd5173.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{f74ae0eff3f08978e607.js → 9f358c7b052cdc0ac06f.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{ee08ae5b73439a1ff666.js → a163c6005aba3378edaa.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{ec9a2425b4a498054a19.js → a17673e691ced46a90d3.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{72bd866df89b8d92e247.js → a43b33955aa78a2a8deb.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{46c5371c7a627537098c.js → a88f346786b04bd194dc.js} +6 -6
  53. package/assets/esri/core/workers/chunks/{092e311cb7aea92a6a26.js → acb265a22be5e12f38e5.js} +1 -1
  54. package/assets/esri/core/workers/chunks/ad96132bc89671e595f3.js +1 -0
  55. package/assets/esri/core/workers/chunks/{9e8f012a56237fc8285f.js → aea44253c80493ef5755.js} +1 -1
  56. package/assets/esri/core/workers/chunks/b5b9d42e1f84ee82429c.js +1 -0
  57. package/assets/esri/core/workers/chunks/c046c4fc934bc6f54c69.js +1 -0
  58. package/assets/esri/core/workers/chunks/{c72a904e01dc8c17d992.js → c47d095434d09b5f10c6.js} +1 -1
  59. package/assets/esri/core/workers/chunks/c4b7111dcedd9d6e1c2a.js +1 -0
  60. package/assets/esri/core/workers/chunks/{81cad8d2f62a5f671c55.js → cb4db5489388559d6bd9.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{bbd44ac63d2a317d8ed9.js → cc794bb94ebc1cb66024.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{be308db5b61a7246edfe.js → cc94bf05b235e65291fc.js} +1 -1
  63. package/assets/esri/core/workers/chunks/d4af9faa5d901274fad2.js +1 -0
  64. package/assets/esri/core/workers/chunks/d77c68e0fc3b259bf4f9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{fc5a36e54929e03efa86.js → dba5f44c4e4a3f075df2.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{1f43e06dcfe56229bb0f.js → debe45e792212682b304.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8414ffd937c1099e0bbc.js → e6d10136bc08aef255ff.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{45fd2b456a6997584ca1.js → f8379cd45f750f28a3d8.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{709e019885822b1f6f3e.js → f905f1a1aa4c123cbe83.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{a2fcbc494333376192aa.js → f9c80e9fc349db4873e8.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{e0351753f6b4d1adf11e.js → fc0dbb588a4062615cb6.js} +1 -1
  72. package/assets/esri/core/workers/chunks/feb4f8c807bb0dca488f.js +1 -0
  73. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  74. package/chunks/GlobalIllumination.glsl.js +17 -47
  75. package/config.js +1 -1
  76. package/core/workers/WorkerFallback.js +4 -2
  77. package/core/workers/workerFactory.js +1 -1
  78. package/core/workers/workers.js +4 -2
  79. package/form/elements/inputs.d.ts +126 -25
  80. package/form/elements/inputs.js +1 -1
  81. package/form/elements.d.ts +1 -0
  82. package/geometry/support/clipRay.js +1 -1
  83. package/geometry/support/plane.js +1 -1
  84. package/graphic/AnnotationFeatureGraphicOrigin.d.ts +49 -9
  85. package/graphic/BuildingGraphicOrigin.d.ts +49 -0
  86. package/graphic/CSVGraphicOrigin.d.ts +42 -9
  87. package/graphic/CatalogGraphicOrigin.d.ts +42 -9
  88. package/graphic/DimensionFeatureGraphicOrigin.d.ts +42 -9
  89. package/graphic/FeatureGraphicOrigin.d.ts +42 -9
  90. package/graphic/GeoJSONGraphicOrigin.d.ts +42 -9
  91. package/graphic/GeoRSSGraphicOrigin.d.ts +42 -9
  92. package/graphic/GraphicOrigin.d.ts +52 -12
  93. package/graphic/ImageryGraphicOrigin.d.ts +42 -9
  94. package/graphic/ImageryTileGraphicOrigin.d.ts +42 -9
  95. package/graphic/KMLGraphicOrigin.d.ts +47 -10
  96. package/graphic/KnowledgeGraphGraphicOrigin.d.ts +49 -1
  97. package/graphic/LinkChartGraphicOrigin.d.ts +49 -1
  98. package/graphic/MapImageGraphicOrigin.d.ts +49 -1
  99. package/graphic/MapNotesGraphicOrigin.d.ts +48 -1
  100. package/graphic/OGCFeatureGraphicOrigin.d.ts +42 -9
  101. package/graphic/OrientedImageryGraphicOrigin.d.ts +42 -9
  102. package/graphic/ParquetGraphicOrigin.d.ts +42 -9
  103. package/graphic/PointCloudGraphicOrigin.d.ts +43 -0
  104. package/graphic/SceneGraphicOrigin.d.ts +43 -0
  105. package/graphic/SketchGraphicOrigin.d.ts +43 -0
  106. package/graphic/StreamGraphicOrigin.d.ts +43 -0
  107. package/graphic/SubtypeGroupGraphicOrigin.d.ts +49 -1
  108. package/graphic/TileGraphicOrigin.d.ts +49 -1
  109. package/graphic/VectorTileGraphicOrigin.d.ts +43 -14
  110. package/graphic/VoxelGraphicOrigin.d.ts +43 -0
  111. package/graphic/WCSGraphicOrigin.d.ts +43 -0
  112. package/graphic/WFSGraphicOrigin.d.ts +42 -9
  113. package/graphic/getGraphicOriginTitle.d.ts +21 -3
  114. package/kernel.js +1 -1
  115. package/layers/GaussianSplatLayer.d.ts +2 -1
  116. package/layers/GeoJSONLayer.d.ts +2 -107
  117. package/layers/ParquetLayer.d.ts +24 -1
  118. package/layers/ParquetLayer.js +1 -1
  119. package/layers/SceneLayer.d.ts +40 -16
  120. package/layers/ViewshedLayer.d.ts +10 -4
  121. package/layers/WMSLayer.d.ts +2 -69
  122. package/layers/mixins/ReloadableLayer.js +1 -1
  123. package/layers/mixins/SublayersOwner.js +1 -1
  124. package/layers/mixins/TemporalLayer.d.ts +70 -48
  125. package/layers/mixins/TiledImagery.d.ts +0 -11
  126. package/layers/orientedImagery/transformations/utils.js +1 -1
  127. package/layers/save/featureLayerUtils.js +1 -1
  128. package/layers/save/imageryUtils.js +1 -1
  129. package/layers/save/mapImageLayerUtils.js +1 -1
  130. package/layers/save/mediaLayerUtils.js +1 -1
  131. package/layers/save/parquetLayerUtils.js +2 -0
  132. package/layers/save/streamLayerUtils.js +1 -1
  133. package/layers/support/LabelClass.d.ts +8 -2
  134. package/layers/support/Sublayer.js +1 -1
  135. package/layers/support/SubtypeSublayer.js +1 -1
  136. package/layers/support/layerUtils.js +1 -1
  137. package/layers/support/layersMapping.js +1 -1
  138. package/package.json +2 -2
  139. package/popup/content.d.ts +38 -1
  140. package/popup/content.js +1 -1
  141. package/portal/schemas/definitions.js +1 -1
  142. package/portal/schemas/webScene.js +1 -1
  143. package/smartMapping/popup/support/clusterUtils.js +1 -1
  144. package/smartMapping/popup/support/utils.js +2 -2
  145. package/smartMapping/renderers/size.js +1 -1
  146. package/smartMapping/renderers/support/regenerateUtils.js +1 -1
  147. package/support/timeUtils.d.ts +11 -0
  148. package/symbols/cim/CIMCursor.js +1 -1
  149. package/tables/elements.d.ts +1 -0
  150. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  151. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  152. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  153. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  154. package/views/3d/environment/SunLighting.d.ts +0 -1
  155. package/views/3d/environment/SunLighting.js +1 -1
  156. package/views/3d/environment/VirtualLighting.d.ts +0 -1
  157. package/views/3d/environment/VirtualLighting.js +1 -1
  158. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  159. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  160. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +5 -5
  161. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  162. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  163. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  164. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +9 -4
  165. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  166. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  167. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  168. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  169. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  170. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  171. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  172. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  173. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  174. package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +2 -0
  175. package/views/layers/LineOfSightLayerView.d.ts +2 -2
  176. package/views/layers/ViewshedLayerView.d.ts +2 -1
  177. package/views/selection/SelectionOperation.js +1 -1
  178. package/views/selection/types.d.ts +43 -3
  179. package/views/support/layerViewUtils.js +1 -1
  180. package/views/support/screenshotUtils.js +1 -1
  181. package/views/support/selectionUtils.js +1 -1
  182. package/views/webgl/Texture.js +1 -1
  183. package/webdoc/support/webdocSaveUtils.js +1 -1
  184. package/webscene/Slide.d.ts +1 -2
  185. package/widgets/DirectionalPad/VisibleElements.d.ts +5 -1
  186. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  187. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  188. package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
  189. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  190. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  191. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  192. package/widgets/Search/SearchViewModel.js +1 -1
  193. package/widgets/Search/support/layerSearchUtils.js +1 -1
  194. package/widgets/Sketch/SketchViewModel.js +1 -1
  195. package/widgets/Sketch/support/PluginManager.js +1 -1
  196. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  197. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +3 -3
  198. package/widgets/UtilityNetworkValidateTopology.d.ts +1 -1
  199. package/widgets/support/SelectionList/GroupLayerItem.d.ts +6 -0
  200. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  201. package/widgets/support/SelectionList/ItemBase.js +1 -1
  202. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +6 -1
  203. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  204. package/widgets/support/SelectionToolbar.d.ts +8 -1
  205. package/widgets/support/SelectionToolbar.js +1 -1
  206. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  207. package/assets/esri/core/workers/chunks/0cb50bc2b2125c5fedf2.js +0 -1
  208. package/assets/esri/core/workers/chunks/1fe24ffcd88280d84fbe.js +0 -1
  209. package/assets/esri/core/workers/chunks/2f04b8679c9f15390517.js +0 -1
  210. package/assets/esri/core/workers/chunks/42045cf46497828cd3c0.js +0 -1
  211. package/assets/esri/core/workers/chunks/72071ea5de89720fbe42.js +0 -1
  212. package/assets/esri/core/workers/chunks/9de5ad77bc37ec142218.js +0 -1
  213. package/assets/esri/core/workers/chunks/c19cd5a03b6d480fe53b.js +0 -1
  214. package/assets/esri/core/workers/chunks/d1f98c5249c487eb96f1.js +0 -1
  215. package/assets/esri/core/workers/chunks/e01fc1c31bc023dd0e33.js +0 -1
  216. package/assets/esri/core/workers/chunks/e077e321a3109c2fbbe2.js +0 -1
@@ -11,7 +11,7 @@ import{EvaluateAmbientLighting as e}from"./EvaluateAmbientLighting.glsl.js";impo
11
11
  `),p.uniforms.add(i).code.add(d`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
12
12
  float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
13
13
  return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
14
- }`);let w=S?`globalIlluminationOcclusion`:`ssao`,T=S?`factorDirect`:`0.0`,E=S?`factorAmbient`:`1.0`;switch(p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.uniforms.add(new u(`factorDirect`,e=>e.globalIlluminationDirectFactor),new u(`factorAmbient`,e=>e.globalIlluminationAmbientFactor)),p.constants.add(`globalIlluminationOcclusionBoost`,`float`,1.2),p.constants.add(`globalIlluminationEmissionBoost`,`float`,2.25),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
14
+ }`);let w=S?`globalIlluminationOcclusion`:`ssao`;switch(p.constants.add(`globalIlluminationDirectFactor`,`float`,S?.55:0),p.constants.add(`globalIlluminationAmbientFactor`,`float`,S?.85:1),p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.constants.add(`globalIlluminationOcclusionBoost`,`float`,1.2),p.constants.add(`globalIlluminationEmissionBoost`,`float`,2.25),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
15
15
  return min(globalIlluminationOcclusionBoost * readGlobalIlluminationOcclusion(), 1.0);
16
16
  }
17
17
  vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
@@ -51,8 +51,8 @@ return mix(emission, compressedEmission, globalIlluminationEmissionCompressionWe
51
51
  // Calculate the irradiance components: sun, fill lights and the sky.
52
52
  // Applying AO to both direct and ambient lighting enhances depth perception.
53
53
  // This is an artistic choice; physically, AO should only attenuate ambient lighting.
54
- vec3 directOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), ${T});
55
- vec3 ambientOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), ${E});
54
+ vec3 directOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), globalIlluminationDirectFactor);
55
+ vec3 ambientOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), globalIlluminationAmbientFactor);
56
56
  vec3 mainLightIrradianceComponent = mainLightIrradianceScale * inputs.NdotL * (1.0 - shadow) * mainLightIntensity * directOcclusionFactor;
57
57
  vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity * directOcclusionFactor;
58
58
  // calculate ambient irradiance for localView and additionalLight for globalView
@@ -106,8 +106,8 @@ return mix(emission, compressedEmission, globalIlluminationEmissionCompressionWe
106
106
 
107
107
  // Applying AO to both direct and ambient lighting enhances depth perception.
108
108
  // This is an artistic choice; physically, AO should only attenuate ambient lighting.
109
- vec3 directOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), ${T});
110
- vec3 ambientOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), ${E});
109
+ vec3 directOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), globalIlluminationDirectFactor);
110
+ vec3 ambientOcclusionFactor = mix(vec3(1.0), vec3(1.0 - ${w}), globalIlluminationAmbientFactor);
111
111
  vec3 mainLightIrradianceComponent = mainLightIrradianceScale * (1.0 - shadow) * inputs.NdotL * mainLightIntensity * directOcclusionFactor;
112
112
  vec3 ambientLightIrradianceComponent = ambientIrradianceScale * calculateAmbientIrradiance(normal) * ambientOcclusionFactor + additionalLight;
113
113
  vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,f as defaultEmissionBoostFactor,g as defaultFactorDaylightDirectional,d as defaultRayMarchMaxReach,h as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,i as defaultRayMarchMinReach,j as defaultRayMarchMinReachEmissionWeight,k as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,b as build}from"../../../../../chunks/GlobalIllumination.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";let b=class extends u{constructor(e){super(e),this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){if(this.bindParameters.frameRendererTarget===3)return null;let t=this.bindParameters.frameRendererTarget!==0;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._emptyOutput:(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderOffscreen(r,i):this._renderInteractive(r,i))}_renderOffscreen(e,t){let n=this._emptyOutput,r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._emptyOutput;let n=this._mode===1?this._lowQualityResolutionScale:1,r=this.techniques.getCompiled(m,this._configuration),i=this.techniques.getCompiled(p),a=n<1,o=a?this.techniques.getCompiled(_):null;if(!r||!i||a&&!o)return this._requestRender(),this._emptyOutput;let s=this._renderAccumulationFrame(e,t,r,i,o,n);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(s),s}_renderAccumulationFrame(e,t,n,r,i,a=1){let s=this.bindParameters,c=this.renderingContext,{camera:u}=s;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/u.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:d,fullHeight:f}=u,p=Math.max(1,Math.floor(d*a)),m=Math.max(1,Math.floor(f*a)),h=this.fboCache.acquire(p,m,`global illumination input`).acquireColor(y,2);c.bindFramebuffer(h.fbo),c.setViewport(0,0,p,m),c.bindTechnique(n,s,this._passParameters,this._drawParameters),c.screen.draw();let g=Math.max(1,Math.round(p)),_=Math.max(1,Math.round(m)),v=this.fboCache.acquire(g,_,`global illumination blur horizontal`);c.bindFramebuffer(v.fbo);let b=h.obtainAttachment(y);this._drawParameters.texture=h.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,0,1/m),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),h.release();let x=this.fboCache.acquire(g,_,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);c.bindFramebuffer(x.fbo),c.setViewport(0,0,g,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.texture=v.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,1/g,0),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),v.release(),x.attachColor(b,y),b.release();let S=x;return i&&(S=this.fboCache.acquire(d,f,l.AMBIENT_ILLUMINATION).acquireColor(y,2),c.bindFramebuffer(S.fbo),c.setViewport(0,0,d,f),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParametersUpscale.colorTexture=x.getTexture(),this._drawParametersUpscale.weightTexture=x.getTexture(y),c.bindTechnique(i,s,this._passParameters,this._drawParametersUpscale),c.screen.draw(),x.release()),c.setViewport4fv(u.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,S}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return!!e.lastFrameColor&&(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};b=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],b);export{b as GlobalIllumination};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";let b=class extends u{constructor(e){super(e),this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){if(this.bindParameters.frameRendererTarget===3)return null;let t=this.bindParameters.frameRendererTarget!==0;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._emptyOutput:(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderOffscreen(r,i):this._renderInteractive(r,i))}_renderOffscreen(e,t){let n=this._emptyOutput,r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._emptyOutput;let n=this._mode===1?this._lowQualityResolutionScale*this.bindParameters.camera.pixelScale:1,r=n>=.99?1:n,i=this.techniques.getCompiled(m,this._configuration),a=this.techniques.getCompiled(p),o=r<1,s=o?this.techniques.getCompiled(_):null;if(!i||!a||o&&!s)return this._requestRender(),this._emptyOutput;let c=this._renderAccumulationFrame(e,t,i,a,s,r);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(c),c}_renderAccumulationFrame(e,t,n,r,i,a=1){let s=this.bindParameters,c=this.renderingContext,{camera:u}=s;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/u.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:d,fullHeight:f}=u,p=Math.max(1,Math.floor(d*a)),m=Math.max(1,Math.floor(f*a)),h=this.fboCache.acquire(p,m,`global illumination input`).acquireColor(y,2);c.bindFramebuffer(h.fbo),c.setViewport(0,0,p,m),c.bindTechnique(n,s,this._passParameters,this._drawParameters),c.screen.draw();let g=Math.max(1,Math.round(p)),_=Math.max(1,Math.round(m)),v=this.fboCache.acquire(g,_,`global illumination blur horizontal`);c.bindFramebuffer(v.fbo);let b=h.obtainAttachment(y);this._drawParameters.texture=h.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,0,1/m),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),h.release();let x=this.fboCache.acquire(g,_,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);c.bindFramebuffer(x.fbo),c.setViewport(0,0,g,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.texture=v.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,1/g,0),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),v.release(),x.attachColor(b,y),b.release();let S=x;return i&&(S=this.fboCache.acquire(d,f,l.AMBIENT_ILLUMINATION).acquireColor(y,2),c.bindFramebuffer(S.fbo),c.setViewport(0,0,d,f),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParametersUpscale.colorTexture=x.getTexture(),this._drawParametersUpscale.weightTexture=x.getTexture(y),c.bindTechnique(i,s,this._passParameters,this._drawParametersUpscale),c.screen.draw(),x.release()),c.setViewport4fv(u.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,S}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};b=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],b);export{b as GlobalIllumination};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t,ShaderTechniqueConfiguration as n}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{d as r,b as i}from"../../../../../chunks/GlobalIllumination.glsl.js";class a extends n{constructor(){super(...arguments),this.hasColor=!0,this.hasEmission=!1,this.rayMarchMaxReach=r,this.rayMarchMaxSteps=i,this.useProjectedRayLength=!0,this.clampRayToScreen=!1}}e([t()],a.prototype,`hasColor`,void 0),e([t()],a.prototype,`hasEmission`,void 0);export{a as GlobalIlluminationTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t,ShaderTechniqueConfiguration as n}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.hasColor=!0,this.hasEmission=!1,this.rayMarchMaxReach=.5,this.rayMarchMaxSteps=16,this.useProjectedRayLength=!0,this.clampRayToScreen=!1}}e([t()],r.prototype,`hasColor`,void 0),e([t()],r.prototype,`hasEmission`,void 0);export{r as GlobalIlluminationTechniqueConfiguration};
@@ -25,13 +25,18 @@ float dispersionPerPixel = getDistanceFalloff(mainDepth, rayDir, scattering * 0.
25
25
  float mainPoint = pow(dispersionPerPixel, 2.0);
26
26
  vec3 emission = vec3(0.0);
27
27
  float weights = 0.0;
28
- float sigmaSq = (0.1 / maxScattering * scattering + 0.003) + 0.03 * (boost - 1.0);
29
- for(float level = floor(mainPoint); level < levels; ++level) {
28
+ float baseSigmaSq = 0.003 + 0.03 * (boost - 1.0);
29
+ float sigmaSq = baseSigmaSq + 0.1 * scattering / maxScattering;
30
+ float minPoint = mainPoint - 0.5;
31
+ float fullPoint = (minPoint + mainPoint) * 0.5;
32
+ for(float level = 0.0; level < levels; ++level) {
30
33
  float point = level / levels;
31
- float dist = abs(point - mainPoint);
32
- float weight = gauss(dist, sigmaSq);
34
+ float dist = point - mainPoint;
35
+ float weight = gauss(dist, sigmaSq) * smoothstep(minPoint, fullPoint, point);
36
+ if(weight > 0.0) {
33
37
  emission += readEmission(point) * weight;
34
38
  weights += weight;
35
39
  }
40
+ }
36
41
  return emission * boost / weights;
37
42
  }`)}export{d as BlurEmissionPassParameters,f as applyEmissiveGlow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.globalIlluminationDirectFactor=.55,this.globalIlluminationAmbientFactor=.85,this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=t(new r),this._inverseViewport=n(),this._oldLighting=new c,this._newLighting=new c,this._fadedLighting=new c,this._lighting=this._newLighting,this.screenSpaceReflections=new s,this.reprojection=new o,this.highlights=[],this.highlightMixOrigin=n(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new a,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=e(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(e){this._emissions.value=e}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return this.emissions===1||this.emissions===3}get hasTransparentEmission(){return this.emissions===2||this.emissions===3}get hasEmissions(){return this.emissions!==0}get camera(){return this._camera.value}set camera(e){this._camera.value=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<5e5}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(e,t,n,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=n,this._newLighting.set(e),this._oldLighting.updateLegacy(),r===1&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return this.frameRendererTarget!==3&&i(this.output)&&this.screenSpaceReflections.enabled&&this.reprojection.lastFrameColor!=null}get highlight(){return this.highlightLevel==null?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name=`geometry depth`),this._depth=e}get occluder(){return this.slot===10||this.slot===11?this.slot:null}}export{u as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=t(new r),this._inverseViewport=n(),this._oldLighting=new c,this._newLighting=new c,this._fadedLighting=new c,this._lighting=this._newLighting,this.screenSpaceReflections=new s,this.reprojection=new o,this.highlights=[],this.highlightMixOrigin=n(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new a,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=e(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(e){this._emissions.value=e}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return this.emissions===1||this.emissions===3}get hasTransparentEmission(){return this.emissions===2||this.emissions===3}get hasEmissions(){return this.emissions!==0}get camera(){return this._camera.value}set camera(e){this._camera.value=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<5e5}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(e,t,n,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=n,this._newLighting.set(e),this._oldLighting.updateLegacy(),r===1&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return this.frameRendererTarget!==3&&i(this.output)&&this.screenSpaceReflections.enabled&&this.reprojection.lastFrameColor!=null}get highlight(){return this.highlightLevel==null?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name=`geometry depth`),this._depth=e}get occluder(){return this.slot===10||this.slot===11?this.slot:null}}export{u as BindParameters,l as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as n,transformMat4 as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustumPlanes.js";import{create as s,fromPoints as c,copy as l}from"../../../../geometry/support/ray.js";import u from"../../webgl/RenderCamera.js";import{HUDTarget as d,HUDIntersectorResult as f}from"./HUDIntersectorResult.js";import{IntersectorOptions as p}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as h}from"./IntersectorResult.js";import{ObjectTarget as g}from"./ObjectTarget.js";import{PolygonIntersectionResults as _}from"./PolygonIntersectionResults.js";import{IntersectorTransform as v,getVerticalOffsetObject3D as y}from"./verticalOffsetUtils.js";const b=1e-5,x=t();class S{constructor(e){this.options=new p,this._results=new C,this.polygonResults=new _,this.transform=new v,this.camera=new u,this.screenPolygonPrimitiveProcessor=w,this.tolerance=b,this.verticalOffset=null,this._ray=s(),this._rayEnd=a(),this._rayBeginTransformed=a(),this._rayEndTransformed=a(),this.viewingMode=e??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(e,t,n){this.resetWithRay(c(e,t,this._ray),n)}resetWithRay(e,t){this.camera=t,e!==this._ray&&l(e,this._ray),this.options.verticalOffset===0?this.verticalOffset=null:this.viewingMode===2?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset,n(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(e=null,t,n,r,i){this.point=t,this.filterPredicate=r,this.tolerance=n??b;let a=y(this.verticalOffset);if(e&&e.length>0){let t=i?e=>{i(e)&&this.intersectObject(e)}:e=>{this.intersectObject(e)};for(let n of e){let e=n.getSpatialQueryAccelerator?.();e==null?n.objects.forEach(e=>t(e)):(a==null?e.forEachAlongRay(this._ray.origin,this._ray.direction,t):e.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,t,a),this.options.selectionMode&&this.options.hud&&e.forEachDegenerateObject(t))}}this.sortResults()}*intersectScreenPolygon(e=null,t){if(this.verticalOffset=null,e?.length)for(let n of e){let e=n.getSpatialQueryAccelerator?.();if(e!=null)for(let n of e.intersectingFrustumValues(t.broadPhaseFrustum,e=>e.visible))yield*this._intersectScreenPolygonObject(n,t);else for(let e of n.objects.values())e.visible&&o(t.broadPhaseFrustum,e.boundingVolumeWorldSpace.sphere)&&(yield*this._intersectScreenPolygonObject(e,t))}}*intersectHUDScreenPolygon(e=null,t){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&e?.length)for(let n of e){let e=(n.getSpatialQueryAccelerator?.())?.degenerateObjectValues()??n.objects.values();for(let n of e)yield*this._intersectScreenPolygonObject(n,t)}}*_intersectScreenPolygonObject(e,t){let n=e.geometries;if(!e.visible||!n)return;let r=e.effectiveTransformation;for(let i of n){if(!i.visible)continue;let{material:n,id:a}=i;if(!n.visible||!n.intersectScreenPolygon)continue;this._setGeometryTransform(r,i);let o=n.intersectScreenPolygon(i,this.transform.transform,this,t);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new g(e,a,o.primitiveIndex),o.distance,o.renderDistance,o.point),yield}}intersectObject(e){let t=e.geometries;if(!t)return;let n=e.effectiveTransformation,i=y(this.verticalOffset);for(let a of t){if(!a.visible)continue;let{material:t,id:o}=a;if(!t.visible)continue;this._setGeometryTransform(n,a),r(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),r(this._rayEndTransformed,this.rayEnd,this.transform.inverse);let s=this.transform.transform;i!=null&&(i.objectTransform=this.transform),t.intersectRay(a,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(t,n,r,i,a)=>this.handleObjectIntersection({object:e,geometryId:o,primitiveIndex:i},t,n,r,s,a))}}_setGeometryTransform(t,n){let r=n.type===1?e(x,n.localOrigin.vec3):n.transformation;this.transform.setAndInvalidateLazyTransforms(t,r)}handleObjectIntersection(e,t,n,r,i,a){if(t<0||this.filterPredicate!=null&&!this.filterPredicate(this._ray.origin,this._rayEnd,n))return;let o=a?this._results.hud:this._results;e=a?new d(e,a):e;let s=a?i=>i.set(1,e,t,n,r):a=>a.set(4,e,t,n,r,i);if((o.min.renderDistance==null||n<o.min.renderDistance)&&s(o.min),this.options.store!==0&&(o.max.renderDistance==null||n>o.max.renderDistance)&&s(o.max),this.options.store===2){if(a){let e=new f(this._ray);s(e),this._results.hud.all.push(e)}else{let e=new m(this._ray);s(e),this._results.all.push(e)}}}_handleObjectScreenPolygonIntersection(e,t,n,r,i){n<0||(this.filterPredicate==null||i!=null&&this.filterPredicate(this.camera.eye,i,1))&&this.polygonResults.add(e,e===1&&i?new d(t,i):t,n,r)}sortResults(e=this._results.all){e.sort(h)}}class C{constructor(){this.min=new m(s()),this.max=new m(s()),this.hud={min:new f(s()),max:new f(s()),all:[]},this.ground=new m(s()),this.all=[]}init(e){this.min.init(e),this.max.init(e),this.ground.init(e),this.all.length=0,this.hud.min.init(e),this.hud.max.init(e),this.hud.all.length=0}}const w={*processTriangle(e){yield e},*processLineSegment(e,t,n){i(e[0],t),i(e[1],n),yield e},validatePoint(){return!0}};export{S as Intersector,w as defaultScreenPolygonPrimitiveProcessor,b as defaultTolerance};
2
+ import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as n,transformMat4 as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustumPlanes.js";import{create as s,fromPoints as c,copy as l}from"../../../../geometry/support/ray.js";import u from"../../webgl/RenderCamera.js";import{HUDTarget as d,HUDIntersectorResult as f}from"./HUDIntersectorResult.js";import{IntersectorOptions as p}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as h}from"./IntersectorResult.js";import{ObjectTarget as g}from"./ObjectTarget.js";import{PolygonIntersectionResults as _}from"./PolygonIntersectionResults.js";import{IntersectorTransform as v,getVerticalOffsetObject3D as y}from"./verticalOffsetUtils.js";const b=1e-5,x=t();class S{constructor(e){this.options=new p,this._results=new C,this.polygonResults=new _,this.transform=new v,this.camera=new u,this.metersPerRenderUnit=1,this.screenPolygonPrimitiveProcessor=w,this.tolerance=b,this.verticalOffset=null,this._ray=s(),this._rayEnd=a(),this._rayBeginTransformed=a(),this._rayEndTransformed=a(),this.viewingMode=e??1}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(e,t,n){this.resetWithRay(c(e,t,this._ray),n)}resetWithRay(e,t){this.camera=t,e!==this._ray&&l(e,this._ray),this.options.verticalOffset===0?this.verticalOffset=null:this.viewingMode===2?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset,n(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(e=null,t,n,r,i){this.point=t,this.filterPredicate=r,this.tolerance=n??b;let a=y(this.verticalOffset);if(e&&e.length>0){let t=i?e=>{i(e)&&this.intersectObject(e)}:e=>{this.intersectObject(e)};for(let n of e){let e=n.getSpatialQueryAccelerator?.();e==null?n.objects.forEach(e=>t(e)):(a==null?e.forEachAlongRay(this._ray.origin,this._ray.direction,t):e.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,t,a),this.options.selectionMode&&this.options.hud&&e.forEachDegenerateObject(t))}}this.sortResults()}*intersectScreenPolygon(e=null,t){if(this.verticalOffset=null,e?.length)for(let n of e){let e=n.getSpatialQueryAccelerator?.();if(e!=null)for(let n of e.intersectingFrustumValues(t.broadPhaseFrustum,e=>e.visible))yield*this._intersectScreenPolygonObject(n,t);else for(let e of n.objects.values())e.visible&&o(t.broadPhaseFrustum,e.boundingVolumeWorldSpace.sphere)&&(yield*this._intersectScreenPolygonObject(e,t))}}*intersectHUDScreenPolygon(e=null,t){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&e?.length)for(let n of e){let e=(n.getSpatialQueryAccelerator?.())?.degenerateObjectValues()??n.objects.values();for(let n of e)yield*this._intersectScreenPolygonObject(n,t)}}*_intersectScreenPolygonObject(e,t){let n=e.geometries;if(!e.visible||!n)return;let r=e.effectiveTransformation;for(let i of n){if(!i.visible)continue;let{material:n,id:a}=i;if(!n.visible||!n.intersectScreenPolygon)continue;this._setGeometryTransform(r,i);let o=n.intersectScreenPolygon(i,this.transform.transform,this,t);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new g(e,a,o.primitiveIndex),o.distance,o.renderDistance,o.point),yield}}intersectObject(e){let t=e.geometries;if(!t)return;let n=e.effectiveTransformation,i=y(this.verticalOffset);for(let a of t){if(!a.visible)continue;let{material:t,id:o}=a;if(!t.visible)continue;this._setGeometryTransform(n,a),r(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),r(this._rayEndTransformed,this.rayEnd,this.transform.inverse);let s=this.transform.transform;i!=null&&(i.objectTransform=this.transform),t.intersectRay(a,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(t,n,r,i,a)=>this.handleObjectIntersection({object:e,geometryId:o,primitiveIndex:i},t,n,r,s,a))}}_setGeometryTransform(t,n){let r=n.type===1?e(x,n.localOrigin.vec3):n.transformation;this.transform.setAndInvalidateLazyTransforms(t,r)}handleObjectIntersection(e,t,n,r,i,a){if(t<0||this.filterPredicate!=null&&!this.filterPredicate(this._ray.origin,this._rayEnd,n))return;let o=a?this._results.hud:this._results;e=a?new d(e,a):e;let s=a?i=>i.set(1,e,t,n,r):a=>a.set(4,e,t,n,r,i);if((o.min.renderDistance==null||n<o.min.renderDistance)&&s(o.min),this.options.store!==0&&(o.max.renderDistance==null||n>o.max.renderDistance)&&s(o.max),this.options.store===2){if(a){let e=new f(this._ray);s(e),this._results.hud.all.push(e)}else{let e=new m(this._ray);s(e),this._results.all.push(e)}}}_handleObjectScreenPolygonIntersection(e,t,n,r,i){n<0||(this.filterPredicate==null||i!=null&&this.filterPredicate(this.camera.eye,i,1))&&this.polygonResults.add(e,e===1&&i?new d(t,i):t,n,r)}sortResults(e=this._results.all){e.sort(h)}}class C{constructor(){this.min=new m(s()),this.max=new m(s()),this.hud={min:new f(s()),max:new f(s()),all:[]},this.ground=new m(s()),this.all=[]}init(e){this.min.init(e),this.max.init(e),this.ground.init(e),this.all.length=0,this.hud.min.init(e),this.hud.max.init(e),this.hud.all.length=0}}const w={*processTriangle(e){yield e},*processLineSegment(e,t,n){i(e[0],t),i(e[1],n),yield e},validatePoint(){return!0}};export{S as Intersector,w as defaultScreenPolygonPrimitiveProcessor,b as defaultTolerance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as me}from"../effects/highlight/Highlight.js";import{OITBlend as D}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as I,PerformanceCategory as L}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Te,ColorAttachment0 as R,ColorAttachment1 as z,ColorAttachment2 as B,DrawBufferNone as Ee}from"../../../webgl/enums.js";const De=has(`disable-feature:async-navigation-3d-depth-readback`);let V=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new I(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new D(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this.updateGlobalIllumination(this.stage.view.environment.lighting.globalIllumination),this._requestRender()}updateGlobalIllumination(e){let t=P(this.stage.view.qualityProfile);for(let n of[0,1,2])this.setFeatureEnabled(11,n,e),this.setFeatureEnabled(10,n,e&&n===2),this.setFeatureEnabled(3,n,!e&&(t.get(n,3)??!1))}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...J),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{this._isRendering=!0,this._needsOffscreenPrepass(e.camera,t)&&this._render(e,3,n).color?.release();let r=this._render(e,t,n);return t!==0&&this._disposeOffscreenBuffers(),r}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_needsOffscreenPrepass(e,t){return(t===1||t===2)&&(this.hasGlobalIllumination||this.hasReflections)&&(!this._framebuffer.hasColor||!this._bindParameters.reprojection.lastFrameCamera.equals(e))}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(ke),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...U),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(L.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!De&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...W),t.output=0,this._plugins.precompile(...W),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(L.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Te.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?L.OPAQUE_EDGES:L.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(L.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?L.AMBIENT_ILLUMINATION_HIGH_QUALITY:L.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(R);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,R),n?.release(),this.performanceInfo.advance(L.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(L.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal){this.sceneDepthRange.value=O.Infinite;return}if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,G),this._needsDepth&&this._precompilePlugins(3,K)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...G),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(L.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...W),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...q);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...q),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...K)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...H),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...H)}_renderTransparentGeometry(){this._plugins.render(...U),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...W)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...J),this._bindParameters.output=2,this._plugins.precompile(...J),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...J)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(z);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?L.HUD_OCCLUDED:L.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),me(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(L.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(L.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...U)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(z,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(B,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(z,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?B:z;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-R,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...H)||this.plugins.produces(5,...H)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([Ee,z]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(z)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],V.prototype,`highResolutionAtmosphere`,null),e([m()],V.prototype,`_edgeView`,void 0),e([m()],V.prototype,`updating`,null),V=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],V);const H=[0,1,2,3],U=[7,6,4,5],W=[7,6],G=[0,1,2,4,...W],K=[3,5],q=[2,4,8],J=[16,12,14,13],Oe=[4,5,2,3,0,1,...W],ke=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...W],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{V as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as me}from"../effects/highlight/Highlight.js";import{OITBlend as D}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as I,PerformanceCategory as L}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Te,ColorAttachment0 as R,ColorAttachment1 as z,ColorAttachment2 as B,DrawBufferNone as Ee}from"../../../webgl/enums.js";const De=has(`disable-feature:async-navigation-3d-depth-readback`);let V=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new I(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new D(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this.updateGlobalIllumination(this.stage.view.environment.lighting.globalIllumination),this._requestRender()}updateGlobalIllumination(e){let t=P(this.stage.view.qualityProfile);for(let n of[0,1,2])this.setFeatureEnabled(11,n,e),this.setFeatureEnabled(10,n,e&&n===2),this.setFeatureEnabled(3,n,!e&&(t.get(n,3)??!1))}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...J),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{this._isRendering=!0,this._needsOffscreenPrepass(e.camera,t)&&this._render(e,3,n).color?.release();let r=this._render(e,t,n);return t!==0&&this._disposeOffscreenBuffers(),r}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_needsOffscreenPrepass(e,t){return(t===1||t===2)&&(this.hasGlobalIllumination||this.hasReflections)&&(!this._framebuffer.hasColor||!this._bindParameters.reprojection.lastFrameCamera.equals(e))}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(ke),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...U),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor);this.hasReflections?(f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(L.PREPARE);let p=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let m=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let h=this._hasTransparentGeometry?2:1,g=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(h,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(h,e)),this._bindParameters.emissions=g,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!De&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let _;return r||(_=d.color,_.retain()),this.performanceInfo.finishFrame(),new F(_,m)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...W),t.output=0,this._plugins.precompile(...W),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(L.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Te.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?L.OPAQUE_EDGES:L.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(L.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?L.AMBIENT_ILLUMINATION_HIGH_QUALITY:L.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(R);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,R),n?.release(),this.performanceInfo.advance(L.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(L.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal){this.sceneDepthRange.value=O.Infinite;return}if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,G),this._needsDepth&&this._precompilePlugins(3,K)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...G),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(L.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...W),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...q);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...q),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...K)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...H),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...H)}_renderTransparentGeometry(){this._plugins.render(...U),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...W)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...J),this._bindParameters.output=2,this._plugins.precompile(...J),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...J)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(z);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?L.HUD_OCCLUDED:L.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),me(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(L.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(L.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...U)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(z,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(B,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(z,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?B:z;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-R,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...H)||this.plugins.produces(5,...H)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([Ee,z]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(z)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],V.prototype,`highResolutionAtmosphere`,null),e([m()],V.prototype,`_edgeView`,void 0),e([m()],V.prototype,`updating`,null),V=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],V);const H=[0,1,2,3],U=[7,6,4,5],W=[7,6],G=[0,1,2,4,...W],K=[3,5],q=[2,4,8],J=[16,12,14,13],Oe=[4,5,2,3,0,1,...W],ke=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...W],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{V as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,copy as r,set as i,transformMat4 as a,squaredDistance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as c,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as u}from"../../../../geometry/support/frustumPlanes.js";import{clipPolygon as d}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as m}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class g{constructor(e){this.primitiveIndex=e}}class _{constructor(e){this.type=e,this.distance=1/0,this.renderDistance=1/0,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=1/0,this.renderDistance=1/0,this.hasNormal=!1}update(e,t,n,i,a=e){this.distance=e,this.renderDistance=a,this.primitiveIndex=t,r(this.point,n),this.hasNormal=i!=null,i!=null&&r(this.normal,i)}updateIfCloserFromValues(e,t,n,r,i=e){i<this.renderDistance&&this.update(e,t,n,r,i)}updateIfCloser(e){let{distance:t,renderDistance:n,primitiveIndex:r,point:i,normal:a}=e;this.updateIfCloserFromValues(t,r,i,e.hasNormal?a:null,n)}get valid(){return Number.isFinite(this.distance)}}function v(e,t,n,r,i){if(!e.visible)return null;let a=new _(4),o;o=e.boundingInfo?b(e.readPrimitivePosition,e.boundingInfo,t,n,r,i):y(t,n,r,0,e.faceCount,e.readPrimitivePosition,i,null,0);for(let e of o)a.updateIfCloser(e);return a.valid?a:null}function*y(e,t,r,i,a,o,s,c=null,l=0){if(e.camera==null)return;let{camera:u,screenPolygonPrimitiveProcessor:p}=e;for(let e=i;e<a;++e){let i=(c?.[e]??e)+l,a=c==null?i:e,m=i*3;x(T[0],o,m+0,s,a,t),x(T[1],o,m+1,s,a,t),x(T[2],o,m+2,s,a,t);let h=k,g;j.reset();let _=E;for(let e of p.processTriangle(T))if(_.length=0,d(u.frustum[4],e,()=>_.pushNew(),!1),!(_.length<3)){for(let e=0;e<_.length;e++)u.projectToScreen(_.at(e),D[e]);S(r,D,_.length)&&(C(u.eye,_,O),g??=f(k,T[0],T[1],T[2]),j.updateIfCloserFromValues(n(u.eye,O),i,O,g?h:null))}j.valid&&(yield j)}}function*b(e,t,n,r,i,a){let o;if(a==null?o=u(i.broadPhaseFrustum,t.box,r):(c(w,t.box),a.applyToAabb(w),o=u(i.broadPhaseFrustum,w,r)),!o)return;let{primitiveIndices:s}=t,l=s.length;if(l>m){let o=t.children;if(o!==void 0){for(let t of o)yield*b(e,t,n,r,i,a);return}}yield*y(n,r,i,0,l,e,a,s,0)}function x(e,t,n,r,o,s){let[c,l,u]=t(e,n);r==null?i(e,c,l,u):r.applyToVertex(e,c,l,u,o),s&&a(e,e,s)}function S(e,t,n){for(let r=1;r<n-1;r++)if(h(e,t[0],t[r],t[r+1]))return!0;return!1}function C(e,t,n){let i=1/0,a=t.at(0);for(let s=1;s<t.length-1;s++){p(A,e,a,t.at(s),t.at(s+1));let c=o(e,A);c<i&&(i=c,r(n,A))}}const w=l(),T=[s(),s(),s()],E=new e({allocator:e=>e??s()}),D=Array.from({length:12},()=>t()),O=s(),k=s(),A=s(),j=new _(4);export{g as DrapedHit,_ as Hit,y as forEachTriangleRangeScreenPolygonHit,v as intersectTriangleGeometryScreenPolygon};
2
+ import e from"../../../../core/PooledArray.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,copy as r,set as i,transformMat4 as a,squaredDistance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as c,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as u}from"../../../../geometry/support/frustumPlanes.js";import{clipPolygon as d}from"../../../../geometry/support/plane.js";import{normalFromValues as f,closestPointFromValues as p}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as m}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as h}from"./screenPolygonOverlapUtils.js";class g{constructor(e){this.primitiveIndex=e}}class _{constructor(e){this.type=e,this.distance=1/0,this.renderDistance=1/0,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=1/0,this.renderDistance=1/0,this.hasNormal=!1}update(e,t,n,i,a=e){this.distance=e,this.renderDistance=a,this.primitiveIndex=t,r(this.point,n),this.hasNormal=i!=null,i!=null&&r(this.normal,i)}updateIfCloserFromValues(e,t,n,r,i=e){i<this.renderDistance&&this.update(e,t,n,r,i)}updateIfCloser(e){let{distance:t,renderDistance:n,primitiveIndex:r,point:i,normal:a}=e;this.updateIfCloserFromValues(t,r,i,e.hasNormal?a:null,n)}get valid(){return Number.isFinite(this.distance)}}function v(e,t,n,r,i){if(!e.visible)return null;let a=new _(4),o;o=e.boundingInfo?b(e.readPrimitivePosition,e.boundingInfo,t,n,r,i):y(t,n,r,0,e.faceCount,e.readPrimitivePosition,i,null,0);for(let e of o)a.updateIfCloser(e);return a.valid?a:null}function*y(e,t,r,i,a,o,s,c=null,l=0){if(e.camera==null)return;let{camera:u,screenPolygonPrimitiveProcessor:d}=e;for(let e=i;e<a;++e){let i=(c?.[e]??e)+l,a=c==null?i:e,p=i*3;x(T[0],o,p+0,s,a,t),x(T[1],o,p+1,s,a,t),x(T[2],o,p+2,s,a,t);let m=j,h;N.reset();let g=E;for(let e of d.processTriangle(T))S(r,e,u,g)&&(C(u.eye,g,A),h??=f(j,T[0],T[1],T[2]),N.updateIfCloserFromValues(n(u.eye,A),i,A,h?m:null));N.valid&&(yield N)}}function*b(e,t,n,r,i,a){let o;if(a==null?o=u(i.broadPhaseFrustum,t.box,r):(c(w,t.box),a.applyToAabb(w),o=u(i.broadPhaseFrustum,w,r)),!o)return;let{primitiveIndices:s}=t,l=s.length;if(l>m){let o=t.children;if(o!==void 0){for(let t of o)yield*b(e,t,n,r,i,a);return}}yield*y(n,r,i,0,l,e,a,s,0)}function x(e,t,n,r,o,s){let[c,l,u]=t(e,n);r==null?i(e,c,l,u):r.applyToVertex(e,c,l,u,o),s&&a(e,e,s)}function S(e,t,n,r){if(r.length=0,d(n.frustum[4],t,()=>r.pushNew()),r.length<3)return!1;let i=D,a=O,o=k;n.projectToScreen(r.data[0],i),n.projectToScreen(r.data[1],a);for(let t=2;t<r.length;t++){if(n.projectToScreen(r.data[t],o),h(e,i,a,o))return!0;let s=a;a=o,o=s}return!1}function C(e,t,n){let i=1/0,a=t.at(0);for(let s=1;s<t.length-1;s++){p(M,e,a,t.at(s),t.at(s+1));let c=o(e,M);c<i&&(i=c,r(n,M))}}const w=l(),T=[s(),s(),s()],E=new e({allocator:e=>e??s()}),D=t(),O=t(),k=t(),A=s(),j=s(),M=s(),N=new _(4);export{g as DrapedHit,_ as Hit,y as forEachTriangleRangeScreenPolygonHit,S as intersectConvexPolygonWithScreenPolygon,v as intersectTriangleGeometryWithScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e,scale as t,add as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as a,fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as s,scale as c}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as l}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as u,isDepth as d,is2DGeometryOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{intersectTriangleGeometry as m}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as h}from"../lib/screenPolygonTriangleIntersections.js";import{assert as g}from"../lib/Util.js";import{applyPolygonOffsetToHit as _,intersectWithPolygonOffset as v}from"./intersectWithPolygonOffset.js";import{TriangleMaterial as y}from"./TriangleMaterial.js";import{VisualVariablePassParameters as b}from"./VisualVariablePassParameters.js";import{writeAttributes as x,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as C,ColorMaterialTechnique as w}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as T}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as E}from"../../../../webscene/support/AlphaCutoff.js";class D extends y{constructor(e){super(e,k),this._configuration=new T,this.supportsEdges=!0,this._pp0=r(0,0,1),this._pp1=r(0,0,0),this.produces=new Map([[2,e=>this._isOpaqueMaterialPass(e)],[3,e=>!this.parameters.shadingEnabled&&this._isOpaqueNoSSAODepthPass(e)],[4,e=>u(e)&&this.transparent&&this.parameters.writeDepth],[5,e=>!this.parameters.shadingEnabled&&d(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>u(e)&&this.transparent&&!this.parameters.writeDepth],[18,e=>f(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.emissionSource=+!!this.emissions}get visible(){return this.parameters.color[3]>=E}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}intersectRay(e,t,n,r,i,a){if(!this.parameters.screenSizeEnabled)return super.intersectRay(e,t,n,r,i,a);this._intersectScreenSizeRay(e,n,r,i,a)}intersectRayDraped(e,t,n,r){if(!this.parameters.screenSizeEnabled)return super.intersectRayDraped(e,t,n,r);this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this._intersectScreenSizeRay(e,t,this._pp0,this._pp1,r)}intersectScreenPolygon(e,t,n,r){return this.parameters.screenSizeEnabled?_(h(e,n,t,r,this._createScreenSizeVertexDisplacement(e,n)),this._configuration,n.camera.eye):super.intersectScreenPolygon(e,t,n,r)}_intersectScreenSizeRay(e,t,n,r,i){m(e,t,n,r,this._createScreenSizeVertexDisplacement(e,t),v(i,this._configuration,n,r))}_createScreenSizeVertexDisplacement(r,i){let a=r.attributes.get(`offset`).data;return{applyToVertex:(r,o,s,c,l)=>{let u=e(j,a[l*3],a[l*3+1],a[l*3+2]);e(r,o,s,c);let d=this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(u)??1);return t(u,u,d),n(r,r,u),r},applyToAabb:e=>{let t=s(e,j);return c(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}}}_isOpaqueMaterialPass(e){return e===10||u(e)&&!this.transparent}_isOpaqueNoSSAODepthPass(e){return d(e)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(e){return new O(e)}createBufferWriter(){return new A(C(this.parameters))}}class O extends p{beginSlot(e){return this.getTechnique(w,e)}}class k extends b{constructor(){super(...arguments),this.color=a,this.shadingTint=o(0,0,0,.25),this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.shadingEnabled=!1,this.screenSizeEnabled=!1,this.screenSizeScale=14,this.useIndexing=!1}}class A{constructor(e){this.layout=e}elementCount(e){return e.get(`position`).indices.length}write(e,t,n,r){if(r==null)return;x(n,this.layout,e,t,r);let i=r.buffer.getField(`offset`,l);if(i&&n.has(`offset`)){let e=n.get(`offset`);g(e.size===3),S(e,t,i,r.offset)}}}const j=i();export{D as ColorMaterial,k as Parameters};
2
+ import{set as e,scale as t,add as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as a,fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as s,scale as c}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as l}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as u,isDepth as d,is2DGeometryOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{intersectTriangleGeometry as m}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as h}from"../lib/screenPolygonTriangleIntersections.js";import{assert as g}from"../lib/Util.js";import{applyPolygonOffsetToHit as _,intersectWithPolygonOffset as v}from"./intersectWithPolygonOffset.js";import{TriangleMaterial as y}from"./TriangleMaterial.js";import{VisualVariablePassParameters as b}from"./VisualVariablePassParameters.js";import{writeAttributes as x,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as C,ColorMaterialTechnique as w}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as T}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as E}from"../../../../webscene/support/AlphaCutoff.js";class D extends y{constructor(e){super(e,k),this._configuration=new T,this.supportsEdges=!0,this._pp0=r(0,0,1),this._pp1=r(0,0,0),this.produces=new Map([[2,e=>this._isOpaqueMaterialPass(e)],[3,e=>!this.parameters.shadingEnabled&&this._isOpaqueNoSSAODepthPass(e)],[4,e=>u(e)&&this.transparent&&this.parameters.writeDepth],[5,e=>!this.parameters.shadingEnabled&&d(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>u(e)&&this.transparent&&!this.parameters.writeDepth],[18,e=>f(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.emissionSource=+!!this.emissions}get visible(){return this.parameters.color[3]>=E}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}intersectRay(e,t,n,r,i,a){if(!this.parameters.screenSizeEnabled)return super.intersectRay(e,t,n,r,i,a);this._intersectScreenSizeRay(e,n,r,i,a)}intersectRayDraped(e,t,n,r){if(!this.parameters.screenSizeEnabled)return super.intersectRayDraped(e,t,n,r);this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this._intersectScreenSizeRay(e,t,this._pp0,this._pp1,r)}intersectScreenPolygon(e,t,n,r){return this.parameters.screenSizeEnabled?_(h(e,n,t,r,this._createScreenSizeVertexDisplacement(e,n)),this._configuration,n.camera.eye):super.intersectScreenPolygon(e,t,n,r)}_intersectScreenSizeRay(e,t,n,r,i){m(e,t,n,r,this._createScreenSizeVertexDisplacement(e,t),v(i,this._configuration,n,r))}_createScreenSizeVertexDisplacement(r,i){let a=r.attributes.get(`offset`).data;return{applyToVertex:(r,o,s,c,l)=>{let u=e(j,a[l*3],a[l*3+1],a[l*3+2]);e(r,o,s,c);let d=this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(u)??1);return t(u,u,d),n(r,r,u),r},applyToAabb:e=>{let t=s(e,j);return c(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}}}_isOpaqueMaterialPass(e){return e===10||u(e)&&!this.transparent}_isOpaqueNoSSAODepthPass(e){return d(e)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(e){return new O(e)}createBufferWriter(){return new A(C(this.parameters))}}class O extends p{beginSlot(e){return this.getTechnique(w,e)}}class k extends b{constructor(){super(...arguments),this.color=a,this.shadingTint=o(0,0,0,.25),this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.shadingEnabled=!1,this.screenSizeEnabled=!1,this.screenSizeScale=14,this.useIndexing=!1}}class A{constructor(e){this.layout=e}elementCount(e){return e.get(`position`).indices.length}write(e,t,n,r){if(r==null)return;x(n,this.layout,e,t,r);let i=r.buffer.getField(`offset`,l);if(i&&n.has(`offset`)){let e=n.get(`offset`);g(e.size===3),S(e,t,i,r.offset)}}}const j=i();export{D as ColorMaterial,k as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _,isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as S}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as C}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as T,applyPolygonOffsetToHit as E}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{getLayout as O,DefaultMaterialPassParameters as k,DefaultMaterialTechnique as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as j}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as M}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as N}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class F extends b{constructor(e,t){super(e,L),this.materialType=`default`,this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>_(e)&&!this.transparent],[4,e=>_(e)&&this.transparent]]),this._layout=O(this.parameters),this._configuration=new j(t.spherical)}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){let{layerOpacity:e,colorMixMode:t,opacity:n,externalColor:r}=this.parameters,i=t===`replace`?1:n,a=t===`ignore`||isNaN(r[3])?1:r[3];return e*i*a>=P}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===0&&this._hasEmissiveBase||this.parameters.emissiveSource===1)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this;n.hasNormalTexture=t.hasNormalTexture,n.hasColorTexture=t.hasColorTexture,n.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,n.hasOcclusionTexture=t.hasOcclusionTexture;let{treeRendering:r,doubleSided:i,doubleSidedType:a}=t;n.hasVertexTangents=!r&&t.hasVertexTangents,n.instanced=t.instanced,n.instancedDoublePrecision=t.instancedDoublePrecision,n.hasVVColor=!!t.vvColor,n.hasVVSize=!!t.vvSize,n.hasVerticalOffset=t.verticalOffset!=null,n.hasScreenSizePerspective=t.screenSizePerspective!=null,n.hasSlicePlane=t.hasSlicePlane,n.alphaDiscardMode=t.textureAlphaMode,n.normalType=r?0:t.normalType,n.transparent=this.transparent,n.enableOITOffset=e.enableOITOffset,n.customDepthTest=t.customDepthTest??0,n.hasOccludees=e.hasOccludees,n.cullFace=t.hasSlicePlane?0:t.cullFace,n.hasModelTransformation=!r&&t.modelTransformation!=null,n.hasVertexColors=t.hasVertexColors,n.hasSymbolColors=t.hasSymbolColors,n.doubleSidedMode=r?2:i&&a===`normal`?1:i&&a===`winding-order`?2:0,n.instancedFeatureAttribute=t.instancedFeatureAttribute,n.instancedColor=t.instancedColor,v(e.output)?(n.receiveShadows=t.receiveShadows,n.hasShadowHighlights=N(n,e),n.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&e.ssao!=null,n.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):n.receiveShadows=n.hasShadowHighlights=n.receiveAmbientOcclusion=n.receiveGlobalIllumination=!1,n.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,n.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,n.emissionSource=t.emissionSource,n.offsetBackfaces=!!(this.transparent&&t.offsetTransparentBackfaces),n.snowCover=e.snowCover>0,n.hasColorTextureTransform=!!t.colorTextureTransformMatrix,n.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,n.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,n.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,n.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,n,r,i,a,o){let s=this._getMaterialVerticalOffset(n,r);s!=null&&(i=t(R,i,s),a=t(z,a,s)),o=T(o,this._configuration,i,a),x(e,r,i,a,C(r.verticalOffset),o)}intersectScreenPolygon(e,t,n,r){return E(S(e,n,t,r,this._createScreenPolygonVertexDisplacement(t,n)),this._configuration,n.camera.eye)}createGLMaterial(e){return new I(e)}createBufferWriter(){return new w(this._layout)}get transparent(){let{drivenOpacity:e,opacity:t,externalColor:n,layerOpacity:r,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:s}=this.parameters,c=n[3];return e||t<1&&s!==`replace`||c<1&&s!==`ignore`||r<1||(i!=null||a!=null)&&o!==1&&o!==2&&s!==`replace`}_createScreenPolygonVertexDisplacement(e,t){let r=this._getMaterialVerticalOffset(e,t);return r==null?null:{applyToVertex:(e,t,n,i)=>(e[0]=t+r[0],e[1]=n+r[1],e[2]=i+r[2],e),applyToAabb:e=>(p(e,n(G,m(e,G),r)),h(e,n(G,g(e,G),r)),e)}}_getMaterialVerticalOffset(e,n){if(this.parameters.verticalOffset==null)return null;let u=n.camera;r(H,e[12],e[13],e[14]);let d=null;switch(n.viewingMode){case 1:d=a(V,H);break;case 2:d=i(V,B)}let f=t(U,H,u.eye),p=o(f),m=s(f,f,1/p),h=null;this.parameters.screenSizePerspective&&(h=c(d,m));let g=D(u,p,this.parameters.verticalOffset,h??0,this.parameters.screenSizePerspective,null);return s(d,d,g),l(W,d,n.transform.inverseRotation)}}class I extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});let t=this._material.parameters;this.updateTexture(t.textureId);let n=e.camera.viewInverseTransposeMatrix;return r(t.origin,n[3],n[7],n[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?M:A,e)}}class L extends k{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.emissiveTextureId!=null&&this.emissiveSource===0?3:this.emissiveSource===0?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||this.emissionSource===3||this.hasOcclusionTexture}}const R=d(),z=d(),B=f(0,0,1),V=d(),H=d(),U=d(),W=d(),G=d();export{I as DefaultGLMaterial,F as DefaultMaterial,L as DefaultMaterialParameters};
2
+ import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _,isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as S}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as C}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as T,applyPolygonOffsetToHit as E}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{getLayout as O,DefaultMaterialPassParameters as k,DefaultMaterialTechnique as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as j}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as M}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as N}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class F extends b{constructor(e,t){super(e,L),this.materialType=`default`,this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>_(e)&&!this.transparent],[4,e=>_(e)&&this.transparent]]),this._layout=O(this.parameters),this._configuration=new j(t.spherical)}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){let{layerOpacity:e,colorMixMode:t,opacity:n,externalColor:r}=this.parameters,i=t===`replace`?1:n,a=t===`ignore`||isNaN(r[3])?1:r[3];return e*i*a>=P}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===0&&this._hasEmissiveBase||this.parameters.emissiveSource===1)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this;n.hasNormalTexture=t.hasNormalTexture,n.hasColorTexture=t.hasColorTexture,n.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,n.hasOcclusionTexture=t.hasOcclusionTexture;let{treeRendering:r,doubleSided:i,doubleSidedType:a}=t;n.hasVertexTangents=!r&&t.hasVertexTangents,n.instanced=t.instanced,n.instancedDoublePrecision=t.instancedDoublePrecision,n.hasVVColor=!!t.vvColor,n.hasVVSize=!!t.vvSize,n.hasVerticalOffset=t.verticalOffset!=null,n.hasScreenSizePerspective=t.screenSizePerspective!=null,n.hasSlicePlane=t.hasSlicePlane,n.alphaDiscardMode=t.textureAlphaMode,n.normalType=r?0:t.normalType,n.transparent=this.transparent,n.enableOITOffset=e.enableOITOffset,n.customDepthTest=t.customDepthTest??0,n.hasOccludees=e.hasOccludees,n.cullFace=t.hasSlicePlane?0:t.cullFace,n.hasModelTransformation=!r&&t.modelTransformation!=null,n.hasVertexColors=t.hasVertexColors,n.hasSymbolColors=t.hasSymbolColors,n.doubleSidedMode=r?2:i&&a===`normal`?1:i&&a===`winding-order`?2:0,n.instancedFeatureAttribute=t.instancedFeatureAttribute,n.instancedColor=t.instancedColor,v(e.output)?(n.receiveShadows=t.receiveShadows,n.hasShadowHighlights=N(n,e),n.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&e.ssao!=null,n.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):n.receiveShadows=n.hasShadowHighlights=n.receiveAmbientOcclusion=n.receiveGlobalIllumination=!1,n.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,n.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,n.emissionSource=t.emissionSource,n.offsetBackfaces=!!(this.transparent&&t.offsetTransparentBackfaces),n.snowCover=e.snowCover>0,n.hasColorTextureTransform=!!t.colorTextureTransformMatrix,n.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,n.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,n.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,n.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,n,r,i,a,o){let s=this._getMaterialVerticalOffset(n,r);s!=null&&(i=t(R,i,s),a=t(z,a,s)),o=T(o,this._configuration,i,a),x(e,r,i,a,C(r.verticalOffset),o)}intersectScreenPolygon(e,t,n,r){return E(S(e,n,t,r,this._createScreenPolygonVertexDisplacement(t,n)),this._configuration,n.camera.eye)}createGLMaterial(e){return new I(e)}createBufferWriter(){return new w(this._layout)}get transparent(){let{drivenOpacity:e,opacity:t,externalColor:n,layerOpacity:r,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:s}=this.parameters,c=n[3];return e||t<1&&s!==`replace`||c<1&&s!==`ignore`||r<1||(i!=null||a!=null)&&o!==1&&o!==2&&s!==`replace`}_createScreenPolygonVertexDisplacement(e,t){let r=this._getMaterialVerticalOffset(e,t);return r==null?null:{applyToVertex:(e,t,n,i)=>(e[0]=t+r[0],e[1]=n+r[1],e[2]=i+r[2],e),applyToAabb:e=>(p(e,n(G,m(e,G),r)),h(e,n(G,g(e,G),r)),e)}}_getMaterialVerticalOffset(e,n){if(this.parameters.verticalOffset==null)return null;let u=n.camera;r(H,e[12],e[13],e[14]);let d=null;switch(n.viewingMode){case 1:d=a(V,H);break;case 2:d=i(V,B)}let f=t(U,H,u.eye),p=o(f),m=s(f,f,1/p),h=null;this.parameters.screenSizePerspective&&(h=c(d,m));let g=D(u,p,this.parameters.verticalOffset,h??0,this.parameters.screenSizePerspective,null);return s(d,d,g),l(W,d,n.transform.inverseRotation)}}class I extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});let t=this._material.parameters;this.updateTexture(t.textureId);let n=e.camera.viewInverseTransposeMatrix;return r(t.origin,n[3],n[7],n[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?M:A,e)}}class L extends k{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.emissiveTextureId!=null&&this.emissiveSource===0?3:this.emissiveSource===0?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||this.emissionSource===3||this.hasOcclusionTexture}}const R=d(),z=d(),B=f(0,0,1),V=d(),H=d(),U=d(),W=d(),G=d();export{I as DefaultGLMaterial,F as DefaultMaterial,L as DefaultMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c;for(let r=0;r<n.length;++r){let a=e[t*n[r]];s.set(i.offset+r,h(a,o))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
2
+ import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c;for(let r=0;r<n.length;++r){let a=e[t*n[r]];s.set(i.offset+r,h(a,o))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as j,BufferViewFloat as M,BufferViewVec4Unorm8 as N,BufferViewVec4f16 as te,BufferViewUint32 as ne}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as re,isColor as ie,isDepth as ae,isColorHighlightOLIDOrDepth as oe,is2DGeometryOutput as se}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as ce}from"../effects/geometry/olidUtils.js";import le from"../lib/GLMaterial.js";import{LineMaterial as ue}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as de,screenPolygonIntersectsBufferedSegment as fe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as pe,DrapedHit as me}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as he}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as ge,assert as P}from"../lib/Util.js";import{isImagePattern as _e}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ve}from"./VisualVariablePassParameters.js";import{writeColor as ye}from"./internal/bufferWriterUtils.js";import{n as be}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as xe,getTextureBufferLayout as Se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ce}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as we}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Te}from"../../../../webscene/support/AlphaCutoff.js";class Ee extends ue{constructor(e,t){super(e,Oe),this.produces=new Map([[2,e=>re(e)||ie(e)&&this.parameters.renderOccluded===8],[3,e=>ae(e)],[10,e=>oe(e)&&this.parameters.renderOccluded===8],[11,e=>oe(e)&&this.parameters.renderOccluded===8],[4,e=>ie(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>ie(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>se(e)]]),this._configuration=new we(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Ne(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Me(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Te||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Te}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=Ae(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of je(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,s){let{options:c,camera:_,rayBegin:v,rayEnd:y}=r;if(!c.selectionMode||!t.visible||!_)return;if(!ge(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let b=t.attributes,x=b.get(`position`).data,T=this._getLineSize(b),E=Ie;o(E,r.point);let D=T*_.pixelRatio,A=$*_.pixelRatio,j=D/2+A;l(X[0],E[0]-j,E[1]+j,0),l(X[1],E[0]+j,E[1]+j,0),l(X[2],E[0]+j,E[1]-j,0),l(X[3],E[0]-j,E[1]-j,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(X[e],Z[e]))return;O(_.eye,Z[0],Z[1],He),O(_.eye,Z[1],Z[2],Ue),O(_.eye,Z[2],Z[3],We),O(_.eye,Z[3],Z[0],Q);let M=Number.MAX_VALUE,N=0;for(let e of this._forEachTransformedLineSegment(L,R,x,n,I(this.parameters,b))){if(k(He,L)<0&&k(He,R)<0||k(Ue,L)<0&&k(Ue,R)<0||k(We,L)<0&&k(We,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=_.projectToRenderScreen(L,G),n=_.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=_.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!_.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=_.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!_.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let r=S(t,n,q),i=C(r,E);if(!(i>=M)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(r,L,R,E,_,T,A);if(i>=e*e)continue}M=i,m(ze,L),m(Be,R),N=e}}if(M<j*j){let e=Number.MAX_VALUE;if(w(S(ze,Be,q),S(v,y,Ve),W)){u(W,W,v);let t=h(W);f(W,W,1/t),e=t/g(v,y)}s(e,e,W,N)}}intersectScreenPolygon(t,n,r,i){let{options:a,camera:o,screenPolygonPrimitiveProcessor:s}=r;if(!a.selectionMode||!t.visible)return null;if(!ge(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let c=t.attributes,l=c.get(`position`).data,u=this._getLineSize(c),d=$,f=d*o.pixelRatio,p=new pe(4);for(let e of this._forEachTransformedLineSegment(L,R,l,n,I(this.parameters,c)))for(let[t,n]of s.processLineSegment(Ke,L,R)){if(!de(o,t,n,G,K))continue;let r=S(G,K,q),a=u/2+d;this.parameters.screenSizePerspective&&(_(Ie,G,K,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(r,t,n,Ie,o,u,f)/o.pixelRatio)),o.renderToScreen(G,Le),o.renderToScreen(K,Re),fe(i,Le,Re,a)&&(T(S(t,n,Ve),o.eye,V),p.updateIfCloserFromValues(g(o.eye,V),e,V,null))}return p}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=Ae(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of je(z,B,this.parameters,e,t))if(fe(r,z,B,o))return new me(n);return null}createBufferWriter(){return new ke(xe(this.parameters),Se(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new De(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Fe,V,i.viewMatrix);let c=h(Fe),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Pe.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Pe.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class De extends le{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ce,e)}}class Oe extends ve{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return _e(this.stipplePattern)&&this.stippleTexture!=null}}class ke{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Ne(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return I(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,j),l=o.getField(`u0`,M),u=o.getField(`sizeFeatureAttribute`,M),d=o.getField(`size`,M),f=o.getField(`colorFeatureAttribute`,M),p=o.getField(`color`,N),h=o.getField(`olidColor`,N),_=o.getField(`timeStamps`,te),v=o.getField(`opacityFeatureAttribute`,M),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);P(c!==null,`Expected valid position field in texture buffer`),P(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(Y,r.data,t,e),t>0&&(w==null?E+=g(J,Y):E=w[t]??E);let n=s+t+1;if(c.setVec(n,Y),l.set(n,E),m(J,Y),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){P(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,J),c.getVec(t,Y);let d=w?.[i]??E+g(J,Y);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);ce()&&D!=null&&h!=null&&ye(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ne);P(f!=null,`Missing texture buffer index field`),P(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;P(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),F(m,y+_,m,y,_),v=F(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=F(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function F(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function I(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function Ae(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*je(e,t,n,r,i){let a=r.get(`position`).data,c=I(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Me(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Ne(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return be+n}}const Pe=new he,L=b(),R=b(),z=c(),B=c(),V=b(),Fe=b(),H=b(),U=b(),W=b(),Ie=b(),G=n(),K=n(),Le=r(),Re=r(),ze=b(),Be=b(),q=D(),Ve=D(),J=b(),Y=b(),X=[n(),n(),n(),n()],Z=[b(),b(),b(),b()],He=A(),Ue=A(),We=A(),Q=A(),$=4,Ge={getDrapedRibbonLineMaxDistance:Ae},Ke=[b(),b()];export{Oe as Parameters,Ee as RibbonLineMaterial,Ge as test};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe,intersectScreenPolygonWithWorldSizedLineSegment as Se}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Ce}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as we,getTextureBufferLayout as Te}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as De}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";class ke extends de{constructor(e,t){super(e,je),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new De(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Fe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Oe||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Oe}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Ne(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=Re;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Y[0],_[0]-b,_[1]+b,0),l(Y[1],_[0]+b,_[1]+b,0),l(Y[2],_[0]+b,_[1]-b,0),l(Y[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Y[e],X[e]))return;O(a.eye,X[0],X[1],Ke),O(a.eye,X[1],X[2],Z),O(a.eye,X[2],X[3],qe),O(a.eye,X[3],X[0],Q);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ke,L)<0&&k(Ke,R)<0||k(Z,L)<0&&k(Z,R)<0||k(qe,L)<0&&k(qe,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=a.projectToRenderScreen(L,G),n=a.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,We),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(Ve,L),m(He,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(Ve,He,We),S(e,t,Ge),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ue);if(t!=null&&t<d&&(d=t,f=e,m(W,Ue),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let o=this._getLineSize(t.attributes);return this.parameters.worldSized?this._intersectWorldSizedPolygon(t,n,r,i,o):this._intersectScreenSizedPolygon(t,n,r,i,o)}_intersectScreenSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o}=n,s=e.attributes,c=s.get(`position`).data,l=$,u=l*a.pixelRatio,d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s)))for(let[t,n]of o.processLineSegment(Ye,L,R)){if(!fe(a,t,n,G,K))continue;let o=S(G,K,We),s=i/2+l;this.parameters.screenSizePerspective&&(_(Re,G,K,.5),s=Math.max(s,this.computeScreenSizePerspectiveWidth(o,t,n,Re,a,i,u)/a.pixelRatio)),a.renderToScreen(G,ze),a.renderToScreen(K,Be),pe(r,ze,Be,s)&&(T(S(t,n,Ge),a.eye,V),d.updateIfCloserFromValues(g(a.eye,V),e,V,null))}return d}_intersectWorldSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o,metersPerRenderUnit:s}=n,{attributes:c}=e,l=c.get(`position`).data,u=i/(2*s),d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c)))for(let[t,n]of o.processLineSegment(Ye,L,R)){T(S(t,n,Ge),a.eye,V);let i=g(a.eye,V);d.valid&&i>=d.distance||Se(t,n,u,a,r)&&d.updateIfCloserFromValues(i,e,V,null)}return d}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Ne(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new Me(we(this.parameters),Te(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new Ae(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Le,V,i.viewMatrix);let c=h(Le),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Ie.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Ie.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class Ae extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ee,e)}}class je extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class Me{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Fe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(J,r.data,t,e),t>0&&(w==null?E+=g(q,J):E=w[t]??E);let n=s+t+1;if(c.setVec(n,J),l.set(n,E),m(q,J),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,q),c.getVec(t,J);let d=w?.[i]??E+g(q,J);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Ne(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Pe(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Fe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Ce+n}}const Ie=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Le=b(),H=b(),U=b(),W=b(),Re=b(),G=n(),K=n(),ze=r(),Be=r(),Ve=b(),He=b(),Ue=b(),We=D(),Ge=D(),q=b(),J=b(),Y=[n(),n(),n(),n()],X=[b(),b(),b(),b()],Ke=A(),Z=A(),qe=A(),Q=A(),$=4,Je={getDrapedRibbonLineMaxDistance:I},Ye=[b(),b()];export{je as Parameters,ke as RibbonLineMaterial,Je as test};