@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,354 +0,0 @@
1
- import { Vector3, Vector2 } from '@zephyr3d/base';
2
- import { Application } from '../app/app.js';
3
-
4
- let vertexLayout = null;
5
- let renderStates = null;
6
- const programs = {};
7
- const faceDirections = [
8
- [
9
- new Vector3(0, 0, -1),
10
- new Vector3(0, -1, 0),
11
- new Vector3(1, 0, 0)
12
- ],
13
- [
14
- new Vector3(0, 0, 1),
15
- new Vector3(0, -1, 0),
16
- new Vector3(-1, 0, 0)
17
- ],
18
- [
19
- new Vector3(1, 0, 0),
20
- new Vector3(0, 0, 1),
21
- new Vector3(0, 1, 0)
22
- ],
23
- [
24
- new Vector3(1, 0, 0),
25
- new Vector3(0, 0, -1),
26
- new Vector3(0, -1, 0)
27
- ],
28
- [
29
- new Vector3(1, 0, 0),
30
- new Vector3(0, -1, 0),
31
- new Vector3(0, 0, 1)
32
- ],
33
- [
34
- new Vector3(-1, 0, 0),
35
- new Vector3(0, -1, 0),
36
- new Vector3(0, 0, -1)
37
- ]
38
- ];
39
- function init() {
40
- const device = Application.instance.device;
41
- const vertices = new Float32Array([
42
- 1,
43
- 1,
44
- -1,
45
- 1,
46
- -1,
47
- -1,
48
- 1,
49
- -1
50
- ]);
51
- const indices = new Uint16Array([
52
- 0,
53
- 1,
54
- 2,
55
- 0,
56
- 2,
57
- 3
58
- ]);
59
- vertexLayout = device.createVertexLayout({
60
- vertexBuffers: [
61
- {
62
- buffer: device.createVertexBuffer('position_f32x2', vertices)
63
- }
64
- ],
65
- indexBuffer: device.createIndexBuffer(indices)
66
- });
67
- renderStates = device.createRenderStateSet();
68
- renderStates.useRasterizerState().setCullMode('none');
69
- renderStates.useDepthState().enableTest(false).enableWrite(false);
70
- }
71
- function getProgramInfo(type, numSamples) {
72
- const device = Application.instance.device;
73
- const hash = `${type}:${numSamples}`;
74
- let ret = programs[hash];
75
- if (!ret) {
76
- const program = createPMREMProgram(type, numSamples);
77
- const bindgroup = device.createBindGroup(program.bindGroupLayouts[0]);
78
- programs[hash] = ret = {
79
- program,
80
- bindgroup
81
- };
82
- }
83
- return ret;
84
- }
85
- function createPMREMProgram(type, numSamples) {
86
- const device = Application.instance.device;
87
- const pb = device;
88
- return pb.buildRenderProgram({
89
- vertex (pb) {
90
- this.$inputs.pos = pb.vec2().attrib('position');
91
- this.up = pb.vec3().uniform(0);
92
- this.right = pb.vec3().uniform(0);
93
- this.front = pb.vec3().uniform(0);
94
- pb.main(function() {
95
- this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);
96
- this.$outputs.direction = pb.mul(pb.mat3(this.up, this.right, this.front), pb.vec3(this.$inputs.pos, 1));
97
- if (device.type === 'webgpu') {
98
- this.$builtins.position.y = pb.neg(this.$builtins.position.y);
99
- }
100
- });
101
- },
102
- fragment (pb) {
103
- if (type === 'ggx') {
104
- this.alphaG = pb.float().uniform(0);
105
- }
106
- this.vFilteringInfo = pb.vec2().uniform(0);
107
- this.hdrScale = pb.float().uniform(0);
108
- this.inputTexture = pb.texCube().uniform(0);
109
- this.NUM_SAMPLES_FLOAT = pb.float(numSamples);
110
- this.NUM_SAMPLES_FLOAT_INVERSED = pb.float(1 / numSamples);
111
- this.K = pb.float(4);
112
- this.$outputs.outcolor = pb.vec4();
113
- if (device.type === 'webgl') {
114
- pb.func('radicalInverse_VdC', [
115
- pb.int('bits')
116
- ], function() {
117
- this.$l.rand = pb.float(0);
118
- this.$l.denom = pb.float(1);
119
- this.$l.invBase = pb.float(0.5);
120
- this.$l.n = this.bits;
121
- this.$for(pb.int('i'), 0, 32, function() {
122
- this.denom = pb.mul(this.denom, 2);
123
- this.rand = pb.add(this.rand, pb.div(pb.mod(pb.float(this.n), 2), this.denom));
124
- this.n = pb.div(this.n, 2);
125
- this.$if(pb.equal(this.n, 0), function() {
126
- this.$break();
127
- });
128
- });
129
- this.$return(this.rand);
130
- });
131
- pb.func('hammersley2d', [
132
- pb.int('i'),
133
- pb.int('N')
134
- ], function() {
135
- this.$return(pb.vec2(pb.div(pb.float(this.i), pb.float(this.N)), this.radicalInverse_VdC(this.i)));
136
- });
137
- } else {
138
- pb.func('radicalInverse_VdC', [
139
- pb.uint('bits')
140
- ], function() {
141
- this.$l.n = this.bits;
142
- this.n = pb.compOr(pb.sal(this.n, 16), pb.sar(this.n, 16));
143
- this.n = pb.compOr(pb.sal(pb.compAnd(this.n, 0x55555555), 1), pb.sar(pb.compAnd(this.n, 0xaaaaaaaa), 1));
144
- this.n = pb.compOr(pb.sal(pb.compAnd(this.n, 0x33333333), 2), pb.sar(pb.compAnd(this.n, 0xcccccccc), 2));
145
- this.n = pb.compOr(pb.sal(pb.compAnd(this.n, 0x0f0f0f0f), 4), pb.sar(pb.compAnd(this.n, 0xf0f0f0f0), 4));
146
- this.n = pb.compOr(pb.sal(pb.compAnd(this.n, 0x00ff00ff), 8), pb.sar(pb.compAnd(this.n, 0xff00ff00), 8));
147
- this.$return(pb.mul(pb.float(this.n), 2.3283064365386963e-10));
148
- });
149
- pb.func('hammersley2d', [
150
- pb.int('i'),
151
- pb.int('N')
152
- ], function() {
153
- this.$return(pb.vec2(pb.div(pb.float(this.i), pb.float(this.N)), this.radicalInverse_VdC(pb.uint(this.i))));
154
- });
155
- }
156
- pb.func('log4', [
157
- pb.float('x')
158
- ], function() {
159
- this.$return(pb.mul(pb.log2(this.x), 0.5));
160
- });
161
- if (type === 'lambertian') {
162
- pb.func('hemisphereCosSample', [
163
- pb.vec2('u')
164
- ], function() {
165
- this.$l.phi = pb.mul(this.u.x, 2 * Math.PI);
166
- this.$l.cosTheta2 = pb.sub(1, this.u.y);
167
- this.$l.cosTheta = pb.sqrt(this.cosTheta2);
168
- this.$l.sinTheta = pb.sqrt(pb.sub(1, this.cosTheta2));
169
- this.$return(pb.vec3(pb.mul(this.sinTheta, pb.cos(this.phi)), pb.mul(this.sinTheta, pb.sin(this.phi)), this.cosTheta));
170
- });
171
- pb.func('irradiance', [
172
- pb.vec3('direction'),
173
- pb.vec2('vFilteringInfo')
174
- ], function() {
175
- this.$l.n = pb.normalize(this.direction);
176
- this.$l.result = pb.vec3(0);
177
- this.$l.tangent = pb.vec3();
178
- this.$if(pb.lessThan(pb.abs(this.n.z), 0.999), function() {
179
- this.tangent = pb.vec3(0, 0, 1);
180
- }).$else(function() {
181
- this.tangent = pb.vec3(1, 0, 0);
182
- });
183
- this.tangent = pb.normalize(pb.cross(this.tangent, this.n));
184
- this.$l.bitangent = pb.cross(this.n, this.tangent);
185
- this.$l.tbn = pb.mat3(this.tangent, this.bitangent, this.n);
186
- this.$l.maxLevel = this.vFilteringInfo.y;
187
- this.$l.dim0 = this.vFilteringInfo.x;
188
- this.$l.omegaP = pb.div(4 * Math.PI, pb.mul(this.dim0, this.dim0, 6));
189
- this.$for(pb.int('i'), 0, numSamples, function() {
190
- this.$l.Xi = this.hammersley2d(this.i, numSamples);
191
- this.$l.Ls = pb.normalize(this.hemisphereCosSample(this.Xi));
192
- this.$l.Ns = pb.vec3(0, 0, 1);
193
- this.$l.NoL = pb.dot(this.Ns, this.Ls);
194
- this.$if(pb.greaterThan(this.NoL, 0), function() {
195
- this.$l.pdf_inversed = pb.div(Math.PI, this.NoL);
196
- this.$l.omegaS = pb.mul(this.pdf_inversed, this.NUM_SAMPLES_FLOAT_INVERSED);
197
- this.$l.l = pb.add(pb.sub(this.log4(this.omegaS), this.log4(this.omegaP)), this.log4(this.K));
198
- this.$l.mipLevel = pb.clamp(this.l, 0, this.maxLevel);
199
- this.$l.c = pb.textureSampleLevel(this.inputTexture, pb.mul(this.tbn, this.Ls), this.mipLevel).rgb;
200
- this.result = pb.add(this.result, this.c);
201
- });
202
- });
203
- this.result = pb.mul(this.result, this.NUM_SAMPLES_FLOAT_INVERSED);
204
- this.$return(this.result);
205
- });
206
- }
207
- if (type === 'ggx') {
208
- pb.func('hemisphereImportanceSampleDggx', [
209
- pb.vec2('u'),
210
- pb.float('a')
211
- ], function() {
212
- this.$l.phi = pb.mul(this.u.x, 2 * Math.PI);
213
- this.$l.cosTheta2 = pb.div(pb.sub(1, this.u.y), pb.add(pb.mul(pb.add(this.a, 1), pb.sub(this.a, 1), this.u.y), 1));
214
- this.$l.cosTheta = pb.sqrt(this.cosTheta2);
215
- this.$l.sinTheta = pb.sqrt(pb.sub(1, this.cosTheta2));
216
- this.$return(pb.vec3(pb.mul(pb.cos(this.phi), this.sinTheta), pb.mul(pb.sin(this.phi), this.sinTheta), this.cosTheta));
217
- });
218
- pb.func('normalDistributionFunction_TrowbridgeReitzGGX', [
219
- pb.float('NoH'),
220
- pb.float('alphaG')
221
- ], function() {
222
- this.$l.a2 = pb.mul(this.alphaG, this.alphaG);
223
- this.$l.d = pb.add(pb.mul(this.NoH, this.NoH, pb.sub(this.a2, 1)), 1);
224
- this.$return(pb.div(this.a2, pb.mul(this.d, this.d, Math.PI)));
225
- });
226
- pb.func('radiance', [
227
- pb.float('alphaG'),
228
- pb.vec3('direction'),
229
- pb.vec2('vFilteringInfo')
230
- ], function() {
231
- this.$l.n = pb.normalize(this.direction);
232
- this.$if(pb.equal(this.alphaG, 0), function() {
233
- this.$l.c = pb.textureSampleLevel(this.inputTexture, this.n, 0).rgb;
234
- this.$return(this.c);
235
- }).$else(function() {
236
- this.$l.result = pb.vec3(0);
237
- this.$l.tangent = pb.vec3();
238
- this.$if(pb.lessThan(pb.abs(this.n.z), 0.999), function() {
239
- this.tangent = pb.vec3(0, 0, 1);
240
- }).$else(function() {
241
- this.tangent = pb.vec3(1, 0, 0);
242
- });
243
- this.tangent = pb.normalize(pb.cross(this.tangent, this.n));
244
- this.$l.bitangent = pb.cross(this.n, this.tangent);
245
- this.$l.tbn = pb.mat3(this.tangent, this.bitangent, this.n);
246
- this.$l.maxLevel = this.vFilteringInfo.y;
247
- this.$l.dim0 = this.vFilteringInfo.x;
248
- this.$l.omegaP = pb.div(4 * Math.PI, pb.mul(this.dim0, this.dim0, 6));
249
- this.$l.weight = pb.float(0);
250
- this.$for(pb.int('i'), 0, numSamples, function() {
251
- this.$l.Xi = this.hammersley2d(this.i, numSamples);
252
- this.$l.H = this.hemisphereImportanceSampleDggx(this.Xi, this.alphaG);
253
- this.$l.NoV = pb.float(1);
254
- this.$l.NoH = this.H.z;
255
- this.$l.NoH2 = pb.mul(this.H.z, this.H.z);
256
- this.$l.NoL = pb.sub(pb.mul(this.NoH2, 2), 1);
257
- this.$l.L = pb.normalize(pb.vec3(pb.mul(this.NoH, this.H.x, 2), pb.mul(this.NoH, this.H.y, 2), this.NoL));
258
- this.$if(pb.greaterThan(this.NoL, 0), function() {
259
- this.$l.pdf_inversed = pb.div(4, this.normalDistributionFunction_TrowbridgeReitzGGX(this.NoH, this.alphaG));
260
- this.$l.omegaS = pb.mul(this.pdf_inversed, this.NUM_SAMPLES_FLOAT_INVERSED);
261
- this.$l.l = pb.add(pb.sub(this.log4(this.omegaS), this.log4(this.omegaP)), this.log4(this.K));
262
- this.$l.mipLevel = pb.clamp(this.l, 0, this.maxLevel);
263
- this.weight = pb.add(this.weight, this.NoL);
264
- this.$l.c = pb.textureSampleLevel(this.inputTexture, pb.mul(this.tbn, this.L), this.mipLevel).rgb;
265
- this.result = pb.add(this.result, pb.mul(this.c, this.NoL));
266
- });
267
- });
268
- this.result = pb.div(this.result, this.weight);
269
- this.$return(this.result);
270
- });
271
- });
272
- }
273
- pb.main(function() {
274
- if (type === 'ggx') {
275
- this.$l.color = this.radiance(this.alphaG, this.$inputs.direction, this.vFilteringInfo);
276
- }
277
- if (type === 'lambertian') {
278
- this.$l.color = this.irradiance(this.$inputs.direction, this.vFilteringInfo);
279
- }
280
- this.$outputs.outcolor = pb.vec4(pb.mul(this.color, this.hdrScale), 1);
281
- });
282
- }
283
- });
284
- }
285
- function doPrefilterCubemap(type, roughness, miplevel, srcTexture, dstFramebuffer, filteringInfo, numSamples) {
286
- const device = Application.instance.device;
287
- const framebuffer = dstFramebuffer;
288
- framebuffer.setColorAttachmentMipLevel(0, miplevel);
289
- framebuffer.setColorAttachmentGenerateMipmaps(0, false);
290
- const { program, bindgroup } = getProgramInfo(type, numSamples);
291
- bindgroup.setValue('vFilteringInfo', filteringInfo);
292
- bindgroup.setValue('hdrScale', 1);
293
- bindgroup.setTexture('inputTexture', srcTexture);
294
- if (type === 'ggx') {
295
- bindgroup.setValue('alphaG', roughness);
296
- }
297
- device.setProgram(program);
298
- device.setBindGroup(0, bindgroup);
299
- device.setFramebuffer(framebuffer);
300
- for(let i = 0; i < 6; i++){
301
- framebuffer.setColorAttachmentCubeFace(0, i);
302
- device.setVertexLayout(vertexLayout);
303
- device.setRenderStates(renderStates);
304
- bindgroup.setValue('up', faceDirections[i][0]);
305
- bindgroup.setValue('right', faceDirections[i][1]);
306
- bindgroup.setValue('front', faceDirections[i][2]);
307
- device.draw('triangle-list', 0, 6);
308
- }
309
- }
310
- /**
311
- * Prefilters an environment cubemap
312
- *
313
- * @param tex - The environment cubemap
314
- * @param type - The prefilter type
315
- * @param destTex - The output cubemap
316
- *
317
- * @public
318
- */ function prefilterCubemap(tex, type, destTexture, numSamples) {
319
- if (!tex || !tex.isTextureCube()) {
320
- console.error('prefilterCubemap(): source texture must be cube texture');
321
- return;
322
- }
323
- const device = Application.instance.device;
324
- if (!vertexLayout) {
325
- init();
326
- }
327
- device.pushDeviceStates();
328
- const rs = device.getRenderStates();
329
- const srcTex = tex;
330
- const width = tex.width;
331
- const mipmapsCount = tex.mipLevelCount;
332
- const filteringInfo = new Vector2(width, mipmapsCount);
333
- const fb = destTexture.isFramebuffer() ? destTexture : device.createFrameBuffer([
334
- destTexture
335
- ], null);
336
- const attachMiplevel = fb.getColorAttachmentMipLevel(0);
337
- const generateMipmap = fb.getColorAttachmentGenerateMipmaps(0);
338
- const destTex = fb.getColorAttachments()[0];
339
- const mips = type === 'ggx' ? destTex.mipLevelCount : 1;
340
- for(let i = 0; i < mips; i++){
341
- const alpha = i === 0 ? 0 : Math.pow(2, i) / width;
342
- doPrefilterCubemap(type, alpha, i, srcTex, fb, filteringInfo, numSamples ?? 64);
343
- }
344
- device.popDeviceStates();
345
- device.setRenderStates(rs);
346
- fb.setColorAttachmentMipLevel(0, attachMiplevel);
347
- fb.setColorAttachmentGenerateMipmaps(0, generateMipmap);
348
- if (!destTexture.isFramebuffer()) {
349
- fb.dispose();
350
- }
351
- }
352
-
353
- export { prefilterCubemap };
354
- //# sourceMappingURL=pmrem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pmrem.js","sources":["../../../src/utility/pmrem.ts"],"sourcesContent":["import { Vector2, Vector3 } from '@zephyr3d/base';\r\nimport type {\r\n BindGroup,\r\n FrameBuffer,\r\n GPUProgram,\r\n RenderStateSet,\r\n TextureCube,\r\n VertexLayout\r\n} from '@zephyr3d/device';\r\nimport { Application } from '../app';\r\n\r\n// reference: https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/\r\n\r\ntype DistributionType = 'lambertian' | 'ggx';\r\n\r\nlet vertexLayout: VertexLayout = null;\r\nlet renderStates: RenderStateSet = null;\r\nconst programs: Record<\r\n string,\r\n {\r\n program: GPUProgram;\r\n bindgroup: BindGroup;\r\n }\r\n> = {};\r\n\r\nconst faceDirections = [\r\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)],\r\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)],\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)],\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)],\r\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)],\r\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)]\r\n];\r\n\r\nfunction init() {\r\n const device = Application.instance.device;\r\n const vertices = new Float32Array([1, 1, -1, 1, -1, -1, 1, -1]);\r\n const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\r\n vertexLayout = device.createVertexLayout({\r\n vertexBuffers: [\r\n {\r\n buffer: device.createVertexBuffer('position_f32x2', vertices)\r\n }\r\n ],\r\n indexBuffer: device.createIndexBuffer(indices)\r\n });\r\n renderStates = device.createRenderStateSet();\r\n renderStates.useRasterizerState().setCullMode('none');\r\n renderStates.useDepthState().enableTest(false).enableWrite(false);\r\n}\r\n\r\nfunction getProgramInfo(type: DistributionType, numSamples: number) {\r\n const device = Application.instance.device;\r\n const hash = `${type}:${numSamples}`;\r\n let ret = programs[hash];\r\n if (!ret) {\r\n const program = createPMREMProgram(type, numSamples);\r\n const bindgroup = device.createBindGroup(program.bindGroupLayouts[0]);\r\n programs[hash] = ret = { program, bindgroup };\r\n }\r\n return ret;\r\n}\r\n\r\nfunction createPMREMProgram(type: DistributionType, numSamples: number): GPUProgram {\r\n const device = Application.instance.device;\r\n const pb = device;\r\n return pb.buildRenderProgram({\r\n vertex(pb) {\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.up = pb.vec3().uniform(0);\r\n this.right = pb.vec3().uniform(0);\r\n this.front = pb.vec3().uniform(0);\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 0, 1);\r\n this.$outputs.direction = pb.mul(\r\n pb.mat3(this.up, this.right, this.front),\r\n pb.vec3(this.$inputs.pos, 1)\r\n );\r\n if (device.type === 'webgpu') {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n }\r\n });\r\n },\r\n fragment(pb) {\r\n if (type === 'ggx') {\r\n this.alphaG = pb.float().uniform(0);\r\n }\r\n this.vFilteringInfo = pb.vec2().uniform(0);\r\n this.hdrScale = pb.float().uniform(0);\r\n this.inputTexture = pb.texCube().uniform(0);\r\n this.NUM_SAMPLES_FLOAT = pb.float(numSamples);\r\n this.NUM_SAMPLES_FLOAT_INVERSED = pb.float(1 / numSamples);\r\n this.K = pb.float(4);\r\n this.$outputs.outcolor = pb.vec4();\r\n if (device.type === 'webgl') {\r\n pb.func('radicalInverse_VdC', [pb.int('bits')], function () {\r\n this.$l.rand = pb.float(0);\r\n this.$l.denom = pb.float(1);\r\n this.$l.invBase = pb.float(0.5);\r\n this.$l.n = this.bits;\r\n this.$for(pb.int('i'), 0, 32, function () {\r\n this.denom = pb.mul(this.denom, 2);\r\n this.rand = pb.add(this.rand, pb.div(pb.mod(pb.float(this.n), 2), this.denom));\r\n this.n = pb.div(this.n, 2);\r\n this.$if(pb.equal(this.n, 0), function () {\r\n this.$break();\r\n });\r\n });\r\n this.$return(this.rand);\r\n });\r\n pb.func('hammersley2d', [pb.int('i'), pb.int('N')], function () {\r\n this.$return(pb.vec2(pb.div(pb.float(this.i), pb.float(this.N)), this.radicalInverse_VdC(this.i)));\r\n });\r\n } else {\r\n pb.func('radicalInverse_VdC', [pb.uint('bits')], function () {\r\n this.$l.n = this.bits;\r\n this.n = pb.compOr(pb.sal(this.n, 16), pb.sar(this.n, 16));\r\n this.n = pb.compOr(\r\n pb.sal(pb.compAnd(this.n, 0x55555555), 1),\r\n pb.sar(pb.compAnd(this.n, 0xaaaaaaaa), 1)\r\n );\r\n this.n = pb.compOr(\r\n pb.sal(pb.compAnd(this.n, 0x33333333), 2),\r\n pb.sar(pb.compAnd(this.n, 0xcccccccc), 2)\r\n );\r\n this.n = pb.compOr(\r\n pb.sal(pb.compAnd(this.n, 0x0f0f0f0f), 4),\r\n pb.sar(pb.compAnd(this.n, 0xf0f0f0f0), 4)\r\n );\r\n this.n = pb.compOr(\r\n pb.sal(pb.compAnd(this.n, 0x00ff00ff), 8),\r\n pb.sar(pb.compAnd(this.n, 0xff00ff00), 8)\r\n );\r\n this.$return(pb.mul(pb.float(this.n), 2.3283064365386963e-10));\r\n });\r\n pb.func('hammersley2d', [pb.int('i'), pb.int('N')], function () {\r\n this.$return(\r\n pb.vec2(pb.div(pb.float(this.i), pb.float(this.N)), this.radicalInverse_VdC(pb.uint(this.i)))\r\n );\r\n });\r\n }\r\n pb.func('log4', [pb.float('x')], function () {\r\n this.$return(pb.mul(pb.log2(this.x), 0.5));\r\n });\r\n if (type === 'lambertian') {\r\n pb.func('hemisphereCosSample', [pb.vec2('u')], function () {\r\n this.$l.phi = pb.mul(this.u.x, 2 * Math.PI);\r\n this.$l.cosTheta2 = pb.sub(1, this.u.y);\r\n this.$l.cosTheta = pb.sqrt(this.cosTheta2);\r\n this.$l.sinTheta = pb.sqrt(pb.sub(1, this.cosTheta2));\r\n this.$return(\r\n pb.vec3(\r\n pb.mul(this.sinTheta, pb.cos(this.phi)),\r\n pb.mul(this.sinTheta, pb.sin(this.phi)),\r\n this.cosTheta\r\n )\r\n );\r\n });\r\n pb.func('irradiance', [pb.vec3('direction'), pb.vec2('vFilteringInfo')], function () {\r\n this.$l.n = pb.normalize(this.direction);\r\n this.$l.result = pb.vec3(0);\r\n this.$l.tangent = pb.vec3();\r\n this.$if(pb.lessThan(pb.abs(this.n.z), 0.999), function () {\r\n this.tangent = pb.vec3(0, 0, 1);\r\n }).$else(function () {\r\n this.tangent = pb.vec3(1, 0, 0);\r\n });\r\n this.tangent = pb.normalize(pb.cross(this.tangent, this.n));\r\n this.$l.bitangent = pb.cross(this.n, this.tangent);\r\n this.$l.tbn = pb.mat3(this.tangent, this.bitangent, this.n);\r\n this.$l.maxLevel = this.vFilteringInfo.y;\r\n this.$l.dim0 = this.vFilteringInfo.x;\r\n this.$l.omegaP = pb.div(4 * Math.PI, pb.mul(this.dim0, this.dim0, 6));\r\n this.$for(pb.int('i'), 0, numSamples, function () {\r\n this.$l.Xi = this.hammersley2d(this.i, numSamples);\r\n this.$l.Ls = pb.normalize(this.hemisphereCosSample(this.Xi));\r\n this.$l.Ns = pb.vec3(0, 0, 1);\r\n this.$l.NoL = pb.dot(this.Ns, this.Ls);\r\n this.$if(pb.greaterThan(this.NoL, 0), function () {\r\n this.$l.pdf_inversed = pb.div(Math.PI, this.NoL);\r\n this.$l.omegaS = pb.mul(this.pdf_inversed, this.NUM_SAMPLES_FLOAT_INVERSED);\r\n this.$l.l = pb.add(pb.sub(this.log4(this.omegaS), this.log4(this.omegaP)), this.log4(this.K));\r\n this.$l.mipLevel = pb.clamp(this.l, 0, this.maxLevel);\r\n this.$l.c = pb.textureSampleLevel(\r\n this.inputTexture,\r\n pb.mul(this.tbn, this.Ls),\r\n this.mipLevel\r\n ).rgb;\r\n this.result = pb.add(this.result, this.c);\r\n });\r\n });\r\n this.result = pb.mul(this.result, this.NUM_SAMPLES_FLOAT_INVERSED);\r\n this.$return(this.result);\r\n });\r\n }\r\n if (type === 'ggx') {\r\n pb.func('hemisphereImportanceSampleDggx', [pb.vec2('u'), pb.float('a')], function () {\r\n this.$l.phi = pb.mul(this.u.x, 2 * Math.PI);\r\n this.$l.cosTheta2 = pb.div(\r\n pb.sub(1, this.u.y),\r\n pb.add(pb.mul(pb.add(this.a, 1), pb.sub(this.a, 1), this.u.y), 1)\r\n );\r\n this.$l.cosTheta = pb.sqrt(this.cosTheta2);\r\n this.$l.sinTheta = pb.sqrt(pb.sub(1, this.cosTheta2));\r\n this.$return(\r\n pb.vec3(\r\n pb.mul(pb.cos(this.phi), this.sinTheta),\r\n pb.mul(pb.sin(this.phi), this.sinTheta),\r\n this.cosTheta\r\n )\r\n );\r\n });\r\n pb.func(\r\n 'normalDistributionFunction_TrowbridgeReitzGGX',\r\n [pb.float('NoH'), pb.float('alphaG')],\r\n function () {\r\n this.$l.a2 = pb.mul(this.alphaG, this.alphaG);\r\n this.$l.d = pb.add(pb.mul(this.NoH, this.NoH, pb.sub(this.a2, 1)), 1);\r\n this.$return(pb.div(this.a2, pb.mul(this.d, this.d, Math.PI)));\r\n }\r\n );\r\n pb.func(\r\n 'radiance',\r\n [pb.float('alphaG'), pb.vec3('direction'), pb.vec2('vFilteringInfo')],\r\n function () {\r\n this.$l.n = pb.normalize(this.direction);\r\n this.$if(pb.equal(this.alphaG, 0), function () {\r\n this.$l.c = pb.textureSampleLevel(this.inputTexture, this.n, 0).rgb;\r\n this.$return(this.c);\r\n }).$else(function () {\r\n this.$l.result = pb.vec3(0);\r\n this.$l.tangent = pb.vec3();\r\n this.$if(pb.lessThan(pb.abs(this.n.z), 0.999), function () {\r\n this.tangent = pb.vec3(0, 0, 1);\r\n }).$else(function () {\r\n this.tangent = pb.vec3(1, 0, 0);\r\n });\r\n this.tangent = pb.normalize(pb.cross(this.tangent, this.n));\r\n this.$l.bitangent = pb.cross(this.n, this.tangent);\r\n this.$l.tbn = pb.mat3(this.tangent, this.bitangent, this.n);\r\n this.$l.maxLevel = this.vFilteringInfo.y;\r\n this.$l.dim0 = this.vFilteringInfo.x;\r\n this.$l.omegaP = pb.div(4 * Math.PI, pb.mul(this.dim0, this.dim0, 6));\r\n this.$l.weight = pb.float(0);\r\n this.$for(pb.int('i'), 0, numSamples, function () {\r\n this.$l.Xi = this.hammersley2d(this.i, numSamples);\r\n this.$l.H = this.hemisphereImportanceSampleDggx(this.Xi, this.alphaG);\r\n this.$l.NoV = pb.float(1);\r\n this.$l.NoH = this.H.z;\r\n this.$l.NoH2 = pb.mul(this.H.z, this.H.z);\r\n this.$l.NoL = pb.sub(pb.mul(this.NoH2, 2), 1);\r\n this.$l.L = pb.normalize(\r\n pb.vec3(pb.mul(this.NoH, this.H.x, 2), pb.mul(this.NoH, this.H.y, 2), this.NoL)\r\n );\r\n this.$if(pb.greaterThan(this.NoL, 0), function () {\r\n this.$l.pdf_inversed = pb.div(\r\n 4,\r\n this.normalDistributionFunction_TrowbridgeReitzGGX(this.NoH, this.alphaG)\r\n );\r\n this.$l.omegaS = pb.mul(this.pdf_inversed, this.NUM_SAMPLES_FLOAT_INVERSED);\r\n this.$l.l = pb.add(\r\n pb.sub(this.log4(this.omegaS), this.log4(this.omegaP)),\r\n this.log4(this.K)\r\n );\r\n this.$l.mipLevel = pb.clamp(this.l, 0, this.maxLevel);\r\n this.weight = pb.add(this.weight, this.NoL);\r\n this.$l.c = pb.textureSampleLevel(\r\n this.inputTexture,\r\n pb.mul(this.tbn, this.L),\r\n this.mipLevel\r\n ).rgb;\r\n this.result = pb.add(this.result, pb.mul(this.c, this.NoL));\r\n });\r\n });\r\n this.result = pb.div(this.result, this.weight);\r\n this.$return(this.result);\r\n });\r\n }\r\n );\r\n }\r\n pb.main(function () {\r\n if (type === 'ggx') {\r\n this.$l.color = this.radiance(this.alphaG, this.$inputs.direction, this.vFilteringInfo);\r\n }\r\n if (type === 'lambertian') {\r\n this.$l.color = this.irradiance(this.$inputs.direction, this.vFilteringInfo);\r\n }\r\n this.$outputs.outcolor = pb.vec4(pb.mul(this.color, this.hdrScale), 1);\r\n });\r\n }\r\n });\r\n}\r\nfunction doPrefilterCubemap(\r\n type: DistributionType,\r\n roughness: number,\r\n miplevel: number,\r\n srcTexture: TextureCube,\r\n dstFramebuffer: FrameBuffer,\r\n filteringInfo: Vector2,\r\n numSamples: number\r\n): void {\r\n const device = Application.instance.device;\r\n const framebuffer = dstFramebuffer;\r\n framebuffer.setColorAttachmentMipLevel(0, miplevel);\r\n framebuffer.setColorAttachmentGenerateMipmaps(0, false);\r\n const { program, bindgroup } = getProgramInfo(type, numSamples);\r\n bindgroup.setValue('vFilteringInfo', filteringInfo);\r\n bindgroup.setValue('hdrScale', 1);\r\n bindgroup.setTexture('inputTexture', srcTexture);\r\n if (type === 'ggx') {\r\n bindgroup.setValue('alphaG', roughness);\r\n }\r\n device.setProgram(program);\r\n device.setBindGroup(0, bindgroup);\r\n device.setFramebuffer(framebuffer);\r\n for (let i = 0; i < 6; i++) {\r\n framebuffer.setColorAttachmentCubeFace(0, i);\r\n device.setVertexLayout(vertexLayout);\r\n device.setRenderStates(renderStates);\r\n bindgroup.setValue('up', faceDirections[i][0]);\r\n bindgroup.setValue('right', faceDirections[i][1]);\r\n bindgroup.setValue('front', faceDirections[i][2]);\r\n device.draw('triangle-list', 0, 6);\r\n }\r\n}\r\n\r\n/**\r\n * Prefilters an environment cubemap\r\n *\r\n * @param tex - The environment cubemap\r\n * @param type - The prefilter type\r\n * @param destTex - The output cubemap\r\n *\r\n * @public\r\n */\r\nexport function prefilterCubemap(\r\n tex: TextureCube,\r\n type: DistributionType,\r\n destTexture: TextureCube | FrameBuffer,\r\n numSamples?: number\r\n): void {\r\n if (!tex || !tex.isTextureCube()) {\r\n console.error('prefilterCubemap(): source texture must be cube texture');\r\n return;\r\n }\r\n const device = Application.instance.device;\r\n if (!vertexLayout) {\r\n init();\r\n }\r\n device.pushDeviceStates();\r\n const rs = device.getRenderStates();\r\n const srcTex = tex;\r\n const width = tex.width;\r\n const mipmapsCount = tex.mipLevelCount;\r\n const filteringInfo = new Vector2(width, mipmapsCount);\r\n const fb = destTexture.isFramebuffer() ? destTexture : device.createFrameBuffer([destTexture], null);\r\n const attachMiplevel = fb.getColorAttachmentMipLevel(0);\r\n const generateMipmap = fb.getColorAttachmentGenerateMipmaps(0);\r\n const destTex = fb.getColorAttachments()[0];\r\n const mips = type === 'ggx' ? destTex.mipLevelCount : 1;\r\n for (let i = 0; i < mips; i++) {\r\n const alpha = i === 0 ? 0 : Math.pow(2, i) / width;\r\n doPrefilterCubemap(type, alpha, i, srcTex, fb, filteringInfo, numSamples ?? 64);\r\n }\r\n device.popDeviceStates();\r\n device.setRenderStates(rs);\r\n fb.setColorAttachmentMipLevel(0, attachMiplevel);\r\n fb.setColorAttachmentGenerateMipmaps(0, generateMipmap);\r\n if (!destTexture.isFramebuffer()) {\r\n fb.dispose();\r\n }\r\n}\r\n"],"names":["vertexLayout","renderStates","programs","faceDirections","Vector3","init","device","Application","instance","vertices","Float32Array","indices","Uint16Array","createVertexLayout","vertexBuffers","buffer","createVertexBuffer","indexBuffer","createIndexBuffer","createRenderStateSet","useRasterizerState","setCullMode","useDepthState","enableTest","enableWrite","getProgramInfo","type","numSamples","hash","ret","program","createPMREMProgram","bindgroup","createBindGroup","bindGroupLayouts","pb","buildRenderProgram","vertex","$inputs","pos","vec2","attrib","up","vec3","uniform","right","front","main","$builtins","position","vec4","$outputs","direction","mul","mat3","y","neg","fragment","alphaG","float","vFilteringInfo","hdrScale","inputTexture","texCube","NUM_SAMPLES_FLOAT","NUM_SAMPLES_FLOAT_INVERSED","K","outcolor","func","int","$l","rand","denom","invBase","n","bits","$for","add","div","mod","$if","equal","$break","$return","i","N","radicalInverse_VdC","uint","compOr","sal","sar","compAnd","log2","x","phi","u","Math","PI","cosTheta2","sub","cosTheta","sqrt","sinTheta","cos","sin","normalize","result","tangent","lessThan","abs","z","$else","cross","bitangent","tbn","maxLevel","dim0","omegaP","Xi","hammersley2d","Ls","hemisphereCosSample","Ns","NoL","dot","greaterThan","pdf_inversed","omegaS","l","log4","mipLevel","clamp","c","textureSampleLevel","rgb","a","a2","d","NoH","weight","H","hemisphereImportanceSampleDggx","NoV","NoH2","L","normalDistributionFunction_TrowbridgeReitzGGX","color","radiance","irradiance","doPrefilterCubemap","roughness","miplevel","srcTexture","dstFramebuffer","filteringInfo","framebuffer","setColorAttachmentMipLevel","setColorAttachmentGenerateMipmaps","setValue","setTexture","setProgram","setBindGroup","setFramebuffer","setColorAttachmentCubeFace","setVertexLayout","setRenderStates","draw","prefilterCubemap","tex","destTexture","isTextureCube","console","error","pushDeviceStates","rs","getRenderStates","srcTex","width","mipmapsCount","mipLevelCount","Vector2","fb","isFramebuffer","createFrameBuffer","attachMiplevel","getColorAttachmentMipLevel","generateMipmap","getColorAttachmentGenerateMipmaps","destTex","getColorAttachments","mips","alpha","pow","popDeviceStates","dispose"],"mappings":";;;AAeA,IAAIA,YAA6B,GAAA,IAAA;AACjC,IAAIC,YAA+B,GAAA,IAAA;AACnC,MAAMC,WAMF,EAAC;AAEL,MAAMC,cAAiB,GAAA;AACrB,IAAA;QAAC,IAAIC,OAAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,EAAC,CAAA;QAAI,IAAIA,OAAAA,CAAQ,CAAG,EAAA,EAAI,EAAA,CAAA,CAAA;QAA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CAAA,GAAIY,KAAKgG,GAAG,CAAC,GAAG5G,CAAK6F,CAAAA,GAAAA,KAAAA;AAC7C5B,QAAAA,kBAAAA,CAAmB3H,MAAMqK,KAAO3G,EAAAA,CAAAA,EAAG4F,MAAQK,EAAAA,EAAAA,EAAI3B,eAAe/H,UAAc,IAAA,EAAA,CAAA;AAC9E;AACArB,IAAAA,MAAAA,CAAO2L,eAAe,EAAA;AACtB3L,IAAAA,MAAAA,CAAO+J,eAAe,CAACS,EAAAA,CAAAA;IACvBO,EAAGzB,CAAAA,0BAA0B,CAAC,CAAG4B,EAAAA,cAAAA,CAAAA;IACjCH,EAAGxB,CAAAA,iCAAiC,CAAC,CAAG6B,EAAAA,cAAAA,CAAAA;IACxC,IAAI,CAACjB,WAAYa,CAAAA,aAAa,EAAI,EAAA;AAChCD,QAAAA,EAAAA,CAAGa,OAAO,EAAA;AACZ;AACF;;;;"}
@@ -1,115 +0,0 @@
1
- import { Application } from '../app/app.js';
2
- import { fetchSampler } from './misc.js';
3
- import { drawFullscreenQuad } from '../render/fullscreenquad.js';
4
- import { DRef } from '@zephyr3d/base';
5
-
6
- class RenderMipmap {
7
- _program;
8
- _bindGroup;
9
- _srcSize;
10
- _dstSize;
11
- setupUniforms(_scope) {}
12
- applyUniformValues(_bindGroup) {}
13
- constructor(){
14
- this._program = new DRef();
15
- this._bindGroup = new DRef();
16
- this._srcSize = new Float32Array(2);
17
- this._dstSize = new Float32Array(2);
18
- }
19
- render(srcTex) {
20
- const device = Application.instance.device;
21
- this.prepare(device);
22
- device.pushDeviceStates();
23
- if (device.type === 'webgpu') {
24
- for(let i = 0; i < srcTex.mipLevelCount - 1; i++){
25
- this.renderLevel(device, i, srcTex, srcTex);
26
- }
27
- } else {
28
- const tmpTexture = device.createTexture2D(srcTex.format, srcTex.width, srcTex.height);
29
- const tmpFramebuffer = device.createFrameBuffer([
30
- tmpTexture
31
- ], null);
32
- const dstTex = tmpFramebuffer.getColorAttachments()[0];
33
- for(let i = 0; i < srcTex.mipLevelCount - 1; i++){
34
- this.renderLevel(device, i, srcTex, dstTex);
35
- }
36
- tmpFramebuffer.dispose();
37
- tmpTexture.dispose();
38
- }
39
- device.popDeviceStates();
40
- }
41
- renderLevel(device, miplevel, srcTexture, dstTexture) {
42
- const sampler = fetchSampler('clamp_nearest');
43
- const framebuffer = device.createFrameBuffer([
44
- dstTexture
45
- ], null);
46
- framebuffer.setColorAttachmentMipLevel(0, miplevel + 1);
47
- const bindGroup = this._bindGroup.get();
48
- framebuffer.setColorAttachmentGenerateMipmaps(0, false);
49
- this._srcSize[0] = Math.max(srcTexture.width >> miplevel, 1);
50
- this._srcSize[1] = Math.max(srcTexture.height >> miplevel, 1);
51
- this._dstSize[0] = Math.max(this._srcSize[0] >> 1, 1);
52
- this._dstSize[1] = Math.max(this._srcSize[1] >> 1, 1);
53
- bindGroup.setValue('srcSize', this._srcSize);
54
- bindGroup.setValue('dstSize', this._dstSize);
55
- if (device.type === 'webgpu') {
56
- bindGroup.setTextureView('srcTex', srcTexture, miplevel, 0, 1, sampler);
57
- } else {
58
- bindGroup.setTexture('srcTex', srcTexture, sampler);
59
- bindGroup.setValue('srcMipLevel', miplevel);
60
- }
61
- this.applyUniformValues(bindGroup);
62
- device.setProgram(this._program.get());
63
- device.setBindGroup(0, this._bindGroup.get());
64
- device.setFramebuffer(framebuffer);
65
- drawFullscreenQuad();
66
- if (srcTexture !== dstTexture) {
67
- device.copyFramebufferToTexture2D(framebuffer, 0, srcTexture, miplevel + 1);
68
- }
69
- framebuffer.dispose();
70
- }
71
- prepare(device) {
72
- if (!this._program.get()) {
73
- const that = this;
74
- const program = device.buildRenderProgram({
75
- vertex (pb) {
76
- this.$inputs.pos = pb.vec2().attrib('position');
77
- this.$outputs.uv = pb.vec2();
78
- that.setupUniforms(this);
79
- pb.main(function() {
80
- this.$builtins.position = pb.vec4(this.$inputs.pos, 1, 1);
81
- this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));
82
- if (device.type === 'webgpu') {
83
- this.$builtins.position.y = pb.neg(this.$builtins.position.y);
84
- }
85
- });
86
- },
87
- fragment (pb) {
88
- this.$outputs.color = pb.vec4();
89
- this.srcTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);
90
- this.srcSize = pb.vec2().uniform(0);
91
- this.dstSize = pb.vec2().uniform(0);
92
- that.setupUniforms(this);
93
- if (device.type !== 'webgpu') {
94
- this.srcMipLevel = pb.float().uniform(0);
95
- }
96
- pb.main(function() {
97
- const miplevel = device.type === 'webgpu' ? 0 : this.srcMipLevel;
98
- this.$l.invSize = pb.div(pb.vec2(1), this.srcSize);
99
- this.$l.uv = pb.div(this.$builtins.fragCoord.xy, this.dstSize);
100
- this.$l.d0 = pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(-0.5, -0.5), this.invSize)), miplevel);
101
- this.$l.d1 = pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(0.5, -0.5), this.invSize)), miplevel);
102
- this.$l.d2 = pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(-0.5, 0.5), this.invSize)), miplevel);
103
- this.$l.d3 = pb.textureSampleLevel(this.srcTex, pb.add(this.uv, pb.mul(pb.vec2(0.5, 0.5), this.invSize)), miplevel);
104
- this.$outputs.color = that.renderPixel(this, this.d0, this.d1, this.d2, this.d3, this.uv);
105
- });
106
- }
107
- });
108
- this._program.set(program);
109
- this._bindGroup.set(device.createBindGroup(program.bindGroupLayouts[0]));
110
- }
111
- }
112
- }
113
-
114
- export { RenderMipmap };
115
- //# sourceMappingURL=rendermipmap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rendermipmap.js","sources":["../../../src/utility/rendermipmap.ts"],"sourcesContent":["import type {\r\n AbstractDevice,\r\n BindGroup,\r\n GPUProgram,\r\n PBGlobalScope,\r\n PBInsideFunctionScope,\r\n PBShaderExp,\r\n Texture2D\r\n} from '@zephyr3d/device';\r\nimport { Application } from '../app';\r\nimport { fetchSampler } from './misc';\r\nimport { drawFullscreenQuad } from '../render/fullscreenquad';\r\nimport { DRef } from '@zephyr3d/base';\r\n\r\nexport abstract class RenderMipmap {\r\n private readonly _program: DRef<GPUProgram>;\r\n private readonly _bindGroup: DRef<BindGroup>;\r\n private _srcSize: Float32Array<ArrayBuffer>;\r\n private _dstSize: Float32Array<ArrayBuffer>;\r\n abstract renderPixel(\r\n scope: PBInsideFunctionScope,\r\n leftTop: PBShaderExp,\r\n rightTop: PBShaderExp,\r\n leftBottom: PBShaderExp,\r\n rightBottom: PBShaderExp,\r\n uv: PBShaderExp\r\n ): PBShaderExp;\r\n setupUniforms(_scope: PBGlobalScope): void {}\r\n applyUniformValues(_bindGroup: BindGroup): void {}\r\n constructor() {\r\n this._program = new DRef();\r\n this._bindGroup = new DRef();\r\n this._srcSize = new Float32Array(2);\r\n this._dstSize = new Float32Array(2);\r\n }\r\n render(srcTex: Texture2D) {\r\n const device = Application.instance.device;\r\n this.prepare(device);\r\n device.pushDeviceStates();\r\n if (device.type === 'webgpu') {\r\n for (let i = 0; i < srcTex.mipLevelCount - 1; i++) {\r\n this.renderLevel(device, i, srcTex, srcTex);\r\n }\r\n } else {\r\n const tmpTexture = device.createTexture2D(srcTex.format, srcTex.width, srcTex.height);\r\n const tmpFramebuffer = device.createFrameBuffer([tmpTexture], null);\r\n const dstTex = tmpFramebuffer.getColorAttachments()[0] as Texture2D;\r\n for (let i = 0; i < srcTex.mipLevelCount - 1; i++) {\r\n this.renderLevel(device, i, srcTex, dstTex);\r\n }\r\n tmpFramebuffer.dispose();\r\n tmpTexture.dispose();\r\n }\r\n device.popDeviceStates();\r\n }\r\n private renderLevel(\r\n device: AbstractDevice,\r\n miplevel: number,\r\n srcTexture: Texture2D,\r\n dstTexture: Texture2D\r\n ): void {\r\n const sampler = fetchSampler('clamp_nearest');\r\n const framebuffer = device.createFrameBuffer([dstTexture], null);\r\n framebuffer.setColorAttachmentMipLevel(0, miplevel + 1);\r\n const bindGroup = this._bindGroup.get();\r\n framebuffer.setColorAttachmentGenerateMipmaps(0, false);\r\n this._srcSize[0] = Math.max(srcTexture.width >> miplevel, 1);\r\n this._srcSize[1] = Math.max(srcTexture.height >> miplevel, 1);\r\n this._dstSize[0] = Math.max(this._srcSize[0] >> 1, 1);\r\n this._dstSize[1] = Math.max(this._srcSize[1] >> 1, 1);\r\n bindGroup.setValue('srcSize', this._srcSize);\r\n bindGroup.setValue('dstSize', this._dstSize);\r\n if (device.type === 'webgpu') {\r\n bindGroup.setTextureView('srcTex', srcTexture, miplevel, 0, 1, sampler);\r\n } else {\r\n bindGroup.setTexture('srcTex', srcTexture, sampler);\r\n bindGroup.setValue('srcMipLevel', miplevel);\r\n }\r\n this.applyUniformValues(bindGroup);\r\n device.setProgram(this._program.get());\r\n device.setBindGroup(0, this._bindGroup.get());\r\n device.setFramebuffer(framebuffer);\r\n drawFullscreenQuad();\r\n if (srcTexture !== dstTexture) {\r\n device.copyFramebufferToTexture2D(framebuffer, 0, srcTexture, miplevel + 1);\r\n }\r\n framebuffer.dispose();\r\n }\r\n private prepare(device: AbstractDevice) {\r\n if (!this._program.get()) {\r\n const that = this;\r\n const program = device.buildRenderProgram({\r\n vertex(pb) {\r\n this.$inputs.pos = pb.vec2().attrib('position');\r\n this.$outputs.uv = pb.vec2();\r\n that.setupUniforms(this);\r\n pb.main(function () {\r\n this.$builtins.position = pb.vec4(this.$inputs.pos, 1, 1);\r\n this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));\r\n if (device.type === 'webgpu') {\r\n this.$builtins.position.y = pb.neg(this.$builtins.position.y);\r\n }\r\n });\r\n },\r\n fragment(pb) {\r\n this.$outputs.color = pb.vec4();\r\n this.srcTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);\r\n this.srcSize = pb.vec2().uniform(0);\r\n this.dstSize = pb.vec2().uniform(0);\r\n that.setupUniforms(this);\r\n if (device.type !== 'webgpu') {\r\n this.srcMipLevel = pb.float().uniform(0);\r\n }\r\n pb.main(function () {\r\n const miplevel = device.type === 'webgpu' ? 0 : this.srcMipLevel;\r\n this.$l.invSize = pb.div(pb.vec2(1), this.srcSize);\r\n this.$l.uv = pb.div(this.$builtins.fragCoord.xy, this.dstSize);\r\n this.$l.d0 = pb.textureSampleLevel(\r\n this.srcTex,\r\n pb.add(this.uv, pb.mul(pb.vec2(-0.5, -0.5), this.invSize)),\r\n miplevel\r\n );\r\n this.$l.d1 = pb.textureSampleLevel(\r\n this.srcTex,\r\n pb.add(this.uv, pb.mul(pb.vec2(0.5, -0.5), this.invSize)),\r\n miplevel\r\n );\r\n this.$l.d2 = pb.textureSampleLevel(\r\n this.srcTex,\r\n pb.add(this.uv, pb.mul(pb.vec2(-0.5, 0.5), this.invSize)),\r\n miplevel\r\n );\r\n this.$l.d3 = pb.textureSampleLevel(\r\n this.srcTex,\r\n pb.add(this.uv, pb.mul(pb.vec2(0.5, 0.5), this.invSize)),\r\n miplevel\r\n );\r\n this.$outputs.color = that.renderPixel(this, this.d0, this.d1, this.d2, this.d3, this.uv);\r\n });\r\n }\r\n });\r\n this._program.set(program);\r\n this._bindGroup.set(device.createBindGroup(program.bindGroupLayouts[0]));\r\n }\r\n }\r\n}\r\n"],"names":["RenderMipmap","_program","_bindGroup","_srcSize","_dstSize","setupUniforms","_scope","applyUniformValues","DRef","Float32Array","render","srcTex","device","Application","instance","prepare","pushDeviceStates","type","i","mipLevelCount","renderLevel","tmpTexture","createTexture2D","format","width","height","tmpFramebuffer","createFrameBuffer","dstTex","getColorAttachments","dispose","popDeviceStates","miplevel","srcTexture","dstTexture","sampler","fetchSampler","framebuffer","setColorAttachmentMipLevel","bindGroup","get","setColorAttachmentGenerateMipmaps","Math","max","setValue","setTextureView","setTexture","setProgram","setBindGroup","setFramebuffer","drawFullscreenQuad","copyFramebufferToTexture2D","that","program","buildRenderProgram","vertex","pb","$inputs","pos","vec2","attrib","$outputs","uv","main","$builtins","position","vec4","add","mul","xy","y","neg","fragment","color","tex2D","sampleType","uniform","srcSize","dstSize","srcMipLevel","float","$l","invSize","div","fragCoord","d0","textureSampleLevel","d1","d2","d3","renderPixel","set","createBindGroup","bindGroupLayouts"],"mappings":";;;;;AAcO,MAAeA,YAAAA,CAAAA;IACHC,QAA2B;IAC3BC,UAA4B;IACrCC,QAAoC;IACpCC,QAAoC;IAS5CC,aAAcC,CAAAA,MAAqB,EAAQ;IAC3CC,kBAAmBL,CAAAA,UAAqB,EAAQ;IAChD,WAAc,EAAA;QACZ,IAAI,CAACD,QAAQ,GAAG,IAAIO,IAAAA,EAAAA;QACpB,IAAI,CAACN,UAAU,GAAG,IAAIM,IAAAA,EAAAA;AACtB,QAAA,IAAI,CAACL,QAAQ,GAAG,IAAIM,YAAa,CAAA,CAAA,CAAA;AACjC,QAAA,IAAI,CAACL,QAAQ,GAAG,IAAIK,YAAa,CAAA,CAAA,CAAA;AACnC;AACAC,IAAAA,MAAAA,CAAOC,MAAiB,EAAE;AACxB,QAAA,MAAMC,MAASC,GAAAA,WAAAA,CAAYC,QAAQ,CAACF,MAAM;QAC1C,IAAI,CAACG,OAAO,CAACH,MAAAA,CAAAA;AACbA,QAAAA,MAAAA,CAAOI,gBAAgB,EAAA;QACvB,IAAIJ,MAAAA,CAAOK,IAAI,KAAK,QAAU,EAAA;YAC5B,IAAK,IAAIC,IAAI,CAAGA,EAAAA,CAAAA,GAAIP,OAAOQ,aAAa,GAAG,GAAGD,CAAK,EAAA,CAAA;AACjD,gBAAA,IAAI,CAACE,WAAW,CAACR,MAAAA,EAAQM,GAAGP,MAAQA,EAAAA,MAAAA,CAAAA;AACtC;SACK,MAAA;YACL,MAAMU,UAAAA,GAAaT,MAAOU,CAAAA,eAAe,CAACX,MAAAA,CAAOY,MAAM,EAAEZ,MAAOa,CAAAA,KAAK,EAAEb,MAAAA,CAAOc,MAAM,CAAA;YACpF,MAAMC,cAAAA,GAAiBd,MAAOe,CAAAA,iBAAiB,CAAC;AAACN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