@aura3d/rendering 1.0.6

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 (1433) hide show
  1. package/README.md +18 -0
  2. package/dist/ArchitecturalLightingFixtures.d.ts +40 -0
  3. package/dist/ArchitecturalLightingFixtures.d.ts.map +1 -0
  4. package/dist/ArchitecturalLightingFixtures.js +171 -0
  5. package/dist/ArchitecturalLightingFixtures.js.map +1 -0
  6. package/dist/ArchitecturalMaterialCatalog.d.ts +30 -0
  7. package/dist/ArchitecturalMaterialCatalog.d.ts.map +1 -0
  8. package/dist/ArchitecturalMaterialCatalog.js +90 -0
  9. package/dist/ArchitecturalMaterialCatalog.js.map +1 -0
  10. package/dist/ArchitecturalMeasurementFixtures.d.ts +30 -0
  11. package/dist/ArchitecturalMeasurementFixtures.d.ts.map +1 -0
  12. package/dist/ArchitecturalMeasurementFixtures.js +115 -0
  13. package/dist/ArchitecturalMeasurementFixtures.js.map +1 -0
  14. package/dist/BRDFLut.d.ts +13 -0
  15. package/dist/BRDFLut.d.ts.map +1 -0
  16. package/dist/BRDFLut.js +34 -0
  17. package/dist/BRDFLut.js.map +1 -0
  18. package/dist/CameraFraming.d.ts +31 -0
  19. package/dist/CameraFraming.d.ts.map +1 -0
  20. package/dist/CameraFraming.js +143 -0
  21. package/dist/CameraFraming.js.map +1 -0
  22. package/dist/CanonicalSceneFixtures.d.ts +13 -0
  23. package/dist/CanonicalSceneFixtures.d.ts.map +1 -0
  24. package/dist/CanonicalSceneFixtures.js +78 -0
  25. package/dist/CanonicalSceneFixtures.js.map +1 -0
  26. package/dist/CascadedShadowMaps.d.ts +121 -0
  27. package/dist/CascadedShadowMaps.d.ts.map +1 -0
  28. package/dist/CascadedShadowMaps.js +315 -0
  29. package/dist/CascadedShadowMaps.js.map +1 -0
  30. package/dist/ColorManagement.d.ts +33 -0
  31. package/dist/ColorManagement.d.ts.map +1 -0
  32. package/dist/ColorManagement.js +71 -0
  33. package/dist/ColorManagement.js.map +1 -0
  34. package/dist/CullingFixtures.d.ts +70 -0
  35. package/dist/CullingFixtures.d.ts.map +1 -0
  36. package/dist/CullingFixtures.js +191 -0
  37. package/dist/CullingFixtures.js.map +1 -0
  38. package/dist/DecalGeometry.d.ts +3 -0
  39. package/dist/DecalGeometry.d.ts.map +1 -0
  40. package/dist/DecalGeometry.js +2 -0
  41. package/dist/DecalGeometry.js.map +1 -0
  42. package/dist/DepthPass.d.ts +23 -0
  43. package/dist/DepthPass.d.ts.map +1 -0
  44. package/dist/DepthPass.js +99 -0
  45. package/dist/DepthPass.js.map +1 -0
  46. package/dist/EnvironmentBackgroundPass.d.ts +27 -0
  47. package/dist/EnvironmentBackgroundPass.d.ts.map +1 -0
  48. package/dist/EnvironmentBackgroundPass.js +167 -0
  49. package/dist/EnvironmentBackgroundPass.js.map +1 -0
  50. package/dist/EnvironmentBackgroundResources.d.ts +31 -0
  51. package/dist/EnvironmentBackgroundResources.d.ts.map +1 -0
  52. package/dist/EnvironmentBackgroundResources.js +237 -0
  53. package/dist/EnvironmentBackgroundResources.js.map +1 -0
  54. package/dist/EnvironmentLighting.d.ts +10 -0
  55. package/dist/EnvironmentLighting.d.ts.map +1 -0
  56. package/dist/EnvironmentLighting.js +64 -0
  57. package/dist/EnvironmentLighting.js.map +1 -0
  58. package/dist/EnvironmentMapResources.d.ts +98 -0
  59. package/dist/EnvironmentMapResources.d.ts.map +1 -0
  60. package/dist/EnvironmentMapResources.js +794 -0
  61. package/dist/EnvironmentMapResources.js.map +1 -0
  62. package/dist/EnvironmentPipeline.d.ts +21 -0
  63. package/dist/EnvironmentPipeline.d.ts.map +1 -0
  64. package/dist/EnvironmentPipeline.js +43 -0
  65. package/dist/EnvironmentPipeline.js.map +1 -0
  66. package/dist/EnvironmentPlatform.d.ts +185 -0
  67. package/dist/EnvironmentPlatform.d.ts.map +1 -0
  68. package/dist/EnvironmentPlatform.js +922 -0
  69. package/dist/EnvironmentPlatform.js.map +1 -0
  70. package/dist/EnvironmentPreset.d.ts +35 -0
  71. package/dist/EnvironmentPreset.d.ts.map +1 -0
  72. package/dist/EnvironmentPreset.js +96 -0
  73. package/dist/EnvironmentPreset.js.map +1 -0
  74. package/dist/Exposure.d.ts +19 -0
  75. package/dist/Exposure.d.ts.map +1 -0
  76. package/dist/Exposure.js +34 -0
  77. package/dist/Exposure.js.map +1 -0
  78. package/dist/ExternalParityRenderPreset.d.ts +149 -0
  79. package/dist/ExternalParityRenderPreset.d.ts.map +1 -0
  80. package/dist/ExternalParityRenderPreset.js +519 -0
  81. package/dist/ExternalParityRenderPreset.js.map +1 -0
  82. package/dist/ForwardPass.d.ts +122 -0
  83. package/dist/ForwardPass.d.ts.map +1 -0
  84. package/dist/ForwardPass.js +1352 -0
  85. package/dist/ForwardPass.js.map +1 -0
  86. package/dist/FrameVisualMetrics.d.ts +60 -0
  87. package/dist/FrameVisualMetrics.d.ts.map +1 -0
  88. package/dist/FrameVisualMetrics.js +146 -0
  89. package/dist/FrameVisualMetrics.js.map +1 -0
  90. package/dist/Geometry.d.ts +50 -0
  91. package/dist/Geometry.d.ts.map +1 -0
  92. package/dist/Geometry.js +385 -0
  93. package/dist/Geometry.js.map +1 -0
  94. package/dist/GeometryPrimitives.d.ts +3 -0
  95. package/dist/GeometryPrimitives.d.ts.map +1 -0
  96. package/dist/GeometryPrimitives.js +2 -0
  97. package/dist/GeometryPrimitives.js.map +1 -0
  98. package/dist/HDRRenderPipeline.d.ts +27 -0
  99. package/dist/HDRRenderPipeline.d.ts.map +1 -0
  100. package/dist/HDRRenderPipeline.js +67 -0
  101. package/dist/HDRRenderPipeline.js.map +1 -0
  102. package/dist/IBL.d.ts +37 -0
  103. package/dist/IBL.d.ts.map +1 -0
  104. package/dist/IBL.js +48 -0
  105. package/dist/IBL.js.map +1 -0
  106. package/dist/IndexBuffer.d.ts +15 -0
  107. package/dist/IndexBuffer.d.ts.map +1 -0
  108. package/dist/IndexBuffer.js +51 -0
  109. package/dist/IndexBuffer.js.map +1 -0
  110. package/dist/InstancedPBRMaterial.d.ts +33 -0
  111. package/dist/InstancedPBRMaterial.d.ts.map +1 -0
  112. package/dist/InstancedPBRMaterial.js +147 -0
  113. package/dist/InstancedPBRMaterial.js.map +1 -0
  114. package/dist/InstancedUnlitMaterial.d.ts +11 -0
  115. package/dist/InstancedUnlitMaterial.d.ts.map +1 -0
  116. package/dist/InstancedUnlitMaterial.js +50 -0
  117. package/dist/InstancedUnlitMaterial.js.map +1 -0
  118. package/dist/Instancing.d.ts +7 -0
  119. package/dist/Instancing.d.ts.map +1 -0
  120. package/dist/Instancing.js +14 -0
  121. package/dist/Instancing.js.map +1 -0
  122. package/dist/LightCollector.d.ts +24 -0
  123. package/dist/LightCollector.d.ts.map +1 -0
  124. package/dist/LightCollector.js +56 -0
  125. package/dist/LightCollector.js.map +1 -0
  126. package/dist/LightUniforms.d.ts +14 -0
  127. package/dist/LightUniforms.d.ts.map +1 -0
  128. package/dist/LightUniforms.js +37 -0
  129. package/dist/LightUniforms.js.map +1 -0
  130. package/dist/LightingDebug.d.ts +13 -0
  131. package/dist/LightingDebug.d.ts.map +1 -0
  132. package/dist/LightingDebug.js +69 -0
  133. package/dist/LightingDebug.js.map +1 -0
  134. package/dist/LightingDefaults.d.ts +13 -0
  135. package/dist/LightingDefaults.d.ts.map +1 -0
  136. package/dist/LightingDefaults.js +64 -0
  137. package/dist/LightingDefaults.js.map +1 -0
  138. package/dist/LightingRig.d.ts +53 -0
  139. package/dist/LightingRig.d.ts.map +1 -0
  140. package/dist/LightingRig.js +197 -0
  141. package/dist/LightingRig.js.map +1 -0
  142. package/dist/LineGeometry.d.ts +3 -0
  143. package/dist/LineGeometry.d.ts.map +1 -0
  144. package/dist/LineGeometry.js +2 -0
  145. package/dist/LineGeometry.js.map +1 -0
  146. package/dist/Material.d.ts +77 -0
  147. package/dist/Material.d.ts.map +1 -0
  148. package/dist/Material.js +137 -0
  149. package/dist/Material.js.map +1 -0
  150. package/dist/MaterialBinding.d.ts +17 -0
  151. package/dist/MaterialBinding.d.ts.map +1 -0
  152. package/dist/MaterialBinding.js +119 -0
  153. package/dist/MaterialBinding.js.map +1 -0
  154. package/dist/MaterialInstance.d.ts +16 -0
  155. package/dist/MaterialInstance.d.ts.map +1 -0
  156. package/dist/MaterialInstance.js +53 -0
  157. package/dist/MaterialInstance.js.map +1 -0
  158. package/dist/MaterialPresets.d.ts +31 -0
  159. package/dist/MaterialPresets.d.ts.map +1 -0
  160. package/dist/MaterialPresets.js +219 -0
  161. package/dist/MaterialPresets.js.map +1 -0
  162. package/dist/MorphTarget.d.ts +10 -0
  163. package/dist/MorphTarget.d.ts.map +1 -0
  164. package/dist/MorphTarget.js +101 -0
  165. package/dist/MorphTarget.js.map +1 -0
  166. package/dist/MorphUnlitMaterial.d.ts +11 -0
  167. package/dist/MorphUnlitMaterial.d.ts.map +1 -0
  168. package/dist/MorphUnlitMaterial.js +45 -0
  169. package/dist/MorphUnlitMaterial.js.map +1 -0
  170. package/dist/NormalMappedPBRMaterial.d.ts +37 -0
  171. package/dist/NormalMappedPBRMaterial.d.ts.map +1 -0
  172. package/dist/NormalMappedPBRMaterial.js +148 -0
  173. package/dist/NormalMappedPBRMaterial.js.map +1 -0
  174. package/dist/OceanFixtures.d.ts +62 -0
  175. package/dist/OceanFixtures.d.ts.map +1 -0
  176. package/dist/OceanFixtures.js +240 -0
  177. package/dist/OceanFixtures.js.map +1 -0
  178. package/dist/PBRLightingDefaults.d.ts +4 -0
  179. package/dist/PBRLightingDefaults.d.ts.map +1 -0
  180. package/dist/PBRLightingDefaults.js +10 -0
  181. package/dist/PBRLightingDefaults.js.map +1 -0
  182. package/dist/PBRMaterial.d.ts +84 -0
  183. package/dist/PBRMaterial.d.ts.map +1 -0
  184. package/dist/PBRMaterial.js +349 -0
  185. package/dist/PBRMaterial.js.map +1 -0
  186. package/dist/PMREM.d.ts +26 -0
  187. package/dist/PMREM.d.ts.map +1 -0
  188. package/dist/PMREM.js +26 -0
  189. package/dist/PMREM.js.map +1 -0
  190. package/dist/PbrReference.d.ts +153 -0
  191. package/dist/PbrReference.d.ts.map +1 -0
  192. package/dist/PbrReference.js +500 -0
  193. package/dist/PbrReference.js.map +1 -0
  194. package/dist/PostProcessPass.d.ts +439 -0
  195. package/dist/PostProcessPass.d.ts.map +1 -0
  196. package/dist/PostProcessPass.js +1834 -0
  197. package/dist/PostProcessPass.js.map +1 -0
  198. package/dist/ProceduralTextureFixtures.d.ts +27 -0
  199. package/dist/ProceduralTextureFixtures.d.ts.map +1 -0
  200. package/dist/ProceduralTextureFixtures.js +336 -0
  201. package/dist/ProceduralTextureFixtures.js.map +1 -0
  202. package/dist/ProductTurntableFixtures.d.ts +96 -0
  203. package/dist/ProductTurntableFixtures.d.ts.map +1 -0
  204. package/dist/ProductTurntableFixtures.js +559 -0
  205. package/dist/ProductTurntableFixtures.js.map +1 -0
  206. package/dist/Raycaster.d.ts +14 -0
  207. package/dist/Raycaster.d.ts.map +1 -0
  208. package/dist/Raycaster.js +10 -0
  209. package/dist/Raycaster.js.map +1 -0
  210. package/dist/ReflectionProbe.d.ts +8 -0
  211. package/dist/ReflectionProbe.d.ts.map +1 -0
  212. package/dist/ReflectionProbe.js +10 -0
  213. package/dist/ReflectionProbe.js.map +1 -0
  214. package/dist/ReflectionSurfaces.d.ts +35 -0
  215. package/dist/ReflectionSurfaces.d.ts.map +1 -0
  216. package/dist/ReflectionSurfaces.js +155 -0
  217. package/dist/ReflectionSurfaces.js.map +1 -0
  218. package/dist/RenderBackend.d.ts +14 -0
  219. package/dist/RenderBackend.d.ts.map +1 -0
  220. package/dist/RenderBackend.js +33 -0
  221. package/dist/RenderBackend.js.map +1 -0
  222. package/dist/RenderDebugViews.d.ts +26 -0
  223. package/dist/RenderDebugViews.d.ts.map +1 -0
  224. package/dist/RenderDebugViews.js +97 -0
  225. package/dist/RenderDebugViews.js.map +1 -0
  226. package/dist/RenderDevice.d.ts +280 -0
  227. package/dist/RenderDevice.d.ts.map +1 -0
  228. package/dist/RenderDevice.js +561 -0
  229. package/dist/RenderDevice.js.map +1 -0
  230. package/dist/RenderGraph.d.ts +22 -0
  231. package/dist/RenderGraph.d.ts.map +1 -0
  232. package/dist/RenderGraph.js +159 -0
  233. package/dist/RenderGraph.js.map +1 -0
  234. package/dist/RenderPass.d.ts +23 -0
  235. package/dist/RenderPass.d.ts.map +1 -0
  236. package/dist/RenderPass.js +14 -0
  237. package/dist/RenderPass.js.map +1 -0
  238. package/dist/RenderPipeline.d.ts +39 -0
  239. package/dist/RenderPipeline.d.ts.map +1 -0
  240. package/dist/RenderPipeline.js +67 -0
  241. package/dist/RenderPipeline.js.map +1 -0
  242. package/dist/RenderQueue.d.ts +3 -0
  243. package/dist/RenderQueue.d.ts.map +1 -0
  244. package/dist/RenderQueue.js +2 -0
  245. package/dist/RenderQueue.js.map +1 -0
  246. package/dist/RenderState.d.ts +3 -0
  247. package/dist/RenderState.d.ts.map +1 -0
  248. package/dist/RenderState.js +2 -0
  249. package/dist/RenderState.js.map +1 -0
  250. package/dist/Renderer.d.ts +265 -0
  251. package/dist/Renderer.d.ts.map +1 -0
  252. package/dist/Renderer.js +2094 -0
  253. package/dist/Renderer.js.map +1 -0
  254. package/dist/RendererDebugOverlay.d.ts +20 -0
  255. package/dist/RendererDebugOverlay.d.ts.map +1 -0
  256. package/dist/RendererDebugOverlay.js +54 -0
  257. package/dist/RendererDebugOverlay.js.map +1 -0
  258. package/dist/RendererFeatureGates.d.ts +17 -0
  259. package/dist/RendererFeatureGates.d.ts.map +1 -0
  260. package/dist/RendererFeatureGates.js +92 -0
  261. package/dist/RendererFeatureGates.js.map +1 -0
  262. package/dist/RendererPostprocessPlan.d.ts +59 -0
  263. package/dist/RendererPostprocessPlan.d.ts.map +1 -0
  264. package/dist/RendererPostprocessPlan.js +155 -0
  265. package/dist/RendererPostprocessPlan.js.map +1 -0
  266. package/dist/RendererTiming.d.ts +53 -0
  267. package/dist/RendererTiming.d.ts.map +1 -0
  268. package/dist/RendererTiming.js +186 -0
  269. package/dist/RendererTiming.js.map +1 -0
  270. package/dist/RendererVisualPipelineReport.d.ts +224 -0
  271. package/dist/RendererVisualPipelineReport.d.ts.map +1 -0
  272. package/dist/RendererVisualPipelineReport.js +499 -0
  273. package/dist/RendererVisualPipelineReport.js.map +1 -0
  274. package/dist/ResourceLifecycle.d.ts +8 -0
  275. package/dist/ResourceLifecycle.d.ts.map +1 -0
  276. package/dist/ResourceLifecycle.js +18 -0
  277. package/dist/ResourceLifecycle.js.map +1 -0
  278. package/dist/Sampler.d.ts +20 -0
  279. package/dist/Sampler.d.ts.map +1 -0
  280. package/dist/Sampler.js +19 -0
  281. package/dist/Sampler.js.map +1 -0
  282. package/dist/SceneOptimization.d.ts +127 -0
  283. package/dist/SceneOptimization.d.ts.map +1 -0
  284. package/dist/SceneOptimization.js +342 -0
  285. package/dist/SceneOptimization.js.map +1 -0
  286. package/dist/ShaderChunks.d.ts +8 -0
  287. package/dist/ShaderChunks.d.ts.map +1 -0
  288. package/dist/ShaderChunks.js +386 -0
  289. package/dist/ShaderChunks.js.map +1 -0
  290. package/dist/ShaderLibrary.d.ts +63 -0
  291. package/dist/ShaderLibrary.d.ts.map +1 -0
  292. package/dist/ShaderLibrary.js +2707 -0
  293. package/dist/ShaderLibrary.js.map +1 -0
  294. package/dist/ShaderModule.d.ts +14 -0
  295. package/dist/ShaderModule.d.ts.map +1 -0
  296. package/dist/ShaderModule.js +33 -0
  297. package/dist/ShaderModule.js.map +1 -0
  298. package/dist/ShaderPreprocessor.d.ts +19 -0
  299. package/dist/ShaderPreprocessor.d.ts.map +1 -0
  300. package/dist/ShaderPreprocessor.js +212 -0
  301. package/dist/ShaderPreprocessor.js.map +1 -0
  302. package/dist/ShaderReflection.d.ts +23 -0
  303. package/dist/ShaderReflection.d.ts.map +1 -0
  304. package/dist/ShaderReflection.js +134 -0
  305. package/dist/ShaderReflection.js.map +1 -0
  306. package/dist/ShadowMap.d.ts +58 -0
  307. package/dist/ShadowMap.d.ts.map +1 -0
  308. package/dist/ShadowMap.js +183 -0
  309. package/dist/ShadowMap.js.map +1 -0
  310. package/dist/ShadowPass.d.ts +44 -0
  311. package/dist/ShadowPass.d.ts.map +1 -0
  312. package/dist/ShadowPass.js +162 -0
  313. package/dist/ShadowPass.js.map +1 -0
  314. package/dist/ShadowProjection.d.ts +15 -0
  315. package/dist/ShadowProjection.d.ts.map +1 -0
  316. package/dist/ShadowProjection.js +90 -0
  317. package/dist/ShadowProjection.js.map +1 -0
  318. package/dist/SkinnedLitMaterial.d.ts +63 -0
  319. package/dist/SkinnedLitMaterial.d.ts.map +1 -0
  320. package/dist/SkinnedLitMaterial.js +296 -0
  321. package/dist/SkinnedLitMaterial.js.map +1 -0
  322. package/dist/SkinnedUnlitMaterial.d.ts +13 -0
  323. package/dist/SkinnedUnlitMaterial.d.ts.map +1 -0
  324. package/dist/SkinnedUnlitMaterial.js +52 -0
  325. package/dist/SkinnedUnlitMaterial.js.map +1 -0
  326. package/dist/SkinningBounds.d.ts +10 -0
  327. package/dist/SkinningBounds.d.ts.map +1 -0
  328. package/dist/SkinningBounds.js +107 -0
  329. package/dist/SkinningBounds.js.map +1 -0
  330. package/dist/SpaceEnvironmentFixtures.d.ts +59 -0
  331. package/dist/SpaceEnvironmentFixtures.d.ts.map +1 -0
  332. package/dist/SpaceEnvironmentFixtures.js +132 -0
  333. package/dist/SpaceEnvironmentFixtures.js.map +1 -0
  334. package/dist/SpriteGeometry.d.ts +3 -0
  335. package/dist/SpriteGeometry.d.ts.map +1 -0
  336. package/dist/SpriteGeometry.js +21 -0
  337. package/dist/SpriteGeometry.js.map +1 -0
  338. package/dist/StereoCameraRig.d.ts +34 -0
  339. package/dist/StereoCameraRig.d.ts.map +1 -0
  340. package/dist/StereoCameraRig.js +79 -0
  341. package/dist/StereoCameraRig.js.map +1 -0
  342. package/dist/StereoEffects.d.ts +90 -0
  343. package/dist/StereoEffects.d.ts.map +1 -0
  344. package/dist/StereoEffects.js +171 -0
  345. package/dist/StereoEffects.js.map +1 -0
  346. package/dist/TerrainFixtures.d.ts +36 -0
  347. package/dist/TerrainFixtures.d.ts.map +1 -0
  348. package/dist/TerrainFixtures.js +143 -0
  349. package/dist/TerrainFixtures.js.map +1 -0
  350. package/dist/Texture.d.ts +64 -0
  351. package/dist/Texture.d.ts.map +1 -0
  352. package/dist/Texture.js +257 -0
  353. package/dist/Texture.js.map +1 -0
  354. package/dist/TextureBinding.d.ts +38 -0
  355. package/dist/TextureBinding.d.ts.map +1 -0
  356. package/dist/TextureBinding.js +66 -0
  357. package/dist/TextureBinding.js.map +1 -0
  358. package/dist/TexturedPBRMaterial.d.ts +206 -0
  359. package/dist/TexturedPBRMaterial.d.ts.map +1 -0
  360. package/dist/TexturedPBRMaterial.js +842 -0
  361. package/dist/TexturedPBRMaterial.js.map +1 -0
  362. package/dist/TexturedUnlitMaterial.d.ts +19 -0
  363. package/dist/TexturedUnlitMaterial.d.ts.map +1 -0
  364. package/dist/TexturedUnlitMaterial.js +52 -0
  365. package/dist/TexturedUnlitMaterial.js.map +1 -0
  366. package/dist/ToneMapping.d.ts +19 -0
  367. package/dist/ToneMapping.d.ts.map +1 -0
  368. package/dist/ToneMapping.js +53 -0
  369. package/dist/ToneMapping.js.map +1 -0
  370. package/dist/UniformBinder.d.ts +7 -0
  371. package/dist/UniformBinder.d.ts.map +1 -0
  372. package/dist/UniformBinder.js +14 -0
  373. package/dist/UniformBinder.js.map +1 -0
  374. package/dist/UniformLayout.d.ts +19 -0
  375. package/dist/UniformLayout.d.ts.map +1 -0
  376. package/dist/UniformLayout.js +107 -0
  377. package/dist/UniformLayout.js.map +1 -0
  378. package/dist/UnlitMaterial.d.ts +16 -0
  379. package/dist/UnlitMaterial.d.ts.map +1 -0
  380. package/dist/UnlitMaterial.js +60 -0
  381. package/dist/UnlitMaterial.js.map +1 -0
  382. package/dist/VegetationFixtures.d.ts +68 -0
  383. package/dist/VegetationFixtures.d.ts.map +1 -0
  384. package/dist/VegetationFixtures.js +241 -0
  385. package/dist/VegetationFixtures.js.map +1 -0
  386. package/dist/VertexBuffer.d.ts +29 -0
  387. package/dist/VertexBuffer.d.ts.map +1 -0
  388. package/dist/VertexBuffer.js +106 -0
  389. package/dist/VertexBuffer.js.map +1 -0
  390. package/dist/VertexFormat.d.ts +36 -0
  391. package/dist/VertexFormat.d.ts.map +1 -0
  392. package/dist/VertexFormat.js +127 -0
  393. package/dist/VertexFormat.js.map +1 -0
  394. package/dist/VoxelWorldFixtures.d.ts +54 -0
  395. package/dist/VoxelWorldFixtures.d.ts.map +1 -0
  396. package/dist/VoxelWorldFixtures.js +186 -0
  397. package/dist/VoxelWorldFixtures.js.map +1 -0
  398. package/dist/WeatherFixtures.d.ts +46 -0
  399. package/dist/WeatherFixtures.d.ts.map +1 -0
  400. package/dist/WeatherFixtures.js +142 -0
  401. package/dist/WeatherFixtures.js.map +1 -0
  402. package/dist/WebGL2Device.d.ts +137 -0
  403. package/dist/WebGL2Device.d.ts.map +1 -0
  404. package/dist/WebGL2Device.js +2107 -0
  405. package/dist/WebGL2Device.js.map +1 -0
  406. package/dist/WebGL2StateCache.d.ts +89 -0
  407. package/dist/WebGL2StateCache.d.ts.map +1 -0
  408. package/dist/WebGL2StateCache.js +265 -0
  409. package/dist/WebGL2StateCache.js.map +1 -0
  410. package/dist/WebGPUDevice.d.ts +287 -0
  411. package/dist/WebGPUDevice.d.ts.map +1 -0
  412. package/dist/WebGPUDevice.js +2403 -0
  413. package/dist/WebGPUDevice.js.map +1 -0
  414. package/dist/WebGPURenderToTextureProof.d.ts +29 -0
  415. package/dist/WebGPURenderToTextureProof.d.ts.map +1 -0
  416. package/dist/WebGPURenderToTextureProof.js +96 -0
  417. package/dist/WebGPURenderToTextureProof.js.map +1 -0
  418. package/dist/advanced-runtime/AdvancedRenderer.d.ts +23 -0
  419. package/dist/advanced-runtime/AdvancedRenderer.d.ts.map +1 -0
  420. package/dist/advanced-runtime/AdvancedRenderer.js +45 -0
  421. package/dist/advanced-runtime/AdvancedRenderer.js.map +1 -0
  422. package/dist/advanced-runtime/index.d.ts +10 -0
  423. package/dist/advanced-runtime/index.d.ts.map +1 -0
  424. package/dist/advanced-runtime/index.js +9 -0
  425. package/dist/advanced-runtime/index.js.map +1 -0
  426. package/dist/cinematic/BloomPass.d.ts +10 -0
  427. package/dist/cinematic/BloomPass.d.ts.map +1 -0
  428. package/dist/cinematic/BloomPass.js +18 -0
  429. package/dist/cinematic/BloomPass.js.map +1 -0
  430. package/dist/cinematic/CinematicDepthComposition.d.ts +12 -0
  431. package/dist/cinematic/CinematicDepthComposition.d.ts.map +1 -0
  432. package/dist/cinematic/CinematicDepthComposition.js +22 -0
  433. package/dist/cinematic/CinematicDepthComposition.js.map +1 -0
  434. package/dist/cinematic/CinematicEvidence.d.ts +43 -0
  435. package/dist/cinematic/CinematicEvidence.d.ts.map +1 -0
  436. package/dist/cinematic/CinematicEvidence.js +55 -0
  437. package/dist/cinematic/CinematicEvidence.js.map +1 -0
  438. package/dist/cinematic/CinematicLightingRig.d.ts +32 -0
  439. package/dist/cinematic/CinematicLightingRig.d.ts.map +1 -0
  440. package/dist/cinematic/CinematicLightingRig.js +90 -0
  441. package/dist/cinematic/CinematicLightingRig.js.map +1 -0
  442. package/dist/cinematic/CinematicMaterialPresets.d.ts +16 -0
  443. package/dist/cinematic/CinematicMaterialPresets.d.ts.map +1 -0
  444. package/dist/cinematic/CinematicMaterialPresets.js +114 -0
  445. package/dist/cinematic/CinematicMaterialPresets.js.map +1 -0
  446. package/dist/cinematic/CinematicPostProcess.d.ts +25 -0
  447. package/dist/cinematic/CinematicPostProcess.d.ts.map +1 -0
  448. package/dist/cinematic/CinematicPostProcess.js +64 -0
  449. package/dist/cinematic/CinematicPostProcess.js.map +1 -0
  450. package/dist/cinematic/DepthHazePass.d.ts +12 -0
  451. package/dist/cinematic/DepthHazePass.d.ts.map +1 -0
  452. package/dist/cinematic/DepthHazePass.js +20 -0
  453. package/dist/cinematic/DepthHazePass.js.map +1 -0
  454. package/dist/cinematic/EmissivePracticalLightSystem.d.ts +18 -0
  455. package/dist/cinematic/EmissivePracticalLightSystem.d.ts.map +1 -0
  456. package/dist/cinematic/EmissivePracticalLightSystem.js +25 -0
  457. package/dist/cinematic/EmissivePracticalLightSystem.js.map +1 -0
  458. package/dist/cinematic/FilmGrainPass.d.ts +9 -0
  459. package/dist/cinematic/FilmGrainPass.d.ts.map +1 -0
  460. package/dist/cinematic/FilmGrainPass.js +17 -0
  461. package/dist/cinematic/FilmGrainPass.js.map +1 -0
  462. package/dist/cinematic/FogVolumeSystem.d.ts +12 -0
  463. package/dist/cinematic/FogVolumeSystem.d.ts.map +1 -0
  464. package/dist/cinematic/FogVolumeSystem.js +20 -0
  465. package/dist/cinematic/FogVolumeSystem.js.map +1 -0
  466. package/dist/cinematic/GlowCardSystem.d.ts +17 -0
  467. package/dist/cinematic/GlowCardSystem.d.ts.map +1 -0
  468. package/dist/cinematic/GlowCardSystem.js +28 -0
  469. package/dist/cinematic/GlowCardSystem.js.map +1 -0
  470. package/dist/cinematic/RainParticleSystem.d.ts +22 -0
  471. package/dist/cinematic/RainParticleSystem.d.ts.map +1 -0
  472. package/dist/cinematic/RainParticleSystem.js +114 -0
  473. package/dist/cinematic/RainParticleSystem.js.map +1 -0
  474. package/dist/cinematic/VignettePass.d.ts +10 -0
  475. package/dist/cinematic/VignettePass.d.ts.map +1 -0
  476. package/dist/cinematic/VignettePass.js +17 -0
  477. package/dist/cinematic/VignettePass.js.map +1 -0
  478. package/dist/cinematic/WetReflectionApproximation.d.ts +13 -0
  479. package/dist/cinematic/WetReflectionApproximation.d.ts.map +1 -0
  480. package/dist/cinematic/WetReflectionApproximation.js +18 -0
  481. package/dist/cinematic/WetReflectionApproximation.js.map +1 -0
  482. package/dist/cinematic/index.d.ts +15 -0
  483. package/dist/cinematic/index.d.ts.map +1 -0
  484. package/dist/cinematic/index.js +15 -0
  485. package/dist/cinematic/index.js.map +1 -0
  486. package/dist/effects/CollisionModule.d.ts +15 -0
  487. package/dist/effects/CollisionModule.d.ts.map +1 -0
  488. package/dist/effects/CollisionModule.js +46 -0
  489. package/dist/effects/CollisionModule.js.map +1 -0
  490. package/dist/effects/ColorModule.d.ts +15 -0
  491. package/dist/effects/ColorModule.d.ts.map +1 -0
  492. package/dist/effects/ColorModule.js +45 -0
  493. package/dist/effects/ColorModule.js.map +1 -0
  494. package/dist/effects/ForceModule.d.ts +11 -0
  495. package/dist/effects/ForceModule.d.ts.map +1 -0
  496. package/dist/effects/ForceModule.js +17 -0
  497. package/dist/effects/ForceModule.js.map +1 -0
  498. package/dist/effects/GPUParticleBackend.d.ts +153 -0
  499. package/dist/effects/GPUParticleBackend.d.ts.map +1 -0
  500. package/dist/effects/GPUParticleBackend.js +397 -0
  501. package/dist/effects/GPUParticleBackend.js.map +1 -0
  502. package/dist/effects/Particle.d.ts +49 -0
  503. package/dist/effects/Particle.d.ts.map +1 -0
  504. package/dist/effects/Particle.js +56 -0
  505. package/dist/effects/Particle.js.map +1 -0
  506. package/dist/effects/ParticleDiagnostics.d.ts +58 -0
  507. package/dist/effects/ParticleDiagnostics.d.ts.map +1 -0
  508. package/dist/effects/ParticleDiagnostics.js +145 -0
  509. package/dist/effects/ParticleDiagnostics.js.map +1 -0
  510. package/dist/effects/ParticleEffectPresets.d.ts +8 -0
  511. package/dist/effects/ParticleEffectPresets.d.ts.map +1 -0
  512. package/dist/effects/ParticleEffectPresets.js +137 -0
  513. package/dist/effects/ParticleEffectPresets.js.map +1 -0
  514. package/dist/effects/ParticleEmitter.d.ts +87 -0
  515. package/dist/effects/ParticleEmitter.d.ts.map +1 -0
  516. package/dist/effects/ParticleEmitter.js +254 -0
  517. package/dist/effects/ParticleEmitter.js.map +1 -0
  518. package/dist/effects/ParticleModule.d.ts +15 -0
  519. package/dist/effects/ParticleModule.d.ts.map +1 -0
  520. package/dist/effects/ParticleModule.js +6 -0
  521. package/dist/effects/ParticleModule.js.map +1 -0
  522. package/dist/effects/ParticleRenderPass.d.ts +35 -0
  523. package/dist/effects/ParticleRenderPass.d.ts.map +1 -0
  524. package/dist/effects/ParticleRenderPass.js +91 -0
  525. package/dist/effects/ParticleRenderPass.js.map +1 -0
  526. package/dist/effects/ParticleRenderer.d.ts +34 -0
  527. package/dist/effects/ParticleRenderer.d.ts.map +1 -0
  528. package/dist/effects/ParticleRenderer.js +93 -0
  529. package/dist/effects/ParticleRenderer.js.map +1 -0
  530. package/dist/effects/ParticleSystem.d.ts +51 -0
  531. package/dist/effects/ParticleSystem.d.ts.map +1 -0
  532. package/dist/effects/ParticleSystem.js +261 -0
  533. package/dist/effects/ParticleSystem.js.map +1 -0
  534. package/dist/effects/SizeModule.d.ts +14 -0
  535. package/dist/effects/SizeModule.d.ts.map +1 -0
  536. package/dist/effects/SizeModule.js +42 -0
  537. package/dist/effects/SizeModule.js.map +1 -0
  538. package/dist/effects/TrailModule.d.ts +22 -0
  539. package/dist/effects/TrailModule.d.ts.map +1 -0
  540. package/dist/effects/TrailModule.js +50 -0
  541. package/dist/effects/TrailModule.js.map +1 -0
  542. package/dist/effects/VelocityModule.d.ts +15 -0
  543. package/dist/effects/VelocityModule.d.ts.map +1 -0
  544. package/dist/effects/VelocityModule.js +57 -0
  545. package/dist/effects/VelocityModule.js.map +1 -0
  546. package/dist/effects/index.d.ts +16 -0
  547. package/dist/effects/index.d.ts.map +1 -0
  548. package/dist/effects/index.js +16 -0
  549. package/dist/effects/index.js.map +1 -0
  550. package/dist/index.d.ts +260 -0
  551. package/dist/index.d.ts.map +1 -0
  552. package/dist/index.js +155 -0
  553. package/dist/index.js.map +1 -0
  554. package/dist/materials/AlphaSorting.d.ts +8 -0
  555. package/dist/materials/AlphaSorting.d.ts.map +1 -0
  556. package/dist/materials/AlphaSorting.js +26 -0
  557. package/dist/materials/AlphaSorting.js.map +1 -0
  558. package/dist/materials/MaterialExtensions.d.ts +10 -0
  559. package/dist/materials/MaterialExtensions.d.ts.map +1 -0
  560. package/dist/materials/MaterialExtensions.js +20 -0
  561. package/dist/materials/MaterialExtensions.js.map +1 -0
  562. package/dist/materials/PhysicalMaterial.d.ts +36 -0
  563. package/dist/materials/PhysicalMaterial.d.ts.map +1 -0
  564. package/dist/materials/PhysicalMaterial.js +79 -0
  565. package/dist/materials/PhysicalMaterial.js.map +1 -0
  566. package/dist/materials/TransmissionPass.d.ts +16 -0
  567. package/dist/materials/TransmissionPass.d.ts.map +1 -0
  568. package/dist/materials/TransmissionPass.js +30 -0
  569. package/dist/materials/TransmissionPass.js.map +1 -0
  570. package/dist/performance/BVH.d.ts +3 -0
  571. package/dist/performance/BVH.d.ts.map +1 -0
  572. package/dist/performance/BVH.js +2 -0
  573. package/dist/performance/BVH.js.map +1 -0
  574. package/dist/performance/Batcher.d.ts +3 -0
  575. package/dist/performance/Batcher.d.ts.map +1 -0
  576. package/dist/performance/Batcher.js +2 -0
  577. package/dist/performance/Batcher.js.map +1 -0
  578. package/dist/performance/FrustumCuller.d.ts +3 -0
  579. package/dist/performance/FrustumCuller.d.ts.map +1 -0
  580. package/dist/performance/FrustumCuller.js +5 -0
  581. package/dist/performance/FrustumCuller.js.map +1 -0
  582. package/dist/performance/LOD.d.ts +8 -0
  583. package/dist/performance/LOD.d.ts.map +1 -0
  584. package/dist/performance/LOD.js +15 -0
  585. package/dist/performance/LOD.js.map +1 -0
  586. package/dist/performance/Octree.d.ts +7 -0
  587. package/dist/performance/Octree.d.ts.map +1 -0
  588. package/dist/performance/Octree.js +4 -0
  589. package/dist/performance/Octree.js.map +1 -0
  590. package/dist/performance/RenderItemSorting.d.ts +43 -0
  591. package/dist/performance/RenderItemSorting.d.ts.map +1 -0
  592. package/dist/performance/RenderItemSorting.js +111 -0
  593. package/dist/performance/RenderItemSorting.js.map +1 -0
  594. package/dist/performance/RendererStats.d.ts +23 -0
  595. package/dist/performance/RendererStats.d.ts.map +1 -0
  596. package/dist/performance/RendererStats.js +23 -0
  597. package/dist/performance/RendererStats.js.map +1 -0
  598. package/dist/performance/ResourceBudget.d.ts +19 -0
  599. package/dist/performance/ResourceBudget.d.ts.map +1 -0
  600. package/dist/performance/ResourceBudget.js +21 -0
  601. package/dist/performance/ResourceBudget.js.map +1 -0
  602. package/dist/postprocess/BloomPass.d.ts +11 -0
  603. package/dist/postprocess/BloomPass.d.ts.map +1 -0
  604. package/dist/postprocess/BloomPass.js +14 -0
  605. package/dist/postprocess/BloomPass.js.map +1 -0
  606. package/dist/postprocess/CinematicDiagnostics.d.ts +112 -0
  607. package/dist/postprocess/CinematicDiagnostics.d.ts.map +1 -0
  608. package/dist/postprocess/CinematicDiagnostics.js +492 -0
  609. package/dist/postprocess/CinematicDiagnostics.js.map +1 -0
  610. package/dist/postprocess/ColorGradingPass.d.ts +4 -0
  611. package/dist/postprocess/ColorGradingPass.d.ts.map +1 -0
  612. package/dist/postprocess/ColorGradingPass.js +15 -0
  613. package/dist/postprocess/ColorGradingPass.js.map +1 -0
  614. package/dist/postprocess/DepthOfFieldPass.d.ts +3 -0
  615. package/dist/postprocess/DepthOfFieldPass.d.ts.map +1 -0
  616. package/dist/postprocess/DepthOfFieldPass.js +7 -0
  617. package/dist/postprocess/DepthOfFieldPass.js.map +1 -0
  618. package/dist/postprocess/EffectComposer.d.ts +110 -0
  619. package/dist/postprocess/EffectComposer.d.ts.map +1 -0
  620. package/dist/postprocess/EffectComposer.js +249 -0
  621. package/dist/postprocess/EffectComposer.js.map +1 -0
  622. package/dist/postprocess/SSAOPass.d.ts +6 -0
  623. package/dist/postprocess/SSAOPass.d.ts.map +1 -0
  624. package/dist/postprocess/SSAOPass.js +18 -0
  625. package/dist/postprocess/SSAOPass.js.map +1 -0
  626. package/dist/postprocess/index.d.ts +11 -0
  627. package/dist/postprocess/index.d.ts.map +1 -0
  628. package/dist/postprocess/index.js +7 -0
  629. package/dist/postprocess/index.js.map +1 -0
  630. package/dist/production-runtime/AnimationControlsPipeline.d.ts +37 -0
  631. package/dist/production-runtime/AnimationControlsPipeline.d.ts.map +1 -0
  632. package/dist/production-runtime/AnimationControlsPipeline.js +41 -0
  633. package/dist/production-runtime/AnimationControlsPipeline.js.map +1 -0
  634. package/dist/production-runtime/PBRHDRPipeline.d.ts +81 -0
  635. package/dist/production-runtime/PBRHDRPipeline.d.ts.map +1 -0
  636. package/dist/production-runtime/PBRHDRPipeline.js +279 -0
  637. package/dist/production-runtime/PBRHDRPipeline.js.map +1 -0
  638. package/dist/production-runtime/ProductionEffectsPipeline.d.ts +20 -0
  639. package/dist/production-runtime/ProductionEffectsPipeline.d.ts.map +1 -0
  640. package/dist/production-runtime/ProductionEffectsPipeline.js +65 -0
  641. package/dist/production-runtime/ProductionEffectsPipeline.js.map +1 -0
  642. package/dist/production-runtime/ProductionRendererTypes.d.ts +97 -0
  643. package/dist/production-runtime/ProductionRendererTypes.d.ts.map +1 -0
  644. package/dist/production-runtime/ProductionRendererTypes.js +29 -0
  645. package/dist/production-runtime/ProductionRendererTypes.js.map +1 -0
  646. package/dist/production-runtime/ProductionRuntimeRenderer.d.ts +36 -0
  647. package/dist/production-runtime/ProductionRuntimeRenderer.d.ts.map +1 -0
  648. package/dist/production-runtime/ProductionRuntimeRenderer.js +124 -0
  649. package/dist/production-runtime/ProductionRuntimeRenderer.js.map +1 -0
  650. package/dist/production-runtime/ProductionWebGL2Renderer.d.ts +51 -0
  651. package/dist/production-runtime/ProductionWebGL2Renderer.d.ts.map +1 -0
  652. package/dist/production-runtime/ProductionWebGL2Renderer.js +269 -0
  653. package/dist/production-runtime/ProductionWebGL2Renderer.js.map +1 -0
  654. package/dist/production-runtime/ProductionWebGPURenderer.d.ts +69 -0
  655. package/dist/production-runtime/ProductionWebGPURenderer.d.ts.map +1 -0
  656. package/dist/production-runtime/ProductionWebGPURenderer.js +313 -0
  657. package/dist/production-runtime/ProductionWebGPURenderer.js.map +1 -0
  658. package/dist/production-runtime/TransmissionBackdropCapture.d.ts +11 -0
  659. package/dist/production-runtime/TransmissionBackdropCapture.d.ts.map +1 -0
  660. package/dist/production-runtime/TransmissionBackdropCapture.js +119 -0
  661. package/dist/production-runtime/TransmissionBackdropCapture.js.map +1 -0
  662. package/dist/production-runtime/animation/MorphTargetRenderer.d.ts +7 -0
  663. package/dist/production-runtime/animation/MorphTargetRenderer.d.ts.map +1 -0
  664. package/dist/production-runtime/animation/MorphTargetRenderer.js +2 -0
  665. package/dist/production-runtime/animation/MorphTargetRenderer.js.map +1 -0
  666. package/dist/production-runtime/animation/SkinningRenderer.d.ts +7 -0
  667. package/dist/production-runtime/animation/SkinningRenderer.d.ts.map +1 -0
  668. package/dist/production-runtime/animation/SkinningRenderer.js +2 -0
  669. package/dist/production-runtime/animation/SkinningRenderer.js.map +1 -0
  670. package/dist/production-runtime/backends/RendererBackend.d.ts +16 -0
  671. package/dist/production-runtime/backends/RendererBackend.d.ts.map +1 -0
  672. package/dist/production-runtime/backends/RendererBackend.js +2 -0
  673. package/dist/production-runtime/backends/RendererBackend.js.map +1 -0
  674. package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts +15 -0
  675. package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts.map +1 -0
  676. package/dist/production-runtime/backends/WebGL2RendererBackend.js +25 -0
  677. package/dist/production-runtime/backends/WebGL2RendererBackend.js.map +1 -0
  678. package/dist/production-runtime/backends/WebGPURendererBackend.d.ts +20 -0
  679. package/dist/production-runtime/backends/WebGPURendererBackend.d.ts.map +1 -0
  680. package/dist/production-runtime/backends/WebGPURendererBackend.js +19 -0
  681. package/dist/production-runtime/backends/WebGPURendererBackend.js.map +1 -0
  682. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts +11 -0
  683. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts.map +1 -0
  684. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js +8 -0
  685. package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js.map +1 -0
  686. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts +11 -0
  687. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts.map +1 -0
  688. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js +8 -0
  689. package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js.map +1 -0
  690. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts +11 -0
  691. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts.map +1 -0
  692. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js +8 -0
  693. package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js.map +1 -0
  694. package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts +11 -0
  695. package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts.map +1 -0
  696. package/dist/production-runtime/backends/webgl2/WebGL2Shader.js +8 -0
  697. package/dist/production-runtime/backends/webgl2/WebGL2Shader.js.map +1 -0
  698. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts +2 -0
  699. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts.map +1 -0
  700. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js +2 -0
  701. package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js.map +1 -0
  702. package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts +11 -0
  703. package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts.map +1 -0
  704. package/dist/production-runtime/backends/webgl2/WebGL2Texture.js +8 -0
  705. package/dist/production-runtime/backends/webgl2/WebGL2Texture.js.map +1 -0
  706. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts +11 -0
  707. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts.map +1 -0
  708. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js +8 -0
  709. package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js.map +1 -0
  710. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts +11 -0
  711. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts.map +1 -0
  712. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js +8 -0
  713. package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js.map +1 -0
  714. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts +11 -0
  715. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts.map +1 -0
  716. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js +8 -0
  717. package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js.map +1 -0
  718. package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts +11 -0
  719. package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts.map +1 -0
  720. package/dist/production-runtime/backends/webgpu/WebGPUShader.js +8 -0
  721. package/dist/production-runtime/backends/webgpu/WebGPUShader.js.map +1 -0
  722. package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts +11 -0
  723. package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts.map +1 -0
  724. package/dist/production-runtime/backends/webgpu/WebGPUTexture.js +8 -0
  725. package/dist/production-runtime/backends/webgpu/WebGPUTexture.js.map +1 -0
  726. package/dist/production-runtime/color/ColorManagement.d.ts +4 -0
  727. package/dist/production-runtime/color/ColorManagement.d.ts.map +1 -0
  728. package/dist/production-runtime/color/ColorManagement.js +3 -0
  729. package/dist/production-runtime/color/ColorManagement.js.map +1 -0
  730. package/dist/production-runtime/color/ToneMapping.d.ts +3 -0
  731. package/dist/production-runtime/color/ToneMapping.d.ts.map +1 -0
  732. package/dist/production-runtime/color/ToneMapping.js +9 -0
  733. package/dist/production-runtime/color/ToneMapping.js.map +1 -0
  734. package/dist/production-runtime/diagnostics/FrameCapture.d.ts +7 -0
  735. package/dist/production-runtime/diagnostics/FrameCapture.d.ts.map +1 -0
  736. package/dist/production-runtime/diagnostics/FrameCapture.js +2 -0
  737. package/dist/production-runtime/diagnostics/FrameCapture.js.map +1 -0
  738. package/dist/production-runtime/diagnostics/GPUCapabilities.d.ts +9 -0
  739. package/dist/production-runtime/diagnostics/GPUCapabilities.d.ts.map +1 -0
  740. package/dist/production-runtime/diagnostics/GPUCapabilities.js +2 -0
  741. package/dist/production-runtime/diagnostics/GPUCapabilities.js.map +1 -0
  742. package/dist/production-runtime/diagnostics/RendererStats.d.ts +9 -0
  743. package/dist/production-runtime/diagnostics/RendererStats.d.ts.map +1 -0
  744. package/dist/production-runtime/diagnostics/RendererStats.js +2 -0
  745. package/dist/production-runtime/diagnostics/RendererStats.js.map +1 -0
  746. package/dist/production-runtime/environment/EnvironmentMap.d.ts +8 -0
  747. package/dist/production-runtime/environment/EnvironmentMap.d.ts.map +1 -0
  748. package/dist/production-runtime/environment/EnvironmentMap.js +2 -0
  749. package/dist/production-runtime/environment/EnvironmentMap.js.map +1 -0
  750. package/dist/production-runtime/environment/HDRLoader.d.ts +19 -0
  751. package/dist/production-runtime/environment/HDRLoader.d.ts.map +1 -0
  752. package/dist/production-runtime/environment/HDRLoader.js +22 -0
  753. package/dist/production-runtime/environment/HDRLoader.js.map +1 -0
  754. package/dist/production-runtime/environment/PMREMGenerator.d.ts +99 -0
  755. package/dist/production-runtime/environment/PMREMGenerator.d.ts.map +1 -0
  756. package/dist/production-runtime/environment/PMREMGenerator.js +534 -0
  757. package/dist/production-runtime/environment/PMREMGenerator.js.map +1 -0
  758. package/dist/production-runtime/framegraph/FrameGraph.d.ts +8 -0
  759. package/dist/production-runtime/framegraph/FrameGraph.d.ts.map +1 -0
  760. package/dist/production-runtime/framegraph/FrameGraph.js +14 -0
  761. package/dist/production-runtime/framegraph/FrameGraph.js.map +1 -0
  762. package/dist/production-runtime/framegraph/RenderPass.d.ts +14 -0
  763. package/dist/production-runtime/framegraph/RenderPass.d.ts.map +1 -0
  764. package/dist/production-runtime/framegraph/RenderPass.js +2 -0
  765. package/dist/production-runtime/framegraph/RenderPass.js.map +1 -0
  766. package/dist/production-runtime/geometry/ProjectedDecalGeometry.d.ts +53 -0
  767. package/dist/production-runtime/geometry/ProjectedDecalGeometry.d.ts.map +1 -0
  768. package/dist/production-runtime/geometry/ProjectedDecalGeometry.js +340 -0
  769. package/dist/production-runtime/geometry/ProjectedDecalGeometry.js.map +1 -0
  770. package/dist/production-runtime/index.d.ts +73 -0
  771. package/dist/production-runtime/index.d.ts.map +1 -0
  772. package/dist/production-runtime/index.js +67 -0
  773. package/dist/production-runtime/index.js.map +1 -0
  774. package/dist/production-runtime/lights/LightManager.d.ts +8 -0
  775. package/dist/production-runtime/lights/LightManager.d.ts.map +1 -0
  776. package/dist/production-runtime/lights/LightManager.js +7 -0
  777. package/dist/production-runtime/lights/LightManager.js.map +1 -0
  778. package/dist/production-runtime/lights/ShadowMapRenderer.d.ts +8 -0
  779. package/dist/production-runtime/lights/ShadowMapRenderer.d.ts.map +1 -0
  780. package/dist/production-runtime/lights/ShadowMapRenderer.js +4 -0
  781. package/dist/production-runtime/lights/ShadowMapRenderer.js.map +1 -0
  782. package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts +14 -0
  783. package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts.map +1 -0
  784. package/dist/production-runtime/materials/GLTFMaterialAdapter.js +5 -0
  785. package/dist/production-runtime/materials/GLTFMaterialAdapter.js.map +1 -0
  786. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts +3 -0
  787. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts.map +1 -0
  788. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js +2 -0
  789. package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js.map +1 -0
  790. package/dist/production-runtime/materials/MaterialCompiler.d.ts +9 -0
  791. package/dist/production-runtime/materials/MaterialCompiler.d.ts.map +1 -0
  792. package/dist/production-runtime/materials/MaterialCompiler.js +5 -0
  793. package/dist/production-runtime/materials/MaterialCompiler.js.map +1 -0
  794. package/dist/production-runtime/materials/MaterialTextureBindings.d.ts +8 -0
  795. package/dist/production-runtime/materials/MaterialTextureBindings.d.ts.map +1 -0
  796. package/dist/production-runtime/materials/MaterialTextureBindings.js +4 -0
  797. package/dist/production-runtime/materials/MaterialTextureBindings.js.map +1 -0
  798. package/dist/production-runtime/materials/PBRMaterial.d.ts +23 -0
  799. package/dist/production-runtime/materials/PBRMaterial.d.ts.map +1 -0
  800. package/dist/production-runtime/materials/PBRMaterial.js +2 -0
  801. package/dist/production-runtime/materials/PBRMaterial.js.map +1 -0
  802. package/dist/production-runtime/materials/PBRShaderFeatures.d.ts +13 -0
  803. package/dist/production-runtime/materials/PBRShaderFeatures.d.ts.map +1 -0
  804. package/dist/production-runtime/materials/PBRShaderFeatures.js +2 -0
  805. package/dist/production-runtime/materials/PBRShaderFeatures.js.map +1 -0
  806. package/dist/production-runtime/passes/ContactShadowPass.d.ts +40 -0
  807. package/dist/production-runtime/passes/ContactShadowPass.d.ts.map +1 -0
  808. package/dist/production-runtime/passes/ContactShadowPass.js +126 -0
  809. package/dist/production-runtime/passes/ContactShadowPass.js.map +1 -0
  810. package/dist/production-runtime/passes/DepthPrepass.d.ts +8 -0
  811. package/dist/production-runtime/passes/DepthPrepass.d.ts.map +1 -0
  812. package/dist/production-runtime/passes/DepthPrepass.js +7 -0
  813. package/dist/production-runtime/passes/DepthPrepass.js.map +1 -0
  814. package/dist/production-runtime/passes/OpaquePass.d.ts +8 -0
  815. package/dist/production-runtime/passes/OpaquePass.d.ts.map +1 -0
  816. package/dist/production-runtime/passes/OpaquePass.js +7 -0
  817. package/dist/production-runtime/passes/OpaquePass.js.map +1 -0
  818. package/dist/production-runtime/passes/ShadowPass.d.ts +8 -0
  819. package/dist/production-runtime/passes/ShadowPass.d.ts.map +1 -0
  820. package/dist/production-runtime/passes/ShadowPass.js +7 -0
  821. package/dist/production-runtime/passes/ShadowPass.js.map +1 -0
  822. package/dist/production-runtime/passes/SkyboxPass.d.ts +8 -0
  823. package/dist/production-runtime/passes/SkyboxPass.d.ts.map +1 -0
  824. package/dist/production-runtime/passes/SkyboxPass.js +7 -0
  825. package/dist/production-runtime/passes/SkyboxPass.js.map +1 -0
  826. package/dist/production-runtime/passes/ToneMappingPass.d.ts +8 -0
  827. package/dist/production-runtime/passes/ToneMappingPass.d.ts.map +1 -0
  828. package/dist/production-runtime/passes/ToneMappingPass.js +7 -0
  829. package/dist/production-runtime/passes/ToneMappingPass.js.map +1 -0
  830. package/dist/production-runtime/passes/TransparentPass.d.ts +8 -0
  831. package/dist/production-runtime/passes/TransparentPass.d.ts.map +1 -0
  832. package/dist/production-runtime/passes/TransparentPass.js +7 -0
  833. package/dist/production-runtime/passes/TransparentPass.js.map +1 -0
  834. package/dist/production-runtime/postprocess/BloomPass.d.ts +15 -0
  835. package/dist/production-runtime/postprocess/BloomPass.d.ts.map +1 -0
  836. package/dist/production-runtime/postprocess/BloomPass.js +37 -0
  837. package/dist/production-runtime/postprocess/BloomPass.js.map +1 -0
  838. package/dist/production-runtime/postprocess/ColorGradingPass.d.ts +16 -0
  839. package/dist/production-runtime/postprocess/ColorGradingPass.d.ts.map +1 -0
  840. package/dist/production-runtime/postprocess/ColorGradingPass.js +34 -0
  841. package/dist/production-runtime/postprocess/ColorGradingPass.js.map +1 -0
  842. package/dist/production-runtime/postprocess/DOFPass.d.ts +16 -0
  843. package/dist/production-runtime/postprocess/DOFPass.d.ts.map +1 -0
  844. package/dist/production-runtime/postprocess/DOFPass.js +31 -0
  845. package/dist/production-runtime/postprocess/DOFPass.js.map +1 -0
  846. package/dist/production-runtime/postprocess/FXAAPass.d.ts +16 -0
  847. package/dist/production-runtime/postprocess/FXAAPass.d.ts.map +1 -0
  848. package/dist/production-runtime/postprocess/FXAAPass.js +39 -0
  849. package/dist/production-runtime/postprocess/FXAAPass.js.map +1 -0
  850. package/dist/production-runtime/postprocess/ProductionEffectComposer.d.ts +21 -0
  851. package/dist/production-runtime/postprocess/ProductionEffectComposer.d.ts.map +1 -0
  852. package/dist/production-runtime/postprocess/ProductionEffectComposer.js +53 -0
  853. package/dist/production-runtime/postprocess/ProductionEffectComposer.js.map +1 -0
  854. package/dist/production-runtime/postprocess/ProductionPostProcessTypes.d.ts +37 -0
  855. package/dist/production-runtime/postprocess/ProductionPostProcessTypes.d.ts.map +1 -0
  856. package/dist/production-runtime/postprocess/ProductionPostProcessTypes.js +124 -0
  857. package/dist/production-runtime/postprocess/ProductionPostProcessTypes.js.map +1 -0
  858. package/dist/production-runtime/postprocess/SSAOPass.d.ts +15 -0
  859. package/dist/production-runtime/postprocess/SSAOPass.d.ts.map +1 -0
  860. package/dist/production-runtime/postprocess/SSAOPass.js +30 -0
  861. package/dist/production-runtime/postprocess/SSAOPass.js.map +1 -0
  862. package/dist/production-runtime/resources/GPUBuffer.d.ts +10 -0
  863. package/dist/production-runtime/resources/GPUBuffer.d.ts.map +1 -0
  864. package/dist/production-runtime/resources/GPUBuffer.js +7 -0
  865. package/dist/production-runtime/resources/GPUBuffer.js.map +1 -0
  866. package/dist/production-runtime/resources/GPUTexture.d.ts +12 -0
  867. package/dist/production-runtime/resources/GPUTexture.d.ts.map +1 -0
  868. package/dist/production-runtime/resources/GPUTexture.js +7 -0
  869. package/dist/production-runtime/resources/GPUTexture.js.map +1 -0
  870. package/dist/production-runtime/resources/RenderTarget.d.ts +11 -0
  871. package/dist/production-runtime/resources/RenderTarget.d.ts.map +1 -0
  872. package/dist/production-runtime/resources/RenderTarget.js +7 -0
  873. package/dist/production-runtime/resources/RenderTarget.js.map +1 -0
  874. package/dist/production-runtime/resources/ResourceCache.d.ts +8 -0
  875. package/dist/production-runtime/resources/ResourceCache.d.ts.map +1 -0
  876. package/dist/production-runtime/resources/ResourceCache.js +8 -0
  877. package/dist/production-runtime/resources/ResourceCache.js.map +1 -0
  878. package/dist/production-runtime/scene/Camera.d.ts +8 -0
  879. package/dist/production-runtime/scene/Camera.d.ts.map +1 -0
  880. package/dist/production-runtime/scene/Camera.js +2 -0
  881. package/dist/production-runtime/scene/Camera.js.map +1 -0
  882. package/dist/production-runtime/scene/Lights.d.ts +9 -0
  883. package/dist/production-runtime/scene/Lights.d.ts.map +1 -0
  884. package/dist/production-runtime/scene/Lights.js +2 -0
  885. package/dist/production-runtime/scene/Lights.js.map +1 -0
  886. package/dist/production-runtime/scene/RenderableMesh.d.ts +8 -0
  887. package/dist/production-runtime/scene/RenderableMesh.d.ts.map +1 -0
  888. package/dist/production-runtime/scene/RenderableMesh.js +2 -0
  889. package/dist/production-runtime/scene/RenderableMesh.js.map +1 -0
  890. package/dist/production-runtime/scene/RenderablePrimitive.d.ts +8 -0
  891. package/dist/production-runtime/scene/RenderablePrimitive.d.ts.map +1 -0
  892. package/dist/production-runtime/scene/RenderablePrimitive.js +2 -0
  893. package/dist/production-runtime/scene/RenderablePrimitive.js.map +1 -0
  894. package/dist/production-runtime/scene/RenderableScene.d.ts +11 -0
  895. package/dist/production-runtime/scene/RenderableScene.d.ts.map +1 -0
  896. package/dist/production-runtime/scene/RenderableScene.js +2 -0
  897. package/dist/production-runtime/scene/RenderableScene.js.map +1 -0
  898. package/dist/production-runtime/shaders/ShaderProgramLibrary.d.ts +12 -0
  899. package/dist/production-runtime/shaders/ShaderProgramLibrary.d.ts.map +1 -0
  900. package/dist/production-runtime/shaders/ShaderProgramLibrary.js +7 -0
  901. package/dist/production-runtime/shaders/ShaderProgramLibrary.js.map +1 -0
  902. package/dist/shadows/CascadedShadowPipeline.d.ts +25 -0
  903. package/dist/shadows/CascadedShadowPipeline.d.ts.map +1 -0
  904. package/dist/shadows/CascadedShadowPipeline.js +31 -0
  905. package/dist/shadows/CascadedShadowPipeline.js.map +1 -0
  906. package/dist/shadows/ContactShadows.d.ts +37 -0
  907. package/dist/shadows/ContactShadows.d.ts.map +1 -0
  908. package/dist/shadows/ContactShadows.js +68 -0
  909. package/dist/shadows/ContactShadows.js.map +1 -0
  910. package/dist/shadows/ShadowDebugViews.d.ts +12 -0
  911. package/dist/shadows/ShadowDebugViews.d.ts.map +1 -0
  912. package/dist/shadows/ShadowDebugViews.js +35 -0
  913. package/dist/shadows/ShadowDebugViews.js.map +1 -0
  914. package/dist/threejs-compatibility/InstancingSystem.d.ts +10 -0
  915. package/dist/threejs-compatibility/InstancingSystem.d.ts.map +1 -0
  916. package/dist/threejs-compatibility/InstancingSystem.js +11 -0
  917. package/dist/threejs-compatibility/InstancingSystem.js.map +1 -0
  918. package/dist/threejs-compatibility/LightingSystem.d.ts +11 -0
  919. package/dist/threejs-compatibility/LightingSystem.d.ts.map +1 -0
  920. package/dist/threejs-compatibility/LightingSystem.js +14 -0
  921. package/dist/threejs-compatibility/LightingSystem.js.map +1 -0
  922. package/dist/threejs-compatibility/MaterialSystem.d.ts +6 -0
  923. package/dist/threejs-compatibility/MaterialSystem.d.ts.map +1 -0
  924. package/dist/threejs-compatibility/MaterialSystem.js +7 -0
  925. package/dist/threejs-compatibility/MaterialSystem.js.map +1 -0
  926. package/dist/threejs-compatibility/RenderTargetSystem.d.ts +16 -0
  927. package/dist/threejs-compatibility/RenderTargetSystem.d.ts.map +1 -0
  928. package/dist/threejs-compatibility/RenderTargetSystem.js +23 -0
  929. package/dist/threejs-compatibility/RenderTargetSystem.js.map +1 -0
  930. package/dist/threejs-compatibility/RendererDiagnostics.d.ts +27 -0
  931. package/dist/threejs-compatibility/RendererDiagnostics.d.ts.map +1 -0
  932. package/dist/threejs-compatibility/RendererDiagnostics.js +41 -0
  933. package/dist/threejs-compatibility/RendererDiagnostics.js.map +1 -0
  934. package/dist/threejs-compatibility/SceneRenderer.d.ts +19 -0
  935. package/dist/threejs-compatibility/SceneRenderer.d.ts.map +1 -0
  936. package/dist/threejs-compatibility/SceneRenderer.js +18 -0
  937. package/dist/threejs-compatibility/SceneRenderer.js.map +1 -0
  938. package/dist/threejs-compatibility/ShadowSystem.d.ts +11 -0
  939. package/dist/threejs-compatibility/ShadowSystem.d.ts.map +1 -0
  940. package/dist/threejs-compatibility/ShadowSystem.js +12 -0
  941. package/dist/threejs-compatibility/ShadowSystem.js.map +1 -0
  942. package/dist/threejs-compatibility/TextureSystem.d.ts +9 -0
  943. package/dist/threejs-compatibility/TextureSystem.d.ts.map +1 -0
  944. package/dist/threejs-compatibility/TextureSystem.js +14 -0
  945. package/dist/threejs-compatibility/TextureSystem.js.map +1 -0
  946. package/dist/threejs-compatibility/ThreeCompatRenderer.d.ts +37 -0
  947. package/dist/threejs-compatibility/ThreeCompatRenderer.d.ts.map +1 -0
  948. package/dist/threejs-compatibility/ThreeCompatRenderer.js +77 -0
  949. package/dist/threejs-compatibility/ThreeCompatRenderer.js.map +1 -0
  950. package/dist/threejs-compatibility/TransparencySystem.d.ts +11 -0
  951. package/dist/threejs-compatibility/TransparencySystem.d.ts.map +1 -0
  952. package/dist/threejs-compatibility/TransparencySystem.js +12 -0
  953. package/dist/threejs-compatibility/TransparencySystem.js.map +1 -0
  954. package/dist/threejs-compatibility/index.d.ts +25 -0
  955. package/dist/threejs-compatibility/index.d.ts.map +1 -0
  956. package/dist/threejs-compatibility/index.js +15 -0
  957. package/dist/threejs-compatibility/index.js.map +1 -0
  958. package/dist/threejs-compatibility/performance/BVH.d.ts +11 -0
  959. package/dist/threejs-compatibility/performance/BVH.d.ts.map +1 -0
  960. package/dist/threejs-compatibility/performance/BVH.js +10 -0
  961. package/dist/threejs-compatibility/performance/BVH.js.map +1 -0
  962. package/dist/threejs-compatibility/performance/FrustumCulling.d.ts +7 -0
  963. package/dist/threejs-compatibility/performance/FrustumCulling.d.ts.map +1 -0
  964. package/dist/threejs-compatibility/performance/FrustumCulling.js +5 -0
  965. package/dist/threejs-compatibility/performance/FrustumCulling.js.map +1 -0
  966. package/dist/threejs-compatibility/performance/Instancing.d.ts +7 -0
  967. package/dist/threejs-compatibility/performance/Instancing.d.ts.map +1 -0
  968. package/dist/threejs-compatibility/performance/Instancing.js +10 -0
  969. package/dist/threejs-compatibility/performance/Instancing.js.map +1 -0
  970. package/dist/threejs-compatibility/performance/LODSystem.d.ts +9 -0
  971. package/dist/threejs-compatibility/performance/LODSystem.d.ts.map +1 -0
  972. package/dist/threejs-compatibility/performance/LODSystem.js +11 -0
  973. package/dist/threejs-compatibility/performance/LODSystem.js.map +1 -0
  974. package/dist/threejs-compatibility/performance/OcclusionCulling.d.ts +3 -0
  975. package/dist/threejs-compatibility/performance/OcclusionCulling.d.ts.map +1 -0
  976. package/dist/threejs-compatibility/performance/OcclusionCulling.js +5 -0
  977. package/dist/threejs-compatibility/performance/OcclusionCulling.js.map +1 -0
  978. package/dist/threejs-compatibility/performance/RaycastAcceleration.d.ts +8 -0
  979. package/dist/threejs-compatibility/performance/RaycastAcceleration.d.ts.map +1 -0
  980. package/dist/threejs-compatibility/performance/RaycastAcceleration.js +11 -0
  981. package/dist/threejs-compatibility/performance/RaycastAcceleration.js.map +1 -0
  982. package/dist/threejs-compatibility/performance/RendererProfiler.d.ts +11 -0
  983. package/dist/threejs-compatibility/performance/RendererProfiler.d.ts.map +1 -0
  984. package/dist/threejs-compatibility/performance/RendererProfiler.js +10 -0
  985. package/dist/threejs-compatibility/performance/RendererProfiler.js.map +1 -0
  986. package/dist/threejs-compatibility/performance/TextureStreaming.d.ts +7 -0
  987. package/dist/threejs-compatibility/performance/TextureStreaming.d.ts.map +1 -0
  988. package/dist/threejs-compatibility/performance/TextureStreaming.js +10 -0
  989. package/dist/threejs-compatibility/performance/TextureStreaming.js.map +1 -0
  990. package/dist/threejs-compatibility/performance/index.d.ts +13 -0
  991. package/dist/threejs-compatibility/performance/index.d.ts.map +1 -0
  992. package/dist/threejs-compatibility/performance/index.js +9 -0
  993. package/dist/threejs-compatibility/performance/index.js.map +1 -0
  994. package/dist/threejs-compatibility/postprocess/BloomPass.d.ts +9 -0
  995. package/dist/threejs-compatibility/postprocess/BloomPass.d.ts.map +1 -0
  996. package/dist/threejs-compatibility/postprocess/BloomPass.js +14 -0
  997. package/dist/threejs-compatibility/postprocess/BloomPass.js.map +1 -0
  998. package/dist/threejs-compatibility/postprocess/ColorGradingPass.d.ts +10 -0
  999. package/dist/threejs-compatibility/postprocess/ColorGradingPass.d.ts.map +1 -0
  1000. package/dist/threejs-compatibility/postprocess/ColorGradingPass.js +16 -0
  1001. package/dist/threejs-compatibility/postprocess/ColorGradingPass.js.map +1 -0
  1002. package/dist/threejs-compatibility/postprocess/DepthOfFieldPass.d.ts +9 -0
  1003. package/dist/threejs-compatibility/postprocess/DepthOfFieldPass.d.ts.map +1 -0
  1004. package/dist/threejs-compatibility/postprocess/DepthOfFieldPass.js +19 -0
  1005. package/dist/threejs-compatibility/postprocess/DepthOfFieldPass.js.map +1 -0
  1006. package/dist/threejs-compatibility/postprocess/EffectComposer.d.ts +7 -0
  1007. package/dist/threejs-compatibility/postprocess/EffectComposer.d.ts.map +1 -0
  1008. package/dist/threejs-compatibility/postprocess/EffectComposer.js +11 -0
  1009. package/dist/threejs-compatibility/postprocess/EffectComposer.js.map +1 -0
  1010. package/dist/threejs-compatibility/postprocess/FXAAPass.d.ts +7 -0
  1011. package/dist/threejs-compatibility/postprocess/FXAAPass.d.ts.map +1 -0
  1012. package/dist/threejs-compatibility/postprocess/FXAAPass.js +10 -0
  1013. package/dist/threejs-compatibility/postprocess/FXAAPass.js.map +1 -0
  1014. package/dist/threejs-compatibility/postprocess/MotionBlurPass.d.ts +9 -0
  1015. package/dist/threejs-compatibility/postprocess/MotionBlurPass.d.ts.map +1 -0
  1016. package/dist/threejs-compatibility/postprocess/MotionBlurPass.js +18 -0
  1017. package/dist/threejs-compatibility/postprocess/MotionBlurPass.js.map +1 -0
  1018. package/dist/threejs-compatibility/postprocess/OutlinePass.d.ts +9 -0
  1019. package/dist/threejs-compatibility/postprocess/OutlinePass.d.ts.map +1 -0
  1020. package/dist/threejs-compatibility/postprocess/OutlinePass.js +19 -0
  1021. package/dist/threejs-compatibility/postprocess/OutlinePass.js.map +1 -0
  1022. package/dist/threejs-compatibility/postprocess/PostProcessTypes.d.ts +42 -0
  1023. package/dist/threejs-compatibility/postprocess/PostProcessTypes.d.ts.map +1 -0
  1024. package/dist/threejs-compatibility/postprocess/PostProcessTypes.js +123 -0
  1025. package/dist/threejs-compatibility/postprocess/PostProcessTypes.js.map +1 -0
  1026. package/dist/threejs-compatibility/postprocess/RenderPass.d.ts +7 -0
  1027. package/dist/threejs-compatibility/postprocess/RenderPass.d.ts.map +1 -0
  1028. package/dist/threejs-compatibility/postprocess/RenderPass.js +8 -0
  1029. package/dist/threejs-compatibility/postprocess/RenderPass.js.map +1 -0
  1030. package/dist/threejs-compatibility/postprocess/SMAAPass.d.ts +7 -0
  1031. package/dist/threejs-compatibility/postprocess/SMAAPass.d.ts.map +1 -0
  1032. package/dist/threejs-compatibility/postprocess/SMAAPass.js +10 -0
  1033. package/dist/threejs-compatibility/postprocess/SMAAPass.js.map +1 -0
  1034. package/dist/threejs-compatibility/postprocess/SSAOPass.d.ts +9 -0
  1035. package/dist/threejs-compatibility/postprocess/SSAOPass.d.ts.map +1 -0
  1036. package/dist/threejs-compatibility/postprocess/SSAOPass.js +19 -0
  1037. package/dist/threejs-compatibility/postprocess/SSAOPass.js.map +1 -0
  1038. package/dist/threejs-compatibility/postprocess/ShaderPass.d.ts +9 -0
  1039. package/dist/threejs-compatibility/postprocess/ShaderPass.d.ts.map +1 -0
  1040. package/dist/threejs-compatibility/postprocess/ShaderPass.js +11 -0
  1041. package/dist/threejs-compatibility/postprocess/ShaderPass.js.map +1 -0
  1042. package/dist/threejs-compatibility/postprocess/TAAPass.d.ts +7 -0
  1043. package/dist/threejs-compatibility/postprocess/TAAPass.d.ts.map +1 -0
  1044. package/dist/threejs-compatibility/postprocess/TAAPass.js +10 -0
  1045. package/dist/threejs-compatibility/postprocess/TAAPass.js.map +1 -0
  1046. package/dist/threejs-compatibility/postprocess/VignettePass.d.ts +9 -0
  1047. package/dist/threejs-compatibility/postprocess/VignettePass.d.ts.map +1 -0
  1048. package/dist/threejs-compatibility/postprocess/VignettePass.js +14 -0
  1049. package/dist/threejs-compatibility/postprocess/VignettePass.js.map +1 -0
  1050. package/dist/threejs-compatibility/postprocess/index.d.ts +16 -0
  1051. package/dist/threejs-compatibility/postprocess/index.d.ts.map +1 -0
  1052. package/dist/threejs-compatibility/postprocess/index.js +15 -0
  1053. package/dist/threejs-compatibility/postprocess/index.js.map +1 -0
  1054. package/dist/threejs-compatibility/shaders/NodeMaterial.d.ts +14 -0
  1055. package/dist/threejs-compatibility/shaders/NodeMaterial.d.ts.map +1 -0
  1056. package/dist/threejs-compatibility/shaders/NodeMaterial.js +15 -0
  1057. package/dist/threejs-compatibility/shaders/NodeMaterial.js.map +1 -0
  1058. package/dist/threejs-compatibility/shaders/RawShaderMaterial.d.ts +6 -0
  1059. package/dist/threejs-compatibility/shaders/RawShaderMaterial.d.ts.map +1 -0
  1060. package/dist/threejs-compatibility/shaders/RawShaderMaterial.js +6 -0
  1061. package/dist/threejs-compatibility/shaders/RawShaderMaterial.js.map +1 -0
  1062. package/dist/threejs-compatibility/shaders/ShaderDiagnostics.d.ts +7 -0
  1063. package/dist/threejs-compatibility/shaders/ShaderDiagnostics.d.ts.map +1 -0
  1064. package/dist/threejs-compatibility/shaders/ShaderDiagnostics.js +12 -0
  1065. package/dist/threejs-compatibility/shaders/ShaderDiagnostics.js.map +1 -0
  1066. package/dist/threejs-compatibility/shaders/ShaderMaterial.d.ts +12 -0
  1067. package/dist/threejs-compatibility/shaders/ShaderMaterial.d.ts.map +1 -0
  1068. package/dist/threejs-compatibility/shaders/ShaderMaterial.js +20 -0
  1069. package/dist/threejs-compatibility/shaders/ShaderMaterial.js.map +1 -0
  1070. package/dist/threejs-compatibility/shaders/ThreeCompatShaderChunks.d.ts +7 -0
  1071. package/dist/threejs-compatibility/shaders/ThreeCompatShaderChunks.d.ts.map +1 -0
  1072. package/dist/threejs-compatibility/shaders/ThreeCompatShaderChunks.js +7 -0
  1073. package/dist/threejs-compatibility/shaders/ThreeCompatShaderChunks.js.map +1 -0
  1074. package/dist/threejs-compatibility/shaders/Uniforms.d.ts +8 -0
  1075. package/dist/threejs-compatibility/shaders/Uniforms.d.ts.map +1 -0
  1076. package/dist/threejs-compatibility/shaders/Uniforms.js +14 -0
  1077. package/dist/threejs-compatibility/shaders/Uniforms.js.map +1 -0
  1078. package/dist/threejs-compatibility/shaders/index.d.ts +10 -0
  1079. package/dist/threejs-compatibility/shaders/index.d.ts.map +1 -0
  1080. package/dist/threejs-compatibility/shaders/index.js +7 -0
  1081. package/dist/threejs-compatibility/shaders/index.js.map +1 -0
  1082. package/dist/threejs-compatibility/vfx/GPUPointCloud.d.ts +7 -0
  1083. package/dist/threejs-compatibility/vfx/GPUPointCloud.d.ts.map +1 -0
  1084. package/dist/threejs-compatibility/vfx/GPUPointCloud.js +12 -0
  1085. package/dist/threejs-compatibility/vfx/GPUPointCloud.js.map +1 -0
  1086. package/dist/threejs-compatibility/vfx/LineRenderer.d.ts +10 -0
  1087. package/dist/threejs-compatibility/vfx/LineRenderer.d.ts.map +1 -0
  1088. package/dist/threejs-compatibility/vfx/LineRenderer.js +7 -0
  1089. package/dist/threejs-compatibility/vfx/LineRenderer.js.map +1 -0
  1090. package/dist/threejs-compatibility/vfx/ParticleSystem.d.ts +12 -0
  1091. package/dist/threejs-compatibility/vfx/ParticleSystem.d.ts.map +1 -0
  1092. package/dist/threejs-compatibility/vfx/ParticleSystem.js +15 -0
  1093. package/dist/threejs-compatibility/vfx/ParticleSystem.js.map +1 -0
  1094. package/dist/threejs-compatibility/vfx/SpriteSystem.d.ts +11 -0
  1095. package/dist/threejs-compatibility/vfx/SpriteSystem.d.ts.map +1 -0
  1096. package/dist/threejs-compatibility/vfx/SpriteSystem.js +7 -0
  1097. package/dist/threejs-compatibility/vfx/SpriteSystem.js.map +1 -0
  1098. package/dist/threejs-compatibility/vfx/TrailRenderer.d.ts +5 -0
  1099. package/dist/threejs-compatibility/vfx/TrailRenderer.d.ts.map +1 -0
  1100. package/dist/threejs-compatibility/vfx/TrailRenderer.js +9 -0
  1101. package/dist/threejs-compatibility/vfx/TrailRenderer.js.map +1 -0
  1102. package/dist/threejs-compatibility/vfx/VFXDiagnostics.d.ts +21 -0
  1103. package/dist/threejs-compatibility/vfx/VFXDiagnostics.d.ts.map +1 -0
  1104. package/dist/threejs-compatibility/vfx/VFXDiagnostics.js +12 -0
  1105. package/dist/threejs-compatibility/vfx/VFXDiagnostics.js.map +1 -0
  1106. package/dist/threejs-compatibility/vfx/index.d.ts +10 -0
  1107. package/dist/threejs-compatibility/vfx/index.d.ts.map +1 -0
  1108. package/dist/threejs-compatibility/vfx/index.js +7 -0
  1109. package/dist/threejs-compatibility/vfx/index.js.map +1 -0
  1110. package/dist/threejs-example-parity/index.d.ts +57 -0
  1111. package/dist/threejs-example-parity/index.d.ts.map +1 -0
  1112. package/dist/threejs-example-parity/index.js +139 -0
  1113. package/dist/threejs-example-parity/index.js.map +1 -0
  1114. package/dist/webgpu/WebGPUBuffer.d.ts +2 -0
  1115. package/dist/webgpu/WebGPUBuffer.d.ts.map +1 -0
  1116. package/dist/webgpu/WebGPUBuffer.js +2 -0
  1117. package/dist/webgpu/WebGPUBuffer.js.map +1 -0
  1118. package/dist/webgpu/WebGPUCompute.d.ts +3 -0
  1119. package/dist/webgpu/WebGPUCompute.d.ts.map +1 -0
  1120. package/dist/webgpu/WebGPUCompute.js +2 -0
  1121. package/dist/webgpu/WebGPUCompute.js.map +1 -0
  1122. package/dist/webgpu/WebGPUPipelineCache.d.ts +6 -0
  1123. package/dist/webgpu/WebGPUPipelineCache.d.ts.map +1 -0
  1124. package/dist/webgpu/WebGPUPipelineCache.js +15 -0
  1125. package/dist/webgpu/WebGPUPipelineCache.js.map +1 -0
  1126. package/dist/webgpu/WebGPUPostProcess.d.ts +3 -0
  1127. package/dist/webgpu/WebGPUPostProcess.d.ts.map +1 -0
  1128. package/dist/webgpu/WebGPUPostProcess.js +2 -0
  1129. package/dist/webgpu/WebGPUPostProcess.js.map +1 -0
  1130. package/dist/webgpu/WebGPUTexture.d.ts +3 -0
  1131. package/dist/webgpu/WebGPUTexture.d.ts.map +1 -0
  1132. package/dist/webgpu/WebGPUTexture.js +2 -0
  1133. package/dist/webgpu/WebGPUTexture.js.map +1 -0
  1134. package/package.json +18 -0
  1135. package/src/ArchitecturalLightingFixtures.ts +241 -0
  1136. package/src/ArchitecturalMaterialCatalog.ts +130 -0
  1137. package/src/ArchitecturalMeasurementFixtures.ts +155 -0
  1138. package/src/BRDFLut.ts +47 -0
  1139. package/src/CameraFraming.ts +200 -0
  1140. package/src/CanonicalSceneFixtures.ts +95 -0
  1141. package/src/CascadedShadowMaps.ts +449 -0
  1142. package/src/ColorManagement.ts +127 -0
  1143. package/src/CullingFixtures.ts +280 -0
  1144. package/src/DecalGeometry.ts +26 -0
  1145. package/src/DepthPass.ts +110 -0
  1146. package/src/EnvironmentBackgroundPass.ts +194 -0
  1147. package/src/EnvironmentBackgroundResources.ts +309 -0
  1148. package/src/EnvironmentLighting.ts +96 -0
  1149. package/src/EnvironmentMapResources.ts +1026 -0
  1150. package/src/EnvironmentPipeline.ts +69 -0
  1151. package/src/EnvironmentPlatform.ts +1306 -0
  1152. package/src/EnvironmentPreset.ts +155 -0
  1153. package/src/Exposure.ts +66 -0
  1154. package/src/ExternalParityRenderPreset.ts +725 -0
  1155. package/src/ForwardPass.ts +1639 -0
  1156. package/src/FrameVisualMetrics.ts +218 -0
  1157. package/src/Geometry.ts +461 -0
  1158. package/src/GeometryPrimitives.ts +2 -0
  1159. package/src/HDRRenderPipeline.ts +94 -0
  1160. package/src/IBL.ts +86 -0
  1161. package/src/IndexBuffer.ts +57 -0
  1162. package/src/InstancedPBRMaterial.ts +186 -0
  1163. package/src/InstancedUnlitMaterial.ts +60 -0
  1164. package/src/Instancing.ts +19 -0
  1165. package/src/LightCollector.ts +82 -0
  1166. package/src/LightUniforms.ts +47 -0
  1167. package/src/LightingDebug.ts +80 -0
  1168. package/src/LightingDefaults.ts +79 -0
  1169. package/src/LightingRig.ts +301 -0
  1170. package/src/LineGeometry.ts +2 -0
  1171. package/src/Material.ts +209 -0
  1172. package/src/MaterialBinding.ts +131 -0
  1173. package/src/MaterialInstance.ts +59 -0
  1174. package/src/MaterialPresets.ts +272 -0
  1175. package/src/MorphTarget.ts +123 -0
  1176. package/src/MorphUnlitMaterial.ts +54 -0
  1177. package/src/NormalMappedPBRMaterial.ts +188 -0
  1178. package/src/OceanFixtures.ts +318 -0
  1179. package/src/PBRLightingDefaults.ts +12 -0
  1180. package/src/PBRMaterial.ts +442 -0
  1181. package/src/PMREM.ts +53 -0
  1182. package/src/PbrReference.ts +681 -0
  1183. package/src/PostProcessPass.ts +2507 -0
  1184. package/src/ProceduralTextureFixtures.ts +393 -0
  1185. package/src/ProductTurntableFixtures.ts +815 -0
  1186. package/src/Raycaster.ts +21 -0
  1187. package/src/ReflectionProbe.ts +13 -0
  1188. package/src/ReflectionSurfaces.ts +219 -0
  1189. package/src/RenderBackend.ts +43 -0
  1190. package/src/RenderDebugViews.ts +138 -0
  1191. package/src/RenderDevice.ts +836 -0
  1192. package/src/RenderGraph.ts +194 -0
  1193. package/src/RenderPass.ts +27 -0
  1194. package/src/RenderPipeline.ts +101 -0
  1195. package/src/RenderQueue.ts +12 -0
  1196. package/src/RenderState.ts +12 -0
  1197. package/src/Renderer.ts +2626 -0
  1198. package/src/RendererDebugOverlay.ts +80 -0
  1199. package/src/RendererFeatureGates.ts +150 -0
  1200. package/src/RendererPostprocessPlan.ts +279 -0
  1201. package/src/RendererTiming.ts +251 -0
  1202. package/src/RendererVisualPipelineReport.ts +836 -0
  1203. package/src/ResourceLifecycle.ts +21 -0
  1204. package/src/Sampler.ts +37 -0
  1205. package/src/SceneOptimization.ts +518 -0
  1206. package/src/ShaderChunks.ts +393 -0
  1207. package/src/ShaderLibrary.ts +2738 -0
  1208. package/src/ShaderModule.ts +36 -0
  1209. package/src/ShaderPreprocessor.ts +260 -0
  1210. package/src/ShaderReflection.ts +201 -0
  1211. package/src/ShadowMap.ts +237 -0
  1212. package/src/ShadowPass.ts +198 -0
  1213. package/src/ShadowProjection.ts +115 -0
  1214. package/src/SkinnedLitMaterial.ts +366 -0
  1215. package/src/SkinnedUnlitMaterial.ts +63 -0
  1216. package/src/SkinningBounds.ts +131 -0
  1217. package/src/SpaceEnvironmentFixtures.ts +200 -0
  1218. package/src/SpriteGeometry.ts +21 -0
  1219. package/src/StereoCameraRig.ts +127 -0
  1220. package/src/StereoEffects.ts +274 -0
  1221. package/src/TerrainFixtures.ts +180 -0
  1222. package/src/Texture.ts +307 -0
  1223. package/src/TextureBinding.ts +91 -0
  1224. package/src/TexturedPBRMaterial.ts +1112 -0
  1225. package/src/TexturedUnlitMaterial.ts +67 -0
  1226. package/src/ToneMapping.ts +105 -0
  1227. package/src/UniformBinder.ts +16 -0
  1228. package/src/UniformLayout.ts +129 -0
  1229. package/src/UnlitMaterial.ts +75 -0
  1230. package/src/VegetationFixtures.ts +314 -0
  1231. package/src/VertexBuffer.ts +120 -0
  1232. package/src/VertexFormat.ts +171 -0
  1233. package/src/VoxelWorldFixtures.ts +280 -0
  1234. package/src/WeatherFixtures.ts +223 -0
  1235. package/src/WebGL2Device.ts +2280 -0
  1236. package/src/WebGL2StateCache.ts +330 -0
  1237. package/src/WebGPUDevice.ts +2806 -0
  1238. package/src/WebGPURenderToTextureProof.ts +139 -0
  1239. package/src/advanced-runtime/AdvancedRenderer.ts +73 -0
  1240. package/src/advanced-runtime/index.ts +9 -0
  1241. package/src/cinematic/BloomPass.ts +26 -0
  1242. package/src/cinematic/CinematicDepthComposition.ts +30 -0
  1243. package/src/cinematic/CinematicEvidence.ts +123 -0
  1244. package/src/cinematic/CinematicLightingRig.ts +144 -0
  1245. package/src/cinematic/CinematicMaterialPresets.ts +130 -0
  1246. package/src/cinematic/CinematicPostProcess.ts +83 -0
  1247. package/src/cinematic/DepthHazePass.ts +30 -0
  1248. package/src/cinematic/EmissivePracticalLightSystem.ts +45 -0
  1249. package/src/cinematic/FilmGrainPass.ts +24 -0
  1250. package/src/cinematic/FogVolumeSystem.ts +30 -0
  1251. package/src/cinematic/GlowCardSystem.ts +44 -0
  1252. package/src/cinematic/RainParticleSystem.ts +151 -0
  1253. package/src/cinematic/VignettePass.ts +25 -0
  1254. package/src/cinematic/WetReflectionApproximation.ts +27 -0
  1255. package/src/cinematic/index.ts +14 -0
  1256. package/src/effects/CollisionModule.ts +64 -0
  1257. package/src/effects/ColorModule.ts +60 -0
  1258. package/src/effects/ForceModule.ts +25 -0
  1259. package/src/effects/GPUParticleBackend.ts +569 -0
  1260. package/src/effects/Particle.ts +108 -0
  1261. package/src/effects/ParticleDiagnostics.ts +224 -0
  1262. package/src/effects/ParticleEffectPresets.ts +147 -0
  1263. package/src/effects/ParticleEmitter.ts +326 -0
  1264. package/src/effects/ParticleModule.ts +26 -0
  1265. package/src/effects/ParticleRenderPass.ts +117 -0
  1266. package/src/effects/ParticleRenderer.ts +132 -0
  1267. package/src/effects/ParticleSystem.ts +333 -0
  1268. package/src/effects/SizeModule.ts +56 -0
  1269. package/src/effects/TrailModule.ts +72 -0
  1270. package/src/effects/VelocityModule.ts +75 -0
  1271. package/src/effects/index.ts +15 -0
  1272. package/src/index.ts +914 -0
  1273. package/src/materials/AlphaSorting.ts +30 -0
  1274. package/src/materials/MaterialExtensions.ts +42 -0
  1275. package/src/materials/PhysicalMaterial.ts +133 -0
  1276. package/src/materials/TransmissionPass.ts +51 -0
  1277. package/src/performance/BVH.ts +18 -0
  1278. package/src/performance/Batcher.ts +2 -0
  1279. package/src/performance/FrustumCuller.ts +9 -0
  1280. package/src/performance/LOD.ts +20 -0
  1281. package/src/performance/Octree.ts +10 -0
  1282. package/src/performance/RenderItemSorting.ts +167 -0
  1283. package/src/performance/RendererStats.ts +43 -0
  1284. package/src/performance/ResourceBudget.ts +44 -0
  1285. package/src/postprocess/BloomPass.ts +28 -0
  1286. package/src/postprocess/CinematicDiagnostics.ts +642 -0
  1287. package/src/postprocess/ColorGradingPass.ts +24 -0
  1288. package/src/postprocess/DepthOfFieldPass.ts +12 -0
  1289. package/src/postprocess/EffectComposer.ts +349 -0
  1290. package/src/postprocess/SSAOPass.ts +20 -0
  1291. package/src/postprocess/index.ts +34 -0
  1292. package/src/production-runtime/AnimationControlsPipeline.ts +77 -0
  1293. package/src/production-runtime/PBRHDRPipeline.ts +381 -0
  1294. package/src/production-runtime/ProductionEffectsPipeline.ts +85 -0
  1295. package/src/production-runtime/ProductionRendererTypes.ts +136 -0
  1296. package/src/production-runtime/ProductionRuntimeRenderer.ts +172 -0
  1297. package/src/production-runtime/ProductionWebGL2Renderer.ts +313 -0
  1298. package/src/production-runtime/ProductionWebGPURenderer.ts +396 -0
  1299. package/src/production-runtime/TransmissionBackdropCapture.ts +130 -0
  1300. package/src/production-runtime/animation/MorphTargetRenderer.ts +2 -0
  1301. package/src/production-runtime/animation/SkinningRenderer.ts +2 -0
  1302. package/src/production-runtime/backends/RendererBackend.ts +17 -0
  1303. package/src/production-runtime/backends/WebGL2RendererBackend.ts +30 -0
  1304. package/src/production-runtime/backends/WebGPURendererBackend.ts +24 -0
  1305. package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +2 -0
  1306. package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +2 -0
  1307. package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +2 -0
  1308. package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +2 -0
  1309. package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +1 -0
  1310. package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +2 -0
  1311. package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +2 -0
  1312. package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +2 -0
  1313. package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +2 -0
  1314. package/src/production-runtime/backends/webgpu/WebGPUShader.ts +2 -0
  1315. package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +2 -0
  1316. package/src/production-runtime/color/ColorManagement.ts +3 -0
  1317. package/src/production-runtime/color/ToneMapping.ts +7 -0
  1318. package/src/production-runtime/diagnostics/FrameCapture.ts +2 -0
  1319. package/src/production-runtime/diagnostics/GPUCapabilities.ts +2 -0
  1320. package/src/production-runtime/diagnostics/RendererStats.ts +2 -0
  1321. package/src/production-runtime/environment/EnvironmentMap.ts +1 -0
  1322. package/src/production-runtime/environment/HDRLoader.ts +57 -0
  1323. package/src/production-runtime/environment/PMREMGenerator.ts +713 -0
  1324. package/src/production-runtime/framegraph/FrameGraph.ts +18 -0
  1325. package/src/production-runtime/framegraph/RenderPass.ts +15 -0
  1326. package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +439 -0
  1327. package/src/production-runtime/index.ts +127 -0
  1328. package/src/production-runtime/lights/LightManager.ts +7 -0
  1329. package/src/production-runtime/lights/ShadowMapRenderer.ts +5 -0
  1330. package/src/production-runtime/materials/GLTFMaterialAdapter.ts +6 -0
  1331. package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +2 -0
  1332. package/src/production-runtime/materials/MaterialCompiler.ts +7 -0
  1333. package/src/production-runtime/materials/MaterialTextureBindings.ts +5 -0
  1334. package/src/production-runtime/materials/PBRMaterial.ts +2 -0
  1335. package/src/production-runtime/materials/PBRShaderFeatures.ts +2 -0
  1336. package/src/production-runtime/passes/ContactShadowPass.ts +184 -0
  1337. package/src/production-runtime/passes/DepthPrepass.ts +7 -0
  1338. package/src/production-runtime/passes/OpaquePass.ts +7 -0
  1339. package/src/production-runtime/passes/ShadowPass.ts +7 -0
  1340. package/src/production-runtime/passes/SkyboxPass.ts +7 -0
  1341. package/src/production-runtime/passes/ToneMappingPass.ts +7 -0
  1342. package/src/production-runtime/passes/TransparentPass.ts +7 -0
  1343. package/src/production-runtime/postprocess/BloomPass.ts +51 -0
  1344. package/src/production-runtime/postprocess/ColorGradingPass.ts +49 -0
  1345. package/src/production-runtime/postprocess/DOFPass.ts +47 -0
  1346. package/src/production-runtime/postprocess/FXAAPass.ts +53 -0
  1347. package/src/production-runtime/postprocess/ProductionEffectComposer.ts +78 -0
  1348. package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +174 -0
  1349. package/src/production-runtime/postprocess/SSAOPass.ts +45 -0
  1350. package/src/production-runtime/resources/GPUBuffer.ts +2 -0
  1351. package/src/production-runtime/resources/GPUTexture.ts +2 -0
  1352. package/src/production-runtime/resources/RenderTarget.ts +3 -0
  1353. package/src/production-runtime/resources/ResourceCache.ts +7 -0
  1354. package/src/production-runtime/scene/Camera.ts +1 -0
  1355. package/src/production-runtime/scene/Lights.ts +2 -0
  1356. package/src/production-runtime/scene/RenderableMesh.ts +2 -0
  1357. package/src/production-runtime/scene/RenderablePrimitive.ts +1 -0
  1358. package/src/production-runtime/scene/RenderableScene.ts +4 -0
  1359. package/src/production-runtime/shaders/ShaderProgramLibrary.ts +7 -0
  1360. package/src/production-runtime/shaders/chunks/brdf.glsl +2 -0
  1361. package/src/production-runtime/shaders/chunks/ibl.glsl +3 -0
  1362. package/src/production-runtime/shaders/chunks/pbr.frag.glsl +47 -0
  1363. package/src/production-runtime/shaders/chunks/pbr.vert.glsl +8 -0
  1364. package/src/production-runtime/shaders/chunks/shadows.glsl +2 -0
  1365. package/src/production-runtime/shaders/wgsl/pbr.wgsl +3 -0
  1366. package/src/production-runtime/shaders/wgsl/postprocess.wgsl +2 -0
  1367. package/src/production-runtime/shaders/wgsl/skybox.wgsl +2 -0
  1368. package/src/shaders/depth.frag.glsl +5 -0
  1369. package/src/shaders/depth.vert.glsl +8 -0
  1370. package/src/shaders/pbr-direct.frag.glsl +687 -0
  1371. package/src/shaders/pbr-direct.vert.glsl +18 -0
  1372. package/src/shaders/unlit.frag.glsl +18 -0
  1373. package/src/shaders/unlit.vert.glsl +13 -0
  1374. package/src/shadows/CascadedShadowPipeline.ts +53 -0
  1375. package/src/shadows/ContactShadows.ts +106 -0
  1376. package/src/shadows/ShadowDebugViews.ts +46 -0
  1377. package/src/threejs-compatibility/InstancingSystem.ts +17 -0
  1378. package/src/threejs-compatibility/LightingSystem.ts +22 -0
  1379. package/src/threejs-compatibility/MaterialSystem.ts +9 -0
  1380. package/src/threejs-compatibility/RenderTargetSystem.ts +35 -0
  1381. package/src/threejs-compatibility/RendererDiagnostics.ts +61 -0
  1382. package/src/threejs-compatibility/SceneRenderer.ts +34 -0
  1383. package/src/threejs-compatibility/ShadowSystem.ts +19 -0
  1384. package/src/threejs-compatibility/TextureSystem.ts +19 -0
  1385. package/src/threejs-compatibility/ThreeCompatRenderer.ts +90 -0
  1386. package/src/threejs-compatibility/TransparencySystem.ts +19 -0
  1387. package/src/threejs-compatibility/index.ts +29 -0
  1388. package/src/threejs-compatibility/performance/BVH.ts +14 -0
  1389. package/src/threejs-compatibility/performance/FrustumCulling.ts +10 -0
  1390. package/src/threejs-compatibility/performance/Instancing.ts +4 -0
  1391. package/src/threejs-compatibility/performance/LODSystem.ts +16 -0
  1392. package/src/threejs-compatibility/performance/OcclusionCulling.ts +6 -0
  1393. package/src/threejs-compatibility/performance/RaycastAcceleration.ts +12 -0
  1394. package/src/threejs-compatibility/performance/RendererProfiler.ts +19 -0
  1395. package/src/threejs-compatibility/performance/TextureStreaming.ts +4 -0
  1396. package/src/threejs-compatibility/performance/index.ts +12 -0
  1397. package/src/threejs-compatibility/postprocess/BloomPass.ts +16 -0
  1398. package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +16 -0
  1399. package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +21 -0
  1400. package/src/threejs-compatibility/postprocess/EffectComposer.ts +14 -0
  1401. package/src/threejs-compatibility/postprocess/FXAAPass.ts +15 -0
  1402. package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +20 -0
  1403. package/src/threejs-compatibility/postprocess/OutlinePass.ts +21 -0
  1404. package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +169 -0
  1405. package/src/threejs-compatibility/postprocess/RenderPass.ts +9 -0
  1406. package/src/threejs-compatibility/postprocess/SMAAPass.ts +15 -0
  1407. package/src/threejs-compatibility/postprocess/SSAOPass.ts +21 -0
  1408. package/src/threejs-compatibility/postprocess/ShaderPass.ts +7 -0
  1409. package/src/threejs-compatibility/postprocess/TAAPass.ts +15 -0
  1410. package/src/threejs-compatibility/postprocess/VignettePass.ts +16 -0
  1411. package/src/threejs-compatibility/postprocess/index.ts +15 -0
  1412. package/src/threejs-compatibility/shaders/NodeMaterial.ts +21 -0
  1413. package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +6 -0
  1414. package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +17 -0
  1415. package/src/threejs-compatibility/shaders/ShaderMaterial.ts +18 -0
  1416. package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +6 -0
  1417. package/src/threejs-compatibility/shaders/Uniforms.ts +18 -0
  1418. package/src/threejs-compatibility/shaders/index.ts +9 -0
  1419. package/src/threejs-compatibility/vfx/GPUPointCloud.ts +7 -0
  1420. package/src/threejs-compatibility/vfx/LineRenderer.ts +13 -0
  1421. package/src/threejs-compatibility/vfx/ParticleSystem.ts +23 -0
  1422. package/src/threejs-compatibility/vfx/SpriteSystem.ts +14 -0
  1423. package/src/threejs-compatibility/vfx/TrailRenderer.ts +8 -0
  1424. package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +23 -0
  1425. package/src/threejs-compatibility/vfx/index.ts +9 -0
  1426. package/src/threejs-example-parity/index.ts +205 -0
  1427. package/src/webgpu/WebGPUBuffer.ts +1 -0
  1428. package/src/webgpu/WebGPUCompute.ts +2 -0
  1429. package/src/webgpu/WebGPUPipelineCache.ts +15 -0
  1430. package/src/webgpu/WebGPUPostProcess.ts +2 -0
  1431. package/src/webgpu/WebGPUTexture.ts +2 -0
  1432. package/tsconfig.json +26 -0
  1433. package/vitest.config.ts +20 -0
@@ -0,0 +1,1639 @@
1
+ import { Geometry } from "./Geometry";
2
+ import { type CollectedLight } from "./LightCollector";
3
+ import { LightUniforms } from "./LightUniforms";
4
+ import { Material, type RenderState } from "./Material";
5
+ import { MaterialBinding } from "./MaterialBinding";
6
+ import { MaterialInstance } from "./MaterialInstance";
7
+ import { applyMorphTargets, type MorphTargetDelta } from "./MorphTarget";
8
+ import { type DrawCommand, type InstanceVertexAttribute, type RenderBuffer, type RenderDevice, RenderDeviceError, type RenderShaderProgram, type UniformValue } from "./RenderDevice";
9
+ import { RenderPipeline } from "./RenderPipeline";
10
+ import { BaseRenderPass, type RenderPassContext } from "./RenderPass";
11
+ import { ShaderModule } from "./ShaderModule";
12
+ import { createDefaultShaderLibrary, type ShaderLibrary } from "./ShaderLibrary";
13
+ import { createShadowFilterKernel, type ShadowFilterKernel } from "./ShadowMap";
14
+ import { TextureBinding } from "./TextureBinding";
15
+ import { UnlitMaterial } from "./UnlitMaterial";
16
+ import { sortRenderQueueItems } from "./performance/RenderItemSorting";
17
+
18
+ export interface RenderItem {
19
+ readonly geometry: Geometry;
20
+ readonly material?: RenderMaterial;
21
+ readonly label?: string;
22
+ readonly drawRange?: RenderItemDrawRange;
23
+ readonly includeInAutoFrame?: boolean;
24
+ readonly modelMatrix?: Float32Array | readonly number[];
25
+ readonly normalMatrix?: Float32Array | readonly number[];
26
+ readonly modelViewProjectionMatrix?: Float32Array | readonly number[];
27
+ readonly skinning?: SkinningPaletteBinding;
28
+ readonly morphTargets?: readonly MorphTargetDelta[];
29
+ readonly morphWeights?: readonly number[];
30
+ readonly instanceTransforms?: Float32Array | readonly number[];
31
+ readonly instanceColors?: Float32Array | readonly number[];
32
+ readonly instanceAttributes?: readonly RenderItemInstanceAttribute[];
33
+ }
34
+
35
+ export interface RenderItemDrawRange {
36
+ readonly start: number;
37
+ readonly count: number;
38
+ }
39
+
40
+ export interface RenderItemInstanceAttribute {
41
+ readonly shaderName: string;
42
+ readonly components: 1 | 2 | 3 | 4;
43
+ readonly data: Float32Array | readonly number[];
44
+ readonly normalized?: boolean;
45
+ readonly divisor?: number;
46
+ }
47
+
48
+ export type RenderMaterial = Material | MaterialInstance;
49
+
50
+ export interface SkinningPaletteBinding {
51
+ readonly jointCount: number;
52
+ readonly matrices: Float32Array;
53
+ }
54
+
55
+ export const MAX_GPU_MORPH_VERTICES = 64;
56
+ export const MAX_GPU_MORPH_TARGETS = 4;
57
+ export const MAX_GPU_INSTANCES = 64;
58
+
59
+ export interface ForwardPassOptions {
60
+ readonly items: readonly RenderItem[];
61
+ readonly lights?: readonly CollectedLight[];
62
+ readonly environmentLighting?: EnvironmentLightingOptions;
63
+ readonly environmentFog?: ForwardEnvironmentFogOptions | false;
64
+ readonly inputColorResource?: string;
65
+ readonly shadowMap?: ForwardShadowMapOptions;
66
+ readonly cameraPosition?: readonly [number, number, number];
67
+ readonly outputColorSpace?: "linear" | "srgb";
68
+ readonly shaderLibrary?: ShaderLibrary;
69
+ }
70
+
71
+ export interface EnvironmentLightingOptions {
72
+ readonly color: readonly [number, number, number];
73
+ readonly intensity: number;
74
+ readonly proceduralMap?: ProceduralEnvironmentMapLightingOptions;
75
+ readonly environmentMapTexture?: TextureBinding;
76
+ readonly environmentCubeMapTexture?: TextureBinding;
77
+ readonly environmentMapIntensity?: number;
78
+ readonly environmentMapSpecularIntensity?: number;
79
+ readonly environmentMapRotation?: number;
80
+ readonly environmentMapMipCount?: number;
81
+ readonly environmentMapEncoding?: "srgb" | "rgbe" | "linear";
82
+ readonly environmentBrdfLutTexture?: TextureBinding;
83
+ }
84
+
85
+ export interface ProceduralEnvironmentMapLightingOptions {
86
+ readonly skyColor: readonly [number, number, number];
87
+ readonly horizonColor: readonly [number, number, number];
88
+ readonly groundColor: readonly [number, number, number];
89
+ readonly specularColor: readonly [number, number, number];
90
+ readonly intensity: number;
91
+ readonly specularIntensity: number;
92
+ }
93
+
94
+ export type ForwardEnvironmentFogMode = "linear" | "exponential" | "exponential-squared";
95
+
96
+ export interface ForwardEnvironmentFogOptions {
97
+ readonly mode: ForwardEnvironmentFogMode;
98
+ readonly color: readonly [number, number, number];
99
+ readonly near: number;
100
+ readonly far: number;
101
+ readonly density: number;
102
+ readonly heightFalloff?: number;
103
+ readonly heightReference?: number;
104
+ readonly maxOpacity?: number;
105
+ }
106
+
107
+ export interface ForwardShadowMapOptions {
108
+ readonly texture: TextureBinding;
109
+ readonly lightMatrix: Float32Array | readonly number[];
110
+ readonly strength?: number;
111
+ readonly bias?: number;
112
+ readonly slopeBias?: number;
113
+ readonly texelSize?: readonly [number, number];
114
+ readonly filterKernel?: ShadowFilterKernel;
115
+ readonly pointLight?: ForwardPointShadowMapOptions;
116
+ }
117
+
118
+ export interface ForwardPointShadowMapOptions {
119
+ readonly texture: TextureBinding;
120
+ readonly lightPosition: readonly [number, number, number];
121
+ readonly range: number;
122
+ readonly faceMatrices: Float32Array | readonly number[];
123
+ readonly faceRects: Float32Array | readonly number[];
124
+ readonly strength?: number;
125
+ readonly bias?: number;
126
+ readonly slopeBias?: number;
127
+ readonly texelSize?: readonly [number, number];
128
+ readonly filterKernel?: ShadowFilterKernel;
129
+ }
130
+
131
+ type Mat4 = [
132
+ number, number, number, number,
133
+ number, number, number, number,
134
+ number, number, number, number,
135
+ number, number, number, number
136
+ ];
137
+
138
+ const MAX_FORWARD_SHADOW_PCF_SAMPLES = 32;
139
+ const DEFAULT_FORWARD_SHADOW_FILTER_KERNEL = createShadowFilterKernel({ filter: "pcf", pcfRadius: 1, pcfSamples: 9 });
140
+ const INSTANCE_MATRIX_ATTRIBUTE_NAMES = [
141
+ "a_instanceMatrix0",
142
+ "a_instanceMatrix1",
143
+ "a_instanceMatrix2",
144
+ "a_instanceMatrix3"
145
+ ] as const;
146
+
147
+ export class ForwardPass extends BaseRenderPass {
148
+ private static readonly shaderCaches = new WeakMap<RenderDevice, WeakMap<ShaderLibrary, Map<string, ShaderModule>>>();
149
+ private readonly materialBinding = new MaterialBinding();
150
+ private readonly shaderLibrary: ShaderLibrary;
151
+ private readonly skinningPaletteUploads = new SkinningPaletteUploadManager();
152
+
153
+ constructor(private readonly options: ForwardPassOptions) {
154
+ super("forward", options.inputColorResource ? [options.inputColorResource] : [], ["color"]);
155
+ this.shaderLibrary = options.shaderLibrary ?? createDefaultShaderLibrary();
156
+ }
157
+
158
+ execute(context: RenderPassContext): void {
159
+ this.skinningPaletteUploads.beginFrame();
160
+ for (const item of sortForwardRenderItems(this.options.items, this.options.cameraPosition)) {
161
+ this.drawItem(context.device, item);
162
+ }
163
+ }
164
+
165
+ private drawItem(device: RenderDevice, item: RenderItem): void {
166
+ const material = item.material ?? new UnlitMaterial();
167
+ const baseMaterial = getBaseMaterial(material);
168
+ this.applyLightUniforms(material);
169
+ const shader = this.getShader(baseMaterial, device);
170
+ if (item.instanceTransforms && baseMaterial.renderState.cullMode !== "none" && instancedItemNeedsPerInstanceCullState(item)) {
171
+ for (const expanded of expandInstancedRenderItem(item)) {
172
+ this.drawItem(device, expanded);
173
+ }
174
+ return;
175
+ }
176
+ if (item.instanceTransforms && !supportsInstanceAttributes(shader) && instanceTransformCount(item) > MAX_GPU_INSTANCES) {
177
+ for (const batch of splitInstanceTransforms(item.instanceTransforms)) {
178
+ this.drawItem(device, { ...item, instanceTransforms: batch });
179
+ }
180
+ return;
181
+ }
182
+ if (item.instanceTransforms && !supportsInstanceAttributes(shader) && !supportsInstanceUniforms(shader)) {
183
+ for (const expanded of expandInstancedRenderItem(item)) {
184
+ this.drawItem(device, expanded);
185
+ }
186
+ return;
187
+ }
188
+ const binding = this.materialBinding.bind(material, shader);
189
+ const uniforms = new Map<string, UniformValue>(binding.uniforms);
190
+ applyEnvironmentLightingUniforms(this.options.environmentLighting, item, shader, uniforms);
191
+ applyEnvironmentFogUniforms(this.options.environmentFog, item, shader, uniforms);
192
+ applyForwardShadowMapUniforms(this.options.shadowMap, item, shader, uniforms);
193
+ applyOutputColorSpaceUniform(this.options.outputColorSpace ?? "srgb", item, shader, uniforms);
194
+ applyCameraUniforms(this.options.cameraPosition, item, shader, uniforms);
195
+ applyAlphaCutoffUniform(item, shader, uniforms);
196
+ applyTransformUniforms(item, shader, uniforms);
197
+ if (item.skinning) {
198
+ this.skinningPaletteUploads.bind(item, item.skinning, baseMaterial, shader, uniforms);
199
+ }
200
+ const instanceBinding = item.instanceTransforms ? applyInstanceBinding(device, item, shader, uniforms) : { count: 1 };
201
+ const gpuMorph = item.morphTargets || item.morphWeights ? applyGpuMorphUniforms(item, shader, uniforms) : false;
202
+ const geometry = gpuMorph ? item.geometry : resolveRenderGeometry(item);
203
+ validateMaterialGeometryContract(item, baseMaterial, geometry);
204
+ try {
205
+ const vertexBuffer = geometry.vertexBuffer.upload(device);
206
+ const indexBuffer = geometry.indexBuffer?.upload(device);
207
+ const drawRange = resolveDrawRange(geometry, item.drawRange);
208
+ const pipeline = new RenderPipeline({
209
+ label: item.label ?? baseMaterial.name,
210
+ shader,
211
+ vertexFormat: geometry.vertexBuffer.format,
212
+ topology: geometry.topology,
213
+ renderState: renderStateForItem(baseMaterial.renderState, item),
214
+ requiredAttributes: baseMaterial.requiredAttributes
215
+ });
216
+ const command: DrawCommand = pipeline.createDrawCommand({
217
+ label: item.label,
218
+ vertexBuffer,
219
+ vertexCount: indexBuffer !== undefined ? geometry.vertexBuffer.vertexCount : drawRange.count,
220
+ ...(indexBuffer === undefined && drawRange.start > 0 ? { firstVertex: drawRange.start } : {}),
221
+ uniforms,
222
+ ...(item.instanceTransforms ? { instanceCount: instanceBinding.count } : {}),
223
+ ...(instanceBinding.attributes ? { instanceAttributes: instanceBinding.attributes } : {})
224
+ });
225
+ if (indexBuffer !== undefined) {
226
+ Object.assign(command, {
227
+ indexBuffer,
228
+ indexType: geometry.indexBuffer?.type,
229
+ indexCount: drawRange.count,
230
+ ...(drawRange.start > 0 ? { firstIndex: drawRange.start } : {})
231
+ });
232
+ }
233
+ device.draw(command);
234
+ } finally {
235
+ for (const buffer of instanceBinding.buffers ?? []) buffer.dispose();
236
+ if (geometry !== item.geometry) {
237
+ geometry.dispose();
238
+ }
239
+ }
240
+ }
241
+
242
+ private applyLightUniforms(material: RenderMaterial): void {
243
+ const baseMaterial = getBaseMaterial(material);
244
+ if (!baseMaterial.requiredUniforms.includes("u_lightCount") || !baseMaterial.requiredUniforms.includes("u_lightData")) {
245
+ return;
246
+ }
247
+ const packed = LightUniforms.pack(this.options.lights ?? []);
248
+ if (material instanceof MaterialInstance) {
249
+ material.setOverride("u_lightCount", packed.lightCount);
250
+ material.setOverride("u_lightData", packed.data);
251
+ } else {
252
+ material.setParameter("u_lightCount", packed.lightCount);
253
+ material.setParameter("u_lightData", packed.data);
254
+ }
255
+ }
256
+
257
+ private getShader(material: Material, device: RenderDevice): RenderShaderProgram {
258
+ const cacheKey = shaderCacheKey(material);
259
+ const shaderCache = getForwardPassShaderCache(device, this.shaderLibrary);
260
+ let module = shaderCache.get(cacheKey);
261
+ if (!module) {
262
+ module = material.shaderVariant
263
+ ? ShaderModule.fromLibraryVariant(this.shaderLibrary, material.shaderKey, material.shaderVariant)
264
+ : ShaderModule.fromLibrary(this.shaderLibrary, material.shaderKey);
265
+ shaderCache.set(cacheKey, module);
266
+ }
267
+ return module.compile(device);
268
+ }
269
+ }
270
+
271
+ class SkinningPaletteUploadManager {
272
+ private static readonly validatedGeometryJointCounts = new WeakMap<Geometry, Set<number>>();
273
+ private submissions = 0;
274
+ private jointsUploaded = 0;
275
+ private maxJointCount = 0;
276
+
277
+ beginFrame(): void {
278
+ this.submissions = 0;
279
+ this.jointsUploaded = 0;
280
+ this.maxJointCount = 0;
281
+ }
282
+
283
+ bind(
284
+ item: RenderItem,
285
+ skinning: SkinningPaletteBinding,
286
+ material: Material,
287
+ shader: RenderShaderProgram,
288
+ uniforms: Map<string, UniformValue>
289
+ ): void {
290
+ applySkinningUniforms(skinning, material, shader, uniforms);
291
+ const validatedJointCounts = SkinningPaletteUploadManager.validatedGeometryJointCounts.get(item.geometry) ?? new Set<number>();
292
+ if (!validatedJointCounts.has(skinning.jointCount)) {
293
+ validateSkinningGeometryContract(item, skinning);
294
+ validatedJointCounts.add(skinning.jointCount);
295
+ SkinningPaletteUploadManager.validatedGeometryJointCounts.set(item.geometry, validatedJointCounts);
296
+ }
297
+ this.submissions += 1;
298
+ this.jointsUploaded += skinning.jointCount;
299
+ this.maxJointCount = Math.max(this.maxJointCount, skinning.jointCount);
300
+ }
301
+ }
302
+
303
+ function getForwardPassShaderCache(device: RenderDevice, library: ShaderLibrary): Map<string, ShaderModule> {
304
+ let libraryCaches = ForwardPass["shaderCaches"].get(device);
305
+ if (!libraryCaches) {
306
+ libraryCaches = new WeakMap<ShaderLibrary, Map<string, ShaderModule>>();
307
+ ForwardPass["shaderCaches"].set(device, libraryCaches);
308
+ }
309
+ let shaderCache = libraryCaches.get(library);
310
+ if (!shaderCache) {
311
+ shaderCache = new Map<string, ShaderModule>();
312
+ libraryCaches.set(library, shaderCache);
313
+ }
314
+ return shaderCache;
315
+ }
316
+
317
+ function applyOutputColorSpaceUniform(
318
+ outputColorSpace: "linear" | "srgb",
319
+ item: RenderItem,
320
+ shader: RenderShaderProgram,
321
+ uniforms: Map<string, UniformValue>
322
+ ): void {
323
+ if (!shader.reflection.uniforms.has("u_outputColorSpace")) return;
324
+ if (outputColorSpace !== "linear" && outputColorSpace !== "srgb") {
325
+ throw new RenderDeviceError("Forward pass outputColorSpace must be linear or srgb", "FORWARD_OUTPUT_COLOR_SPACE_CONTRACT", {
326
+ label: item.label,
327
+ outputColorSpace
328
+ });
329
+ }
330
+ uniforms.set("u_outputColorSpace", outputColorSpace === "srgb" ? 1 : 0);
331
+ }
332
+
333
+ function applyEnvironmentFogUniforms(
334
+ fog: ForwardEnvironmentFogOptions | false | undefined,
335
+ item: RenderItem,
336
+ shader: RenderShaderProgram,
337
+ uniforms: Map<string, UniformValue>
338
+ ): void {
339
+ const requiredUniforms = [
340
+ "u_environmentFogEnabled",
341
+ "u_environmentFogMode",
342
+ "u_environmentFogColor",
343
+ "u_environmentFogNear",
344
+ "u_environmentFogFar",
345
+ "u_environmentFogDensity",
346
+ "u_environmentFogHeightFalloff",
347
+ "u_environmentFogHeightReference",
348
+ "u_environmentFogMaxOpacity"
349
+ ];
350
+ if (!requiredUniforms.every((uniform) => shader.reflection.uniforms.has(uniform))) {
351
+ return;
352
+ }
353
+ if (!fog) {
354
+ uniforms.set("u_environmentFogEnabled", 0);
355
+ uniforms.set("u_environmentFogMode", 1);
356
+ uniforms.set("u_environmentFogColor", [0, 0, 0]);
357
+ uniforms.set("u_environmentFogNear", 0);
358
+ uniforms.set("u_environmentFogFar", 1);
359
+ uniforms.set("u_environmentFogDensity", 0);
360
+ uniforms.set("u_environmentFogHeightFalloff", 0);
361
+ uniforms.set("u_environmentFogHeightReference", 0);
362
+ uniforms.set("u_environmentFogMaxOpacity", 1);
363
+ return;
364
+ }
365
+ const color = Array.from(fog.color);
366
+ const heightFalloff = fog.heightFalloff ?? 0;
367
+ const heightReference = fog.heightReference ?? 0;
368
+ const maxOpacity = fog.maxOpacity ?? 1;
369
+ if (color.length !== 3 || !color.every((component) => Number.isFinite(component) && component >= 0 && component <= 1)) {
370
+ throw new RenderDeviceError("Forward environment fog color must contain three finite linear RGB values in [0, 1]", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
371
+ label: item.label,
372
+ color
373
+ });
374
+ }
375
+ if (!Number.isFinite(fog.near) || !Number.isFinite(fog.far) || fog.far <= fog.near) {
376
+ throw new RenderDeviceError("Forward environment fog requires finite far greater than near", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
377
+ label: item.label,
378
+ near: fog.near,
379
+ far: fog.far
380
+ });
381
+ }
382
+ if (!Number.isFinite(fog.density) || fog.density < 0) {
383
+ throw new RenderDeviceError("Forward environment fog density must be finite and non-negative", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
384
+ label: item.label,
385
+ density: fog.density
386
+ });
387
+ }
388
+ if (!Number.isFinite(heightFalloff) || heightFalloff < 0) {
389
+ throw new RenderDeviceError("Forward environment fog heightFalloff must be finite and non-negative", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
390
+ label: item.label,
391
+ heightFalloff
392
+ });
393
+ }
394
+ if (!Number.isFinite(heightReference)) {
395
+ throw new RenderDeviceError("Forward environment fog heightReference must be finite", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
396
+ label: item.label,
397
+ heightReference
398
+ });
399
+ }
400
+ if (!Number.isFinite(maxOpacity) || maxOpacity < 0 || maxOpacity > 1) {
401
+ throw new RenderDeviceError("Forward environment fog maxOpacity must be finite in [0, 1]", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
402
+ label: item.label,
403
+ maxOpacity
404
+ });
405
+ }
406
+ uniforms.set("u_environmentFogEnabled", 1);
407
+ uniforms.set("u_environmentFogMode", fogModeUniform(fog.mode, item.label));
408
+ uniforms.set("u_environmentFogColor", color);
409
+ uniforms.set("u_environmentFogNear", fog.near);
410
+ uniforms.set("u_environmentFogFar", fog.far);
411
+ uniforms.set("u_environmentFogDensity", fog.density);
412
+ uniforms.set("u_environmentFogHeightFalloff", heightFalloff);
413
+ uniforms.set("u_environmentFogHeightReference", heightReference);
414
+ uniforms.set("u_environmentFogMaxOpacity", maxOpacity);
415
+ }
416
+
417
+ function fogModeUniform(mode: ForwardEnvironmentFogMode, label: string | undefined): number {
418
+ switch (mode) {
419
+ case "linear":
420
+ return 1;
421
+ case "exponential":
422
+ return 2;
423
+ case "exponential-squared":
424
+ return 3;
425
+ default:
426
+ throw new RenderDeviceError("Forward environment fog mode must be linear, exponential, or exponential-squared", "FORWARD_ENVIRONMENT_FOG_CONTRACT", {
427
+ label,
428
+ mode
429
+ });
430
+ }
431
+ }
432
+
433
+ function validateMaterialGeometryContract(item: RenderItem, material: Material, geometry: Geometry): void {
434
+ const missing = material.requiredAttributes.filter((attribute) => !geometryHasAttribute(geometry, attribute));
435
+ if (missing.length === 0) {
436
+ return;
437
+ }
438
+ throw new RenderDeviceError("Render item geometry is missing attributes required by its material", "RENDER_ITEM_GEOMETRY_MATERIAL_CONTRACT", {
439
+ label: item.label,
440
+ material: material.name,
441
+ topology: geometry.topology,
442
+ vertexFormat: geometry.vertexBuffer.format.attributes.map((attribute) => attribute.shaderName),
443
+ missingAttributes: missing
444
+ });
445
+ }
446
+
447
+ function resolveDrawRange(geometry: Geometry, range: RenderItemDrawRange | undefined): { readonly start: number; readonly count: number } {
448
+ const available = geometry.indexBuffer?.count ?? geometry.vertexBuffer.vertexCount;
449
+ if (!range) {
450
+ return { start: 0, count: available };
451
+ }
452
+ if (!Number.isInteger(range.start) || range.start < 0 || !Number.isInteger(range.count) || range.count <= 0) {
453
+ throw new RenderDeviceError("Render item drawRange must contain non-negative integer start and positive integer count", "RENDER_ITEM_DRAW_RANGE_INVALID", {
454
+ start: range.start,
455
+ count: range.count,
456
+ available
457
+ });
458
+ }
459
+ if (range.start + range.count > available) {
460
+ throw new RenderDeviceError("Render item drawRange exceeds geometry draw count", "RENDER_ITEM_DRAW_RANGE_INVALID", {
461
+ start: range.start,
462
+ count: range.count,
463
+ available
464
+ });
465
+ }
466
+ return range;
467
+ }
468
+
469
+ function geometryHasAttribute(geometry: Geometry, attribute: string): boolean {
470
+ return geometry.vertexBuffer.format.attributes.some((candidate) => candidate.semantic === attribute || candidate.shaderName === attribute);
471
+ }
472
+
473
+ function shaderCacheKey(material: Material): string {
474
+ return material.shaderVariant ? `${material.shaderKey}:${material.shaderVariant}` : material.shaderKey;
475
+ }
476
+
477
+ function supportsInstanceUniforms(shader: RenderShaderProgram): boolean {
478
+ return shader.reflection.uniforms.has("u_instanceMatrices") && shader.reflection.uniforms.has("u_instanceCount");
479
+ }
480
+
481
+ function supportsInstanceAttributes(shader: RenderShaderProgram): boolean {
482
+ return shader.reflection.uniforms.has("u_instanceAttributeMode") &&
483
+ shader.reflection.uniforms.has("u_instanceCount") &&
484
+ INSTANCE_MATRIX_ATTRIBUTE_NAMES.every((name) => shader.reflection.attributes.has(name));
485
+ }
486
+
487
+ function renderStateForItem(renderState: RenderState, item: RenderItem): RenderState {
488
+ if (renderState.cullMode === "none") return renderState;
489
+ const modelMatrix = toMat4Values(item.modelMatrix ?? identityMatrix(), "modelMatrix", item.label);
490
+ if (!hasNegativeHandedness(modelMatrix)) return renderState;
491
+ return {
492
+ ...renderState,
493
+ cullMode: renderState.cullMode === "back" ? "front" : "back"
494
+ };
495
+ }
496
+
497
+ function instancedItemNeedsPerInstanceCullState(item: RenderItem): boolean {
498
+ const source = validateInstanceTransformSource(item);
499
+ const baseModel = toMat4Values(item.modelMatrix ?? identityMatrix(), "modelMatrix", item.label);
500
+ const handedness = new Set<boolean>();
501
+ for (let offset = 0; offset < source.length; offset += 16) {
502
+ const instanceMatrix = mat4FromArrayLike(source, offset);
503
+ handedness.add(hasNegativeHandedness(multiplyMat4(baseModel, instanceMatrix)));
504
+ }
505
+ return handedness.has(true);
506
+ }
507
+
508
+ function expandInstancedRenderItem(item: RenderItem): readonly RenderItem[] {
509
+ const source = validateInstanceTransformSource(item);
510
+ const baseModel = toMat4Values(item.modelMatrix ?? identityMatrix(), "modelMatrix", item.label);
511
+ const baseModelViewProjection = toMat4Values(item.modelViewProjectionMatrix ?? baseModel, "modelViewProjectionMatrix", item.label);
512
+ const { instanceTransforms: _instanceTransforms, normalMatrix: _normalMatrix, ...baseItem } = item;
513
+ const expanded: RenderItem[] = [];
514
+ for (let offset = 0; offset < source.length; offset += 16) {
515
+ const index = offset / 16;
516
+ const instanceMatrix = mat4FromArrayLike(source, offset);
517
+ const modelMatrix = multiplyMat4(baseModel, instanceMatrix);
518
+ expanded.push({
519
+ ...baseItem,
520
+ label: item.label ? `${item.label}#instance-${index}` : undefined,
521
+ modelMatrix: new Float32Array(modelMatrix),
522
+ modelViewProjectionMatrix: new Float32Array(multiplyMat4(baseModelViewProjection, instanceMatrix)),
523
+ normalMatrix: new Float32Array(normalMatrixFromModel(modelMatrix))
524
+ });
525
+ }
526
+ return expanded;
527
+ }
528
+
529
+ function multiplyMat4(left: Mat4, right: Mat4): Mat4 {
530
+ const out = new Array(16).fill(0) as Mat4;
531
+ for (let column = 0; column < 4; column += 1) {
532
+ for (let row = 0; row < 4; row += 1) {
533
+ out[column * 4 + row] =
534
+ left[0 * 4 + row] * right[column * 4 + 0] +
535
+ left[1 * 4 + row] * right[column * 4 + 1] +
536
+ left[2 * 4 + row] * right[column * 4 + 2] +
537
+ left[3 * 4 + row] * right[column * 4 + 3];
538
+ }
539
+ }
540
+ return out;
541
+ }
542
+
543
+ function normalMatrixFromModel(modelMatrix: Mat4): Mat4 {
544
+ const matrix = transposeMat4(invertMat4(modelMatrix));
545
+ return [
546
+ matrix[0], matrix[1], matrix[2], 0,
547
+ matrix[4], matrix[5], matrix[6], 0,
548
+ matrix[8], matrix[9], matrix[10], 0,
549
+ 0, 0, 0, 1
550
+ ];
551
+ }
552
+
553
+ function hasNegativeHandedness(matrix: Mat4): boolean {
554
+ const determinant =
555
+ matrix[0] * (matrix[5] * matrix[10] - matrix[9] * matrix[6]) -
556
+ matrix[4] * (matrix[1] * matrix[10] - matrix[9] * matrix[2]) +
557
+ matrix[8] * (matrix[1] * matrix[6] - matrix[5] * matrix[2]);
558
+ return Number.isFinite(determinant) && determinant < -1e-8;
559
+ }
560
+
561
+ function transposeMat4(matrix: Mat4): Mat4 {
562
+ return [
563
+ matrix[0], matrix[4], matrix[8], matrix[12],
564
+ matrix[1], matrix[5], matrix[9], matrix[13],
565
+ matrix[2], matrix[6], matrix[10], matrix[14],
566
+ matrix[3], matrix[7], matrix[11], matrix[15]
567
+ ];
568
+ }
569
+
570
+ function invertMat4(matrix: Mat4): Mat4 {
571
+ const [
572
+ a00, a01, a02, a03,
573
+ a10, a11, a12, a13,
574
+ a20, a21, a22, a23,
575
+ a30, a31, a32, a33
576
+ ] = matrix;
577
+ const b00 = a00 * a11 - a01 * a10;
578
+ const b01 = a00 * a12 - a02 * a10;
579
+ const b02 = a00 * a13 - a03 * a10;
580
+ const b03 = a01 * a12 - a02 * a11;
581
+ const b04 = a01 * a13 - a03 * a11;
582
+ const b05 = a02 * a13 - a03 * a12;
583
+ const b06 = a20 * a31 - a21 * a30;
584
+ const b07 = a20 * a32 - a22 * a30;
585
+ const b08 = a20 * a33 - a23 * a30;
586
+ const b09 = a21 * a32 - a22 * a31;
587
+ const b10 = a21 * a33 - a23 * a31;
588
+ const b11 = a22 * a33 - a23 * a32;
589
+ const det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
590
+ if (Math.abs(det) <= 1e-12 || !Number.isFinite(det)) {
591
+ throw new RenderDeviceError("Instance transform fallback requires invertible model matrices", "INSTANCING_CONTRACT");
592
+ }
593
+ const invDet = 1 / det;
594
+ return [
595
+ (a11 * b11 - a12 * b10 + a13 * b09) * invDet,
596
+ (a02 * b10 - a01 * b11 - a03 * b09) * invDet,
597
+ (a31 * b05 - a32 * b04 + a33 * b03) * invDet,
598
+ (a22 * b04 - a21 * b05 - a23 * b03) * invDet,
599
+ (a12 * b08 - a10 * b11 - a13 * b07) * invDet,
600
+ (a00 * b11 - a02 * b08 + a03 * b07) * invDet,
601
+ (a32 * b02 - a30 * b05 - a33 * b01) * invDet,
602
+ (a20 * b05 - a22 * b02 + a23 * b01) * invDet,
603
+ (a10 * b10 - a11 * b08 + a13 * b06) * invDet,
604
+ (a01 * b08 - a00 * b10 - a03 * b06) * invDet,
605
+ (a30 * b04 - a31 * b02 + a33 * b00) * invDet,
606
+ (a21 * b02 - a20 * b04 - a23 * b00) * invDet,
607
+ (a11 * b07 - a10 * b09 - a12 * b06) * invDet,
608
+ (a00 * b09 - a01 * b07 + a02 * b06) * invDet,
609
+ (a31 * b01 - a30 * b03 - a32 * b00) * invDet,
610
+ (a20 * b03 - a21 * b01 + a22 * b00) * invDet
611
+ ];
612
+ }
613
+
614
+ function applyForwardShadowMapUniforms(
615
+ shadowMap: ForwardShadowMapOptions | undefined,
616
+ item: RenderItem,
617
+ shader: RenderShaderProgram,
618
+ uniforms: Map<string, UniformValue>
619
+ ): void {
620
+ const requiredUniforms = [
621
+ "u_shadowMapTexture",
622
+ "u_shadowMapEnabled",
623
+ "u_shadowMapMatrix",
624
+ "u_shadowMapStrength",
625
+ "u_shadowMapBias",
626
+ "u_shadowMapSlopeBias",
627
+ "u_shadowMapTexelSize",
628
+ "u_shadowPcfSampleCount",
629
+ "u_shadowPcfSamples"
630
+ ];
631
+ if (!requiredUniforms.every((uniform) => shader.reflection.uniforms.has(uniform))) {
632
+ return;
633
+ }
634
+ applyForwardPointShadowMapUniforms(shadowMap?.pointLight, item, shader, uniforms);
635
+ if (!shadowMap) {
636
+ uniforms.set("u_shadowMapTexture", new TextureBinding({ name: "u_shadowMapTexture", required: false }));
637
+ uniforms.set("u_shadowMapEnabled", 0);
638
+ uniforms.set("u_shadowMapMatrix", new Float32Array(identityMatrix()));
639
+ uniforms.set("u_shadowMapStrength", 0);
640
+ uniforms.set("u_shadowMapBias", 0);
641
+ uniforms.set("u_shadowMapSlopeBias", 0);
642
+ uniforms.set("u_shadowMapTexelSize", [1, 1]);
643
+ uniforms.set("u_shadowPcfSampleCount", 1);
644
+ uniforms.set("u_shadowPcfSamples", new Float32Array(MAX_FORWARD_SHADOW_PCF_SAMPLES * 4));
645
+ return;
646
+ }
647
+ const validation = shadowMap.texture.validate();
648
+ if (!validation.ok) {
649
+ throw new RenderDeviceError("Forward shadow-map texture binding validation failed", "FORWARD_SHADOW_MAP_CONTRACT", {
650
+ label: item.label,
651
+ diagnostics: validation.diagnostics
652
+ });
653
+ }
654
+ const strength = shadowMap.strength ?? 0.65;
655
+ const bias = shadowMap.bias ?? 0.001;
656
+ const slopeBias = shadowMap.slopeBias ?? 1;
657
+ const texelSize = shadowMap.texelSize ?? [
658
+ 1 / Math.max(1, shadowMap.texture.texture?.width ?? 1),
659
+ 1 / Math.max(1, shadowMap.texture.texture?.height ?? 1)
660
+ ];
661
+ if (!Number.isFinite(strength) || strength < 0 || strength > 1) {
662
+ throw new RenderDeviceError("Forward shadow-map strength must be finite in [0, 1]", "FORWARD_SHADOW_MAP_CONTRACT", {
663
+ label: item.label,
664
+ strength
665
+ });
666
+ }
667
+ if (!Number.isFinite(bias) || bias < 0) {
668
+ throw new RenderDeviceError("Forward shadow-map bias must be finite and non-negative", "FORWARD_SHADOW_MAP_CONTRACT", {
669
+ label: item.label,
670
+ bias
671
+ });
672
+ }
673
+ if (!Number.isFinite(slopeBias) || slopeBias < 0) {
674
+ throw new RenderDeviceError("Forward shadow-map slopeBias must be finite and non-negative", "FORWARD_SHADOW_MAP_CONTRACT", {
675
+ label: item.label,
676
+ slopeBias
677
+ });
678
+ }
679
+ if (texelSize.length !== 2 || !texelSize.every((value) => Number.isFinite(value) && value > 0)) {
680
+ throw new RenderDeviceError("Forward shadow-map texelSize must contain two finite positive values", "FORWARD_SHADOW_MAP_CONTRACT", {
681
+ label: item.label,
682
+ texelSize: Array.from(texelSize)
683
+ });
684
+ }
685
+ const filterKernel = shadowMap.filterKernel ?? DEFAULT_FORWARD_SHADOW_FILTER_KERNEL;
686
+ const pcfSamples = packForwardShadowPcfSamples(filterKernel, item.label);
687
+ uniforms.set("u_shadowMapTexture", shadowMap.texture);
688
+ uniforms.set("u_shadowMapEnabled", 1);
689
+ uniforms.set("u_shadowMapMatrix", toMat4Uniform(shadowMap.lightMatrix, "shadowMap.lightMatrix", item.label));
690
+ uniforms.set("u_shadowMapStrength", strength);
691
+ uniforms.set("u_shadowMapBias", bias);
692
+ uniforms.set("u_shadowMapSlopeBias", slopeBias);
693
+ uniforms.set("u_shadowMapTexelSize", texelSize);
694
+ uniforms.set("u_shadowPcfSampleCount", filterKernel.samples.length);
695
+ uniforms.set("u_shadowPcfSamples", pcfSamples);
696
+ }
697
+
698
+ function applyForwardPointShadowMapUniforms(
699
+ pointShadowMap: ForwardPointShadowMapOptions | undefined,
700
+ item: RenderItem,
701
+ shader: RenderShaderProgram,
702
+ uniforms: Map<string, UniformValue>
703
+ ): void {
704
+ const requiredUniforms = [
705
+ "u_pointShadowMapTexture",
706
+ "u_pointShadowMapEnabled",
707
+ "u_pointShadowLightPosition",
708
+ "u_pointShadowRange",
709
+ "u_pointShadowFaceMatrices",
710
+ "u_pointShadowFaceRects",
711
+ "u_pointShadowStrength",
712
+ "u_pointShadowBias",
713
+ "u_pointShadowSlopeBias",
714
+ "u_pointShadowTexelSize",
715
+ "u_pointShadowPcfSampleCount",
716
+ "u_pointShadowPcfSamples"
717
+ ];
718
+ if (!requiredUniforms.every((uniform) => shader.reflection.uniforms.has(uniform))) {
719
+ return;
720
+ }
721
+ if (!pointShadowMap) {
722
+ uniforms.set("u_pointShadowMapTexture", new TextureBinding({ name: "u_pointShadowMapTexture", required: false }));
723
+ uniforms.set("u_pointShadowMapEnabled", 0);
724
+ uniforms.set("u_pointShadowLightPosition", [0, 0, 0]);
725
+ uniforms.set("u_pointShadowRange", 1);
726
+ uniforms.set("u_pointShadowFaceMatrices", new Float32Array(6 * 16));
727
+ uniforms.set("u_pointShadowFaceRects", new Float32Array(6 * 4));
728
+ uniforms.set("u_pointShadowStrength", 0);
729
+ uniforms.set("u_pointShadowBias", 0);
730
+ uniforms.set("u_pointShadowSlopeBias", 0);
731
+ uniforms.set("u_pointShadowTexelSize", [1, 1]);
732
+ uniforms.set("u_pointShadowPcfSampleCount", 1);
733
+ uniforms.set("u_pointShadowPcfSamples", new Float32Array(MAX_FORWARD_SHADOW_PCF_SAMPLES * 4));
734
+ return;
735
+ }
736
+ const validation = pointShadowMap.texture.validate();
737
+ if (!validation.ok) {
738
+ throw new RenderDeviceError("Forward point-shadow atlas texture binding validation failed", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
739
+ label: item.label,
740
+ diagnostics: validation.diagnostics
741
+ });
742
+ }
743
+ if (pointShadowMap.lightPosition.length !== 3 || !isFiniteArrayLike(pointShadowMap.lightPosition)) {
744
+ throw new RenderDeviceError("Forward point-shadow lightPosition must contain three finite values", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
745
+ label: item.label,
746
+ lightPosition: pointShadowMap.lightPosition
747
+ });
748
+ }
749
+ if (!Number.isFinite(pointShadowMap.range) || pointShadowMap.range <= 0) {
750
+ throw new RenderDeviceError("Forward point-shadow range must be finite and positive", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
751
+ label: item.label,
752
+ range: pointShadowMap.range
753
+ });
754
+ }
755
+ const faceMatrices = toFloat32Array(pointShadowMap.faceMatrices, 6 * 16, "pointShadowMap.faceMatrices", item.label);
756
+ const faceRects = toFloat32Array(pointShadowMap.faceRects, 6 * 4, "pointShadowMap.faceRects", item.label);
757
+ validatePointShadowFaceRects(faceRects, item.label);
758
+ const strength = pointShadowMap.strength ?? 0.65;
759
+ const bias = pointShadowMap.bias ?? 0.001;
760
+ const slopeBias = pointShadowMap.slopeBias ?? 1;
761
+ const texelSize = pointShadowMap.texelSize ?? [
762
+ 1 / Math.max(1, pointShadowMap.texture.texture?.width ?? 1),
763
+ 1 / Math.max(1, pointShadowMap.texture.texture?.height ?? 1)
764
+ ];
765
+ if (!Number.isFinite(strength) || strength < 0 || strength > 1) {
766
+ throw new RenderDeviceError("Forward point-shadow strength must be finite in [0, 1]", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
767
+ label: item.label,
768
+ strength
769
+ });
770
+ }
771
+ if (!Number.isFinite(bias) || bias < 0) {
772
+ throw new RenderDeviceError("Forward point-shadow bias must be finite and non-negative", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
773
+ label: item.label,
774
+ bias
775
+ });
776
+ }
777
+ if (!Number.isFinite(slopeBias) || slopeBias < 0) {
778
+ throw new RenderDeviceError("Forward point-shadow slopeBias must be finite and non-negative", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
779
+ label: item.label,
780
+ slopeBias
781
+ });
782
+ }
783
+ if (texelSize.length !== 2 || !texelSize.every((value) => Number.isFinite(value) && value > 0)) {
784
+ throw new RenderDeviceError("Forward point-shadow texelSize must contain two finite positive values", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
785
+ label: item.label,
786
+ texelSize: Array.from(texelSize)
787
+ });
788
+ }
789
+ const filterKernel = pointShadowMap.filterKernel ?? DEFAULT_FORWARD_SHADOW_FILTER_KERNEL;
790
+ uniforms.set("u_pointShadowMapTexture", pointShadowMap.texture);
791
+ uniforms.set("u_pointShadowMapEnabled", 1);
792
+ uniforms.set("u_pointShadowLightPosition", pointShadowMap.lightPosition);
793
+ uniforms.set("u_pointShadowRange", pointShadowMap.range);
794
+ uniforms.set("u_pointShadowFaceMatrices", faceMatrices);
795
+ uniforms.set("u_pointShadowFaceRects", faceRects);
796
+ uniforms.set("u_pointShadowStrength", strength);
797
+ uniforms.set("u_pointShadowBias", bias);
798
+ uniforms.set("u_pointShadowSlopeBias", slopeBias);
799
+ uniforms.set("u_pointShadowTexelSize", texelSize);
800
+ uniforms.set("u_pointShadowPcfSampleCount", filterKernel.samples.length);
801
+ uniforms.set("u_pointShadowPcfSamples", packForwardShadowPcfSamples(filterKernel, item.label));
802
+ }
803
+
804
+ function toFloat32Array(values: Float32Array | readonly number[], expectedLength: number, name: string, label: string | undefined): Float32Array {
805
+ const source = values instanceof Float32Array ? values : new Float32Array(values);
806
+ if (source.length !== expectedLength || !isFiniteArrayLike(source)) {
807
+ throw new RenderDeviceError(`${name} must contain ${expectedLength} finite values`, "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
808
+ label,
809
+ length: source.length,
810
+ expectedLength
811
+ });
812
+ }
813
+ return source;
814
+ }
815
+
816
+ function validatePointShadowFaceRects(faceRects: Float32Array, label: string | undefined): void {
817
+ for (let offset = 0; offset < faceRects.length; offset += 4) {
818
+ const rect = [faceRects[offset], faceRects[offset + 1], faceRects[offset + 2], faceRects[offset + 3]];
819
+ if (!rect.every((value) => Number.isFinite(value) && value >= 0 && value <= 1) || rect[2]! <= 0 || rect[3]! <= 0) {
820
+ throw new RenderDeviceError("Forward point-shadow face rects must be normalized atlas rectangles", "FORWARD_POINT_SHADOW_MAP_CONTRACT", {
821
+ label,
822
+ face: offset / 4,
823
+ rect
824
+ });
825
+ }
826
+ }
827
+ }
828
+
829
+ function packForwardShadowPcfSamples(filterKernel: ShadowFilterKernel, label: string | undefined): Float32Array {
830
+ if (filterKernel.samples.length < 1 || filterKernel.samples.length > MAX_FORWARD_SHADOW_PCF_SAMPLES) {
831
+ throw new RenderDeviceError("Forward shadow-map PCF kernel must contain 1 to 32 samples", "FORWARD_SHADOW_MAP_CONTRACT", {
832
+ label,
833
+ samples: filterKernel.samples.length
834
+ });
835
+ }
836
+ const packed = new Float32Array(MAX_FORWARD_SHADOW_PCF_SAMPLES * 4);
837
+ let weightSum = 0;
838
+ for (const [index, sample] of filterKernel.samples.entries()) {
839
+ if (![sample.x, sample.y, sample.weight].every(Number.isFinite) || sample.weight < 0) {
840
+ throw new RenderDeviceError("Forward shadow-map PCF samples must contain finite offsets and non-negative weights", "FORWARD_SHADOW_MAP_CONTRACT", {
841
+ label,
842
+ sample
843
+ });
844
+ }
845
+ const offset = index * 4;
846
+ packed[offset] = sample.x;
847
+ packed[offset + 1] = sample.y;
848
+ packed[offset + 2] = sample.weight;
849
+ weightSum += sample.weight;
850
+ }
851
+ if (weightSum <= 0) {
852
+ throw new RenderDeviceError("Forward shadow-map PCF sample weights must sum to a positive value", "FORWARD_SHADOW_MAP_CONTRACT", {
853
+ label,
854
+ weightSum
855
+ });
856
+ }
857
+ return packed;
858
+ }
859
+
860
+ function applyEnvironmentLightingUniforms(
861
+ environment: EnvironmentLightingOptions | undefined,
862
+ item: RenderItem,
863
+ shader: RenderShaderProgram,
864
+ uniforms: Map<string, UniformValue>
865
+ ): void {
866
+ if (!environment) {
867
+ clearProceduralEnvironmentMapUniforms(shader, uniforms);
868
+ clearSampledEnvironmentMapUniforms(shader, uniforms);
869
+ clearEnvironmentBrdfLutUniforms(shader, uniforms);
870
+ return;
871
+ }
872
+ if (!shader.reflection.uniforms.has("u_environmentColor") || !shader.reflection.uniforms.has("u_environmentIntensity")) {
873
+ return;
874
+ }
875
+ const color = environment.color;
876
+ if (color.length !== 3 || !isFiniteColor(color)) {
877
+ throw new RenderDeviceError("Environment lighting color must contain three finite values in [0, 1]", "ENVIRONMENT_LIGHTING_CONTRACT", {
878
+ label: item.label,
879
+ color
880
+ });
881
+ }
882
+ if (!Number.isFinite(environment.intensity) || environment.intensity < 0) {
883
+ throw new RenderDeviceError("Environment lighting intensity must be finite and non-negative", "ENVIRONMENT_LIGHTING_CONTRACT", {
884
+ label: item.label,
885
+ intensity: environment.intensity
886
+ });
887
+ }
888
+ uniforms.set("u_environmentColor", color);
889
+ uniforms.set("u_environmentIntensity", environment.intensity);
890
+ applyProceduralEnvironmentMapUniforms(environment.proceduralMap, item, shader, uniforms);
891
+ applySampledEnvironmentMapUniforms(environment, item, shader, uniforms);
892
+ }
893
+
894
+ function applyProceduralEnvironmentMapUniforms(
895
+ proceduralMap: ProceduralEnvironmentMapLightingOptions | undefined,
896
+ item: RenderItem,
897
+ shader: RenderShaderProgram,
898
+ uniforms: Map<string, UniformValue>
899
+ ): void {
900
+ if (!proceduralMap) {
901
+ clearProceduralEnvironmentMapUniforms(shader, uniforms);
902
+ return;
903
+ }
904
+ const requiredUniforms = [
905
+ "u_environmentSkyColor",
906
+ "u_environmentHorizonColor",
907
+ "u_environmentGroundColor",
908
+ "u_environmentSpecularColor",
909
+ "u_environmentMapIntensity",
910
+ "u_environmentSpecularIntensity"
911
+ ];
912
+ if (!requiredUniforms.every((uniform) => shader.reflection.uniforms.has(uniform))) {
913
+ return;
914
+ }
915
+ const skyColor = toEnvironmentColor(proceduralMap.skyColor, "proceduralMap.skyColor", item.label);
916
+ const horizonColor = toEnvironmentColor(proceduralMap.horizonColor, "proceduralMap.horizonColor", item.label);
917
+ const groundColor = toEnvironmentColor(proceduralMap.groundColor, "proceduralMap.groundColor", item.label);
918
+ const specularColor = toEnvironmentColor(proceduralMap.specularColor, "proceduralMap.specularColor", item.label);
919
+ if (!Number.isFinite(proceduralMap.intensity) || proceduralMap.intensity < 0) {
920
+ throw new RenderDeviceError("Procedural environment map intensity must be finite and non-negative", "ENVIRONMENT_LIGHTING_CONTRACT", {
921
+ label: item.label,
922
+ intensity: proceduralMap.intensity
923
+ });
924
+ }
925
+ if (!Number.isFinite(proceduralMap.specularIntensity) || proceduralMap.specularIntensity < 0) {
926
+ throw new RenderDeviceError("Procedural environment map specularIntensity must be finite and non-negative", "ENVIRONMENT_LIGHTING_CONTRACT", {
927
+ label: item.label,
928
+ specularIntensity: proceduralMap.specularIntensity
929
+ });
930
+ }
931
+ uniforms.set("u_environmentSkyColor", skyColor);
932
+ uniforms.set("u_environmentHorizonColor", horizonColor);
933
+ uniforms.set("u_environmentGroundColor", groundColor);
934
+ uniforms.set("u_environmentSpecularColor", specularColor);
935
+ uniforms.set("u_environmentMapIntensity", proceduralMap.intensity);
936
+ uniforms.set("u_environmentSpecularIntensity", proceduralMap.specularIntensity);
937
+ }
938
+
939
+ function clearProceduralEnvironmentMapUniforms(
940
+ shader: RenderShaderProgram,
941
+ uniforms: Map<string, UniformValue>
942
+ ): void {
943
+ if (shader.reflection.uniforms.has("u_environmentMapIntensity")) {
944
+ uniforms.set("u_environmentMapIntensity", 0);
945
+ }
946
+ if (shader.reflection.uniforms.has("u_environmentSpecularIntensity")) {
947
+ uniforms.set("u_environmentSpecularIntensity", 0);
948
+ }
949
+ }
950
+
951
+ function applySampledEnvironmentMapUniforms(
952
+ environment: EnvironmentLightingOptions,
953
+ item: RenderItem,
954
+ shader: RenderShaderProgram,
955
+ uniforms: Map<string, UniformValue>
956
+ ): void {
957
+ const environmentMapTexture = environment.environmentMapTexture;
958
+ const environmentCubeMapTexture = environment.environmentCubeMapTexture;
959
+ if (!environmentMapTexture && !environmentCubeMapTexture) {
960
+ clearSampledEnvironmentMapUniforms(shader, uniforms);
961
+ clearEnvironmentBrdfLutUniforms(shader, uniforms);
962
+ return;
963
+ }
964
+ const requiredUniforms = [
965
+ "u_environmentMapTexture",
966
+ "u_environmentMapTextureEnabled",
967
+ "u_environmentMapTextureIntensity",
968
+ "u_environmentMapTextureSpecularIntensity",
969
+ "u_environmentMapTextureRotation",
970
+ "u_environmentMapTextureMipCount"
971
+ ];
972
+ if (!requiredUniforms.every((uniform) => shader.reflection.uniforms.has(uniform))) {
973
+ return;
974
+ }
975
+ if (environmentMapTexture) {
976
+ validateEnvironmentTextureBinding("Environment map texture", environmentMapTexture, "2d", item);
977
+ }
978
+ if (environmentCubeMapTexture) {
979
+ validateEnvironmentTextureBinding("Environment cube map texture", environmentCubeMapTexture, "cube", item);
980
+ }
981
+ const intensity = environment.environmentMapIntensity ?? 1;
982
+ const specularIntensity = environment.environmentMapSpecularIntensity ?? 0.5;
983
+ const rotation = environment.environmentMapRotation ?? 0;
984
+ const mipCount = environment.environmentMapMipCount ?? 1;
985
+ const encoding = environment.environmentMapEncoding ?? "srgb";
986
+ if (!Number.isFinite(intensity) || intensity < 0) {
987
+ throw new RenderDeviceError("Sampled environment map intensity must be finite and non-negative", "ENVIRONMENT_LIGHTING_CONTRACT", {
988
+ label: item.label,
989
+ intensity
990
+ });
991
+ }
992
+ if (!Number.isFinite(specularIntensity) || specularIntensity < 0) {
993
+ throw new RenderDeviceError("Sampled environment map specular intensity must be finite and non-negative", "ENVIRONMENT_LIGHTING_CONTRACT", {
994
+ label: item.label,
995
+ specularIntensity
996
+ });
997
+ }
998
+ if (!Number.isFinite(rotation)) {
999
+ throw new RenderDeviceError("Sampled environment map rotation must be finite", "ENVIRONMENT_LIGHTING_CONTRACT", {
1000
+ label: item.label,
1001
+ rotation
1002
+ });
1003
+ }
1004
+ if (!Number.isInteger(mipCount) || mipCount < 1) {
1005
+ throw new RenderDeviceError("Sampled environment map mip count must be a positive integer", "ENVIRONMENT_LIGHTING_CONTRACT", {
1006
+ label: item.label,
1007
+ mipCount
1008
+ });
1009
+ }
1010
+ if (encoding !== "srgb" && encoding !== "rgbe" && encoding !== "linear") {
1011
+ throw new RenderDeviceError("Sampled environment map encoding must be srgb, rgbe, or linear", "ENVIRONMENT_LIGHTING_CONTRACT", {
1012
+ label: item.label,
1013
+ encoding
1014
+ });
1015
+ }
1016
+ uniforms.set(
1017
+ "u_environmentMapTexture",
1018
+ environmentMapTexture ?? new TextureBinding({ name: "u_environmentMapTexture", required: false, expectedDimension: "2d" })
1019
+ );
1020
+ if (shader.reflection.uniforms.has("u_environmentCubeMapTexture")) {
1021
+ uniforms.set(
1022
+ "u_environmentCubeMapTexture",
1023
+ environmentCubeMapTexture ?? new TextureBinding({ name: "u_environmentCubeMapTexture", required: false, expectedDimension: "cube" })
1024
+ );
1025
+ }
1026
+ uniforms.set("u_environmentMapTextureEnabled", 1);
1027
+ if (shader.reflection.uniforms.has("u_environmentCubeMapTextureEnabled")) {
1028
+ uniforms.set("u_environmentCubeMapTextureEnabled", environmentCubeMapTexture ? 1 : 0);
1029
+ }
1030
+ uniforms.set("u_environmentMapTextureIntensity", intensity);
1031
+ uniforms.set("u_environmentMapTextureSpecularIntensity", specularIntensity);
1032
+ uniforms.set("u_environmentMapTextureRotation", rotation);
1033
+ uniforms.set("u_environmentMapTextureMipCount", mipCount);
1034
+ if (shader.reflection.uniforms.has("u_environmentMapTextureEncoding")) {
1035
+ uniforms.set("u_environmentMapTextureEncoding", encoding === "rgbe" ? 1 : encoding === "linear" ? 2 : 0);
1036
+ }
1037
+ applyEnvironmentBrdfLutUniforms(environment, item, shader, uniforms);
1038
+ }
1039
+
1040
+ function clearSampledEnvironmentMapUniforms(
1041
+ shader: RenderShaderProgram,
1042
+ uniforms: Map<string, UniformValue>
1043
+ ): void {
1044
+ if (shader.reflection.uniforms.has("u_environmentMapTexture")) {
1045
+ uniforms.set("u_environmentMapTexture", new TextureBinding({ name: "u_environmentMapTexture", required: false, expectedDimension: "2d" }));
1046
+ }
1047
+ if (shader.reflection.uniforms.has("u_environmentCubeMapTexture")) {
1048
+ uniforms.set("u_environmentCubeMapTexture", new TextureBinding({ name: "u_environmentCubeMapTexture", required: false, expectedDimension: "cube" }));
1049
+ }
1050
+ if (shader.reflection.uniforms.has("u_environmentMapTextureEnabled")) {
1051
+ uniforms.set("u_environmentMapTextureEnabled", 0);
1052
+ }
1053
+ if (shader.reflection.uniforms.has("u_environmentCubeMapTextureEnabled")) {
1054
+ uniforms.set("u_environmentCubeMapTextureEnabled", 0);
1055
+ }
1056
+ if (shader.reflection.uniforms.has("u_environmentMapTextureIntensity")) {
1057
+ uniforms.set("u_environmentMapTextureIntensity", 0);
1058
+ }
1059
+ if (shader.reflection.uniforms.has("u_environmentMapTextureSpecularIntensity")) {
1060
+ uniforms.set("u_environmentMapTextureSpecularIntensity", 0);
1061
+ }
1062
+ if (shader.reflection.uniforms.has("u_environmentMapTextureEncoding")) {
1063
+ uniforms.set("u_environmentMapTextureEncoding", 0);
1064
+ }
1065
+ }
1066
+
1067
+ function validateEnvironmentTextureBinding(
1068
+ label: string,
1069
+ binding: TextureBinding,
1070
+ expectedDimension: "2d" | "cube",
1071
+ item: RenderItem
1072
+ ): void {
1073
+ const validation = binding.validate();
1074
+ if (!validation.ok) {
1075
+ throw new RenderDeviceError(`${label} binding validation failed`, "ENVIRONMENT_LIGHTING_CONTRACT", {
1076
+ label: item.label,
1077
+ diagnostics: validation.diagnostics
1078
+ });
1079
+ }
1080
+ if (binding.texture?.dimension !== expectedDimension) {
1081
+ throw new RenderDeviceError(`${label} must bind a ${expectedDimension} texture`, "ENVIRONMENT_LIGHTING_CONTRACT", {
1082
+ label: item.label,
1083
+ texture: binding.name,
1084
+ expectedDimension,
1085
+ actualDimension: binding.texture?.dimension ?? null
1086
+ });
1087
+ }
1088
+ }
1089
+
1090
+ function applyEnvironmentBrdfLutUniforms(
1091
+ environment: EnvironmentLightingOptions,
1092
+ item: RenderItem,
1093
+ shader: RenderShaderProgram,
1094
+ uniforms: Map<string, UniformValue>
1095
+ ): void {
1096
+ if (!environment.environmentBrdfLutTexture) {
1097
+ clearEnvironmentBrdfLutUniforms(shader, uniforms);
1098
+ return;
1099
+ }
1100
+ if (!shader.reflection.uniforms.has("u_environmentBrdfLutTexture") || !shader.reflection.uniforms.has("u_environmentBrdfLutEnabled")) {
1101
+ return;
1102
+ }
1103
+ const validation = environment.environmentBrdfLutTexture.validate();
1104
+ if (!validation.ok) {
1105
+ throw new RenderDeviceError("Environment BRDF LUT texture binding validation failed", "ENVIRONMENT_LIGHTING_CONTRACT", {
1106
+ label: item.label,
1107
+ diagnostics: validation.diagnostics
1108
+ });
1109
+ }
1110
+ uniforms.set("u_environmentBrdfLutTexture", environment.environmentBrdfLutTexture);
1111
+ uniforms.set("u_environmentBrdfLutEnabled", 1);
1112
+ }
1113
+
1114
+ function clearEnvironmentBrdfLutUniforms(
1115
+ shader: RenderShaderProgram,
1116
+ uniforms: Map<string, UniformValue>
1117
+ ): void {
1118
+ if (shader.reflection.uniforms.has("u_environmentBrdfLutTexture")) {
1119
+ uniforms.set("u_environmentBrdfLutTexture", new TextureBinding({ name: "u_environmentBrdfLutTexture", required: false }));
1120
+ }
1121
+ if (shader.reflection.uniforms.has("u_environmentBrdfLutEnabled")) {
1122
+ uniforms.set("u_environmentBrdfLutEnabled", 0);
1123
+ }
1124
+ }
1125
+
1126
+ function toEnvironmentColor(value: readonly number[], field: string, label?: string): readonly number[] {
1127
+ if (value.length !== 3 || !isFiniteColor(value)) {
1128
+ throw new RenderDeviceError("Procedural environment map colors must contain three finite values in [0, 1]", "ENVIRONMENT_LIGHTING_CONTRACT", {
1129
+ label,
1130
+ field,
1131
+ color: value
1132
+ });
1133
+ }
1134
+ return value;
1135
+ }
1136
+
1137
+ function applyCameraUniforms(
1138
+ cameraPosition: readonly [number, number, number] | undefined,
1139
+ item: RenderItem,
1140
+ shader: RenderShaderProgram,
1141
+ uniforms: Map<string, UniformValue>
1142
+ ): void {
1143
+ if (!shader.reflection.uniforms.has("u_cameraPosition")) return;
1144
+ const position = cameraPosition ?? [0, 0, 1];
1145
+ if (position.length !== 3 || position.some((value) => !Number.isFinite(value))) {
1146
+ throw new RenderDeviceError("Forward pass camera position must be a finite vec3", "FORWARD_CAMERA_CONTRACT", {
1147
+ label: item.label,
1148
+ cameraPosition: [...position]
1149
+ });
1150
+ }
1151
+ uniforms.set("u_cameraPosition", [...position]);
1152
+ }
1153
+
1154
+ function applyAlphaCutoffUniform(
1155
+ item: RenderItem,
1156
+ shader: RenderShaderProgram,
1157
+ uniforms: Map<string, UniformValue>
1158
+ ): void {
1159
+ if (!shader.reflection.uniforms.has("u_alphaCutoff") || uniforms.has("u_alphaCutoff")) return;
1160
+ uniforms.set("u_alphaCutoff", 0);
1161
+ }
1162
+
1163
+ function applyTransformUniforms(
1164
+ item: RenderItem,
1165
+ shader: RenderShaderProgram,
1166
+ uniforms: Map<string, UniformValue>
1167
+ ): void {
1168
+ const modelMatrix = shader.reflection.uniforms.has("u_modelMatrix") || shader.reflection.uniforms.has("u_normalMatrix")
1169
+ ? toMat4Uniform(item.modelMatrix ?? identityMatrix(), "modelMatrix", item.label)
1170
+ : undefined;
1171
+ if (item.modelViewProjectionMatrix && shader.reflection.uniforms.has("u_modelViewProjection")) {
1172
+ uniforms.set("u_modelViewProjection", toMat4Uniform(item.modelViewProjectionMatrix, "modelViewProjectionMatrix", item.label));
1173
+ }
1174
+ if (modelMatrix && shader.reflection.uniforms.has("u_modelMatrix")) {
1175
+ uniforms.set("u_modelMatrix", modelMatrix);
1176
+ }
1177
+ if (shader.reflection.uniforms.has("u_normalMatrix")) {
1178
+ uniforms.set(
1179
+ "u_normalMatrix",
1180
+ item.normalMatrix
1181
+ ? toMat4Uniform(item.normalMatrix, "normalMatrix", item.label)
1182
+ : new Float32Array(normalMatrixFromModel(toMat4Values(modelMatrix ?? identityMatrix(), "modelMatrix", item.label)))
1183
+ );
1184
+ }
1185
+ }
1186
+
1187
+ function toMat4Uniform(value: Float32Array | readonly number[], field: string, label?: string): Float32Array {
1188
+ if (value.length !== 16 || !isFiniteArrayLike(value)) {
1189
+ throw new RenderDeviceError("Render item transform uniforms must be finite mat4 values", "RENDER_ITEM_TRANSFORM_CONTRACT", {
1190
+ label,
1191
+ field,
1192
+ scalars: value.length
1193
+ });
1194
+ }
1195
+ return value instanceof Float32Array ? value : new Float32Array(value);
1196
+ }
1197
+
1198
+ function toMat4Values(value: Float32Array | readonly number[], field: string, label?: string): Mat4 {
1199
+ if (value.length !== 16 || !isFiniteArrayLike(value)) {
1200
+ throw new RenderDeviceError("Render item transform uniforms must be finite mat4 values", "RENDER_ITEM_TRANSFORM_CONTRACT", {
1201
+ label,
1202
+ field,
1203
+ scalars: value.length
1204
+ });
1205
+ }
1206
+ return mat4FromArrayLike(value, 0);
1207
+ }
1208
+
1209
+ function identityMatrix(): readonly number[] {
1210
+ return [
1211
+ 1, 0, 0, 0,
1212
+ 0, 1, 0, 0,
1213
+ 0, 0, 1, 0,
1214
+ 0, 0, 0, 1
1215
+ ];
1216
+ }
1217
+
1218
+ function getBaseMaterial(material: RenderMaterial): Material {
1219
+ return material instanceof MaterialInstance ? material.baseMaterial : material;
1220
+ }
1221
+
1222
+ function sortForwardRenderItems(
1223
+ items: readonly RenderItem[],
1224
+ cameraPosition: readonly [number, number, number] | undefined
1225
+ ): readonly RenderItem[] {
1226
+ return sortRenderQueueItems(items.map((item) => ({
1227
+ item,
1228
+ bucket: isTransparentRenderItem(item) ? "transparent" : "opaque",
1229
+ depth: cameraPosition ? distanceSquaredFromCamera(item, cameraPosition) : 0,
1230
+ pipelineKey: renderItemPipelineKey(item),
1231
+ batchKey: renderItemPipelineKey(item),
1232
+ instanceCount: item.instanceTransforms ? instanceTransformCount(item) : 1
1233
+ }))).items;
1234
+ }
1235
+
1236
+ function isTransparentRenderItem(item: RenderItem): boolean {
1237
+ const material = item.material ?? new UnlitMaterial();
1238
+ return getBaseMaterial(material).renderState.blend;
1239
+ }
1240
+
1241
+ function distanceSquaredFromCamera(item: RenderItem, cameraPosition: readonly [number, number, number]): number {
1242
+ const transform = item.modelMatrix ?? identityMatrix();
1243
+ const x = (transform[12] ?? 0) - cameraPosition[0];
1244
+ const y = (transform[13] ?? 0) - cameraPosition[1];
1245
+ const z = (transform[14] ?? 0) - cameraPosition[2];
1246
+ return x * x + y * y + z * z;
1247
+ }
1248
+
1249
+ function renderItemPipelineKey(item: RenderItem): string {
1250
+ const material = item.material ?? new UnlitMaterial();
1251
+ const baseMaterial = getBaseMaterial(material);
1252
+ const state = baseMaterial.renderState;
1253
+ return `${baseMaterial.name}|${state.depthTest ? "dt" : "ndt"}|${state.depthWrite ? "dw" : "ndw"}|${state.cullMode}|${state.blend ? "blend" : "opaque"}`;
1254
+ }
1255
+
1256
+ function instanceTransformCount(item: RenderItem): number {
1257
+ return validateInstanceTransformSource(item).length / 16;
1258
+ }
1259
+
1260
+ function splitInstanceTransforms(transforms: Float32Array | readonly number[]): Float32Array[] {
1261
+ const source = transforms instanceof Float32Array ? transforms : new Float32Array(transforms);
1262
+ const batches: Float32Array[] = [];
1263
+ for (let offset = 0; offset < source.length; offset += MAX_GPU_INSTANCES * 16) {
1264
+ batches.push(source.subarray(offset, Math.min(source.length, offset + MAX_GPU_INSTANCES * 16)));
1265
+ }
1266
+ return batches;
1267
+ }
1268
+
1269
+ function applyInstanceUniforms(
1270
+ item: RenderItem,
1271
+ shader: RenderShaderProgram,
1272
+ uniforms: Map<string, UniformValue>
1273
+ ): number {
1274
+ if (!shader.reflection.uniforms.has("u_instanceMatrices") || !shader.reflection.uniforms.has("u_instanceCount")) {
1275
+ throw new RenderDeviceError("Instanced render items require a shader with instance matrix uniforms", "INSTANCING_SHADER_CONTRACT", {
1276
+ label: item.label
1277
+ });
1278
+ }
1279
+ const source = validateInstanceTransformSource(item);
1280
+ const instanceCount = source.length / 16;
1281
+ if (instanceCount > MAX_GPU_INSTANCES) {
1282
+ throw new RenderDeviceError("Instanced shader path exceeds the supported uniform instance count", "GPU_INSTANCE_LIMIT", {
1283
+ label: item.label,
1284
+ instanceCount,
1285
+ maxInstances: MAX_GPU_INSTANCES
1286
+ });
1287
+ }
1288
+ const packed = new Float32Array(MAX_GPU_INSTANCES * 16);
1289
+ packed.set(source);
1290
+ uniforms.set("u_instanceMatrices", packed);
1291
+ uniforms.set("u_instanceCount", instanceCount);
1292
+ uniforms.set("u_instanceAttributeMode", 0);
1293
+ return instanceCount;
1294
+ }
1295
+
1296
+ function applyInstanceBinding(
1297
+ device: RenderDevice,
1298
+ item: RenderItem,
1299
+ shader: RenderShaderProgram,
1300
+ uniforms: Map<string, UniformValue>
1301
+ ): { readonly count: number; readonly attributes?: readonly InstanceVertexAttribute[]; readonly buffers?: readonly RenderBuffer[] } {
1302
+ const source = validateInstanceTransformSource(item);
1303
+ const instanceCount = source.length / 16;
1304
+ const extraBindings = createExtraInstanceAttributeBindings(device, item, instanceCount);
1305
+ if (supportsInstanceAttributes(shader) && instanceCount > MAX_GPU_INSTANCES) {
1306
+ const data = source instanceof Float32Array ? source : new Float32Array(source);
1307
+ const buffer = device.createBuffer("vertex", data.byteLength, data);
1308
+ uniforms.set("u_instanceCount", instanceCount);
1309
+ uniforms.set("u_instanceAttributeMode", 1);
1310
+ return {
1311
+ count: instanceCount,
1312
+ buffers: [buffer, ...extraBindings.buffers],
1313
+ attributes: [
1314
+ ...INSTANCE_MATRIX_ATTRIBUTE_NAMES.map((shaderName, column) => ({
1315
+ buffer,
1316
+ shaderName,
1317
+ components: 4 as const,
1318
+ offset: column * 16,
1319
+ stride: 64,
1320
+ divisor: 1
1321
+ })),
1322
+ ...extraBindings.attributes
1323
+ ]
1324
+ };
1325
+ }
1326
+ return {
1327
+ count: applyInstanceUniforms(item, shader, uniforms),
1328
+ ...(extraBindings.attributes.length > 0 ? { attributes: extraBindings.attributes } : {}),
1329
+ ...(extraBindings.buffers.length > 0 ? { buffers: extraBindings.buffers } : {})
1330
+ };
1331
+ }
1332
+
1333
+ function createExtraInstanceAttributeBindings(
1334
+ device: RenderDevice,
1335
+ item: RenderItem,
1336
+ instanceCount: number
1337
+ ): { readonly attributes: readonly InstanceVertexAttribute[]; readonly buffers: readonly RenderBuffer[] } {
1338
+ const descriptors: RenderItemInstanceAttribute[] = [];
1339
+ if (item.instanceColors) {
1340
+ descriptors.push({
1341
+ shaderName: "a_instanceColor",
1342
+ components: 4,
1343
+ data: item.instanceColors
1344
+ });
1345
+ }
1346
+ if (item.instanceAttributes) descriptors.push(...item.instanceAttributes);
1347
+ if (descriptors.length === 0) return { attributes: [], buffers: [] };
1348
+
1349
+ const attributes: InstanceVertexAttribute[] = [];
1350
+ const buffers: RenderBuffer[] = [];
1351
+ for (const descriptor of descriptors) {
1352
+ validateInstanceAttributeDescriptor(descriptor, instanceCount, item.label);
1353
+ const data = descriptor.data instanceof Float32Array ? descriptor.data : new Float32Array(descriptor.data);
1354
+ const stride = descriptor.components * 4;
1355
+ const buffer = device.createBuffer("vertex", data.byteLength, data);
1356
+ buffers.push(buffer);
1357
+ attributes.push({
1358
+ buffer,
1359
+ shaderName: descriptor.shaderName,
1360
+ components: descriptor.components,
1361
+ offset: 0,
1362
+ stride,
1363
+ normalized: descriptor.normalized ?? false,
1364
+ divisor: descriptor.divisor ?? 1
1365
+ });
1366
+ }
1367
+ return { attributes, buffers };
1368
+ }
1369
+
1370
+ function validateInstanceAttributeDescriptor(descriptor: RenderItemInstanceAttribute, instanceCount: number, label: string | undefined): void {
1371
+ if (!descriptor.shaderName.trim()) {
1372
+ throw new RenderDeviceError("Instance attribute shaderName is required", "INSTANCE_ATTRIBUTE_CONTRACT", { label });
1373
+ }
1374
+ if (![1, 2, 3, 4].includes(descriptor.components)) {
1375
+ throw new RenderDeviceError("Instance attribute components must be 1, 2, 3, or 4", "INSTANCE_ATTRIBUTE_CONTRACT", {
1376
+ label,
1377
+ shaderName: descriptor.shaderName,
1378
+ components: descriptor.components
1379
+ });
1380
+ }
1381
+ const data = descriptor.data instanceof Float32Array ? descriptor.data : new Float32Array(descriptor.data);
1382
+ if (data.length !== instanceCount * descriptor.components || !Array.from(data).every(Number.isFinite)) {
1383
+ throw new RenderDeviceError("Instance attribute data must contain finite values for every instance", "INSTANCE_ATTRIBUTE_CONTRACT", {
1384
+ label,
1385
+ shaderName: descriptor.shaderName,
1386
+ components: descriptor.components,
1387
+ dataLength: data.length,
1388
+ expectedLength: instanceCount * descriptor.components
1389
+ });
1390
+ }
1391
+ }
1392
+
1393
+ function resolveRenderGeometry(item: RenderItem): Geometry {
1394
+ if (item.morphTargets === undefined && item.morphWeights === undefined) {
1395
+ return item.geometry;
1396
+ }
1397
+ if (!item.morphTargets || !item.morphWeights) {
1398
+ throw new RenderDeviceError("Morph render items require both morphTargets and morphWeights", "MORPH_TARGET_CONTRACT", {
1399
+ label: item.label,
1400
+ targetCount: item.morphTargets?.length ?? 0,
1401
+ weightCount: item.morphWeights?.length ?? 0
1402
+ });
1403
+ }
1404
+ return applyMorphTargets(item.geometry, item.morphTargets, item.morphWeights);
1405
+ }
1406
+
1407
+ function applyGpuMorphUniforms(
1408
+ item: RenderItem,
1409
+ shader: RenderShaderProgram,
1410
+ uniforms: Map<string, UniformValue>
1411
+ ): boolean {
1412
+ if (
1413
+ !shader.reflection.uniforms.has("u_morphPositionDeltas") ||
1414
+ !shader.reflection.uniforms.has("u_morphWeights") ||
1415
+ !shader.reflection.uniforms.has("u_morphTargetCount")
1416
+ ) {
1417
+ return false;
1418
+ }
1419
+ if (!item.morphTargets || !item.morphWeights) {
1420
+ throw new RenderDeviceError("Morph render items require both morphTargets and morphWeights", "MORPH_TARGET_CONTRACT", {
1421
+ label: item.label,
1422
+ targetCount: item.morphTargets?.length ?? 0,
1423
+ weightCount: item.morphWeights?.length ?? 0
1424
+ });
1425
+ }
1426
+ if (item.morphTargets.length !== item.morphWeights.length) {
1427
+ throw new RenderDeviceError("Morph target count must match morph weight count", "MORPH_TARGET_CONTRACT", {
1428
+ label: item.label,
1429
+ targetCount: item.morphTargets.length,
1430
+ weightCount: item.morphWeights.length
1431
+ });
1432
+ }
1433
+ if (item.morphTargets.length > MAX_GPU_MORPH_TARGETS) {
1434
+ throw new RenderDeviceError("GPU morph shader path exceeds the supported uniform morph target count", "GPU_MORPH_TARGET_LIMIT", {
1435
+ label: item.label,
1436
+ targetCount: item.morphTargets.length,
1437
+ maxTargets: MAX_GPU_MORPH_TARGETS
1438
+ });
1439
+ }
1440
+ if (item.geometry.vertexBuffer.vertexCount > MAX_GPU_MORPH_VERTICES) {
1441
+ throw new RenderDeviceError("GPU morph shader path exceeds the supported uniform morph vertex count", "GPU_MORPH_VERTEX_LIMIT", {
1442
+ label: item.label,
1443
+ vertexCount: item.geometry.vertexBuffer.vertexCount,
1444
+ maxVertices: MAX_GPU_MORPH_VERTICES
1445
+ });
1446
+ }
1447
+ const packed = new Float32Array(MAX_GPU_MORPH_TARGETS * MAX_GPU_MORPH_VERTICES * 4);
1448
+ const weights = new Float32Array(MAX_GPU_MORPH_TARGETS);
1449
+ for (let targetIndex = 0; targetIndex < item.morphTargets.length; targetIndex += 1) {
1450
+ const target = item.morphTargets[targetIndex]!;
1451
+ if (!target.positions || target.positions.length < item.geometry.vertexBuffer.vertexCount) {
1452
+ throw new RenderDeviceError("GPU morph shader path requires position deltas for every source vertex", "GPU_MORPH_TARGET_CONTRACT", {
1453
+ label: item.label,
1454
+ targetIndex,
1455
+ vertexCount: item.geometry.vertexBuffer.vertexCount,
1456
+ deltaCount: target.positions?.length ?? 0
1457
+ });
1458
+ }
1459
+ const weight = item.morphWeights[targetIndex] ?? 0;
1460
+ if (!Number.isFinite(weight)) {
1461
+ throw new RenderDeviceError("GPU morph weights must be finite", "GPU_MORPH_TARGET_CONTRACT", {
1462
+ label: item.label,
1463
+ targetIndex,
1464
+ weight
1465
+ });
1466
+ }
1467
+ weights[targetIndex] = weight;
1468
+ for (let vertex = 0; vertex < item.geometry.vertexBuffer.vertexCount; vertex += 1) {
1469
+ const delta = target.positions[vertex]!;
1470
+ if (delta.length !== 3 || !Number.isFinite(delta[0]) || !Number.isFinite(delta[1]) || !Number.isFinite(delta[2])) {
1471
+ throw new RenderDeviceError("GPU morph position deltas must be finite vec3 values", "GPU_MORPH_TARGET_CONTRACT", {
1472
+ label: item.label,
1473
+ targetIndex,
1474
+ vertex
1475
+ });
1476
+ }
1477
+ const offset = (targetIndex * MAX_GPU_MORPH_VERTICES + vertex) * 4;
1478
+ packed[offset] = delta[0];
1479
+ packed[offset + 1] = delta[1];
1480
+ packed[offset + 2] = delta[2];
1481
+ }
1482
+ }
1483
+ uniforms.set("u_morphPositionDeltas", packed);
1484
+ uniforms.set("u_morphWeights", weights);
1485
+ uniforms.set("u_morphTargetCount", item.morphTargets.length);
1486
+ return true;
1487
+ }
1488
+
1489
+ function applySkinningUniforms(
1490
+ skinning: SkinningPaletteBinding,
1491
+ material: Material,
1492
+ shader: RenderShaderProgram,
1493
+ uniforms: Map<string, UniformValue>
1494
+ ): void {
1495
+ if (!shader.reflection.uniforms.has("u_jointMatrices") || !shader.reflection.uniforms.has("u_jointCount")) {
1496
+ throw new RenderDeviceError("Skinned render item requires a shader with joint palette uniforms", "SKINNING_SHADER_CONTRACT", {
1497
+ material: material.name
1498
+ });
1499
+ }
1500
+ if (!Number.isInteger(skinning.jointCount) || skinning.jointCount <= 0 || skinning.jointCount > 96) {
1501
+ throw new RenderDeviceError("Skinning jointCount must be an integer in [1, 96]", "INVALID_SKINNING_PALETTE", {
1502
+ jointCount: skinning.jointCount
1503
+ });
1504
+ }
1505
+ if (skinning.matrices.length !== skinning.jointCount * 16) {
1506
+ throw new RenderDeviceError("Skinning matrix palette length must equal jointCount * 16", "INVALID_SKINNING_PALETTE", {
1507
+ jointCount: skinning.jointCount,
1508
+ matrixScalars: skinning.matrices.length
1509
+ });
1510
+ }
1511
+ if (!isFiniteArrayLike(skinning.matrices)) {
1512
+ throw new RenderDeviceError("Skinning matrix palette must contain finite values", "INVALID_SKINNING_PALETTE", {
1513
+ jointCount: skinning.jointCount
1514
+ });
1515
+ }
1516
+ uniforms.set("u_jointCount", skinning.jointCount);
1517
+ uniforms.set("u_jointMatrices", skinning.matrices);
1518
+ }
1519
+
1520
+ function validateSkinningGeometryContract(item: RenderItem, skinning: SkinningPaletteBinding): void {
1521
+ const format = item.geometry.vertexBuffer.format;
1522
+ if (!format.hasAttribute("joints") || !format.hasAttribute("weights")) {
1523
+ throw new RenderDeviceError("Skinned render item geometry must include joints and weights attributes", "SKINNING_GEOMETRY_CONTRACT", {
1524
+ label: item.label,
1525
+ jointCount: skinning.jointCount,
1526
+ vertexFormat: format.attributes.map((attribute) => attribute.shaderName),
1527
+ missingAttributes: [
1528
+ ...(format.hasAttribute("joints") ? [] : ["a_joints"]),
1529
+ ...(format.hasAttribute("weights") ? [] : ["a_weights"])
1530
+ ]
1531
+ });
1532
+ }
1533
+
1534
+ const jointsAttribute = format.getAttribute("joints");
1535
+ const weightsAttribute = format.getAttribute("weights");
1536
+ if (jointsAttribute.components !== 4 || weightsAttribute.components !== 4) {
1537
+ throw new RenderDeviceError("Skinned render item geometry must use four joint and four weight influences per vertex", "SKINNING_GEOMETRY_CONTRACT", {
1538
+ label: item.label,
1539
+ jointCount: skinning.jointCount,
1540
+ jointComponents: jointsAttribute.components,
1541
+ weightComponents: weightsAttribute.components
1542
+ });
1543
+ }
1544
+
1545
+ for (let vertex = 0; vertex < item.geometry.vertexBuffer.vertexCount; vertex += 1) {
1546
+ const joints = item.geometry.vertexBuffer.getAttribute(vertex, "joints");
1547
+ const weights = item.geometry.vertexBuffer.getAttribute(vertex, "weights");
1548
+ let weightSum = 0;
1549
+ for (let influence = 0; influence < 4; influence += 1) {
1550
+ const joint = joints[influence] ?? 0;
1551
+ const weight = weights[influence] ?? 0;
1552
+ if (!Number.isFinite(weight) || weight < 0) {
1553
+ throw new RenderDeviceError("Skinned render item weights must be finite non-negative values", "SKINNING_GEOMETRY_CONTRACT", {
1554
+ label: item.label,
1555
+ jointCount: skinning.jointCount,
1556
+ vertex,
1557
+ influence,
1558
+ weight
1559
+ });
1560
+ }
1561
+ if (!Number.isFinite(joint) || !Number.isInteger(joint) || joint < 0) {
1562
+ throw new RenderDeviceError("Skinned render item joints must be finite non-negative integer indices", "SKINNING_GEOMETRY_CONTRACT", {
1563
+ label: item.label,
1564
+ jointCount: skinning.jointCount,
1565
+ vertex,
1566
+ influence,
1567
+ joint
1568
+ });
1569
+ }
1570
+ if (weight > 0 && joint >= skinning.jointCount) {
1571
+ throw new RenderDeviceError("Skinned render item joint indices must be within the uploaded skinning palette", "SKINNING_GEOMETRY_CONTRACT", {
1572
+ label: item.label,
1573
+ jointCount: skinning.jointCount,
1574
+ vertex,
1575
+ influence,
1576
+ joint,
1577
+ weight
1578
+ });
1579
+ }
1580
+ weightSum += weight;
1581
+ }
1582
+ if (weightSum <= 0) {
1583
+ throw new RenderDeviceError("Skinned render item weights must sum to a positive value", "SKINNING_GEOMETRY_CONTRACT", {
1584
+ label: item.label,
1585
+ jointCount: skinning.jointCount,
1586
+ vertex,
1587
+ weightSum
1588
+ });
1589
+ }
1590
+ if (Math.abs(weightSum - 1) > 0.02) {
1591
+ throw new RenderDeviceError("Skinned render item weights must be normalized before GPU skinning", "SKINNING_GEOMETRY_CONTRACT", {
1592
+ label: item.label,
1593
+ jointCount: skinning.jointCount,
1594
+ vertex,
1595
+ weightSum
1596
+ });
1597
+ }
1598
+ }
1599
+ }
1600
+
1601
+ function validateInstanceTransformSource(item: RenderItem): Float32Array | readonly number[] {
1602
+ const source = item.instanceTransforms ?? [];
1603
+ if (source.length === 0 || source.length % 16 !== 0) {
1604
+ throw new RenderDeviceError("Instance transforms must contain one or more mat4 values", "INSTANCING_CONTRACT", {
1605
+ label: item.label,
1606
+ scalars: source.length
1607
+ });
1608
+ }
1609
+ if (!isFiniteArrayLike(source)) {
1610
+ throw new RenderDeviceError("Instance transforms must contain finite mat4 values", "INSTANCING_CONTRACT", {
1611
+ label: item.label
1612
+ });
1613
+ }
1614
+ return source;
1615
+ }
1616
+
1617
+ function isFiniteArrayLike(values: ArrayLike<number>): boolean {
1618
+ for (let index = 0; index < values.length; index += 1) {
1619
+ if (!Number.isFinite(values[index])) return false;
1620
+ }
1621
+ return true;
1622
+ }
1623
+
1624
+ function isFiniteColor(values: ArrayLike<number>): boolean {
1625
+ for (let index = 0; index < values.length; index += 1) {
1626
+ const channel = values[index];
1627
+ if (!Number.isFinite(channel) || channel < 0 || channel > 1) return false;
1628
+ }
1629
+ return true;
1630
+ }
1631
+
1632
+ function mat4FromArrayLike(values: ArrayLike<number>, offset: number): Mat4 {
1633
+ return [
1634
+ values[offset]!, values[offset + 1]!, values[offset + 2]!, values[offset + 3]!,
1635
+ values[offset + 4]!, values[offset + 5]!, values[offset + 6]!, values[offset + 7]!,
1636
+ values[offset + 8]!, values[offset + 9]!, values[offset + 10]!, values[offset + 11]!,
1637
+ values[offset + 12]!, values[offset + 13]!, values[offset + 14]!, values[offset + 15]!
1638
+ ];
1639
+ }