@zephyr3d/scene 0.7.1 → 0.8.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 (441) hide show
  1. package/dist/animation/animation.js +0 -18
  2. package/dist/animation/animation.js.map +1 -1
  3. package/dist/animation/animationset.js +200 -3
  4. package/dist/animation/animationset.js.map +1 -1
  5. package/dist/animation/ik/ccd_solver.js +371 -0
  6. package/dist/animation/ik/ccd_solver.js.map +1 -0
  7. package/dist/animation/ik/fabrik_solver.js +398 -0
  8. package/dist/animation/ik/fabrik_solver.js.map +1 -0
  9. package/dist/animation/ik/ik_angle_constraint.js +181 -0
  10. package/dist/animation/ik/ik_angle_constraint.js.map +1 -0
  11. package/dist/animation/ik/ik_chain.js +163 -0
  12. package/dist/animation/ik/ik_chain.js.map +1 -0
  13. package/dist/animation/ik/ik_constraint.js +25 -0
  14. package/dist/animation/ik/ik_constraint.js.map +1 -0
  15. package/dist/animation/ik/ik_pole_constraint.js +128 -0
  16. package/dist/animation/ik/ik_pole_constraint.js.map +1 -0
  17. package/dist/animation/ik/ik_solver.js +48 -0
  18. package/dist/animation/ik/ik_solver.js.map +1 -0
  19. package/dist/animation/ik/ik_track.js +96 -0
  20. package/dist/animation/ik/ik_track.js.map +1 -0
  21. package/dist/animation/ik/ik_utils.js +191 -0
  22. package/dist/animation/ik/ik_utils.js.map +1 -0
  23. package/dist/animation/ik/two_bone_ik_solver.js +331 -0
  24. package/dist/animation/ik/two_bone_ik_solver.js.map +1 -0
  25. package/dist/animation/ik_modifier.js +61 -0
  26. package/dist/animation/ik_modifier.js.map +1 -0
  27. package/dist/animation/ik_postprocessor.js +71 -0
  28. package/dist/animation/ik_postprocessor.js.map +1 -0
  29. package/dist/animation/manual_transform_processor.js +156 -0
  30. package/dist/animation/manual_transform_processor.js.map +1 -0
  31. package/dist/animation/skeleton.js +55 -51
  32. package/dist/animation/skeleton.js.map +1 -1
  33. package/dist/animation/skeleton_modifier.js +38 -0
  34. package/dist/animation/skeleton_modifier.js.map +1 -0
  35. package/dist/animation/skeleton_postprocessor.js +50 -0
  36. package/dist/animation/skeleton_postprocessor.js.map +1 -0
  37. package/dist/animation/spring/multi_chain_spring_system.js +503 -0
  38. package/dist/animation/spring/multi_chain_spring_system.js.map +1 -0
  39. package/dist/animation/spring/spring_bone.js +240 -0
  40. package/dist/animation/spring/spring_bone.js.map +1 -0
  41. package/dist/animation/spring/spring_bone_collider.js +198 -0
  42. package/dist/animation/spring/spring_bone_collider.js.map +1 -0
  43. package/dist/animation/spring/spring_bone_constraint.js +170 -0
  44. package/dist/animation/spring/spring_bone_constraint.js.map +1 -0
  45. package/dist/animation/spring/spring_bone_system.js +328 -0
  46. package/dist/animation/spring/spring_bone_system.js.map +1 -0
  47. package/dist/animation/spring/spring_chain.js +103 -0
  48. package/dist/animation/spring/spring_chain.js.map +1 -0
  49. package/dist/animation/spring/spring_collider.js +247 -0
  50. package/dist/animation/spring/spring_collider.js.map +1 -0
  51. package/dist/animation/spring/spring_constraint.js +21 -0
  52. package/dist/animation/spring/spring_constraint.js.map +1 -0
  53. package/dist/animation/spring/spring_particle.js +20 -0
  54. package/dist/animation/spring/spring_particle.js.map +1 -0
  55. package/dist/animation/spring/spring_system.js +526 -0
  56. package/dist/animation/spring/spring_system.js.map +1 -0
  57. package/dist/animation/spring_modifier.js +45 -0
  58. package/dist/animation/spring_modifier.js.map +1 -0
  59. package/dist/animation/spring_postprocessor.js +54 -0
  60. package/dist/animation/spring_postprocessor.js.map +1 -0
  61. package/dist/app/screen.js +1 -1
  62. package/dist/app/screen.js.map +1 -1
  63. package/dist/asset/model.js +10 -6
  64. package/dist/asset/model.js.map +1 -1
  65. package/dist/camera/perspectivecamera.js +3 -3
  66. package/dist/camera/perspectivecamera.js.map +1 -1
  67. package/dist/index.d.ts +1400 -4
  68. package/dist/index.js +16 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/material/mixins/lightmodel/blinnphong.js +66 -4
  71. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  72. package/dist/material/mixins/pbr/common.js +20 -17
  73. package/dist/material/mixins/pbr/common.js.map +1 -1
  74. package/dist/material/shader/helper.js +5 -3
  75. package/dist/material/shader/helper.js.map +1 -1
  76. package/dist/render/gpu_picking.js +100 -0
  77. package/dist/render/gpu_picking.js.map +1 -0
  78. package/dist/render/rendergraph/device_pool_allocator.js +41 -0
  79. package/dist/render/rendergraph/device_pool_allocator.js.map +1 -0
  80. package/dist/render/rendergraph/executor.js +146 -0
  81. package/dist/render/rendergraph/executor.js.map +1 -0
  82. package/dist/render/rendergraph/forward_plus_builder.js +414 -0
  83. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -0
  84. package/dist/render/rendergraph/rendergraph.js +306 -0
  85. package/dist/render/rendergraph/rendergraph.js.map +1 -0
  86. package/dist/render/rendergraph/types.js +57 -0
  87. package/dist/render/rendergraph/types.js.map +1 -0
  88. package/dist/render/sky_motion_vector.js +85 -0
  89. package/dist/render/sky_motion_vector.js.map +1 -0
  90. package/dist/scene/mesh.js +15 -23
  91. package/dist/scene/mesh.js.map +1 -1
  92. package/dist/utility/serialization/scene/animation.js +24 -23
  93. package/dist/utility/serialization/scene/animation.js.map +1 -1
  94. package/dist/utility/serialization/scene/material.js +62 -0
  95. package/dist/utility/serialization/scene/material.js.map +1 -1
  96. package/dist/utility/serialization/scene/node.js +1 -1
  97. package/package.json +3 -3
  98. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
  99. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
  100. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
  101. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
  102. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
  103. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
  104. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
  105. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
  106. package/dist/src/animation/animation.js +0 -127
  107. package/dist/src/animation/animation.js.map +0 -1
  108. package/dist/src/animation/animationset.js +0 -255
  109. package/dist/src/animation/animationset.js.map +0 -1
  110. package/dist/src/animation/animationtrack.js +0 -34
  111. package/dist/src/animation/animationtrack.js.map +0 -1
  112. package/dist/src/animation/eulerrotationtrack.js +0 -52
  113. package/dist/src/animation/eulerrotationtrack.js.map +0 -1
  114. package/dist/src/animation/morphtarget.js +0 -93
  115. package/dist/src/animation/morphtarget.js.map +0 -1
  116. package/dist/src/animation/morphtrack.js +0 -70
  117. package/dist/src/animation/morphtrack.js.map +0 -1
  118. package/dist/src/animation/proptrack.js +0 -161
  119. package/dist/src/animation/proptrack.js.map +0 -1
  120. package/dist/src/animation/rotationtrack.js +0 -51
  121. package/dist/src/animation/rotationtrack.js.map +0 -1
  122. package/dist/src/animation/scaletrack.js +0 -50
  123. package/dist/src/animation/scaletrack.js.map +0 -1
  124. package/dist/src/animation/skeleton.js +0 -204
  125. package/dist/src/animation/skeleton.js.map +0 -1
  126. package/dist/src/animation/translationtrack.js +0 -50
  127. package/dist/src/animation/translationtrack.js.map +0 -1
  128. package/dist/src/app/app.js +0 -129
  129. package/dist/src/app/app.js.map +0 -1
  130. package/dist/src/app/inputmgr.js +0 -267
  131. package/dist/src/app/inputmgr.js.map +0 -1
  132. package/dist/src/asset/assetmanager.js +0 -404
  133. package/dist/src/asset/assetmanager.js.map +0 -1
  134. package/dist/src/asset/builtin.js +0 -337
  135. package/dist/src/asset/builtin.js.map +0 -1
  136. package/dist/src/asset/loaders/dds/dds.js +0 -470
  137. package/dist/src/asset/loaders/dds/dds.js.map +0 -1
  138. package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
  139. package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
  140. package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
  141. package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
  142. package/dist/src/asset/loaders/gltf/helpers.js +0 -327
  143. package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
  144. package/dist/src/asset/loaders/hdr/hdr.js +0 -180
  145. package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
  146. package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
  147. package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
  148. package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
  149. package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
  150. package/dist/src/asset/loaders/loader.js +0 -45
  151. package/dist/src/asset/loaders/loader.js.map +0 -1
  152. package/dist/src/asset/model.js +0 -414
  153. package/dist/src/asset/model.js.map +0 -1
  154. package/dist/src/blitter/bilateralblur.js +0 -221
  155. package/dist/src/blitter/bilateralblur.js.map +0 -1
  156. package/dist/src/blitter/blitter.js +0 -390
  157. package/dist/src/blitter/blitter.js.map +0 -1
  158. package/dist/src/blitter/box.js +0 -118
  159. package/dist/src/blitter/box.js.map +0 -1
  160. package/dist/src/blitter/copy.js +0 -22
  161. package/dist/src/blitter/copy.js.map +0 -1
  162. package/dist/src/blitter/gaussianblur.js +0 -228
  163. package/dist/src/blitter/gaussianblur.js.map +0 -1
  164. package/dist/src/camera/base.js +0 -92
  165. package/dist/src/camera/base.js.map +0 -1
  166. package/dist/src/camera/camera.js +0 -1005
  167. package/dist/src/camera/camera.js.map +0 -1
  168. package/dist/src/camera/fps.js +0 -238
  169. package/dist/src/camera/fps.js.map +0 -1
  170. package/dist/src/camera/orbit.js +0 -245
  171. package/dist/src/camera/orbit.js.map +0 -1
  172. package/dist/src/camera/orthocamera.js +0 -167
  173. package/dist/src/camera/orthocamera.js.map +0 -1
  174. package/dist/src/camera/perspectivecamera.js +0 -141
  175. package/dist/src/camera/perspectivecamera.js.map +0 -1
  176. package/dist/src/index.js +0 -120
  177. package/dist/src/index.js.map +0 -1
  178. package/dist/src/material/blinn.js +0 -81
  179. package/dist/src/material/blinn.js.map +0 -1
  180. package/dist/src/material/grassmaterial.js +0 -113
  181. package/dist/src/material/grassmaterial.js.map +0 -1
  182. package/dist/src/material/lambert.js +0 -92
  183. package/dist/src/material/lambert.js.map +0 -1
  184. package/dist/src/material/material.js +0 -301
  185. package/dist/src/material/material.js.map +0 -1
  186. package/dist/src/material/meshmaterial.js +0 -704
  187. package/dist/src/material/meshmaterial.js.map +0 -1
  188. package/dist/src/material/mixins/albedocolor.js +0 -76
  189. package/dist/src/material/mixins/albedocolor.js.map +0 -1
  190. package/dist/src/material/mixins/foliage.js +0 -47
  191. package/dist/src/material/mixins/foliage.js.map +0 -1
  192. package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
  193. package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
  194. package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
  195. package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
  196. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
  197. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
  198. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
  199. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
  200. package/dist/src/material/mixins/lit.js +0 -476
  201. package/dist/src/material/mixins/lit.js.map +0 -1
  202. package/dist/src/material/mixins/pbr/common.js +0 -918
  203. package/dist/src/material/mixins/pbr/common.js.map +0 -1
  204. package/dist/src/material/mixins/texture.js +0 -172
  205. package/dist/src/material/mixins/texture.js.map +0 -1
  206. package/dist/src/material/mixins/vertexcolor.js +0 -56
  207. package/dist/src/material/mixins/vertexcolor.js.map +0 -1
  208. package/dist/src/material/particle.js +0 -178
  209. package/dist/src/material/particle.js.map +0 -1
  210. package/dist/src/material/pbrmr.js +0 -97
  211. package/dist/src/material/pbrmr.js.map +0 -1
  212. package/dist/src/material/pbrsg.js +0 -97
  213. package/dist/src/material/pbrsg.js.map +0 -1
  214. package/dist/src/material/shader/helper.js +0 -1209
  215. package/dist/src/material/shader/helper.js.map +0 -1
  216. package/dist/src/material/terrain-cm.js +0 -606
  217. package/dist/src/material/terrain-cm.js.map +0 -1
  218. package/dist/src/material/terrainmaterial.js +0 -375
  219. package/dist/src/material/terrainmaterial.js.map +0 -1
  220. package/dist/src/material/unlit.js +0 -41
  221. package/dist/src/material/unlit.js.map +0 -1
  222. package/dist/src/material/water.js +0 -417
  223. package/dist/src/material/water.js.map +0 -1
  224. package/dist/src/posteffect/bloom.js +0 -361
  225. package/dist/src/posteffect/bloom.js.map +0 -1
  226. package/dist/src/posteffect/compositor.js +0 -226
  227. package/dist/src/posteffect/compositor.js.map +0 -1
  228. package/dist/src/posteffect/fxaa.js +0 -273
  229. package/dist/src/posteffect/fxaa.js.map +0 -1
  230. package/dist/src/posteffect/grayscale.js +0 -69
  231. package/dist/src/posteffect/grayscale.js.map +0 -1
  232. package/dist/src/posteffect/motionblur.js +0 -96
  233. package/dist/src/posteffect/motionblur.js.map +0 -1
  234. package/dist/src/posteffect/posteffect.js +0 -126
  235. package/dist/src/posteffect/posteffect.js.map +0 -1
  236. package/dist/src/posteffect/sao.js +0 -324
  237. package/dist/src/posteffect/sao.js.map +0 -1
  238. package/dist/src/posteffect/ssr.js +0 -489
  239. package/dist/src/posteffect/ssr.js.map +0 -1
  240. package/dist/src/posteffect/taa.js +0 -172
  241. package/dist/src/posteffect/taa.js.map +0 -1
  242. package/dist/src/posteffect/tonemap.js +0 -94
  243. package/dist/src/posteffect/tonemap.js.map +0 -1
  244. package/dist/src/render/abuffer_oit.js +0 -361
  245. package/dist/src/render/abuffer_oit.js.map +0 -1
  246. package/dist/src/render/clipmap.js +0 -851
  247. package/dist/src/render/clipmap.js.map +0 -1
  248. package/dist/src/render/cluster_light.js +0 -333
  249. package/dist/src/render/cluster_light.js.map +0 -1
  250. package/dist/src/render/cull_visitor.js +0 -187
  251. package/dist/src/render/cull_visitor.js.map +0 -1
  252. package/dist/src/render/depthpass.js +0 -68
  253. package/dist/src/render/depthpass.js.map +0 -1
  254. package/dist/src/render/drawable_mixin.js +0 -227
  255. package/dist/src/render/drawable_mixin.js.map +0 -1
  256. package/dist/src/render/envlight.js +0 -463
  257. package/dist/src/render/envlight.js.map +0 -1
  258. package/dist/src/render/fbm_wavegenerator.js +0 -251
  259. package/dist/src/render/fbm_wavegenerator.js.map +0 -1
  260. package/dist/src/render/fft_wavegenerator.js +0 -1006
  261. package/dist/src/render/fft_wavegenerator.js.map +0 -1
  262. package/dist/src/render/fullscreenquad.js +0 -38
  263. package/dist/src/render/fullscreenquad.js.map +0 -1
  264. package/dist/src/render/gerstner_wavegenerator.js +0 -314
  265. package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
  266. package/dist/src/render/globalbindgroup_allocator.js +0 -60
  267. package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
  268. package/dist/src/render/hzb.js +0 -273
  269. package/dist/src/render/hzb.js.map +0 -1
  270. package/dist/src/render/lightpass.js +0 -172
  271. package/dist/src/render/lightpass.js.map +0 -1
  272. package/dist/src/render/objectcolorpass.js +0 -51
  273. package/dist/src/render/objectcolorpass.js.map +0 -1
  274. package/dist/src/render/primitive.js +0 -364
  275. package/dist/src/render/primitive.js.map +0 -1
  276. package/dist/src/render/render_queue.js +0 -467
  277. package/dist/src/render/render_queue.js.map +0 -1
  278. package/dist/src/render/renderbundle_wrapper.js +0 -152
  279. package/dist/src/render/renderbundle_wrapper.js.map +0 -1
  280. package/dist/src/render/renderer.js +0 -455
  281. package/dist/src/render/renderer.js.map +0 -1
  282. package/dist/src/render/renderpass.js +0 -200
  283. package/dist/src/render/renderpass.js.map +0 -1
  284. package/dist/src/render/shadowmap_pass.js +0 -56
  285. package/dist/src/render/shadowmap_pass.js.map +0 -1
  286. package/dist/src/render/sky.js +0 -1103
  287. package/dist/src/render/sky.js.map +0 -1
  288. package/dist/src/render/weightedblended_oit.js +0 -168
  289. package/dist/src/render/weightedblended_oit.js.map +0 -1
  290. package/dist/src/scene/batchgroup.js +0 -162
  291. package/dist/src/scene/batchgroup.js.map +0 -1
  292. package/dist/src/scene/environment.js +0 -209
  293. package/dist/src/scene/environment.js.map +0 -1
  294. package/dist/src/scene/graph_node.js +0 -72
  295. package/dist/src/scene/graph_node.js.map +0 -1
  296. package/dist/src/scene/light.js +0 -416
  297. package/dist/src/scene/light.js.map +0 -1
  298. package/dist/src/scene/mesh.js +0 -341
  299. package/dist/src/scene/mesh.js.map +0 -1
  300. package/dist/src/scene/octree.js +0 -649
  301. package/dist/src/scene/octree.js.map +0 -1
  302. package/dist/src/scene/particlesys.js +0 -738
  303. package/dist/src/scene/particlesys.js.map +0 -1
  304. package/dist/src/scene/raycast_visitor.js +0 -103
  305. package/dist/src/scene/raycast_visitor.js.map +0 -1
  306. package/dist/src/scene/scene.js +0 -284
  307. package/dist/src/scene/scene.js.map +0 -1
  308. package/dist/src/scene/scene_node.js +0 -732
  309. package/dist/src/scene/scene_node.js.map +0 -1
  310. package/dist/src/scene/terrain/grass.js +0 -278
  311. package/dist/src/scene/terrain/grass.js.map +0 -1
  312. package/dist/src/scene/terrain/heightfield.js +0 -475
  313. package/dist/src/scene/terrain/heightfield.js.map +0 -1
  314. package/dist/src/scene/terrain/patch.js +0 -530
  315. package/dist/src/scene/terrain/patch.js.map +0 -1
  316. package/dist/src/scene/terrain/quadtree.js +0 -461
  317. package/dist/src/scene/terrain/quadtree.js.map +0 -1
  318. package/dist/src/scene/terrain/terrain.js +0 -246
  319. package/dist/src/scene/terrain/terrain.js.map +0 -1
  320. package/dist/src/scene/terrain-cm/grass.js +0 -594
  321. package/dist/src/scene/terrain-cm/grass.js.map +0 -1
  322. package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
  323. package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
  324. package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
  325. package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
  326. package/dist/src/scene/water.js +0 -374
  327. package/dist/src/scene/water.js.map +0 -1
  328. package/dist/src/shaders/atmosphere.js +0 -957
  329. package/dist/src/shaders/atmosphere.js.map +0 -1
  330. package/dist/src/shaders/fog.js +0 -112
  331. package/dist/src/shaders/fog.js.map +0 -1
  332. package/dist/src/shaders/misc.js +0 -266
  333. package/dist/src/shaders/misc.js.map +0 -1
  334. package/dist/src/shaders/noise.js +0 -222
  335. package/dist/src/shaders/noise.js.map +0 -1
  336. package/dist/src/shaders/pbr.js +0 -51
  337. package/dist/src/shaders/pbr.js.map +0 -1
  338. package/dist/src/shaders/shadow.js +0 -636
  339. package/dist/src/shaders/shadow.js.map +0 -1
  340. package/dist/src/shaders/ssr.js +0 -490
  341. package/dist/src/shaders/ssr.js.map +0 -1
  342. package/dist/src/shaders/temporal.js +0 -215
  343. package/dist/src/shaders/temporal.js.map +0 -1
  344. package/dist/src/shaders/water.js +0 -756
  345. package/dist/src/shaders/water.js.map +0 -1
  346. package/dist/src/shadow/esm.js +0 -237
  347. package/dist/src/shadow/esm.js.map +0 -1
  348. package/dist/src/shadow/pcf_opt.js +0 -181
  349. package/dist/src/shadow/pcf_opt.js.map +0 -1
  350. package/dist/src/shadow/pcf_pd.js +0 -189
  351. package/dist/src/shadow/pcf_pd.js.map +0 -1
  352. package/dist/src/shadow/shader.js +0 -37
  353. package/dist/src/shadow/shader.js.map +0 -1
  354. package/dist/src/shadow/shadow_impl.js +0 -15
  355. package/dist/src/shadow/shadow_impl.js.map +0 -1
  356. package/dist/src/shadow/shadowmapper.js +0 -790
  357. package/dist/src/shadow/shadowmapper.js.map +0 -1
  358. package/dist/src/shadow/ssm.js +0 -159
  359. package/dist/src/shadow/ssm.js.map +0 -1
  360. package/dist/src/shadow/vsm.js +0 -297
  361. package/dist/src/shadow/vsm.js.map +0 -1
  362. package/dist/src/shapes/box.js +0 -386
  363. package/dist/src/shapes/box.js.map +0 -1
  364. package/dist/src/shapes/cylinder.js +0 -125
  365. package/dist/src/shapes/cylinder.js.map +0 -1
  366. package/dist/src/shapes/plane.js +0 -88
  367. package/dist/src/shapes/plane.js.map +0 -1
  368. package/dist/src/shapes/shape.js +0 -87
  369. package/dist/src/shapes/shape.js.map +0 -1
  370. package/dist/src/shapes/sphere.js +0 -114
  371. package/dist/src/shapes/sphere.js.map +0 -1
  372. package/dist/src/shapes/tetrahedron.js +0 -188
  373. package/dist/src/shapes/tetrahedron.js.map +0 -1
  374. package/dist/src/shapes/torus.js +0 -111
  375. package/dist/src/shapes/torus.js.map +0 -1
  376. package/dist/src/utility/aabbtree.js +0 -400
  377. package/dist/src/utility/aabbtree.js.map +0 -1
  378. package/dist/src/utility/bounding_volume.js +0 -29
  379. package/dist/src/utility/bounding_volume.js.map +0 -1
  380. package/dist/src/utility/debug.js +0 -28
  381. package/dist/src/utility/debug.js.map +0 -1
  382. package/dist/src/utility/draco/decoder.js +0 -116
  383. package/dist/src/utility/draco/decoder.js.map +0 -1
  384. package/dist/src/utility/misc.js +0 -105
  385. package/dist/src/utility/misc.js.map +0 -1
  386. package/dist/src/utility/panorama.js +0 -163
  387. package/dist/src/utility/panorama.js.map +0 -1
  388. package/dist/src/utility/pmrem.js +0 -354
  389. package/dist/src/utility/pmrem.js.map +0 -1
  390. package/dist/src/utility/rendermipmap.js +0 -115
  391. package/dist/src/utility/rendermipmap.js.map +0 -1
  392. package/dist/src/utility/serialization/json.js +0 -402
  393. package/dist/src/utility/serialization/json.js.map +0 -1
  394. package/dist/src/utility/serialization/manager.js +0 -623
  395. package/dist/src/utility/serialization/manager.js.map +0 -1
  396. package/dist/src/utility/serialization/scene/animation.js +0 -248
  397. package/dist/src/utility/serialization/scene/animation.js.map +0 -1
  398. package/dist/src/utility/serialization/scene/batch.js +0 -59
  399. package/dist/src/utility/serialization/scene/batch.js.map +0 -1
  400. package/dist/src/utility/serialization/scene/camera.js +0 -790
  401. package/dist/src/utility/serialization/scene/camera.js.map +0 -1
  402. package/dist/src/utility/serialization/scene/common.js +0 -222
  403. package/dist/src/utility/serialization/scene/common.js.map +0 -1
  404. package/dist/src/utility/serialization/scene/light.js +0 -575
  405. package/dist/src/utility/serialization/scene/light.js.map +0 -1
  406. package/dist/src/utility/serialization/scene/material.js +0 -1111
  407. package/dist/src/utility/serialization/scene/material.js.map +0 -1
  408. package/dist/src/utility/serialization/scene/mesh.js +0 -148
  409. package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
  410. package/dist/src/utility/serialization/scene/misc.js +0 -39
  411. package/dist/src/utility/serialization/scene/misc.js.map +0 -1
  412. package/dist/src/utility/serialization/scene/node.js +0 -451
  413. package/dist/src/utility/serialization/scene/node.js.map +0 -1
  414. package/dist/src/utility/serialization/scene/particle.js +0 -425
  415. package/dist/src/utility/serialization/scene/particle.js.map +0 -1
  416. package/dist/src/utility/serialization/scene/primitive.js +0 -692
  417. package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
  418. package/dist/src/utility/serialization/scene/scene.js +0 -704
  419. package/dist/src/utility/serialization/scene/scene.js.map +0 -1
  420. package/dist/src/utility/serialization/scene/terrain.js +0 -488
  421. package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
  422. package/dist/src/utility/serialization/scene/water.js +0 -465
  423. package/dist/src/utility/serialization/scene/water.js.map +0 -1
  424. package/dist/src/utility/shprojector.js +0 -297
  425. package/dist/src/utility/shprojector.js.map +0 -1
  426. package/dist/src/utility/textures/ggxlut.js +0 -213
  427. package/dist/src/utility/textures/ggxlut.js.map +0 -1
  428. package/dist/src/utility/textures/gradientnoise.js +0 -62
  429. package/dist/src/utility/textures/gradientnoise.js.map +0 -1
  430. package/dist/src/utility/textures/randomnoise.js +0 -41
  431. package/dist/src/utility/textures/randomnoise.js.map +0 -1
  432. package/dist/src/values.js +0 -162
  433. package/dist/src/values.js.map +0 -1
  434. package/dist/utility/blueprint/material/common.js +0 -7
  435. package/dist/utility/blueprint/material/common.js.map +0 -1
  436. package/dist/utility/serialization/blueprint/constants.js +0 -255
  437. package/dist/utility/serialization/blueprint/constants.js.map +0 -1
  438. package/dist/utility/serialization/blueprint/material/constants.js +0 -203
  439. package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
  440. package/dist/utility/serialization/blueprint/material/texture.js +0 -165
  441. package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
@@ -1,337 +0,0 @@
1
- import { Vector3, Vector2 } from '@zephyr3d/base';
2
- import { BUILTIN_ASSET_TEXTURE_SHEEN_LUT } from '../values.js';
3
- import { Application } from '../app/app.js';
4
-
5
- /** @internal */ function getSheenLutLoader(textureSize) {
6
- const bits = new Uint32Array(1);
7
- //Van der Corput radical inverse
8
- function radicalInverse_VdC(i) {
9
- bits[0] = i;
10
- bits[0] = (bits[0] << 16 | bits[0] >> 16) >>> 0;
11
- bits[0] = (bits[0] & 0x55555555) << 1 | (bits[0] & 0xaaaaaaaa) >>> 1 >>> 0;
12
- bits[0] = (bits[0] & 0x33333333) << 2 | (bits[0] & 0xcccccccc) >>> 2 >>> 0;
13
- bits[0] = (bits[0] & 0x0f0f0f0f) << 4 | (bits[0] & 0xf0f0f0f0) >>> 4 >>> 0;
14
- bits[0] = (bits[0] & 0x00ff00ff) << 8 | (bits[0] & 0xff00ff00) >>> 8 >>> 0;
15
- return bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296
16
- }
17
- function hammersley(i, iN, out) {
18
- out.setXY(i * iN, radicalInverse_VdC(i));
19
- }
20
- /*
21
- function hammersley(i: number, iN: number, out: Vector2) {
22
- const tof = 0.5 / 0x80000000;
23
- let bits = i;
24
- bits = (bits << 16) | (bits >>> 16);
25
- bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >>> 1);
26
- bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >>> 2);
27
- bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >>> 4);
28
- bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >>> 8);
29
- out.setXY(i * iN, (bits >>> 0) * tof);
30
- }
31
- */ /*
32
- function generateTBN(normal: Vector3, out: Matrix3x3) {
33
- bitangent.setXYZ(0.0, 1.0, 0.0);
34
- const NdotUp = Vector3.dot(normal, up);
35
- const epsilon = 0.0000001;
36
- if (1.0 - Math.abs(NdotUp) <= epsilon) {
37
- // Sampling +Y or -Y, so we need a more robust bitangent.
38
- if (NdotUp > 0.0) {
39
- bitangent.setXYZ(0.0, 0.0, 1.0);
40
- } else {
41
- bitangent.setXYZ(0.0, 0.0, -1.0);
42
- }
43
- }
44
- Vector3.cross(bitangent, normal, tangent).inplaceNormalize();
45
- Vector3.cross(normal, tangent, bitangent);
46
- out.setCol(0, tangent);
47
- out.setCol(1, bitangent);
48
- out.setCol(2, normal);
49
- }
50
- function mix(x: number, y: number, a: number): number {
51
- return x * (1 - a) + y * a;
52
- }
53
- function l(x: number, alphaG: number): number {
54
- const oneMinusAlphaSq = (1 - alphaG) * (1 - alphaG);
55
- const a = mix(21.5473, 25.3245, oneMinusAlphaSq);
56
- const b = mix(3.82987, 3.32435, oneMinusAlphaSq);
57
- const c = mix(0.19823, 0.16801, oneMinusAlphaSq);
58
- const d = mix(-1.9776, -1.27393, oneMinusAlphaSq);
59
- const e = mix(-4.32054, -4.85967, oneMinusAlphaSq);
60
- return a / (1 + b * Math.pow(x, c)) + d * x + e;
61
- }
62
- function lambdaSheen(cosTheta: number, alphaG: number): number {
63
- return Math.abs(cosTheta) < 0.5
64
- ? Math.exp(l(Math.abs(cosTheta), alphaG))
65
- : Math.exp(2 * l(0.5, alphaG) - l(1 - Math.abs(cosTheta), alphaG));
66
- }
67
- function visibilityCharlie(NdotV: number, NdotL: number, a: number): number {
68
- const alphaG = a;
69
- return 1 / ((1 + lambdaSheen(NdotV, alphaG) + lambdaSheen(NdotL, alphaG)) * (4 * NdotV * NdotL));
70
- }
71
- */ function distributionCharlie(NdotH, roughness) {
72
- // roughness = Math.max(roughness, 0.000001);
73
- const invAlpha = 1 / roughness;
74
- const cos2h = NdotH * NdotH;
75
- const sin2h = 1 - cos2h;
76
- return (2 + invAlpha) * Math.pow(sin2h, invAlpha * 0.5) / (2 * Math.PI);
77
- }
78
- /*
79
- function charlie(xi: Vector2, roughness: number, sample: MicrofacetDistributionSample) {
80
- const alpha = roughness * roughness;
81
- sample.sinTheta = Math.pow(xi.y, alpha / (2 * alpha + 1));
82
- sample.cosTheta = Math.sqrt(1 - sample.sinTheta * sample.sinTheta);
83
- sample.phi = 2 * Math.PI * xi.x;
84
- sample.pdf = distributionCharlie(sample.cosTheta, Math.max(alpha, 0.000001)) / 4;
85
- }
86
- function getImportanceSample(
87
- sampleIndex: number,
88
- sampleCount: number,
89
- N: Vector3,
90
- roughness: number,
91
- out: Vector4
92
- ) {
93
- // generate a quasi monte carlo point in the unit square [0.1)^2
94
- hammersley(sampleIndex, 1 / sampleCount, xi);
95
- // generate the points on the hemisphere with a fitting mapping for
96
- // the distribution (e.g. lambertian uses a cosine importance)
97
- charlie(xi, roughness, importanceSample);
98
-
99
- // transform the hemisphere sample to the normal coordinate frame
100
- // i.e. rotate the hemisphere to the normal direction
101
- localSpaceDirection
102
- .setXYZ(
103
- importanceSample.sinTheta * Math.cos(importanceSample.phi),
104
- importanceSample.sinTheta * Math.sin(importanceSample.phi),
105
- importanceSample.cosTheta
106
- )
107
- .inplaceNormalize();
108
- generateTBN(N, TBN);
109
- TBN.transform(localSpaceDirection, direction);
110
- out.setXYZW(direction.x, direction.y, direction.z, importanceSample.pdf);
111
- }
112
- function lut(NdotV: number, roughness: number, numSamples: number, out: Vector4) {
113
- V.setXYZ(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);
114
- N.setXYZ(0, 0, 1);
115
- const A = 0;
116
- const B = 0;
117
- let C = 0;
118
- const importanceSample = new Vector4();
119
- for (let i = 0; i < numSamples; i++) {
120
- getImportanceSample(i, numSamples, N, roughness, importanceSample);
121
- H.setXYZ(importanceSample.x, importanceSample.y, importanceSample.z);
122
- // do reflect L = normalize(reflect(-V, H)) = normalize(-V - 2.0 * dot(H, -V) * H) = normalize(2 * dot(H, V) * H - V)
123
- Vector3.scale(H, Vector3.dot(V, H) * 2, L)
124
- .subBy(V)
125
- .inplaceNormalize();
126
- const NdotL = Math.min(Math.max(L.z, 0), 1);
127
- const NdotH = Math.min(Math.max(H.z, 0), 1);
128
- const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);
129
- if (NdotL > 0) {
130
- const sheenDistribution = distributionCharlie(NdotH, roughness);
131
- // const sheenVisibility = visibilityAshikhmin(NdotV, NdotL);
132
- const sheenVisibility = visibilityCharlie(NdotV, NdotL, roughness);
133
- C += sheenVisibility * sheenDistribution * NdotL * VdotH;
134
- }
135
- }
136
- out.setXYZW(4 * A, 4 * B, 4 * 2 * Math.PI * C, 0).scaleBy(1 / numSamples);
137
- }
138
-
139
- async function createSheenLUT(): Promise<Texture2D> {
140
- const tex = Application.instance.device.createTexture2D('rgba8unorm', textureSize, textureSize);
141
- const image = new Uint8Array(textureSize * textureSize * 4);
142
- let p = 0;
143
- const c = new Vector4();
144
- for (let y = 0; y < textureSize; y++) {
145
- const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);
146
- const roughness = coord;
147
- for (let x = 0; x < textureSize; x++) {
148
- const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);
149
- // const c = dfvCharlieUniform(NdotV, roughness, 1024);
150
- // const c = Math.min(Math.max(Math.round(t * 255), 0), 255);
151
- lut(NdotV, roughness, 1024, c);
152
- image[p++] = Math.min(Math.max(Math.round(c.x * 255), 0), 255);
153
- image[p++] = Math.min(Math.max(Math.round(c.y * 255), 0), 255);
154
- image[p++] = Math.min(Math.max(Math.round(c.z * 255), 0), 255);
155
- image[p++] = 255;
156
- }
157
- }
158
- tex.update(image, 0, 0, textureSize, textureSize);
159
- tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;
160
- return tex;
161
- }
162
- */ //////////////////////////////////////////////////////////////////////////////////////////////////////
163
- function visibilityAshikhmin(NdotV, NdotL) {
164
- return Math.min(Math.max(1 / (4 * (NdotL + NdotV - NdotL * NdotV)), 0), 1);
165
- }
166
- function hemisphereUniformSample(u, out) {
167
- const phi = 2 * Math.PI * u.x;
168
- const cosTheta = 1 - u.y;
169
- const sinTheta = Math.sqrt(1 - cosTheta * cosTheta);
170
- out.setXYZ(sinTheta * Math.cos(phi), sinTheta * Math.sin(phi), cosTheta);
171
- }
172
- function dfvCharlieUniform(NdotV, roughness, numSamples) {
173
- let r = 0;
174
- const V = new Vector3(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);
175
- const u = new Vector2();
176
- const H = new Vector3();
177
- const L = new Vector3();
178
- for(let i = 0; i < numSamples; i++){
179
- hammersley(i, 1 / numSamples, u);
180
- hemisphereUniformSample(u, H);
181
- Vector3.scale(H, Vector3.dot(V, H) * 2, L).subBy(V);
182
- const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);
183
- const NdotL = Math.min(Math.max(L.z, 0), 1);
184
- const NdotH = Math.min(Math.max(H.z, 0), 1);
185
- if (NdotL > 0) {
186
- const v = visibilityAshikhmin(NdotV, NdotL);
187
- // const v = visibilityCharlie(NdotV, NdotL, roughness);
188
- const d = distributionCharlie(NdotH, roughness);
189
- r += v * d * NdotL * VdotH;
190
- }
191
- }
192
- return r * (4 * 2 * Math.PI / numSamples);
193
- }
194
- const _tables = function _generateTables() {
195
- // float32 to float16 helpers
196
- const buffer = new ArrayBuffer(4);
197
- const floatView = new Float32Array(buffer);
198
- const uint32View = new Uint32Array(buffer);
199
- const baseTable = new Uint32Array(512);
200
- const shiftTable = new Uint32Array(512);
201
- for(let i = 0; i < 256; ++i){
202
- const e = i - 127;
203
- // very small number (0, -0)
204
- if (e < -27) {
205
- baseTable[i] = 0x0000;
206
- baseTable[i | 0x100] = 0x8000;
207
- shiftTable[i] = 24;
208
- shiftTable[i | 0x100] = 24;
209
- // small number (denorm)
210
- } else if (e < -14) {
211
- baseTable[i] = 0x0400 >> -e - 14;
212
- baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
213
- shiftTable[i] = -e - 1;
214
- shiftTable[i | 0x100] = -e - 1;
215
- // normal number
216
- } else if (e <= 15) {
217
- baseTable[i] = e + 15 << 10;
218
- baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
219
- shiftTable[i] = 13;
220
- shiftTable[i | 0x100] = 13;
221
- // large number (Infinity, -Infinity)
222
- } else if (e < 128) {
223
- baseTable[i] = 0x7c00;
224
- baseTable[i | 0x100] = 0xfc00;
225
- shiftTable[i] = 24;
226
- shiftTable[i | 0x100] = 24;
227
- // stay (NaN, Infinity, -Infinity)
228
- } else {
229
- baseTable[i] = 0x7c00;
230
- baseTable[i | 0x100] = 0xfc00;
231
- shiftTable[i] = 13;
232
- shiftTable[i | 0x100] = 13;
233
- }
234
- }
235
- // float16 to float32 helpers
236
- const mantissaTable = new Uint32Array(2048);
237
- const exponentTable = new Uint32Array(64);
238
- const offsetTable = new Uint32Array(64);
239
- for(let i = 1; i < 1024; ++i){
240
- let m = i << 13; // zero pad mantissa bits
241
- let e = 0; // zero exponent
242
- // normalized
243
- while((m & 0x00800000) === 0){
244
- m <<= 1;
245
- e -= 0x00800000; // decrement exponent
246
- }
247
- m &= -8388609; // clear leading 1 bit
248
- e += 0x38800000; // adjust bias
249
- mantissaTable[i] = m | e;
250
- }
251
- for(let i = 1024; i < 2048; ++i){
252
- mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
253
- }
254
- for(let i = 1; i < 31; ++i){
255
- exponentTable[i] = i << 23;
256
- }
257
- exponentTable[31] = 0x47800000;
258
- exponentTable[32] = 0x80000000;
259
- for(let i = 33; i < 63; ++i){
260
- exponentTable[i] = 0x80000000 + (i - 32 << 23);
261
- }
262
- exponentTable[63] = 0xc7800000;
263
- for(let i = 1; i < 64; ++i){
264
- if (i !== 32) {
265
- offsetTable[i] = 1024;
266
- }
267
- }
268
- return {
269
- floatView: floatView,
270
- uint32View: uint32View,
271
- baseTable: baseTable,
272
- shiftTable: shiftTable,
273
- mantissaTable: mantissaTable,
274
- exponentTable: exponentTable,
275
- offsetTable: offsetTable
276
- };
277
- }();
278
- function encodeF16(val) {
279
- val = Math.min(Math.max(val, -65504), 65504);
280
- _tables.floatView[0] = val;
281
- const f = _tables.uint32View[0];
282
- const e = f >> 23 & 0x1ff;
283
- return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);
284
- }
285
- /*
286
- function decodeF16(val: number) {
287
- const exponent = (val & 0x7c00) >> 10;
288
- const fraction = val & 0x03ff;
289
- return (
290
- (val >> 15 ? -1 : 1) *
291
- (exponent
292
- ? exponent === 0x1f
293
- ? fraction
294
- ? NaN
295
- : Infinity
296
- : Math.pow(2, exponent - 15) * (1 + fraction / 0x400)
297
- : 6.103515625e-5 * (fraction / 0x400))
298
- );
299
- }
300
- */ function createSheenLUTFilament(assetManager, texture) {
301
- if (texture) {
302
- if (!texture.isTexture2D()) {
303
- throw new Error('can not reload sheen lut texture: invalid texture type');
304
- }
305
- if (texture.format !== 'rgba16f') {
306
- throw new Error('can not reload sheen lut texture: invalid texture format');
307
- }
308
- if (texture.width !== textureSize || texture.height !== textureSize) {
309
- throw new Error('can not reload sheen lut texture: invalid texture size');
310
- }
311
- }
312
- const tex = texture || Application.instance.device.createTexture2D('rgba16f', textureSize, textureSize);
313
- const image = new Uint16Array(textureSize * textureSize * 4);
314
- let p = 0;
315
- const one = encodeF16(1);
316
- for(let y = textureSize - 1; y >= 0; y--){
317
- const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);
318
- const roughness = coord * coord;
319
- for(let x = 0; x < textureSize; x++){
320
- const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);
321
- const c = dfvCharlieUniform(NdotV, roughness, 512);
322
- const f16 = encodeF16(c);
323
- image[p++] = 0;
324
- image[p++] = 0;
325
- image[p++] = f16;
326
- image[p++] = one;
327
- }
328
- }
329
- tex.update(image, 0, 0, textureSize, textureSize);
330
- tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;
331
- return tex;
332
- }
333
- return createSheenLUTFilament;
334
- }
335
-
336
- export { getSheenLutLoader };
337
- //# sourceMappingURL=builtin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builtin.js","sources":["../../../src/asset/builtin.ts"],"sourcesContent":["import { Vector2, Vector3, Vector4 } from '@zephyr3d/base';\r\nimport { BUILTIN_ASSET_TEXTURE_SHEEN_LUT } from '../values';\r\nimport type { Texture2D, BaseTexture, TextureCube } from '@zephyr3d/device';\r\nimport type { AssetManager } from './assetmanager';\r\nimport { Application } from '../app/app';\r\n\r\n/*\r\ninterface MicrofacetDistributionSample {\r\n pdf?: number;\r\n cosTheta?: number;\r\n sinTheta?: number;\r\n phi?: number;\r\n}\r\n*/\r\n/** @internal */\r\nexport function testCubemapLoader(): TextureCube {\r\n const tex = Application.instance.device.createCubeTexture('rgba8unorm', 32, {\r\n samplerOptions: { mipFilter: 'none' }\r\n });\r\n const fb = Application.instance.device.createFrameBuffer([tex], null);\r\n Application.instance.device.pushDeviceStates();\r\n Application.instance.device.setFramebuffer(fb);\r\n const colors = [\r\n new Vector4(1, 0, 0, 1),\r\n new Vector4(0.2, 0, 0, 1),\r\n new Vector4(0, 1, 0, 1),\r\n new Vector4(0, 0.2, 0, 1),\r\n new Vector4(0, 0, 1, 1),\r\n new Vector4(0, 0, 0.2, 1)\r\n ];\r\n for (let i = 0; i < 6; i++) {\r\n fb.setColorAttachmentCubeFace(0, i);\r\n Application.instance.device.clearFrameBuffer(colors[i], null, null);\r\n }\r\n Application.instance.device.popDeviceStates();\r\n fb.dispose();\r\n\r\n return tex;\r\n}\r\n\r\n/** @internal */\r\nexport function getSheenLutLoader(textureSize: number): (assetManager: AssetManager) => Texture2D {\r\n const bits = new Uint32Array(1);\r\n\r\n //Van der Corput radical inverse\r\n function radicalInverse_VdC(i: number) {\r\n bits[0] = i;\r\n bits[0] = ((bits[0] << 16) | (bits[0] >> 16)) >>> 0;\r\n bits[0] = ((bits[0] & 0x55555555) << 1) | (((bits[0] & 0xaaaaaaaa) >>> 1) >>> 0);\r\n bits[0] = ((bits[0] & 0x33333333) << 2) | (((bits[0] & 0xcccccccc) >>> 2) >>> 0);\r\n bits[0] = ((bits[0] & 0x0f0f0f0f) << 4) | (((bits[0] & 0xf0f0f0f0) >>> 4) >>> 0);\r\n bits[0] = ((bits[0] & 0x00ff00ff) << 8) | (((bits[0] & 0xff00ff00) >>> 8) >>> 0);\r\n return bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296\r\n }\r\n\r\n function hammersley(i: number, iN: number, out: Vector2) {\r\n out.setXY(i * iN, radicalInverse_VdC(i));\r\n }\r\n /*\r\n function hammersley(i: number, iN: number, out: Vector2) {\r\n const tof = 0.5 / 0x80000000;\r\n let bits = i;\r\n bits = (bits << 16) | (bits >>> 16);\r\n bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >>> 1);\r\n bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >>> 2);\r\n bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >>> 4);\r\n bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >>> 8);\r\n out.setXY(i * iN, (bits >>> 0) * tof);\r\n }\r\n */\r\n /*\r\n function generateTBN(normal: Vector3, out: Matrix3x3) {\r\n bitangent.setXYZ(0.0, 1.0, 0.0);\r\n const NdotUp = Vector3.dot(normal, up);\r\n const epsilon = 0.0000001;\r\n if (1.0 - Math.abs(NdotUp) <= epsilon) {\r\n // Sampling +Y or -Y, so we need a more robust bitangent.\r\n if (NdotUp > 0.0) {\r\n bitangent.setXYZ(0.0, 0.0, 1.0);\r\n } else {\r\n bitangent.setXYZ(0.0, 0.0, -1.0);\r\n }\r\n }\r\n Vector3.cross(bitangent, normal, tangent).inplaceNormalize();\r\n Vector3.cross(normal, tangent, bitangent);\r\n out.setCol(0, tangent);\r\n out.setCol(1, bitangent);\r\n out.setCol(2, normal);\r\n }\r\n function mix(x: number, y: number, a: number): number {\r\n return x * (1 - a) + y * a;\r\n }\r\n function l(x: number, alphaG: number): number {\r\n const oneMinusAlphaSq = (1 - alphaG) * (1 - alphaG);\r\n const a = mix(21.5473, 25.3245, oneMinusAlphaSq);\r\n const b = mix(3.82987, 3.32435, oneMinusAlphaSq);\r\n const c = mix(0.19823, 0.16801, oneMinusAlphaSq);\r\n const d = mix(-1.9776, -1.27393, oneMinusAlphaSq);\r\n const e = mix(-4.32054, -4.85967, oneMinusAlphaSq);\r\n return a / (1 + b * Math.pow(x, c)) + d * x + e;\r\n }\r\n function lambdaSheen(cosTheta: number, alphaG: number): number {\r\n return Math.abs(cosTheta) < 0.5\r\n ? Math.exp(l(Math.abs(cosTheta), alphaG))\r\n : Math.exp(2 * l(0.5, alphaG) - l(1 - Math.abs(cosTheta), alphaG));\r\n }\r\n function visibilityCharlie(NdotV: number, NdotL: number, a: number): number {\r\n const alphaG = a;\r\n return 1 / ((1 + lambdaSheen(NdotV, alphaG) + lambdaSheen(NdotL, alphaG)) * (4 * NdotV * NdotL));\r\n }\r\n */\r\n function distributionCharlie(NdotH: number, roughness: number) {\r\n // roughness = Math.max(roughness, 0.000001);\r\n const invAlpha = 1 / roughness;\r\n const cos2h = NdotH * NdotH;\r\n const sin2h = 1 - cos2h;\r\n return ((2 + invAlpha) * Math.pow(sin2h, invAlpha * 0.5)) / (2 * Math.PI);\r\n }\r\n /*\r\n function charlie(xi: Vector2, roughness: number, sample: MicrofacetDistributionSample) {\r\n const alpha = roughness * roughness;\r\n sample.sinTheta = Math.pow(xi.y, alpha / (2 * alpha + 1));\r\n sample.cosTheta = Math.sqrt(1 - sample.sinTheta * sample.sinTheta);\r\n sample.phi = 2 * Math.PI * xi.x;\r\n sample.pdf = distributionCharlie(sample.cosTheta, Math.max(alpha, 0.000001)) / 4;\r\n }\r\n function getImportanceSample(\r\n sampleIndex: number,\r\n sampleCount: number,\r\n N: Vector3,\r\n roughness: number,\r\n out: Vector4\r\n ) {\r\n // generate a quasi monte carlo point in the unit square [0.1)^2\r\n hammersley(sampleIndex, 1 / sampleCount, xi);\r\n // generate the points on the hemisphere with a fitting mapping for\r\n // the distribution (e.g. lambertian uses a cosine importance)\r\n charlie(xi, roughness, importanceSample);\r\n\r\n // transform the hemisphere sample to the normal coordinate frame\r\n // i.e. rotate the hemisphere to the normal direction\r\n localSpaceDirection\r\n .setXYZ(\r\n importanceSample.sinTheta * Math.cos(importanceSample.phi),\r\n importanceSample.sinTheta * Math.sin(importanceSample.phi),\r\n importanceSample.cosTheta\r\n )\r\n .inplaceNormalize();\r\n generateTBN(N, TBN);\r\n TBN.transform(localSpaceDirection, direction);\r\n out.setXYZW(direction.x, direction.y, direction.z, importanceSample.pdf);\r\n }\r\n function lut(NdotV: number, roughness: number, numSamples: number, out: Vector4) {\r\n V.setXYZ(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);\r\n N.setXYZ(0, 0, 1);\r\n const A = 0;\r\n const B = 0;\r\n let C = 0;\r\n const importanceSample = new Vector4();\r\n for (let i = 0; i < numSamples; i++) {\r\n getImportanceSample(i, numSamples, N, roughness, importanceSample);\r\n H.setXYZ(importanceSample.x, importanceSample.y, importanceSample.z);\r\n // do reflect L = normalize(reflect(-V, H)) = normalize(-V - 2.0 * dot(H, -V) * H) = normalize(2 * dot(H, V) * H - V)\r\n Vector3.scale(H, Vector3.dot(V, H) * 2, L)\r\n .subBy(V)\r\n .inplaceNormalize();\r\n const NdotL = Math.min(Math.max(L.z, 0), 1);\r\n const NdotH = Math.min(Math.max(H.z, 0), 1);\r\n const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);\r\n if (NdotL > 0) {\r\n const sheenDistribution = distributionCharlie(NdotH, roughness);\r\n // const sheenVisibility = visibilityAshikhmin(NdotV, NdotL);\r\n const sheenVisibility = visibilityCharlie(NdotV, NdotL, roughness);\r\n C += sheenVisibility * sheenDistribution * NdotL * VdotH;\r\n }\r\n }\r\n out.setXYZW(4 * A, 4 * B, 4 * 2 * Math.PI * C, 0).scaleBy(1 / numSamples);\r\n }\r\n\r\n async function createSheenLUT(): Promise<Texture2D> {\r\n const tex = Application.instance.device.createTexture2D('rgba8unorm', textureSize, textureSize);\r\n const image = new Uint8Array(textureSize * textureSize * 4);\r\n let p = 0;\r\n const c = new Vector4();\r\n for (let y = 0; y < textureSize; y++) {\r\n const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);\r\n const roughness = coord;\r\n for (let x = 0; x < textureSize; x++) {\r\n const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);\r\n // const c = dfvCharlieUniform(NdotV, roughness, 1024);\r\n // const c = Math.min(Math.max(Math.round(t * 255), 0), 255);\r\n lut(NdotV, roughness, 1024, c);\r\n image[p++] = Math.min(Math.max(Math.round(c.x * 255), 0), 255);\r\n image[p++] = Math.min(Math.max(Math.round(c.y * 255), 0), 255);\r\n image[p++] = Math.min(Math.max(Math.round(c.z * 255), 0), 255);\r\n image[p++] = 255;\r\n }\r\n }\r\n tex.update(image, 0, 0, textureSize, textureSize);\r\n tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;\r\n return tex;\r\n }\r\n */\r\n\r\n //////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\r\n function visibilityAshikhmin(NdotV: number, NdotL: number): number {\r\n return Math.min(Math.max(1 / (4 * (NdotL + NdotV - NdotL * NdotV)), 0), 1);\r\n }\r\n\r\n function hemisphereUniformSample(u: Vector2, out: Vector3) {\r\n const phi = 2 * Math.PI * u.x;\r\n const cosTheta = 1 - u.y;\r\n const sinTheta = Math.sqrt(1 - cosTheta * cosTheta);\r\n out.setXYZ(sinTheta * Math.cos(phi), sinTheta * Math.sin(phi), cosTheta);\r\n }\r\n\r\n function dfvCharlieUniform(NdotV: number, roughness: number, numSamples: number): number {\r\n let r = 0;\r\n const V = new Vector3(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);\r\n const u = new Vector2();\r\n const H = new Vector3();\r\n const L = new Vector3();\r\n for (let i = 0; i < numSamples; i++) {\r\n hammersley(i, 1 / numSamples, u);\r\n hemisphereUniformSample(u, H);\r\n Vector3.scale(H, Vector3.dot(V, H) * 2, L).subBy(V);\r\n const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);\r\n const NdotL = Math.min(Math.max(L.z, 0), 1);\r\n const NdotH = Math.min(Math.max(H.z, 0), 1);\r\n if (NdotL > 0) {\r\n const v = visibilityAshikhmin(NdotV, NdotL);\r\n // const v = visibilityCharlie(NdotV, NdotL, roughness);\r\n const d = distributionCharlie(NdotH, roughness);\r\n r += v * d * NdotL * VdotH;\r\n }\r\n }\r\n return r * ((4 * 2 * Math.PI) / numSamples);\r\n }\r\n\r\n const _tables = (function _generateTables() {\r\n // float32 to float16 helpers\r\n\r\n const buffer = new ArrayBuffer(4);\r\n const floatView = new Float32Array(buffer);\r\n const uint32View = new Uint32Array(buffer);\r\n\r\n const baseTable = new Uint32Array(512);\r\n const shiftTable = new Uint32Array(512);\r\n\r\n for (let i = 0; i < 256; ++i) {\r\n const e = i - 127;\r\n\r\n // very small number (0, -0)\r\n\r\n if (e < -27) {\r\n baseTable[i] = 0x0000;\r\n baseTable[i | 0x100] = 0x8000;\r\n shiftTable[i] = 24;\r\n shiftTable[i | 0x100] = 24;\r\n\r\n // small number (denorm)\r\n } else if (e < -14) {\r\n baseTable[i] = 0x0400 >> (-e - 14);\r\n baseTable[i | 0x100] = (0x0400 >> (-e - 14)) | 0x8000;\r\n shiftTable[i] = -e - 1;\r\n shiftTable[i | 0x100] = -e - 1;\r\n\r\n // normal number\r\n } else if (e <= 15) {\r\n baseTable[i] = (e + 15) << 10;\r\n baseTable[i | 0x100] = ((e + 15) << 10) | 0x8000;\r\n shiftTable[i] = 13;\r\n shiftTable[i | 0x100] = 13;\r\n\r\n // large number (Infinity, -Infinity)\r\n } else if (e < 128) {\r\n baseTable[i] = 0x7c00;\r\n baseTable[i | 0x100] = 0xfc00;\r\n shiftTable[i] = 24;\r\n shiftTable[i | 0x100] = 24;\r\n\r\n // stay (NaN, Infinity, -Infinity)\r\n } else {\r\n baseTable[i] = 0x7c00;\r\n baseTable[i | 0x100] = 0xfc00;\r\n shiftTable[i] = 13;\r\n shiftTable[i | 0x100] = 13;\r\n }\r\n }\r\n\r\n // float16 to float32 helpers\r\n\r\n const mantissaTable = new Uint32Array(2048);\r\n const exponentTable = new Uint32Array(64);\r\n const offsetTable = new Uint32Array(64);\r\n\r\n for (let i = 1; i < 1024; ++i) {\r\n let m = i << 13; // zero pad mantissa bits\r\n let e = 0; // zero exponent\r\n\r\n // normalized\r\n while ((m & 0x00800000) === 0) {\r\n m <<= 1;\r\n e -= 0x00800000; // decrement exponent\r\n }\r\n\r\n m &= ~0x00800000; // clear leading 1 bit\r\n e += 0x38800000; // adjust bias\r\n\r\n mantissaTable[i] = m | e;\r\n }\r\n\r\n for (let i = 1024; i < 2048; ++i) {\r\n mantissaTable[i] = 0x38000000 + ((i - 1024) << 13);\r\n }\r\n\r\n for (let i = 1; i < 31; ++i) {\r\n exponentTable[i] = i << 23;\r\n }\r\n\r\n exponentTable[31] = 0x47800000;\r\n exponentTable[32] = 0x80000000;\r\n\r\n for (let i = 33; i < 63; ++i) {\r\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\r\n }\r\n\r\n exponentTable[63] = 0xc7800000;\r\n\r\n for (let i = 1; i < 64; ++i) {\r\n if (i !== 32) {\r\n offsetTable[i] = 1024;\r\n }\r\n }\r\n\r\n return {\r\n floatView: floatView,\r\n uint32View: uint32View,\r\n baseTable: baseTable,\r\n shiftTable: shiftTable,\r\n mantissaTable: mantissaTable,\r\n exponentTable: exponentTable,\r\n offsetTable: offsetTable\r\n };\r\n })();\r\n\r\n function encodeF16(val: number): number {\r\n val = Math.min(Math.max(val, -65504), 65504);\r\n _tables.floatView[0] = val;\r\n const f = _tables.uint32View[0];\r\n const e = (f >> 23) & 0x1ff;\r\n return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);\r\n }\r\n\r\n /*\r\n function decodeF16(val: number) {\r\n const exponent = (val & 0x7c00) >> 10;\r\n const fraction = val & 0x03ff;\r\n return (\r\n (val >> 15 ? -1 : 1) *\r\n (exponent\r\n ? exponent === 0x1f\r\n ? fraction\r\n ? NaN\r\n : Infinity\r\n : Math.pow(2, exponent - 15) * (1 + fraction / 0x400)\r\n : 6.103515625e-5 * (fraction / 0x400))\r\n );\r\n }\r\n */\r\n\r\n function createSheenLUTFilament(assetManager: AssetManager, texture?: BaseTexture): Texture2D {\r\n if (texture) {\r\n if (!texture.isTexture2D()) {\r\n throw new Error('can not reload sheen lut texture: invalid texture type');\r\n }\r\n if (texture.format !== 'rgba16f') {\r\n throw new Error('can not reload sheen lut texture: invalid texture format');\r\n }\r\n if (texture.width !== textureSize || texture.height !== textureSize) {\r\n throw new Error('can not reload sheen lut texture: invalid texture size');\r\n }\r\n }\r\n const tex =\r\n (texture as Texture2D) ||\r\n Application.instance.device.createTexture2D('rgba16f', textureSize, textureSize);\r\n const image = new Uint16Array(textureSize * textureSize * 4);\r\n let p = 0;\r\n const one = encodeF16(1);\r\n for (let y = textureSize - 1; y >= 0; y--) {\r\n const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);\r\n const roughness = coord * coord;\r\n for (let x = 0; x < textureSize; x++) {\r\n const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);\r\n const c = dfvCharlieUniform(NdotV, roughness, 512);\r\n const f16 = encodeF16(c);\r\n image[p++] = 0;\r\n image[p++] = 0;\r\n image[p++] = f16;\r\n image[p++] = one;\r\n }\r\n }\r\n tex.update(image, 0, 0, textureSize, textureSize);\r\n tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;\r\n return tex;\r\n }\r\n\r\n return createSheenLUTFilament;\r\n}\r\n"],"names":["getSheenLutLoader","textureSize","bits","Uint32Array","radicalInverse_VdC","i","hammersley","iN","out","setXY","distributionCharlie","NdotH","roughness","invAlpha","cos2h","sin2h","Math","pow","PI","visibilityAshikhmin","NdotV","NdotL","min","max","hemisphereUniformSample","u","phi","x","cosTheta","y","sinTheta","sqrt","setXYZ","cos","sin","dfvCharlieUniform","numSamples","r","V","Vector3","Vector2","H","L","scale","dot","subBy","VdotH","z","v","d","_tables","_generateTables","buffer","ArrayBuffer","floatView","Float32Array","uint32View","baseTable","shiftTable","e","mantissaTable","exponentTable","offsetTable","m","encodeF16","val","f","createSheenLUTFilament","assetManager","texture","isTexture2D","Error","format","width","height","tex","Application","instance","device","createTexture2D","image","Uint16Array","p","one","coord","c","f16","update","name","BUILTIN_ASSET_TEXTURE_SHEEN_LUT"],"mappings":";;;;AAwCA,iBACO,SAASA,iBAAAA,CAAkBC,WAAmB,EAAA;IACnD,MAAMC,IAAAA,GAAO,IAAIC,WAAY,CAAA,CAAA,CAAA;;AAG7B,IAAA,SAASC,mBAAmBC,CAAS,EAAA;QACnCH,IAAI,CAAC,EAAE,GAAGG,CAAAA;AACVH,QAAAA,IAAI,CAAC,CAAE,CAAA,GAAG,CAAC,IAAK,CAAC,CAAE,CAAA,IAAI,KAAOA,IAAI,CAAC,CAAE,CAAA,IAAI,EAAE,MAAO,CAAA;QAClDA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;QAC9EA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;QAC9EA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS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