@meimu/mutracer 0.0.0-stage → 0.1.1

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 (536) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/Apache-2.0.txt +202 -0
  3. package/LICENSES/GLSL-PathTracer-MIT.txt +21 -0
  4. package/LICENSES/GlMatrix-MIT.txt +19 -0
  5. package/LICENSES/KinoBloom-MIT.txt +21 -0
  6. package/LICENSES/OIDNWeb-MIT.txt +21 -0
  7. package/LICENSES/Octicons-MIT.txt +21 -0
  8. package/LICENSES/RayTracingRenderer-MIT.txt +21 -0
  9. package/LICENSES/TinyBVH-MIT.txt +21 -0
  10. package/LICENSES/WebGPUUtils-MIT.txt +21 -0
  11. package/LICENSES/ZetaRay-MIT.txt +21 -0
  12. package/README.md +240 -2
  13. package/THIRD_PARTY_NOTICES.md +160 -0
  14. package/dist/assets/bvh.worker.js +1 -0
  15. package/dist/mutracer.umd.js +14360 -0
  16. package/docs/api.md +394 -0
  17. package/docs/bvh.md +141 -0
  18. package/docs/denoising.md +301 -0
  19. package/docs/getting-started.md +308 -0
  20. package/docs/materials.md +281 -0
  21. package/docs/performance.md +85 -0
  22. package/docs/post-processing.md +87 -0
  23. package/docs/progressive-rendering.md +160 -0
  24. package/docs/sampling.md +40 -0
  25. package/docs/threejs.md +274 -0
  26. package/docs/todo.md +61 -0
  27. package/docs/updates.md +208 -0
  28. package/lib/Display.d.ts +72 -0
  29. package/lib/Display.js +123 -0
  30. package/lib/Display.js.map +1 -0
  31. package/lib/Engine.d.ts +161 -0
  32. package/lib/Engine.js +681 -0
  33. package/lib/Engine.js.map +1 -0
  34. package/lib/Render.d.ts +265 -0
  35. package/lib/Render.js +742 -0
  36. package/lib/Render.js.map +1 -0
  37. package/lib/RenderLoop.d.ts +79 -0
  38. package/lib/RenderLoop.js +236 -0
  39. package/lib/RenderLoop.js.map +1 -0
  40. package/lib/Sync.d.ts +19 -0
  41. package/lib/Sync.js +19 -0
  42. package/lib/Sync.js.map +1 -0
  43. package/lib/constants.d.ts +2 -0
  44. package/lib/constants.js +3 -0
  45. package/lib/constants.js.map +1 -0
  46. package/lib/main.d.ts +56 -0
  47. package/lib/main.js +43 -0
  48. package/lib/main.js.map +1 -0
  49. package/lib/math.d.ts +23 -0
  50. package/lib/math.js +56 -0
  51. package/lib/math.js.map +1 -0
  52. package/lib/oidn.d.ts +45 -0
  53. package/lib/oidn.js +42 -0
  54. package/lib/oidn.js.map +1 -0
  55. package/lib/oidnBundledWeights.cdn.d.ts +2 -0
  56. package/lib/oidnBundledWeights.cdn.js +5 -0
  57. package/lib/oidnBundledWeights.cdn.js.map +1 -0
  58. package/lib/oidnBundledWeights.d.ts +2 -0
  59. package/lib/oidnBundledWeights.js +4 -0
  60. package/lib/oidnBundledWeights.js.map +1 -0
  61. package/lib/renderer/DisplayPostProcess.d.ts +14 -0
  62. package/lib/renderer/DisplayPostProcess.js +41 -0
  63. package/lib/renderer/DisplayPostProcess.js.map +1 -0
  64. package/lib/renderer/MaterialTable.d.ts +119 -0
  65. package/lib/renderer/MaterialTable.js +550 -0
  66. package/lib/renderer/MaterialTable.js.map +1 -0
  67. package/lib/renderer/OfflineAdaptiveSampling.d.ts +47 -0
  68. package/lib/renderer/OfflineAdaptiveSampling.js +36 -0
  69. package/lib/renderer/OfflineAdaptiveSampling.js.map +1 -0
  70. package/lib/renderer/RenderingPipeline.d.ts +232 -0
  71. package/lib/renderer/RenderingPipeline.js +18 -0
  72. package/lib/renderer/RenderingPipeline.js.map +1 -0
  73. package/lib/renderer/ScratchPool.d.ts +13 -0
  74. package/lib/renderer/ScratchPool.js +21 -0
  75. package/lib/renderer/ScratchPool.js.map +1 -0
  76. package/lib/renderer/TileRender.d.ts +44 -0
  77. package/lib/renderer/TileRender.js +283 -0
  78. package/lib/renderer/TileRender.js.map +1 -0
  79. package/lib/renderer/WGPUBloomPass.d.ts +17 -0
  80. package/lib/renderer/WGPUBloomPass.js +243 -0
  81. package/lib/renderer/WGPUBloomPass.js.map +1 -0
  82. package/lib/renderer/WGPUCanvasSurface.d.ts +21 -0
  83. package/lib/renderer/WGPUCanvasSurface.js +48 -0
  84. package/lib/renderer/WGPUCanvasSurface.js.map +1 -0
  85. package/lib/renderer/WGPUComputePass.d.ts +73 -0
  86. package/lib/renderer/WGPUComputePass.js +317 -0
  87. package/lib/renderer/WGPUComputePass.js.map +1 -0
  88. package/lib/renderer/WGPUFullQuadPass.d.ts +73 -0
  89. package/lib/renderer/WGPUFullQuadPass.js +389 -0
  90. package/lib/renderer/WGPUFullQuadPass.js.map +1 -0
  91. package/lib/renderer/WGPUHDRPeakMeter.d.ts +19 -0
  92. package/lib/renderer/WGPUHDRPeakMeter.js +112 -0
  93. package/lib/renderer/WGPUHDRPeakMeter.js.map +1 -0
  94. package/lib/renderer/WGPUJNLMDenoiser.d.ts +61 -0
  95. package/lib/renderer/WGPUJNLMDenoiser.js +412 -0
  96. package/lib/renderer/WGPUJNLMDenoiser.js.map +1 -0
  97. package/lib/renderer/WGPURayTraceOutput.d.ts +44 -0
  98. package/lib/renderer/WGPURayTraceOutput.js +368 -0
  99. package/lib/renderer/WGPURayTraceOutput.js.map +1 -0
  100. package/lib/renderer/WGPURayTracePass.d.ts +284 -0
  101. package/lib/renderer/WGPURayTracePass.js +2323 -0
  102. package/lib/renderer/WGPURayTracePass.js.map +1 -0
  103. package/lib/renderer/WGPURenderingPipeline.d.ts +9 -0
  104. package/lib/renderer/WGPURenderingPipeline.js +1448 -0
  105. package/lib/renderer/WGPURenderingPipeline.js.map +1 -0
  106. package/lib/renderer/WGPUSceneFeatures.d.ts +3 -0
  107. package/lib/renderer/WGPUSceneFeatures.js +20 -0
  108. package/lib/renderer/WGPUSceneFeatures.js.map +1 -0
  109. package/lib/renderer/WGPUScratchBuffer.d.ts +9 -0
  110. package/lib/renderer/WGPUScratchBuffer.js +21 -0
  111. package/lib/renderer/WGPUScratchBuffer.js.map +1 -0
  112. package/lib/renderer/WGPUScratchTexture.d.ts +10 -0
  113. package/lib/renderer/WGPUScratchTexture.js +27 -0
  114. package/lib/renderer/WGPUScratchTexture.js.map +1 -0
  115. package/lib/renderer/WGPUShaderCache.d.ts +26 -0
  116. package/lib/renderer/WGPUShaderCache.js +103 -0
  117. package/lib/renderer/WGPUShaderCache.js.map +1 -0
  118. package/lib/renderer/WebGLBloomPass.d.ts +18 -0
  119. package/lib/renderer/WebGLBloomPass.js +113 -0
  120. package/lib/renderer/WebGLBloomPass.js.map +1 -0
  121. package/lib/renderer/WebGLFullQuadPass.d.ts +65 -0
  122. package/lib/renderer/WebGLFullQuadPass.js +208 -0
  123. package/lib/renderer/WebGLFullQuadPass.js.map +1 -0
  124. package/lib/renderer/WebGLJNLMDenoiser.d.ts +32 -0
  125. package/lib/renderer/WebGLJNLMDenoiser.js +328 -0
  126. package/lib/renderer/WebGLJNLMDenoiser.js.map +1 -0
  127. package/lib/renderer/WebGLRayTraceOutputPass.d.ts +20 -0
  128. package/lib/renderer/WebGLRayTraceOutputPass.js +106 -0
  129. package/lib/renderer/WebGLRayTraceOutputPass.js.map +1 -0
  130. package/lib/renderer/WebGLRayTracePass.d.ts +142 -0
  131. package/lib/renderer/WebGLRayTracePass.js +845 -0
  132. package/lib/renderer/WebGLRayTracePass.js.map +1 -0
  133. package/lib/renderer/WebGLReadback.d.ts +4 -0
  134. package/lib/renderer/WebGLReadback.js +75 -0
  135. package/lib/renderer/WebGLReadback.js.map +1 -0
  136. package/lib/renderer/WebGLRenderingPipeline.d.ts +4 -0
  137. package/lib/renderer/WebGLRenderingPipeline.js +510 -0
  138. package/lib/renderer/WebGLRenderingPipeline.js.map +1 -0
  139. package/lib/renderer/WebGLScratchCopy.d.ts +10 -0
  140. package/lib/renderer/WebGLScratchCopy.js +27 -0
  141. package/lib/renderer/WebGLScratchCopy.js.map +1 -0
  142. package/lib/renderer/accumulationTarget.d.ts +26 -0
  143. package/lib/renderer/accumulationTarget.js +2 -0
  144. package/lib/renderer/accumulationTarget.js.map +1 -0
  145. package/lib/renderer/binnedSahBvh.d.ts +31 -0
  146. package/lib/renderer/binnedSahBvh.js +263 -0
  147. package/lib/renderer/binnedSahBvh.js.map +1 -0
  148. package/lib/renderer/bvh.worker.d.ts +1 -0
  149. package/lib/renderer/bvh.worker.js +16 -0
  150. package/lib/renderer/bvh.worker.js.map +1 -0
  151. package/lib/renderer/bvhAccel.d.ts +81 -0
  152. package/lib/renderer/bvhAccel.js +621 -0
  153. package/lib/renderer/bvhAccel.js.map +1 -0
  154. package/lib/renderer/bvhWorkerBuild.d.ts +12 -0
  155. package/lib/renderer/bvhWorkerBuild.js +17 -0
  156. package/lib/renderer/bvhWorkerBuild.js.map +1 -0
  157. package/lib/renderer/bvhWorkerClient.d.ts +57 -0
  158. package/lib/renderer/bvhWorkerClient.js +166 -0
  159. package/lib/renderer/bvhWorkerClient.js.map +1 -0
  160. package/lib/renderer/cameraLens.d.ts +5 -0
  161. package/lib/renderer/cameraLens.js +15 -0
  162. package/lib/renderer/cameraLens.js.map +1 -0
  163. package/lib/renderer/cameraSnapshot.d.ts +3 -0
  164. package/lib/renderer/cameraSnapshot.js +7 -0
  165. package/lib/renderer/cameraSnapshot.js.map +1 -0
  166. package/lib/renderer/committedScene.d.ts +13 -0
  167. package/lib/renderer/committedScene.js +126 -0
  168. package/lib/renderer/committedScene.js.map +1 -0
  169. package/lib/renderer/dataTextureUtil.d.ts +32 -0
  170. package/lib/renderer/dataTextureUtil.js +46 -0
  171. package/lib/renderer/dataTextureUtil.js.map +1 -0
  172. package/lib/renderer/denoiser.d.ts +65 -0
  173. package/lib/renderer/denoiser.js +2 -0
  174. package/lib/renderer/denoiser.js.map +1 -0
  175. package/lib/renderer/depthQuery.d.ts +14 -0
  176. package/lib/renderer/depthQuery.js +14 -0
  177. package/lib/renderer/depthQuery.js.map +1 -0
  178. package/lib/renderer/deviceRequirements.d.ts +23 -0
  179. package/lib/renderer/deviceRequirements.js +50 -0
  180. package/lib/renderer/deviceRequirements.js.map +1 -0
  181. package/lib/renderer/envMapCreation.d.ts +10 -0
  182. package/lib/renderer/envMapCreation.js +96 -0
  183. package/lib/renderer/envMapCreation.js.map +1 -0
  184. package/lib/renderer/envMapDistribution.d.ts +9 -0
  185. package/lib/renderer/envMapDistribution.js +107 -0
  186. package/lib/renderer/envMapDistribution.js.map +1 -0
  187. package/lib/renderer/float16.d.ts +1 -0
  188. package/lib/renderer/float16.js +19 -0
  189. package/lib/renderer/float16.js.map +1 -0
  190. package/lib/renderer/geometryBvh.d.ts +11 -0
  191. package/lib/renderer/geometryBvh.js +24 -0
  192. package/lib/renderer/geometryBvh.js.map +1 -0
  193. package/lib/renderer/geometryUpdates.d.ts +28 -0
  194. package/lib/renderer/geometryUpdates.js +131 -0
  195. package/lib/renderer/geometryUpdates.js.map +1 -0
  196. package/lib/renderer/glsl/chunks/cameraRay.glsl.d.ts +2 -0
  197. package/lib/renderer/glsl/chunks/cameraRay.glsl.js +37 -0
  198. package/lib/renderer/glsl/chunks/cameraRay.glsl.js.map +1 -0
  199. package/lib/renderer/glsl/chunks/common.glsl.d.ts +2 -0
  200. package/lib/renderer/glsl/chunks/common.glsl.js +17 -0
  201. package/lib/renderer/glsl/chunks/common.glsl.js.map +1 -0
  202. package/lib/renderer/glsl/chunks/envMap.glsl.d.ts +2 -0
  203. package/lib/renderer/glsl/chunks/envMap.glsl.js +192 -0
  204. package/lib/renderer/glsl/chunks/envMap.glsl.js.map +1 -0
  205. package/lib/renderer/glsl/chunks/intersect.glsl.d.ts +2 -0
  206. package/lib/renderer/glsl/chunks/intersect.glsl.js +1091 -0
  207. package/lib/renderer/glsl/chunks/intersect.glsl.js.map +1 -0
  208. package/lib/renderer/glsl/chunks/materialBuffer.glsl.d.ts +2 -0
  209. package/lib/renderer/glsl/chunks/materialBuffer.glsl.js +371 -0
  210. package/lib/renderer/glsl/chunks/materialBuffer.glsl.js.map +1 -0
  211. package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.d.ts +2 -0
  212. package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js +1767 -0
  213. package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js.map +1 -0
  214. package/lib/renderer/glsl/chunks/rand.glsl.d.ts +2 -0
  215. package/lib/renderer/glsl/chunks/rand.glsl.js +26 -0
  216. package/lib/renderer/glsl/chunks/rand.glsl.js.map +1 -0
  217. package/lib/renderer/glsl/chunks/random.glsl.d.ts +2 -0
  218. package/lib/renderer/glsl/chunks/random.glsl.js +27 -0
  219. package/lib/renderer/glsl/chunks/random.glsl.js.map +1 -0
  220. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.d.ts +2 -0
  221. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js +287 -0
  222. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js.map +1 -0
  223. package/lib/renderer/glsl/chunks/sampleLight.glsl.d.ts +2 -0
  224. package/lib/renderer/glsl/chunks/sampleLight.glsl.js +254 -0
  225. package/lib/renderer/glsl/chunks/sampleLight.glsl.js.map +1 -0
  226. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.d.ts +2 -0
  227. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js +279 -0
  228. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js.map +1 -0
  229. package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.d.ts +2 -0
  230. package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js +48 -0
  231. package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js.map +1 -0
  232. package/lib/renderer/glsl/chunks/sampling.glsl.d.ts +2 -0
  233. package/lib/renderer/glsl/chunks/sampling.glsl.js +194 -0
  234. package/lib/renderer/glsl/chunks/sampling.glsl.js.map +1 -0
  235. package/lib/renderer/glsl/chunks/sobol.glsl.d.ts +2 -0
  236. package/lib/renderer/glsl/chunks/sobol.glsl.js +170 -0
  237. package/lib/renderer/glsl/chunks/sobol.glsl.js.map +1 -0
  238. package/lib/renderer/glsl/chunks/textureLinear.glsl.d.ts +2 -0
  239. package/lib/renderer/glsl/chunks/textureLinear.glsl.js +27 -0
  240. package/lib/renderer/glsl/chunks/textureLinear.glsl.js.map +1 -0
  241. package/lib/renderer/glsl/chunks/uvProjection.glsl.d.ts +2 -0
  242. package/lib/renderer/glsl/chunks/uvProjection.glsl.js +72 -0
  243. package/lib/renderer/glsl/chunks/uvProjection.glsl.js.map +1 -0
  244. package/lib/renderer/glsl/depthQuery.frag.d.ts +3 -0
  245. package/lib/renderer/glsl/depthQuery.frag.js +55 -0
  246. package/lib/renderer/glsl/depthQuery.frag.js.map +1 -0
  247. package/lib/renderer/glsl/normalizeRayTraceOutput.frag.d.ts +6 -0
  248. package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js +46 -0
  249. package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js.map +1 -0
  250. package/lib/renderer/glsl/rayTrace.frag.d.ts +2 -0
  251. package/lib/renderer/glsl/rayTrace.frag.js +623 -0
  252. package/lib/renderer/glsl/rayTrace.frag.js.map +1 -0
  253. package/lib/renderer/glsl/shadowCatcher.frag.d.ts +3 -0
  254. package/lib/renderer/glsl/shadowCatcher.frag.js +119 -0
  255. package/lib/renderer/glsl/shadowCatcher.frag.js.map +1 -0
  256. package/lib/renderer/glsl/webglPipeline.frag.d.ts +4 -0
  257. package/lib/renderer/glsl/webglPipeline.frag.js +208 -0
  258. package/lib/renderer/glsl/webglPipeline.frag.js.map +1 -0
  259. package/lib/renderer/gpuMemory.d.ts +2 -0
  260. package/lib/renderer/gpuMemory.js +10 -0
  261. package/lib/renderer/gpuMemory.js.map +1 -0
  262. package/lib/renderer/halton.d.ts +1 -0
  263. package/lib/renderer/halton.js +15 -0
  264. package/lib/renderer/halton.js.map +1 -0
  265. package/lib/renderer/jnlm.d.ts +85 -0
  266. package/lib/renderer/jnlm.js +87 -0
  267. package/lib/renderer/jnlm.js.map +1 -0
  268. package/lib/renderer/lightSampling.d.ts +75 -0
  269. package/lib/renderer/lightSampling.js +305 -0
  270. package/lib/renderer/lightSampling.js.map +1 -0
  271. package/lib/renderer/lightsUtil.d.ts +26 -0
  272. package/lib/renderer/lightsUtil.js +154 -0
  273. package/lib/renderer/lightsUtil.js.map +1 -0
  274. package/lib/renderer/materialChanges.d.ts +13 -0
  275. package/lib/renderer/materialChanges.js +59 -0
  276. package/lib/renderer/materialChanges.js.map +1 -0
  277. package/lib/renderer/materialComparison.generated.d.ts +5 -0
  278. package/lib/renderer/materialComparison.generated.js +655 -0
  279. package/lib/renderer/materialComparison.generated.js.map +1 -0
  280. package/lib/renderer/materialConstants.d.ts +6 -0
  281. package/lib/renderer/materialConstants.js +3 -0
  282. package/lib/renderer/materialConstants.js.map +1 -0
  283. package/lib/renderer/materialEmission.d.ts +9 -0
  284. package/lib/renderer/materialEmission.js +21 -0
  285. package/lib/renderer/materialEmission.js.map +1 -0
  286. package/lib/renderer/materialIndices.d.ts +7 -0
  287. package/lib/renderer/materialIndices.js +34 -0
  288. package/lib/renderer/materialIndices.js.map +1 -0
  289. package/lib/renderer/materialLayout.d.ts +102 -0
  290. package/lib/renderer/materialLayout.js +189 -0
  291. package/lib/renderer/materialLayout.js.map +1 -0
  292. package/lib/renderer/materialTextureSlots.d.ts +537 -0
  293. package/lib/renderer/materialTextureSlots.js +219 -0
  294. package/lib/renderer/materialTextureSlots.js.map +1 -0
  295. package/lib/renderer/mergeMeshesToGeometry.d.ts +8 -0
  296. package/lib/renderer/mergeMeshesToGeometry.js +236 -0
  297. package/lib/renderer/mergeMeshesToGeometry.js.map +1 -0
  298. package/lib/renderer/meshInstances.d.ts +23 -0
  299. package/lib/renderer/meshInstances.js +66 -0
  300. package/lib/renderer/meshInstances.js.map +1 -0
  301. package/lib/renderer/meshMembership.d.ts +10 -0
  302. package/lib/renderer/meshMembership.js +72 -0
  303. package/lib/renderer/meshMembership.js.map +1 -0
  304. package/lib/renderer/oidnNetwork.d.ts +20 -0
  305. package/lib/renderer/oidnNetwork.js +123 -0
  306. package/lib/renderer/oidnNetwork.js.map +1 -0
  307. package/lib/renderer/openPbrEnergyLut.d.ts +32 -0
  308. package/lib/renderer/openPbrEnergyLut.js +965 -0
  309. package/lib/renderer/openPbrEnergyLut.js.map +1 -0
  310. package/lib/renderer/pathLimits.d.ts +4 -0
  311. package/lib/renderer/pathLimits.js +7 -0
  312. package/lib/renderer/pathLimits.js.map +1 -0
  313. package/lib/renderer/prepareMeshBVH.d.ts +110 -0
  314. package/lib/renderer/prepareMeshBVH.js +857 -0
  315. package/lib/renderer/prepareMeshBVH.js.map +1 -0
  316. package/lib/renderer/progressiveScheduler.d.ts +11 -0
  317. package/lib/renderer/progressiveScheduler.js +19 -0
  318. package/lib/renderer/progressiveScheduler.js.map +1 -0
  319. package/lib/renderer/renderPipeline.d.ts +57 -0
  320. package/lib/renderer/renderPipeline.js +49 -0
  321. package/lib/renderer/renderPipeline.js.map +1 -0
  322. package/lib/renderer/sampling.d.ts +10 -0
  323. package/lib/renderer/sampling.js +28 -0
  324. package/lib/renderer/sampling.js.map +1 -0
  325. package/lib/renderer/sceneChangeDetector.d.ts +29 -0
  326. package/lib/renderer/sceneChangeDetector.js +232 -0
  327. package/lib/renderer/sceneChangeDetector.js.map +1 -0
  328. package/lib/renderer/sceneLightChanges.d.ts +14 -0
  329. package/lib/renderer/sceneLightChanges.js +34 -0
  330. package/lib/renderer/sceneLightChanges.js.map +1 -0
  331. package/lib/renderer/scratchSampling.d.ts +3 -0
  332. package/lib/renderer/scratchSampling.js +39 -0
  333. package/lib/renderer/scratchSampling.js.map +1 -0
  334. package/lib/renderer/shader.d.ts +37 -0
  335. package/lib/renderer/shader.js +41 -0
  336. package/lib/renderer/shader.js.map +1 -0
  337. package/lib/renderer/staticBvhPreparation.d.ts +24 -0
  338. package/lib/renderer/staticBvhPreparation.js +116 -0
  339. package/lib/renderer/staticBvhPreparation.js.map +1 -0
  340. package/lib/renderer/textureRegion.d.ts +8 -0
  341. package/lib/renderer/textureRegion.js +9 -0
  342. package/lib/renderer/textureRegion.js.map +1 -0
  343. package/lib/renderer/texturesFromMaterials.d.ts +6 -0
  344. package/lib/renderer/texturesFromMaterials.js +37 -0
  345. package/lib/renderer/texturesFromMaterials.js.map +1 -0
  346. package/lib/renderer/util.d.ts +17 -0
  347. package/lib/renderer/util.js +56 -0
  348. package/lib/renderer/util.js.map +1 -0
  349. package/lib/renderer/webgl.d.ts +131 -0
  350. package/lib/renderer/webgl.js +586 -0
  351. package/lib/renderer/webgl.js.map +1 -0
  352. package/lib/renderer/webglShaders.d.ts +4 -0
  353. package/lib/renderer/webglShaders.js +41 -0
  354. package/lib/renderer/webglShaders.js.map +1 -0
  355. package/lib/renderer/wgsl/chunks/common.wgsl.d.ts +2 -0
  356. package/lib/renderer/wgsl/chunks/common.wgsl.js +23 -0
  357. package/lib/renderer/wgsl/chunks/common.wgsl.js.map +1 -0
  358. package/lib/renderer/wgsl/chunks/envMap.wgsl.d.ts +2 -0
  359. package/lib/renderer/wgsl/chunks/envMap.wgsl.js +128 -0
  360. package/lib/renderer/wgsl/chunks/envMap.wgsl.js.map +1 -0
  361. package/lib/renderer/wgsl/chunks/intersect.wgsl.d.ts +6 -0
  362. package/lib/renderer/wgsl/chunks/intersect.wgsl.js +1441 -0
  363. package/lib/renderer/wgsl/chunks/intersect.wgsl.js.map +1 -0
  364. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.d.ts +8 -0
  365. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js +85 -0
  366. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js.map +1 -0
  367. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.d.ts +7 -0
  368. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js +315 -0
  369. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js.map +1 -0
  370. package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.d.ts +3 -0
  371. package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js +1737 -0
  372. package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js.map +1 -0
  373. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.d.ts +4 -0
  374. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js +352 -0
  375. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js.map +1 -0
  376. package/lib/renderer/wgsl/chunks/rand.wgsl.d.ts +2 -0
  377. package/lib/renderer/wgsl/chunks/rand.wgsl.js +25 -0
  378. package/lib/renderer/wgsl/chunks/rand.wgsl.js.map +1 -0
  379. package/lib/renderer/wgsl/chunks/random.wgsl.d.ts +1 -0
  380. package/lib/renderer/wgsl/chunks/random.wgsl.js +2 -0
  381. package/lib/renderer/wgsl/chunks/random.wgsl.js.map +1 -0
  382. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.d.ts +5 -0
  383. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js +328 -0
  384. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js.map +1 -0
  385. package/lib/renderer/wgsl/chunks/sampleLight.wgsl.d.ts +2 -0
  386. package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js +400 -0
  387. package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js.map +1 -0
  388. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.d.ts +3 -0
  389. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js +439 -0
  390. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js.map +1 -0
  391. package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.d.ts +2 -0
  392. package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js +40 -0
  393. package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js.map +1 -0
  394. package/lib/renderer/wgsl/chunks/sampling.wgsl.d.ts +2 -0
  395. package/lib/renderer/wgsl/chunks/sampling.wgsl.js +198 -0
  396. package/lib/renderer/wgsl/chunks/sampling.wgsl.js.map +1 -0
  397. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.d.ts +8 -0
  398. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js +16 -0
  399. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js.map +1 -0
  400. package/lib/renderer/wgsl/chunks/sobol.wgsl.d.ts +2 -0
  401. package/lib/renderer/wgsl/chunks/sobol.wgsl.js +170 -0
  402. package/lib/renderer/wgsl/chunks/sobol.wgsl.js.map +1 -0
  403. package/lib/renderer/wgsl/chunks/uvProjection.wgsl.d.ts +2 -0
  404. package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js +42 -0
  405. package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js.map +1 -0
  406. package/lib/renderer/wgsl/compose.frag.wgsl.d.ts +5 -0
  407. package/lib/renderer/wgsl/compose.frag.wgsl.js +218 -0
  408. package/lib/renderer/wgsl/compose.frag.wgsl.js.map +1 -0
  409. package/lib/renderer/wgsl/customDenoise.wgsl.d.ts +4 -0
  410. package/lib/renderer/wgsl/customDenoise.wgsl.js +28 -0
  411. package/lib/renderer/wgsl/customDenoise.wgsl.js.map +1 -0
  412. package/lib/renderer/wgsl/depthQuery.wgsl.d.ts +3 -0
  413. package/lib/renderer/wgsl/depthQuery.wgsl.js +34 -0
  414. package/lib/renderer/wgsl/depthQuery.wgsl.js.map +1 -0
  415. package/lib/renderer/wgsl/offlineAdaptive.compute.d.ts +2 -0
  416. package/lib/renderer/wgsl/offlineAdaptive.compute.js +108 -0
  417. package/lib/renderer/wgsl/offlineAdaptive.compute.js.map +1 -0
  418. package/lib/renderer/wgsl/rayTrace.compute.d.ts +16 -0
  419. package/lib/renderer/wgsl/rayTrace.compute.js +927 -0
  420. package/lib/renderer/wgsl/rayTrace.compute.js.map +1 -0
  421. package/lib/scene/AmbientLight.d.ts +17 -0
  422. package/lib/scene/AmbientLight.js +15 -0
  423. package/lib/scene/AmbientLight.js.map +1 -0
  424. package/lib/scene/Camera.d.ts +78 -0
  425. package/lib/scene/Camera.js +111 -0
  426. package/lib/scene/Camera.js.map +1 -0
  427. package/lib/scene/DirectionalLight.d.ts +18 -0
  428. package/lib/scene/DirectionalLight.js +17 -0
  429. package/lib/scene/DirectionalLight.js.map +1 -0
  430. package/lib/scene/EnvironmentLight.d.ts +14 -0
  431. package/lib/scene/EnvironmentLight.js +14 -0
  432. package/lib/scene/EnvironmentLight.js.map +1 -0
  433. package/lib/scene/Geometry.d.ts +87 -0
  434. package/lib/scene/Geometry.js +108 -0
  435. package/lib/scene/Geometry.js.map +1 -0
  436. package/lib/scene/IESProfile.d.ts +19 -0
  437. package/lib/scene/IESProfile.js +165 -0
  438. package/lib/scene/IESProfile.js.map +1 -0
  439. package/lib/scene/InstancedMesh.d.ts +43 -0
  440. package/lib/scene/InstancedMesh.js +79 -0
  441. package/lib/scene/InstancedMesh.js.map +1 -0
  442. package/lib/scene/Mesh.d.ts +14 -0
  443. package/lib/scene/Mesh.js +17 -0
  444. package/lib/scene/Mesh.js.map +1 -0
  445. package/lib/scene/OpenPBRMaterial.d.ts +224 -0
  446. package/lib/scene/OpenPBRMaterial.js +240 -0
  447. package/lib/scene/OpenPBRMaterial.js.map +1 -0
  448. package/lib/scene/RectLight.d.ts +31 -0
  449. package/lib/scene/RectLight.js +26 -0
  450. package/lib/scene/RectLight.js.map +1 -0
  451. package/lib/scene/Scene.d.ts +55 -0
  452. package/lib/scene/Scene.js +2 -0
  453. package/lib/scene/Scene.js.map +1 -0
  454. package/lib/scene/SceneNode.d.ts +16 -0
  455. package/lib/scene/SceneNode.js +33 -0
  456. package/lib/scene/SceneNode.js.map +1 -0
  457. package/lib/scene/SphereLight.d.ts +22 -0
  458. package/lib/scene/SphereLight.js +20 -0
  459. package/lib/scene/SphereLight.js.map +1 -0
  460. package/lib/scene/SpotLight.d.ts +35 -0
  461. package/lib/scene/SpotLight.js +29 -0
  462. package/lib/scene/SpotLight.js.map +1 -0
  463. package/lib/scene/Texture.d.ts +38 -0
  464. package/lib/scene/Texture.js +37 -0
  465. package/lib/scene/Texture.js.map +1 -0
  466. package/lib/scene/anisotropyParameters.d.ts +1 -0
  467. package/lib/scene/anisotropyParameters.js +13 -0
  468. package/lib/scene/anisotropyParameters.js.map +1 -0
  469. package/lib/scene/geometryChanges.d.ts +5 -0
  470. package/lib/scene/geometryChanges.js +18 -0
  471. package/lib/scene/geometryChanges.js.map +1 -0
  472. package/lib/scene/materialTextureNames.d.ts +2 -0
  473. package/lib/scene/materialTextureNames.js +9 -0
  474. package/lib/scene/materialTextureNames.js.map +1 -0
  475. package/lib/scene/openPbrSchema.d.ts +400 -0
  476. package/lib/scene/openPbrSchema.js +149 -0
  477. package/lib/scene/openPbrSchema.js.map +1 -0
  478. package/lib/scene/thinFilmParameters.d.ts +4 -0
  479. package/lib/scene/thinFilmParameters.js +12 -0
  480. package/lib/scene/thinFilmParameters.js.map +1 -0
  481. package/lib/settings/display.d.ts +118 -0
  482. package/lib/settings/display.js +34 -0
  483. package/lib/settings/display.js.map +1 -0
  484. package/lib/settings/engine.d.ts +37 -0
  485. package/lib/settings/engine.js +26 -0
  486. package/lib/settings/engine.js.map +1 -0
  487. package/lib/settings/render.d.ts +178 -0
  488. package/lib/settings/render.js +36 -0
  489. package/lib/settings/render.js.map +1 -0
  490. package/lib/tinybvh/LICENSE +21 -0
  491. package/lib/tinybvh/TinyBvhBuilder.d.ts +17 -0
  492. package/lib/tinybvh/TinyBvhBuilder.js +211 -0
  493. package/lib/tinybvh/TinyBvhBuilder.js.map +1 -0
  494. package/lib/tinybvh/tinybvh.wasm +0 -0
  495. package/lib/types.d.ts +13 -0
  496. package/lib/types.js +2 -0
  497. package/lib/types.js.map +1 -0
  498. package/lib/util/canvas.d.ts +2 -0
  499. package/lib/util/canvas.js +13 -0
  500. package/lib/util/canvas.js.map +1 -0
  501. package/lib/util/commonGeometry.d.ts +15 -0
  502. package/lib/util/commonGeometry.js +240 -0
  503. package/lib/util/commonGeometry.js.map +1 -0
  504. package/lib/util/events.d.ts +7 -0
  505. package/lib/util/events.js +23 -0
  506. package/lib/util/events.js.map +1 -0
  507. package/lib/util/frame.d.ts +2 -0
  508. package/lib/util/frame.js +10 -0
  509. package/lib/util/frame.js.map +1 -0
  510. package/lib/util/fromTHREE.d.ts +105 -0
  511. package/lib/util/fromTHREE.js +1111 -0
  512. package/lib/util/fromTHREE.js.map +1 -0
  513. package/lib/util/geometry.d.ts +13 -0
  514. package/lib/util/geometry.js +292 -0
  515. package/lib/util/geometry.js.map +1 -0
  516. package/lib/util/loadRGBE.d.ts +7 -0
  517. package/lib/util/loadRGBE.js +168 -0
  518. package/lib/util/loadRGBE.js.map +1 -0
  519. package/lib/util/math.d.ts +8 -0
  520. package/lib/util/math.js +64 -0
  521. package/lib/util/math.js.map +1 -0
  522. package/lib/util/mesh.d.ts +7 -0
  523. package/lib/util/mesh.js +20 -0
  524. package/lib/util/mesh.js.map +1 -0
  525. package/lib/util/threeDeformation.d.ts +20 -0
  526. package/lib/util/threeDeformation.js +218 -0
  527. package/lib/util/threeDeformation.js.map +1 -0
  528. package/lib/version.d.ts +2 -0
  529. package/lib/version.js +3 -0
  530. package/lib/version.js.map +1 -0
  531. package/llms.txt +62 -0
  532. package/oidn/weights/LICENSE.txt +202 -0
  533. package/oidn/weights/README.md +43 -0
  534. package/oidn/weights/rt_hdr_alb_nrm.tza +0 -0
  535. package/oidn/weights/rt_hdr_alb_nrm_small.tza +0 -0
  536. package/package.json +124 -4
@@ -0,0 +1,240 @@
1
+ import { materialDefault, applyMaterialParams } from './openPbrSchema.js';
2
+ /**
3
+ * OpenPBR 1.1 surface material.
4
+ *
5
+ * Property names are camelCase OpenPBR inputs plus documented compatibility names
6
+ * (https://academysoftwarefoundation.github.io/OpenPBR/). Colors are linear
7
+ * RGB. Length-valued inputs (`transmissionDepth`, `subsurfaceRadius`) use
8
+ * scene units; `thinFilmThickness` is in micrometres as in OpenPBR.
9
+ *
10
+ * ```ts
11
+ * const gold = new OpenPBRMaterial({
12
+ * baseColor: [1.0, 0.78, 0.34], baseMetalness: 1, specularRoughness: 0.2
13
+ * });
14
+ * ```
15
+ *
16
+ * Edit parameters in place; the next `engine.update()` detects the changes.
17
+ */
18
+ export default class OpenPBRMaterial {
19
+ /** Creates a material. Omitted properties use their documented defaults. */
20
+ constructor(params = {}) {
21
+ applyMaterialParams(this, params);
22
+ }
23
+ // Base
24
+ /** Multiplier of diffuse reflection and metallic normal-incidence color; does not scale dielectric specular, transmission or subsurface. Default `1`. */
25
+ baseWeight = materialDefault('baseWeight');
26
+ /** Diffuse/metal color. Default `[0.8, 0.8, 0.8]`. */
27
+ baseColor = materialDefault('baseColor');
28
+ /** Oren-Nayar style roughness of the diffuse lobe. Default `0`. */
29
+ baseDiffuseRoughness = materialDefault('baseDiffuseRoughness');
30
+ /** `0` dielectric, `1` metal. Default `0`. */
31
+ baseMetalness = materialDefault('baseMetalness');
32
+ // Specular
33
+ /** Dielectric specular strength (via IOR) and overall metallic Fresnel multiplier. Default `1`. */
34
+ specularWeight = materialDefault('specularWeight');
35
+ /** Dielectric specular tint and metallic F82 near-grazing tint. Default `[1, 1, 1]`. */
36
+ specularColor = materialDefault('specularColor');
37
+ /** Microfacet roughness, `0` mirror to `1` rough; retains source perceptual roughness in `gltf` anisotropy mode. Default `0.3`. */
38
+ specularRoughness = materialDefault('specularRoughness');
39
+ /** Index of refraction. Default `1.5`. */
40
+ specularIor = materialDefault('specularIor');
41
+ /**
42
+ * GGX anisotropy strength, 0 to 1 (requires tangents); native OpenPBR or source glTF strength according to specularAnisotropyModel. Default `0`.
43
+ * @deprecated Use specularRoughnessAnisotropy.
44
+ */
45
+ specularAnisotropy = materialDefault('specularAnisotropy');
46
+ // Transmission
47
+ /** `1` makes the dielectric base fully transmissive (glass). Default `0`. */
48
+ transmissionWeight = materialDefault('transmissionWeight');
49
+ /** Transmission tint, or the medium color at `transmissionDepth`. Default `[1, 1, 1]`. */
50
+ transmissionColor = materialDefault('transmissionColor');
51
+ /** Depth at which `transmissionColor` is reached; `0` tints at the surface. Default `0`. */
52
+ transmissionDepth = materialDefault('transmissionDepth');
53
+ /** Volume scattering color of the transmissive medium. Default `[0, 0, 0]`. */
54
+ transmissionScatter = materialDefault('transmissionScatter');
55
+ /** Henyey-Greenstein anisotropy of the medium, -1 to 1. Default `0`. */
56
+ transmissionScatterAnisotropy = materialDefault('transmissionScatterAnisotropy');
57
+ /** Dispersion strength; `> 0` enables spectral rendering. Default `0`. */
58
+ transmissionDispersionScale = materialDefault('transmissionDispersionScale');
59
+ /** Abbe number controlling dispersion. Default `20`. */
60
+ transmissionDispersionAbbeNumber = materialDefault('transmissionDispersionAbbeNumber');
61
+ // Subsurface
62
+ /** Subsurface scattering weight. Default `0`. */
63
+ subsurfaceWeight = materialDefault('subsurfaceWeight');
64
+ /** Subsurface color. Default `[0.8, 0.8, 0.8]`. */
65
+ subsurfaceColor = materialDefault('subsurfaceColor');
66
+ /** Mean free path in scene units. Default `1`. */
67
+ subsurfaceRadius = materialDefault('subsurfaceRadius');
68
+ /** Per-channel multiplier of `subsurfaceRadius`. Default `[1, 0.5, 0.25]`. */
69
+ subsurfaceRadiusScale = materialDefault('subsurfaceRadiusScale');
70
+ /**
71
+ * Scattering anisotropy, -1 to 1. Default `0`.
72
+ * @deprecated Use subsurfaceScatterAnisotropy.
73
+ */
74
+ subsurfaceAnisotropy = materialDefault('subsurfaceAnisotropy');
75
+ // Fuzz (sheen)
76
+ /** Fuzz (sheen) layer weight. Default `0`. */
77
+ fuzzWeight = materialDefault('fuzzWeight');
78
+ /** Fuzz reflection color; substrate attenuation uses white fuzz albedo. Default `[1, 1, 1]`. */
79
+ fuzzColor = materialDefault('fuzzColor');
80
+ /** Fuzz roughness; imported from Three.js `sheenRoughness`. Default `0.5`. */
81
+ fuzzRoughness = materialDefault('fuzzRoughness');
82
+ // Coat
83
+ /** Clear coat weight. Default `0`. */
84
+ coatWeight = materialDefault('coatWeight');
85
+ /** Squared coat transmittance at normal incidence; colors the base and emission, not coat reflection. Default `[1, 1, 1]`. */
86
+ coatColor = materialDefault('coatColor');
87
+ /** Coat roughness. Default `0`. */
88
+ coatRoughness = materialDefault('coatRoughness');
89
+ /**
90
+ * OpenPBR GGX coat anisotropy, 0 to 1; uses the base geometry tangent. Default `0`.
91
+ * @deprecated Use coatRoughnessAnisotropy.
92
+ */
93
+ coatAnisotropy = materialDefault('coatAnisotropy');
94
+ /** Coat index of refraction. Default `1.6`. */
95
+ coatIor = materialDefault('coatIor');
96
+ /** Internal-reflection darkening: 0 compensates darkening, 1 is physical; absorption remains at 0. Default `1`. */
97
+ coatDarkening = materialDefault('coatDarkening');
98
+ // Thin film
99
+ /** Thin-film interference weight (iridescence). Default `0`. */
100
+ thinFilmWeight = materialDefault('thinFilmWeight');
101
+ /** Film thickness in micrometres; maximum endpoint when thinFilmMap is present. Default `0.5`. */
102
+ thinFilmThickness = materialDefault('thinFilmThickness');
103
+ /** Film index of refraction. Default `1.4`. */
104
+ thinFilmIor = materialDefault('thinFilmIor');
105
+ /** Thickness at a thinFilmMap sample of zero, in micrometres; ignored without a map. May exceed thinFilmThickness. Default `0`. */
106
+ thinFilmThicknessMinimum = materialDefault('thinFilmThicknessMinimum');
107
+ /** Linear channel sampled by thinFilmMap. Default `r`. */
108
+ thinFilmMapChannel = materialDefault('thinFilmMapChannel');
109
+ // Emission and geometry
110
+ /** Emission color. Default `[1, 1, 1]`. */
111
+ emissionColor = materialDefault('emissionColor');
112
+ /** Emitted radiance scale; `0` disables emission. Default `0`. */
113
+ emissionLuminance = materialDefault('emissionLuminance');
114
+ /**
115
+ * Coverage, `1` opaque. See `alphaMode`. Default `1`.
116
+ * @deprecated Use geometryOpacity.
117
+ */
118
+ opacity = materialDefault('opacity');
119
+ /**
120
+ * Treat the surface as an infinitely thin shell (leaves, paper). Default `false`.
121
+ * @deprecated Use geometryThinWalled.
122
+ */
123
+ thinWalled = materialDefault('thinWalled');
124
+ /** Disables geometric back-face culling for this material. Default `false`. */
125
+ doubleSided = materialDefault('doubleSided');
126
+ // Textures
127
+ /** Base color texture, multiplied with `baseColor` using Texture color encoding. Default `undefined`. */
128
+ map;
129
+ /** Standalone opacity texture sampled from its green channel, matching Three.js. Default `undefined`. */
130
+ alphaMap;
131
+ /**
132
+ * Coverage for surface and shadow rays: `opaque` ignores alpha inputs,
133
+ * `mask` uses binary alpha testing, `blend` retains fractional coverage.
134
+ * `auto` derives the mode from the alpha inputs. Default `auto`.
135
+ */
136
+ alphaMode = materialDefault('alphaMode');
137
+ /** Alpha-test threshold for `mask` mode; equality is fully covered. Default `0`. */
138
+ alphaCutoff = materialDefault('alphaCutoff');
139
+ /** Emission texture multiplied with `emissionColor`. Default `undefined`. */
140
+ emissiveMap;
141
+ /** Tangent-space normal map. */
142
+ normalMap;
143
+ /** Normal map strength per axis. Default `[1, 1]`. */
144
+ normalScale = materialDefault('normalScale');
145
+ /** glTF-compatible B=metalness, G=specular roughness texture. Default `undefined`. */
146
+ metallicRoughnessMap;
147
+ /** Standalone roughness texture sampled from its green channel. Default `undefined`. */
148
+ roughnessMap;
149
+ /** Standalone metalness texture sampled from its blue channel. Default `undefined`. */
150
+ metalnessMap;
151
+ /** Multiplies transmission weight using the texture's red channel. Default `undefined`. */
152
+ transmissionMap;
153
+ /** Linear thickness-range texture; R and zero minimum preserve multiplication semantics. Default `undefined`. */
154
+ thinFilmMap;
155
+ /** Multiplies coatWeight by the linear red channel. Default `undefined`. */
156
+ coatWeightMap;
157
+ /** Multiplies coatRoughness by the linear green channel. Default `undefined`. */
158
+ coatRoughnessMap;
159
+ /** Multiplies fuzzColor by RGB channels using Texture color encoding. Default `undefined`. */
160
+ fuzzColorMap;
161
+ /** Multiplies fuzzRoughness by the linear alpha channel. Default `undefined`. */
162
+ fuzzRoughnessMap;
163
+ /** Multiplies specularWeight by the linear alpha channel. Default `undefined`. */
164
+ specularWeightMap;
165
+ /** Multiplies specularColor by RGB channels using Texture color encoding. Default `undefined`. */
166
+ specularColorMap;
167
+ /** Source convention for base specular anisotropy. `gltf` converts textured roughness and strength before coat roughening; `openpbr` uses native parameters. Default `openpbr`. */
168
+ specularAnisotropyModel = 'openpbr';
169
+ /** Linear RG tangent direction and B strength multiplier for the base specular layer. Default `undefined`. */
170
+ anisotropyMap;
171
+ /** Independent tangent-space coat normal in linear RGB. Without a map, coat shares the existing shading normal. Default `undefined`. */
172
+ coatNormalMap;
173
+ /** XY strength of coatNormalMap; independent of normalScale. Default `[1, 1]`. */
174
+ coatNormalScale = materialDefault('coatNormalScale');
175
+ /** Base direction rotation in radians, counter-clockwise in tangent/bitangent space after RG decoding. Default `0`. */
176
+ specularAnisotropyRotation = 0;
177
+ /** Coat direction rotation in radians relative to the geometry tangent. Default `0`. */
178
+ coatAnisotropyRotation = 0;
179
+ /** GGX roughness anisotropy in [0, 1]; native OpenPBR or source glTF strength according to specularAnisotropyModel. Requires tangents. Default `0`. */
180
+ get specularRoughnessAnisotropy() { return this.specularAnisotropy; }
181
+ set specularRoughnessAnisotropy(value) { this.specularAnisotropy = value; }
182
+ /** OpenPBR coat GGX roughness anisotropy in [0, 1]. Default `0`. */
183
+ get coatRoughnessAnisotropy() { return this.coatAnisotropy; }
184
+ set coatRoughnessAnisotropy(value) { this.coatAnisotropy = value; }
185
+ /** Subsurface scattering anisotropy in [-1, 1]. Default `0`. */
186
+ get subsurfaceScatterAnisotropy() { return this.subsurfaceAnisotropy; }
187
+ set subsurfaceScatterAnisotropy(value) { this.subsurfaceAnisotropy = value; }
188
+ /** Surface coverage; alphaMode controls testing and blending. Default `1`. */
189
+ get geometryOpacity() { return this.opacity; }
190
+ set geometryOpacity(value) { this.opacity = value; }
191
+ /** Treat the surface as an infinitely thin shell. Default `false`. */
192
+ get geometryThinWalled() { return this.thinWalled; }
193
+ set geometryThinWalled(value) { this.thinWalled = value; }
194
+ // Renderer extensions
195
+ /**
196
+ * Invisible ground that only receives shadows, composited over the
197
+ * background. Default `false`.
198
+ */
199
+ shadowCatcher = materialDefault('shadowCatcher');
200
+ /** Displays emission without scattering or illuminating other surfaces. Default `false`. */
201
+ unlit = materialDefault('unlit');
202
+ /** Radius of rounded-edge shading (shader bevel) in scene units. `0` disables it. Default `0`. */
203
+ bevelSize = materialDefault('bevelSize');
204
+ /** How map alpha is used: ignored, opacity or transmission. Default `opaque`. */
205
+ mapAlphaUsage = materialDefault('mapAlphaUsage');
206
+ /** Procedural UV projection for textures without (good) UVs. Default `none`. */
207
+ uvProjection = materialDefault('uvProjection');
208
+ /** UV scale used with `uvProjection`. Default `[1, 1]`. */
209
+ uvProjectionScale = materialDefault('uvProjectionScale');
210
+ // Displacement
211
+ /** Height texture (red channel) for displacement. Default `undefined`. */
212
+ displacementMap;
213
+ /** Procedural UV projection for the displacement map. Default `none`. */
214
+ displacementUvProjection = materialDefault('displacementUvProjection');
215
+ /** UV scale used with `displacementUvProjection`. Default `1`. */
216
+ displacementUvProjectionScale = materialDefault('displacementUvProjectionScale');
217
+ /** Height multiplier in mesh-local coordinate units. Default `0.1`. */
218
+ displacementScale = materialDefault('displacementScale');
219
+ /** Ray-marching step for projective displacement. Default `0.01`. */
220
+ displacementStepSize = materialDefault('displacementStepSize');
221
+ }
222
+ export const materialAlphaModeConstants = {
223
+ opaque: 0,
224
+ mask: 1,
225
+ blend: 2
226
+ };
227
+ export function resolveMaterialAlphaMode(material) {
228
+ if (material.alphaMode !== 'auto')
229
+ return material.alphaMode;
230
+ if (material.alphaCutoff > 0)
231
+ return 'mask';
232
+ if (material.opacity < 1 ||
233
+ material.mapAlphaUsage === "alpha" ||
234
+ material.alphaMap) {
235
+ return 'blend';
236
+ }
237
+ return 'opaque';
238
+ }
239
+ export { materialKeys, materialTextureKeys, materialGeometryKeys, materialParamKeys, getMaterialHashKey, resetMaterialTextureId } from './openPbrSchema.js';
240
+ //# sourceMappingURL=OpenPBRMaterial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenPBRMaterial.js","sourceRoot":"","sources":["../../src/scene/OpenPBRMaterial.ts"],"names":[],"mappings":"AAIA,O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esContent":["import type { Vec2 } from '../types.js';\nimport { ColorRGB } from '../types.js';\nimport type Texture from './Texture.js';\nimport type { ThinFilmMapChannel } from './thinFilmParameters.js';\nimport { materialDefault, applyMaterialParams } from './openPbrSchema.js';\n\nexport type UVProjection = 'none' | 'triplanar' | 'spherical' | 'cylindrical';\nexport type MaterialAlphaMode = 'auto' | 'opaque' | 'mask' | 'blend';\n\nexport type { MaterialTextureName } from './materialTextureNames.js';\n\n/**\n * OpenPBR 1.1 surface material.\n *\n * Property names are camelCase OpenPBR inputs plus documented compatibility names\n * (https://academysoftwarefoundation.github.io/OpenPBR/). Colors are linear\n * RGB. Length-valued inputs (`transmissionDepth`, `subsurfaceRadius`) use\n * scene units; `thinFilmThickness` is in micrometres as in OpenPBR.\n *\n * ```ts\n * const gold = new OpenPBRMaterial({\n * baseColor: [1.0, 0.78, 0.34], baseMetalness: 1, specularRoughness: 0.2\n * });\n * ```\n *\n * Edit parameters in place; the next `engine.update()` detects the changes.\n */\nexport default class OpenPBRMaterial {\n /** Creates a material. Omitted properties use their documented defaults. */\n constructor(params: OpenPBRMaterialParams = {}) {\n applyMaterialParams(this, params);\n }\n\n // Base\n /** Multiplier of diffuse reflection and metallic normal-incidence color; does not scale dielectric specular, transmission or subsurface. Default `1`. */\n baseWeight: number = materialDefault('baseWeight');\n /** Diffuse/metal color. Default `[0.8, 0.8, 0.8]`. */\n baseColor: ColorRGB = materialDefault('baseColor');\n /** Oren-Nayar style roughness of the diffuse lobe. Default `0`. */\n baseDiffuseRoughness: number = materialDefault('baseDiffuseRoughness');\n /** `0` dielectric, `1` metal. Default `0`. */\n baseMetalness: number = materialDefault('baseMetalness');\n\n // Specular\n /** Dielectric specular strength (via IOR) and overall metallic Fresnel multiplier. Default `1`. */\n specularWeight: number = materialDefault('specularWeight');\n /** Dielectric specular tint and metallic F82 near-grazing tint. Default `[1, 1, 1]`. */\n specularColor: ColorRGB = materialDefault('specularColor');\n /** Microfacet roughness, `0` mirror to `1` rough; retains source perceptual roughness in `gltf` anisotropy mode. Default `0.3`. */\n specularRoughness: number = materialDefault('specularRoughness');\n /** Index of refraction. Default `1.5`. */\n specularIor: number = materialDefault('specularIor');\n /**\n * GGX anisotropy strength, 0 to 1 (requires tangents); native OpenPBR or source glTF strength according to specularAnisotropyModel. Default `0`.\n * @deprecated Use specularRoughnessAnisotropy.\n */\n specularAnisotropy: number = materialDefault('specularAnisotropy');\n\n // Transmission\n /** `1` makes the dielectric base fully transmissive (glass). Default `0`. */\n transmissionWeight: number = materialDefault('transmissionWeight');\n /** Transmission tint, or the medium color at `transmissionDepth`. Default `[1, 1, 1]`. */\n transmissionColor: ColorRGB = materialDefault('transmissionColor');\n /** Depth at which `transmissionColor` is reached; `0` tints at the surface. Default `0`. */\n transmissionDepth: number = materialDefault('transmissionDepth');\n /** Volume scattering color of the transmissive medium. Default `[0, 0, 0]`. */\n transmissionScatter: ColorRGB = materialDefault('transmissionScatter');\n /** Henyey-Greenstein anisotropy of the medium, -1 to 1. Default `0`. */\n transmissionScatterAnisotropy: number = materialDefault('transmissionScatterAnisotropy');\n /** Dispersion strength; `> 0` enables spectral rendering. Default `0`. */\n transmissionDispersionScale: number = materialDefault('transmissionDispersionScale');\n /** Abbe number controlling dispersion. Default `20`. */\n transmissionDispersionAbbeNumber: number = materialDefault('transmissionDispersionAbbeNumber');\n\n // Subsurface\n /** Subsurface scattering weight. Default `0`. */\n subsurfaceWeight: number = materialDefault('subsurfaceWeight');\n /** Subsurface color. Default `[0.8, 0.8, 0.8]`. */\n subsurfaceColor: ColorRGB = materialDefault('subsurfaceColor');\n /** Mean free path in scene units. Default `1`. */\n subsurfaceRadius: number = materialDefault('subsurfaceRadius');\n /** Per-channel multiplier of `subsurfaceRadius`. Default `[1, 0.5, 0.25]`. */\n subsurfaceRadiusScale: ColorRGB = materialDefault('subsurfaceRadiusScale');\n /**\n * Scattering anisotropy, -1 to 1. Default `0`.\n * @deprecated Use subsurfaceScatterAnisotropy.\n */\n subsurfaceAnisotropy: number = materialDefault('subsurfaceAnisotropy');\n\n // Fuzz (sheen)\n /** Fuzz (sheen) layer weight. Default `0`. */\n fuzzWeight: number = materialDefault('fuzzWeight');\n /** Fuzz reflection color; substrate attenuation uses white fuzz albedo. Default `[1, 1, 1]`. */\n fuzzColor: ColorRGB = materialDefault('fuzzColor');\n /** Fuzz roughness; imported from Three.js `sheenRoughness`. Default `0.5`. */\n fuzzRoughness: number = materialDefault('fuzzRoughness');\n\n // Coat\n /** Clear coat weight. Default `0`. */\n coatWeight: number = materialDefault('coatWeight');\n /** Squared coat transmittance at normal incidence; colors the base and emission, not coat reflection. Default `[1, 1, 1]`. */\n coatColor: ColorRGB = materialDefault('coatColor');\n /** Coat roughness. Default `0`. */\n coatRoughness: number = materialDefault('coatRoughness');\n /**\n * OpenPBR GGX coat anisotropy, 0 to 1; uses the base geometry tangent. Default `0`.\n * @deprecated Use coatRoughnessAnisotropy.\n */\n coatAnisotropy: number = materialDefault('coatAnisotropy');\n /** Coat index of refraction. Default `1.6`. */\n coatIor: number = materialDefault('coatIor');\n /** Internal-reflection darkening: 0 compensates darkening, 1 is physical; absorption remains at 0. Default `1`. */\n coatDarkening: number = materialDefault('coatDarkening');\n\n // Thin film\n /** Thin-film interference weight (iridescence). Default `0`. */\n thinFilmWeight: number = materialDefault('thinFilmWeight');\n /** Film thickness in micrometres; maximum endpoint when thinFilmMap is present. Default `0.5`. */\n thinFilmThickness: number = materialDefault('thinFilmThickness');\n /** Film index of refraction. Default `1.4`. */\n thinFilmIor: number = materialDefault('thinFilmIor');\n\n /** Thickness at a thinFilmMap sample of zero, in micrometres; ignored without a map. May exceed thinFilmThickness. Default `0`. */\n thinFilmThicknessMinimum: number = materialDefault('thinFilmThicknessMinimum');\n /** Linear channel sampled by thinFilmMap. Default `r`. */\n thinFilmMapChannel: ThinFilmMapChannel = materialDefault('thinFilmMapChannel');\n\n // Emission and geometry\n /** Emission color. Default `[1, 1, 1]`. */\n emissionColor: ColorRGB = materialDefault('emissionColor');\n /** Emitted radiance scale; `0` disables emission. Default `0`. */\n emissionLuminance: number = materialDefault('emissionLuminance');\n /**\n * Coverage, `1` opaque. See `alphaMode`. Default `1`.\n * @deprecated Use geometryOpacity.\n */\n opacity: number = materialDefault('opacity');\n /**\n * Treat the surface as an infinitely thin shell (leaves, paper). Default `false`.\n * @deprecated Use geometryThinWalled.\n */\n thinWalled: boolean = materialDefault('thinWalled');\n /** Disables geometric back-face culling for this material. Default `false`. */\n doubleSided: boolean = materialDefault('doubleSided');\n\n // Textures\n /** Base color texture, multiplied with `baseColor` using Texture color encoding. Default `undefined`. */\n map?: Texture;\n /** Standalone opacity texture sampled from its green channel, matching Three.js. Default `undefined`. */\n alphaMap?: Texture;\n /**\n * Coverage for surface and shadow rays: `opaque` ignores alpha inputs,\n * `mask` uses binary alpha testing, `blend` retains fractional coverage.\n * `auto` derives the mode from the alpha inputs. Default `auto`.\n */\n alphaMode: MaterialAlphaMode = materialDefault('alphaMode');\n /** Alpha-test threshold for `mask` mode; equality is fully covered. Default `0`. */\n alphaCutoff: number = materialDefault('alphaCutoff');\n /** Emission texture multiplied with `emissionColor`. Default `undefined`. */\n emissiveMap?: Texture;\n /** Tangent-space normal map. */\n normalMap?: Texture;\n /** Normal map strength per axis. Default `[1, 1]`. */\n normalScale: Vec2 = materialDefault('normalScale');\n /** glTF-compatible B=metalness, G=specular roughness texture. Default `undefined`. */\n metallicRoughnessMap?: Texture;\n /** Standalone roughness texture sampled from its green channel. Default `undefined`. */\n roughnessMap?: Texture;\n /** Standalone metalness texture sampled from its blue channel. Default `undefined`. */\n metalnessMap?: Texture;\n /** Multiplies transmission weight using the texture's red channel. Default `undefined`. */\n transmissionMap?: Texture;\n /** Linear thickness-range texture; R and zero minimum preserve multiplication semantics. Default `undefined`. */\n thinFilmMap?: Texture;\n\n /** Multiplies coatWeight by the linear red channel. Default `undefined`. */\n coatWeightMap?: Texture;\n /** Multiplies coatRoughness by the linear green channel. Default `undefined`. */\n coatRoughnessMap?: Texture;\n /** Multiplies fuzzColor by RGB channels using Texture color encoding. Default `undefined`. */\n fuzzColorMap?: Texture;\n /** Multiplies fuzzRoughness by the linear alpha channel. Default `undefined`. */\n fuzzRoughnessMap?: Texture;\n /** Multiplies specularWeight by the linear alpha channel. Default `undefined`. */\n specularWeightMap?: Texture;\n /** Multiplies specularColor by RGB channels using Texture color encoding. Default `undefined`. */\n specularColorMap?: Texture;\n\n\n /** Source convention for base specular anisotropy. `gltf` converts textured roughness and strength before coat roughening; `openpbr` uses native parameters. Default `openpbr`. */\n specularAnisotropyModel: 'openpbr' | 'gltf' = 'openpbr';\n /** Linear RG tangent direction and B strength multiplier for the base specular layer. Default `undefined`. */\n anisotropyMap?: Texture;\n /** Independent tangent-space coat normal in linear RGB. Without a map, coat shares the existing shading normal. Default `undefined`. */\n coatNormalMap?: Texture;\n /** XY strength of coatNormalMap; independent of normalScale. Default `[1, 1]`. */\n coatNormalScale: Vec2 = materialDefault('coatNormalScale');\n /** Base direction rotation in radians, counter-clockwise in tangent/bitangent space after RG decoding. Default `0`. */\n specularAnisotropyRotation: number = 0;\n /** Coat direction rotation in radians relative to the geometry tangent. Default `0`. */\n coatAnisotropyRotation: number = 0;\n\n /** GGX roughness anisotropy in [0, 1]; native OpenPBR or source glTF strength according to specularAnisotropyModel. Requires tangents. Default `0`. */\n get specularRoughnessAnisotropy(): number { return this.specularAnisotropy; }\n set specularRoughnessAnisotropy(value: number) { this.specularAnisotropy = value; }\n\n /** OpenPBR coat GGX roughness anisotropy in [0, 1]. Default `0`. */\n get coatRoughnessAnisotropy(): number { return this.coatAnisotropy; }\n set coatRoughnessAnisotropy(value: number) { this.coatAnisotropy = value; }\n\n /** Subsurface scattering anisotropy in [-1, 1]. Default `0`. */\n get subsurfaceScatterAnisotropy(): number { return this.subsurfaceAnisotropy; }\n set subsurfaceScatterAnisotropy(value: number) { this.subsurfaceAnisotropy = value; }\n\n /** Surface coverage; alphaMode controls testing and blending. Default `1`. */\n get geometryOpacity(): number { return this.opacity; }\n set geometryOpacity(value: number) { this.opacity = value; }\n\n /** Treat the surface as an infinitely thin shell. Default `false`. */\n get geometryThinWalled(): boolean { return this.thinWalled; }\n set geometryThinWalled(value: boolean) { this.thinWalled = value; }\n\n // Renderer extensions\n /**\n * Invisible ground that only receives shadows, composited over the\n * background. Default `false`.\n */\n shadowCatcher: boolean = materialDefault('shadowCatcher');\n /** Displays emission without scattering or illuminating other surfaces. Default `false`. */\n unlit: boolean = materialDefault('unlit');\n /** Radius of rounded-edge shading (shader bevel) in scene units. `0` disables it. Default `0`. */\n bevelSize: number = materialDefault('bevelSize');\n /** How map alpha is used: ignored, opacity or transmission. Default `opaque`. */\n mapAlphaUsage: 'opaque' | 'alpha' | 'transmission' = materialDefault('mapAlphaUsage');\n /** Procedural UV projection for textures without (good) UVs. Default `none`. */\n uvProjection: UVProjection = materialDefault('uvProjection');\n /** UV scale used with `uvProjection`. Default `[1, 1]`. */\n uvProjectionScale: Vec2 = materialDefault('uvProjectionScale');\n\n // Displacement\n /** Height texture (red channel) for displacement. Default `undefined`. */\n displacementMap?: Texture;\n /** Procedural UV projection for the displacement map. Default `none`. */\n displacementUvProjection: UVProjection = materialDefault('displacementUvProjection');\n /** UV scale used with `displacementUvProjection`. Default `1`. */\n displacementUvProjectionScale: number = materialDefault('displacementUvProjectionScale');\n /** Height multiplier in mesh-local coordinate units. Default `0.1`. */\n displacementScale: number = materialDefault('displacementScale');\n /** Ray-marching step for projective displacement. Default `0.01`. */\n displacementStepSize: number = materialDefault('displacementStepSize');\n\n}\nexport const materialAlphaModeConstants = {\n opaque: 0,\n mask: 1,\n blend: 2\n} as const;\n\nexport type ResolvedMaterialAlphaMode = Exclude<MaterialAlphaMode, 'auto'>;\n\nexport function resolveMaterialAlphaMode(\n material: OpenPBRMaterial\n): ResolvedMaterialAlphaMode {\n if (material.alphaMode !== 'auto') return material.alphaMode;\n if (material.alphaCutoff > 0) return 'mask';\n if (\n material.opacity < 1 ||\n material.mapAlphaUsage === \"alpha\" ||\n material.alphaMap\n ) {\n return 'blend';\n }\n return 'opaque';\n}\n\nexport { materialKeys, materialTextureKeys, materialGeometryKeys, materialParamKeys, getMaterialHashKey, resetMaterialTextureId } from './openPbrSchema.js';\n\n/** Optional material properties; defaults are documented on OpenPBRMaterial. */\nexport type OpenPBRMaterialParams = Partial<OpenPBRMaterial>;\n"]}
@@ -0,0 +1,31 @@
1
+ import type { ColorRGB, Vec2 } from '../types.js';
2
+ import SceneNode from './SceneNode.js';
3
+ import type Texture from './Texture.js';
4
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
5
+ export default class RectLight extends SceneNode {
6
+ /** Light discriminator. */
7
+ readonly type: "RectLight";
8
+ /** Width and height; transform scale is ignored. Default `[1, 1]`. */
9
+ size: Vec2;
10
+ /** Linear RGB color. Default `[1, 1, 1]`. */
11
+ color: ColorRGB;
12
+ /** Emitted radiance multiplier. Default `1`. */
13
+ intensity: number;
14
+ /** Emission texture. Default `undefined`. */
15
+ texture: Texture | undefined;
16
+ /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
17
+ spread: number;
18
+ /** Creates a light; omitted options retain the field defaults. */
19
+ constructor(params?: {
20
+ /** Width and height; transform scale is ignored. Default `[1, 1]`. */
21
+ size?: Vec2;
22
+ /** Linear RGB color. Default `[1, 1, 1]`. */
23
+ color?: ColorRGB;
24
+ /** Emitted radiance multiplier. Default `1`. */
25
+ intensity?: number;
26
+ /** Emission texture. Default `undefined`. */
27
+ texture?: Texture | undefined;
28
+ /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
29
+ spread?: number;
30
+ });
31
+ }
@@ -0,0 +1,26 @@
1
+ import SceneNode from './SceneNode.js';
2
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
3
+ export default class RectLight extends SceneNode {
4
+ /** Light discriminator. */
5
+ type = 'RectLight';
6
+ /** Width and height; transform scale is ignored. Default `[1, 1]`. */
7
+ size = [1, 1];
8
+ /** Linear RGB color. Default `[1, 1, 1]`. */
9
+ color = [1, 1, 1];
10
+ /** Emitted radiance multiplier. Default `1`. */
11
+ intensity = 1;
12
+ /** Emission texture. Default `undefined`. */
13
+ texture = undefined;
14
+ /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
15
+ spread = 1;
16
+ /** Creates a light; omitted options retain the field defaults. */
17
+ constructor(params = {}) {
18
+ super();
19
+ this.size = params.size ?? [1, 1];
20
+ this.color = params.color ?? [1, 1, 1];
21
+ this.intensity = params.intensity ?? 1;
22
+ this.texture = params.texture ?? undefined;
23
+ this.spread = params.spread ?? 1;
24
+ }
25
+ }
26
+ //# sourceMappingURL=RectLight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RectLight.js","sourceRoot":"","sources":["../../src/scene/RectLight.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAGvC,kHAAkH;AAClH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS;IAC9C,2BAA2B;IAClB,IAAI,GAAG,WAAoB,CAAC;IACrC,sEAAsE;IACtE,IAAI,GAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,6CAA6C;IAC7C,KAAK,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,gDAAgD;IAChD,SAAS,GAAW,CAAC,CAAC;IACtB,6CAA6C;IAC7C,OAAO,GAAwB,SAAS,CAAC;IACzC,yEAAyE;IACzE,MAAM,GAAW,CAAC,CAAC;IAEnB,kEAAkE;IAClE,YAAY,SAWR,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["import type { ColorRGB, Vec2 } from '../types.js';\nimport SceneNode from './SceneNode.js';\nimport type Texture from './Texture.js';\n\n/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */\nexport default class RectLight extends SceneNode {\n /** Light discriminator. */\n readonly type = 'RectLight' as const;\n /** Width and height; transform scale is ignored. Default `[1, 1]`. */\n size: Vec2 = [1, 1];\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color: ColorRGB = [1, 1, 1];\n /** Emitted radiance multiplier. Default `1`. */\n intensity: number = 1;\n /** Emission texture. Default `undefined`. */\n texture: Texture | undefined = undefined;\n /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */\n spread: number = 1;\n\n /** Creates a light; omitted options retain the field defaults. */\n constructor(params: {\n /** Width and height; transform scale is ignored. Default `[1, 1]`. */\n size?: Vec2;\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color?: ColorRGB;\n /** Emitted radiance multiplier. Default `1`. */\n intensity?: number;\n /** Emission texture. Default `undefined`. */\n texture?: Texture | undefined;\n /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */\n spread?: number;\n } = {}) {\n super();\n this.size = params.size ?? [1, 1];\n this.color = params.color ?? [1, 1, 1];\n this.intensity = params.intensity ?? 1;\n this.texture = params.texture ?? undefined;\n this.spread = params.spread ?? 1;\n }\n}\n"]}
@@ -0,0 +1,55 @@
1
+ import { ColorRGBA } from '../types.js';
2
+ import AmbientLight from './AmbientLight.js';
3
+ import DirectionalLight from './DirectionalLight.js';
4
+ import EnvironmentLight from './EnvironmentLight.js';
5
+ import Mesh from './Mesh.js';
6
+ import InstancedMesh from './InstancedMesh.js';
7
+ import RectLight from './RectLight.js';
8
+ import SphereLight from './SphereLight.js';
9
+ import SpotLight from './SpotLight.js';
10
+ import Texture from './Texture.js';
11
+ /** Lights with an analytic shape. */
12
+ export type AnalyticLight = RectLight | SphereLight | SpotLight | DirectionalLight;
13
+ /** Any light that can be placed in {@link Scene.lights}. */
14
+ export type SceneLight = AmbientLight | EnvironmentLight | AnalyticLight;
15
+ /**
16
+ * Environment map projected onto a ground plane and sky dome, so objects
17
+ * appear to stand on the photographed ground.
18
+ */
19
+ export interface GroundedSkyboxBackground {
20
+ /** Ground projection discriminator; always `GroundedSkybox`. */
21
+ type: 'GroundedSkybox';
22
+ /** Required equirectangular environment texture. */
23
+ map: Texture;
24
+ /** Required capture height above ground in scene units. */
25
+ height: number;
26
+ /** Required projected sky-dome radius in scene units. */
27
+ radius: number;
28
+ /** Ground plane Y in scene units. Default `0`. */
29
+ groundHeight?: number;
30
+ /** Capture X/Z center in scene units. Default `[0, 0]`. */
31
+ center?: [number, number];
32
+ }
33
+ /**
34
+ * What camera rays that miss the scene show: a linear RGBA color (alpha 0
35
+ * for a transparent canvas), an equirectangular texture, or a grounded
36
+ * skybox. When omitted, the environment light is shown.
37
+ */
38
+ export type SceneBackground = ColorRGBA | Texture | GroundedSkyboxBackground;
39
+ /**
40
+ * Everything the renderer draws. A plain object; mesh and light membership,
41
+ * mesh transforms, material parameters, resource references, light parameters and background
42
+ * values are detected automatically, including edits within existing arrays.
43
+ * Call `markUpdated()` on a Geometry after attribute edits, and a Texture
44
+ * after pixel or UV-array element edits.
45
+ * InstancedMesh matrix/color elements require markUpdated() or the dedicated
46
+ * markTransformsUpdated()/markColorsUpdated() notifications.
47
+ */
48
+ export interface Scene {
49
+ /** Required mesh instances; use an empty array for an empty scene. */
50
+ meshes: (Mesh | InstancedMesh)[];
51
+ /** Required lights; use an empty array for an unlit scene. */
52
+ lights: SceneLight[];
53
+ /** Camera-ray background; defaults to the environment light when omitted. */
54
+ background?: SceneBackground;
55
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scene.js","sourceRoot":"","sources":["../../src/scene/Scene.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorRGBA } from '../types.js';\nimport AmbientLight from './AmbientLight.js';\nimport DirectionalLight from './DirectionalLight.js';\nimport EnvironmentLight from './EnvironmentLight.js';\nimport Mesh from './Mesh.js';\nimport InstancedMesh from './InstancedMesh.js';\nimport RectLight from './RectLight.js';\nimport SphereLight from './SphereLight.js';\nimport SpotLight from './SpotLight.js';\nimport Texture from './Texture.js';\n\n/** Lights with an analytic shape. */\nexport type AnalyticLight = RectLight | SphereLight | SpotLight | DirectionalLight;\n/** Any light that can be placed in {@link Scene.lights}. */\nexport type SceneLight = AmbientLight | EnvironmentLight | AnalyticLight;\n\n/**\n * Environment map projected onto a ground plane and sky dome, so objects\n * appear to stand on the photographed ground.\n */\nexport interface GroundedSkyboxBackground {\n /** Ground projection discriminator; always `GroundedSkybox`. */\n type: 'GroundedSkybox';\n /** Required equirectangular environment texture. */\n map: Texture;\n /** Required capture height above ground in scene units. */\n height: number;\n /** Required projected sky-dome radius in scene units. */\n radius: number;\n /** Ground plane Y in scene units. Default `0`. */\n groundHeight?: number;\n /** Capture X/Z center in scene units. Default `[0, 0]`. */\n center?: [number, number];\n}\n\n/**\n * What camera rays that miss the scene show: a linear RGBA color (alpha 0\n * for a transparent canvas), an equirectangular texture, or a grounded\n * skybox. When omitted, the environment light is shown.\n */\nexport type SceneBackground = ColorRGBA | Texture | GroundedSkyboxBackground;\n/**\n * Everything the renderer draws. A plain object; mesh and light membership,\n * mesh transforms, material parameters, resource references, light parameters and background\n * values are detected automatically, including edits within existing arrays.\n * Call `markUpdated()` on a Geometry after attribute edits, and a Texture\n * after pixel or UV-array element edits.\n * InstancedMesh matrix/color elements require markUpdated() or the dedicated\n * markTransformsUpdated()/markColorsUpdated() notifications.\n */\nexport interface Scene {\n /** Required mesh instances; use an empty array for an empty scene. */\n meshes: (Mesh | InstancedMesh)[];\n /** Required lights; use an empty array for an unlit scene. */\n lights: SceneLight[];\n /** Camera-ray background; defaults to the environment light when omitted. */\n background?: SceneBackground;\n\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { Mat4, Vec3 } from '../types.js';
2
+ /** Base class of objects positioned by a local-to-world transform. */
3
+ export default abstract class SceneNode {
4
+ /** Optional object name. Default empty string. */
5
+ name: string;
6
+ /**
7
+ * Local-to-world transform: column-major 4×4 (gl-matrix layout). Default identity.
8
+ * Edits, including in-place element edits, are detected on the next render.
9
+ */
10
+ transform: Mat4;
11
+ /** Reads a copy of the translation, or writes it into transform. Default `[0, 0, 0]`. */
12
+ get position(): Vec3;
13
+ set position(value: Vec3);
14
+ /** Points local -Z at target, preserving position and scale. Default up `[0, 1, 0]`. */
15
+ lookAt(target: Vec3, up?: Vec3): this;
16
+ }
@@ -0,0 +1,33 @@
1
+ import { mat4 } from '../math.js';
2
+ /** Base class of objects positioned by a local-to-world transform. */
3
+ export default class SceneNode {
4
+ /** Optional object name. Default empty string. */
5
+ name = '';
6
+ /**
7
+ * Local-to-world transform: column-major 4×4 (gl-matrix layout). Default identity.
8
+ * Edits, including in-place element edits, are detected on the next render.
9
+ */
10
+ transform = mat4.create();
11
+ /** Reads a copy of the translation, or writes it into transform. Default `[0, 0, 0]`. */
12
+ get position() {
13
+ return [this.transform[12], this.transform[13], this.transform[14]];
14
+ }
15
+ set position(value) {
16
+ this.transform[12] = value[0];
17
+ this.transform[13] = value[1];
18
+ this.transform[14] = value[2];
19
+ }
20
+ /** Points local -Z at target, preserving position and scale. Default up `[0, 1, 0]`. */
21
+ lookAt(target, up = [0, 1, 0]) {
22
+ const scale = mat4.getScaling(new Float32Array(3), this.transform);
23
+ const position = this.position;
24
+ const direction = [target[0] - position[0], target[1] - position[1], target[2] - position[2]];
25
+ const cross = [direction[1] * up[2] - direction[2] * up[1], direction[2] * up[0] - direction[0] * up[2], direction[0] * up[1] - direction[1] * up[0]];
26
+ const effectiveUp = Math.hypot(...cross) > 1e-8 ? up
27
+ : Math.abs(direction[2]) < Math.hypot(...direction) * .99 ? [0, 0, -1] : [1, 0, 0];
28
+ mat4.targetTo(this.transform, position, target, effectiveUp);
29
+ mat4.scale(this.transform, this.transform, scale);
30
+ return this;
31
+ }
32
+ }
33
+ //# sourceMappingURL=SceneNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SceneNode.js","sourceRoot":"","sources":["../../src/scene/SceneNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,sEAAsE;AACtE,MAAM,CAAC,OAAO,OAAgB,SAAS;IACrC,kDAAkD;IAClD,IAAI,GAAG,EAAE,CAAC;IACV;;;OAGG;IACH,SAAS,GAAS,IAAI,CAAC,MAAM,EAAE,CAAC;IAEhC,yFAAyF;IACzF,IAAI,QAAQ;QACV,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,QAAQ,CAAC,KAAW;QACtB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,wFAAwF;IACxF,MAAM,CAAC,MAAY,EAAE,KAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACnE,MAAM,QAAQ,G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AAC;IACd,CAAC;CACF","sourcesContent":["import type { Mat4, Vec3 } from '../types.js';\nimport { mat4 } from '../math.js';\n\n/** Base class of objects positioned by a local-to-world transform. */\nexport default abstract class SceneNode {\n /** Optional object name. Default empty string. */\n name = '';\n /**\n * Local-to-world transform: column-major 4×4 (gl-matrix layout). Default identity.\n * Edits, including in-place element edits, are detected on the next render.\n */\n transform: Mat4 = mat4.create();\n\n /** Reads a copy of the translation, or writes it into transform. Default `[0, 0, 0]`. */\n get position(): Vec3 {\n return [this.transform[12], this.transform[13], this.transform[14]];\n }\n set position(value: Vec3) {\n this.transform[12] = value[0];\n this.transform[13] = value[1];\n this.transform[14] = value[2];\n }\n\n /** Points local -Z at target, preserving position and scale. Default up `[0, 1, 0]`. */\n lookAt(target: Vec3, up: Vec3 = [0, 1, 0]): this {\n const scale = mat4.getScaling(new Float32Array(3), this.transform);\n const position = this.position;\n const direction = [target[0] - position[0], target[1] - position[1], target[2] - position[2]];\n const cross = [direction[1]*up[2]-direction[2]*up[1], direction[2]*up[0]-direction[0]*up[2], direction[0]*up[1]-direction[1]*up[0]];\n const effectiveUp: Vec3 = Math.hypot(...cross) > 1e-8 ? up\n : Math.abs(direction[2]) < Math.hypot(...direction) * .99 ? [0, 0, -1] : [1, 0, 0];\n mat4.targetTo(this.transform, position, target, effectiveUp);\n mat4.scale(this.transform, this.transform, scale);\n return this;\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { ColorRGB } from '../types.js';
2
+ import SceneNode from './SceneNode.js';
3
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
4
+ export default class SphereLight extends SceneNode {
5
+ /** Light discriminator. */
6
+ readonly type: "SphereLight";
7
+ /** Linear RGB color. Default `[1, 1, 1]`. */
8
+ color: ColorRGB;
9
+ /** Emitted radiance multiplier. Default `1`. */
10
+ intensity: number;
11
+ /** Emitter radius in scene units; 0 is a point light. Default `1`. */
12
+ radius: number;
13
+ /** Creates a light; omitted options retain the field defaults. */
14
+ constructor(params?: {
15
+ /** Linear RGB color. Default `[1, 1, 1]`. */
16
+ color?: ColorRGB;
17
+ /** Emitted radiance multiplier. Default `1`. */
18
+ intensity?: number;
19
+ /** Emitter radius in scene units; 0 is a point light. Default `1`. */
20
+ radius?: number;
21
+ });
22
+ }
@@ -0,0 +1,20 @@
1
+ import SceneNode from './SceneNode.js';
2
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
3
+ export default class SphereLight extends SceneNode {
4
+ /** Light discriminator. */
5
+ type = 'SphereLight';
6
+ /** Linear RGB color. Default `[1, 1, 1]`. */
7
+ color = [1, 1, 1];
8
+ /** Emitted radiance multiplier. Default `1`. */
9
+ intensity = 1;
10
+ /** Emitter radius in scene units; 0 is a point light. Default `1`. */
11
+ radius = 1;
12
+ /** Creates a light; omitted options retain the field defaults. */
13
+ constructor(params = {}) {
14
+ super();
15
+ this.color = params.color ?? [1, 1, 1];
16
+ this.intensity = params.intensity ?? 1;
17
+ this.radius = params.radius ?? 1;
18
+ }
19
+ }
20
+ //# sourceMappingURL=SphereLight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SphereLight.js","sourceRoot":"","sources":["../../src/scene/SphereLight.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,kHAAkH;AAClH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IAChD,2BAA2B;IAClB,IAAI,GAAG,aAAsB,CAAC;IACvC,6CAA6C;IAC7C,KAAK,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,gDAAgD;IAChD,SAAS,GAAW,CAAC,CAAC;IACtB,sEAAsE;IACtE,MAAM,GAAW,CAAC,CAAC;IAEnB,kEAAkE;IAClE,YAAY,SAOR,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["import type { ColorRGB } from '../types.js';\nimport SceneNode from './SceneNode.js';\n\n/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */\nexport default class SphereLight extends SceneNode {\n /** Light discriminator. */\n readonly type = 'SphereLight' as const;\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color: ColorRGB = [1, 1, 1];\n /** Emitted radiance multiplier. Default `1`. */\n intensity: number = 1;\n /** Emitter radius in scene units; 0 is a point light. Default `1`. */\n radius: number = 1;\n\n /** Creates a light; omitted options retain the field defaults. */\n constructor(params: {\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color?: ColorRGB;\n /** Emitted radiance multiplier. Default `1`. */\n intensity?: number;\n /** Emitter radius in scene units; 0 is a point light. Default `1`. */\n radius?: number;\n } = {}) {\n super();\n this.color = params.color ?? [1, 1, 1];\n this.intensity = params.intensity ?? 1;\n this.radius = params.radius ?? 1;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import type { ColorRGB } from '../types.js';
2
+ import SceneNode from './SceneNode.js';
3
+ import type IESProfile from './IESProfile.js';
4
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
5
+ export default class SpotLight extends SceneNode {
6
+ /** Light discriminator. */
7
+ readonly type: "SpotLight";
8
+ /** Linear RGB color. Default `[1, 1, 1]`. */
9
+ color: ColorRGB;
10
+ /** Axial intensity in candela. Default `1`. */
11
+ intensity: number;
12
+ /** Emitter radius in scene units; 0 is a point emitter. Default `0.01`. */
13
+ radius: number;
14
+ /** Full-intensity cone half-angle in degrees. Default `30`. */
15
+ innerAngle: number;
16
+ /** Cutoff cone half-angle in degrees, at most 180. Default `45`. */
17
+ outerAngle: number;
18
+ /** Optional photometric emission profile. Default `undefined`. */
19
+ iesProfile: IESProfile | undefined;
20
+ /** Creates a light; omitted options retain the field defaults. */
21
+ constructor(params?: {
22
+ /** Linear RGB color. Default `[1, 1, 1]`. */
23
+ color?: ColorRGB;
24
+ /** Axial intensity in candela. Default `1`. */
25
+ intensity?: number;
26
+ /** Emitter radius in scene units; 0 is a point emitter. Default `0.01`. */
27
+ radius?: number;
28
+ /** Full-intensity cone half-angle in degrees. Default `30`. */
29
+ innerAngle?: number;
30
+ /** Cutoff cone half-angle in degrees, at most 180. Default `45`. */
31
+ outerAngle?: number;
32
+ /** Optional photometric emission profile. Default `undefined`. */
33
+ iesProfile?: IESProfile | undefined;
34
+ });
35
+ }
@@ -0,0 +1,29 @@
1
+ import SceneNode from './SceneNode.js';
2
+ /** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
3
+ export default class SpotLight extends SceneNode {
4
+ /** Light discriminator. */
5
+ type = 'SpotLight';
6
+ /** Linear RGB color. Default `[1, 1, 1]`. */
7
+ color = [1, 1, 1];
8
+ /** Axial intensity in candela. Default `1`. */
9
+ intensity = 1;
10
+ /** Emitter radius in scene units; 0 is a point emitter. Default `0.01`. */
11
+ radius = 0.01;
12
+ /** Full-intensity cone half-angle in degrees. Default `30`. */
13
+ innerAngle = 30;
14
+ /** Cutoff cone half-angle in degrees, at most 180. Default `45`. */
15
+ outerAngle = 45;
16
+ /** Optional photometric emission profile. Default `undefined`. */
17
+ iesProfile = undefined;
18
+ /** Creates a light; omitted options retain the field defaults. */
19
+ constructor(params = {}) {
20
+ super();
21
+ this.color = params.color ?? [1, 1, 1];
22
+ this.intensity = params.intensity ?? 1;
23
+ this.radius = params.radius ?? 0.01;
24
+ this.innerAngle = params.innerAngle ?? 30;
25
+ this.outerAngle = params.outerAngle ?? 45;
26
+ this.iesProfile = params.iesProfile ?? undefined;
27
+ }
28
+ }
29
+ //# sourceMappingURL=SpotLight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpotLight.js","sourceRoot":"","sources":["../../src/scene/SpotLight.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAGvC,kHAAkH;AAClH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS;IAC9C,2BAA2B;IAClB,IAAI,GAAG,WAAoB,CAAC;IACrC,6CAA6C;IAC7C,KAAK,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,+CAA+C;IAC/C,SAAS,GAAW,CAAC,CAAC;IACtB,2EAA2E;IAC3E,MAAM,GAAW,IAAI,CAAC;IACtB,+DAA+D;IAC/D,UAAU,GAAW,EAAE,CAAC;IACxB,oEAAoE;IACpE,UAAU,GAAW,EAAE,CAAC;IACxB,kEAAkE;IAClE,UAAU,GAA2B,SAAS,CAAC;IAE/C,kEAAkE;IAClE,YAAY,SAaR,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC;IACnD,CAAC;CACF","sourcesContent":["import type { ColorRGB } from '../types.js';\nimport SceneNode from './SceneNode.js';\nimport type IESProfile from './IESProfile.js';\n\n/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */\nexport default class SpotLight extends SceneNode {\n /** Light discriminator. */\n readonly type = 'SpotLight' as const;\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color: ColorRGB = [1, 1, 1];\n /** Axial intensity in candela. Default `1`. */\n intensity: number = 1;\n /** Emitter radius in scene units; 0 is a point emitter. Default `0.01`. */\n radius: number = 0.01;\n /** Full-intensity cone half-angle in degrees. Default `30`. */\n innerAngle: number = 30;\n /** Cutoff cone half-angle in degrees, at most 180. Default `45`. */\n outerAngle: number = 45;\n /** Optional photometric emission profile. Default `undefined`. */\n iesProfile: IESProfile | undefined = undefined;\n\n /** Creates a light; omitted options retain the field defaults. */\n constructor(params: {\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color?: ColorRGB;\n /** Axial intensity in candela. Default `1`. */\n intensity?: number;\n /** Emitter radius in scene units; 0 is a point emitter. Default `0.01`. */\n radius?: number;\n /** Full-intensity cone half-angle in degrees. Default `30`. */\n innerAngle?: number;\n /** Cutoff cone half-angle in degrees, at most 180. Default `45`. */\n outerAngle?: number;\n /** Optional photometric emission profile. Default `undefined`. */\n iesProfile?: IESProfile | undefined;\n } = {}) {\n super();\n this.color = params.color ?? [1, 1, 1];\n this.intensity = params.intensity ?? 1;\n this.radius = params.radius ?? 0.01;\n this.innerAngle = params.innerAngle ?? 30;\n this.outerAngle = params.outerAngle ?? 45;\n this.iesProfile = params.iesProfile ?? undefined;\n }\n}\n"]}