@aura3d/rendering 3.0.1 → 4.0.0

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 (1764) hide show
  1. package/dist/BlendModes.d.ts +34 -0
  2. package/dist/BlendModes.d.ts.map +1 -0
  3. package/dist/BlendModes.js +42 -0
  4. package/dist/BlendModes.js.map +1 -0
  5. package/dist/DepthPass.d.ts +18 -0
  6. package/dist/DepthPass.d.ts.map +1 -1
  7. package/dist/DepthPass.js +103 -20
  8. package/dist/DepthPass.js.map +1 -1
  9. package/dist/EnvironmentBackgroundPass.d.ts +7 -0
  10. package/dist/EnvironmentBackgroundPass.d.ts.map +1 -1
  11. package/dist/EnvironmentBackgroundPass.js +39 -14
  12. package/dist/EnvironmentBackgroundPass.js.map +1 -1
  13. package/dist/EnvironmentMapResources.d.ts +1 -1
  14. package/dist/EnvironmentMapResources.d.ts.map +1 -1
  15. package/dist/EnvironmentMapResources.js +19 -8
  16. package/dist/EnvironmentMapResources.js.map +1 -1
  17. package/dist/EnvironmentPlatform.d.ts +6 -0
  18. package/dist/EnvironmentPlatform.d.ts.map +1 -1
  19. package/dist/EnvironmentPlatform.js +3 -1
  20. package/dist/EnvironmentPlatform.js.map +1 -1
  21. package/dist/EnvironmentPreset.d.ts +7 -0
  22. package/dist/EnvironmentPreset.d.ts.map +1 -1
  23. package/dist/EnvironmentPreset.js +11 -11
  24. package/dist/EnvironmentPreset.js.map +1 -1
  25. package/dist/EnvironmentPresetPack.d.ts +16 -0
  26. package/dist/EnvironmentPresetPack.d.ts.map +1 -1
  27. package/dist/EnvironmentPresetPack.js +28 -0
  28. package/dist/EnvironmentPresetPack.js.map +1 -1
  29. package/dist/ExternalParityRenderPreset.d.ts +15 -1
  30. package/dist/ExternalParityRenderPreset.d.ts.map +1 -1
  31. package/dist/ExternalParityRenderPreset.js +52 -7
  32. package/dist/ExternalParityRenderPreset.js.map +1 -1
  33. package/dist/ForwardPass.d.ts +240 -50
  34. package/dist/ForwardPass.d.ts.map +1 -1
  35. package/dist/ForwardPass.js +845 -866
  36. package/dist/ForwardPass.js.map +1 -1
  37. package/dist/Geometry.d.ts +44 -1
  38. package/dist/Geometry.d.ts.map +1 -1
  39. package/dist/Geometry.js +174 -24
  40. package/dist/Geometry.js.map +1 -1
  41. package/dist/InstancedPBRMaterial.d.ts +5 -0
  42. package/dist/InstancedPBRMaterial.d.ts.map +1 -1
  43. package/dist/InstancedPBRMaterial.js +7 -0
  44. package/dist/InstancedPBRMaterial.js.map +1 -1
  45. package/dist/LightCollector.d.ts +8 -0
  46. package/dist/LightCollector.d.ts.map +1 -1
  47. package/dist/LightCollector.js +1 -1
  48. package/dist/LightCollector.js.map +1 -1
  49. package/dist/LightUniforms.d.ts +78 -0
  50. package/dist/LightUniforms.d.ts.map +1 -1
  51. package/dist/LightUniforms.js +100 -0
  52. package/dist/LightUniforms.js.map +1 -1
  53. package/dist/Material.d.ts +15 -0
  54. package/dist/Material.d.ts.map +1 -1
  55. package/dist/Material.js +19 -2
  56. package/dist/Material.js.map +1 -1
  57. package/dist/MaterialBinding.d.ts +10 -0
  58. package/dist/MaterialBinding.d.ts.map +1 -1
  59. package/dist/MaterialBinding.js +91 -1
  60. package/dist/MaterialBinding.js.map +1 -1
  61. package/dist/MaterialPresets.d.ts +60 -0
  62. package/dist/MaterialPresets.d.ts.map +1 -1
  63. package/dist/MaterialPresets.js +212 -0
  64. package/dist/MaterialPresets.js.map +1 -1
  65. package/dist/NormalMappedPBRMaterial.d.ts +5 -0
  66. package/dist/NormalMappedPBRMaterial.d.ts.map +1 -1
  67. package/dist/NormalMappedPBRMaterial.js +7 -0
  68. package/dist/NormalMappedPBRMaterial.js.map +1 -1
  69. package/dist/OceanSurface.d.ts +8 -0
  70. package/dist/OceanSurface.d.ts.map +1 -1
  71. package/dist/OceanSurface.js +10 -79
  72. package/dist/OceanSurface.js.map +1 -1
  73. package/dist/PBRLightingDefaults.d.ts +8 -0
  74. package/dist/PBRLightingDefaults.d.ts.map +1 -1
  75. package/dist/PBRLightingDefaults.js +8 -0
  76. package/dist/PBRLightingDefaults.js.map +1 -1
  77. package/dist/PBRMaterial.d.ts +5 -0
  78. package/dist/PBRMaterial.d.ts.map +1 -1
  79. package/dist/PBRMaterial.js +7 -0
  80. package/dist/PBRMaterial.js.map +1 -1
  81. package/dist/PostProcessPass.d.ts +6 -490
  82. package/dist/PostProcessPass.d.ts.map +1 -1
  83. package/dist/PostProcessPass.js +6 -2016
  84. package/dist/PostProcessPass.js.map +1 -1
  85. package/dist/ProceduralMaterialTextures.d.ts +28 -0
  86. package/dist/ProceduralMaterialTextures.d.ts.map +1 -0
  87. package/dist/ProceduralMaterialTextures.js +217 -0
  88. package/dist/ProceduralMaterialTextures.js.map +1 -0
  89. package/dist/ReflectionProbe.d.ts.map +1 -1
  90. package/dist/ReflectionProbe.js +4 -1
  91. package/dist/ReflectionProbe.js.map +1 -1
  92. package/dist/RenderBackend.d.ts +2 -0
  93. package/dist/RenderBackend.d.ts.map +1 -1
  94. package/dist/RenderBackend.js +3 -0
  95. package/dist/RenderBackend.js.map +1 -1
  96. package/dist/RenderDevice.d.ts +92 -5
  97. package/dist/RenderDevice.d.ts.map +1 -1
  98. package/dist/RenderDevice.js +166 -9
  99. package/dist/RenderDevice.js.map +1 -1
  100. package/dist/RenderGraph.d.ts.map +1 -1
  101. package/dist/RenderGraph.js +17 -0
  102. package/dist/RenderGraph.js.map +1 -1
  103. package/dist/RenderPass.d.ts +7 -0
  104. package/dist/RenderPass.d.ts.map +1 -1
  105. package/dist/RenderPass.js.map +1 -1
  106. package/dist/RenderPipeline.d.ts +5 -0
  107. package/dist/RenderPipeline.d.ts.map +1 -1
  108. package/dist/RenderPipeline.js +6 -0
  109. package/dist/RenderPipeline.js.map +1 -1
  110. package/dist/Renderer.d.ts +261 -66
  111. package/dist/Renderer.d.ts.map +1 -1
  112. package/dist/Renderer.js +889 -1254
  113. package/dist/Renderer.js.map +1 -1
  114. package/dist/RendererPostprocessPlan.d.ts +4 -0
  115. package/dist/RendererPostprocessPlan.d.ts.map +1 -1
  116. package/dist/RendererPostprocessPlan.js +16 -2
  117. package/dist/RendererPostprocessPlan.js.map +1 -1
  118. package/dist/RendererTiming.d.ts +27 -0
  119. package/dist/RendererTiming.d.ts.map +1 -1
  120. package/dist/RendererTiming.js +179 -12
  121. package/dist/RendererTiming.js.map +1 -1
  122. package/dist/ResolutionGovernor.d.ts +56 -0
  123. package/dist/ResolutionGovernor.d.ts.map +1 -0
  124. package/dist/ResolutionGovernor.js +87 -0
  125. package/dist/ResolutionGovernor.js.map +1 -0
  126. package/dist/Sampler.d.ts +34 -1
  127. package/dist/Sampler.d.ts.map +1 -1
  128. package/dist/Sampler.js +55 -2
  129. package/dist/Sampler.js.map +1 -1
  130. package/dist/ShaderLibrary.d.ts.map +1 -1
  131. package/dist/ShaderLibrary.js +15 -10
  132. package/dist/ShaderLibrary.js.map +1 -1
  133. package/dist/ShaderLibraryCore.d.ts.map +1 -1
  134. package/dist/ShaderLibraryCore.js +3 -2
  135. package/dist/ShaderLibraryCore.js.map +1 -1
  136. package/dist/ShaderModule.d.ts +7 -1
  137. package/dist/ShaderModule.d.ts.map +1 -1
  138. package/dist/ShaderModule.js +20 -5
  139. package/dist/ShaderModule.js.map +1 -1
  140. package/dist/ShadowPass.d.ts.map +1 -1
  141. package/dist/ShadowPass.js +14 -7
  142. package/dist/ShadowPass.js.map +1 -1
  143. package/dist/SkinnedLitMaterial.d.ts +5 -0
  144. package/dist/SkinnedLitMaterial.d.ts.map +1 -1
  145. package/dist/SkinnedLitMaterial.js +13 -0
  146. package/dist/SkinnedLitMaterial.js.map +1 -1
  147. package/dist/SkinningBounds.d.ts +18 -0
  148. package/dist/SkinningBounds.d.ts.map +1 -1
  149. package/dist/SkinningBounds.js +78 -0
  150. package/dist/SkinningBounds.js.map +1 -1
  151. package/dist/SkinningPaletteTextureCache.d.ts +117 -0
  152. package/dist/SkinningPaletteTextureCache.d.ts.map +1 -0
  153. package/dist/SkinningPaletteTextureCache.js +205 -0
  154. package/dist/SkinningPaletteTextureCache.js.map +1 -0
  155. package/dist/SkinningUniforms.d.ts +56 -0
  156. package/dist/SkinningUniforms.d.ts.map +1 -0
  157. package/dist/SkinningUniforms.js +262 -0
  158. package/dist/SkinningUniforms.js.map +1 -0
  159. package/dist/TemporalHistory.d.ts +33 -0
  160. package/dist/TemporalHistory.d.ts.map +1 -1
  161. package/dist/TemporalHistory.js +84 -1
  162. package/dist/TemporalHistory.js.map +1 -1
  163. package/dist/TerrainHeightfield.d.ts +12 -0
  164. package/dist/TerrainHeightfield.d.ts.map +1 -1
  165. package/dist/TerrainHeightfield.js +29 -6
  166. package/dist/TerrainHeightfield.js.map +1 -1
  167. package/dist/TerrainTiles.d.ts +40 -10
  168. package/dist/TerrainTiles.d.ts.map +1 -1
  169. package/dist/TerrainTiles.js +18 -57
  170. package/dist/TerrainTiles.js.map +1 -1
  171. package/dist/Texture.d.ts +47 -2
  172. package/dist/Texture.d.ts.map +1 -1
  173. package/dist/Texture.js +119 -3
  174. package/dist/Texture.js.map +1 -1
  175. package/dist/TexturedPBRMaterial.d.ts +24 -0
  176. package/dist/TexturedPBRMaterial.d.ts.map +1 -1
  177. package/dist/TexturedPBRMaterial.js +72 -20
  178. package/dist/TexturedPBRMaterial.js.map +1 -1
  179. package/dist/TransmissionRenderTarget.d.ts +33 -0
  180. package/dist/TransmissionRenderTarget.d.ts.map +1 -0
  181. package/dist/TransmissionRenderTarget.js +61 -0
  182. package/dist/TransmissionRenderTarget.js.map +1 -0
  183. package/dist/VegetationScatter.js +1 -1
  184. package/dist/VegetationScatter.js.map +1 -1
  185. package/dist/VolumetricFog.d.ts +42 -0
  186. package/dist/VolumetricFog.d.ts.map +1 -1
  187. package/dist/VolumetricFog.js +52 -1
  188. package/dist/VolumetricFog.js.map +1 -1
  189. package/dist/WaterSurface.d.ts +5 -0
  190. package/dist/WaterSurface.d.ts.map +1 -1
  191. package/dist/WaterSurface.js +5 -0
  192. package/dist/WaterSurface.js.map +1 -1
  193. package/dist/WebGL2Device.d.ts +153 -207
  194. package/dist/WebGL2Device.d.ts.map +1 -1
  195. package/dist/WebGL2Device.js +822 -3706
  196. package/dist/WebGL2Device.js.map +1 -1
  197. package/dist/WebGL2StateCache.d.ts +15 -1
  198. package/dist/WebGL2StateCache.d.ts.map +1 -1
  199. package/dist/WebGL2StateCache.js +31 -2
  200. package/dist/WebGL2StateCache.js.map +1 -1
  201. package/dist/WebGPUDevice.d.ts +0 -4
  202. package/dist/WebGPUDevice.d.ts.map +1 -1
  203. package/dist/WebGPUDevice.js +31 -605
  204. package/dist/WebGPUDevice.js.map +1 -1
  205. package/dist/WebGPUSkinningLimits.d.ts +10 -1
  206. package/dist/WebGPUSkinningLimits.d.ts.map +1 -1
  207. package/dist/WebGPUSkinningLimits.js +15 -1
  208. package/dist/WebGPUSkinningLimits.js.map +1 -1
  209. package/dist/advanced-runtime/index.d.ts +6 -2
  210. package/dist/advanced-runtime/index.d.ts.map +1 -1
  211. package/dist/advanced-runtime/index.js +0 -1
  212. package/dist/advanced-runtime/index.js.map +1 -1
  213. package/dist/animation/AnimationRenderPreset.d.ts +1 -1
  214. package/dist/animation/AnimationRenderPreset.d.ts.map +1 -1
  215. package/dist/animation/AnimationRenderPreset.js +1 -1
  216. package/dist/animation/AnimationRenderPreset.js.map +1 -1
  217. package/dist/animation/applyAnimationRenderPreset.d.ts +1 -1
  218. package/dist/animation/applyAnimationRenderPreset.d.ts.map +1 -1
  219. package/dist/animation/index.d.ts +2 -1
  220. package/dist/animation/index.d.ts.map +1 -1
  221. package/dist/animation/index.js +1 -1
  222. package/dist/animation/index.js.map +1 -1
  223. package/dist/atmosphere/CloudLayer.d.ts +24 -0
  224. package/dist/atmosphere/CloudLayer.d.ts.map +1 -0
  225. package/dist/atmosphere/CloudLayer.js +30 -0
  226. package/dist/atmosphere/CloudLayer.js.map +1 -0
  227. package/dist/atmosphere/FogVolumes.d.ts +30 -0
  228. package/dist/atmosphere/FogVolumes.d.ts.map +1 -0
  229. package/dist/atmosphere/FogVolumes.js +96 -0
  230. package/dist/atmosphere/FogVolumes.js.map +1 -0
  231. package/dist/atmosphere/GradientSky.d.ts +40 -0
  232. package/dist/atmosphere/GradientSky.d.ts.map +1 -0
  233. package/dist/atmosphere/GradientSky.js +75 -0
  234. package/dist/atmosphere/GradientSky.js.map +1 -0
  235. package/dist/atmosphere/HeightFog.d.ts +154 -0
  236. package/dist/atmosphere/HeightFog.d.ts.map +1 -0
  237. package/dist/atmosphere/HeightFog.js +379 -0
  238. package/dist/atmosphere/HeightFog.js.map +1 -0
  239. package/dist/atmosphere/PreethamSky.d.ts +38 -0
  240. package/dist/atmosphere/PreethamSky.d.ts.map +1 -0
  241. package/dist/atmosphere/PreethamSky.js +150 -0
  242. package/dist/atmosphere/PreethamSky.js.map +1 -0
  243. package/dist/atmosphere/SkyBackgroundPass.d.ts +63 -0
  244. package/dist/atmosphere/SkyBackgroundPass.d.ts.map +1 -0
  245. package/dist/atmosphere/SkyBackgroundPass.js +233 -0
  246. package/dist/atmosphere/SkyBackgroundPass.js.map +1 -0
  247. package/dist/atmosphere/SkyCaptureAdapter.d.ts +45 -0
  248. package/dist/atmosphere/SkyCaptureAdapter.d.ts.map +1 -0
  249. package/dist/atmosphere/SkyCaptureAdapter.js +65 -0
  250. package/dist/atmosphere/SkyCaptureAdapter.js.map +1 -0
  251. package/dist/atmosphere/SkyEval.d.ts +56 -0
  252. package/dist/atmosphere/SkyEval.d.ts.map +1 -0
  253. package/dist/atmosphere/SkyEval.js +99 -0
  254. package/dist/atmosphere/SkyEval.js.map +1 -0
  255. package/dist/atmosphere/StarField.d.ts +26 -0
  256. package/dist/atmosphere/StarField.d.ts.map +1 -0
  257. package/dist/atmosphere/StarField.js +31 -0
  258. package/dist/atmosphere/StarField.js.map +1 -0
  259. package/dist/atmosphere/VolumetricFogPass.d.ts +69 -0
  260. package/dist/atmosphere/VolumetricFogPass.d.ts.map +1 -0
  261. package/dist/atmosphere/VolumetricFogPass.js +265 -0
  262. package/dist/atmosphere/VolumetricFogPass.js.map +1 -0
  263. package/dist/atmosphere/fogChunks.d.ts +8 -0
  264. package/dist/atmosphere/fogChunks.d.ts.map +1 -0
  265. package/dist/atmosphere/fogChunks.js +39 -0
  266. package/dist/atmosphere/fogChunks.js.map +1 -0
  267. package/dist/atmosphere/fogUniformStore.d.ts +20 -0
  268. package/dist/atmosphere/fogUniformStore.d.ts.map +1 -0
  269. package/dist/atmosphere/fogUniformStore.js +45 -0
  270. package/dist/atmosphere/fogUniformStore.js.map +1 -0
  271. package/dist/atmosphere/shaders/fog.glsl.d.ts +10 -0
  272. package/dist/atmosphere/shaders/fog.glsl.d.ts.map +1 -0
  273. package/dist/atmosphere/shaders/fog.glsl.js +161 -0
  274. package/dist/atmosphere/shaders/fog.glsl.js.map +1 -0
  275. package/dist/atmosphere/shaders/volumetric-apply.glsl.d.ts +3 -0
  276. package/dist/atmosphere/shaders/volumetric-apply.glsl.d.ts.map +1 -0
  277. package/dist/atmosphere/shaders/volumetric-apply.glsl.js +61 -0
  278. package/dist/atmosphere/shaders/volumetric-apply.glsl.js.map +1 -0
  279. package/dist/atmosphere/shaders/volumetric-inject.glsl.d.ts +4 -0
  280. package/dist/atmosphere/shaders/volumetric-inject.glsl.d.ts.map +1 -0
  281. package/dist/atmosphere/shaders/volumetric-inject.glsl.js +129 -0
  282. package/dist/atmosphere/shaders/volumetric-inject.glsl.js.map +1 -0
  283. package/dist/atmosphere/shaders/volumetric-integrate.glsl.d.ts +3 -0
  284. package/dist/atmosphere/shaders/volumetric-integrate.glsl.d.ts.map +1 -0
  285. package/dist/atmosphere/shaders/volumetric-integrate.glsl.js +55 -0
  286. package/dist/atmosphere/shaders/volumetric-integrate.glsl.js.map +1 -0
  287. package/dist/atmosphere/shaders/wetness.glsl.d.ts +34 -0
  288. package/dist/atmosphere/shaders/wetness.glsl.d.ts.map +1 -0
  289. package/dist/atmosphere/shaders/wetness.glsl.js +101 -0
  290. package/dist/atmosphere/shaders/wetness.glsl.js.map +1 -0
  291. package/dist/atmosphere/sky.glsl.d.ts +8 -0
  292. package/dist/atmosphere/sky.glsl.d.ts.map +1 -0
  293. package/dist/atmosphere/sky.glsl.js +249 -0
  294. package/dist/atmosphere/sky.glsl.js.map +1 -0
  295. package/dist/batching/BatchedGeometryPool.d.ts +72 -0
  296. package/dist/batching/BatchedGeometryPool.d.ts.map +1 -0
  297. package/dist/batching/BatchedGeometryPool.js +138 -0
  298. package/dist/batching/BatchedGeometryPool.js.map +1 -0
  299. package/dist/batching/ContentKeys.d.ts +29 -0
  300. package/dist/batching/ContentKeys.d.ts.map +1 -0
  301. package/dist/batching/ContentKeys.js +220 -0
  302. package/dist/batching/ContentKeys.js.map +1 -0
  303. package/dist/batching/DrawDataTexture.d.ts +51 -0
  304. package/dist/batching/DrawDataTexture.d.ts.map +1 -0
  305. package/dist/batching/DrawDataTexture.js +99 -0
  306. package/dist/batching/DrawDataTexture.js.map +1 -0
  307. package/dist/batching/MultiDrawBatch.d.ts +64 -0
  308. package/dist/batching/MultiDrawBatch.d.ts.map +1 -0
  309. package/dist/batching/MultiDrawBatch.js +103 -0
  310. package/dist/batching/MultiDrawBatch.js.map +1 -0
  311. package/dist/batching/StaticMergePlanner.d.ts +80 -0
  312. package/dist/batching/StaticMergePlanner.d.ts.map +1 -0
  313. package/dist/batching/StaticMergePlanner.js +323 -0
  314. package/dist/batching/StaticMergePlanner.js.map +1 -0
  315. package/dist/batching/index.d.ts +8 -0
  316. package/dist/batching/index.d.ts.map +1 -0
  317. package/dist/batching/index.js +8 -0
  318. package/dist/batching/index.js.map +1 -0
  319. package/dist/batching/shaders/drawId.glsl.d.ts +29 -0
  320. package/dist/batching/shaders/drawId.glsl.d.ts.map +1 -0
  321. package/dist/batching/shaders/drawId.glsl.js +93 -0
  322. package/dist/batching/shaders/drawId.glsl.js.map +1 -0
  323. package/dist/batching/shaders/instanceEmissive.glsl.d.ts +16 -0
  324. package/dist/batching/shaders/instanceEmissive.glsl.d.ts.map +1 -0
  325. package/dist/batching/shaders/instanceEmissive.glsl.js +63 -0
  326. package/dist/batching/shaders/instanceEmissive.glsl.js.map +1 -0
  327. package/dist/cinematic/BloomPass.d.ts +5 -9
  328. package/dist/cinematic/BloomPass.d.ts.map +1 -1
  329. package/dist/cinematic/BloomPass.js +5 -17
  330. package/dist/cinematic/BloomPass.js.map +1 -1
  331. package/dist/cinematic/DepthHazePass.d.ts +5 -11
  332. package/dist/cinematic/DepthHazePass.d.ts.map +1 -1
  333. package/dist/cinematic/DepthHazePass.js +5 -19
  334. package/dist/cinematic/DepthHazePass.js.map +1 -1
  335. package/dist/cinematic/FilmGrainPass.d.ts +5 -8
  336. package/dist/cinematic/FilmGrainPass.d.ts.map +1 -1
  337. package/dist/cinematic/FilmGrainPass.js +5 -16
  338. package/dist/cinematic/FilmGrainPass.js.map +1 -1
  339. package/dist/cinematic/VignettePass.d.ts +5 -9
  340. package/dist/cinematic/VignettePass.d.ts.map +1 -1
  341. package/dist/cinematic/VignettePass.js +5 -16
  342. package/dist/cinematic/VignettePass.js.map +1 -1
  343. package/dist/cinematic/index.d.ts +2 -1
  344. package/dist/cinematic/index.d.ts.map +1 -1
  345. package/dist/cinematic/index.js +1 -1
  346. package/dist/cinematic/index.js.map +1 -1
  347. package/dist/contracts/atmosphere.d.ts +30 -0
  348. package/dist/contracts/atmosphere.d.ts.map +1 -0
  349. package/dist/contracts/atmosphere.js +42 -0
  350. package/dist/contracts/atmosphere.js.map +1 -0
  351. package/dist/contracts/blend.d.ts +28 -0
  352. package/dist/contracts/blend.d.ts.map +1 -0
  353. package/dist/contracts/blend.js +73 -0
  354. package/dist/contracts/blend.js.map +1 -0
  355. package/dist/contracts/core.d.ts +47 -0
  356. package/dist/contracts/core.d.ts.map +1 -0
  357. package/dist/contracts/core.js +70 -0
  358. package/dist/contracts/core.js.map +1 -0
  359. package/dist/contracts/deform.d.ts +38 -0
  360. package/dist/contracts/deform.d.ts.map +1 -0
  361. package/dist/contracts/deform.js +14 -0
  362. package/dist/contracts/deform.js.map +1 -0
  363. package/dist/contracts/device.d.ts +71 -0
  364. package/dist/contracts/device.d.ts.map +1 -0
  365. package/dist/contracts/device.js +97 -0
  366. package/dist/contracts/device.js.map +1 -0
  367. package/dist/contracts/environment.d.ts +55 -0
  368. package/dist/contracts/environment.d.ts.map +1 -0
  369. package/dist/contracts/environment.js +115 -0
  370. package/dist/contracts/environment.js.map +1 -0
  371. package/dist/contracts/flags.state.d.ts +15 -0
  372. package/dist/contracts/flags.state.d.ts.map +1 -0
  373. package/dist/contracts/flags.state.js +45 -0
  374. package/dist/contracts/flags.state.js.map +1 -0
  375. package/dist/contracts/frameGraph.d.ts +78 -0
  376. package/dist/contracts/frameGraph.d.ts.map +1 -0
  377. package/dist/contracts/frameGraph.js +32 -0
  378. package/dist/contracts/frameGraph.js.map +1 -0
  379. package/dist/contracts/frameUniforms.d.ts +43 -0
  380. package/dist/contracts/frameUniforms.d.ts.map +1 -0
  381. package/dist/contracts/frameUniforms.js +35 -0
  382. package/dist/contracts/frameUniforms.js.map +1 -0
  383. package/dist/contracts/geometry.d.ts +33 -0
  384. package/dist/contracts/geometry.d.ts.map +1 -0
  385. package/dist/contracts/geometry.js +59 -0
  386. package/dist/contracts/geometry.js.map +1 -0
  387. package/dist/contracts/index.d.ts +27 -0
  388. package/dist/contracts/index.d.ts.map +1 -0
  389. package/dist/contracts/index.js +27 -0
  390. package/dist/contracts/index.js.map +1 -0
  391. package/dist/contracts/materialLobes.d.ts +41 -0
  392. package/dist/contracts/materialLobes.d.ts.map +1 -0
  393. package/dist/contracts/materialLobes.js +14 -0
  394. package/dist/contracts/materialLobes.js.map +1 -0
  395. package/dist/contracts/output.d.ts +35 -0
  396. package/dist/contracts/output.d.ts.map +1 -0
  397. package/dist/contracts/output.js +18 -0
  398. package/dist/contracts/output.js.map +1 -0
  399. package/dist/contracts/particles.d.ts +41 -0
  400. package/dist/contracts/particles.d.ts.map +1 -0
  401. package/dist/contracts/particles.js +15 -0
  402. package/dist/contracts/particles.js.map +1 -0
  403. package/dist/contracts/post.d.ts +71 -0
  404. package/dist/contracts/post.d.ts.map +1 -0
  405. package/dist/contracts/post.js +28 -0
  406. package/dist/contracts/post.js.map +1 -0
  407. package/dist/contracts/program.d.ts +158 -0
  408. package/dist/contracts/program.d.ts.map +1 -0
  409. package/dist/contracts/program.js +128 -0
  410. package/dist/contracts/program.js.map +1 -0
  411. package/dist/contracts/quality.d.ts +93 -0
  412. package/dist/contracts/quality.d.ts.map +1 -0
  413. package/dist/contracts/quality.js +149 -0
  414. package/dist/contracts/quality.js.map +1 -0
  415. package/dist/contracts/renderItem.d.ts +58 -0
  416. package/dist/contracts/renderItem.d.ts.map +1 -0
  417. package/dist/contracts/renderItem.js +8 -0
  418. package/dist/contracts/renderItem.js.map +1 -0
  419. package/dist/contracts/renderSource.d.ts +63 -0
  420. package/dist/contracts/renderSource.d.ts.map +1 -0
  421. package/dist/contracts/renderSource.js +7 -0
  422. package/dist/contracts/renderSource.js.map +1 -0
  423. package/dist/contracts/rendererFactory.d.ts +42 -0
  424. package/dist/contracts/rendererFactory.d.ts.map +1 -0
  425. package/dist/contracts/rendererFactory.js +32 -0
  426. package/dist/contracts/rendererFactory.js.map +1 -0
  427. package/dist/contracts/sampling.d.ts +23 -0
  428. package/dist/contracts/sampling.d.ts.map +1 -0
  429. package/dist/contracts/sampling.js +17 -0
  430. package/dist/contracts/sampling.js.map +1 -0
  431. package/dist/contracts/shadows.d.ts +53 -0
  432. package/dist/contracts/shadows.d.ts.map +1 -0
  433. package/dist/contracts/shadows.js +66 -0
  434. package/dist/contracts/shadows.js.map +1 -0
  435. package/dist/contracts/testing/ChunkHarness.d.ts +18 -0
  436. package/dist/contracts/testing/ChunkHarness.d.ts.map +1 -0
  437. package/dist/contracts/testing/ChunkHarness.js +68 -0
  438. package/dist/contracts/testing/ChunkHarness.js.map +1 -0
  439. package/dist/contracts/textureFormats.d.ts +18 -0
  440. package/dist/contracts/textureFormats.d.ts.map +1 -0
  441. package/dist/contracts/textureFormats.js +13 -0
  442. package/dist/contracts/textureFormats.js.map +1 -0
  443. package/dist/contracts/velocity.d.ts +37 -0
  444. package/dist/contracts/velocity.d.ts.map +1 -0
  445. package/dist/contracts/velocity.js +22 -0
  446. package/dist/contracts/velocity.js.map +1 -0
  447. package/dist/environment/EnvUniforms.d.ts +42 -0
  448. package/dist/environment/EnvUniforms.d.ts.map +1 -0
  449. package/dist/environment/EnvUniforms.js +54 -0
  450. package/dist/environment/EnvUniforms.js.map +1 -0
  451. package/dist/environment/EnvironmentCache.d.ts +83 -0
  452. package/dist/environment/EnvironmentCache.d.ts.map +1 -0
  453. package/dist/environment/EnvironmentCache.js +205 -0
  454. package/dist/environment/EnvironmentCache.js.map +1 -0
  455. package/dist/environment/EnvironmentProbeFactory.d.ts +41 -0
  456. package/dist/environment/EnvironmentProbeFactory.d.ts.map +1 -0
  457. package/dist/environment/EnvironmentProbeFactory.js +52 -0
  458. package/dist/environment/EnvironmentProbeFactory.js.map +1 -0
  459. package/dist/environment/GPUPMREMGenerator.d.ts +44 -0
  460. package/dist/environment/GPUPMREMGenerator.d.ts.map +1 -0
  461. package/dist/environment/GPUPMREMGenerator.js +98 -0
  462. package/dist/environment/GPUPMREMGenerator.js.map +1 -0
  463. package/dist/environment/HdrEquirect.d.ts +28 -0
  464. package/dist/environment/HdrEquirect.d.ts.map +1 -0
  465. package/dist/environment/HdrEquirect.js +205 -0
  466. package/dist/environment/HdrEquirect.js.map +1 -0
  467. package/dist/environment/LightingSamplerBudget.d.ts +20 -0
  468. package/dist/environment/LightingSamplerBudget.d.ts.map +1 -0
  469. package/dist/environment/LightingSamplerBudget.js +94 -0
  470. package/dist/environment/LightingSamplerBudget.js.map +1 -0
  471. package/dist/environment/Prd02BackgroundShaderLibrary.d.ts +10 -0
  472. package/dist/environment/Prd02BackgroundShaderLibrary.d.ts.map +1 -0
  473. package/dist/environment/Prd02BackgroundShaderLibrary.js +100 -0
  474. package/dist/environment/Prd02BackgroundShaderLibrary.js.map +1 -0
  475. package/dist/environment/Rgb9e5Cube.d.ts +25 -0
  476. package/dist/environment/Rgb9e5Cube.d.ts.map +1 -0
  477. package/dist/environment/Rgb9e5Cube.js +103 -0
  478. package/dist/environment/Rgb9e5Cube.js.map +1 -0
  479. package/dist/environment/RoomEnvironmentScene.d.ts +57 -0
  480. package/dist/environment/RoomEnvironmentScene.d.ts.map +1 -0
  481. package/dist/environment/RoomEnvironmentScene.js +165 -0
  482. package/dist/environment/RoomEnvironmentScene.js.map +1 -0
  483. package/dist/environment/SphericalHarmonics.d.ts +32 -0
  484. package/dist/environment/SphericalHarmonics.d.ts.map +1 -0
  485. package/dist/environment/SphericalHarmonics.js +155 -0
  486. package/dist/environment/SphericalHarmonics.js.map +1 -0
  487. package/dist/environment/probeBuild.d.ts +97 -0
  488. package/dist/environment/probeBuild.d.ts.map +1 -0
  489. package/dist/environment/probeBuild.js +406 -0
  490. package/dist/environment/probeBuild.js.map +1 -0
  491. package/dist/environment/workers/cpuPrefilter.d.ts +58 -0
  492. package/dist/environment/workers/cpuPrefilter.d.ts.map +1 -0
  493. package/dist/environment/workers/cpuPrefilter.js +288 -0
  494. package/dist/environment/workers/cpuPrefilter.js.map +1 -0
  495. package/dist/forward/Deform.d.ts +56 -0
  496. package/dist/forward/Deform.d.ts.map +1 -0
  497. package/dist/forward/Deform.js +517 -0
  498. package/dist/forward/Deform.js.map +1 -0
  499. package/dist/forward/DrawSubmit.d.ts +32 -0
  500. package/dist/forward/DrawSubmit.d.ts.map +1 -0
  501. package/dist/forward/DrawSubmit.js +75 -0
  502. package/dist/forward/DrawSubmit.js.map +1 -0
  503. package/dist/forward/Lighting.d.ts +35 -0
  504. package/dist/forward/Lighting.d.ts.map +1 -0
  505. package/dist/forward/Lighting.js +477 -0
  506. package/dist/forward/Lighting.js.map +1 -0
  507. package/dist/forward/Transmission.d.ts +62 -0
  508. package/dist/forward/Transmission.d.ts.map +1 -0
  509. package/dist/forward/Transmission.js +299 -0
  510. package/dist/forward/Transmission.js.map +1 -0
  511. package/dist/forward/Velocity.d.ts +47 -0
  512. package/dist/forward/Velocity.d.ts.map +1 -0
  513. package/dist/forward/Velocity.js +153 -0
  514. package/dist/forward/Velocity.js.map +1 -0
  515. package/dist/forward/transmissionTargetStore.d.ts +21 -0
  516. package/dist/forward/transmissionTargetStore.d.ts.map +1 -0
  517. package/dist/forward/transmissionTargetStore.js +8 -0
  518. package/dist/forward/transmissionTargetStore.js.map +1 -0
  519. package/dist/geometry/Primitives.d.ts +28 -0
  520. package/dist/geometry/Primitives.d.ts.map +1 -0
  521. package/dist/geometry/Primitives.js +110 -0
  522. package/dist/geometry/Primitives.js.map +1 -0
  523. package/dist/index.d.ts +140 -58
  524. package/dist/index.d.ts.map +1 -1
  525. package/dist/index.js +102 -52
  526. package/dist/index.js.map +1 -1
  527. package/dist/lanes/index.d.ts +17 -0
  528. package/dist/lanes/index.d.ts.map +1 -0
  529. package/dist/lanes/index.js +17 -0
  530. package/dist/lanes/index.js.map +1 -0
  531. package/dist/lanes/prd01.d.ts +6 -0
  532. package/dist/lanes/prd01.d.ts.map +1 -0
  533. package/dist/lanes/prd01.js +19 -0
  534. package/dist/lanes/prd01.js.map +1 -0
  535. package/dist/lanes/prd02.d.ts +62 -0
  536. package/dist/lanes/prd02.d.ts.map +1 -0
  537. package/dist/lanes/prd02.js +117 -0
  538. package/dist/lanes/prd02.js.map +1 -0
  539. package/dist/lanes/prd03.d.ts +19 -0
  540. package/dist/lanes/prd03.d.ts.map +1 -0
  541. package/dist/lanes/prd03.js +55 -0
  542. package/dist/lanes/prd03.js.map +1 -0
  543. package/dist/lanes/prd04.d.ts +22 -0
  544. package/dist/lanes/prd04.d.ts.map +1 -0
  545. package/dist/lanes/prd04.js +35 -0
  546. package/dist/lanes/prd04.js.map +1 -0
  547. package/dist/lanes/prd05.d.ts +4 -0
  548. package/dist/lanes/prd05.d.ts.map +1 -0
  549. package/dist/lanes/prd05.js +31 -0
  550. package/dist/lanes/prd05.js.map +1 -0
  551. package/dist/lanes/prd06.d.ts +33 -0
  552. package/dist/lanes/prd06.d.ts.map +1 -0
  553. package/dist/lanes/prd06.js +217 -0
  554. package/dist/lanes/prd06.js.map +1 -0
  555. package/dist/lanes/prd07.d.ts +49 -0
  556. package/dist/lanes/prd07.d.ts.map +1 -0
  557. package/dist/lanes/prd07.js +112 -0
  558. package/dist/lanes/prd07.js.map +1 -0
  559. package/dist/lanes/prd08.d.ts +2 -0
  560. package/dist/lanes/prd08.d.ts.map +1 -0
  561. package/dist/lanes/prd08.js +17 -0
  562. package/dist/lanes/prd08.js.map +1 -0
  563. package/dist/lanes/prd09.d.ts +6 -0
  564. package/dist/lanes/prd09.d.ts.map +1 -0
  565. package/dist/lanes/prd09.js +6 -0
  566. package/dist/lanes/prd09.js.map +1 -0
  567. package/dist/lanes/prd10.d.ts +2 -0
  568. package/dist/lanes/prd10.d.ts.map +1 -0
  569. package/dist/lanes/prd10.js +10 -0
  570. package/dist/lanes/prd10.js.map +1 -0
  571. package/dist/lanes/prd11.d.ts +61 -0
  572. package/dist/lanes/prd11.d.ts.map +1 -0
  573. package/dist/lanes/prd11.js +244 -0
  574. package/dist/lanes/prd11.js.map +1 -0
  575. package/dist/lanes/prd12.d.ts +6 -0
  576. package/dist/lanes/prd12.d.ts.map +1 -0
  577. package/dist/lanes/prd12.js +6 -0
  578. package/dist/lanes/prd12.js.map +1 -0
  579. package/dist/lanes/prd13.d.ts +6 -0
  580. package/dist/lanes/prd13.d.ts.map +1 -0
  581. package/dist/lanes/prd13.js +6 -0
  582. package/dist/lanes/prd13.js.map +1 -0
  583. package/dist/lanes/prd14.d.ts +6 -0
  584. package/dist/lanes/prd14.d.ts.map +1 -0
  585. package/dist/lanes/prd14.js +6 -0
  586. package/dist/lanes/prd14.js.map +1 -0
  587. package/dist/lanes/prd15.d.ts +6 -0
  588. package/dist/lanes/prd15.d.ts.map +1 -0
  589. package/dist/lanes/prd15.js +6 -0
  590. package/dist/lanes/prd15.js.map +1 -0
  591. package/dist/materials/PhysicalFeatures.d.ts +71 -0
  592. package/dist/materials/PhysicalFeatures.d.ts.map +1 -0
  593. package/dist/materials/PhysicalFeatures.js +255 -0
  594. package/dist/materials/PhysicalFeatures.js.map +1 -0
  595. package/dist/materials/PhysicalMaterial.d.ts +85 -0
  596. package/dist/materials/PhysicalMaterial.d.ts.map +1 -1
  597. package/dist/materials/PhysicalMaterial.js +21 -0
  598. package/dist/materials/PhysicalMaterial.js.map +1 -1
  599. package/dist/materials/features.d.ts +47 -0
  600. package/dist/materials/features.d.ts.map +1 -0
  601. package/dist/materials/features.js +282 -0
  602. package/dist/materials/features.js.map +1 -0
  603. package/dist/materials/lobes.d.ts +3 -0
  604. package/dist/materials/lobes.d.ts.map +1 -0
  605. package/dist/materials/lobes.js +225 -0
  606. package/dist/materials/lobes.js.map +1 -0
  607. package/dist/output/HdrTarget.d.ts +27 -0
  608. package/dist/output/HdrTarget.d.ts.map +1 -0
  609. package/dist/output/HdrTarget.js +48 -0
  610. package/dist/output/HdrTarget.js.map +1 -0
  611. package/dist/output/OutputPass.d.ts +28 -0
  612. package/dist/output/OutputPass.d.ts.map +1 -0
  613. package/dist/output/OutputPass.js +142 -0
  614. package/dist/output/OutputPass.js.map +1 -0
  615. package/dist/output/ToneMappingOperators.glsl.d.ts +22 -0
  616. package/dist/output/ToneMappingOperators.glsl.d.ts.map +1 -0
  617. package/dist/output/ToneMappingOperators.glsl.js +217 -0
  618. package/dist/output/ToneMappingOperators.glsl.js.map +1 -0
  619. package/dist/passes/ContactShadowPass.d.ts +57 -0
  620. package/dist/passes/ContactShadowPass.d.ts.map +1 -0
  621. package/dist/passes/ContactShadowPass.js +151 -0
  622. package/dist/passes/ContactShadowPass.js.map +1 -0
  623. package/dist/passes/Prd02ContactShadowsContributor.d.ts +16 -0
  624. package/dist/passes/Prd02ContactShadowsContributor.d.ts.map +1 -0
  625. package/dist/passes/Prd02ContactShadowsContributor.js +133 -0
  626. package/dist/passes/Prd02ContactShadowsContributor.js.map +1 -0
  627. package/dist/passes/Prd02SubFlags.d.ts +22 -0
  628. package/dist/passes/Prd02SubFlags.d.ts.map +1 -0
  629. package/dist/passes/Prd02SubFlags.js +32 -0
  630. package/dist/passes/Prd02SubFlags.js.map +1 -0
  631. package/dist/performance/BVH.d.ts +46 -0
  632. package/dist/performance/BVH.d.ts.map +1 -1
  633. package/dist/performance/BVH.js +212 -0
  634. package/dist/performance/BVH.js.map +1 -1
  635. package/dist/performance/Batcher.d.ts +11 -0
  636. package/dist/performance/Batcher.d.ts.map +1 -1
  637. package/dist/performance/Batcher.js +10 -0
  638. package/dist/performance/Batcher.js.map +1 -1
  639. package/dist/performance/FrustumCuller.d.ts +29 -0
  640. package/dist/performance/FrustumCuller.d.ts.map +1 -1
  641. package/dist/performance/FrustumCuller.js +78 -1
  642. package/dist/performance/FrustumCuller.js.map +1 -1
  643. package/dist/performance/LOD.d.ts +6 -0
  644. package/dist/performance/LOD.d.ts.map +1 -1
  645. package/dist/performance/LOD.js +12 -0
  646. package/dist/performance/LOD.js.map +1 -1
  647. package/dist/performance/RenderItemSorting.d.ts +2 -0
  648. package/dist/performance/RenderItemSorting.d.ts.map +1 -1
  649. package/dist/performance/RenderItemSorting.js +5 -1
  650. package/dist/performance/RenderItemSorting.js.map +1 -1
  651. package/dist/post/CubeLut.d.ts +15 -0
  652. package/dist/post/CubeLut.d.ts.map +1 -0
  653. package/dist/post/CubeLut.js +86 -0
  654. package/dist/post/CubeLut.js.map +1 -0
  655. package/dist/post/DisplayLutCache.d.ts +31 -0
  656. package/dist/post/DisplayLutCache.d.ts.map +1 -0
  657. package/dist/post/DisplayLutCache.js +44 -0
  658. package/dist/post/DisplayLutCache.js.map +1 -0
  659. package/dist/post/PostAntiAlias.d.ts +49 -0
  660. package/dist/post/PostAntiAlias.d.ts.map +1 -0
  661. package/dist/post/PostAntiAlias.js +75 -0
  662. package/dist/post/PostAntiAlias.js.map +1 -0
  663. package/dist/post/PostGraph.d.ts +206 -0
  664. package/dist/post/PostGraph.d.ts.map +1 -0
  665. package/dist/post/PostGraph.js +234 -0
  666. package/dist/post/PostGraph.js.map +1 -0
  667. package/dist/post/PostQualityTiers.d.ts +95 -0
  668. package/dist/post/PostQualityTiers.d.ts.map +1 -0
  669. package/dist/post/PostQualityTiers.js +62 -0
  670. package/dist/post/PostQualityTiers.js.map +1 -0
  671. package/dist/post/PostResources.d.ts +49 -0
  672. package/dist/post/PostResources.d.ts.map +1 -0
  673. package/dist/post/PostResources.js +119 -0
  674. package/dist/post/PostResources.js.map +1 -0
  675. package/dist/post/PostTimer.d.ts +37 -0
  676. package/dist/post/PostTimer.d.ts.map +1 -0
  677. package/dist/post/PostTimer.js +88 -0
  678. package/dist/post/PostTimer.js.map +1 -0
  679. package/dist/post/ScreenFeelPass.d.ts +83 -0
  680. package/dist/post/ScreenFeelPass.d.ts.map +1 -0
  681. package/dist/post/ScreenFeelPass.js +197 -0
  682. package/dist/post/ScreenFeelPass.js.map +1 -0
  683. package/dist/post/ToneOperators.d.ts +42 -0
  684. package/dist/post/ToneOperators.d.ts.map +1 -0
  685. package/dist/post/ToneOperators.js +179 -0
  686. package/dist/post/ToneOperators.js.map +1 -0
  687. package/dist/post/chunks/indirectFraction.glsl.d.ts +50 -0
  688. package/dist/post/chunks/indirectFraction.glsl.d.ts.map +1 -0
  689. package/dist/post/chunks/indirectFraction.glsl.js +82 -0
  690. package/dist/post/chunks/indirectFraction.glsl.js.map +1 -0
  691. package/dist/post/chunks/velocity.glsl.d.ts +35 -0
  692. package/dist/post/chunks/velocity.glsl.d.ts.map +1 -0
  693. package/dist/post/chunks/velocity.glsl.js +86 -0
  694. package/dist/post/chunks/velocity.glsl.js.map +1 -0
  695. package/dist/post/shaders/bloom.glsl.d.ts +21 -0
  696. package/dist/post/shaders/bloom.glsl.d.ts.map +1 -0
  697. package/dist/post/shaders/bloom.glsl.js +120 -0
  698. package/dist/post/shaders/bloom.glsl.js.map +1 -0
  699. package/dist/post/shaders/bloom.wgsl.d.ts +10 -0
  700. package/dist/post/shaders/bloom.wgsl.d.ts.map +1 -0
  701. package/dist/post/shaders/bloom.wgsl.js +121 -0
  702. package/dist/post/shaders/bloom.wgsl.js.map +1 -0
  703. package/dist/post/shaders/common.glsl.d.ts +11 -0
  704. package/dist/post/shaders/common.glsl.d.ts.map +1 -0
  705. package/dist/post/shaders/common.glsl.js +34 -0
  706. package/dist/post/shaders/common.glsl.js.map +1 -0
  707. package/dist/post/shaders/common.wgsl.d.ts +25 -0
  708. package/dist/post/shaders/common.wgsl.d.ts.map +1 -0
  709. package/dist/post/shaders/common.wgsl.js +48 -0
  710. package/dist/post/shaders/common.wgsl.js.map +1 -0
  711. package/dist/post/shaders/composite.glsl.d.ts +25 -0
  712. package/dist/post/shaders/composite.glsl.d.ts.map +1 -0
  713. package/dist/post/shaders/composite.glsl.js +96 -0
  714. package/dist/post/shaders/composite.glsl.js.map +1 -0
  715. package/dist/post/shaders/composite.wgsl.d.ts +10 -0
  716. package/dist/post/shaders/composite.wgsl.d.ts.map +1 -0
  717. package/dist/post/shaders/composite.wgsl.js +92 -0
  718. package/dist/post/shaders/composite.wgsl.js.map +1 -0
  719. package/dist/post/shaders/depthDownsample.glsl.d.ts +20 -0
  720. package/dist/post/shaders/depthDownsample.glsl.d.ts.map +1 -0
  721. package/dist/post/shaders/depthDownsample.glsl.js +78 -0
  722. package/dist/post/shaders/depthDownsample.glsl.js.map +1 -0
  723. package/dist/post/shaders/depthDownsample.wgsl.d.ts +17 -0
  724. package/dist/post/shaders/depthDownsample.wgsl.d.ts.map +1 -0
  725. package/dist/post/shaders/depthDownsample.wgsl.js +87 -0
  726. package/dist/post/shaders/depthDownsample.wgsl.js.map +1 -0
  727. package/dist/post/shaders/displayGrade.glsl.d.ts +18 -0
  728. package/dist/post/shaders/displayGrade.glsl.d.ts.map +1 -0
  729. package/dist/post/shaders/displayGrade.glsl.js +80 -0
  730. package/dist/post/shaders/displayGrade.glsl.js.map +1 -0
  731. package/dist/post/shaders/displayGrade.wgsl.d.ts +9 -0
  732. package/dist/post/shaders/displayGrade.wgsl.d.ts.map +1 -0
  733. package/dist/post/shaders/displayGrade.wgsl.js +75 -0
  734. package/dist/post/shaders/displayGrade.wgsl.js.map +1 -0
  735. package/dist/post/shaders/dof.glsl.d.ts +25 -0
  736. package/dist/post/shaders/dof.glsl.d.ts.map +1 -0
  737. package/dist/post/shaders/dof.glsl.js +129 -0
  738. package/dist/post/shaders/dof.glsl.js.map +1 -0
  739. package/dist/post/shaders/dof.wgsl.d.ts +11 -0
  740. package/dist/post/shaders/dof.wgsl.d.ts.map +1 -0
  741. package/dist/post/shaders/dof.wgsl.js +119 -0
  742. package/dist/post/shaders/dof.wgsl.js.map +1 -0
  743. package/dist/post/shaders/exposure.glsl.d.ts +43 -0
  744. package/dist/post/shaders/exposure.glsl.d.ts.map +1 -0
  745. package/dist/post/shaders/exposure.glsl.js +115 -0
  746. package/dist/post/shaders/exposure.glsl.js.map +1 -0
  747. package/dist/post/shaders/exposure.wgsl.d.ts +16 -0
  748. package/dist/post/shaders/exposure.wgsl.d.ts.map +1 -0
  749. package/dist/post/shaders/exposure.wgsl.js +97 -0
  750. package/dist/post/shaders/exposure.wgsl.js.map +1 -0
  751. package/dist/post/shaders/finalize.glsl.d.ts +17 -0
  752. package/dist/post/shaders/finalize.glsl.d.ts.map +1 -0
  753. package/dist/post/shaders/finalize.glsl.js +120 -0
  754. package/dist/post/shaders/finalize.glsl.js.map +1 -0
  755. package/dist/post/shaders/finalize.wgsl.d.ts +13 -0
  756. package/dist/post/shaders/finalize.wgsl.d.ts.map +1 -0
  757. package/dist/post/shaders/finalize.wgsl.js +124 -0
  758. package/dist/post/shaders/finalize.wgsl.js.map +1 -0
  759. package/dist/post/shaders/fxaa.glsl.d.ts +26 -0
  760. package/dist/post/shaders/fxaa.glsl.d.ts.map +1 -0
  761. package/dist/post/shaders/fxaa.glsl.js +246 -0
  762. package/dist/post/shaders/fxaa.glsl.js.map +1 -0
  763. package/dist/post/shaders/fxaa.wgsl.d.ts +17 -0
  764. package/dist/post/shaders/fxaa.wgsl.d.ts.map +1 -0
  765. package/dist/post/shaders/fxaa.wgsl.js +268 -0
  766. package/dist/post/shaders/fxaa.wgsl.js.map +1 -0
  767. package/dist/post/shaders/godrays.glsl.d.ts +16 -0
  768. package/dist/post/shaders/godrays.glsl.d.ts.map +1 -0
  769. package/dist/post/shaders/godrays.glsl.js +70 -0
  770. package/dist/post/shaders/godrays.glsl.js.map +1 -0
  771. package/dist/post/shaders/godrays.wgsl.d.ts +8 -0
  772. package/dist/post/shaders/godrays.wgsl.d.ts.map +1 -0
  773. package/dist/post/shaders/godrays.wgsl.js +60 -0
  774. package/dist/post/shaders/godrays.wgsl.js.map +1 -0
  775. package/dist/post/shaders/gtao.glsl.d.ts +29 -0
  776. package/dist/post/shaders/gtao.glsl.d.ts.map +1 -0
  777. package/dist/post/shaders/gtao.glsl.js +190 -0
  778. package/dist/post/shaders/gtao.glsl.js.map +1 -0
  779. package/dist/post/shaders/gtao.wgsl.d.ts +13 -0
  780. package/dist/post/shaders/gtao.wgsl.d.ts.map +1 -0
  781. package/dist/post/shaders/gtao.wgsl.js +163 -0
  782. package/dist/post/shaders/gtao.wgsl.js.map +1 -0
  783. package/dist/post/shaders/gtaoDenoise.glsl.d.ts +22 -0
  784. package/dist/post/shaders/gtaoDenoise.glsl.d.ts.map +1 -0
  785. package/dist/post/shaders/gtaoDenoise.glsl.js +121 -0
  786. package/dist/post/shaders/gtaoDenoise.glsl.js.map +1 -0
  787. package/dist/post/shaders/gtaoDenoise.wgsl.d.ts +11 -0
  788. package/dist/post/shaders/gtaoDenoise.wgsl.d.ts.map +1 -0
  789. package/dist/post/shaders/gtaoDenoise.wgsl.js +117 -0
  790. package/dist/post/shaders/gtaoDenoise.wgsl.js.map +1 -0
  791. package/dist/post/shaders/motionBlur.glsl.d.ts +21 -0
  792. package/dist/post/shaders/motionBlur.glsl.d.ts.map +1 -0
  793. package/dist/post/shaders/motionBlur.glsl.js +110 -0
  794. package/dist/post/shaders/motionBlur.glsl.js.map +1 -0
  795. package/dist/post/shaders/motionBlur.wgsl.d.ts +10 -0
  796. package/dist/post/shaders/motionBlur.wgsl.d.ts.map +1 -0
  797. package/dist/post/shaders/motionBlur.wgsl.js +102 -0
  798. package/dist/post/shaders/motionBlur.wgsl.js.map +1 -0
  799. package/dist/post/shaders/smaa.glsl.d.ts +28 -0
  800. package/dist/post/shaders/smaa.glsl.d.ts.map +1 -0
  801. package/dist/post/shaders/smaa.glsl.js +354 -0
  802. package/dist/post/shaders/smaa.glsl.js.map +1 -0
  803. package/dist/post/shaders/smaa.wgsl.d.ts +20 -0
  804. package/dist/post/shaders/smaa.wgsl.d.ts.map +1 -0
  805. package/dist/post/shaders/smaa.wgsl.js +375 -0
  806. package/dist/post/shaders/smaa.wgsl.js.map +1 -0
  807. package/dist/post/shaders/taa.glsl.d.ts +23 -0
  808. package/dist/post/shaders/taa.glsl.d.ts.map +1 -0
  809. package/dist/post/shaders/taa.glsl.js +169 -0
  810. package/dist/post/shaders/taa.glsl.js.map +1 -0
  811. package/dist/post/shaders/taa.wgsl.d.ts +10 -0
  812. package/dist/post/shaders/taa.wgsl.d.ts.map +1 -0
  813. package/dist/post/shaders/taa.wgsl.js +185 -0
  814. package/dist/post/shaders/taa.wgsl.js.map +1 -0
  815. package/dist/post/shaders/velocityDilate.glsl.d.ts +16 -0
  816. package/dist/post/shaders/velocityDilate.glsl.d.ts.map +1 -0
  817. package/dist/post/shaders/velocityDilate.glsl.js +45 -0
  818. package/dist/post/shaders/velocityDilate.glsl.js.map +1 -0
  819. package/dist/post/shaders/velocityDilate.wgsl.d.ts +8 -0
  820. package/dist/post/shaders/velocityDilate.wgsl.d.ts.map +1 -0
  821. package/dist/post/shaders/velocityDilate.wgsl.js +30 -0
  822. package/dist/post/shaders/velocityDilate.wgsl.js.map +1 -0
  823. package/dist/post/smaa/textures.d.ts +17 -0
  824. package/dist/post/smaa/textures.d.ts.map +1 -0
  825. package/dist/post/smaa/textures.js +17 -0
  826. package/dist/post/smaa/textures.js.map +1 -0
  827. package/dist/post/v2Entry.d.ts +25 -0
  828. package/dist/post/v2Entry.d.ts.map +1 -0
  829. package/dist/post/v2Entry.js +28 -0
  830. package/dist/post/v2Entry.js.map +1 -0
  831. package/dist/post/v2Stages.d.ts +156 -0
  832. package/dist/post/v2Stages.d.ts.map +1 -0
  833. package/dist/post/v2Stages.js +1189 -0
  834. package/dist/post/v2Stages.js.map +1 -0
  835. package/dist/postprocess/EffectComposer.d.ts +6 -109
  836. package/dist/postprocess/EffectComposer.d.ts.map +1 -1
  837. package/dist/postprocess/EffectComposer.js +6 -246
  838. package/dist/postprocess/EffectComposer.js.map +1 -1
  839. package/dist/postprocess/NativeBloomPyramid.d.ts +34 -0
  840. package/dist/postprocess/NativeBloomPyramid.d.ts.map +1 -1
  841. package/dist/postprocess/NativeBloomPyramid.js +57 -0
  842. package/dist/postprocess/NativeBloomPyramid.js.map +1 -1
  843. package/dist/postprocess/SSAOPass.d.ts +5 -5
  844. package/dist/postprocess/SSAOPass.d.ts.map +1 -1
  845. package/dist/postprocess/SSAOPass.js +5 -17
  846. package/dist/postprocess/SSAOPass.js.map +1 -1
  847. package/dist/probes/IrradianceVolume.d.ts +45 -0
  848. package/dist/probes/IrradianceVolume.d.ts.map +1 -0
  849. package/dist/probes/IrradianceVolume.js +230 -0
  850. package/dist/probes/IrradianceVolume.js.map +1 -0
  851. package/dist/probes/LtcLuts.d.ts +30 -0
  852. package/dist/probes/LtcLuts.d.ts.map +1 -0
  853. package/dist/probes/LtcLuts.js +120 -0
  854. package/dist/probes/LtcLuts.js.map +1 -0
  855. package/dist/probes/Prd02ProbesContributor.d.ts +53 -0
  856. package/dist/probes/Prd02ProbesContributor.d.ts.map +1 -0
  857. package/dist/probes/Prd02ProbesContributor.js +241 -0
  858. package/dist/probes/Prd02ProbesContributor.js.map +1 -0
  859. package/dist/probes/ProbeBoxProjection.d.ts +53 -0
  860. package/dist/probes/ProbeBoxProjection.d.ts.map +1 -0
  861. package/dist/probes/ProbeBoxProjection.js +99 -0
  862. package/dist/probes/ProbeBoxProjection.js.map +1 -0
  863. package/dist/probes/ReflectionProbeSystem.d.ts +64 -0
  864. package/dist/probes/ReflectionProbeSystem.d.ts.map +1 -0
  865. package/dist/probes/ReflectionProbeSystem.js +157 -0
  866. package/dist/probes/ReflectionProbeSystem.js.map +1 -0
  867. package/dist/production-runtime/PBRHDRPipeline.d.ts.map +1 -1
  868. package/dist/production-runtime/PBRHDRPipeline.js +23 -9
  869. package/dist/production-runtime/PBRHDRPipeline.js.map +1 -1
  870. package/dist/production-runtime/ProductionRendererTypes.d.ts +16 -6
  871. package/dist/production-runtime/ProductionRendererTypes.d.ts.map +1 -1
  872. package/dist/production-runtime/ProductionRendererTypes.js.map +1 -1
  873. package/dist/production-runtime/ProductionWebGPURenderer.d.ts +4 -4
  874. package/dist/production-runtime/ProductionWebGPURenderer.d.ts.map +1 -1
  875. package/dist/production-runtime/ProductionWebGPURenderer.js +10 -45
  876. package/dist/production-runtime/ProductionWebGPURenderer.js.map +1 -1
  877. package/dist/production-runtime/backendSelection.d.ts +26 -0
  878. package/dist/production-runtime/backendSelection.d.ts.map +1 -0
  879. package/dist/production-runtime/backendSelection.js +46 -0
  880. package/dist/production-runtime/backendSelection.js.map +1 -0
  881. package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts +1 -1
  882. package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts.map +1 -1
  883. package/dist/production-runtime/backends/WebGL2RendererBackend.js +8 -4
  884. package/dist/production-runtime/backends/WebGL2RendererBackend.js.map +1 -1
  885. package/dist/production-runtime/backends/WebGPURendererBackend.d.ts +2 -19
  886. package/dist/production-runtime/backends/WebGPURendererBackend.d.ts.map +1 -1
  887. package/dist/production-runtime/backends/WebGPURendererBackend.js +2 -18
  888. package/dist/production-runtime/backends/WebGPURendererBackend.js.map +1 -1
  889. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts +2 -10
  890. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts.map +1 -1
  891. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js +2 -7
  892. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js.map +1 -1
  893. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts +2 -10
  894. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts.map +1 -1
  895. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js +2 -7
  896. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js.map +1 -1
  897. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts +2 -10
  898. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts.map +1 -1
  899. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js +2 -7
  900. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js.map +1 -1
  901. package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts +2 -10
  902. package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts.map +1 -1
  903. package/dist/production-runtime/backends/webgl2/WebGL2Shader.js +2 -7
  904. package/dist/production-runtime/backends/webgl2/WebGL2Shader.js.map +1 -1
  905. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts +1 -0
  906. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts.map +1 -1
  907. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js +1 -0
  908. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js.map +1 -1
  909. package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts +2 -10
  910. package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts.map +1 -1
  911. package/dist/production-runtime/backends/webgl2/WebGL2Texture.js +2 -7
  912. package/dist/production-runtime/backends/webgl2/WebGL2Texture.js.map +1 -1
  913. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts +2 -10
  914. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts.map +1 -1
  915. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js +2 -7
  916. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js.map +1 -1
  917. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts +2 -10
  918. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts.map +1 -1
  919. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js +2 -7
  920. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js.map +1 -1
  921. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts +2 -10
  922. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts.map +1 -1
  923. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js +2 -7
  924. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js.map +1 -1
  925. package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts +2 -10
  926. package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts.map +1 -1
  927. package/dist/production-runtime/backends/webgpu/WebGPUShader.js +2 -7
  928. package/dist/production-runtime/backends/webgpu/WebGPUShader.js.map +1 -1
  929. package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts +2 -10
  930. package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts.map +1 -1
  931. package/dist/production-runtime/backends/webgpu/WebGPUTexture.js +2 -7
  932. package/dist/production-runtime/backends/webgpu/WebGPUTexture.js.map +1 -1
  933. package/dist/production-runtime/index.d.ts +6 -6
  934. package/dist/production-runtime/index.d.ts.map +1 -1
  935. package/dist/production-runtime/index.js +9 -3
  936. package/dist/production-runtime/index.js.map +1 -1
  937. package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts +12 -13
  938. package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts.map +1 -1
  939. package/dist/production-runtime/materials/GLTFMaterialAdapter.js +10 -4
  940. package/dist/production-runtime/materials/GLTFMaterialAdapter.js.map +1 -1
  941. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts +9 -2
  942. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts.map +1 -1
  943. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js +7 -1
  944. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js.map +1 -1
  945. package/dist/production-runtime/materials/MaterialCompiler.d.ts +10 -8
  946. package/dist/production-runtime/materials/MaterialCompiler.d.ts.map +1 -1
  947. package/dist/production-runtime/materials/MaterialCompiler.js +9 -4
  948. package/dist/production-runtime/materials/MaterialCompiler.js.map +1 -1
  949. package/dist/production-runtime/materials/PBRShaderFeatures.d.ts.map +1 -1
  950. package/dist/production-runtime/materials/PBRShaderFeatures.js +30 -1
  951. package/dist/production-runtime/materials/PBRShaderFeatures.js.map +1 -1
  952. package/dist/production-runtime/renderProofs.d.ts +54 -0
  953. package/dist/production-runtime/renderProofs.d.ts.map +1 -0
  954. package/dist/production-runtime/renderProofs.js +245 -0
  955. package/dist/production-runtime/renderProofs.js.map +1 -0
  956. package/dist/program/DFGLut.d.ts +23 -0
  957. package/dist/program/DFGLut.d.ts.map +1 -0
  958. package/dist/program/DFGLut.js +58 -0
  959. package/dist/program/DFGLut.js.map +1 -0
  960. package/dist/program/DFGLutData.d.ts +35 -0
  961. package/dist/program/DFGLutData.d.ts.map +1 -0
  962. package/dist/program/DFGLutData.js +52 -0
  963. package/dist/program/DFGLutData.js.map +1 -0
  964. package/dist/program/FeatureSelect.d.ts +35 -0
  965. package/dist/program/FeatureSelect.d.ts.map +1 -0
  966. package/dist/program/FeatureSelect.js +88 -0
  967. package/dist/program/FeatureSelect.js.map +1 -0
  968. package/dist/program/MaterialFeatures.d.ts +66 -0
  969. package/dist/program/MaterialFeatures.d.ts.map +1 -0
  970. package/dist/program/MaterialFeatures.js +242 -0
  971. package/dist/program/MaterialFeatures.js.map +1 -0
  972. package/dist/program/ProgramCache.d.ts +83 -0
  973. package/dist/program/ProgramCache.d.ts.map +1 -0
  974. package/dist/program/ProgramCache.js +194 -0
  975. package/dist/program/ProgramCache.js.map +1 -0
  976. package/dist/program/ProgramFeatures.d.ts +21 -0
  977. package/dist/program/ProgramFeatures.d.ts.map +1 -0
  978. package/dist/program/ProgramFeatures.js +95 -0
  979. package/dist/program/ProgramFeatures.js.map +1 -0
  980. package/dist/program/ProgramGenerator.d.ts +60 -0
  981. package/dist/program/ProgramGenerator.d.ts.map +1 -0
  982. package/dist/program/ProgramGenerator.js +760 -0
  983. package/dist/program/ProgramGenerator.js.map +1 -0
  984. package/dist/program/ProgramKey.d.ts +10 -0
  985. package/dist/program/ProgramKey.d.ts.map +1 -0
  986. package/dist/program/ProgramKey.js +13 -0
  987. package/dist/program/ProgramKey.js.map +1 -0
  988. package/dist/program/ProgramWarmup.d.ts +37 -0
  989. package/dist/program/ProgramWarmup.d.ts.map +1 -0
  990. package/dist/program/ProgramWarmup.js +68 -0
  991. package/dist/program/ProgramWarmup.js.map +1 -0
  992. package/dist/program/UniformLayout.d.ts +40 -0
  993. package/dist/program/UniformLayout.d.ts.map +1 -0
  994. package/dist/program/UniformLayout.js +105 -0
  995. package/dist/program/UniformLayout.js.map +1 -0
  996. package/dist/program/chunks/alpha.glsl.d.ts +7 -0
  997. package/dist/program/chunks/alpha.glsl.d.ts.map +1 -0
  998. package/dist/program/chunks/alpha.glsl.js +17 -0
  999. package/dist/program/chunks/alpha.glsl.js.map +1 -0
  1000. package/dist/program/chunks/brdf.glsl.d.ts +12 -0
  1001. package/dist/program/chunks/brdf.glsl.d.ts.map +1 -0
  1002. package/dist/program/chunks/brdf.glsl.js +144 -0
  1003. package/dist/program/chunks/brdf.glsl.js.map +1 -0
  1004. package/dist/program/chunks/colorspace.glsl.d.ts +8 -0
  1005. package/dist/program/chunks/colorspace.glsl.d.ts.map +1 -0
  1006. package/dist/program/chunks/colorspace.glsl.js +16 -0
  1007. package/dist/program/chunks/colorspace.glsl.js.map +1 -0
  1008. package/dist/program/chunks/common.glsl.d.ts +7 -0
  1009. package/dist/program/chunks/common.glsl.d.ts.map +1 -0
  1010. package/dist/program/chunks/common.glsl.js +25 -0
  1011. package/dist/program/chunks/common.glsl.js.map +1 -0
  1012. package/dist/program/chunks/depth.glsl.d.ts +9 -0
  1013. package/dist/program/chunks/depth.glsl.d.ts.map +1 -0
  1014. package/dist/program/chunks/depth.glsl.js +18 -0
  1015. package/dist/program/chunks/depth.glsl.js.map +1 -0
  1016. package/dist/program/chunks/drawId.wgsl.d.ts +9 -0
  1017. package/dist/program/chunks/drawId.wgsl.d.ts.map +1 -0
  1018. package/dist/program/chunks/drawId.wgsl.js +29 -0
  1019. package/dist/program/chunks/drawId.wgsl.js.map +1 -0
  1020. package/dist/program/chunks/fog_default.glsl.d.ts +8 -0
  1021. package/dist/program/chunks/fog_default.glsl.d.ts.map +1 -0
  1022. package/dist/program/chunks/fog_default.glsl.js +31 -0
  1023. package/dist/program/chunks/fog_default.glsl.js.map +1 -0
  1024. package/dist/program/chunks/indirect_default.glsl.d.ts +29 -0
  1025. package/dist/program/chunks/indirect_default.glsl.d.ts.map +1 -0
  1026. package/dist/program/chunks/indirect_default.glsl.js +113 -0
  1027. package/dist/program/chunks/indirect_default.glsl.js.map +1 -0
  1028. package/dist/program/chunks/instanceEmissive.wgsl.d.ts +10 -0
  1029. package/dist/program/chunks/instanceEmissive.wgsl.d.ts.map +1 -0
  1030. package/dist/program/chunks/instanceEmissive.wgsl.js +21 -0
  1031. package/dist/program/chunks/instanceEmissive.wgsl.js.map +1 -0
  1032. package/dist/program/chunks/instancing.glsl.d.ts +8 -0
  1033. package/dist/program/chunks/instancing.glsl.d.ts.map +1 -0
  1034. package/dist/program/chunks/instancing.glsl.js +25 -0
  1035. package/dist/program/chunks/instancing.glsl.js.map +1 -0
  1036. package/dist/program/chunks/lights_legacy.glsl.d.ts +15 -0
  1037. package/dist/program/chunks/lights_legacy.glsl.d.ts.map +1 -0
  1038. package/dist/program/chunks/lights_legacy.glsl.js +95 -0
  1039. package/dist/program/chunks/lights_legacy.glsl.js.map +1 -0
  1040. package/dist/program/chunks/manifest.d.ts +42 -0
  1041. package/dist/program/chunks/manifest.d.ts.map +1 -0
  1042. package/dist/program/chunks/manifest.js +48 -0
  1043. package/dist/program/chunks/manifest.js.map +1 -0
  1044. package/dist/program/chunks/normal.glsl.d.ts +8 -0
  1045. package/dist/program/chunks/normal.glsl.d.ts.map +1 -0
  1046. package/dist/program/chunks/normal.glsl.js +34 -0
  1047. package/dist/program/chunks/normal.glsl.js.map +1 -0
  1048. package/dist/program/chunks/shadow_forward.glsl.d.ts +23 -0
  1049. package/dist/program/chunks/shadow_forward.glsl.d.ts.map +1 -0
  1050. package/dist/program/chunks/shadow_forward.glsl.js +73 -0
  1051. package/dist/program/chunks/shadow_forward.glsl.js.map +1 -0
  1052. package/dist/quality/DeviceClasses.d.ts +31 -0
  1053. package/dist/quality/DeviceClasses.d.ts.map +1 -0
  1054. package/dist/quality/DeviceClasses.js +83 -0
  1055. package/dist/quality/DeviceClasses.js.map +1 -0
  1056. package/dist/quality/DeviceProbe.d.ts +42 -0
  1057. package/dist/quality/DeviceProbe.d.ts.map +1 -0
  1058. package/dist/quality/DeviceProbe.js +83 -0
  1059. package/dist/quality/DeviceProbe.js.map +1 -0
  1060. package/dist/quality/FrameStats.d.ts +62 -0
  1061. package/dist/quality/FrameStats.d.ts.map +1 -0
  1062. package/dist/quality/FrameStats.js +220 -0
  1063. package/dist/quality/FrameStats.js.map +1 -0
  1064. package/dist/quality/PostprocessGuard.d.ts +49 -0
  1065. package/dist/quality/PostprocessGuard.d.ts.map +1 -0
  1066. package/dist/quality/PostprocessGuard.js +92 -0
  1067. package/dist/quality/PostprocessGuard.js.map +1 -0
  1068. package/dist/quality/QualityController.d.ts +93 -0
  1069. package/dist/quality/QualityController.d.ts.map +1 -0
  1070. package/dist/quality/QualityController.js +248 -0
  1071. package/dist/quality/QualityController.js.map +1 -0
  1072. package/dist/quality/QualityGovernor.d.ts +78 -0
  1073. package/dist/quality/QualityGovernor.d.ts.map +1 -0
  1074. package/dist/quality/QualityGovernor.js +170 -0
  1075. package/dist/quality/QualityGovernor.js.map +1 -0
  1076. package/dist/quality/QualityTier.d.ts +17 -0
  1077. package/dist/quality/QualityTier.d.ts.map +1 -0
  1078. package/dist/quality/QualityTier.js +23 -0
  1079. package/dist/quality/QualityTier.js.map +1 -0
  1080. package/dist/quality/RenderScaleController.d.ts +35 -0
  1081. package/dist/quality/RenderScaleController.d.ts.map +1 -0
  1082. package/dist/quality/RenderScaleController.js +57 -0
  1083. package/dist/quality/RenderScaleController.js.map +1 -0
  1084. package/dist/quality/RetentionPolicy.d.ts +11 -0
  1085. package/dist/quality/RetentionPolicy.d.ts.map +1 -0
  1086. package/dist/quality/RetentionPolicy.js +12 -0
  1087. package/dist/quality/RetentionPolicy.js.map +1 -0
  1088. package/dist/quality/TierResolver.d.ts +52 -0
  1089. package/dist/quality/TierResolver.d.ts.map +1 -0
  1090. package/dist/quality/TierResolver.js +155 -0
  1091. package/dist/quality/TierResolver.js.map +1 -0
  1092. package/dist/quality/liveTier.d.ts +23 -0
  1093. package/dist/quality/liveTier.d.ts.map +1 -0
  1094. package/dist/quality/liveTier.js +16 -0
  1095. package/dist/quality/liveTier.js.map +1 -0
  1096. package/dist/reference/BloomPass.d.ts +10 -0
  1097. package/dist/reference/BloomPass.d.ts.map +1 -0
  1098. package/dist/reference/BloomPass.js +18 -0
  1099. package/dist/reference/BloomPass.js.map +1 -0
  1100. package/dist/reference/DepthHazePass.d.ts +12 -0
  1101. package/dist/reference/DepthHazePass.d.ts.map +1 -0
  1102. package/dist/reference/DepthHazePass.js +20 -0
  1103. package/dist/reference/DepthHazePass.js.map +1 -0
  1104. package/dist/reference/EffectComposer.d.ts +110 -0
  1105. package/dist/reference/EffectComposer.d.ts.map +1 -0
  1106. package/dist/reference/EffectComposer.js +247 -0
  1107. package/dist/reference/EffectComposer.js.map +1 -0
  1108. package/dist/reference/FilmGrainPass.d.ts +9 -0
  1109. package/dist/reference/FilmGrainPass.d.ts.map +1 -0
  1110. package/dist/reference/FilmGrainPass.js +17 -0
  1111. package/dist/reference/FilmGrainPass.js.map +1 -0
  1112. package/dist/reference/PostProcessPass.d.ts +511 -0
  1113. package/dist/reference/PostProcessPass.d.ts.map +1 -0
  1114. package/dist/reference/PostProcessPass.js +2020 -0
  1115. package/dist/reference/PostProcessPass.js.map +1 -0
  1116. package/dist/reference/SSAOPass.d.ts +6 -0
  1117. package/dist/reference/SSAOPass.d.ts.map +1 -0
  1118. package/dist/reference/SSAOPass.js +18 -0
  1119. package/dist/reference/SSAOPass.js.map +1 -0
  1120. package/dist/reference/VignettePass.d.ts +10 -0
  1121. package/dist/reference/VignettePass.d.ts.map +1 -0
  1122. package/dist/reference/VignettePass.js +17 -0
  1123. package/dist/reference/VignettePass.js.map +1 -0
  1124. package/dist/reference/index.d.ts +15 -0
  1125. package/dist/reference/index.d.ts.map +1 -0
  1126. package/dist/reference/index.js +15 -0
  1127. package/dist/reference/index.js.map +1 -0
  1128. package/dist/renderer/Background.d.ts +49 -0
  1129. package/dist/renderer/Background.d.ts.map +1 -0
  1130. package/dist/renderer/Background.js +259 -0
  1131. package/dist/renderer/Background.js.map +1 -0
  1132. package/dist/renderer/CullingBatching.d.ts +55 -0
  1133. package/dist/renderer/CullingBatching.d.ts.map +1 -0
  1134. package/dist/renderer/CullingBatching.js +362 -0
  1135. package/dist/renderer/CullingBatching.js.map +1 -0
  1136. package/dist/renderer/DeviceLifecycle.d.ts +29 -0
  1137. package/dist/renderer/DeviceLifecycle.d.ts.map +1 -0
  1138. package/dist/renderer/DeviceLifecycle.js +48 -0
  1139. package/dist/renderer/DeviceLifecycle.js.map +1 -0
  1140. package/dist/renderer/FrameGraph.d.ts +96 -0
  1141. package/dist/renderer/FrameGraph.d.ts.map +1 -0
  1142. package/dist/renderer/FrameGraph.js +301 -0
  1143. package/dist/renderer/FrameGraph.js.map +1 -0
  1144. package/dist/renderer/InterleavedTransparentPass.d.ts +31 -0
  1145. package/dist/renderer/InterleavedTransparentPass.d.ts.map +1 -0
  1146. package/dist/renderer/InterleavedTransparentPass.js +65 -0
  1147. package/dist/renderer/InterleavedTransparentPass.js.map +1 -0
  1148. package/dist/renderer/PixelRatio.d.ts +64 -0
  1149. package/dist/renderer/PixelRatio.d.ts.map +1 -0
  1150. package/dist/renderer/PixelRatio.js +81 -0
  1151. package/dist/renderer/PixelRatio.js.map +1 -0
  1152. package/dist/renderer/PostprocessExecution.d.ts +82 -0
  1153. package/dist/renderer/PostprocessExecution.d.ts.map +1 -0
  1154. package/dist/renderer/PostprocessExecution.js +741 -0
  1155. package/dist/renderer/PostprocessExecution.js.map +1 -0
  1156. package/dist/renderer/Prd06ShaderWarmup.d.ts +32 -0
  1157. package/dist/renderer/Prd06ShaderWarmup.d.ts.map +1 -0
  1158. package/dist/renderer/Prd06ShaderWarmup.js +45 -0
  1159. package/dist/renderer/Prd06ShaderWarmup.js.map +1 -0
  1160. package/dist/renderer/RenderShared.d.ts +11 -0
  1161. package/dist/renderer/RenderShared.d.ts.map +1 -0
  1162. package/dist/renderer/RenderShared.js +47 -0
  1163. package/dist/renderer/RenderShared.js.map +1 -0
  1164. package/dist/renderer/RendererFactory.d.ts +3 -0
  1165. package/dist/renderer/RendererFactory.d.ts.map +1 -0
  1166. package/dist/renderer/RendererFactory.js +19 -0
  1167. package/dist/renderer/RendererFactory.js.map +1 -0
  1168. package/dist/renderer/RendererHost.d.ts +25 -0
  1169. package/dist/renderer/RendererHost.d.ts.map +1 -0
  1170. package/dist/renderer/RendererHost.js +4 -0
  1171. package/dist/renderer/RendererHost.js.map +1 -0
  1172. package/dist/renderer/SceneDepthCopyPass.d.ts +50 -0
  1173. package/dist/renderer/SceneDepthCopyPass.d.ts.map +1 -0
  1174. package/dist/renderer/SceneDepthCopyPass.js +124 -0
  1175. package/dist/renderer/SceneDepthCopyPass.js.map +1 -0
  1176. package/dist/renderer/ShadowOrchestration.d.ts +32 -0
  1177. package/dist/renderer/ShadowOrchestration.d.ts.map +1 -0
  1178. package/dist/renderer/ShadowOrchestration.js +491 -0
  1179. package/dist/renderer/ShadowOrchestration.js.map +1 -0
  1180. package/dist/renderer/SkinnedBounds.d.ts +6 -0
  1181. package/dist/renderer/SkinnedBounds.d.ts.map +1 -0
  1182. package/dist/renderer/SkinnedBounds.js +74 -0
  1183. package/dist/renderer/SkinnedBounds.js.map +1 -0
  1184. package/dist/renderer/coreOutputPostRoute.d.ts +40 -0
  1185. package/dist/renderer/coreOutputPostRoute.d.ts.map +1 -0
  1186. package/dist/renderer/coreOutputPostRoute.js +46 -0
  1187. package/dist/renderer/coreOutputPostRoute.js.map +1 -0
  1188. package/dist/renderer/postSkipped.d.ts +12 -0
  1189. package/dist/renderer/postSkipped.d.ts.map +1 -0
  1190. package/dist/renderer/postSkipped.js +54 -0
  1191. package/dist/renderer/postSkipped.js.map +1 -0
  1192. package/dist/renderer/qrSubFlags.d.ts +45 -0
  1193. package/dist/renderer/qrSubFlags.d.ts.map +1 -0
  1194. package/dist/renderer/qrSubFlags.js +130 -0
  1195. package/dist/renderer/qrSubFlags.js.map +1 -0
  1196. package/dist/resources/InstanceBuffer.d.ts +34 -0
  1197. package/dist/resources/InstanceBuffer.d.ts.map +1 -0
  1198. package/dist/resources/InstanceBuffer.js +96 -0
  1199. package/dist/resources/InstanceBuffer.js.map +1 -0
  1200. package/dist/resources/MorphTargetTexture.d.ts +53 -0
  1201. package/dist/resources/MorphTargetTexture.d.ts.map +1 -0
  1202. package/dist/resources/MorphTargetTexture.js +135 -0
  1203. package/dist/resources/MorphTargetTexture.js.map +1 -0
  1204. package/dist/resources/RenderTargetPool.d.ts +47 -0
  1205. package/dist/resources/RenderTargetPool.d.ts.map +1 -0
  1206. package/dist/resources/RenderTargetPool.js +113 -0
  1207. package/dist/resources/RenderTargetPool.js.map +1 -0
  1208. package/dist/resources/ResourceRegistry.d.ts +48 -0
  1209. package/dist/resources/ResourceRegistry.d.ts.map +1 -0
  1210. package/dist/resources/ResourceRegistry.js +95 -0
  1211. package/dist/resources/ResourceRegistry.js.map +1 -0
  1212. package/dist/resources/UniformBlock.d.ts +90 -0
  1213. package/dist/resources/UniformBlock.d.ts.map +1 -0
  1214. package/dist/resources/UniformBlock.js +184 -0
  1215. package/dist/resources/UniformBlock.js.map +1 -0
  1216. package/dist/shaders/camera-fade.glsl.d.ts +26 -0
  1217. package/dist/shaders/camera-fade.glsl.d.ts.map +1 -0
  1218. package/dist/shaders/camera-fade.glsl.js +109 -0
  1219. package/dist/shaders/camera-fade.glsl.js.map +1 -0
  1220. package/dist/shaders/chunks/contact_shadow.glsl.d.ts +12 -0
  1221. package/dist/shaders/chunks/contact_shadow.glsl.d.ts.map +1 -0
  1222. package/dist/shaders/chunks/contact_shadow.glsl.js +53 -0
  1223. package/dist/shaders/chunks/contact_shadow.glsl.js.map +1 -0
  1224. package/dist/shaders/chunks/lighting_ibl.glsl.d.ts +29 -0
  1225. package/dist/shaders/chunks/lighting_ibl.glsl.d.ts.map +1 -0
  1226. package/dist/shaders/chunks/lighting_ibl.glsl.js +122 -0
  1227. package/dist/shaders/chunks/lighting_ibl.glsl.js.map +1 -0
  1228. package/dist/shaders/chunks/lighting_mirrors.d.ts +18 -0
  1229. package/dist/shaders/chunks/lighting_mirrors.d.ts.map +1 -0
  1230. package/dist/shaders/chunks/lighting_mirrors.js +35 -0
  1231. package/dist/shaders/chunks/lighting_mirrors.js.map +1 -0
  1232. package/dist/shaders/chunks/lighting_punctual.glsl.d.ts +17 -0
  1233. package/dist/shaders/chunks/lighting_punctual.glsl.d.ts.map +1 -0
  1234. package/dist/shaders/chunks/lighting_punctual.glsl.js +197 -0
  1235. package/dist/shaders/chunks/lighting_punctual.glsl.js.map +1 -0
  1236. package/dist/shaders/chunks/sh9.glsl.d.ts +9 -0
  1237. package/dist/shaders/chunks/sh9.glsl.d.ts.map +1 -0
  1238. package/dist/shaders/chunks/sh9.glsl.js +41 -0
  1239. package/dist/shaders/chunks/sh9.glsl.js.map +1 -0
  1240. package/dist/shaders/chunks/shadow_caster.glsl.d.ts +10 -0
  1241. package/dist/shaders/chunks/shadow_caster.glsl.d.ts.map +1 -0
  1242. package/dist/shaders/chunks/shadow_caster.glsl.js +32 -0
  1243. package/dist/shaders/chunks/shadow_caster.glsl.js.map +1 -0
  1244. package/dist/shaders/chunks/shadow_receive.glsl.d.ts +13 -0
  1245. package/dist/shaders/chunks/shadow_receive.glsl.d.ts.map +1 -0
  1246. package/dist/shaders/chunks/shadow_receive.glsl.js +136 -0
  1247. package/dist/shaders/chunks/shadow_receive.glsl.js.map +1 -0
  1248. package/dist/shaders/debug-view.glsl.d.ts +18 -0
  1249. package/dist/shaders/debug-view.glsl.d.ts.map +1 -0
  1250. package/dist/shaders/debug-view.glsl.js +153 -0
  1251. package/dist/shaders/debug-view.glsl.js.map +1 -0
  1252. package/dist/shaders/deform/deform.glsl.d.ts +17 -0
  1253. package/dist/shaders/deform/deform.glsl.d.ts.map +1 -0
  1254. package/dist/shaders/deform/deform.glsl.js +99 -0
  1255. package/dist/shaders/deform/deform.glsl.js.map +1 -0
  1256. package/dist/shaders/deform/deform.wgsl.d.ts +15 -0
  1257. package/dist/shaders/deform/deform.wgsl.d.ts.map +1 -0
  1258. package/dist/shaders/deform/deform.wgsl.js +89 -0
  1259. package/dist/shaders/deform/deform.wgsl.js.map +1 -0
  1260. package/dist/shaders/deform/depthFeature.d.ts +22 -0
  1261. package/dist/shaders/deform/depthFeature.d.ts.map +1 -0
  1262. package/dist/shaders/deform/depthFeature.js +44 -0
  1263. package/dist/shaders/deform/depthFeature.js.map +1 -0
  1264. package/dist/shaders/deform/forwardFeature.d.ts +114 -0
  1265. package/dist/shaders/deform/forwardFeature.d.ts.map +1 -0
  1266. package/dist/shaders/deform/forwardFeature.js +300 -0
  1267. package/dist/shaders/deform/forwardFeature.js.map +1 -0
  1268. package/dist/shaders/deform/morph.glsl.d.ts +14 -0
  1269. package/dist/shaders/deform/morph.glsl.d.ts.map +1 -0
  1270. package/dist/shaders/deform/morph.glsl.js +45 -0
  1271. package/dist/shaders/deform/morph.glsl.js.map +1 -0
  1272. package/dist/shaders/deform/morph.wgsl.d.ts +21 -0
  1273. package/dist/shaders/deform/morph.wgsl.d.ts.map +1 -0
  1274. package/dist/shaders/deform/morph.wgsl.js +73 -0
  1275. package/dist/shaders/deform/morph.wgsl.js.map +1 -0
  1276. package/dist/shaders/deform/skinning.glsl.d.ts +8 -0
  1277. package/dist/shaders/deform/skinning.glsl.d.ts.map +1 -0
  1278. package/dist/shaders/deform/skinning.glsl.js +37 -0
  1279. package/dist/shaders/deform/skinning.glsl.js.map +1 -0
  1280. package/dist/shaders/deform/skinning.wgsl.d.ts +26 -0
  1281. package/dist/shaders/deform/skinning.wgsl.d.ts.map +1 -0
  1282. package/dist/shaders/deform/skinning.wgsl.js +58 -0
  1283. package/dist/shaders/deform/skinning.wgsl.js.map +1 -0
  1284. package/dist/shaders/deform/twins.d.ts +8 -0
  1285. package/dist/shaders/deform/twins.d.ts.map +1 -0
  1286. package/dist/shaders/deform/twins.js +20 -0
  1287. package/dist/shaders/deform/twins.js.map +1 -0
  1288. package/dist/shaders/lod-dither.glsl.d.ts +12 -0
  1289. package/dist/shaders/lod-dither.glsl.d.ts.map +1 -0
  1290. package/dist/shaders/lod-dither.glsl.js +101 -0
  1291. package/dist/shaders/lod-dither.glsl.js.map +1 -0
  1292. package/dist/shaders/physical/alpha_a2c.glsl.d.ts +19 -0
  1293. package/dist/shaders/physical/alpha_a2c.glsl.d.ts.map +1 -0
  1294. package/dist/shaders/physical/alpha_a2c.glsl.js +29 -0
  1295. package/dist/shaders/physical/alpha_a2c.glsl.js.map +1 -0
  1296. package/dist/shaders/physical/anisotropy.glsl.d.ts +23 -0
  1297. package/dist/shaders/physical/anisotropy.glsl.d.ts.map +1 -0
  1298. package/dist/shaders/physical/anisotropy.glsl.js +116 -0
  1299. package/dist/shaders/physical/anisotropy.glsl.js.map +1 -0
  1300. package/dist/shaders/physical/bsdf_lobes_common.glsl.d.ts +25 -0
  1301. package/dist/shaders/physical/bsdf_lobes_common.glsl.d.ts.map +1 -0
  1302. package/dist/shaders/physical/bsdf_lobes_common.glsl.js +95 -0
  1303. package/dist/shaders/physical/bsdf_lobes_common.glsl.js.map +1 -0
  1304. package/dist/shaders/physical/clearcoat.glsl.d.ts +23 -0
  1305. package/dist/shaders/physical/clearcoat.glsl.d.ts.map +1 -0
  1306. package/dist/shaders/physical/clearcoat.glsl.js +70 -0
  1307. package/dist/shaders/physical/clearcoat.glsl.js.map +1 -0
  1308. package/dist/shaders/physical/debug_view.glsl.d.ts +19 -0
  1309. package/dist/shaders/physical/debug_view.glsl.d.ts.map +1 -0
  1310. package/dist/shaders/physical/debug_view.glsl.js +76 -0
  1311. package/dist/shaders/physical/debug_view.glsl.js.map +1 -0
  1312. package/dist/shaders/physical/dispersion.glsl.d.ts +18 -0
  1313. package/dist/shaders/physical/dispersion.glsl.d.ts.map +1 -0
  1314. package/dist/shaders/physical/dispersion.glsl.js +67 -0
  1315. package/dist/shaders/physical/dispersion.glsl.js.map +1 -0
  1316. package/dist/shaders/physical/emissive_strength.glsl.d.ts +18 -0
  1317. package/dist/shaders/physical/emissive_strength.glsl.d.ts.map +1 -0
  1318. package/dist/shaders/physical/emissive_strength.glsl.js +20 -0
  1319. package/dist/shaders/physical/emissive_strength.glsl.js.map +1 -0
  1320. package/dist/shaders/physical/index.d.ts +27 -0
  1321. package/dist/shaders/physical/index.d.ts.map +1 -0
  1322. package/dist/shaders/physical/index.js +69 -0
  1323. package/dist/shaders/physical/index.js.map +1 -0
  1324. package/dist/shaders/physical/iridescence.glsl.d.ts +25 -0
  1325. package/dist/shaders/physical/iridescence.glsl.d.ts.map +1 -0
  1326. package/dist/shaders/physical/iridescence.glsl.js +186 -0
  1327. package/dist/shaders/physical/iridescence.glsl.js.map +1 -0
  1328. package/dist/shaders/physical/lobe_calls.glsl.d.ts +83 -0
  1329. package/dist/shaders/physical/lobe_calls.glsl.d.ts.map +1 -0
  1330. package/dist/shaders/physical/lobe_calls.glsl.js +397 -0
  1331. package/dist/shaders/physical/lobe_calls.glsl.js.map +1 -0
  1332. package/dist/shaders/physical/sheen.glsl.d.ts +24 -0
  1333. package/dist/shaders/physical/sheen.glsl.d.ts.map +1 -0
  1334. package/dist/shaders/physical/sheen.glsl.js +108 -0
  1335. package/dist/shaders/physical/sheen.glsl.js.map +1 -0
  1336. package/dist/shaders/physical/specular_ior.glsl.d.ts +20 -0
  1337. package/dist/shaders/physical/specular_ior.glsl.d.ts.map +1 -0
  1338. package/dist/shaders/physical/specular_ior.glsl.js +64 -0
  1339. package/dist/shaders/physical/specular_ior.glsl.js.map +1 -0
  1340. package/dist/shaders/physical/tangent_frame.glsl.d.ts +27 -0
  1341. package/dist/shaders/physical/tangent_frame.glsl.d.ts.map +1 -0
  1342. package/dist/shaders/physical/tangent_frame.glsl.js +71 -0
  1343. package/dist/shaders/physical/tangent_frame.glsl.js.map +1 -0
  1344. package/dist/shaders/physical/transmission.glsl.d.ts +25 -0
  1345. package/dist/shaders/physical/transmission.glsl.d.ts.map +1 -0
  1346. package/dist/shaders/physical/transmission.glsl.js +204 -0
  1347. package/dist/shaders/physical/transmission.glsl.js.map +1 -0
  1348. package/dist/shaders/physical/transmission_copy.glsl.d.ts +15 -0
  1349. package/dist/shaders/physical/transmission_copy.glsl.d.ts.map +1 -0
  1350. package/dist/shaders/physical/transmission_copy.glsl.js +33 -0
  1351. package/dist/shaders/physical/transmission_copy.glsl.js.map +1 -0
  1352. package/dist/shaders/physical/unlit.glsl.d.ts +17 -0
  1353. package/dist/shaders/physical/unlit.glsl.d.ts.map +1 -0
  1354. package/dist/shaders/physical/unlit.glsl.js +19 -0
  1355. package/dist/shaders/physical/unlit.glsl.js.map +1 -0
  1356. package/dist/shaders/physical/uv_transform.glsl.d.ts +18 -0
  1357. package/dist/shaders/physical/uv_transform.glsl.d.ts.map +1 -0
  1358. package/dist/shaders/physical/uv_transform.glsl.js +30 -0
  1359. package/dist/shaders/physical/uv_transform.glsl.js.map +1 -0
  1360. package/dist/shaders/physical/volume.glsl.d.ts +19 -0
  1361. package/dist/shaders/physical/volume.glsl.d.ts.map +1 -0
  1362. package/dist/shaders/physical/volume.glsl.js +47 -0
  1363. package/dist/shaders/physical/volume.glsl.js.map +1 -0
  1364. package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.d.ts +8 -0
  1365. package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.d.ts.map +1 -0
  1366. package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.js +26 -0
  1367. package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.js.map +1 -0
  1368. package/dist/shaders/physical-wgsl/anisotropy.wgsl.d.ts +10 -0
  1369. package/dist/shaders/physical-wgsl/anisotropy.wgsl.d.ts.map +1 -0
  1370. package/dist/shaders/physical-wgsl/anisotropy.wgsl.js +97 -0
  1371. package/dist/shaders/physical-wgsl/anisotropy.wgsl.js.map +1 -0
  1372. package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.d.ts +11 -0
  1373. package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.d.ts.map +1 -0
  1374. package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.js +76 -0
  1375. package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.js.map +1 -0
  1376. package/dist/shaders/physical-wgsl/clearcoat.wgsl.d.ts +9 -0
  1377. package/dist/shaders/physical-wgsl/clearcoat.wgsl.d.ts.map +1 -0
  1378. package/dist/shaders/physical-wgsl/clearcoat.wgsl.js +56 -0
  1379. package/dist/shaders/physical-wgsl/clearcoat.wgsl.js.map +1 -0
  1380. package/dist/shaders/physical-wgsl/debug_view.wgsl.d.ts +10 -0
  1381. package/dist/shaders/physical-wgsl/debug_view.wgsl.d.ts.map +1 -0
  1382. package/dist/shaders/physical-wgsl/debug_view.wgsl.js +71 -0
  1383. package/dist/shaders/physical-wgsl/debug_view.wgsl.js.map +1 -0
  1384. package/dist/shaders/physical-wgsl/dispersion.wgsl.d.ts +10 -0
  1385. package/dist/shaders/physical-wgsl/dispersion.wgsl.d.ts.map +1 -0
  1386. package/dist/shaders/physical-wgsl/dispersion.wgsl.js +51 -0
  1387. package/dist/shaders/physical-wgsl/dispersion.wgsl.js.map +1 -0
  1388. package/dist/shaders/physical-wgsl/emissive_strength.wgsl.d.ts +9 -0
  1389. package/dist/shaders/physical-wgsl/emissive_strength.wgsl.d.ts.map +1 -0
  1390. package/dist/shaders/physical-wgsl/emissive_strength.wgsl.js +15 -0
  1391. package/dist/shaders/physical-wgsl/emissive_strength.wgsl.js.map +1 -0
  1392. package/dist/shaders/physical-wgsl/index.d.ts +35 -0
  1393. package/dist/shaders/physical-wgsl/index.d.ts.map +1 -0
  1394. package/dist/shaders/physical-wgsl/index.js +51 -0
  1395. package/dist/shaders/physical-wgsl/index.js.map +1 -0
  1396. package/dist/shaders/physical-wgsl/iridescence.wgsl.d.ts +9 -0
  1397. package/dist/shaders/physical-wgsl/iridescence.wgsl.d.ts.map +1 -0
  1398. package/dist/shaders/physical-wgsl/iridescence.wgsl.js +162 -0
  1399. package/dist/shaders/physical-wgsl/iridescence.wgsl.js.map +1 -0
  1400. package/dist/shaders/physical-wgsl/sheen.wgsl.d.ts +9 -0
  1401. package/dist/shaders/physical-wgsl/sheen.wgsl.d.ts.map +1 -0
  1402. package/dist/shaders/physical-wgsl/sheen.wgsl.js +85 -0
  1403. package/dist/shaders/physical-wgsl/sheen.wgsl.js.map +1 -0
  1404. package/dist/shaders/physical-wgsl/specular_ior.wgsl.d.ts +10 -0
  1405. package/dist/shaders/physical-wgsl/specular_ior.wgsl.d.ts.map +1 -0
  1406. package/dist/shaders/physical-wgsl/specular_ior.wgsl.js +47 -0
  1407. package/dist/shaders/physical-wgsl/specular_ior.wgsl.js.map +1 -0
  1408. package/dist/shaders/physical-wgsl/tangent_frame.wgsl.d.ts +11 -0
  1409. package/dist/shaders/physical-wgsl/tangent_frame.wgsl.d.ts.map +1 -0
  1410. package/dist/shaders/physical-wgsl/tangent_frame.wgsl.js +57 -0
  1411. package/dist/shaders/physical-wgsl/tangent_frame.wgsl.js.map +1 -0
  1412. package/dist/shaders/physical-wgsl/transmission.wgsl.d.ts +14 -0
  1413. package/dist/shaders/physical-wgsl/transmission.wgsl.d.ts.map +1 -0
  1414. package/dist/shaders/physical-wgsl/transmission.wgsl.js +159 -0
  1415. package/dist/shaders/physical-wgsl/transmission.wgsl.js.map +1 -0
  1416. package/dist/shaders/physical-wgsl/unlit.wgsl.d.ts +8 -0
  1417. package/dist/shaders/physical-wgsl/unlit.wgsl.d.ts.map +1 -0
  1418. package/dist/shaders/physical-wgsl/unlit.wgsl.js +13 -0
  1419. package/dist/shaders/physical-wgsl/unlit.wgsl.js.map +1 -0
  1420. package/dist/shaders/physical-wgsl/uv_transform.wgsl.d.ts +10 -0
  1421. package/dist/shaders/physical-wgsl/uv_transform.wgsl.d.ts.map +1 -0
  1422. package/dist/shaders/physical-wgsl/uv_transform.wgsl.js +24 -0
  1423. package/dist/shaders/physical-wgsl/uv_transform.wgsl.js.map +1 -0
  1424. package/dist/shaders/physical-wgsl/volume.wgsl.d.ts +10 -0
  1425. package/dist/shaders/physical-wgsl/volume.wgsl.d.ts.map +1 -0
  1426. package/dist/shaders/physical-wgsl/volume.wgsl.js +35 -0
  1427. package/dist/shaders/physical-wgsl/volume.wgsl.js.map +1 -0
  1428. package/dist/shadows/DirectionalCascadeFitter.d.ts +97 -0
  1429. package/dist/shadows/DirectionalCascadeFitter.d.ts.map +1 -0
  1430. package/dist/shadows/DirectionalCascadeFitter.js +372 -0
  1431. package/dist/shadows/DirectionalCascadeFitter.js.map +1 -0
  1432. package/dist/shadows/Prd02DepthShaderLibrary.d.ts +77 -0
  1433. package/dist/shadows/Prd02DepthShaderLibrary.d.ts.map +1 -0
  1434. package/dist/shadows/Prd02DepthShaderLibrary.js +381 -0
  1435. package/dist/shadows/Prd02DepthShaderLibrary.js.map +1 -0
  1436. package/dist/shadows/Prd02ReceiveShadowContributor.d.ts +20 -0
  1437. package/dist/shadows/Prd02ReceiveShadowContributor.d.ts.map +1 -0
  1438. package/dist/shadows/Prd02ReceiveShadowContributor.js +20 -0
  1439. package/dist/shadows/Prd02ReceiveShadowContributor.js.map +1 -0
  1440. package/dist/shadows/Prd02ShadowBridge.d.ts +111 -0
  1441. package/dist/shadows/Prd02ShadowBridge.d.ts.map +1 -0
  1442. package/dist/shadows/Prd02ShadowBridge.js +267 -0
  1443. package/dist/shadows/Prd02ShadowBridge.js.map +1 -0
  1444. package/dist/shadows/Prd02ShadowFilter.d.ts +29 -0
  1445. package/dist/shadows/Prd02ShadowFilter.d.ts.map +1 -0
  1446. package/dist/shadows/Prd02ShadowFilter.js +35 -0
  1447. package/dist/shadows/Prd02ShadowFilter.js.map +1 -0
  1448. package/dist/shadows/Prd02ShadowsContributor.d.ts +44 -0
  1449. package/dist/shadows/Prd02ShadowsContributor.d.ts.map +1 -0
  1450. package/dist/shadows/Prd02ShadowsContributor.js +197 -0
  1451. package/dist/shadows/Prd02ShadowsContributor.js.map +1 -0
  1452. package/dist/shadows/ShadowAtlas.d.ts +59 -0
  1453. package/dist/shadows/ShadowAtlas.d.ts.map +1 -0
  1454. package/dist/shadows/ShadowAtlas.js +137 -0
  1455. package/dist/shadows/ShadowAtlas.js.map +1 -0
  1456. package/dist/shadows/ShadowDebugViews.d.ts +5 -0
  1457. package/dist/shadows/ShadowDebugViews.d.ts.map +1 -1
  1458. package/dist/shadows/ShadowDebugViews.js +15 -10
  1459. package/dist/shadows/ShadowDebugViews.js.map +1 -1
  1460. package/dist/shadows/ShadowFrameBinding.d.ts +18 -0
  1461. package/dist/shadows/ShadowFrameBinding.d.ts.map +1 -0
  1462. package/dist/shadows/ShadowFrameBinding.js +52 -0
  1463. package/dist/shadows/ShadowFrameBinding.js.map +1 -0
  1464. package/dist/shadows/ShadowSystem.d.ts +125 -0
  1465. package/dist/shadows/ShadowSystem.d.ts.map +1 -0
  1466. package/dist/shadows/ShadowSystem.js +293 -0
  1467. package/dist/shadows/ShadowSystem.js.map +1 -0
  1468. package/dist/textures/TextureBudget.d.ts +42 -0
  1469. package/dist/textures/TextureBudget.d.ts.map +1 -0
  1470. package/dist/textures/TextureBudget.js +180 -0
  1471. package/dist/textures/TextureBudget.js.map +1 -0
  1472. package/dist/vfx/BeamPass.d.ts +42 -0
  1473. package/dist/vfx/BeamPass.d.ts.map +1 -0
  1474. package/dist/vfx/BeamPass.js +249 -0
  1475. package/dist/vfx/BeamPass.js.map +1 -0
  1476. package/dist/vfx/BlendFallback.d.ts +19 -0
  1477. package/dist/vfx/BlendFallback.d.ts.map +1 -0
  1478. package/dist/vfx/BlendFallback.js +73 -0
  1479. package/dist/vfx/BlendFallback.js.map +1 -0
  1480. package/dist/vfx/DecalBatch.d.ts +120 -0
  1481. package/dist/vfx/DecalBatch.d.ts.map +1 -0
  1482. package/dist/vfx/DecalBatch.js +234 -0
  1483. package/dist/vfx/DecalBatch.js.map +1 -0
  1484. package/dist/vfx/DecalPass.d.ts +63 -0
  1485. package/dist/vfx/DecalPass.d.ts.map +1 -0
  1486. package/dist/vfx/DecalPass.js +159 -0
  1487. package/dist/vfx/DecalPass.js.map +1 -0
  1488. package/dist/vfx/LowResParticles.d.ts +31 -0
  1489. package/dist/vfx/LowResParticles.d.ts.map +1 -0
  1490. package/dist/vfx/LowResParticles.js +151 -0
  1491. package/dist/vfx/LowResParticles.js.map +1 -0
  1492. package/dist/vfx/MeshParticleBatch.d.ts +49 -0
  1493. package/dist/vfx/MeshParticleBatch.d.ts.map +1 -0
  1494. package/dist/vfx/MeshParticleBatch.js +184 -0
  1495. package/dist/vfx/MeshParticleBatch.js.map +1 -0
  1496. package/dist/vfx/MeshParticlePass.d.ts +28 -0
  1497. package/dist/vfx/MeshParticlePass.d.ts.map +1 -0
  1498. package/dist/vfx/MeshParticlePass.js +150 -0
  1499. package/dist/vfx/MeshParticlePass.js.map +1 -0
  1500. package/dist/vfx/ParticleBatchPass.d.ts +61 -0
  1501. package/dist/vfx/ParticleBatchPass.d.ts.map +1 -0
  1502. package/dist/vfx/ParticleBatchPass.js +320 -0
  1503. package/dist/vfx/ParticleBatchPass.js.map +1 -0
  1504. package/dist/vfx/ParticleGpuSim.d.ts +85 -0
  1505. package/dist/vfx/ParticleGpuSim.d.ts.map +1 -0
  1506. package/dist/vfx/ParticleGpuSim.js +301 -0
  1507. package/dist/vfx/ParticleGpuSim.js.map +1 -0
  1508. package/dist/vfx/ParticleInstanceLayout.d.ts +38 -0
  1509. package/dist/vfx/ParticleInstanceLayout.d.ts.map +1 -0
  1510. package/dist/vfx/ParticleInstanceLayout.js +105 -0
  1511. package/dist/vfx/ParticleInstanceLayout.js.map +1 -0
  1512. package/dist/vfx/ParticleSort.d.ts +21 -0
  1513. package/dist/vfx/ParticleSort.d.ts.map +1 -0
  1514. package/dist/vfx/ParticleSort.js +80 -0
  1515. package/dist/vfx/ParticleSort.js.map +1 -0
  1516. package/dist/vfx/ProceduralVolumeEmitter.d.ts +90 -0
  1517. package/dist/vfx/ProceduralVolumeEmitter.d.ts.map +1 -0
  1518. package/dist/vfx/ProceduralVolumeEmitter.js +155 -0
  1519. package/dist/vfx/ProceduralVolumeEmitter.js.map +1 -0
  1520. package/dist/vfx/RibbonBatch.d.ts +71 -0
  1521. package/dist/vfx/RibbonBatch.d.ts.map +1 -0
  1522. package/dist/vfx/RibbonBatch.js +234 -0
  1523. package/dist/vfx/RibbonBatch.js.map +1 -0
  1524. package/dist/vfx/RibbonPass.d.ts +21 -0
  1525. package/dist/vfx/RibbonPass.d.ts.map +1 -0
  1526. package/dist/vfx/RibbonPass.js +108 -0
  1527. package/dist/vfx/RibbonPass.js.map +1 -0
  1528. package/dist/vfx/SceneDepthAdapter.d.ts +28 -0
  1529. package/dist/vfx/SceneDepthAdapter.d.ts.map +1 -0
  1530. package/dist/vfx/SceneDepthAdapter.js +70 -0
  1531. package/dist/vfx/SceneDepthAdapter.js.map +1 -0
  1532. package/dist/vfx/VfxAtlas.d.ts +68 -0
  1533. package/dist/vfx/VfxAtlas.d.ts.map +1 -0
  1534. package/dist/vfx/VfxAtlas.js +106 -0
  1535. package/dist/vfx/VfxAtlas.js.map +1 -0
  1536. package/dist/vfx/contributors.d.ts +73 -0
  1537. package/dist/vfx/contributors.d.ts.map +1 -0
  1538. package/dist/vfx/contributors.js +615 -0
  1539. package/dist/vfx/contributors.js.map +1 -0
  1540. package/dist/vfx/decalLighting.d.ts +8 -0
  1541. package/dist/vfx/decalLighting.d.ts.map +1 -0
  1542. package/dist/vfx/decalLighting.js +53 -0
  1543. package/dist/vfx/decalLighting.js.map +1 -0
  1544. package/dist/vfx/depthSampler.d.ts +3 -0
  1545. package/dist/vfx/depthSampler.d.ts.map +1 -0
  1546. package/dist/vfx/depthSampler.js +10 -0
  1547. package/dist/vfx/depthSampler.js.map +1 -0
  1548. package/dist/vfx/prd07FeaturePars.d.ts +12 -0
  1549. package/dist/vfx/prd07FeaturePars.d.ts.map +1 -0
  1550. package/dist/vfx/prd07FeaturePars.js +54 -0
  1551. package/dist/vfx/prd07FeaturePars.js.map +1 -0
  1552. package/dist/vfx/shaders/beam.glsl.d.ts +11 -0
  1553. package/dist/vfx/shaders/beam.glsl.d.ts.map +1 -0
  1554. package/dist/vfx/shaders/beam.glsl.js +89 -0
  1555. package/dist/vfx/shaders/beam.glsl.js.map +1 -0
  1556. package/dist/vfx/shaders/decal.glsl.d.ts +14 -0
  1557. package/dist/vfx/shaders/decal.glsl.d.ts.map +1 -0
  1558. package/dist/vfx/shaders/decal.glsl.js +157 -0
  1559. package/dist/vfx/shaders/decal.glsl.js.map +1 -0
  1560. package/dist/vfx/shaders/gpu-sim.glsl.d.ts +5 -0
  1561. package/dist/vfx/shaders/gpu-sim.glsl.d.ts.map +1 -0
  1562. package/dist/vfx/shaders/gpu-sim.glsl.js +177 -0
  1563. package/dist/vfx/shaders/gpu-sim.glsl.js.map +1 -0
  1564. package/dist/vfx/shaders/lowresComposite.glsl.d.ts +9 -0
  1565. package/dist/vfx/shaders/lowresComposite.glsl.d.ts.map +1 -0
  1566. package/dist/vfx/shaders/lowresComposite.glsl.js +64 -0
  1567. package/dist/vfx/shaders/lowresComposite.glsl.js.map +1 -0
  1568. package/dist/vfx/shaders/mesh-particle.glsl.d.ts +4 -0
  1569. package/dist/vfx/shaders/mesh-particle.glsl.d.ts.map +1 -0
  1570. package/dist/vfx/shaders/mesh-particle.glsl.js +55 -0
  1571. package/dist/vfx/shaders/mesh-particle.glsl.js.map +1 -0
  1572. package/dist/vfx/shaders/particle.glsl.d.ts +24 -0
  1573. package/dist/vfx/shaders/particle.glsl.d.ts.map +1 -0
  1574. package/dist/vfx/shaders/particle.glsl.js +215 -0
  1575. package/dist/vfx/shaders/particle.glsl.js.map +1 -0
  1576. package/dist/vfx/shaders/ribbon.glsl.d.ts +9 -0
  1577. package/dist/vfx/shaders/ribbon.glsl.d.ts.map +1 -0
  1578. package/dist/vfx/shaders/ribbon.glsl.js +60 -0
  1579. package/dist/vfx/shaders/ribbon.glsl.js.map +1 -0
  1580. package/dist/vfx/shaders/volume.glsl.d.ts +5 -0
  1581. package/dist/vfx/shaders/volume.glsl.d.ts.map +1 -0
  1582. package/dist/vfx/shaders/volume.glsl.js +52 -0
  1583. package/dist/vfx/shaders/volume.glsl.js.map +1 -0
  1584. package/dist/webgl2/ContextLifecycle.d.ts +43 -0
  1585. package/dist/webgl2/ContextLifecycle.d.ts.map +1 -0
  1586. package/dist/webgl2/ContextLifecycle.js +189 -0
  1587. package/dist/webgl2/ContextLifecycle.js.map +1 -0
  1588. package/dist/webgl2/Counters.d.ts +58 -0
  1589. package/dist/webgl2/Counters.d.ts.map +1 -0
  1590. package/dist/webgl2/Counters.js +207 -0
  1591. package/dist/webgl2/Counters.js.map +1 -0
  1592. package/dist/webgl2/DeviceHost.d.ts +41 -0
  1593. package/dist/webgl2/DeviceHost.d.ts.map +1 -0
  1594. package/dist/webgl2/DeviceHost.js +3 -0
  1595. package/dist/webgl2/DeviceHost.js.map +1 -0
  1596. package/dist/webgl2/LegacyPost.d.ts +279 -0
  1597. package/dist/webgl2/LegacyPost.d.ts.map +1 -0
  1598. package/dist/webgl2/LegacyPost.js +2477 -0
  1599. package/dist/webgl2/LegacyPost.js.map +1 -0
  1600. package/dist/webgl2/MultiDraw.d.ts +96 -0
  1601. package/dist/webgl2/MultiDraw.d.ts.map +1 -0
  1602. package/dist/webgl2/MultiDraw.js +716 -0
  1603. package/dist/webgl2/MultiDraw.js.map +1 -0
  1604. package/dist/webgl2/Probe.d.ts +27 -0
  1605. package/dist/webgl2/Probe.d.ts.map +1 -0
  1606. package/dist/webgl2/Probe.js +303 -0
  1607. package/dist/webgl2/Probe.js.map +1 -0
  1608. package/dist/webgl2/Samplers.d.ts +20 -0
  1609. package/dist/webgl2/Samplers.d.ts.map +1 -0
  1610. package/dist/webgl2/Samplers.js +179 -0
  1611. package/dist/webgl2/Samplers.js.map +1 -0
  1612. package/dist/webgl2/TextureFormats.d.ts +48 -0
  1613. package/dist/webgl2/TextureFormats.d.ts.map +1 -0
  1614. package/dist/webgl2/TextureFormats.js +185 -0
  1615. package/dist/webgl2/TextureFormats.js.map +1 -0
  1616. package/dist/webgl2/TextureUpload.d.ts +38 -0
  1617. package/dist/webgl2/TextureUpload.d.ts.map +1 -0
  1618. package/dist/webgl2/TextureUpload.js +346 -0
  1619. package/dist/webgl2/TextureUpload.js.map +1 -0
  1620. package/dist/webgpu/WebGPUBuffer.d.ts +1 -0
  1621. package/dist/webgpu/WebGPUBuffer.d.ts.map +1 -1
  1622. package/dist/webgpu/WebGPUCompute.d.ts +1 -0
  1623. package/dist/webgpu/WebGPUCompute.d.ts.map +1 -1
  1624. package/dist/webgpu/WebGPUCompute.js +1 -0
  1625. package/dist/webgpu/WebGPUCompute.js.map +1 -1
  1626. package/dist/webgpu/WebGPUPipelineCache.d.ts +4 -0
  1627. package/dist/webgpu/WebGPUPipelineCache.d.ts.map +1 -1
  1628. package/dist/webgpu/WebGPUPipelineCache.js +4 -0
  1629. package/dist/webgpu/WebGPUPipelineCache.js.map +1 -1
  1630. package/dist/webgpu/WebGPUPostShaders.d.ts.map +1 -1
  1631. package/dist/webgpu/WebGPUPostShaders.js +33 -2
  1632. package/dist/webgpu/WebGPUPostShaders.js.map +1 -1
  1633. package/dist/webgpu/WebGPUTexture.d.ts +1 -0
  1634. package/dist/webgpu/WebGPUTexture.d.ts.map +1 -1
  1635. package/dist/webgpu/WebGPUTexture.js.map +1 -1
  1636. package/dist/world/chunks.d.ts +15 -0
  1637. package/dist/world/chunks.d.ts.map +1 -0
  1638. package/dist/world/chunks.js +56 -0
  1639. package/dist/world/chunks.js.map +1 -0
  1640. package/dist/world/index.d.ts +38 -0
  1641. package/dist/world/index.d.ts.map +1 -0
  1642. package/dist/world/index.js +39 -0
  1643. package/dist/world/index.js.map +1 -0
  1644. package/dist/world/shared/shaders/worldLightFallback.d.ts +12 -0
  1645. package/dist/world/shared/shaders/worldLightFallback.d.ts.map +1 -0
  1646. package/dist/world/shared/shaders/worldLightFallback.js +82 -0
  1647. package/dist/world/shared/shaders/worldLightFallback.js.map +1 -0
  1648. package/dist/world/space/PlanetMaterial.d.ts +24 -0
  1649. package/dist/world/space/PlanetMaterial.d.ts.map +1 -0
  1650. package/dist/world/space/PlanetMaterial.js +82 -0
  1651. package/dist/world/space/PlanetMaterial.js.map +1 -0
  1652. package/dist/world/space/SpaceSkyBake.d.ts +46 -0
  1653. package/dist/world/space/SpaceSkyBake.d.ts.map +1 -0
  1654. package/dist/world/space/SpaceSkyBake.js +145 -0
  1655. package/dist/world/space/SpaceSkyBake.js.map +1 -0
  1656. package/dist/world/space/shaders/planet.d.ts +8 -0
  1657. package/dist/world/space/shaders/planet.d.ts.map +1 -0
  1658. package/dist/world/space/shaders/planet.js +55 -0
  1659. package/dist/world/space/shaders/planet.js.map +1 -0
  1660. package/dist/world/space/shaders/spaceBake.d.ts +9 -0
  1661. package/dist/world/space/shaders/spaceBake.d.ts.map +1 -0
  1662. package/dist/world/space/shaders/spaceBake.js +102 -0
  1663. package/dist/world/space/shaders/spaceBake.js.map +1 -0
  1664. package/dist/world/terrain/SplatBake.d.ts +76 -0
  1665. package/dist/world/terrain/SplatBake.d.ts.map +1 -0
  1666. package/dist/world/terrain/SplatBake.js +308 -0
  1667. package/dist/world/terrain/SplatBake.js.map +1 -0
  1668. package/dist/world/terrain/TerrainCdlod.d.ts +67 -0
  1669. package/dist/world/terrain/TerrainCdlod.d.ts.map +1 -0
  1670. package/dist/world/terrain/TerrainCdlod.js +115 -0
  1671. package/dist/world/terrain/TerrainCdlod.js.map +1 -0
  1672. package/dist/world/terrain/TerrainHeightTexture.d.ts +44 -0
  1673. package/dist/world/terrain/TerrainHeightTexture.d.ts.map +1 -0
  1674. package/dist/world/terrain/TerrainHeightTexture.js +173 -0
  1675. package/dist/world/terrain/TerrainHeightTexture.js.map +1 -0
  1676. package/dist/world/terrain/TerrainPatchGeometry.d.ts +18 -0
  1677. package/dist/world/terrain/TerrainPatchGeometry.d.ts.map +1 -0
  1678. package/dist/world/terrain/TerrainPatchGeometry.js +40 -0
  1679. package/dist/world/terrain/TerrainPatchGeometry.js.map +1 -0
  1680. package/dist/world/terrain/shaders/terrain.vert.glsl.d.ts +19 -0
  1681. package/dist/world/terrain/shaders/terrain.vert.glsl.d.ts.map +1 -0
  1682. package/dist/world/terrain/shaders/terrain.vert.glsl.js +162 -0
  1683. package/dist/world/terrain/shaders/terrain.vert.glsl.js.map +1 -0
  1684. package/dist/world/terrain/shaders/terrainCdlod.d.ts +23 -0
  1685. package/dist/world/terrain/shaders/terrainCdlod.d.ts.map +1 -0
  1686. package/dist/world/terrain/shaders/terrainCdlod.js +110 -0
  1687. package/dist/world/terrain/shaders/terrainCdlod.js.map +1 -0
  1688. package/dist/world/terrain/shaders/terrainSplat.d.ts +26 -0
  1689. package/dist/world/terrain/shaders/terrainSplat.d.ts.map +1 -0
  1690. package/dist/world/terrain/shaders/terrainSplat.js +181 -0
  1691. package/dist/world/terrain/shaders/terrainSplat.js.map +1 -0
  1692. package/dist/world/vegetation/FoliageMaterial.d.ts +14 -0
  1693. package/dist/world/vegetation/FoliageMaterial.d.ts.map +1 -0
  1694. package/dist/world/vegetation/FoliageMaterial.js +107 -0
  1695. package/dist/world/vegetation/FoliageMaterial.js.map +1 -0
  1696. package/dist/world/vegetation/GrassField.d.ts +43 -0
  1697. package/dist/world/vegetation/GrassField.d.ts.map +1 -0
  1698. package/dist/world/vegetation/GrassField.js +68 -0
  1699. package/dist/world/vegetation/GrassField.js.map +1 -0
  1700. package/dist/world/vegetation/ImpostorMaterial.d.ts +20 -0
  1701. package/dist/world/vegetation/ImpostorMaterial.d.ts.map +1 -0
  1702. package/dist/world/vegetation/ImpostorMaterial.js +80 -0
  1703. package/dist/world/vegetation/ImpostorMaterial.js.map +1 -0
  1704. package/dist/world/vegetation/InstanceChunkGrid.d.ts +67 -0
  1705. package/dist/world/vegetation/InstanceChunkGrid.d.ts.map +1 -0
  1706. package/dist/world/vegetation/InstanceChunkGrid.js +150 -0
  1707. package/dist/world/vegetation/InstanceChunkGrid.js.map +1 -0
  1708. package/dist/world/vegetation/WindCpu.d.ts +19 -0
  1709. package/dist/world/vegetation/WindCpu.d.ts.map +1 -0
  1710. package/dist/world/vegetation/WindCpu.js +43 -0
  1711. package/dist/world/vegetation/WindCpu.js.map +1 -0
  1712. package/dist/world/vegetation/WindField.d.ts +42 -0
  1713. package/dist/world/vegetation/WindField.d.ts.map +1 -0
  1714. package/dist/world/vegetation/WindField.js +154 -0
  1715. package/dist/world/vegetation/WindField.js.map +1 -0
  1716. package/dist/world/vegetation/shaders/foliage.d.ts +8 -0
  1717. package/dist/world/vegetation/shaders/foliage.d.ts.map +1 -0
  1718. package/dist/world/vegetation/shaders/foliage.js +104 -0
  1719. package/dist/world/vegetation/shaders/foliage.js.map +1 -0
  1720. package/dist/world/vegetation/shaders/grass.d.ts +10 -0
  1721. package/dist/world/vegetation/shaders/grass.d.ts.map +1 -0
  1722. package/dist/world/vegetation/shaders/grass.js +79 -0
  1723. package/dist/world/vegetation/shaders/grass.js.map +1 -0
  1724. package/dist/world/vegetation/shaders/impostor.d.ts +9 -0
  1725. package/dist/world/vegetation/shaders/impostor.d.ts.map +1 -0
  1726. package/dist/world/vegetation/shaders/impostor.js +97 -0
  1727. package/dist/world/vegetation/shaders/impostor.js.map +1 -0
  1728. package/dist/world/vegetation/shaders/wind.d.ts +9 -0
  1729. package/dist/world/vegetation/shaders/wind.d.ts.map +1 -0
  1730. package/dist/world/vegetation/shaders/wind.js +103 -0
  1731. package/dist/world/vegetation/shaders/wind.js.map +1 -0
  1732. package/dist/world/water/GerstnerWaves.d.ts +65 -0
  1733. package/dist/world/water/GerstnerWaves.d.ts.map +1 -0
  1734. package/dist/world/water/GerstnerWaves.js +182 -0
  1735. package/dist/world/water/GerstnerWaves.js.map +1 -0
  1736. package/dist/world/water/ReflectionViewPass.d.ts +46 -0
  1737. package/dist/world/water/ReflectionViewPass.d.ts.map +1 -0
  1738. package/dist/world/water/ReflectionViewPass.js +85 -0
  1739. package/dist/world/water/ReflectionViewPass.js.map +1 -0
  1740. package/dist/world/water/SceneCopyFallback.d.ts +21 -0
  1741. package/dist/world/water/SceneCopyFallback.d.ts.map +1 -0
  1742. package/dist/world/water/SceneCopyFallback.js +150 -0
  1743. package/dist/world/water/SceneCopyFallback.js.map +1 -0
  1744. package/dist/world/water/UnderwaterState.d.ts +25 -0
  1745. package/dist/world/water/UnderwaterState.d.ts.map +1 -0
  1746. package/dist/world/water/UnderwaterState.js +134 -0
  1747. package/dist/world/water/UnderwaterState.js.map +1 -0
  1748. package/dist/world/water/WaterMaterial.d.ts +23 -0
  1749. package/dist/world/water/WaterMaterial.d.ts.map +1 -0
  1750. package/dist/world/water/WaterMaterial.js +129 -0
  1751. package/dist/world/water/WaterMaterial.js.map +1 -0
  1752. package/dist/world/water/shaders/caustics.d.ts +13 -0
  1753. package/dist/world/water/shaders/caustics.d.ts.map +1 -0
  1754. package/dist/world/water/shaders/caustics.js +103 -0
  1755. package/dist/world/water/shaders/caustics.js.map +1 -0
  1756. package/dist/world/water/shaders/gerstner.d.ts +9 -0
  1757. package/dist/world/water/shaders/gerstner.d.ts.map +1 -0
  1758. package/dist/world/water/shaders/gerstner.js +100 -0
  1759. package/dist/world/water/shaders/gerstner.js.map +1 -0
  1760. package/dist/world/water/shaders/water.d.ts +12 -0
  1761. package/dist/world/water/shaders/water.d.ts.map +1 -0
  1762. package/dist/world/water/shaders/water.js +112 -0
  1763. package/dist/world/water/shaders/water.js.map +1 -0
  1764. package/package.json +32 -11
@@ -0,0 +1,2477 @@
1
+ // PR 0b-2 carve-out (CONTRACTS.md §3.3) — verbatim move from WebGL2Device.ts; 0 changed logic lines.
2
+ import { invertSsrProjection } from "../ProjectionMath.js";
3
+ import { RenderDeviceError, resolveGpuTargetOwner } from "../RenderDevice.js";
4
+ import { temporalAccumulationWeight } from "../TemporalMath.js";
5
+ import { WebGL2RenderTarget } from "../WebGL2Device.js";
6
+ import { normalizeBloomQualityPreset, resolveBloomPyramidBlurRadii, resolveBloomPyramidPlan, resolveBloomPyramidResponseGain, resolveBloomPyramidV2Response } from "../postprocess/NativeBloomPyramid.js";
7
+ import { BLOOM_BRIGHT_LUT_HEIGHT, BLOOM_BRIGHT_LUT_WIDTH, BLOOM_COMPOSITE_LUT_SIZE, OUTLINE_BLEND_LUT_WIDTH, OUTLINE_LIMB_RADIX, createBloomBrightThresholdLut, createBloomCompositeLut, createOutlineBlendLut, createOutlineGradientBound } from "../postprocess/NativeLdrEffectLuts.js";
8
+ // PRD-03 Phase 1 — the r185 FXAA finalize (post/shaders/fxaa.glsl.ts). The
9
+ // split is opt-in via `fxaa: { variant: "r185" }`; the legacy in-shader
10
+ // `u_hasFxaa` taps stay the default path.
11
+ import { FXAA_185_FRAGMENT_GLSL } from "../post/shaders/fxaa.glsl.js";
12
+ import { recordPostSkipped } from "../renderer/postSkipped.js";
13
+ export class WebGL2LegacyPostPipeline {
14
+ host;
15
+ constructor(host) {
16
+ this.host = host;
17
+ }
18
+ bloomAccumulateProgram = null;
19
+ bloomBlurProgram = null;
20
+ bloomBrightExtractProgram = null;
21
+ bloomBrightLutTexture = null;
22
+ bloomBrightLutThreshold = null;
23
+ bloomCompositeLutIntensity = null;
24
+ bloomCompositeLutShoulder = null;
25
+ bloomCompositeLutTexture = null;
26
+ bloomCompositeProgram = null;
27
+ bloomDownsampleProgram = null;
28
+ bloomPingPongResources = null;
29
+ bloomPyramidResources = null;
30
+ depthOfFieldProgram = null;
31
+ lastBloomDiagnostics = null;
32
+ ldrPostprocessProgram = null;
33
+ motionBlurProgram = null;
34
+ nativeFxaaFinalizeProgram = null;
35
+ motionBlurVelocitySize = null;
36
+ motionBlurVelocityTexture = null;
37
+ outlineBlendLutKey = null;
38
+ outlineBlendLutTexture = null;
39
+ outlineProgram = null;
40
+ presentationProgram = null;
41
+ presentationVertexArray = null;
42
+ ssaoProgram = null;
43
+ ssrProgram = null;
44
+ taaHistorySize = null;
45
+ taaHistoryTexture = null;
46
+ taaPresentationProgram = null;
47
+ taaProgram = null;
48
+ presentRenderTarget(source) {
49
+ this.host.lifecycle.assertAlive();
50
+ if (!(source instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(source) || source.disposed) {
51
+ throw new RenderDeviceError("Render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
52
+ targetId: source.id
53
+ });
54
+ }
55
+ this.host.resolveMultisampleTarget(source);
56
+ const outputWidth = this.host.lifecycle.viewportWidth || this.host.gl.drawingBufferWidth;
57
+ const outputHeight = this.host.lifecycle.viewportHeight || this.host.gl.drawingBufferHeight;
58
+ this.drawRenderTargetToBackbuffer(source, outputWidth, outputHeight);
59
+ this.host.activeRenderTarget = null;
60
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, null);
61
+ this.host.lifecycle.lastError = this.host.lifecycle.readError();
62
+ if (this.host.lifecycle.lastError) {
63
+ throw new RenderDeviceError(`WebGL2 render-target presentation failed: ${this.host.lifecycle.lastError}`, "WEBGL_PRESENT_FAILED", {
64
+ targetId: source.id,
65
+ error: this.host.lifecycle.lastError
66
+ });
67
+ }
68
+ }
69
+ executeReflectionSurfaceSsr(source, normalMask, output, options) {
70
+ this.host.lifecycle.assertAlive();
71
+ for (const target of [source, normalMask, output]) {
72
+ if (!(target instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(target) || target.disposed) {
73
+ throw new RenderDeviceError("SSR inputs must be live targets owned by this device", "INVALID_RESOURCE");
74
+ }
75
+ }
76
+ const color = source, normals = normalMask, destination = output;
77
+ if (!color.depthTextureHandle || color === destination || normals === destination
78
+ || color.width !== normals.width || color.height !== normals.height) {
79
+ throw new RenderDeviceError("SSR requires sampleable scene depth, matching normal-mask input, and a separate output", "INVALID_RESOURCE");
80
+ }
81
+ this.host.resolveMultisampleTarget(color);
82
+ this.host.resolveMultisampleTarget(normals);
83
+ const state = this.prepareFullscreenPresentation(destination.framebuffer, destination.width, destination.height);
84
+ try {
85
+ this.drawSsrKernel(color.colorHandle, color.depthTextureHandle, destination.width, destination.height, { ...options, normalMask: normals.colorHandle }, this.ensurePresentationVertexArray(), { near: 0.1, far: 1000 });
86
+ }
87
+ finally {
88
+ this.restoreFullscreenPresentationState(state, destination.width, destination.height);
89
+ }
90
+ }
91
+ presentLdrPostprocess(source, options) {
92
+ this.host.lifecycle.assertAlive();
93
+ if (!(source instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(source) || source.disposed) {
94
+ throw new RenderDeviceError("Render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
95
+ targetId: source.id
96
+ });
97
+ }
98
+ this.host.resolveMultisampleTarget(source);
99
+ const tonePass = options.passes.find((pass) => pass.name === "tone-mapping");
100
+ const bloomPass = options.passes.find((pass) => pass.name === "bloom");
101
+ const depthOfFieldPass = options.passes.find((pass) => pass.name === "depth-of-field");
102
+ const motionBlurPass = options.passes.find((pass) => pass.name === "motion-blur");
103
+ const ssaoPass = options.passes.find((pass) => pass.name === "ssao");
104
+ const ssrPass = options.passes.find((pass) => pass.name === "ssr");
105
+ const taaPass = options.passes.find((pass) => pass.name === "taa");
106
+ const outlinePass = options.passes.find((pass) => pass.name === "outline");
107
+ if (source.colorTexture.format !== "rgba8" && !tonePass) {
108
+ throw new RenderDeviceError("WebGL2 HDR postprocess presentation requires a tone-mapping pass before LDR output.", "WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED", {
109
+ targetId: source.id,
110
+ format: source.colorTexture.format
111
+ });
112
+ }
113
+ if (source.colorTexture.format !== "rgba8" && (depthOfFieldPass || motionBlurPass || ssaoPass || ssrPass || taaPass || outlinePass) && !tonePass) {
114
+ throw new RenderDeviceError("WebGL2 byte-kernel postprocess requires rgba8 input or a preceding tone-mapping pass.", "WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED", {
115
+ targetId: source.id,
116
+ format: source.colorTexture.format,
117
+ pass: depthOfFieldPass ? "depth-of-field" : motionBlurPass ? "motion-blur" : ssaoPass ? "ssao" : ssrPass ? "ssr" : taaPass ? "taa" : "outline"
118
+ });
119
+ }
120
+ if ((depthOfFieldPass || ssaoPass || ssrPass) && !source.depthTextureHandle) {
121
+ throw new RenderDeviceError("WebGL2 native depth postprocess requires a renderer-owned sampleable depth texture.", "WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED", {
122
+ targetId: source.id,
123
+ pass: depthOfFieldPass ? "depth-of-field" : ssaoPass ? "ssao" : "ssr"
124
+ });
125
+ }
126
+ // Raw GL depth is nonlinear (0.1/1000 defaults park the play area past
127
+ // 0.97), which blinded every depth-gated native pass. SSR and DOF compare
128
+ // linearized depth; SSAO keeps its legacy response (documented partial).
129
+ const depthRange = normalizeLdrDepthRange(options.depthRange);
130
+ const outputTarget = options.outputTarget;
131
+ if (outputTarget && (!(outputTarget instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(outputTarget) || outputTarget.disposed)) {
132
+ throw new RenderDeviceError("Output render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
133
+ targetId: outputTarget.id
134
+ });
135
+ }
136
+ if (outputTarget && outputTarget.colorTexture.format !== "rgba8") {
137
+ throw new RenderDeviceError("WebGL2 LDR postprocess output target must be rgba8.", "WEBGL_LDR_POSTPROCESS_OUTPUT_FORMAT_UNSUPPORTED", {
138
+ targetId: outputTarget.id,
139
+ format: outputTarget.colorTexture.format
140
+ });
141
+ }
142
+ if (outputTarget && (outputTarget.width !== source.width || outputTarget.height !== source.height)) {
143
+ throw new RenderDeviceError("WebGL2 LDR postprocess source and output dimensions must match.", "WEBGL_LDR_POSTPROCESS_SIZE_MISMATCH", {
144
+ sourceWidth: source.width,
145
+ sourceHeight: source.height,
146
+ targetWidth: outputTarget.width,
147
+ targetHeight: outputTarget.height
148
+ });
149
+ }
150
+ const webglOutputTarget = outputTarget;
151
+ const colorPass = options.passes.find((pass) => pass.name === "color-grade");
152
+ const fxaaPass = options.passes.find((pass) => pass.name === "fxaa");
153
+ const bloomOptions = bloomPass ? normalizeNativeBloomOptions(bloomPass.options) : undefined;
154
+ const depthOfFieldOptions = depthOfFieldPass ? normalizeNativeDepthOfFieldOptions(depthOfFieldPass.options) : undefined;
155
+ const motionBlurOptions = motionBlurPass
156
+ ? normalizeNativeMotionBlurOptions(motionBlurPass.options, source.width, source.height)
157
+ : undefined;
158
+ const ssaoOptions = ssaoPass ? normalizeNativeSsaoOptions(ssaoPass.options) : undefined;
159
+ const ssrOptions = ssrPass ? normalizeNativeSsrOptions(ssrPass.options) : undefined;
160
+ const taaOptions = taaPass ? normalizeNativeTaaOptions(taaPass.options, source.width, source.height) : undefined;
161
+ const outlineOptions = outlinePass ? normalizeNativeOutlineOptions(outlinePass.options) : undefined;
162
+ const program = this.ensureLdrPostprocessProgram();
163
+ const vertexArray = this.ensurePresentationVertexArray();
164
+ const sourceIsHdr = source.colorTexture.format !== "rgba8";
165
+ // PRD-03 Phase 1: `fxaa.variant === "r185"` splits the finalize — the
166
+ // legacy stage presents tone/grade into an RGBA8 intermediate and the
167
+ // dedicated r185 FXAA + triangular-dither program writes the output, so
168
+ // the FXAA taps no longer re-run `finalColorAt` per tap.
169
+ const fxaaSplit = fxaaPass?.options?.variant === "r185";
170
+ const bloomResources = bloomOptions || depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions || fxaaSplit
171
+ ? this.ensureBloomPingPongResources(source.width, source.height, sourceIsHdr && Boolean(bloomOptions))
172
+ : undefined;
173
+ if (bloomOptions && !sourceIsHdr) {
174
+ this.ensureBloomLutTextures(bloomOptions);
175
+ }
176
+ if (outlineOptions) {
177
+ this.ensureOutlineBlendLutTexture(outlineOptions);
178
+ }
179
+ if (motionBlurOptions?.velocity) {
180
+ this.ensureMotionBlurVelocityTexture(source.width, source.height, motionBlurOptions.velocity);
181
+ }
182
+ if (taaOptions?.history) {
183
+ this.ensureTaaHistoryTexture(source.width, source.height, taaOptions.history);
184
+ }
185
+ const outputWidth = webglOutputTarget?.width ?? (this.host.lifecycle.viewportWidth || this.host.gl.drawingBufferWidth);
186
+ const outputHeight = webglOutputTarget?.height ?? (this.host.lifecycle.viewportHeight || this.host.gl.drawingBufferHeight);
187
+ const previousState = this.prepareFullscreenPresentation(webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight);
188
+ try {
189
+ let ldrSourceHandle = source.colorHandle;
190
+ let temporarySourceIndex = -1;
191
+ if (bloomOptions && bloomResources) {
192
+ if (bloomOptions.quality === "performance") {
193
+ ldrSourceHandle = this.executeNativeBloomPasses(ldrSourceHandle, bloomResources, bloomOptions, vertexArray, sourceIsHdr);
194
+ temporarySourceIndex = 1;
195
+ this.recordBloomDiagnostics(bloomOptions, source.width, source.height, sourceIsHdr, 1);
196
+ }
197
+ else {
198
+ const plan = resolveBloomPyramidPlan(source.width, source.height, bloomOptions.quality, sourceIsHdr);
199
+ const pyramid = this.ensureBloomPyramidResources(plan, sourceIsHdr);
200
+ const pyramidResult = this.executeNativeBloomPyramidPasses(ldrSourceHandle, source.width, source.height, pyramid, {
201
+ textureA: bloomResources.textures[0],
202
+ framebufferA: bloomResources.framebuffers[0],
203
+ textureB: bloomResources.textures[1],
204
+ framebufferB: bloomResources.framebuffers[1]
205
+ }, bloomOptions, vertexArray, sourceIsHdr);
206
+ // The pyramid sum lands in ping-pong texture A; composite it with the
207
+ // source through the proven single-scale composite program.
208
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, bloomResources.framebuffers[1]);
209
+ this.host.gl.viewport(0, 0, source.width, source.height);
210
+ const pyramidComposite = this.ensureBloomCompositeProgram();
211
+ this.host.gl.useProgram(pyramidComposite);
212
+ this.host.gl.bindVertexArray(vertexArray);
213
+ this.bindFullscreenTexture(0, ldrSourceHandle);
214
+ this.bindFullscreenTexture(1, pyramidResult);
215
+ if (this.bloomCompositeLutTexture)
216
+ this.bindFullscreenTexture(2, this.bloomCompositeLutTexture);
217
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_source"), 0);
218
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_blurred"), 1);
219
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_compositeLut"), 2);
220
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_hdr"), sourceIsHdr ? 1 : 0);
221
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(pyramidComposite, "u_intensity"), bloomOptions.intensity * nativeBloomResponseGain(plan, bloomOptions));
222
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
223
+ ldrSourceHandle = bloomResources.textures[1];
224
+ // `temporarySourceIndex` names the ping-pong slot that HOLDS the
225
+ // current source (every later pass writes the other slot). The
226
+ // composite lives in texture B, so the index is 1. It was 0, which
227
+ // made the next pass (r185 FXAA split under A3D_QR_POST, ssao, ...)
228
+ // write framebuffer B while sampling texture B — a WebGL feedback
229
+ // loop (GL_INVALID_OPERATION 0x502, WEBGL_LDR_POSTPROCESS_FAILED).
230
+ temporarySourceIndex = 1;
231
+ this.recordBloomDiagnostics(bloomOptions, source.width, source.height, sourceIsHdr, plan.mipCount);
232
+ }
233
+ }
234
+ if ((depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions) && bloomResources) {
235
+ if (tonePass || colorPass) {
236
+ const baseTargetIndex = 0;
237
+ this.drawNativeLdrStage(ldrSourceHandle, bloomResources.framebuffers[baseTargetIndex], source.width, source.height, program, vertexArray, tonePass, colorPass, undefined, options.toneMappingDefaults);
238
+ ldrSourceHandle = bloomResources.textures[baseTargetIndex];
239
+ temporarySourceIndex = baseTargetIndex;
240
+ }
241
+ if (depthOfFieldOptions && source.depthTextureHandle) {
242
+ const depthOfFieldTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
243
+ ldrSourceHandle = this.executeNativeDepthOfFieldPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, depthOfFieldOptions, vertexArray, depthOfFieldTargetIndex, depthRange);
244
+ temporarySourceIndex = depthOfFieldTargetIndex;
245
+ }
246
+ if (motionBlurOptions) {
247
+ const motionBlurTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
248
+ ldrSourceHandle = this.executeNativeMotionBlurPass(ldrSourceHandle, bloomResources, motionBlurOptions, vertexArray, motionBlurTargetIndex);
249
+ temporarySourceIndex = motionBlurTargetIndex;
250
+ }
251
+ if (ssaoOptions && source.depthTextureHandle) {
252
+ const ssaoTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
253
+ ldrSourceHandle = this.executeNativeSsaoPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, ssaoOptions, vertexArray, ssaoTargetIndex);
254
+ temporarySourceIndex = ssaoTargetIndex;
255
+ }
256
+ if (ssrOptions && source.depthTextureHandle) {
257
+ const ssrTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
258
+ ldrSourceHandle = this.executeNativeSsrPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, ssrOptions, vertexArray, ssrTargetIndex, depthRange);
259
+ temporarySourceIndex = ssrTargetIndex;
260
+ }
261
+ if (taaOptions) {
262
+ const taaTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
263
+ ldrSourceHandle = this.executeNativeTaaPass(ldrSourceHandle, bloomResources, taaOptions, vertexArray, taaTargetIndex);
264
+ temporarySourceIndex = taaTargetIndex;
265
+ }
266
+ }
267
+ if (outlineOptions && bloomResources) {
268
+ const outlineTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
269
+ ldrSourceHandle = this.executeNativeOutlinePasses(ldrSourceHandle, bloomResources, outlineOptions, vertexArray, outlineTargetIndex);
270
+ temporarySourceIndex = outlineTargetIndex;
271
+ }
272
+ if (fxaaSplit && bloomResources) {
273
+ const fxaaScratchIndex = temporarySourceIndex === 0 ? 1 : 0;
274
+ this.drawNativeLdrStage(ldrSourceHandle, bloomResources.framebuffers[fxaaScratchIndex], source.width, source.height, program, vertexArray, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : tonePass, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : colorPass, undefined, options.toneMappingDefaults);
275
+ this.executeNativeFxaaFinalize(bloomResources.textures[fxaaScratchIndex], webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight, source.width, source.height, vertexArray);
276
+ }
277
+ else {
278
+ this.drawNativeLdrStage(ldrSourceHandle, webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight, program, vertexArray, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : tonePass, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : colorPass, fxaaPass, options.toneMappingDefaults);
279
+ }
280
+ this.host.gl.flush();
281
+ }
282
+ finally {
283
+ this.restoreFullscreenPresentationState(previousState, outputWidth, outputHeight);
284
+ }
285
+ this.host.lifecycle.lastError = this.host.lifecycle.readError();
286
+ if (this.host.lifecycle.lastError) {
287
+ throw new RenderDeviceError(`WebGL2 LDR postprocess presentation failed: ${this.host.lifecycle.lastError}`, "WEBGL_LDR_POSTPROCESS_FAILED", {
288
+ targetId: source.id,
289
+ error: this.host.lifecycle.lastError
290
+ });
291
+ }
292
+ this.host.device.setRenderTarget(webglOutputTarget ?? null);
293
+ }
294
+ drawRenderTargetToBackbuffer(source, outputWidth, outputHeight) {
295
+ const program = this.ensurePresentationProgram();
296
+ const vertexArray = this.ensurePresentationVertexArray();
297
+ const previousState = this.prepareFullscreenPresentation(null, outputWidth, outputHeight);
298
+ this.host.gl.useProgram(program);
299
+ this.host.gl.bindVertexArray(vertexArray);
300
+ this.host.gl.activeTexture(this.host.gl.TEXTURE0);
301
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, source.colorHandle);
302
+ this.host.gl.bindSampler(0, null);
303
+ try {
304
+ const uniformLocation = this.host.gl.getUniformLocation(program, "u_source");
305
+ this.host.gl.uniform1i(uniformLocation, 0);
306
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
307
+ this.host.gl.flush();
308
+ }
309
+ finally {
310
+ this.restoreFullscreenPresentationState(previousState, outputWidth, outputHeight);
311
+ }
312
+ }
313
+ ensureBloomPingPongResources(width, height, hdr = false) {
314
+ const current = this.bloomPingPongResources;
315
+ if (current && current.width === width && current.height === height && current.hdr === hdr) {
316
+ return current;
317
+ }
318
+ this.disposeBloomPingPongResources();
319
+ this.disposeBloomPyramidResources();
320
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
321
+ const previousFramebuffer = this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING);
322
+ const textures = [];
323
+ const framebuffers = [];
324
+ try {
325
+ for (let index = 0; index < 2; index += 1) {
326
+ const texture = this.host.gl.createTexture();
327
+ const framebuffer = this.host.gl.createFramebuffer();
328
+ if (!texture || !framebuffer) {
329
+ if (texture)
330
+ this.host.gl.deleteTexture(texture);
331
+ if (framebuffer)
332
+ this.host.gl.deleteFramebuffer(framebuffer);
333
+ throw new RenderDeviceError("Failed to allocate WebGL2 bloom ping-pong resources", "WEBGL_ALLOCATION_FAILED", {
334
+ width,
335
+ height,
336
+ index
337
+ });
338
+ }
339
+ textures.push(texture);
340
+ framebuffers.push(framebuffer);
341
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
342
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.NEAREST);
343
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.NEAREST);
344
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
345
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
346
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, hdr ? this.host.gl.RGBA16F : this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, hdr ? this.host.gl.HALF_FLOAT : this.host.gl.UNSIGNED_BYTE, null);
347
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
348
+ this.host.gl.framebufferTexture2D(this.host.gl.FRAMEBUFFER, this.host.gl.COLOR_ATTACHMENT0, this.host.gl.TEXTURE_2D, texture, 0);
349
+ const status = this.host.gl.checkFramebufferStatus(this.host.gl.FRAMEBUFFER);
350
+ if (status !== this.host.gl.FRAMEBUFFER_COMPLETE) {
351
+ throw new RenderDeviceError("WebGL2 bloom ping-pong framebuffer status is invalid", "FRAMEBUFFER_INVALID", {
352
+ width,
353
+ height,
354
+ index,
355
+ status
356
+ });
357
+ }
358
+ }
359
+ const resources = {
360
+ width,
361
+ height,
362
+ hdr,
363
+ textures: [textures[0], textures[1]],
364
+ framebuffers: [framebuffers[0], framebuffers[1]]
365
+ };
366
+ this.bloomPingPongResources = resources;
367
+ return resources;
368
+ }
369
+ catch (error) {
370
+ for (const texture of textures)
371
+ this.host.gl.deleteTexture(texture);
372
+ for (const framebuffer of framebuffers)
373
+ this.host.gl.deleteFramebuffer(framebuffer);
374
+ throw error;
375
+ }
376
+ finally {
377
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, previousFramebuffer);
378
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
379
+ this.host.stateCache.invalidate();
380
+ }
381
+ }
382
+ ensureBloomLutTextures(options) {
383
+ const updateBright = this.bloomBrightLutThreshold !== options.threshold;
384
+ const updateComposite = this.bloomCompositeLutIntensity !== options.intensity ||
385
+ this.bloomCompositeLutShoulder !== options.shoulder;
386
+ if (this.bloomBrightLutTexture && this.bloomCompositeLutTexture && !updateBright && !updateComposite) {
387
+ return;
388
+ }
389
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
390
+ try {
391
+ if (!this.bloomBrightLutTexture) {
392
+ this.bloomBrightLutTexture = this.createNativeBloomDataTexture();
393
+ }
394
+ if (updateBright) {
395
+ const pixels = createBloomBrightThresholdLut(options.threshold);
396
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.bloomBrightLutTexture);
397
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, BLOOM_BRIGHT_LUT_WIDTH, BLOOM_BRIGHT_LUT_HEIGHT, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, pixels);
398
+ this.bloomBrightLutThreshold = options.threshold;
399
+ }
400
+ if (!this.bloomCompositeLutTexture) {
401
+ this.bloomCompositeLutTexture = this.createNativeBloomDataTexture();
402
+ }
403
+ if (updateComposite) {
404
+ const pixels = createBloomCompositeLut(options.intensity, { shoulder: options.shoulder });
405
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.bloomCompositeLutTexture);
406
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, BLOOM_COMPOSITE_LUT_SIZE, BLOOM_COMPOSITE_LUT_SIZE, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, pixels);
407
+ this.bloomCompositeLutIntensity = options.intensity;
408
+ this.bloomCompositeLutShoulder = options.shoulder;
409
+ }
410
+ }
411
+ finally {
412
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
413
+ this.host.stateCache.invalidate();
414
+ }
415
+ }
416
+ createNativeBloomDataTexture() {
417
+ const texture = this.host.gl.createTexture();
418
+ if (!texture) {
419
+ throw new RenderDeviceError("Failed to allocate WebGL2 bloom lookup texture", "WEBGL_ALLOCATION_FAILED");
420
+ }
421
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
422
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.NEAREST);
423
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.NEAREST);
424
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
425
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
426
+ return texture;
427
+ }
428
+ ensureOutlineBlendLutTexture(options) {
429
+ const combinedAlpha = options.opacity * (options.color[3] / 255);
430
+ const key = `${options.color.join(",")}|${combinedAlpha}`;
431
+ if (this.outlineBlendLutTexture && this.outlineBlendLutKey === key)
432
+ return;
433
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
434
+ try {
435
+ if (!this.outlineBlendLutTexture) {
436
+ this.outlineBlendLutTexture = this.createNativeBloomDataTexture();
437
+ }
438
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.outlineBlendLutTexture);
439
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, OUTLINE_BLEND_LUT_WIDTH, 1, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, createOutlineBlendLut(options.color, combinedAlpha));
440
+ this.outlineBlendLutKey = key;
441
+ }
442
+ finally {
443
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
444
+ this.host.stateCache.invalidate();
445
+ }
446
+ }
447
+ ensureMotionBlurVelocityTexture(width, height, velocity) {
448
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
449
+ try {
450
+ if (!this.motionBlurVelocityTexture) {
451
+ this.motionBlurVelocityTexture = this.createNativeBloomDataTexture();
452
+ }
453
+ this.motionBlurVelocitySize = { width, height };
454
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.motionBlurVelocityTexture);
455
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RG32F, width, height, 0, this.host.gl.RG, this.host.gl.FLOAT, velocity);
456
+ }
457
+ finally {
458
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
459
+ this.host.stateCache.invalidate();
460
+ }
461
+ }
462
+ ensureTaaHistoryTexture(width, height, history) {
463
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
464
+ try {
465
+ if (!this.taaHistoryTexture) {
466
+ this.taaHistoryTexture = this.createNativeBloomDataTexture();
467
+ }
468
+ this.taaHistorySize = { width, height };
469
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.taaHistoryTexture);
470
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, history);
471
+ }
472
+ finally {
473
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
474
+ this.host.stateCache.invalidate();
475
+ }
476
+ }
477
+ drawNativeLdrStage(sourceTexture, framebuffer, width, height, program, vertexArray, tonePass, colorPass, fxaaPass, toneMappingDefaults) {
478
+ const toneOptions = { ...(toneMappingDefaults ?? {}), ...(tonePass?.options ?? {}) };
479
+ const colorOptions = colorPass?.options ?? {};
480
+ const fxaaOptions = fxaaPass?.options ?? {};
481
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
482
+ this.host.gl.viewport(0, 0, width, height);
483
+ this.host.gl.useProgram(program);
484
+ this.host.gl.bindVertexArray(vertexArray);
485
+ this.bindFullscreenTexture(0, sourceTexture);
486
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
487
+ this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_texelSize"), 1 / width, 1 / height);
488
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasToneMapping"), tonePass ? 1 : 0);
489
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_toneOperator"), toneMappingOperatorId(stringOption(toneOptions, "operator", "reinhard")));
490
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_inputColorSpace"), colorSpaceId(stringOption(toneOptions, "inputColorSpace", "linear")));
491
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_outputColorSpace"), colorSpaceId(stringOption(toneOptions, "outputColorSpace", "linear")));
492
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_exposure"), numberOption(toneOptions, "exposure", 1));
493
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_whitePoint"), Math.max(0.0001, numberOption(toneOptions, "whitePoint", 1)));
494
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_gamma"), Math.max(0.0001, numberOption(toneOptions, "gamma", 2.2)));
495
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasColorGrade"), colorPass ? 1 : 0);
496
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_contrast"), numberOption(colorOptions, "contrast", 1));
497
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_temperature"), numberOption(colorOptions, "temperature", 0));
498
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_tint"), numberOption(colorOptions, "tint", 0));
499
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_saturation"), numberOption(colorOptions, "saturation", 1));
500
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_vibrance"), numberOption(colorOptions, "vibrance", 0));
501
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_vignette"), numberOption(colorOptions, "vignette", 0));
502
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_sharpening"), numberOption(colorOptions, "sharpening", 0));
503
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasFxaa"), fxaaPass ? 1 : 0);
504
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_edgeThreshold"), numberOption(fxaaOptions, "edgeThreshold", 0.125));
505
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_subpixelBlend"), numberOption(fxaaOptions, "subpixelBlend", 0.75));
506
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
507
+ }
508
+ executeNativeBloomPasses(sourceTexture, resources, options, vertexArray, hdr) {
509
+ const brightLut = this.bloomBrightLutTexture;
510
+ const compositeLut = this.bloomCompositeLutTexture;
511
+ if (!hdr && (!brightLut || !compositeLut)) {
512
+ throw new RenderDeviceError("WebGL2 bloom lookup textures were not initialized", "WEBGL_ALLOCATION_FAILED");
513
+ }
514
+ const [textureA, textureB] = resources.textures;
515
+ const [framebufferA, framebufferB] = resources.framebuffers;
516
+ const brightProgram = this.ensureBloomBrightExtractProgram();
517
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferA);
518
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
519
+ this.host.gl.useProgram(brightProgram);
520
+ this.host.gl.bindVertexArray(vertexArray);
521
+ this.bindFullscreenTexture(0, sourceTexture);
522
+ if (brightLut)
523
+ this.bindFullscreenTexture(1, brightLut);
524
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
525
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
526
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
527
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
528
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
529
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
530
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
531
+ const blurProgram = this.ensureBloomBlurProgram();
532
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferB);
533
+ this.host.gl.useProgram(blurProgram);
534
+ this.bindFullscreenTexture(0, textureA);
535
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_source"), 0);
536
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(blurProgram, "u_size"), resources.width, resources.height);
537
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_radius"), options.radius);
538
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 1);
539
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_hdr"), hdr ? 1 : 0);
540
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
541
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferA);
542
+ this.bindFullscreenTexture(0, textureB);
543
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 0);
544
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
545
+ const compositeProgram = this.ensureBloomCompositeProgram();
546
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferB);
547
+ this.host.gl.useProgram(compositeProgram);
548
+ this.bindFullscreenTexture(0, sourceTexture);
549
+ this.bindFullscreenTexture(1, textureA);
550
+ if (compositeLut)
551
+ this.bindFullscreenTexture(2, compositeLut);
552
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_source"), 0);
553
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_blurred"), 1);
554
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_compositeLut"), 2);
555
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_hdr"), hdr ? 1 : 0);
556
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(compositeProgram, "u_intensity"), options.intensity);
557
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
558
+ return textureB;
559
+ }
560
+ executeNativeBloomPyramidPasses(sourceTexture, sourceWidth, sourceHeight, resources, fullResStaging, options, vertexArray, hdr) {
561
+ const plan = resources.plan;
562
+ const mipCount = plan.mips.length;
563
+ // Flag-on (§6.6): fixed widening kernels + spread-weighted mips; flag-off
564
+ // keeps the radius-scaled kernels and the legacy preset weights.
565
+ const v2Response = options.excess === true ? resolveBloomPyramidV2Response(plan, options.spread ?? 0.7) : undefined;
566
+ const blurRadii = v2Response ? v2Response.blurRadii : resolveBloomPyramidBlurRadii(plan, options.radius);
567
+ const downsampleProgram = this.ensureBloomDownsampleProgram();
568
+ const brightProgram = this.ensureBloomBrightExtractProgram();
569
+ const blurProgram = this.ensureBloomBlurProgram();
570
+ const accumulateProgram = this.ensureBloomAccumulateProgram();
571
+ const brightLut = this.bloomBrightLutTexture;
572
+ const mipTexture = (level, slot) => resources.textures[level * 2 + slot];
573
+ const mipFramebuffer = (level, slot) => resources.framebuffers[level * 2 + slot];
574
+ const mipSize = (level) => plan.mips[level];
575
+ // Every level settles in slot 0 after the vertical blur.
576
+ const blurredSlot = (_level) => 0;
577
+ const drawDownsample = (fromTexture, fromWidth, fromHeight, toFramebuffer, toWidth, toHeight) => {
578
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, toFramebuffer);
579
+ this.host.gl.viewport(0, 0, toWidth, toHeight);
580
+ this.host.gl.useProgram(downsampleProgram);
581
+ this.host.gl.bindVertexArray(vertexArray);
582
+ this.bindFullscreenTexture(0, fromTexture);
583
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(downsampleProgram, "u_source"), 0);
584
+ this.host.gl.uniform2f(this.host.gl.getUniformLocation(downsampleProgram, "u_texelSize"), 1 / fromWidth, 1 / fromHeight);
585
+ this.host.gl.uniform2f(this.host.gl.getUniformLocation(downsampleProgram, "u_targetSize"), toWidth, toHeight);
586
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
587
+ };
588
+ const drawBrightExtract = (fromTexture, toFramebuffer, size) => {
589
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, toFramebuffer);
590
+ this.host.gl.viewport(0, 0, size.width, size.height);
591
+ this.host.gl.useProgram(brightProgram);
592
+ this.host.gl.bindVertexArray(vertexArray);
593
+ this.bindFullscreenTexture(0, fromTexture);
594
+ if (brightLut)
595
+ this.bindFullscreenTexture(1, brightLut);
596
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
597
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
598
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
599
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
600
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
601
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
602
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
603
+ };
604
+ const drawSeparableBlur = (readTexture, tmpTexture, tmpFramebuffer, outFramebuffer, size, radius) => {
605
+ // Horizontal into the temp target, vertical back into the output target.
606
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, tmpFramebuffer);
607
+ this.host.gl.viewport(0, 0, size.width, size.height);
608
+ this.host.gl.useProgram(blurProgram);
609
+ this.host.gl.bindVertexArray(vertexArray);
610
+ this.bindFullscreenTexture(0, readTexture);
611
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_source"), 0);
612
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(blurProgram, "u_size"), size.width, size.height);
613
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_radius"), radius);
614
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 1);
615
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_hdr"), hdr ? 1 : 0);
616
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
617
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, outFramebuffer);
618
+ this.bindFullscreenTexture(0, tmpTexture);
619
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 0);
620
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
621
+ };
622
+ // Extract highlights at the source resolution before the first downsample.
623
+ // Downsampling the complete scene first averaged narrow emissive sources
624
+ // below the authored threshold, so balanced/cinematic bloom could execute
625
+ // all native passes yet remain pixel-identical to disabled output.
626
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferA);
627
+ this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
628
+ this.host.gl.useProgram(brightProgram);
629
+ this.host.gl.bindVertexArray(vertexArray);
630
+ this.bindFullscreenTexture(0, sourceTexture);
631
+ if (brightLut)
632
+ this.bindFullscreenTexture(1, brightLut);
633
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
634
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
635
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
636
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
637
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
638
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
639
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
640
+ // Level 0 downsamples the extracted highlight field, then blurs H into
641
+ // slot 1 and V back into slot 0. The result therefore settles in slot 0.
642
+ const level0 = mipSize(0);
643
+ drawDownsample(fullResStaging.textureA, sourceWidth, sourceHeight, mipFramebuffer(0, 0), level0.width, level0.height);
644
+ drawSeparableBlur(mipTexture(0, 0), mipTexture(0, 1), mipFramebuffer(0, 1), mipFramebuffer(0, 0), level0, blurRadii[0]);
645
+ for (let level = 1; level < mipCount; level += 1) {
646
+ const size = mipSize(level);
647
+ const previous = mipSize(level - 1);
648
+ drawDownsample(mipTexture(level - 1, blurredSlot(level - 1)), previous.width, previous.height, mipFramebuffer(level, 0), size.width, size.height);
649
+ // H into slot 1, V back into slot 0: blurred result settles in slot 0.
650
+ drawSeparableBlur(mipTexture(level, 0), mipTexture(level, 1), mipFramebuffer(level, 1), mipFramebuffer(level, 0), size, blurRadii[level]);
651
+ }
652
+ // Accumulate smallest-to-largest, ping-ponging between the two
653
+ // accumulators (a pass must never sample its own bound target).
654
+ const weights = v2Response ? v2Response.weights : plan.weights;
655
+ let readAccumulator = { texture: resources.accumulatorTextureA, framebuffer: resources.accumulatorFramebufferA };
656
+ let writeAccumulator = { texture: resources.accumulatorTextureB, framebuffer: resources.accumulatorFramebufferB };
657
+ // Clear both accumulators; the seed reads the cleared sibling, never the
658
+ // bound target (feedback loop).
659
+ for (const acc of [readAccumulator, writeAccumulator]) {
660
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, acc.framebuffer);
661
+ this.host.gl.viewport(0, 0, level0.width, level0.height);
662
+ this.host.gl.clearColor(0, 0, 0, 0);
663
+ this.host.gl.clear(this.host.gl.COLOR_BUFFER_BIT);
664
+ }
665
+ // Seed: smallest mip onto the cleared sibling accumulator.
666
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, writeAccumulator.framebuffer);
667
+ this.host.gl.viewport(0, 0, level0.width, level0.height);
668
+ this.host.gl.useProgram(accumulateProgram);
669
+ this.host.gl.bindVertexArray(vertexArray);
670
+ this.bindFullscreenTexture(0, readAccumulator.texture);
671
+ this.bindFullscreenTexture(1, mipTexture(mipCount - 1, blurredSlot(mipCount - 1)));
672
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
673
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
674
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), weights[mipCount - 1]);
675
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
676
+ for (let level = mipCount - 2; level >= 0; level -= 1) {
677
+ const nextRead = writeAccumulator;
678
+ const nextWrite = readAccumulator;
679
+ readAccumulator = nextRead;
680
+ writeAccumulator = nextWrite;
681
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, writeAccumulator.framebuffer);
682
+ this.host.gl.viewport(0, 0, level0.width, level0.height);
683
+ this.host.gl.useProgram(accumulateProgram);
684
+ this.host.gl.bindVertexArray(vertexArray);
685
+ this.bindFullscreenTexture(0, readAccumulator.texture);
686
+ this.bindFullscreenTexture(1, mipTexture(level, blurredSlot(level)));
687
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
688
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
689
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), weights[level]);
690
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
691
+ }
692
+ // Upsample the weighted sum onto full-resolution staging target A, using
693
+ // the cleared staging target B as the zero base (never sample A while
694
+ // rendering into it).
695
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferB);
696
+ this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
697
+ this.host.gl.clearColor(0, 0, 0, 0);
698
+ this.host.gl.clear(this.host.gl.COLOR_BUFFER_BIT);
699
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferA);
700
+ this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
701
+ this.host.gl.useProgram(accumulateProgram);
702
+ this.host.gl.bindVertexArray(vertexArray);
703
+ this.bindFullscreenTexture(0, fullResStaging.textureB);
704
+ this.bindFullscreenTexture(1, writeAccumulator.texture);
705
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
706
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
707
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), 1);
708
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
709
+ return fullResStaging.textureA;
710
+ }
711
+ executeNativeOutlinePasses(sourceTexture, resources, options, vertexArray, targetIndex) {
712
+ const blendLut = this.outlineBlendLutTexture;
713
+ if (!blendLut) {
714
+ throw new RenderDeviceError("WebGL2 outline lookup texture was not initialized", "WEBGL_ALLOCATION_FAILED");
715
+ }
716
+ const program = this.ensureOutlineProgram();
717
+ const targetTexture = resources.textures[targetIndex];
718
+ const targetFramebuffer = resources.framebuffers[targetIndex];
719
+ const bound = createOutlineGradientBound(options.threshold);
720
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, targetFramebuffer);
721
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
722
+ this.host.gl.useProgram(program);
723
+ this.host.gl.bindVertexArray(vertexArray);
724
+ this.bindFullscreenTexture(0, sourceTexture);
725
+ this.bindFullscreenTexture(1, blendLut);
726
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
727
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_blendLut"), 1);
728
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
729
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_width"), options.width);
730
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_boundHigh"), bound.highWord);
731
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_boundLow"), bound.lowWord);
732
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
733
+ return targetTexture;
734
+ }
735
+ executeNativeSsaoPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex) {
736
+ const program = this.ensureSsaoProgram();
737
+ const targetTexture = resources.textures[targetIndex];
738
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
739
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
740
+ this.host.gl.useProgram(program);
741
+ this.host.gl.bindVertexArray(vertexArray);
742
+ this.bindFullscreenTexture(0, sourceTexture);
743
+ this.bindFullscreenTexture(1, depthTexture);
744
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
745
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
746
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
747
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_radius"), options.radius);
748
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_intensity"), options.intensity);
749
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_bias"), options.bias);
750
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
751
+ return targetTexture;
752
+ }
753
+ executeNativeSsrPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex, depthRange) {
754
+ const targetTexture = resources.textures[targetIndex];
755
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
756
+ this.drawSsrKernel(sourceTexture, depthTexture, resources.width, resources.height, options, vertexArray, depthRange);
757
+ return targetTexture;
758
+ }
759
+ drawSsrKernel(sourceTexture, depthTexture, width, height, options, vertexArray, depthRange) {
760
+ const program = this.ensureSsrProgram();
761
+ this.host.gl.viewport(0, 0, width, height);
762
+ this.host.gl.useProgram(program);
763
+ this.host.gl.bindVertexArray(vertexArray);
764
+ this.bindFullscreenTexture(0, sourceTexture);
765
+ this.bindFullscreenTexture(1, depthTexture);
766
+ this.bindFullscreenTexture(2, options.normalMask ?? sourceTexture);
767
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
768
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
769
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_normalMask"), 2);
770
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasNormalMask"), options.normalMask ? 1 : 0);
771
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), width, height);
772
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_intensity"), options.intensity);
773
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_maxDistance"), options.maxDistance);
774
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_maxSteps"), options.maxSteps ?? 32);
775
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_thickness"), options.thickness ?? 0.2);
776
+ if (options.projection && options.inverseProjection) {
777
+ this.host.gl.uniformMatrix4fv(this.host.gl.getUniformLocation(program, "u_projection"), false, options.projection);
778
+ this.host.gl.uniformMatrix4fv(this.host.gl.getUniformLocation(program, "u_inverseProjection"), false, options.inverseProjection);
779
+ }
780
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthNear"), depthRange.near);
781
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthFar"), depthRange.far);
782
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
783
+ }
784
+ executeNativeDepthOfFieldPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex, depthRange) {
785
+ const program = this.ensureDepthOfFieldProgram();
786
+ const targetTexture = resources.textures[targetIndex];
787
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
788
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
789
+ this.host.gl.useProgram(program);
790
+ this.host.gl.bindVertexArray(vertexArray);
791
+ this.bindFullscreenTexture(0, sourceTexture);
792
+ this.bindFullscreenTexture(1, depthTexture);
793
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
794
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
795
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
796
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_focusDepth"), options.focusDepth);
797
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_focusRange"), options.focusRange);
798
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_maxRadius"), options.maxRadius);
799
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthNear"), depthRange.near);
800
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthFar"), depthRange.far);
801
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
802
+ return targetTexture;
803
+ }
804
+ executeNativeMotionBlurPass(sourceTexture, resources, options, vertexArray, targetIndex) {
805
+ const velocityTexture = options.temporal ? this.requireTemporalTarget(options.temporal.velocity, resources.width, resources.height).colorHandle : this.motionBlurVelocityTexture;
806
+ if (!velocityTexture) {
807
+ throw new RenderDeviceError("WebGL2 motion-blur velocity texture was not initialized", "WEBGL_ALLOCATION_FAILED");
808
+ }
809
+ const program = this.ensureMotionBlurProgram();
810
+ const targetTexture = resources.textures[targetIndex];
811
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
812
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
813
+ this.host.gl.useProgram(program);
814
+ this.host.gl.bindVertexArray(vertexArray);
815
+ this.bindFullscreenTexture(0, sourceTexture);
816
+ this.bindFullscreenTexture(1, velocityTexture);
817
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
818
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_velocity"), 1);
819
+ this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
820
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_samples"), options.samples);
821
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_scale"), options.scale);
822
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_velocityUv"), options.temporal ? 1 : 0);
823
+ if (options.temporal) {
824
+ this.host.counters.nativeTemporalPasses++;
825
+ this.host.counters.nativeTemporalBindings++;
826
+ }
827
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
828
+ return targetTexture;
829
+ }
830
+ executeNativeTaaPass(sourceTexture, resources, options, vertexArray, targetIndex) {
831
+ const temporal = options.temporal;
832
+ const historyTarget = temporal ? this.requireTemporalTarget(temporal.history, resources.width, resources.height) : undefined;
833
+ const historyTexture = historyTarget?.colorHandle ?? this.taaHistoryTexture;
834
+ if (!historyTexture) {
835
+ throw new RenderDeviceError("WebGL2 TAA history texture was not initialized", "WEBGL_ALLOCATION_FAILED");
836
+ }
837
+ const accumulationProgram = this.ensureTaaProgram();
838
+ const targetTexture = resources.textures[targetIndex];
839
+ this.host.gl.viewport(0, 0, resources.width, resources.height);
840
+ this.host.gl.useProgram(accumulationProgram);
841
+ this.host.gl.bindVertexArray(vertexArray);
842
+ this.bindFullscreenTexture(0, sourceTexture);
843
+ this.bindFullscreenTexture(1, historyTexture);
844
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_source"), 0);
845
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_history"), 1);
846
+ this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulationProgram, "u_blend"), temporal && !temporal.historyValid ? 0 : temporalAccumulationWeight(options.blend, temporal?.historyFrames));
847
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_temporal"), temporal ? 1 : 0);
848
+ if (temporal) {
849
+ const velocity = this.requireTemporalTarget(temporal.velocity, resources.width, resources.height);
850
+ const destination = this.requireTemporalTarget(temporal.historyOutput, resources.width, resources.height);
851
+ if (destination === historyTarget || destination === velocity || historyTarget === velocity)
852
+ throw new RenderDeviceError("Temporal targets must not alias", "TEMPORAL_TARGET_ALIAS");
853
+ this.bindFullscreenTexture(2, velocity.colorHandle);
854
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_velocity"), 2);
855
+ // Resolve exactly once into the next history target. Presentation reads
856
+ // this immutable result through a separate program, so display tuning
857
+ // cannot alter the accumulated history shader or its stored bytes.
858
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, destination.framebuffer);
859
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
860
+ const presentationProgram = this.ensureTaaPresentationProgram();
861
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
862
+ this.host.gl.useProgram(presentationProgram);
863
+ this.bindFullscreenTexture(0, sourceTexture);
864
+ this.bindFullscreenTexture(1, destination.colorHandle);
865
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(presentationProgram, "u_source"), 0);
866
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(presentationProgram, "u_accumulated"), 1);
867
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
868
+ this.host.counters.nativeTemporalPasses++;
869
+ this.host.counters.nativeTemporalBindings += 3;
870
+ }
871
+ else {
872
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
873
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
874
+ }
875
+ return targetTexture;
876
+ }
877
+ requireTemporalTarget(target, width, height) {
878
+ if (!(target instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(target) || target.disposed || target.width !== width || target.height !== height || target.colorTexture.format !== "rgba16f")
879
+ throw new RenderDeviceError("Temporal input must be a live same-device same-size RGBA16F target", "TEMPORAL_TARGET_INVALID");
880
+ return target;
881
+ }
882
+ bindFullscreenTexture(unit, texture) {
883
+ this.host.gl.activeTexture(this.host.gl.TEXTURE0 + unit);
884
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
885
+ this.host.gl.bindSampler(unit, null);
886
+ }
887
+ disposeBloomPingPongResources() {
888
+ if (!this.bloomPingPongResources)
889
+ return;
890
+ for (const texture of this.bloomPingPongResources.textures)
891
+ this.host.gl.deleteTexture(texture);
892
+ for (const framebuffer of this.bloomPingPongResources.framebuffers)
893
+ this.host.gl.deleteFramebuffer(framebuffer);
894
+ this.bloomPingPongResources = null;
895
+ }
896
+ getBloomDiagnostics() {
897
+ return this.lastBloomDiagnostics;
898
+ }
899
+ recordBloomDiagnostics(options, sourceWidth, sourceHeight, hdr, mipCount) {
900
+ const plan = resolveBloomPyramidPlan(sourceWidth, sourceHeight, options.quality, hdr);
901
+ const pingPongBytes = sourceWidth * sourceHeight * 4 * (hdr ? 2 : 1) * 2;
902
+ const bytesPerChannel = plan.halfFloat ? 2 : 1;
903
+ const level0 = plan.mips[0];
904
+ const accumulatorBytes = level0.width * level0.height * 4 * bytesPerChannel;
905
+ this.lastBloomDiagnostics = {
906
+ quality: options.quality,
907
+ mipCount,
908
+ targetCount: options.quality === "performance" ? 2 : plan.mips.length * 2 + 1,
909
+ targetBytes: (options.quality === "performance" ? pingPongBytes : plan.targetBytes + accumulatorBytes + pingPongBytes),
910
+ compositeGain: options.intensity * nativeBloomResponseGain(plan, options),
911
+ threshold: options.threshold,
912
+ intensity: options.intensity,
913
+ softKnee: options.softKnee,
914
+ shoulder: options.shoulder,
915
+ halfFloat: hdr || plan.halfFloat,
916
+ };
917
+ }
918
+ describeGpuTargetInventory(liveRenderTargets) {
919
+ const entries = liveRenderTargets.map((target) => ({
920
+ label: target.label,
921
+ kind: "render-target",
922
+ bytes: target.colorTexture.byteLength + (target.depthTexture?.byteLength ?? 0),
923
+ owner: resolveGpuTargetOwner(target.label)
924
+ }));
925
+ const pyramid = this.bloomPyramidResources;
926
+ if (pyramid) {
927
+ const bytesPerPixel = pyramid.hdr ? 8 : 4;
928
+ pyramid.plan.mips.forEach((mip, index) => {
929
+ for (const side of ["a", "b"]) {
930
+ entries.push({
931
+ label: `bloom-pyramid-mip${index}${side}`,
932
+ kind: "pyramid-mip",
933
+ bytes: mip.width * mip.height * bytesPerPixel,
934
+ owner: "a1-bloom"
935
+ });
936
+ }
937
+ });
938
+ const level0 = pyramid.plan.mips[0];
939
+ if (level0) {
940
+ for (const side of ["a", "b"]) {
941
+ entries.push({
942
+ label: `bloom-pyramid-accumulator-${side}`,
943
+ kind: "pyramid-accumulator",
944
+ bytes: level0.width * level0.height * bytesPerPixel,
945
+ owner: "a1-bloom"
946
+ });
947
+ }
948
+ }
949
+ }
950
+ const pingPong = this.bloomPingPongResources;
951
+ if (pingPong) {
952
+ const bytesPerPixel = pingPong.hdr ? 8 : 4;
953
+ for (const side of ["a", "b"]) {
954
+ entries.push({
955
+ label: `bloom-ping-pong-${side}`,
956
+ kind: "ping-pong",
957
+ bytes: pingPong.width * pingPong.height * bytesPerPixel,
958
+ owner: "a1-bloom"
959
+ });
960
+ }
961
+ }
962
+ if (this.bloomBrightLutTexture) {
963
+ entries.push({
964
+ label: "bloom-bright-lut",
965
+ kind: "lut",
966
+ bytes: BLOOM_BRIGHT_LUT_WIDTH * BLOOM_BRIGHT_LUT_HEIGHT * 4,
967
+ owner: "a1-bloom"
968
+ });
969
+ }
970
+ if (this.bloomCompositeLutTexture) {
971
+ entries.push({
972
+ label: "bloom-composite-lut",
973
+ kind: "lut",
974
+ bytes: BLOOM_COMPOSITE_LUT_SIZE * BLOOM_COMPOSITE_LUT_SIZE * 4,
975
+ owner: "a1-bloom"
976
+ });
977
+ }
978
+ if (this.outlineBlendLutTexture) {
979
+ entries.push({ label: "outline-blend-lut", kind: "lut", bytes: OUTLINE_BLEND_LUT_WIDTH * 4, owner: "post" });
980
+ }
981
+ if (this.motionBlurVelocityTexture && this.motionBlurVelocitySize) {
982
+ entries.push({
983
+ label: "motion-blur-velocity",
984
+ kind: "history",
985
+ bytes: this.motionBlurVelocitySize.width * this.motionBlurVelocitySize.height * 8,
986
+ owner: "post"
987
+ });
988
+ }
989
+ if (this.taaHistoryTexture && this.taaHistorySize) {
990
+ entries.push({
991
+ label: "taa-history",
992
+ kind: "history",
993
+ bytes: this.taaHistorySize.width * this.taaHistorySize.height * 4,
994
+ owner: "post"
995
+ });
996
+ }
997
+ return entries;
998
+ }
999
+ disposeBloomPyramidResources() {
1000
+ if (!this.bloomPyramidResources)
1001
+ return;
1002
+ for (const texture of this.bloomPyramidResources.textures)
1003
+ this.host.gl.deleteTexture(texture);
1004
+ for (const framebuffer of this.bloomPyramidResources.framebuffers)
1005
+ this.host.gl.deleteFramebuffer(framebuffer);
1006
+ this.host.gl.deleteTexture(this.bloomPyramidResources.accumulatorTextureA);
1007
+ this.host.gl.deleteFramebuffer(this.bloomPyramidResources.accumulatorFramebufferA);
1008
+ this.host.gl.deleteTexture(this.bloomPyramidResources.accumulatorTextureB);
1009
+ this.host.gl.deleteFramebuffer(this.bloomPyramidResources.accumulatorFramebufferB);
1010
+ this.bloomPyramidResources = null;
1011
+ }
1012
+ ensureBloomPyramidResources(plan, hdr) {
1013
+ const current = this.bloomPyramidResources;
1014
+ if (current && current.plan.quality === plan.quality && current.hdr === (hdr || plan.halfFloat) &&
1015
+ current.plan.mips.length === plan.mips.length &&
1016
+ current.plan.mips.every((mip, index) => mip.width === plan.mips[index].width && mip.height === plan.mips[index].height)) {
1017
+ return current;
1018
+ }
1019
+ this.disposeBloomPyramidResources();
1020
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
1021
+ const previousFramebuffer = this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING);
1022
+ const textures = [];
1023
+ const framebuffers = [];
1024
+ const useHalfFloat = hdr || plan.halfFloat;
1025
+ const allocateTarget = (width, height, label) => {
1026
+ const texture = this.host.gl.createTexture();
1027
+ const framebuffer = this.host.gl.createFramebuffer();
1028
+ if (!texture || !framebuffer) {
1029
+ if (texture)
1030
+ this.host.gl.deleteTexture(texture);
1031
+ if (framebuffer)
1032
+ this.host.gl.deleteFramebuffer(framebuffer);
1033
+ throw new RenderDeviceError(`Failed to allocate WebGL2 bloom pyramid ${label}`, "WEBGL_ALLOCATION_FAILED", { width, height });
1034
+ }
1035
+ textures.push(texture);
1036
+ framebuffers.push(framebuffer);
1037
+ this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
1038
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.LINEAR);
1039
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.LINEAR);
1040
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
1041
+ this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
1042
+ this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, useHalfFloat ? this.host.gl.RGBA16F : this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, useHalfFloat ? this.host.gl.HALF_FLOAT : this.host.gl.UNSIGNED_BYTE, null);
1043
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
1044
+ this.host.gl.framebufferTexture2D(this.host.gl.FRAMEBUFFER, this.host.gl.COLOR_ATTACHMENT0, this.host.gl.TEXTURE_2D, texture, 0);
1045
+ const status = this.host.gl.checkFramebufferStatus(this.host.gl.FRAMEBUFFER);
1046
+ if (status !== this.host.gl.FRAMEBUFFER_COMPLETE) {
1047
+ throw new RenderDeviceError("WebGL2 bloom pyramid framebuffer status is invalid", "FRAMEBUFFER_INVALID", { width, height, status });
1048
+ }
1049
+ return { texture, framebuffer };
1050
+ };
1051
+ try {
1052
+ // Two ping-pong targets per mip (separable blur needs distinct read/write
1053
+ // targets at the same size), plus two level-0-sized accumulators: the
1054
+ // weighted sum ping-pongs between them so no pass ever samples the
1055
+ // texture of its own bound framebuffer (feedback loop).
1056
+ for (const mip of plan.mips) {
1057
+ allocateTarget(mip.width, mip.height, "mip");
1058
+ allocateTarget(mip.width, mip.height, "mip");
1059
+ }
1060
+ const level0 = plan.mips[0];
1061
+ const accumulatorA = allocateTarget(level0.width, level0.height, "accumulator-a");
1062
+ const accumulatorB = allocateTarget(level0.width, level0.height, "accumulator-b");
1063
+ const finalResources = {
1064
+ plan,
1065
+ hdr: useHalfFloat,
1066
+ textures,
1067
+ framebuffers,
1068
+ accumulatorTextureA: accumulatorA.texture,
1069
+ accumulatorFramebufferA: accumulatorA.framebuffer,
1070
+ accumulatorTextureB: accumulatorB.texture,
1071
+ accumulatorFramebufferB: accumulatorB.framebuffer
1072
+ };
1073
+ this.bloomPyramidResources = finalResources;
1074
+ return finalResources;
1075
+ }
1076
+ catch (error) {
1077
+ for (const texture of textures)
1078
+ this.host.gl.deleteTexture(texture);
1079
+ for (const framebuffer of framebuffers)
1080
+ this.host.gl.deleteFramebuffer(framebuffer);
1081
+ throw error;
1082
+ }
1083
+ finally {
1084
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, previousFramebuffer);
1085
+ this.host.lifecycle.restoreTextureUnit0(textureUnit0);
1086
+ this.host.stateCache.invalidate();
1087
+ }
1088
+ }
1089
+ prepareFullscreenPresentation(framebuffer, outputWidth, outputHeight) {
1090
+ const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
1091
+ const textureUnit1 = this.host.lifecycle.captureTextureUnitBinding(1);
1092
+ const textureUnit2 = this.host.lifecycle.captureTextureUnitBinding(2);
1093
+ this.host.gl.activeTexture(textureUnit0.activeTexture);
1094
+ const snapshot = {
1095
+ framebuffer: this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING),
1096
+ program: this.host.gl.getParameter(this.host.gl.CURRENT_PROGRAM),
1097
+ textureUnit0,
1098
+ textureUnit1,
1099
+ textureUnit2,
1100
+ vertexArray: this.host.gl.getParameter(this.host.gl.VERTEX_ARRAY_BINDING),
1101
+ viewport: this.host.gl.getParameter(this.host.gl.VIEWPORT),
1102
+ colorMask: this.host.gl.getParameter(this.host.gl.COLOR_WRITEMASK),
1103
+ depthTestEnabled: this.host.gl.isEnabled(this.host.gl.DEPTH_TEST),
1104
+ cullFaceEnabled: this.host.gl.isEnabled(this.host.gl.CULL_FACE),
1105
+ blendEnabled: this.host.gl.isEnabled(this.host.gl.BLEND),
1106
+ scissorTestEnabled: this.host.gl.isEnabled(this.host.gl.SCISSOR_TEST),
1107
+ stencilTestEnabled: this.host.gl.isEnabled(this.host.gl.STENCIL_TEST),
1108
+ polygonOffsetFillEnabled: this.host.gl.isEnabled(this.host.gl.POLYGON_OFFSET_FILL),
1109
+ depthMask: this.host.gl.getParameter(this.host.gl.DEPTH_WRITEMASK)
1110
+ };
1111
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
1112
+ this.host.gl.viewport(0, 0, outputWidth, outputHeight);
1113
+ this.host.gl.colorMask(true, true, true, true);
1114
+ this.host.gl.disable(this.host.gl.SCISSOR_TEST);
1115
+ this.host.gl.disable(this.host.gl.STENCIL_TEST);
1116
+ this.host.gl.disable(this.host.gl.POLYGON_OFFSET_FILL);
1117
+ this.host.gl.disable(this.host.gl.DEPTH_TEST);
1118
+ this.host.gl.disable(this.host.gl.CULL_FACE);
1119
+ this.host.gl.disable(this.host.gl.BLEND);
1120
+ this.host.gl.depthMask(false);
1121
+ return snapshot;
1122
+ }
1123
+ restoreFullscreenPresentationState(snapshot, fallbackWidth, fallbackHeight) {
1124
+ this.host.gl.bindVertexArray(snapshot.vertexArray);
1125
+ this.host.lifecycle.restoreTextureUnitBinding(2, snapshot.textureUnit2);
1126
+ this.host.lifecycle.restoreTextureUnitBinding(1, snapshot.textureUnit1);
1127
+ this.host.lifecycle.restoreTextureUnit0(snapshot.textureUnit0);
1128
+ this.host.gl.useProgram(snapshot.program);
1129
+ if (snapshot.depthTestEnabled)
1130
+ this.host.gl.enable(this.host.gl.DEPTH_TEST);
1131
+ else
1132
+ this.host.gl.disable(this.host.gl.DEPTH_TEST);
1133
+ if (snapshot.cullFaceEnabled)
1134
+ this.host.gl.enable(this.host.gl.CULL_FACE);
1135
+ else
1136
+ this.host.gl.disable(this.host.gl.CULL_FACE);
1137
+ if (snapshot.blendEnabled)
1138
+ this.host.gl.enable(this.host.gl.BLEND);
1139
+ else
1140
+ this.host.gl.disable(this.host.gl.BLEND);
1141
+ if (snapshot.scissorTestEnabled)
1142
+ this.host.gl.enable(this.host.gl.SCISSOR_TEST);
1143
+ else
1144
+ this.host.gl.disable(this.host.gl.SCISSOR_TEST);
1145
+ if (snapshot.stencilTestEnabled)
1146
+ this.host.gl.enable(this.host.gl.STENCIL_TEST);
1147
+ else
1148
+ this.host.gl.disable(this.host.gl.STENCIL_TEST);
1149
+ if (snapshot.polygonOffsetFillEnabled)
1150
+ this.host.gl.enable(this.host.gl.POLYGON_OFFSET_FILL);
1151
+ else
1152
+ this.host.gl.disable(this.host.gl.POLYGON_OFFSET_FILL);
1153
+ const colorMask = snapshot.colorMask ?? [true, true, true, true];
1154
+ this.host.gl.colorMask(colorMask[0] ?? true, colorMask[1] ?? true, colorMask[2] ?? true, colorMask[3] ?? true);
1155
+ this.host.gl.depthMask(snapshot.depthMask);
1156
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, snapshot.framebuffer);
1157
+ const viewport = snapshot.viewport ?? [0, 0, fallbackWidth, fallbackHeight];
1158
+ this.host.gl.viewport(viewport[0] ?? 0, viewport[1] ?? 0, viewport[2] ?? fallbackWidth, viewport[3] ?? fallbackHeight);
1159
+ this.host.stateCache.invalidate();
1160
+ }
1161
+ ensurePresentationVertexArray() {
1162
+ if (this.presentationVertexArray)
1163
+ return this.presentationVertexArray;
1164
+ const vertexArray = this.host.gl.createVertexArray();
1165
+ if (!vertexArray) {
1166
+ throw new RenderDeviceError("Failed to allocate WebGL presentation vertex array", "WEBGL_ALLOCATION_FAILED");
1167
+ }
1168
+ this.presentationVertexArray = vertexArray;
1169
+ return vertexArray;
1170
+ }
1171
+ ensurePresentationProgram() {
1172
+ if (this.presentationProgram) {
1173
+ return this.presentationProgram;
1174
+ }
1175
+ const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
1176
+ precision highp float;
1177
+ out vec2 v_uv;
1178
+ void main() {
1179
+ vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
1180
+ v_uv = position;
1181
+ gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
1182
+ }
1183
+ `, "webgl2-present-render-target");
1184
+ const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, `#version 300 es
1185
+ precision highp float;
1186
+ uniform sampler2D u_source;
1187
+ in vec2 v_uv;
1188
+ out vec4 outColor;
1189
+ void main() {
1190
+ outColor = texture(u_source, v_uv);
1191
+ }
1192
+ `, "webgl2-present-render-target");
1193
+ const program = this.host.gl.createProgram();
1194
+ if (!program) {
1195
+ this.host.gl.deleteShader(vertex);
1196
+ this.host.gl.deleteShader(fragment);
1197
+ throw new RenderDeviceError("Failed to allocate WebGL presentation shader", "WEBGL_ALLOCATION_FAILED");
1198
+ }
1199
+ this.host.gl.attachShader(program, vertex);
1200
+ this.host.gl.attachShader(program, fragment);
1201
+ this.host.gl.linkProgram(program);
1202
+ this.host.counters.programCompiles += 1;
1203
+ this.host.gl.deleteShader(vertex);
1204
+ this.host.gl.deleteShader(fragment);
1205
+ if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
1206
+ const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown presentation shader link error";
1207
+ this.host.gl.deleteProgram(program);
1208
+ throw new RenderDeviceError("WebGL presentation shader link failed", "SHADER_LINK_FAILED", { log });
1209
+ }
1210
+ this.presentationProgram = program;
1211
+ return program;
1212
+ }
1213
+ ensureBloomBrightExtractProgram() {
1214
+ if (this.bloomBrightExtractProgram) {
1215
+ return this.bloomBrightExtractProgram;
1216
+ }
1217
+ this.bloomBrightExtractProgram = this.createFullscreenProgram(BLOOM_BRIGHT_EXTRACT_GLSL, "webgl2-bloom-bright-extract");
1218
+ return this.bloomBrightExtractProgram;
1219
+ }
1220
+ ensureBloomBlurProgram() {
1221
+ if (this.bloomBlurProgram) {
1222
+ return this.bloomBlurProgram;
1223
+ }
1224
+ this.bloomBlurProgram = this.createFullscreenProgram(`#version 300 es
1225
+ precision highp float;
1226
+ precision highp int;
1227
+ uniform sampler2D u_source;
1228
+ uniform ivec2 u_size;
1229
+ uniform int u_radius;
1230
+ uniform int u_horizontal;
1231
+ uniform int u_hdr;
1232
+ out vec4 outColor;
1233
+
1234
+ vec4 sourcePixel(ivec2 coordinate) {
1235
+ return texelFetch(u_source, clamp(coordinate, ivec2(0), u_size - ivec2(1)), 0);
1236
+ }
1237
+
1238
+ void main() {
1239
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1240
+ float sigma = max(float(u_radius) / 3.0, 0.5);
1241
+ float coefficient = 0.39894 / sigma;
1242
+ vec4 sum = sourcePixel(pixel) * coefficient;
1243
+ float weightSum = coefficient;
1244
+ // 24 covers the flag-on §6.6 kernels (≤ 22); flag-off radii stay ≤ 16.
1245
+ for (int offset = 1; offset <= 24; offset += 1) {
1246
+ if (offset > u_radius) continue;
1247
+ float distance = float(offset);
1248
+ float weight = coefficient * exp(-0.5 * distance * distance / (sigma * sigma));
1249
+ ivec2 delta = u_horizontal == 1 ? ivec2(offset, 0) : ivec2(0, offset);
1250
+ sum += (sourcePixel(pixel + delta) + sourcePixel(pixel - delta)) * weight;
1251
+ weightSum += 2.0 * weight;
1252
+ }
1253
+ outColor = sum / max(weightSum, 0.000001);
1254
+ }
1255
+ `, "webgl2-bloom-blur");
1256
+ return this.bloomBlurProgram;
1257
+ }
1258
+ ensureBloomCompositeProgram() {
1259
+ if (this.bloomCompositeProgram) {
1260
+ return this.bloomCompositeProgram;
1261
+ }
1262
+ this.bloomCompositeProgram = this.createFullscreenProgram(`#version 300 es
1263
+ precision highp float;
1264
+ precision highp int;
1265
+ uniform sampler2D u_source;
1266
+ uniform sampler2D u_blurred;
1267
+ uniform sampler2D u_compositeLut;
1268
+ uniform int u_hdr;
1269
+ uniform float u_intensity;
1270
+ out vec4 outColor;
1271
+
1272
+ uvec4 byteTexel(sampler2D source, ivec2 coordinate) {
1273
+ return uvec4(texelFetch(source, coordinate, 0) * 255.0 + 0.5);
1274
+ }
1275
+
1276
+ float compositeChannel(uint source, uint blurred) {
1277
+ return texelFetch(u_compositeLut, ivec2(int(source), int(blurred)), 0).r;
1278
+ }
1279
+
1280
+ void main() {
1281
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1282
+ if (u_hdr == 1) {
1283
+ vec4 source = texelFetch(u_source, pixel, 0);
1284
+ vec3 blurred = texelFetch(u_blurred, pixel, 0).rgb;
1285
+ outColor = vec4(source.rgb + blurred * u_intensity, source.a);
1286
+ return;
1287
+ }
1288
+ uvec4 source = byteTexel(u_source, pixel);
1289
+ uvec4 blurred = byteTexel(u_blurred, pixel);
1290
+ outColor = vec4(
1291
+ compositeChannel(source.r, blurred.r),
1292
+ compositeChannel(source.g, blurred.g),
1293
+ compositeChannel(source.b, blurred.b),
1294
+ float(source.a) / 255.0
1295
+ );
1296
+ }
1297
+ `, "webgl2-bloom-composite");
1298
+ return this.bloomCompositeProgram;
1299
+ }
1300
+ ensureBloomDownsampleProgram() {
1301
+ if (this.bloomDownsampleProgram)
1302
+ return this.bloomDownsampleProgram;
1303
+ this.bloomDownsampleProgram = this.createFullscreenProgram(`#version 300 es
1304
+ precision highp float;
1305
+ uniform sampler2D u_source;
1306
+ uniform vec2 u_texelSize;
1307
+ uniform vec2 u_targetSize;
1308
+ out vec4 outColor;
1309
+ void main() {
1310
+ // gl_FragCoord is expressed in destination pixels. Normalize by the
1311
+ // destination size so every downsample covers the complete source image;
1312
+ // multiplying by source texel size cropped a half-size target to the
1313
+ // lower-left quarter of the preceding level.
1314
+ vec2 uv = gl_FragCoord.xy / u_targetSize;
1315
+ vec2 e = u_texelSize * 0.5;
1316
+ vec4 sum = texture(u_source, uv - e) + texture(u_source, uv + vec2(e.x, -e.y))
1317
+ + texture(u_source, uv + vec2(-e.x, e.y)) + texture(u_source, uv + e);
1318
+ outColor = sum * 0.25;
1319
+ }
1320
+ `, "webgl2-bloom-downsample");
1321
+ return this.bloomDownsampleProgram;
1322
+ }
1323
+ ensureBloomAccumulateProgram() {
1324
+ if (this.bloomAccumulateProgram)
1325
+ return this.bloomAccumulateProgram;
1326
+ this.bloomAccumulateProgram = this.createFullscreenProgram(`#version 300 es
1327
+ precision highp float;
1328
+ uniform sampler2D u_base;
1329
+ uniform sampler2D u_bloom;
1330
+ uniform float u_weight;
1331
+ out vec4 outColor;
1332
+ void main() {
1333
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1334
+ vec4 base = texelFetch(u_base, pixel, 0);
1335
+ vec2 uv = (vec2(pixel) + 0.5) / vec2(textureSize(u_base, 0));
1336
+ vec3 bloom = texture(u_bloom, uv).rgb;
1337
+ outColor = vec4(base.rgb + bloom * u_weight, base.a);
1338
+ }
1339
+ `, "webgl2-bloom-accumulate");
1340
+ return this.bloomAccumulateProgram;
1341
+ }
1342
+ ensureOutlineProgram() {
1343
+ if (this.outlineProgram)
1344
+ return this.outlineProgram;
1345
+ this.outlineProgram = this.createFullscreenProgram(`#version 300 es
1346
+ precision highp float;
1347
+ precision highp int;
1348
+ uniform sampler2D u_source;
1349
+ uniform sampler2D u_blendLut;
1350
+ uniform ivec2 u_size;
1351
+ uniform int u_width;
1352
+ uniform float u_boundHigh;
1353
+ uniform float u_boundLow;
1354
+ out vec4 outColor;
1355
+
1356
+ uvec4 sourceByte(ivec2 coordinate) {
1357
+ ivec2 bounded = clamp(coordinate, ivec2(0), u_size - ivec2(1));
1358
+ return uvec4(texelFetch(u_source, bounded, 0) * 255.0 + 0.5);
1359
+ }
1360
+
1361
+ uint lumaNumerator(ivec2 coordinate) {
1362
+ uvec3 source = sourceByte(coordinate).rgb;
1363
+ return 2126u * source.r + 7152u * source.g + 722u * source.b;
1364
+ }
1365
+
1366
+ uvec2 squareWords(int signedValue) {
1367
+ uint value = uint(abs(signedValue));
1368
+ uint high = value >> 12u;
1369
+ uint low = value & 4095u;
1370
+ uint middle = 2u * high * low;
1371
+ uint lowWord = low * low + (middle & 4095u) * 4096u;
1372
+ uint highWord = high * high + (middle >> 12u);
1373
+ highWord += lowWord / ${OUTLINE_LIMB_RADIX}u;
1374
+ lowWord %= ${OUTLINE_LIMB_RADIX}u;
1375
+ return uvec2(highWord, lowWord);
1376
+ }
1377
+
1378
+ bool edgeAt(ivec2 pixel) {
1379
+ int nw = int(lumaNumerator(pixel + ivec2(-1, -1)));
1380
+ int n = int(lumaNumerator(pixel + ivec2(0, -1)));
1381
+ int ne = int(lumaNumerator(pixel + ivec2(1, -1)));
1382
+ int w = int(lumaNumerator(pixel + ivec2(-1, 0)));
1383
+ int e = int(lumaNumerator(pixel + ivec2(1, 0)));
1384
+ int sw = int(lumaNumerator(pixel + ivec2(-1, 1)));
1385
+ int s = int(lumaNumerator(pixel + ivec2(0, 1)));
1386
+ int se = int(lumaNumerator(pixel + ivec2(1, 1)));
1387
+ int gx = -nw - 2 * w - sw + ne + 2 * e + se;
1388
+ int gy = -nw - 2 * n - ne + sw + 2 * s + se;
1389
+ uvec2 x = squareWords(gx);
1390
+ uvec2 y = squareWords(gy);
1391
+ uint low = x.y + y.y;
1392
+ uint high = x.x + y.x;
1393
+ if (low >= ${OUTLINE_LIMB_RADIX}u) {
1394
+ low -= ${OUTLINE_LIMB_RADIX}u;
1395
+ high += 1u;
1396
+ }
1397
+ uint boundHigh = uint(u_boundHigh);
1398
+ uint boundLow = uint(u_boundLow);
1399
+ return high != boundHigh ? high > boundHigh : low >= boundLow;
1400
+ }
1401
+
1402
+ void main() {
1403
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1404
+ bool outlined = false;
1405
+ for (int offsetY = -6; offsetY <= 6 && !outlined; offsetY += 1) {
1406
+ for (int offsetX = -6; offsetX <= 6; offsetX += 1) {
1407
+ if (abs(offsetX) > u_width || abs(offsetY) > u_width) continue;
1408
+ if (offsetX * offsetX + offsetY * offsetY > u_width * u_width) continue;
1409
+ ivec2 candidate = clamp(pixel + ivec2(offsetX, offsetY), ivec2(0), u_size - ivec2(1));
1410
+ if (edgeAt(candidate)) {
1411
+ outlined = true;
1412
+ break;
1413
+ }
1414
+ }
1415
+ }
1416
+ uvec4 source = sourceByte(pixel);
1417
+ if (!outlined) {
1418
+ outColor = vec4(source) / 255.0;
1419
+ return;
1420
+ }
1421
+ outColor = vec4(
1422
+ texelFetch(u_blendLut, ivec2(int(source.r), 0), 0).r,
1423
+ texelFetch(u_blendLut, ivec2(int(source.g), 0), 0).g,
1424
+ texelFetch(u_blendLut, ivec2(int(source.b), 0), 0).b,
1425
+ float(source.a) / 255.0
1426
+ );
1427
+ }
1428
+ `, "webgl2-outline");
1429
+ return this.outlineProgram;
1430
+ }
1431
+ ensureSsaoProgram() {
1432
+ if (this.ssaoProgram)
1433
+ return this.ssaoProgram;
1434
+ this.ssaoProgram = this.createFullscreenProgram(`#version 300 es
1435
+ precision highp float;
1436
+ precision highp int;
1437
+ uniform sampler2D u_source;
1438
+ uniform sampler2D u_depth;
1439
+ uniform ivec2 u_size;
1440
+ uniform int u_radius;
1441
+ uniform float u_intensity;
1442
+ uniform float u_bias;
1443
+ out vec4 outColor;
1444
+
1445
+ float depthAt(ivec2 coordinate) {
1446
+ return texelFetch(u_depth, clamp(coordinate, ivec2(0), u_size - ivec2(1)), 0).r;
1447
+ }
1448
+
1449
+ void main() {
1450
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1451
+ float centerDepth = depthAt(pixel);
1452
+ float occlusion = 0.0;
1453
+ float samples = 0.0;
1454
+ for (int stepY = -1; stepY <= 1; stepY += 1) {
1455
+ for (int stepX = -1; stepX <= 1; stepX += 1) {
1456
+ if (stepX == 0 && stepY == 0) continue;
1457
+ float sampleDepth = depthAt(pixel + ivec2(stepX * u_radius, stepY * u_radius));
1458
+ occlusion += clamp(
1459
+ (centerDepth - sampleDepth - u_bias) / (0.14 + float(u_radius) * 0.04),
1460
+ 0.0,
1461
+ 1.0
1462
+ );
1463
+ samples += 1.0;
1464
+ }
1465
+ }
1466
+ float factor = max(0.18, 1.0 - (occlusion / max(1.0, samples)) * u_intensity * 0.72);
1467
+ vec4 source = texelFetch(u_source, pixel, 0);
1468
+ outColor = vec4(source.rgb * factor, source.a);
1469
+ }
1470
+ `, "webgl2-ssao");
1471
+ return this.ssaoProgram;
1472
+ }
1473
+ ensureSsrProgram() {
1474
+ if (this.ssrProgram)
1475
+ return this.ssrProgram;
1476
+ this.ssrProgram = this.createFullscreenProgram(`#version 300 es
1477
+ precision highp float;
1478
+ precision highp int;
1479
+ uniform sampler2D u_source;
1480
+ uniform sampler2D u_depth;
1481
+ uniform sampler2D u_normalMask;
1482
+ uniform ivec2 u_size;
1483
+ uniform float u_intensity;
1484
+ uniform float u_maxDistance;
1485
+ uniform int u_maxSteps;
1486
+ uniform float u_thickness;
1487
+ uniform int u_hasNormalMask;
1488
+ uniform mat4 u_projection;
1489
+ uniform mat4 u_inverseProjection;
1490
+ out vec4 outColor;
1491
+ vec3 positionAtDepth(vec2 uv, float depth) {
1492
+ vec4 p = u_inverseProjection * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
1493
+ return p.xyz / p.w;
1494
+ }
1495
+ vec3 positionAt(vec2 uv) {
1496
+ return positionAtDepth(uv, texture(u_depth, uv).r);
1497
+ }
1498
+ vec3 viewDirection(vec2 uv) {
1499
+ return normalize(positionAtDepth(uv, 0.999) - positionAtDepth(uv, 0.0));
1500
+ }
1501
+ vec2 projectPosition(vec3 p) {
1502
+ vec4 clip = u_projection * vec4(p, 1.0);
1503
+ return clip.xy / clip.w * 0.5 + 0.5;
1504
+ }
1505
+ float depthDifference(vec3 p, vec2 uv) {
1506
+ return dot(p - positionAt(uv), viewDirection(uv));
1507
+ }
1508
+ void main() {
1509
+ vec2 uv = gl_FragCoord.xy / vec2(u_size);
1510
+ vec4 base = texture(u_source, uv);
1511
+ outColor = base;
1512
+ vec3 origin = positionAt(uv);
1513
+ vec4 normalMask = texture(u_normalMask, uv);
1514
+ vec3 normal = u_hasNormalMask == 1 ? normalize(normalMask.xyz * 2.0 - 1.0) : normalize(cross(dFdx(origin), dFdy(origin)));
1515
+ float roughness = u_hasNormalMask == 1 ? normalMask.a : 0.25;
1516
+ if (texture(u_depth, uv).r >= 0.999999 || (u_hasNormalMask == 1 && normalMask.a == 0.0) || roughness >= 1.0) return;
1517
+ vec3 ray = normalize(reflect(viewDirection(uv), normal));
1518
+ float stepSize = u_maxDistance / float(u_maxSteps);
1519
+ vec3 start = origin + normal * u_thickness;
1520
+ float previous = 0.0;
1521
+ for (int i = 1; i <= 64; ++i) {
1522
+ if (i > u_maxSteps) break;
1523
+ float distanceAlong = float(i) * stepSize;
1524
+ vec3 candidate = start + ray * distanceAlong;
1525
+ vec4 candidateClip = u_projection * vec4(candidate, 1.0);
1526
+ if (candidateClip.w <= 0.0 || abs(candidateClip.z) >= candidateClip.w) break;
1527
+ vec2 hitUV = projectPosition(candidate);
1528
+ if (any(lessThanEqual(hitUV, vec2(0.0))) || any(greaterThanEqual(hitUV, vec2(1.0)))) break;
1529
+ float difference = depthDifference(candidate, hitUV);
1530
+ if (difference >= 0.0 && previous < 0.0) {
1531
+ float lo = distanceAlong - stepSize, hi = distanceAlong;
1532
+ for (int j = 0; j < 5; ++j) {
1533
+ float mid = (lo + hi) * 0.5;
1534
+ vec3 point = start + ray * mid;
1535
+ if (depthDifference(point, projectPosition(point)) >= 0.0) hi = mid; else lo = mid;
1536
+ }
1537
+ candidate = start + ray * hi;
1538
+ hitUV = projectPosition(candidate);
1539
+ difference = depthDifference(candidate, hitUV);
1540
+ if (difference > u_thickness || texture(u_depth, hitUV).r >= 0.999999) break;
1541
+ float edge = smoothstep(0.0, 0.08, min(min(hitUV.x, hitUV.y), min(1.0 - hitUV.x, 1.0 - hitUV.y)));
1542
+ float response = clamp(u_intensity * edge * (1.0 - roughness) * (1.0 - hi / u_maxDistance), 0.0, 1.0);
1543
+ outColor = vec4(mix(base.rgb, texture(u_source, hitUV).rgb, response), base.a);
1544
+ break;
1545
+ }
1546
+ previous = difference;
1547
+ }
1548
+ }
1549
+ `, "webgl2-ssr");
1550
+ return this.ssrProgram;
1551
+ }
1552
+ ensureDepthOfFieldProgram() {
1553
+ if (this.depthOfFieldProgram)
1554
+ return this.depthOfFieldProgram;
1555
+ this.depthOfFieldProgram = this.createFullscreenProgram(`#version 300 es
1556
+ precision highp float;
1557
+ precision highp int;
1558
+ uniform sampler2D u_source;
1559
+ uniform sampler2D u_depth;
1560
+ uniform ivec2 u_size;
1561
+ uniform float u_focusDepth;
1562
+ uniform float u_focusRange;
1563
+ uniform int u_maxRadius;
1564
+ uniform float u_depthNear;
1565
+ uniform float u_depthFar;
1566
+ out vec4 outColor;
1567
+
1568
+ // Same linearization contract as the SSR program, except focus is authored
1569
+ // directly as a linear-distance fraction (0 = near plane, 1 = far plane):
1570
+ // buffer-unit focus values are unusable once depth is linearized, because the
1571
+ // projection curve parks the whole play area inside a sliver of buffer units.
1572
+ // The CPU byte kernel keeps buffer-unit semantics; the divergence is
1573
+ // documented at normalizeLdrDepthRange.
1574
+ float a3dDofLinearDepth(float depth) {
1575
+ float viewZ = u_depthNear * u_depthFar / max(u_depthFar - depth * (u_depthFar - u_depthNear), 0.0001);
1576
+ return clamp((viewZ - u_depthNear) / max(u_depthFar - u_depthNear, 0.0001), 0.0, 1.0);
1577
+ }
1578
+
1579
+ void main() {
1580
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1581
+ vec4 source = texelFetch(u_source, pixel, 0);
1582
+ float linearDepth = a3dDofLinearDepth(texelFetch(u_depth, pixel, 0).r);
1583
+ float normalizedBlur = max(0.0, abs(linearDepth - u_focusDepth) - u_focusRange)
1584
+ / max(u_focusRange, 0.001) * float(u_maxRadius);
1585
+ int radius = min(u_maxRadius, int(round(normalizedBlur)));
1586
+ if (radius == 0) {
1587
+ outColor = source;
1588
+ return;
1589
+ }
1590
+ vec3 sum = vec3(0.0);
1591
+ float samples = 0.0;
1592
+ for (int offsetY = -8; offsetY <= 8; offsetY += 1) {
1593
+ for (int offsetX = -8; offsetX <= 8; offsetX += 1) {
1594
+ if (abs(offsetX) > radius || abs(offsetY) > radius) continue;
1595
+ if (offsetX * offsetX + offsetY * offsetY > radius * radius) continue;
1596
+ ivec2 samplePixel = clamp(pixel + ivec2(offsetX, offsetY), ivec2(0), u_size - ivec2(1));
1597
+ sum += texelFetch(u_source, samplePixel, 0).rgb;
1598
+ samples += 1.0;
1599
+ }
1600
+ }
1601
+ outColor = vec4(sum / max(1.0, samples), source.a);
1602
+ }
1603
+ `, "webgl2-depth-of-field");
1604
+ return this.depthOfFieldProgram;
1605
+ }
1606
+ ensureMotionBlurProgram() {
1607
+ if (this.motionBlurProgram)
1608
+ return this.motionBlurProgram;
1609
+ this.motionBlurProgram = this.createFullscreenProgram(`#version 300 es
1610
+ precision highp float;
1611
+ precision highp int;
1612
+ uniform sampler2D u_source;
1613
+ uniform sampler2D u_velocity;
1614
+ uniform bool u_velocityUv;
1615
+ uniform ivec2 u_size;
1616
+ uniform int u_samples;
1617
+ uniform float u_scale;
1618
+ out vec4 outColor;
1619
+
1620
+ void main() {
1621
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1622
+ vec4 source = texelFetch(u_source, pixel, 0);
1623
+ vec2 velocity = texelFetch(u_velocity, pixel, 0).rg * u_scale;
1624
+ if (u_velocityUv) velocity *= vec2(u_size);
1625
+ velocity = clamp(velocity, vec2(-64.0), vec2(64.0));
1626
+ if (length(velocity) < 0.01) {
1627
+ outColor = source;
1628
+ return;
1629
+ }
1630
+ vec3 sum = vec3(0.0);
1631
+ for (int sampleIndex = 0; sampleIndex < 16; sampleIndex += 1) {
1632
+ if (sampleIndex >= u_samples) continue;
1633
+ float t = float(sampleIndex) / float(u_samples - 1) - 0.5;
1634
+ ivec2 samplePixel = ivec2(floor(vec2(pixel) - velocity * t + vec2(0.5)));
1635
+ samplePixel = clamp(samplePixel, ivec2(0), u_size - ivec2(1));
1636
+ sum += texelFetch(u_source, samplePixel, 0).rgb;
1637
+ }
1638
+ outColor = vec4(sum / float(u_samples), source.a);
1639
+ }
1640
+ `, "webgl2-motion-blur");
1641
+ return this.motionBlurProgram;
1642
+ }
1643
+ ensureTaaProgram() {
1644
+ if (this.taaProgram)
1645
+ return this.taaProgram;
1646
+ this.taaProgram = this.createFullscreenProgram(`#version 300 es
1647
+ precision highp float;
1648
+ uniform sampler2D u_source;
1649
+ uniform sampler2D u_history;
1650
+ uniform sampler2D u_velocity;
1651
+ uniform float u_blend;
1652
+ uniform bool u_temporal;
1653
+ out vec4 outColor;
1654
+ vec4 cubicWeights(float f) {
1655
+ float f2=f*f, f3=f2*f;
1656
+ return vec4(-0.5*f+f2-0.5*f3,1.0-2.5*f2+1.5*f3,0.5*f+2.0*f2-1.5*f3,-0.5*f2+0.5*f3);
1657
+ }
1658
+ vec4 historyAt(vec2 uv) {
1659
+ ivec2 size=textureSize(u_history,0);
1660
+ vec2 position=uv*vec2(size)-0.5;
1661
+ ivec2 base=ivec2(floor(position));
1662
+ vec4 wx=cubicWeights(fract(position.x)), wy=cubicWeights(fract(position.y));
1663
+ vec4 result=vec4(0.0);
1664
+ // Repeated bilinear history reconstruction diffuses a moving edge every
1665
+ // frame. Cubic reconstruction preserves it; the resolve's current-neighbor
1666
+ // clipping below bounds ringing before accumulation.
1667
+ for(int y=0;y<4;y++) for(int x=0;x<4;x++) {
1668
+ result+=texelFetch(u_history,clamp(base+ivec2(x-1,y-1),ivec2(0),size-1),0)*wx[x]*wy[y];
1669
+ }
1670
+ return result;
1671
+ }
1672
+
1673
+ void main() {
1674
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
1675
+ ivec2 size = textureSize(u_source, 0);
1676
+ vec2 outputUV=(vec2(pixel)+0.5)/vec2(size);
1677
+ // Raster jitter supplies quadrature samples inside the output pixel.
1678
+ // Keep that sample on its pixel's accumulation grid; undoing the jitter
1679
+ // spatially filters it and defeats temporal coverage integration.
1680
+ vec2 sourceUV=outputUV;
1681
+ ivec2 sourcePixel=clamp(ivec2(floor(sourceUV*vec2(size))),ivec2(0),size-1);
1682
+ // Reconstruct current color on the stable output grid before accumulation.
1683
+ vec4 source = texelFetch(u_source, pixel, 0);
1684
+ vec4 motion = u_temporal ? texelFetch(u_velocity, sourcePixel, 0) : vec4(0.0);
1685
+ // A currently uncovered sample may still carry integrated foreground
1686
+ // coverage in history. Track nearby foreground motion for that coverage,
1687
+ // but retain this pixel's own current/previous depth tags: copying RGBA
1688
+ // wholesale falsely labels background color as a foreground surface.
1689
+ if (u_temporal) {
1690
+ float nearestDepth=motion.b;
1691
+ for(int y=-1;y<=1;y++) for(int x=-1;x<=1;x++) {
1692
+ vec4 candidate=texelFetch(u_velocity,clamp(pixel+ivec2(x,y),ivec2(0),size-1),0);
1693
+ if(candidate.b<nearestDepth) {nearestDepth=candidate.b;motion.xy=candidate.xy;}
1694
+ }
1695
+ }
1696
+ vec2 previousUV = outputUV-motion.xy;
1697
+ vec4 history = u_temporal ? historyAt(previousUV) : texture(u_history, previousUV);
1698
+ float weight = u_blend;
1699
+ if (u_temporal) {
1700
+ // Reprojected history incurs reconstruction error as the footprint moves
1701
+ // across the pixel grid. Reduce its confidence with displacement instead
1702
+ // of repeatedly giving a softened moving edge the stationary .9 weight.
1703
+ // Physical motion itself remains fully represented in previousUV.
1704
+ weight /= 1.0 + length(motion.xy * vec2(size));
1705
+ // Depth is categorical at a silhouette: bilinear alpha interpolation creates
1706
+ // nonexistent surfaces and rejects valid history on every jittered edge.
1707
+ // Test surface presence in the central history footprint. RGB remains
1708
+ // an integrated coverage value reconstructed from the wider cubic kernel.
1709
+ ivec2 previousBase=ivec2(floor(previousUV*vec2(size)-vec2(0.5)));
1710
+ float depthError=1.0;
1711
+ for(int y=0;y<2;y++) for(int x=0;x<2;x++) {
1712
+ float previousDepth=texelFetch(u_history,clamp(previousBase+ivec2(x,y),ivec2(0),size-1),0).a;
1713
+ depthError=min(depthError,abs(previousDepth-motion.a));
1714
+ }
1715
+ if (any(lessThan(previousUV,vec2(0.0))) || any(greaterThanEqual(previousUV,vec2(1.0))) || depthError>0.002) weight=0.0;
1716
+ vec3 lo=source.rgb, hi=source.rgb;
1717
+ for(int y=-1;y<=1;y++) for(int x=-1;x<=1;x++) { vec3 tap=texelFetch(u_source,clamp(pixel+ivec2(x,y),ivec2(0),size-1),0).rgb; lo=min(lo,tap); hi=max(hi,tap); }
1718
+ history.rgb=clamp(history.rgb,lo,hi);
1719
+ }
1720
+ vec3 resolved=mix(source.rgb,history.rgb,weight);
1721
+ outColor=vec4(resolved,u_temporal?motion.b:source.a);
1722
+ }
1723
+ `, "webgl2-taa-accumulation");
1724
+ return this.taaProgram;
1725
+ }
1726
+ ensureTaaPresentationProgram() {
1727
+ if (this.taaPresentationProgram)
1728
+ return this.taaPresentationProgram;
1729
+ this.taaPresentationProgram = this.createFullscreenProgram(`#version 300 es
1730
+ precision highp float;
1731
+ uniform sampler2D u_source;
1732
+ uniform sampler2D u_accumulated;
1733
+ out vec4 outColor;
1734
+ void main() {
1735
+ ivec2 pixel=ivec2(gl_FragCoord.xy);
1736
+ ivec2 size=textureSize(u_source,0);
1737
+ vec4 source=texelFetch(u_source,pixel,0);
1738
+ vec3 accumulated=texelFetch(u_accumulated,pixel,0).rgb;
1739
+ // Retained native pixels isolate the remaining spatial excess to the
1740
+ // horizontally moving silhouette. Apply a bounded three-tap unsharp resolve
1741
+ // to presentation only; accumulated history remains immutable.
1742
+ vec3 center=mix(source.rgb,accumulated,0.90);
1743
+ ivec2 leftPixel=clamp(pixel+ivec2(-1,0),ivec2(0),size-1);
1744
+ ivec2 rightPixel=clamp(pixel+ivec2(1,0),ivec2(0),size-1);
1745
+ vec3 left=mix(texelFetch(u_source,leftPixel,0).rgb,texelFetch(u_accumulated,leftPixel,0).rgb,0.90);
1746
+ vec3 right=mix(texelFetch(u_source,rightPixel,0).rgb,texelFetch(u_accumulated,rightPixel,0).rgb,0.90);
1747
+ outColor=vec4(clamp(center*1.04-(left+right)*0.02,0.0,1.0),source.a);
1748
+ }
1749
+ `, "webgl2-taa-presentation");
1750
+ return this.taaPresentationProgram;
1751
+ }
1752
+ ensureNativeFxaaFinalizeProgram() {
1753
+ if (this.nativeFxaaFinalizeProgram) {
1754
+ return this.nativeFxaaFinalizeProgram;
1755
+ }
1756
+ this.nativeFxaaFinalizeProgram = this.createFullscreenProgram(FXAA_185_FRAGMENT_GLSL, "webgl2-fxaa-185-finalize");
1757
+ return this.nativeFxaaFinalizeProgram;
1758
+ }
1759
+ /**
1760
+ * PRD-03 Phase 1 — the split finalize for `fxaa.variant === "r185"`: samples
1761
+ * the completed LDR intermediate (source resolution) and writes the r185
1762
+ * FXAA blend plus the ±1-LSB triangular dither to the output.
1763
+ */
1764
+ executeNativeFxaaFinalize(sourceTexture, framebuffer, outputWidth, outputHeight, sourceWidth, sourceHeight, vertexArray) {
1765
+ const program = this.ensureNativeFxaaFinalizeProgram();
1766
+ this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
1767
+ this.host.gl.viewport(0, 0, outputWidth, outputHeight);
1768
+ this.host.gl.useProgram(program);
1769
+ this.host.gl.bindVertexArray(vertexArray);
1770
+ this.bindFullscreenTexture(0, sourceTexture);
1771
+ this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
1772
+ this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_texelSize"), 1 / sourceWidth, 1 / sourceHeight);
1773
+ this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_outputTexel"), 1 / outputWidth, 1 / outputHeight);
1774
+ this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
1775
+ }
1776
+ createFullscreenProgram(fragmentSource, label) {
1777
+ const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
1778
+ precision highp float;
1779
+ void main() {
1780
+ vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
1781
+ gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
1782
+ }
1783
+ `, label);
1784
+ const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, fragmentSource, label);
1785
+ const program = this.host.gl.createProgram();
1786
+ if (!program) {
1787
+ this.host.gl.deleteShader(vertex);
1788
+ this.host.gl.deleteShader(fragment);
1789
+ throw new RenderDeviceError("Failed to allocate WebGL2 fullscreen shader program", "WEBGL_ALLOCATION_FAILED", { label });
1790
+ }
1791
+ this.host.gl.attachShader(program, vertex);
1792
+ this.host.gl.attachShader(program, fragment);
1793
+ this.host.gl.linkProgram(program);
1794
+ this.host.counters.programCompiles += 1;
1795
+ this.host.gl.deleteShader(vertex);
1796
+ this.host.gl.deleteShader(fragment);
1797
+ if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
1798
+ const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown fullscreen shader link error";
1799
+ this.host.gl.deleteProgram(program);
1800
+ throw new RenderDeviceError("WebGL2 fullscreen shader link failed", "SHADER_LINK_FAILED", { label, log });
1801
+ }
1802
+ return program;
1803
+ }
1804
+ ensureLdrPostprocessProgram() {
1805
+ if (this.ldrPostprocessProgram) {
1806
+ return this.ldrPostprocessProgram;
1807
+ }
1808
+ const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
1809
+ precision highp float;
1810
+ out vec2 v_uv;
1811
+ void main() {
1812
+ vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
1813
+ v_uv = position;
1814
+ gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
1815
+ }
1816
+ `, "webgl2-ldr-postprocess");
1817
+ const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, `#version 300 es
1818
+ precision highp float;
1819
+ uniform sampler2D u_source;
1820
+ uniform vec2 u_texelSize;
1821
+ uniform int u_hasToneMapping;
1822
+ uniform int u_toneOperator;
1823
+ uniform int u_inputColorSpace;
1824
+ uniform int u_outputColorSpace;
1825
+ uniform float u_exposure;
1826
+ uniform float u_whitePoint;
1827
+ uniform float u_gamma;
1828
+ uniform int u_hasColorGrade;
1829
+ uniform float u_contrast;
1830
+ uniform float u_temperature;
1831
+ uniform float u_tint;
1832
+ uniform float u_saturation;
1833
+ uniform float u_vibrance;
1834
+ uniform float u_vignette;
1835
+ uniform float u_sharpening;
1836
+ uniform int u_hasFxaa;
1837
+ uniform float u_edgeThreshold;
1838
+ uniform float u_subpixelBlend;
1839
+ in vec2 v_uv;
1840
+ out vec4 outColor;
1841
+
1842
+ float srgbToLinear(float value) {
1843
+ return value <= 0.04045 ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4);
1844
+ }
1845
+
1846
+ float linearToSrgb(float value) {
1847
+ return value <= 0.0031308 ? value * 12.92 : 1.055 * pow(value, 1.0 / 2.4) - 0.055;
1848
+ }
1849
+
1850
+ vec3 decodeColor(vec3 color) {
1851
+ return u_inputColorSpace == 1 ? vec3(srgbToLinear(color.r), srgbToLinear(color.g), srgbToLinear(color.b)) : color;
1852
+ }
1853
+
1854
+ vec3 encodeColor(vec3 color) {
1855
+ vec3 linear = clamp(color, 0.0, 1.0);
1856
+ return u_outputColorSpace == 1 ? vec3(linearToSrgb(linear.r), linearToSrgb(linear.g), linearToSrgb(linear.b)) : linear;
1857
+ }
1858
+
1859
+ vec3 acesRrtAndOdtFit(vec3 value) {
1860
+ vec3 numerator = value * (value + 0.0245786) - 0.000090537;
1861
+ vec3 denominator = value * (0.983729 * value + 0.4329510) + 0.238081;
1862
+ return numerator / denominator;
1863
+ }
1864
+
1865
+ vec3 acesFilmic(vec3 color) {
1866
+ // Match current Three.js ACESFilmicToneMapping. ACES is a coupled RGB
1867
+ // transform; a scalar approximation shifts hue and washes saturated colors.
1868
+ const mat3 acesInput = mat3(
1869
+ vec3(0.59719, 0.07600, 0.02840),
1870
+ vec3(0.35458, 0.90834, 0.13383),
1871
+ vec3(0.04823, 0.01566, 0.83777)
1872
+ );
1873
+ const mat3 acesOutput = mat3(
1874
+ vec3(1.60475, -0.10208, -0.00327),
1875
+ vec3(-0.53108, 1.10813, -0.07276),
1876
+ vec3(-0.07367, -0.00605, 1.07602)
1877
+ );
1878
+ vec3 acesColor = acesInput * (color / 0.6);
1879
+ acesColor = acesRrtAndOdtFit(acesColor);
1880
+ return clamp(acesOutput * acesColor, 0.0, 1.0);
1881
+ }
1882
+
1883
+ float filmic(float value) {
1884
+ float x = max(0.0, value);
1885
+ float toe = max(0.0, x - 0.004);
1886
+ float curve = (toe * (6.2 * toe + 0.5)) / (toe * (6.2 * toe + 1.7) + 0.06);
1887
+ return min(curve, x * 1.08);
1888
+ }
1889
+
1890
+ float uncharted2(float value) {
1891
+ float a = 0.15;
1892
+ float b = 0.5;
1893
+ float c = 0.1;
1894
+ float d = 0.2;
1895
+ float e = 0.02;
1896
+ float f = 0.3;
1897
+ float w = 11.2;
1898
+ float x = value * 2.0;
1899
+ float curve = ((x * (a * x + c * b) + d * e) / (x * (a * x + b) + d * f)) - e / f;
1900
+ float wx = w;
1901
+ float white = ((wx * (a * wx + c * b) + d * e) / (wx * (a * wx + b) + d * f)) - e / f;
1902
+ return clamp(curve / white, 0.0, 1.0);
1903
+ }
1904
+
1905
+ float agx(float value) {
1906
+ float x = max(0.0, value);
1907
+ float encoded = log2(1.0 + x) / log2(17.0);
1908
+ return clamp(encoded * encoded * (3.0 - 2.0 * encoded), 0.0, 1.0);
1909
+ }
1910
+
1911
+ float neutral(float value) {
1912
+ float x = max(0.0, value);
1913
+ return min(1.0, (x * (1.0 + x / 7.5)) / (1.0 + x));
1914
+ }
1915
+
1916
+ float toneMapChannel(float value) {
1917
+ float exposed = max(0.0, value * u_exposure) / max(0.0001, u_whitePoint);
1918
+ if (u_toneOperator == 0) return min(1.0, exposed);
1919
+ if (u_toneOperator == 1) return exposed / (1.0 + exposed);
1920
+ if (u_toneOperator == 2) return exposed;
1921
+ if (u_toneOperator == 3) return filmic(exposed);
1922
+ if (u_toneOperator == 4) return uncharted2(exposed);
1923
+ if (u_toneOperator == 5) return agx(exposed);
1924
+ return neutral(exposed);
1925
+ }
1926
+
1927
+ vec3 applyToneMapping(vec3 color) {
1928
+ if (u_hasToneMapping == 0) return color;
1929
+ vec3 decoded = decodeColor(color);
1930
+ vec3 mapped = u_toneOperator == 2
1931
+ ? acesFilmic(max(vec3(0.0), decoded * u_exposure) / max(0.0001, u_whitePoint))
1932
+ : vec3(toneMapChannel(decoded.r), toneMapChannel(decoded.g), toneMapChannel(decoded.b));
1933
+ return encodeColor(mapped);
1934
+ }
1935
+
1936
+ vec3 applyColorGrade(vec3 color, vec2 uv) {
1937
+ if (u_hasColorGrade == 0) return color;
1938
+ float contrastOffset = 0.5 - 0.5 * u_contrast;
1939
+ float redShift = u_temperature * 0.08 - u_tint * 0.02;
1940
+ float greenShift = u_tint * 0.06;
1941
+ float blueShift = -u_temperature * 0.08 - u_tint * 0.02;
1942
+ float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
1943
+ vec3 graded = color * u_contrast + vec3(contrastOffset + redShift, contrastOffset + greenShift, contrastOffset + blueShift);
1944
+ float distanceFromLuma = min(1.0, abs(graded.r - luma) + abs(graded.g - luma) + abs(graded.b - luma));
1945
+ float vibranceBoost = u_vibrance == 0.0 ? 0.0 : u_vibrance * (1.0 - distanceFromLuma);
1946
+ float saturation = u_saturation + vibranceBoost;
1947
+ graded = vec3(luma) + (graded - vec3(luma)) * saturation;
1948
+ vec2 centered = uv * 2.0 - 1.0;
1949
+ float vignette = 1.0 - u_vignette * clamp((length(centered) - 0.28) / 1.12, 0.0, 1.0);
1950
+ return clamp(graded * vignette, 0.0, 1.0);
1951
+ }
1952
+
1953
+ vec3 baseColorAt(vec2 uv) {
1954
+ vec2 clampedUv = clamp(uv, vec2(0.0), vec2(1.0));
1955
+ vec3 color = texture(u_source, clampedUv).rgb;
1956
+ return applyColorGrade(applyToneMapping(color), clampedUv);
1957
+ }
1958
+
1959
+ vec3 finalColorAt(vec2 uv) {
1960
+ vec3 center = baseColorAt(uv);
1961
+ if (u_hasColorGrade == 0 || u_sharpening <= 0.0) return center;
1962
+ vec3 blur = (
1963
+ baseColorAt(uv + vec2(-u_texelSize.x, 0.0)) +
1964
+ baseColorAt(uv + vec2(u_texelSize.x, 0.0)) +
1965
+ baseColorAt(uv + vec2(0.0, -u_texelSize.y)) +
1966
+ baseColorAt(uv + vec2(0.0, u_texelSize.y))
1967
+ ) * 0.25;
1968
+ return clamp(center + (center - blur) * u_sharpening, 0.0, 1.0);
1969
+ }
1970
+
1971
+ float luma(vec3 color) {
1972
+ return dot(color, vec3(0.2126, 0.7152, 0.0722));
1973
+ }
1974
+
1975
+ void main() {
1976
+ vec3 center = finalColorAt(v_uv);
1977
+ float alpha = texture(u_source, clamp(v_uv, vec2(0.0), vec2(1.0))).a;
1978
+ if (u_hasFxaa == 0) {
1979
+ outColor = vec4(center, alpha);
1980
+ return;
1981
+ }
1982
+ vec3 north = finalColorAt(v_uv + vec2(0.0, -u_texelSize.y));
1983
+ vec3 south = finalColorAt(v_uv + vec2(0.0, u_texelSize.y));
1984
+ vec3 west = finalColorAt(v_uv + vec2(-u_texelSize.x, 0.0));
1985
+ vec3 east = finalColorAt(v_uv + vec2(u_texelSize.x, 0.0));
1986
+ float centerLuma = luma(center);
1987
+ float minLuma = min(centerLuma, min(min(luma(north), luma(south)), min(luma(west), luma(east))));
1988
+ float maxLuma = max(centerLuma, max(max(luma(north), luma(south)), max(luma(west), luma(east))));
1989
+ if (maxLuma - minLuma < u_edgeThreshold) {
1990
+ outColor = vec4(center, alpha);
1991
+ return;
1992
+ }
1993
+ vec3 average = (north + south + west + east) * 0.25;
1994
+ outColor = vec4(mix(center, average, clamp(u_subpixelBlend, 0.0, 1.0)), alpha);
1995
+ }
1996
+ `, "webgl2-ldr-postprocess");
1997
+ const program = this.host.gl.createProgram();
1998
+ if (!program) {
1999
+ this.host.gl.deleteShader(vertex);
2000
+ this.host.gl.deleteShader(fragment);
2001
+ throw new RenderDeviceError("Failed to allocate WebGL2 LDR postprocess shader", "WEBGL_ALLOCATION_FAILED");
2002
+ }
2003
+ this.host.gl.attachShader(program, vertex);
2004
+ this.host.gl.attachShader(program, fragment);
2005
+ this.host.gl.linkProgram(program);
2006
+ this.host.counters.programCompiles += 1;
2007
+ this.host.gl.deleteShader(vertex);
2008
+ this.host.gl.deleteShader(fragment);
2009
+ if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
2010
+ const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown LDR postprocess shader link error";
2011
+ this.host.gl.deleteProgram(program);
2012
+ throw new RenderDeviceError("WebGL2 LDR postprocess shader link failed", "SHADER_LINK_FAILED", { log });
2013
+ }
2014
+ this.ldrPostprocessProgram = program;
2015
+ return program;
2016
+ }
2017
+ }
2018
+ function bloomNumberOption(options, key, fallback) {
2019
+ const value = options[key];
2020
+ if (value === undefined)
2021
+ return fallback;
2022
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2023
+ throw new RenderDeviceError(`Bloom ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2024
+ }
2025
+ return value;
2026
+ }
2027
+ function colorSpaceId(value) {
2028
+ return value === "srgb" ? 1 : 0;
2029
+ }
2030
+ function depthOfFieldNumberOption(options, key, fallback) {
2031
+ const value = options[key];
2032
+ if (value === undefined)
2033
+ return fallback;
2034
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2035
+ throw new RenderDeviceError(`Depth-of-field ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2036
+ }
2037
+ return value;
2038
+ }
2039
+ function motionBlurNumberOption(options, key, fallback) {
2040
+ const value = options[key];
2041
+ if (value === undefined)
2042
+ return fallback;
2043
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2044
+ throw new RenderDeviceError(`Motion blur ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2045
+ }
2046
+ return value;
2047
+ }
2048
+ function normalizeLdrDepthRange(range) {
2049
+ const near = range && Number.isFinite(range.near) && range.near > 0 ? range.near : 0.1;
2050
+ const far = range && Number.isFinite(range.far) && range.far > near ? range.far : 1000;
2051
+ return { near, far };
2052
+ }
2053
+ /**
2054
+ * Composite response for the native bloom. Flag-on (`excess`, §6.6): the
2055
+ * normalized pyramid weights sum to 1 and nothing else scales the halo, so an
2056
+ * excess E composites as E · intensity ("no hidden gain"). Flag-off keeps the
2057
+ * legacy `resolveBloomPyramidResponseGain` heuristic (deleted in Phase 8).
2058
+ */
2059
+ export function nativeBloomResponseGain(plan, options) {
2060
+ return options.excess === true ? 1 : resolveBloomPyramidResponseGain(plan);
2061
+ }
2062
+ export function normalizeNativeBloomOptions(options) {
2063
+ // PRD-03 §7.2 carve (0b-2): flag-on (`v2` stamp) accepts the HDR option
2064
+ // ranges — threshold [0,64], `knee` ratio [0,1] — and drops the
2065
+ // `softKnee ≤ 0.5` throw. §7.1 deprecated fields map while the
2066
+ // transitional legacy chain still executes: `knee` feeds the soft-knee
2067
+ // slot (§6.6 `threshold × kneeRatio` absolute width), authored
2068
+ // `scatter`/`radius` map onto the legacy `radius` integer, and
2069
+ // `maxIntensity`/`antiBlowout`/`clampLuminance`/`quality`/`shoulder` are
2070
+ // accepted and ignored (deprecation diagnostics live in the bridge).
2071
+ const v2 = options["v2"] === true;
2072
+ const threshold = bloomNumberOption(options, "threshold", 0.75);
2073
+ const intensity = bloomNumberOption(options, "intensity", 0.35);
2074
+ const knee = bloomNumberOption(options, "knee", NaN);
2075
+ const scatter = bloomNumberOption(options, "scatter", NaN);
2076
+ const radius = Number.isFinite(scatter)
2077
+ ? Math.round(scatter)
2078
+ : bloomNumberOption(options, "radius", 1);
2079
+ if (threshold < 0 || threshold > (v2 ? 64 : 1)) {
2080
+ throw new RenderDeviceError(v2 ? "Bloom threshold must be finite and in [0, 64]." : "Bloom threshold must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { threshold });
2081
+ }
2082
+ if (intensity < 0) {
2083
+ throw new RenderDeviceError("Bloom intensity must be finite and non-negative.", "INVALID_POSTPROCESS_OPTIONS", { intensity });
2084
+ }
2085
+ if (!Number.isInteger(radius) || radius < 0 || radius > 16) {
2086
+ throw new RenderDeviceError("Bloom radius must be an integer in [0, 16].", "INVALID_POSTPROCESS_OPTIONS", { radius });
2087
+ }
2088
+ if (v2 && Number.isFinite(knee) && (knee < 0 || knee > 1)) {
2089
+ throw new RenderDeviceError("Bloom knee must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { knee });
2090
+ }
2091
+ const authoredSoftKnee = bloomNumberOption(options, "softKnee", 0);
2092
+ const softKnee = v2 && Number.isFinite(knee) ? Math.min(0.5, threshold * knee) : authoredSoftKnee;
2093
+ if (!v2 && (!(authoredSoftKnee >= 0) || authoredSoftKnee > 0.5)) {
2094
+ throw new RenderDeviceError("Bloom softKnee must be finite and in [0, 0.5].", "INVALID_POSTPROCESS_OPTIONS", { softKnee });
2095
+ }
2096
+ const shoulder = bloomNumberOption(options, "shoulder", 0);
2097
+ if (!(shoulder >= 0) || shoulder > 1) {
2098
+ throw new RenderDeviceError("Bloom shoulder must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { shoulder });
2099
+ }
2100
+ let quality;
2101
+ try {
2102
+ // Flag-on S9: an unauthored quality runs the 5-mip pyramid (the
2103
+ // UnrealBloomPass-class wide halo) instead of the single 1-scale blur,
2104
+ // whose few-pixel fringe left the halo below one display LSB.
2105
+ quality = v2 && options.quality === undefined ? "cinematic" : normalizeBloomQualityPreset(options.quality);
2106
+ }
2107
+ catch {
2108
+ throw new RenderDeviceError("Bloom quality must be one of performance|balanced|cinematic.", "INVALID_POSTPROCESS_OPTIONS", { quality: options.quality });
2109
+ }
2110
+ const spread = bloomNumberOption(options, "spread", 0.7);
2111
+ if (v2 && (!(spread >= 0) || spread > 1)) {
2112
+ throw new RenderDeviceError("Bloom spread must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { spread });
2113
+ }
2114
+ return { threshold, intensity, radius, quality, softKnee, shoulder, ...(v2 ? { excess: true, spread } : {}) };
2115
+ }
2116
+ function normalizeNativeDepthOfFieldOptions(options) {
2117
+ const focusDepth = depthOfFieldNumberOption(options, "focusDepth", 0.5);
2118
+ const focusRange = depthOfFieldNumberOption(options, "focusRange", 0.12);
2119
+ const maxRadius = depthOfFieldNumberOption(options, "maxRadius", 2);
2120
+ if (focusDepth < 0 || focusDepth > 1) {
2121
+ throw new RenderDeviceError("Depth-of-field focusDepth must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { focusDepth });
2122
+ }
2123
+ if (focusRange < 0.001 || focusRange > 1) {
2124
+ throw new RenderDeviceError("Depth-of-field focusRange must be finite and in [0.001, 1].", "INVALID_POSTPROCESS_OPTIONS", { focusRange });
2125
+ }
2126
+ if (!Number.isInteger(maxRadius) || maxRadius < 0 || maxRadius > 8) {
2127
+ throw new RenderDeviceError("Depth-of-field maxRadius must be an integer in [0, 8].", "INVALID_POSTPROCESS_OPTIONS", { maxRadius });
2128
+ }
2129
+ return { focusDepth, focusRange, maxRadius };
2130
+ }
2131
+ function normalizeNativeMotionBlurOptions(options, width, height) {
2132
+ const samples = motionBlurNumberOption(options, "samples", 5);
2133
+ const scale = motionBlurNumberOption(options, "scale", 1);
2134
+ if (options.temporal) {
2135
+ if (!Number.isInteger(samples) || samples < 2 || samples > 16 || scale < 0 || scale > 8)
2136
+ throw new RenderDeviceError("Invalid motion blur samples/scale", "INVALID_POSTPROCESS_OPTIONS");
2137
+ return { samples, scale, temporal: options.temporal };
2138
+ }
2139
+ const value = options.velocity;
2140
+ if (!(value instanceof Float32Array) && !Array.isArray(value)) {
2141
+ throw new RenderDeviceError("Motion blur requires a velocity Float32Array or number array.", "WEBGL_LDR_POSTPROCESS_VELOCITY_REQUIRED");
2142
+ }
2143
+ const velocity = value instanceof Float32Array ? value : new Float32Array(value);
2144
+ if (velocity.length !== width * height * 2) {
2145
+ throw new RenderDeviceError("Motion blur velocity must contain width * height * 2 float samples.", "INVALID_POSTPROCESS_OPTIONS", {
2146
+ expectedLength: width * height * 2,
2147
+ actualLength: velocity.length
2148
+ });
2149
+ }
2150
+ if (!Number.isInteger(samples) || samples < 2 || samples > 16) {
2151
+ throw new RenderDeviceError("Motion blur samples must be an integer in [2, 16].", "INVALID_POSTPROCESS_OPTIONS", { samples });
2152
+ }
2153
+ if (scale < 0 || scale > 8) {
2154
+ throw new RenderDeviceError("Motion blur scale must be finite and in [0, 8].", "INVALID_POSTPROCESS_OPTIONS", { scale });
2155
+ }
2156
+ return { samples, scale, velocity };
2157
+ }
2158
+ function normalizeNativeOutlineOptions(options) {
2159
+ const width = outlineNumberOption(options, "width", 1);
2160
+ const threshold = outlineNumberOption(options, "threshold", 0.22);
2161
+ const opacity = outlineNumberOption(options, "opacity", 0.85);
2162
+ const value = options.color;
2163
+ const sourceColor = value === undefined ? [255, 188, 64, 255] : value;
2164
+ if (!Array.isArray(sourceColor)
2165
+ || (sourceColor.length !== 3 && sourceColor.length !== 4)
2166
+ || sourceColor.some((channel) => typeof channel !== "number" || !Number.isFinite(channel) || channel < 0 || channel > 255)) {
2167
+ throw new RenderDeviceError("Outline color must contain three or four finite channels in [0, 255].", "INVALID_POSTPROCESS_OPTIONS", { color: value });
2168
+ }
2169
+ if (!Number.isInteger(width) || width < 1 || width > 6) {
2170
+ throw new RenderDeviceError("Outline width must be an integer in [1, 6].", "INVALID_POSTPROCESS_OPTIONS", { width });
2171
+ }
2172
+ if (threshold < 0 || threshold > 4) {
2173
+ throw new RenderDeviceError("Outline threshold must be finite and in [0, 4].", "INVALID_POSTPROCESS_OPTIONS", { threshold });
2174
+ }
2175
+ if (opacity < 0 || opacity > 1) {
2176
+ throw new RenderDeviceError("Outline opacity must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { opacity });
2177
+ }
2178
+ const color = [
2179
+ sourceColor[0],
2180
+ sourceColor[1],
2181
+ sourceColor[2],
2182
+ (sourceColor[3] ?? 255)
2183
+ ];
2184
+ return { width, threshold, opacity, color };
2185
+ }
2186
+ function normalizeNativeSsaoOptions(options) {
2187
+ const radius = ssaoNumberOption(options, "radius", 2);
2188
+ const intensity = ssaoNumberOption(options, "intensity", 0.38);
2189
+ const bias = ssaoNumberOption(options, "bias", 0.015);
2190
+ if (!Number.isInteger(radius) || radius < 1 || radius > 8) {
2191
+ throw new RenderDeviceError("SSAO radius must be an integer in [1, 8].", "INVALID_POSTPROCESS_OPTIONS", { radius });
2192
+ }
2193
+ if (intensity < 0 || intensity > 2) {
2194
+ throw new RenderDeviceError("SSAO intensity must be finite and in [0, 2].", "INVALID_POSTPROCESS_OPTIONS", { intensity });
2195
+ }
2196
+ if (bias < 0 || bias > 0.25) {
2197
+ throw new RenderDeviceError("SSAO bias must be finite and in [0, 0.25].", "INVALID_POSTPROCESS_OPTIONS", { bias });
2198
+ }
2199
+ return { radius, intensity, bias };
2200
+ }
2201
+ function normalizeNativeSsrOptions(options) {
2202
+ const intensity = ssrNumberOption(options, "intensity", 0.32);
2203
+ const maxDistance = ssrNumberOption(options, "maxDistance", 16);
2204
+ if (intensity < 0 || intensity > 2) {
2205
+ throw new RenderDeviceError("SSR intensity must be finite and in [0, 2].", "INVALID_POSTPROCESS_OPTIONS", { intensity });
2206
+ }
2207
+ if (!Number.isInteger(maxDistance) || maxDistance < 1 || maxDistance > 64) {
2208
+ throw new RenderDeviceError("SSR maxDistance must be an integer in [1, 64].", "INVALID_POSTPROCESS_OPTIONS", { maxDistance });
2209
+ }
2210
+ const projection = options["projection"];
2211
+ if (!(projection instanceof Float32Array))
2212
+ throw new RenderDeviceError("Native SSR requires the actual frame projection or view-projection matrix.", "INVALID_POSTPROCESS_OPTIONS");
2213
+ const inverseProjection = invertSsrProjection(projection);
2214
+ return { intensity, maxDistance, projection, inverseProjection };
2215
+ }
2216
+ function normalizeNativeTaaOptions(options, width, height) {
2217
+ const blend = taaNumberOption(options, "blend", 0.18);
2218
+ if (options.temporal) {
2219
+ if (blend < 0 || blend > .95)
2220
+ throw new RenderDeviceError("Invalid TAA blend", "INVALID_POSTPROCESS_OPTIONS");
2221
+ return { blend, temporal: options.temporal };
2222
+ }
2223
+ const history = options.history;
2224
+ if (!(history instanceof Uint8Array)) {
2225
+ throw new RenderDeviceError("TAA requires a Uint8Array history buffer.", "WEBGL_LDR_POSTPROCESS_HISTORY_REQUIRED");
2226
+ }
2227
+ if (history.byteLength !== width * height * 4) {
2228
+ throw new RenderDeviceError("TAA history must contain width * height * 4 RGBA bytes.", "INVALID_POSTPROCESS_OPTIONS", {
2229
+ expectedLength: width * height * 4,
2230
+ actualLength: history.byteLength
2231
+ });
2232
+ }
2233
+ if (blend < 0 || blend > 0.95) {
2234
+ throw new RenderDeviceError("TAA blend must be finite and in [0, 0.95].", "INVALID_POSTPROCESS_OPTIONS", { blend });
2235
+ }
2236
+ return { blend, history };
2237
+ }
2238
+ function numberOption(options, key, fallback) {
2239
+ const value = options[key];
2240
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
2241
+ }
2242
+ function outlineNumberOption(options, key, fallback) {
2243
+ const value = options[key];
2244
+ if (value === undefined)
2245
+ return fallback;
2246
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2247
+ throw new RenderDeviceError(`Outline ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2248
+ }
2249
+ return value;
2250
+ }
2251
+ function ssaoNumberOption(options, key, fallback) {
2252
+ const value = options[key];
2253
+ if (value === undefined)
2254
+ return fallback;
2255
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2256
+ throw new RenderDeviceError(`SSAO ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2257
+ }
2258
+ return value;
2259
+ }
2260
+ function ssrNumberOption(options, key, fallback) {
2261
+ const value = options[key];
2262
+ if (value === undefined)
2263
+ return fallback;
2264
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2265
+ throw new RenderDeviceError(`SSR ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2266
+ }
2267
+ return value;
2268
+ }
2269
+ function stringOption(options, key, fallback) {
2270
+ const value = options[key];
2271
+ return typeof value === "string" ? value : fallback;
2272
+ }
2273
+ function taaNumberOption(options, key, fallback) {
2274
+ const value = options[key];
2275
+ if (value === undefined)
2276
+ return fallback;
2277
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2278
+ throw new RenderDeviceError(`TAA ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
2279
+ }
2280
+ return value;
2281
+ }
2282
+ function toneMappingOperatorId(value) {
2283
+ if (value === "linear")
2284
+ return 0;
2285
+ if (value === "reinhard")
2286
+ return 1;
2287
+ if (value === "aces")
2288
+ return 2;
2289
+ if (value === "filmic")
2290
+ return 3;
2291
+ if (value === "uncharted2")
2292
+ return 4;
2293
+ if (value === "agx")
2294
+ return 5;
2295
+ return 6;
2296
+ }
2297
+ /* ------------------------------------------------------------------------- */
2298
+ /* C-13 v2 seam (PRD-03 Phase 2, CCR-03-5) */
2299
+ /* ------------------------------------------------------------------------- */
2300
+ /**
2301
+ * The §6.1 OUT stage adapted onto the proven native tone program (C-05
2302
+ * OutputPass stub): single tonemap operator + sRGB encode. `exposure`
2303
+ * defaults to the pipeline bag's §6.4 product — while the transitional
2304
+ * chain applies exposure here, the final graph applies it in S10 composite
2305
+ * and this pass receives `1`.
2306
+ */
2307
+ export function createLegacyOutputPass(pipeline, base) {
2308
+ const operator = pipeline.toneMapping === "none" ? "linear" : pipeline.toneMapping;
2309
+ return {
2310
+ name: "tone-mapping",
2311
+ options: {
2312
+ ...(base ?? {}),
2313
+ operator,
2314
+ exposure: pipeline.exposure,
2315
+ inputColorSpace: "srgb-linear",
2316
+ outputColorSpace: "srgb",
2317
+ // §6.1 OUT.dithering: false — the S12 finalize owns the triangular
2318
+ // dither; a second dither here would double-dither.
2319
+ ...(pipeline.dither === false ? { dithering: false } : {})
2320
+ }
2321
+ };
2322
+ }
2323
+ /**
2324
+ * `executePostGraphWebGL2` — the C-13 device carve (CONTRACTS §3.1 /
2325
+ * PRD-03 §7.2). It receives the device's GL internals (the registered
2326
+ * `WebGL2DeviceHost`) plus the already-planned LDR descriptors, replaces
2327
+ * the legacy `tone-mapping` descriptor with `createLegacyOutputPass`,
2328
+ * stamps `v2` on bloom options (the §7.2 field-range carve), and runs the
2329
+ * proven native fused path. Phases 3–6 grow this seam stage-by-stage into
2330
+ * the real v2 GPU loop (S1–S12) without touching `WebGL2Device.ts`.
2331
+ */
2332
+ export function executePostGraphWebGL2(host, source, request) {
2333
+ if (!host) {
2334
+ throw new RenderDeviceError("PostGraph v2 requires a WebGL2 device host.", "POST_GRAPH_V2_UNSUPPORTED");
2335
+ }
2336
+ const v2 = request.v2;
2337
+ const pipeline = request.pipeline;
2338
+ // Phase 3: real S1/S2/S4 + CA run on the HDR target before the fused
2339
+ // present; S10b/S11/S12 run as the LDR tail after it.
2340
+ let workSource = source;
2341
+ if (v2) {
2342
+ workSource = v2.runV2HdrStages(host, source, pipeline, request.cameraFrame, request.temporal, request.frameContext).target;
2343
+ }
2344
+ const needsTail = Boolean(v2 && v2.v2NeedsLdrTail(pipeline));
2345
+ const ldrTailTarget = needsTail && v2
2346
+ ? v2.acquireV2Target(host, { width: source.width, height: source.height, format: "rgba8" })
2347
+ : undefined;
2348
+ // With a real S12 the fused OUT must not emit the legacy dither — the
2349
+ // finalize pass owns the single triangular dither for the frame.
2350
+ const pipelineForOut = needsTail && pipeline.dither !== false
2351
+ ? { ...pipeline, dither: false }
2352
+ : pipeline;
2353
+ const mappedPasses = request.passes
2354
+ // §6.9/T0-17 (FLAG-ON-4): on the v2 chain the HDR stages own their
2355
+ // effects — S2 GTAO (ssao), S6 (depth-of-field), S7 (motion-blur),
2356
+ // S5 (taa). The legacy twin must not double-run, and its native depth
2357
+ // read would throw WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED per frame on
2358
+ // the pooled depth-less stage output.
2359
+ .filter((pass) => !(v2 && ((pipeline.ao && pass.name === "ssao")
2360
+ || (pipeline.dof && pass.name === "depth-of-field")
2361
+ || (pipeline.motionBlur && pass.name === "motion-blur")
2362
+ || ((pipeline.antiAliasing === "taa" || Boolean(pipeline.taa)) && pass.name === "taa"))))
2363
+ .map((pass) => {
2364
+ if (pass.name === "tone-mapping") {
2365
+ return createLegacyOutputPass(pipelineForOut, pass.options);
2366
+ }
2367
+ if (pass.name === "bloom") {
2368
+ return { name: pass.name, options: { ...pass.options, v2: true } };
2369
+ }
2370
+ return pass;
2371
+ });
2372
+ // T0-17/FLAG-ON-4: the pooled HDR-stage output carries no depth texture —
2373
+ // any remaining native depth pass would throw
2374
+ // WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED per frame; degrade it to a
2375
+ // recorded skip instead.
2376
+ const workSourceDepthless = workSource !== source && !workSource.depthTextureHandle;
2377
+ const depthSkippedPasses = workSourceDepthless
2378
+ ? mappedPasses.filter((pass) => {
2379
+ if (pass.name === "depth-of-field" || pass.name === "ssao" || pass.name === "ssr") {
2380
+ recordPostSkipped(`WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED:${pass.name}`);
2381
+ return false;
2382
+ }
2383
+ return true;
2384
+ })
2385
+ : mappedPasses;
2386
+ // T0-17/FLAG-ON-3: `output.toneMapping:'none'` drops the legacy tone pass,
2387
+ // but an HDR workSource (HDR stages ran, or an rgba16f forward target)
2388
+ // still needs the §6.1 OUT stage to reach LDR — inject the linear
2389
+ // OutputPass (createLegacyOutputPass maps 'none' to the linear operator)
2390
+ // instead of throwing WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED per frame.
2391
+ const passes = pipeline.toneMapping === "none" && !depthSkippedPasses.some((pass) => pass.name === "tone-mapping")
2392
+ ? [...depthSkippedPasses, createLegacyOutputPass(pipelineForOut)]
2393
+ : depthSkippedPasses;
2394
+ host.post.presentLdrPostprocess(workSource, {
2395
+ passes,
2396
+ ...(ldrTailTarget ?? request.outputTarget ? { outputTarget: ldrTailTarget ?? request.outputTarget } : {}),
2397
+ toneMappingDefaults: { outputColorSpace: "srgb" },
2398
+ depthRange: {
2399
+ near: request.depthRange?.near ?? request.pipeline.depthRange.near,
2400
+ far: request.depthRange?.far ?? request.pipeline.depthRange.far
2401
+ }
2402
+ });
2403
+ if (workSource !== source && v2)
2404
+ v2.releaseV2Target(host, workSource);
2405
+ if (ldrTailTarget && v2) {
2406
+ v2.runV2LdrTail(host, ldrTailTarget, pipeline, request.outputTarget, request.frameContext);
2407
+ v2.releaseV2Target(host, ldrTailTarget);
2408
+ }
2409
+ }
2410
+ /**
2411
+ * Native bloom bright-extract fragment (exported for the glslang unit gate).
2412
+ * HDR sources: flag-on (`u_excess`) keeps the §6.6 soft-knee excess over
2413
+ * threshold; flag-off keeps the legacy full-colour gate. LDR sources use the
2414
+ * packed bright LUT.
2415
+ */
2416
+ export const BLOOM_BRIGHT_EXTRACT_GLSL = `#version 300 es
2417
+ precision highp float;
2418
+ precision highp int;
2419
+ uniform sampler2D u_source;
2420
+ uniform sampler2D u_brightLut;
2421
+ uniform int u_hdr;
2422
+ uniform float u_threshold;
2423
+ uniform float u_softKnee;
2424
+ uniform int u_excess;
2425
+ out vec4 outColor;
2426
+
2427
+ uvec4 byteTexel(sampler2D source, ivec2 coordinate) {
2428
+ return uvec4(texelFetch(source, coordinate, 0) * 255.0 + 0.5);
2429
+ }
2430
+
2431
+ void main() {
2432
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
2433
+ if (u_hdr == 1) {
2434
+ vec4 source = texelFetch(u_source, pixel, 0);
2435
+ float luma = dot(source.rgb, vec3(0.2126, 0.7152, 0.0722));
2436
+ if (u_excess == 1) {
2437
+ // PRD-03 §6.6 soft-knee threshold weight (bloom.glsl prefilter twin):
2438
+ // keep only the excess over threshold — quadratic inside the knee,
2439
+ // linear above it — so bloom energy is proportional to the excess.
2440
+ // u_softKnee is the absolute knee width (threshold × knee ratio).
2441
+ float knee = max(u_softKnee, 0.0);
2442
+ float soft = clamp(luma - u_threshold + knee, 0.0, 2.0 * knee);
2443
+ soft = soft * soft / (4.0 * knee + 1e-5);
2444
+ float excessWeight = max(soft, luma - u_threshold) / max(luma, 1e-5);
2445
+ outColor = vec4(source.rgb * excessWeight, source.a);
2446
+ return;
2447
+ }
2448
+ float kneeLow = max(u_threshold - u_softKnee, 0.0);
2449
+ float kneeHigh = min(u_threshold + u_softKnee, 1.0);
2450
+ float weight = u_softKnee <= 0.0
2451
+ ? (luma >= u_threshold ? 1.0 : 0.0)
2452
+ : smoothstep(kneeLow, kneeHigh, luma);
2453
+ outColor = source * weight;
2454
+ return;
2455
+ }
2456
+ uvec4 source = byteTexel(u_source, pixel);
2457
+ uint colorIndex = (source.r << 16u) | (source.g << 8u) | source.b;
2458
+ uint byteIndex = colorIndex >> 3u;
2459
+ uint texelIndex = byteIndex >> 2u;
2460
+ ivec2 lutCoordinate = ivec2(
2461
+ int(texelIndex % ${BLOOM_BRIGHT_LUT_WIDTH}u),
2462
+ int(texelIndex / ${BLOOM_BRIGHT_LUT_WIDTH}u)
2463
+ );
2464
+ uvec4 packed = byteTexel(u_brightLut, lutCoordinate);
2465
+ uint component = byteIndex & 3u;
2466
+ uint packedByte = component == 0u
2467
+ ? packed.r
2468
+ : component == 1u
2469
+ ? packed.g
2470
+ : component == 2u
2471
+ ? packed.b
2472
+ : packed.a;
2473
+ bool bright = ((packedByte >> (colorIndex & 7u)) & 1u) == 1u;
2474
+ outColor = bright ? vec4(source) / 255.0 : vec4(0.0);
2475
+ }
2476
+ `;
2477
+ //# sourceMappingURL=LegacyPost.js.map