@zephyr3d/scene 0.9.5 → 0.9.7

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 (621) hide show
  1. package/dist/animation/joint_dynamics/controller.js +92 -32
  2. package/dist/animation/joint_dynamics/controller.js.map +1 -1
  3. package/dist/animation/joint_dynamics/convex_collider.js +320 -0
  4. package/dist/animation/joint_dynamics/convex_collider.js.map +1 -0
  5. package/dist/animation/joint_dynamics/joint_dynamics_system.js +57 -19
  6. package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
  7. package/dist/animation/joint_dynamics/solver.js +71 -27
  8. package/dist/animation/joint_dynamics/solver.js.map +1 -1
  9. package/dist/animation/joint_dynamics_modifier.js +21 -20
  10. package/dist/animation/joint_dynamics_modifier.js.map +1 -1
  11. package/dist/animation/skeleton.js +7 -10
  12. package/dist/animation/skeleton.js.map +1 -1
  13. package/dist/app/engine.js +134 -140
  14. package/dist/app/engine.js.map +1 -1
  15. package/dist/app/scriptregistry.js +47 -16
  16. package/dist/app/scriptregistry.js.map +1 -1
  17. package/dist/asset/assetmanager.js +3 -1
  18. package/dist/asset/assetmanager.js.map +1 -1
  19. package/dist/asset/model.js +346 -7
  20. package/dist/asset/model.js.map +1 -1
  21. package/dist/avatar/wardrobe.js +20 -16
  22. package/dist/avatar/wardrobe.js.map +1 -1
  23. package/dist/camera/camera.js +416 -210
  24. package/dist/camera/camera.js.map +1 -1
  25. package/dist/index.d.ts +1350 -621
  26. package/dist/index.js +6 -11
  27. package/dist/index.js.map +1 -1
  28. package/dist/material/blinn.js +1 -1
  29. package/dist/material/blinn.js.map +1 -1
  30. package/dist/material/lambert.js +1 -1
  31. package/dist/material/lambert.js.map +1 -1
  32. package/dist/material/material.js +23 -1
  33. package/dist/material/material.js.map +1 -1
  34. package/dist/material/meshmaterial.js +178 -23
  35. package/dist/material/meshmaterial.js.map +1 -1
  36. package/dist/material/mixins/albedocolor.js +4 -4
  37. package/dist/material/mixins/albedocolor.js.map +1 -1
  38. package/dist/material/mixins/lightmodel/blinnphong.js +2 -1
  39. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  40. package/dist/material/mixins/lightmodel/lambert.js +2 -1
  41. package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
  42. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +63 -16
  43. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
  44. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +105 -32
  45. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  46. package/dist/material/mixins/lightmodel/pbrspecularglossness.js +16 -6
  47. package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
  48. package/dist/material/mixins/lit.js +1 -1
  49. package/dist/material/mixins/lit.js.map +1 -1
  50. package/dist/material/mixins/pbr/common.js +276 -65
  51. package/dist/material/mixins/pbr/common.js.map +1 -1
  52. package/dist/material/mixins/texture.js +3 -3
  53. package/dist/material/mixins/texture.js.map +1 -1
  54. package/dist/material/mixins/vertexcolor.js +2 -2
  55. package/dist/material/mixins/vertexcolor.js.map +1 -1
  56. package/dist/material/msdf_text.js +3 -3
  57. package/dist/material/msdf_text.js.map +1 -1
  58. package/dist/material/mtoon.js +574 -0
  59. package/dist/material/mtoon.js.map +1 -0
  60. package/dist/material/pbrblueprint.js +499 -336
  61. package/dist/material/pbrblueprint.js.map +1 -1
  62. package/dist/material/pbrmr.js +118 -100
  63. package/dist/material/pbrmr.js.map +1 -1
  64. package/dist/material/pbrsg.js +1 -1
  65. package/dist/material/pbrsg.js.map +1 -1
  66. package/dist/material/shader/helper.js +324 -294
  67. package/dist/material/shader/helper.js.map +1 -1
  68. package/dist/material/subsurfaceprofile.js +812 -0
  69. package/dist/material/subsurfaceprofile.js.map +1 -0
  70. package/dist/material/unlit.js +1 -1
  71. package/dist/material/unlit.js.map +1 -1
  72. package/dist/posteffect/compositor.js +46 -11
  73. package/dist/posteffect/compositor.js.map +1 -1
  74. package/dist/posteffect/ssr.js +422 -96
  75. package/dist/posteffect/ssr.js.map +1 -1
  76. package/dist/posteffect/sss.js +1053 -0
  77. package/dist/posteffect/sss.js.map +1 -0
  78. package/dist/posteffect/taa.js +61 -60
  79. package/dist/posteffect/taa.js.map +1 -1
  80. package/dist/render/abuffer_oit.js +63 -12
  81. package/dist/render/abuffer_oit.js.map +1 -1
  82. package/dist/render/cluster_light.js +6 -5
  83. package/dist/render/cluster_light.js.map +1 -1
  84. package/dist/render/drawable.js +1 -5
  85. package/dist/render/drawable.js.map +1 -1
  86. package/dist/render/drawable_mixin.js +2 -1
  87. package/dist/render/drawable_mixin.js.map +1 -1
  88. package/dist/render/fbm_wavegenerator.js +2 -1
  89. package/dist/render/fbm_wavegenerator.js.map +1 -1
  90. package/dist/render/gerstner_wavegenerator.js +2 -1
  91. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  92. package/dist/render/globalbindgroup_allocator.js +2 -1
  93. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  94. package/dist/render/lightpass.js +110 -23
  95. package/dist/render/lightpass.js.map +1 -1
  96. package/dist/render/render_queue.js +51 -8
  97. package/dist/render/render_queue.js.map +1 -1
  98. package/dist/render/renderer.js +80 -66
  99. package/dist/render/renderer.js.map +1 -1
  100. package/dist/render/rendergraph/device_pool_allocator.js +8 -0
  101. package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
  102. package/dist/render/rendergraph/forward_plus_builder.js +481 -95
  103. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
  104. package/dist/render/rendergraph/history_resource_manager.js +55 -0
  105. package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
  106. package/dist/render/rendergraph/history_resources.js +3 -1
  107. package/dist/render/rendergraph/history_resources.js.map +1 -1
  108. package/dist/render/rendergraph/types.js.map +1 -1
  109. package/dist/render/renderpass.js +10 -4
  110. package/dist/render/renderpass.js.map +1 -1
  111. package/dist/render/sky.js +31 -1
  112. package/dist/render/sky.js.map +1 -1
  113. package/dist/render/weightedblended_oit.js +23 -5
  114. package/dist/render/weightedblended_oit.js.map +1 -1
  115. package/dist/scene/basesprite.js +4 -2
  116. package/dist/scene/basesprite.js.map +1 -1
  117. package/dist/scene/batchgroup.js +3 -1
  118. package/dist/scene/batchgroup.js.map +1 -1
  119. package/dist/scene/environment.js +11 -1
  120. package/dist/scene/environment.js.map +1 -1
  121. package/dist/scene/light.js +21 -3
  122. package/dist/scene/light.js.map +1 -1
  123. package/dist/scene/mesh.js +29 -14
  124. package/dist/scene/mesh.js.map +1 -1
  125. package/dist/scene/meshdrawable.js +6 -0
  126. package/dist/scene/meshdrawable.js.map +1 -1
  127. package/dist/scene/msdftext.js +5 -2
  128. package/dist/scene/msdftext.js.map +1 -1
  129. package/dist/scene/msdftextsprite.js +5 -3
  130. package/dist/scene/msdftextsprite.js.map +1 -1
  131. package/dist/scene/particlesys.js +3 -1
  132. package/dist/scene/particlesys.js.map +1 -1
  133. package/dist/scene/scene.js +6 -5
  134. package/dist/scene/scene.js.map +1 -1
  135. package/dist/scene/terrain-cm/grass.js +4 -2
  136. package/dist/scene/terrain-cm/grass.js.map +1 -1
  137. package/dist/scene/terrain-cm/grassmaterial.js +2 -1
  138. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  139. package/dist/scene/terrain-cm/terrain-cm.js +4 -2
  140. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  141. package/dist/scene/water.js +4 -2
  142. package/dist/scene/water.js.map +1 -1
  143. package/dist/shaders/shadow.js +26 -393
  144. package/dist/shaders/shadow.js.map +1 -1
  145. package/dist/shadow/esm.js +112 -12
  146. package/dist/shadow/esm.js.map +1 -1
  147. package/dist/shadow/pcf_opt.js +2 -2
  148. package/dist/shadow/pcf_opt.js.map +1 -1
  149. package/dist/shadow/pcf_pd.js +19 -10
  150. package/dist/shadow/pcf_pd.js.map +1 -1
  151. package/dist/shadow/shader.js +58 -7
  152. package/dist/shadow/shader.js.map +1 -1
  153. package/dist/shadow/shadow_impl.js +6 -0
  154. package/dist/shadow/shadow_impl.js.map +1 -1
  155. package/dist/shadow/shadow_region.js +229 -0
  156. package/dist/shadow/shadow_region.js.map +1 -0
  157. package/dist/shadow/shadowmapper.js +67 -59
  158. package/dist/shadow/shadowmapper.js.map +1 -1
  159. package/dist/shadow/vsm.js +45 -19
  160. package/dist/shadow/vsm.js.map +1 -1
  161. package/dist/text/font/cff_font.js +890 -0
  162. package/dist/text/font/cff_font.js.map +1 -0
  163. package/dist/text/font/font_asset.js +17 -3
  164. package/dist/text/font/font_asset.js.map +1 -1
  165. package/dist/utility/blueprint/common/constants.js +8 -8
  166. package/dist/utility/blueprint/common/constants.js.map +1 -1
  167. package/dist/utility/blueprint/material/pbr.js +31 -4
  168. package/dist/utility/blueprint/material/pbr.js.map +1 -1
  169. package/dist/utility/blueprint/material/texture.js +1 -17
  170. package/dist/utility/blueprint/material/texture.js.map +1 -1
  171. package/dist/utility/serialization/manager.js +327 -359
  172. package/dist/utility/serialization/manager.js.map +1 -1
  173. package/dist/utility/serialization/scene/animation.js +5 -2
  174. package/dist/utility/serialization/scene/animation.js.map +1 -1
  175. package/dist/utility/serialization/scene/batch.js +4 -1
  176. package/dist/utility/serialization/scene/batch.js.map +1 -1
  177. package/dist/utility/serialization/scene/camera.js +249 -54
  178. package/dist/utility/serialization/scene/camera.js.map +1 -1
  179. package/dist/utility/serialization/scene/common.js +37 -1
  180. package/dist/utility/serialization/scene/common.js.map +1 -1
  181. package/dist/utility/serialization/scene/light.js +42 -3
  182. package/dist/utility/serialization/scene/light.js.map +1 -1
  183. package/dist/utility/serialization/scene/material.js +1112 -646
  184. package/dist/utility/serialization/scene/material.js.map +1 -1
  185. package/dist/utility/serialization/scene/mesh.js +7 -4
  186. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  187. package/dist/utility/serialization/scene/node.js +31 -12
  188. package/dist/utility/serialization/scene/node.js.map +1 -1
  189. package/dist/utility/serialization/scene/particle.js +4 -1
  190. package/dist/utility/serialization/scene/particle.js.map +1 -1
  191. package/dist/utility/serialization/scene/primitive.js +3 -1
  192. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  193. package/dist/utility/serialization/scene/scene.js +18 -0
  194. package/dist/utility/serialization/scene/scene.js.map +1 -1
  195. package/dist/utility/serialization/scene/sprite.js +6 -3
  196. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  197. package/dist/utility/serialization/scene/terrain.js +5 -2
  198. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  199. package/dist/utility/serialization/scene/text.js +3 -1
  200. package/dist/utility/serialization/scene/text.js.map +1 -1
  201. package/dist/utility/serialization/scene/water.js +4 -1
  202. package/dist/utility/serialization/scene/water.js.map +1 -1
  203. package/dist/utility/textures/ltcdata.js +6 -0
  204. package/dist/utility/textures/ltcdata.js.map +1 -0
  205. package/dist/utility/textures/ltclut.js +61 -0
  206. package/dist/utility/textures/ltclut.js.map +1 -0
  207. package/dist/values.js +9 -1
  208. package/dist/values.js.map +1 -1
  209. package/package.json +3 -3
  210. package/dist/animation/ik/ik_chain_builder.js +0 -68
  211. package/dist/animation/ik/ik_chain_builder.js.map +0 -1
  212. package/dist/animation/ik/ik_pole_constraint.js +0 -123
  213. package/dist/animation/ik/ik_pole_constraint.js.map +0 -1
  214. package/dist/animation/ik/ik_track.js +0 -96
  215. package/dist/animation/ik/ik_track.js.map +0 -1
  216. package/dist/animation/ik_postprocessor.js +0 -71
  217. package/dist/animation/ik_postprocessor.js.map +0 -1
  218. package/dist/animation/joint_dynamics/math.js +0 -16
  219. package/dist/animation/joint_dynamics/math.js.map +0 -1
  220. package/dist/animation/manual_transform_processor.js +0 -156
  221. package/dist/animation/manual_transform_processor.js.map +0 -1
  222. package/dist/animation/skeleton_postprocessor.js +0 -50
  223. package/dist/animation/skeleton_postprocessor.js.map +0 -1
  224. package/dist/animation/spring2/collision.js +0 -469
  225. package/dist/animation/spring2/collision.js.map +0 -1
  226. package/dist/animation/spring2/constraints.js +0 -329
  227. package/dist/animation/spring2/constraints.js.map +0 -1
  228. package/dist/animation/spring2/controller.js +0 -434
  229. package/dist/animation/spring2/controller.js.map +0 -1
  230. package/dist/animation/spring2/math.js +0 -16
  231. package/dist/animation/spring2/math.js.map +0 -1
  232. package/dist/animation/spring2/solver.js +0 -624
  233. package/dist/animation/spring2/solver.js.map +0 -1
  234. package/dist/animation/spring2/spring_system.js +0 -118
  235. package/dist/animation/spring2/spring_system.js.map +0 -1
  236. package/dist/animation/spring2/types.js +0 -19
  237. package/dist/animation/spring2/types.js.map +0 -1
  238. package/dist/animation/spring_postprocessor.js +0 -54
  239. package/dist/animation/spring_postprocessor.js.map +0 -1
  240. package/dist/asset/loaders/gltf/gltf_loader.js +0 -1276
  241. package/dist/asset/loaders/gltf/gltf_loader.js.map +0 -1
  242. package/dist/asset/loaders/gltf/helpers.js +0 -331
  243. package/dist/asset/loaders/gltf/helpers.js.map +0 -1
  244. package/dist/material/sprite3d.js +0 -301
  245. package/dist/material/sprite3d.js.map +0 -1
  246. package/dist/material/sprite3d_std.js +0 -116
  247. package/dist/material/sprite3d_std.js.map +0 -1
  248. package/dist/material/sprite3dblueprint.js +0 -235
  249. package/dist/material/sprite3dblueprint.js.map +0 -1
  250. package/dist/material/sprite_sdf.js +0 -106
  251. package/dist/material/sprite_sdf.js.map +0 -1
  252. package/dist/material/terrainmaterial.js +0 -368
  253. package/dist/material/terrainmaterial.js.map +0 -1
  254. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
  255. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
  256. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
  257. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
  258. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
  259. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
  260. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
  261. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
  262. package/dist/render/deferredlightpass.js +0 -510
  263. package/dist/render/deferredlightpass.js.map +0 -1
  264. package/dist/render/deferredshadowlightpass.js +0 -428
  265. package/dist/render/deferredshadowlightpass.js.map +0 -1
  266. package/dist/render/gbufferpass.js +0 -50
  267. package/dist/render/gbufferpass.js.map +0 -1
  268. package/dist/scene/sdftextsprite.js +0 -322
  269. package/dist/scene/sdftextsprite.js.map +0 -1
  270. package/dist/scene/sprite3d.js +0 -18
  271. package/dist/scene/sprite3d.js.map +0 -1
  272. package/dist/scene/terrain/grass.js +0 -280
  273. package/dist/scene/terrain/grass.js.map +0 -1
  274. package/dist/scene/terrain/heightfield.js +0 -475
  275. package/dist/scene/terrain/heightfield.js.map +0 -1
  276. package/dist/scene/terrain/patch.js +0 -532
  277. package/dist/scene/terrain/patch.js.map +0 -1
  278. package/dist/scene/terrain/quadtree.js +0 -461
  279. package/dist/scene/terrain/quadtree.js.map +0 -1
  280. package/dist/scene/terrain/terrain.js +0 -231
  281. package/dist/scene/terrain/terrain.js.map +0 -1
  282. package/dist/src/animation/animation.js +0 -127
  283. package/dist/src/animation/animation.js.map +0 -1
  284. package/dist/src/animation/animationset.js +0 -255
  285. package/dist/src/animation/animationset.js.map +0 -1
  286. package/dist/src/animation/animationtrack.js +0 -34
  287. package/dist/src/animation/animationtrack.js.map +0 -1
  288. package/dist/src/animation/eulerrotationtrack.js +0 -52
  289. package/dist/src/animation/eulerrotationtrack.js.map +0 -1
  290. package/dist/src/animation/morphtarget.js +0 -93
  291. package/dist/src/animation/morphtarget.js.map +0 -1
  292. package/dist/src/animation/morphtrack.js +0 -70
  293. package/dist/src/animation/morphtrack.js.map +0 -1
  294. package/dist/src/animation/proptrack.js +0 -161
  295. package/dist/src/animation/proptrack.js.map +0 -1
  296. package/dist/src/animation/rotationtrack.js +0 -51
  297. package/dist/src/animation/rotationtrack.js.map +0 -1
  298. package/dist/src/animation/scaletrack.js +0 -50
  299. package/dist/src/animation/scaletrack.js.map +0 -1
  300. package/dist/src/animation/skeleton.js +0 -204
  301. package/dist/src/animation/skeleton.js.map +0 -1
  302. package/dist/src/animation/translationtrack.js +0 -50
  303. package/dist/src/animation/translationtrack.js.map +0 -1
  304. package/dist/src/app/app.js +0 -129
  305. package/dist/src/app/app.js.map +0 -1
  306. package/dist/src/app/inputmgr.js +0 -267
  307. package/dist/src/app/inputmgr.js.map +0 -1
  308. package/dist/src/asset/assetmanager.js +0 -404
  309. package/dist/src/asset/assetmanager.js.map +0 -1
  310. package/dist/src/asset/builtin.js +0 -337
  311. package/dist/src/asset/builtin.js.map +0 -1
  312. package/dist/src/asset/loaders/dds/dds.js +0 -470
  313. package/dist/src/asset/loaders/dds/dds.js.map +0 -1
  314. package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
  315. package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
  316. package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
  317. package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
  318. package/dist/src/asset/loaders/gltf/helpers.js +0 -327
  319. package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
  320. package/dist/src/asset/loaders/hdr/hdr.js +0 -180
  321. package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
  322. package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
  323. package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
  324. package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
  325. package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
  326. package/dist/src/asset/loaders/loader.js +0 -45
  327. package/dist/src/asset/loaders/loader.js.map +0 -1
  328. package/dist/src/asset/model.js +0 -414
  329. package/dist/src/asset/model.js.map +0 -1
  330. package/dist/src/blitter/bilateralblur.js +0 -221
  331. package/dist/src/blitter/bilateralblur.js.map +0 -1
  332. package/dist/src/blitter/blitter.js +0 -390
  333. package/dist/src/blitter/blitter.js.map +0 -1
  334. package/dist/src/blitter/box.js +0 -118
  335. package/dist/src/blitter/box.js.map +0 -1
  336. package/dist/src/blitter/copy.js +0 -22
  337. package/dist/src/blitter/copy.js.map +0 -1
  338. package/dist/src/blitter/gaussianblur.js +0 -228
  339. package/dist/src/blitter/gaussianblur.js.map +0 -1
  340. package/dist/src/camera/base.js +0 -92
  341. package/dist/src/camera/base.js.map +0 -1
  342. package/dist/src/camera/camera.js +0 -1005
  343. package/dist/src/camera/camera.js.map +0 -1
  344. package/dist/src/camera/fps.js +0 -238
  345. package/dist/src/camera/fps.js.map +0 -1
  346. package/dist/src/camera/orbit.js +0 -245
  347. package/dist/src/camera/orbit.js.map +0 -1
  348. package/dist/src/camera/orthocamera.js +0 -167
  349. package/dist/src/camera/orthocamera.js.map +0 -1
  350. package/dist/src/camera/perspectivecamera.js +0 -141
  351. package/dist/src/camera/perspectivecamera.js.map +0 -1
  352. package/dist/src/index.js +0 -120
  353. package/dist/src/index.js.map +0 -1
  354. package/dist/src/material/blinn.js +0 -81
  355. package/dist/src/material/blinn.js.map +0 -1
  356. package/dist/src/material/grassmaterial.js +0 -113
  357. package/dist/src/material/grassmaterial.js.map +0 -1
  358. package/dist/src/material/lambert.js +0 -92
  359. package/dist/src/material/lambert.js.map +0 -1
  360. package/dist/src/material/material.js +0 -301
  361. package/dist/src/material/material.js.map +0 -1
  362. package/dist/src/material/meshmaterial.js +0 -704
  363. package/dist/src/material/meshmaterial.js.map +0 -1
  364. package/dist/src/material/mixins/albedocolor.js +0 -76
  365. package/dist/src/material/mixins/albedocolor.js.map +0 -1
  366. package/dist/src/material/mixins/foliage.js +0 -47
  367. package/dist/src/material/mixins/foliage.js.map +0 -1
  368. package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
  369. package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
  370. package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
  371. package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
  372. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
  373. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
  374. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
  375. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
  376. package/dist/src/material/mixins/lit.js +0 -476
  377. package/dist/src/material/mixins/lit.js.map +0 -1
  378. package/dist/src/material/mixins/pbr/common.js +0 -918
  379. package/dist/src/material/mixins/pbr/common.js.map +0 -1
  380. package/dist/src/material/mixins/texture.js +0 -172
  381. package/dist/src/material/mixins/texture.js.map +0 -1
  382. package/dist/src/material/mixins/vertexcolor.js +0 -56
  383. package/dist/src/material/mixins/vertexcolor.js.map +0 -1
  384. package/dist/src/material/particle.js +0 -178
  385. package/dist/src/material/particle.js.map +0 -1
  386. package/dist/src/material/pbrmr.js +0 -97
  387. package/dist/src/material/pbrmr.js.map +0 -1
  388. package/dist/src/material/pbrsg.js +0 -97
  389. package/dist/src/material/pbrsg.js.map +0 -1
  390. package/dist/src/material/shader/helper.js +0 -1209
  391. package/dist/src/material/shader/helper.js.map +0 -1
  392. package/dist/src/material/terrain-cm.js +0 -606
  393. package/dist/src/material/terrain-cm.js.map +0 -1
  394. package/dist/src/material/terrainmaterial.js +0 -375
  395. package/dist/src/material/terrainmaterial.js.map +0 -1
  396. package/dist/src/material/unlit.js +0 -41
  397. package/dist/src/material/unlit.js.map +0 -1
  398. package/dist/src/material/water.js +0 -417
  399. package/dist/src/material/water.js.map +0 -1
  400. package/dist/src/posteffect/bloom.js +0 -361
  401. package/dist/src/posteffect/bloom.js.map +0 -1
  402. package/dist/src/posteffect/compositor.js +0 -226
  403. package/dist/src/posteffect/compositor.js.map +0 -1
  404. package/dist/src/posteffect/fxaa.js +0 -273
  405. package/dist/src/posteffect/fxaa.js.map +0 -1
  406. package/dist/src/posteffect/grayscale.js +0 -69
  407. package/dist/src/posteffect/grayscale.js.map +0 -1
  408. package/dist/src/posteffect/motionblur.js +0 -96
  409. package/dist/src/posteffect/motionblur.js.map +0 -1
  410. package/dist/src/posteffect/posteffect.js +0 -126
  411. package/dist/src/posteffect/posteffect.js.map +0 -1
  412. package/dist/src/posteffect/sao.js +0 -324
  413. package/dist/src/posteffect/sao.js.map +0 -1
  414. package/dist/src/posteffect/ssr.js +0 -489
  415. package/dist/src/posteffect/ssr.js.map +0 -1
  416. package/dist/src/posteffect/taa.js +0 -172
  417. package/dist/src/posteffect/taa.js.map +0 -1
  418. package/dist/src/posteffect/tonemap.js +0 -94
  419. package/dist/src/posteffect/tonemap.js.map +0 -1
  420. package/dist/src/render/abuffer_oit.js +0 -361
  421. package/dist/src/render/abuffer_oit.js.map +0 -1
  422. package/dist/src/render/clipmap.js +0 -851
  423. package/dist/src/render/clipmap.js.map +0 -1
  424. package/dist/src/render/cluster_light.js +0 -333
  425. package/dist/src/render/cluster_light.js.map +0 -1
  426. package/dist/src/render/cull_visitor.js +0 -187
  427. package/dist/src/render/cull_visitor.js.map +0 -1
  428. package/dist/src/render/depthpass.js +0 -68
  429. package/dist/src/render/depthpass.js.map +0 -1
  430. package/dist/src/render/drawable_mixin.js +0 -227
  431. package/dist/src/render/drawable_mixin.js.map +0 -1
  432. package/dist/src/render/envlight.js +0 -463
  433. package/dist/src/render/envlight.js.map +0 -1
  434. package/dist/src/render/fbm_wavegenerator.js +0 -251
  435. package/dist/src/render/fbm_wavegenerator.js.map +0 -1
  436. package/dist/src/render/fft_wavegenerator.js +0 -1006
  437. package/dist/src/render/fft_wavegenerator.js.map +0 -1
  438. package/dist/src/render/fullscreenquad.js +0 -38
  439. package/dist/src/render/fullscreenquad.js.map +0 -1
  440. package/dist/src/render/gerstner_wavegenerator.js +0 -314
  441. package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
  442. package/dist/src/render/globalbindgroup_allocator.js +0 -60
  443. package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
  444. package/dist/src/render/hzb.js +0 -273
  445. package/dist/src/render/hzb.js.map +0 -1
  446. package/dist/src/render/lightpass.js +0 -172
  447. package/dist/src/render/lightpass.js.map +0 -1
  448. package/dist/src/render/objectcolorpass.js +0 -51
  449. package/dist/src/render/objectcolorpass.js.map +0 -1
  450. package/dist/src/render/primitive.js +0 -364
  451. package/dist/src/render/primitive.js.map +0 -1
  452. package/dist/src/render/render_queue.js +0 -467
  453. package/dist/src/render/render_queue.js.map +0 -1
  454. package/dist/src/render/renderbundle_wrapper.js +0 -152
  455. package/dist/src/render/renderbundle_wrapper.js.map +0 -1
  456. package/dist/src/render/renderer.js +0 -455
  457. package/dist/src/render/renderer.js.map +0 -1
  458. package/dist/src/render/renderpass.js +0 -200
  459. package/dist/src/render/renderpass.js.map +0 -1
  460. package/dist/src/render/shadowmap_pass.js +0 -56
  461. package/dist/src/render/shadowmap_pass.js.map +0 -1
  462. package/dist/src/render/sky.js +0 -1103
  463. package/dist/src/render/sky.js.map +0 -1
  464. package/dist/src/render/weightedblended_oit.js +0 -168
  465. package/dist/src/render/weightedblended_oit.js.map +0 -1
  466. package/dist/src/scene/batchgroup.js +0 -162
  467. package/dist/src/scene/batchgroup.js.map +0 -1
  468. package/dist/src/scene/environment.js +0 -209
  469. package/dist/src/scene/environment.js.map +0 -1
  470. package/dist/src/scene/graph_node.js +0 -72
  471. package/dist/src/scene/graph_node.js.map +0 -1
  472. package/dist/src/scene/light.js +0 -416
  473. package/dist/src/scene/light.js.map +0 -1
  474. package/dist/src/scene/mesh.js +0 -341
  475. package/dist/src/scene/mesh.js.map +0 -1
  476. package/dist/src/scene/octree.js +0 -649
  477. package/dist/src/scene/octree.js.map +0 -1
  478. package/dist/src/scene/particlesys.js +0 -738
  479. package/dist/src/scene/particlesys.js.map +0 -1
  480. package/dist/src/scene/raycast_visitor.js +0 -103
  481. package/dist/src/scene/raycast_visitor.js.map +0 -1
  482. package/dist/src/scene/scene.js +0 -284
  483. package/dist/src/scene/scene.js.map +0 -1
  484. package/dist/src/scene/scene_node.js +0 -732
  485. package/dist/src/scene/scene_node.js.map +0 -1
  486. package/dist/src/scene/terrain/grass.js +0 -278
  487. package/dist/src/scene/terrain/grass.js.map +0 -1
  488. package/dist/src/scene/terrain/heightfield.js +0 -475
  489. package/dist/src/scene/terrain/heightfield.js.map +0 -1
  490. package/dist/src/scene/terrain/patch.js +0 -530
  491. package/dist/src/scene/terrain/patch.js.map +0 -1
  492. package/dist/src/scene/terrain/quadtree.js +0 -461
  493. package/dist/src/scene/terrain/quadtree.js.map +0 -1
  494. package/dist/src/scene/terrain/terrain.js +0 -246
  495. package/dist/src/scene/terrain/terrain.js.map +0 -1
  496. package/dist/src/scene/terrain-cm/grass.js +0 -594
  497. package/dist/src/scene/terrain-cm/grass.js.map +0 -1
  498. package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
  499. package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
  500. package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
  501. package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
  502. package/dist/src/scene/water.js +0 -374
  503. package/dist/src/scene/water.js.map +0 -1
  504. package/dist/src/shaders/atmosphere.js +0 -957
  505. package/dist/src/shaders/atmosphere.js.map +0 -1
  506. package/dist/src/shaders/fog.js +0 -112
  507. package/dist/src/shaders/fog.js.map +0 -1
  508. package/dist/src/shaders/misc.js +0 -266
  509. package/dist/src/shaders/misc.js.map +0 -1
  510. package/dist/src/shaders/noise.js +0 -222
  511. package/dist/src/shaders/noise.js.map +0 -1
  512. package/dist/src/shaders/pbr.js +0 -51
  513. package/dist/src/shaders/pbr.js.map +0 -1
  514. package/dist/src/shaders/shadow.js +0 -636
  515. package/dist/src/shaders/shadow.js.map +0 -1
  516. package/dist/src/shaders/ssr.js +0 -490
  517. package/dist/src/shaders/ssr.js.map +0 -1
  518. package/dist/src/shaders/temporal.js +0 -215
  519. package/dist/src/shaders/temporal.js.map +0 -1
  520. package/dist/src/shaders/water.js +0 -756
  521. package/dist/src/shaders/water.js.map +0 -1
  522. package/dist/src/shadow/esm.js +0 -237
  523. package/dist/src/shadow/esm.js.map +0 -1
  524. package/dist/src/shadow/pcf_opt.js +0 -181
  525. package/dist/src/shadow/pcf_opt.js.map +0 -1
  526. package/dist/src/shadow/pcf_pd.js +0 -189
  527. package/dist/src/shadow/pcf_pd.js.map +0 -1
  528. package/dist/src/shadow/shader.js +0 -37
  529. package/dist/src/shadow/shader.js.map +0 -1
  530. package/dist/src/shadow/shadow_impl.js +0 -15
  531. package/dist/src/shadow/shadow_impl.js.map +0 -1
  532. package/dist/src/shadow/shadowmapper.js +0 -790
  533. package/dist/src/shadow/shadowmapper.js.map +0 -1
  534. package/dist/src/shadow/ssm.js +0 -159
  535. package/dist/src/shadow/ssm.js.map +0 -1
  536. package/dist/src/shadow/vsm.js +0 -297
  537. package/dist/src/shadow/vsm.js.map +0 -1
  538. package/dist/src/shapes/box.js +0 -386
  539. package/dist/src/shapes/box.js.map +0 -1
  540. package/dist/src/shapes/cylinder.js +0 -125
  541. package/dist/src/shapes/cylinder.js.map +0 -1
  542. package/dist/src/shapes/plane.js +0 -88
  543. package/dist/src/shapes/plane.js.map +0 -1
  544. package/dist/src/shapes/shape.js +0 -87
  545. package/dist/src/shapes/shape.js.map +0 -1
  546. package/dist/src/shapes/sphere.js +0 -114
  547. package/dist/src/shapes/sphere.js.map +0 -1
  548. package/dist/src/shapes/tetrahedron.js +0 -188
  549. package/dist/src/shapes/tetrahedron.js.map +0 -1
  550. package/dist/src/shapes/torus.js +0 -111
  551. package/dist/src/shapes/torus.js.map +0 -1
  552. package/dist/src/utility/aabbtree.js +0 -400
  553. package/dist/src/utility/aabbtree.js.map +0 -1
  554. package/dist/src/utility/bounding_volume.js +0 -29
  555. package/dist/src/utility/bounding_volume.js.map +0 -1
  556. package/dist/src/utility/debug.js +0 -28
  557. package/dist/src/utility/debug.js.map +0 -1
  558. package/dist/src/utility/draco/decoder.js +0 -116
  559. package/dist/src/utility/draco/decoder.js.map +0 -1
  560. package/dist/src/utility/misc.js +0 -105
  561. package/dist/src/utility/misc.js.map +0 -1
  562. package/dist/src/utility/panorama.js +0 -163
  563. package/dist/src/utility/panorama.js.map +0 -1
  564. package/dist/src/utility/pmrem.js +0 -354
  565. package/dist/src/utility/pmrem.js.map +0 -1
  566. package/dist/src/utility/rendermipmap.js +0 -115
  567. package/dist/src/utility/rendermipmap.js.map +0 -1
  568. package/dist/src/utility/serialization/json.js +0 -402
  569. package/dist/src/utility/serialization/json.js.map +0 -1
  570. package/dist/src/utility/serialization/manager.js +0 -623
  571. package/dist/src/utility/serialization/manager.js.map +0 -1
  572. package/dist/src/utility/serialization/scene/animation.js +0 -248
  573. package/dist/src/utility/serialization/scene/animation.js.map +0 -1
  574. package/dist/src/utility/serialization/scene/batch.js +0 -59
  575. package/dist/src/utility/serialization/scene/batch.js.map +0 -1
  576. package/dist/src/utility/serialization/scene/camera.js +0 -790
  577. package/dist/src/utility/serialization/scene/camera.js.map +0 -1
  578. package/dist/src/utility/serialization/scene/common.js +0 -222
  579. package/dist/src/utility/serialization/scene/common.js.map +0 -1
  580. package/dist/src/utility/serialization/scene/light.js +0 -575
  581. package/dist/src/utility/serialization/scene/light.js.map +0 -1
  582. package/dist/src/utility/serialization/scene/material.js +0 -1111
  583. package/dist/src/utility/serialization/scene/material.js.map +0 -1
  584. package/dist/src/utility/serialization/scene/mesh.js +0 -148
  585. package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
  586. package/dist/src/utility/serialization/scene/misc.js +0 -39
  587. package/dist/src/utility/serialization/scene/misc.js.map +0 -1
  588. package/dist/src/utility/serialization/scene/node.js +0 -451
  589. package/dist/src/utility/serialization/scene/node.js.map +0 -1
  590. package/dist/src/utility/serialization/scene/particle.js +0 -425
  591. package/dist/src/utility/serialization/scene/particle.js.map +0 -1
  592. package/dist/src/utility/serialization/scene/primitive.js +0 -692
  593. package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
  594. package/dist/src/utility/serialization/scene/scene.js +0 -704
  595. package/dist/src/utility/serialization/scene/scene.js.map +0 -1
  596. package/dist/src/utility/serialization/scene/terrain.js +0 -488
  597. package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
  598. package/dist/src/utility/serialization/scene/water.js +0 -465
  599. package/dist/src/utility/serialization/scene/water.js.map +0 -1
  600. package/dist/src/utility/shprojector.js +0 -297
  601. package/dist/src/utility/shprojector.js.map +0 -1
  602. package/dist/src/utility/textures/ggxlut.js +0 -213
  603. package/dist/src/utility/textures/ggxlut.js.map +0 -1
  604. package/dist/src/utility/textures/gradientnoise.js +0 -62
  605. package/dist/src/utility/textures/gradientnoise.js.map +0 -1
  606. package/dist/src/utility/textures/randomnoise.js +0 -41
  607. package/dist/src/utility/textures/randomnoise.js.map +0 -1
  608. package/dist/src/values.js +0 -162
  609. package/dist/src/values.js.map +0 -1
  610. package/dist/utility/blueprint/material/common.js +0 -7
  611. package/dist/utility/blueprint/material/common.js.map +0 -1
  612. package/dist/utility/serialization/blueprint/constants.js +0 -255
  613. package/dist/utility/serialization/blueprint/constants.js.map +0 -1
  614. package/dist/utility/serialization/blueprint/material/constants.js +0 -203
  615. package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
  616. package/dist/utility/serialization/blueprint/material/texture.js +0 -165
  617. package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
  618. package/dist/utility/serialization/scene/cloth_script.js +0 -834
  619. package/dist/utility/serialization/scene/cloth_script.js.map +0 -1
  620. package/dist/utility/serialization/scene/spring_script.js +0 -596
  621. package/dist/utility/serialization/scene/spring_script.js.map +0 -1
@@ -1,1005 +0,0 @@
1
- import { halton23, Matrix4x4, DRef, Vector4, Vector2, Plane, Vector3, Ray, Frustum } from '@zephyr3d/base';
2
- import { SceneNode } from '../scene/scene_node.js';
3
- import { Application } from '../app/app.js';
4
- import { Compositor } from '../posteffect/compositor.js';
5
- import { TAA } from '../posteffect/taa.js';
6
- import { SSR } from '../posteffect/ssr.js';
7
- import { Tonemap } from '../posteffect/tonemap.js';
8
- import { FXAA } from '../posteffect/fxaa.js';
9
- import { Bloom } from '../posteffect/bloom.js';
10
- import { SAO } from '../posteffect/sao.js';
11
- import { MotionBlur } from '../posteffect/motionblur.js';
12
-
13
- /**
14
- * The camera node class
15
- * @public
16
- */ class Camera extends SceneNode {
17
- /** @internal */ static _halton23 = halton23(16);
18
- /** @internal */ static _historyData = new WeakMap();
19
- /** @internal */ _projMatrix;
20
- /** @internal */ _invProjMatrix;
21
- /** @internal */ _viewMatrix;
22
- /** @internal */ _viewProjMatrix;
23
- /** @internal */ _rotationMatrix;
24
- /** @internal */ _invViewProjMatrix;
25
- /** @internal */ _clipPlane;
26
- /** @internal */ _controller;
27
- /** @internal */ _frustum;
28
- /** @internal */ _frustumV;
29
- /** @internal */ _dirty;
30
- /** @internal */ _viewport;
31
- /** @internal */ _scissor;
32
- /** @internal */ _clipMask;
33
- /** @internal */ _oit;
34
- /** @internal */ _depthPrePass;
35
- /** @internal */ _commandBufferReuse;
36
- /** @internal */ _HiZ;
37
- /** @internal */ _toneMap;
38
- /** @internal */ _postEffectTonemap;
39
- /** @internal */ _tonemapExposure;
40
- /** @internal */ _motionBlur;
41
- /** @internal */ _postEffectMotionBlur;
42
- /** @internal */ _motionBlurStrength;
43
- /** @internal */ _bloom;
44
- /** @internal */ _postEffectBloom;
45
- /** @internal */ _bloomMaxDownsampleLevels;
46
- /** @internal */ _bloomDownsampleLimit;
47
- /** @internal */ _bloomThreshold;
48
- /** @internal */ _bloomThresholdKnee;
49
- /** @internal */ _bloomIntensity;
50
- /** @internal */ _FXAA;
51
- /** @internal */ _postEffectFXAA;
52
- /** @internal */ _TAA;
53
- /** @internal */ _postEffectTAA;
54
- /** @internal */ _TAADebug;
55
- /** @internal */ _SSR;
56
- /** @internal */ _postEffectSSR;
57
- /** @internal */ _ssrParams;
58
- /** @internal */ _ssrMaxRoughness;
59
- /** @internal */ _ssrRoughnessFactor;
60
- /** @internal */ _ssrStride;
61
- /** @internal */ _ssrCalcThickness;
62
- /** @internal */ _ssrBlurriness;
63
- /** @internal */ _ssrBlurDepthCutoff;
64
- /** @internal */ _ssrBlurKernelSize;
65
- /** @internal */ _ssrBlurStdDev;
66
- /** @internal */ _SSAO;
67
- /** @internal */ _postEffectSSAO;
68
- /** @internal */ _SSAOScale;
69
- /** @internal */ _SSAOBias;
70
- /** @internal */ _SSAORadius;
71
- /** @internal */ _SSAOIntensity;
72
- /** @internal */ _SSAOBlurDepthCutoff;
73
- /** @internal */ _pickResultPromise;
74
- /** @internal */ _pickResultResolve;
75
- /** @internal */ _pickPosX;
76
- /** @internal */ _pickPosY;
77
- /** @internal */ _pickResult;
78
- /** @internal */ _jitterValue;
79
- /** @internal */ _prevJitterValue;
80
- /** @internal */ _jitteredVPMatrix;
81
- /** @internal */ _jitteredInvVPMatrix;
82
- /** @internal */ _prevVPMatrix;
83
- /** @internal */ _prevPosition;
84
- /** @internal */ _prevJitteredVPMatrix;
85
- /** @internal */ _compositor;
86
- /**
87
- * Creates a new camera node
88
- *
89
- * @param scene - The scene that the camera belongs to
90
- * @param projectionMatrix - Projection matrix for this camera
91
- */ constructor(scene, projectionMatrix){
92
- super(scene);
93
- this._projMatrix = projectionMatrix || Matrix4x4.identity();
94
- this._invProjMatrix = Matrix4x4.invert(this._projMatrix);
95
- this._viewMatrix = Matrix4x4.identity();
96
- this._viewProjMatrix = Matrix4x4.identity();
97
- this._invViewProjMatrix = Matrix4x4.identity();
98
- this._clipPlane = null;
99
- this._dirty = true;
100
- this._controller = null;
101
- this._viewport = null;
102
- this._scissor = null;
103
- this._clipMask = 0;
104
- this._frustum = null;
105
- this._frustumV = null;
106
- this._oit = new DRef();
107
- this._depthPrePass = false;
108
- this._HiZ = false;
109
- this._toneMap = true;
110
- this._postEffectTonemap = new DRef();
111
- this._tonemapExposure = 1;
112
- this._motionBlur = false;
113
- this._postEffectMotionBlur = new DRef();
114
- this._motionBlurStrength = 1;
115
- this._bloom = false;
116
- this._postEffectBloom = new DRef();
117
- this._bloomMaxDownsampleLevels = 4;
118
- this._bloomDownsampleLimit = 32;
119
- this._bloomThreshold = 0.8;
120
- this._bloomThresholdKnee = 0;
121
- this._bloomIntensity = 1;
122
- this._FXAA = false;
123
- this._postEffectFXAA = new DRef();
124
- this._TAA = false;
125
- this._postEffectTAA = new DRef();
126
- this._TAADebug = 0;
127
- this._SSR = false;
128
- this._postEffectSSR = new DRef();
129
- this._ssrParams = new Vector4(100, 120, 0.5, 0);
130
- this._ssrMaxRoughness = 0.8;
131
- this._ssrRoughnessFactor = 1;
132
- this._ssrStride = 2;
133
- this._ssrCalcThickness = false;
134
- this._ssrBlurriness = 0.05;
135
- this._ssrBlurDepthCutoff = 2;
136
- this._ssrBlurKernelSize = 17;
137
- this._ssrBlurStdDev = 10;
138
- this._SSAO = false;
139
- this._postEffectSSAO = new DRef();
140
- this._SSAOScale = 10;
141
- this._SSAOBias = 1;
142
- this._SSAOIntensity = 0.025;
143
- this._SSAORadius = 100;
144
- this._SSAOBlurDepthCutoff = 2;
145
- this._pickResult = null;
146
- this._commandBufferReuse = true;
147
- this._jitteredVPMatrix = new Matrix4x4();
148
- this._jitteredInvVPMatrix = new Matrix4x4();
149
- this._jitterValue = new Vector2(0, 0);
150
- this._prevVPMatrix = null;
151
- this._prevPosition = null;
152
- this._prevJitteredVPMatrix = null;
153
- this._prevJitterValue = null;
154
- this._pickResultPromise = null;
155
- this._pickResultResolve = null;
156
- this._pickPosX = 0;
157
- this._pickPosY = 0;
158
- this._compositor = new Compositor();
159
- this.updatePostProcessing();
160
- }
161
- clone(method, recursive) {
162
- const other = new Camera(this.scene);
163
- other.copyFrom(this, method, recursive);
164
- other.parent = this.parent;
165
- return other;
166
- }
167
- copyFrom(other, method, recursive) {
168
- super.copyFrom(other, method, recursive);
169
- this.clipPlane = other.clipPlane ? new Plane(other.clipPlane) : null;
170
- this.HiZ = other.HiZ;
171
- this.toneMap = other.toneMap;
172
- this.toneMapExposure = other.toneMapExposure;
173
- this.bloom = other.bloom;
174
- this.FXAA = other.FXAA;
175
- this.TAA = other.TAA;
176
- this.TAADebug = other.TAADebug;
177
- this.SSR = other.SSR;
178
- this.ssrMaxRoughness = other.ssrMaxRoughness;
179
- this.ssrRoughnessFactor = other.ssrRoughnessFactor;
180
- this.ssrStride = other.ssrStride;
181
- this.ssrMaxDistance = other.ssrMaxDistance;
182
- this.ssrIterations = other.ssrIterations;
183
- this.ssrThickness = other.ssrThickness;
184
- this.ssrCalcThickness = other.ssrCalcThickness;
185
- this.ssrBlurScale = other.ssrBlurScale;
186
- this.ssrBlurDepthCutoff = other.ssrBlurDepthCutoff;
187
- this.ssrBlurKernelSize = other.ssrBlurKernelSize;
188
- this.depthPrePass = other.depthPrePass;
189
- this.commandBufferReuse = other.commandBufferReuse;
190
- this.oit = other.oit;
191
- this.clipMask = other.clipMask;
192
- this.viewport = other.viewport?.slice() ?? null;
193
- this.scissor = other.scissor?.slice() ?? null;
194
- this.setProjectionMatrix(other.getProjectionMatrix());
195
- }
196
- /** Compositor */ get compositor() {
197
- return this._compositor;
198
- }
199
- /** Clip plane in camera space */ get clipPlane() {
200
- return this._clipPlane;
201
- }
202
- set clipPlane(plane) {
203
- this._clipPlane = plane;
204
- this._invalidate(false);
205
- }
206
- /**
207
- * Gets whether Hi-Z acceleration is enabled.
208
- * When enabled, it can significantly improve SSR performance with minimal quality impact.
209
- */ get HiZ() {
210
- return this._HiZ;
211
- }
212
- set HiZ(val) {
213
- this._HiZ = !!val;
214
- }
215
- /**
216
- * Gets whether Tonemap is enabled.
217
- */ get toneMap() {
218
- return this._postEffectTonemap.get().enabled;
219
- }
220
- set toneMap(val) {
221
- this._postEffectTonemap.get().enabled = !!val;
222
- }
223
- /**
224
- * Gets whether motion blur is enabled
225
- */ get motionBlur() {
226
- return this._postEffectMotionBlur.get().enabled;
227
- }
228
- set motionBlur(val) {
229
- this._postEffectMotionBlur.get().enabled = !!val;
230
- }
231
- /** Motion blur strength */ get motionBlurStrength() {
232
- return this._motionBlurStrength;
233
- }
234
- set motionBlurStrength(val) {
235
- this._motionBlurStrength = val;
236
- if (this._postEffectMotionBlur.get()) {
237
- this._postEffectMotionBlur.get().strength = this._motionBlurStrength;
238
- }
239
- }
240
- /**
241
- * Gets whether Bloom is enabled.
242
- */ get bloom() {
243
- return this._postEffectBloom.get().enabled;
244
- }
245
- set bloom(val) {
246
- this._postEffectBloom.get().enabled = !!val;
247
- }
248
- /**
249
- * Maximum bloom downsample levels
250
- */ get bloomMaxDownsampleLevels() {
251
- return this._bloomMaxDownsampleLevels;
252
- }
253
- set bloomMaxDownsampleLevels(val) {
254
- this._bloomMaxDownsampleLevels = val;
255
- if (this._postEffectBloom.get()) {
256
- this._postEffectBloom.get().maxDownsampleLevel = val;
257
- }
258
- }
259
- /**
260
- * Bloom downsample limit
261
- */ get bloomDownsampleLimit() {
262
- return this._bloomDownsampleLimit;
263
- }
264
- set bloomDownsampleLimit(val) {
265
- this._bloomDownsampleLimit = val;
266
- if (this._postEffectBloom.get()) {
267
- this._postEffectBloom.get().downsampleLimit = val;
268
- }
269
- }
270
- /**
271
- * Bloom threshold
272
- */ get bloomThreshold() {
273
- return this._bloomThreshold;
274
- }
275
- set bloomThreshold(val) {
276
- this._bloomThreshold = val;
277
- if (this._postEffectBloom.get()) {
278
- this._postEffectBloom.get().threshold = val;
279
- }
280
- }
281
- /**
282
- * Bloom threshold knee
283
- */ get bloomThresholdKnee() {
284
- return this._bloomThresholdKnee;
285
- }
286
- set bloomThresholdKnee(val) {
287
- this._bloomThresholdKnee = val;
288
- if (this._postEffectBloom.get()) {
289
- this._postEffectBloom.get().thresholdKnee = val;
290
- }
291
- }
292
- /**
293
- * Bloom intensity
294
- */ get bloomIntensity() {
295
- return this._bloomIntensity;
296
- }
297
- set bloomIntensity(val) {
298
- this._bloomIntensity = val;
299
- if (this._postEffectBloom.get()) {
300
- this._postEffectBloom.get().intensity = val;
301
- }
302
- }
303
- /**
304
- * Gets whether FXAA is enabled.
305
- */ get FXAA() {
306
- return this._postEffectFXAA.get().enabled;
307
- }
308
- set FXAA(val) {
309
- this._postEffectFXAA.get().enabled = !!val;
310
- }
311
- /**
312
- * Tonemap exposure
313
- */ get toneMapExposure() {
314
- return this._tonemapExposure;
315
- }
316
- set toneMapExposure(val) {
317
- this._tonemapExposure = val;
318
- if (this._postEffectTonemap.get()) {
319
- this._postEffectTonemap.get().exposure = val;
320
- }
321
- }
322
- /**
323
- * Gets whether TAA is enabled.
324
- */ get TAA() {
325
- return this._postEffectTAA.get().enabled;
326
- }
327
- set TAA(val) {
328
- this._postEffectTAA.get().enabled = !!val;
329
- }
330
- /**
331
- * Gets the debug flag for TAA
332
- */ get TAADebug() {
333
- return this._TAADebug;
334
- }
335
- set TAADebug(val) {
336
- this._TAADebug = val;
337
- }
338
- /**
339
- * Gets whether Screen Space Reflections (SSR) is enabled.
340
- */ get SSR() {
341
- return this._postEffectSSR.get().enabled;
342
- }
343
- set SSR(val) {
344
- this._postEffectSSR.get().enabled = !!val;
345
- }
346
- /**
347
- * Gets the maximum roughness value for screen space reflections.
348
- * Controls the cutoff point where surfaces are considered too rough for SSR.
349
- */ get ssrMaxRoughness() {
350
- return this._ssrMaxRoughness;
351
- }
352
- set ssrMaxRoughness(val) {
353
- this._ssrMaxRoughness = val;
354
- }
355
- /**
356
- * Gets the roughness factor for SSR calculations.
357
- * Affects how surface roughness influences reflection clarity.
358
- */ get ssrRoughnessFactor() {
359
- return this._ssrRoughnessFactor;
360
- }
361
- set ssrRoughnessFactor(val) {
362
- this._ssrRoughnessFactor = val;
363
- }
364
- /**
365
- * Gets the stride value for SSR ray marching.
366
- * Controls the step size during ray marching. Larger values improve performance but may miss details.
367
- */ get ssrStride() {
368
- return this._ssrStride;
369
- }
370
- set ssrStride(val) {
371
- this._ssrStride = val;
372
- }
373
- /**
374
- * Gets the maximum distance for SSR ray marching.
375
- * Defines how far rays will travel when searching for reflection intersections.
376
- */ get ssrMaxDistance() {
377
- return this._ssrParams.x;
378
- }
379
- set ssrMaxDistance(val) {
380
- this._ssrParams.x = val;
381
- }
382
- /**
383
- * Gets the number of iterations for SSR ray marching.
384
- * Higher values provide more accurate reflections but impact performance.
385
- */ get ssrIterations() {
386
- return this._ssrParams.y;
387
- }
388
- set ssrIterations(val) {
389
- this._ssrParams.y = val;
390
- }
391
- /**
392
- * Gets the thickness value for SSR calculations.
393
- * Determines the thickness threshold for surfaces when calculating reflections.
394
- */ get ssrThickness() {
395
- return this._ssrParams.z;
396
- }
397
- set ssrThickness(val) {
398
- this._ssrParams.z = val;
399
- }
400
- /**
401
- * Gets whether SSR should calculate thickness automatically.
402
- * When enabled, the system will dynamically compute surface thickness for reflections.
403
- */ get ssrCalcThickness() {
404
- return this._ssrCalcThickness;
405
- }
406
- set ssrCalcThickness(val) {
407
- this._ssrCalcThickness = !!val;
408
- }
409
- /**
410
- * Gets the blur scale factor for SSR.
411
- * Controls the overall intensity of the blur effect applied to reflections.
412
- */ get ssrBlurScale() {
413
- return this._ssrBlurriness;
414
- }
415
- set ssrBlurScale(val) {
416
- this._ssrBlurriness = val;
417
- }
418
- /**
419
- * Gets the depth cutoff value for SSR blur.
420
- * Determines at what depth difference the blur effect should be reduced or eliminated.
421
- */ get ssrBlurDepthCutoff() {
422
- return this._ssrBlurDepthCutoff;
423
- }
424
- set ssrBlurDepthCutoff(val) {
425
- this._ssrBlurDepthCutoff = val;
426
- }
427
- /**
428
- * Gets the kernel size for the SSR blur effect.
429
- * Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
430
- */ get ssrBlurKernelSize() {
431
- return this._ssrBlurKernelSize;
432
- }
433
- set ssrBlurKernelSize(val) {
434
- this._ssrBlurKernelSize = val;
435
- }
436
- /**
437
- * Gets the standard deviation for the SSR Gaussian blur.
438
- * Controls the distribution of the blur effect. Higher values create more pronounced blur.
439
- */ get ssrBlurStdDev() {
440
- return this._ssrBlurStdDev;
441
- }
442
- set ssrBlurStdDev(val) {
443
- this._ssrBlurStdDev = val;
444
- }
445
- /** @internal */ get ssrParams() {
446
- return this._ssrParams;
447
- }
448
- /**
449
- * Gets whether SSAO is enabled.
450
- */ get SSAO() {
451
- return this._postEffectSSAO.get().enabled;
452
- }
453
- set SSAO(val) {
454
- this._postEffectSSAO.get().enabled = !!val;
455
- }
456
- /** SSAO scale */ get SSAOScale() {
457
- return this._SSAOScale;
458
- }
459
- set SSAOScale(val) {
460
- this._SSAOScale = val;
461
- if (this._postEffectSSAO.get()) {
462
- this._postEffectSSAO.get().scale = val;
463
- }
464
- }
465
- /** SSAO bias */ get SSAOBias() {
466
- return this._SSAOBias;
467
- }
468
- set SSAOBias(val) {
469
- this._SSAOBias = val;
470
- if (this._postEffectSSAO.get()) {
471
- this._postEffectSSAO.get().bias = val;
472
- }
473
- }
474
- /** SSAO radius */ get SSAORadius() {
475
- return this._SSAORadius;
476
- }
477
- set SSAORadius(val) {
478
- this._SSAORadius = val;
479
- if (this._postEffectSSAO.get()) {
480
- this._postEffectSSAO.get().radius = val;
481
- }
482
- }
483
- /** SSAO intensity */ get SSAOIntensity() {
484
- return this._SSAOIntensity;
485
- }
486
- set SSAOIntensity(val) {
487
- this._SSAOIntensity = val;
488
- if (this._postEffectSSAO.get()) {
489
- this._postEffectSSAO.get().intensity = val;
490
- }
491
- }
492
- /** SSAO depth cutoff */ get SSAOBlurDepthCutoff() {
493
- return this._SSAOBlurDepthCutoff;
494
- }
495
- set SSAOBlurDepthCutoff(val) {
496
- this._SSAOBlurDepthCutoff = val;
497
- if (this._postEffectSSAO.get()) {
498
- this._postEffectSSAO.get().blurDepthCutoff = val;
499
- }
500
- }
501
- /** Whether to perform a depth pass */ get depthPrePass() {
502
- return this._depthPrePass;
503
- }
504
- set depthPrePass(val) {
505
- this._depthPrePass = !!val;
506
- }
507
- /** Whether to allow command buffer reuse optimization */ get commandBufferReuse() {
508
- return this._commandBufferReuse;
509
- }
510
- set commandBufferReuse(val) {
511
- this._commandBufferReuse = !!val;
512
- }
513
- /** OIT */ get oit() {
514
- return this._oit.get();
515
- }
516
- set oit(val) {
517
- this._oit.set(val);
518
- }
519
- /** Clip plane mask */ get clipMask() {
520
- return this._clipMask;
521
- }
522
- set clipMask(val) {
523
- this._clipMask = val;
524
- }
525
- /** Viewport used for rendering, if null, use full framebuffer size */ get viewport() {
526
- return this._viewport ? [
527
- ...this._viewport
528
- ] : null;
529
- }
530
- set viewport(rect) {
531
- this._viewport = rect?.slice() ?? null;
532
- }
533
- /** Scissor rectangle used for rendering, if null, use viewport value */ get scissor() {
534
- return this._scissor ? [
535
- ...this._scissor
536
- ] : null;
537
- }
538
- set scissor(rect) {
539
- this._scissor = rect?.slice() ?? null;
540
- }
541
- /**
542
- * Handle input events
543
- * @param ev - input event object
544
- * @param type - event type, default to ev.type
545
- * @returns Boolean value indicates whether the event was handled.
546
- */ handleEvent(ev, type) {
547
- let handled = false;
548
- if (this._controller) {
549
- type = type ?? ev.type;
550
- if (type === 'pointerdown') {
551
- handled = this._controller.onMouseDown(ev);
552
- } else if (type === 'pointerup') {
553
- handled = this._controller.onMouseUp(ev);
554
- } else if (type === 'pointermove') {
555
- handled = this._controller.onMouseMove(ev);
556
- } else if (type === 'wheel') {
557
- handled = this._controller.onMouseWheel(ev);
558
- } else if (type === 'keydown') {
559
- handled = this._controller.onKeyDown(ev);
560
- } else if (type === 'keyup') {
561
- handled = this._controller.onKeyUp(ev);
562
- }
563
- if (handled) {
564
- ev.preventDefault();
565
- }
566
- }
567
- return handled;
568
- }
569
- /**
570
- * Constructs a ray based on the given screen coordinates.
571
- *
572
- * @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
573
- * @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
574
- * @returns The ray originating from the camera position and passing through the given screen coordinates.
575
- */ constructRay(x, y) {
576
- const width = this.viewport ? this.viewport[2] : Application.instance.device.getViewport().width;
577
- const height = this.viewport ? this.viewport[3] : Application.instance.device.getViewport().height;
578
- const ndcX = 2 * x / width - 1;
579
- const ndcY = 1 - 2 * y / height;
580
- const nearClip = new Vector4(ndcX, ndcY, 0, 1);
581
- const farClip = new Vector4(ndcX, ndcY, 1, 1);
582
- const nearWorld = this.invViewProjectionMatrix.transform(nearClip);
583
- const farWorld = this.invViewProjectionMatrix.transform(farClip);
584
- if (this.isPerspective()) {
585
- nearWorld.scaleBy(1 / nearWorld.w);
586
- farWorld.scaleBy(1 / farWorld.w);
587
- }
588
- const vEye = this.isPerspective() ? this.getWorldPosition() : nearWorld.xyz();
589
- const vDir = Vector3.sub(farWorld.xyz(), vEye).inplaceNormalize();
590
- return new Ray(vEye, vDir);
591
- }
592
- /**
593
- * Place the camera by specifying the camera position and the target point
594
- * @param eye - The camera position
595
- * @param target - The target point to look at
596
- * @param up - The up vector
597
- * @returns self
598
- */ lookAt(eye, target, up) {
599
- return this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
600
- }
601
- /**
602
- * Place the camera to look at a given cube face at a given camera position
603
- * @param face - The cube face to look at
604
- * @param position - The camera position
605
- * @returns self
606
- */ lookAtCubeFace(face, position) {
607
- return this.setLocalTransform(Matrix4x4.lookAtCubeFace(face, position ?? this.position));
608
- }
609
- /**
610
- * Setup a perspective projection matrix for the camera
611
- * @param fovY - The vertical field of view in radians.
612
- * @param aspect - The aspect ratio
613
- * @param zNear - The near clip plane
614
- * @param zFar - The far clip plane
615
- * @returns self
616
- */ setPerspective(fovY, aspect, zNear, zFar) {
617
- this._projMatrix.perspective(fovY, aspect, zNear, zFar);
618
- Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
619
- this._invalidate(true);
620
- return this;
621
- }
622
- /**
623
- * Setup a orthogonal projection matrix for the camera
624
- * @param left - Left bound of the frustum
625
- * @param right - Right bound of the frustum
626
- * @param bottom - Bottom bound of the frustum
627
- * @param top - Top bound of the frustum
628
- * @param near - Near bound of the frustum.
629
- * @param far - Far bound of the frustum.
630
- * @returns self
631
- */ setOrtho(left, right, bottom, top, near, far) {
632
- this._projMatrix.ortho(left, right, bottom, top, near, far);
633
- Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
634
- this._invalidate(true);
635
- return this;
636
- }
637
- /**
638
- * Setup a projection matrix for the camera
639
- * @param matrix - The projection matrix
640
- */ setProjectionMatrix(matrix) {
641
- if (matrix && matrix !== this._projMatrix) {
642
- this._projMatrix = matrix;
643
- Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
644
- this._invalidate(true);
645
- }
646
- }
647
- /**
648
- * Gets the projection matrix of the camera
649
- * @returns The projection matrix
650
- */ getProjectionMatrix() {
651
- if (this._dirty) {
652
- this._dirty = false;
653
- this._compute();
654
- }
655
- return this._projMatrix;
656
- }
657
- /**
658
- * Gets the inverse projection matrix of the camera
659
- * @returns The projection matrix
660
- */ getInvProjectionMatrix() {
661
- if (this._dirty) {
662
- this._dirty = false;
663
- this._compute();
664
- }
665
- return this._invProjMatrix;
666
- }
667
- getRotationMatrix() {
668
- const rotationMatrix = new Matrix4x4();
669
- this.worldMatrix.decompose(null, rotationMatrix, null);
670
- const xAxis = rotationMatrix.getRow(0).xyz().scaleBy(-1);
671
- const yAxis = rotationMatrix.getRow(1).xyz();
672
- const zAxis = rotationMatrix.getRow(2).xyz().scaleBy(-1);
673
- rotationMatrix.setRow(0, new Vector4(xAxis.x, xAxis.y, xAxis.z, 0));
674
- rotationMatrix.setRow(1, new Vector4(yAxis.x, yAxis.y, yAxis.z, 0));
675
- rotationMatrix.setRow(2, new Vector4(zAxis.x, zAxis.y, zAxis.z, 0));
676
- return rotationMatrix;
677
- }
678
- /**
679
- * View matrix of the camera
680
- *
681
- * @remarks
682
- * Camera's view matrix will transform a point from the world space to the camera space
683
- */ get viewMatrix() {
684
- if (this._dirty) {
685
- this._dirty = false;
686
- this._compute();
687
- }
688
- return this._viewMatrix;
689
- }
690
- get viewProjectionMatrix() {
691
- if (this._dirty) {
692
- this._dirty = false;
693
- this._compute();
694
- }
695
- return this._viewProjMatrix;
696
- }
697
- /**
698
- * The inverse-view-projection matrix of the camera
699
- *
700
- * @remarks
701
- * The inverse-view-projection matrix transforms a point from the clip space to the camera space
702
- */ get invViewProjectionMatrix() {
703
- if (this._dirty) {
704
- this._dirty = false;
705
- this._compute();
706
- }
707
- return this._invViewProjMatrix;
708
- }
709
- /** Gets the frustum of the camera */ get frustum() {
710
- if (this._dirty) {
711
- this._dirty = false;
712
- this._compute();
713
- }
714
- return this._frustum;
715
- }
716
- get frustumViewSpace() {
717
- if (this._dirty) {
718
- this._dirty = false;
719
- this._compute();
720
- }
721
- if (!this._frustumV) {
722
- this._frustumV = new Frustum(this._projMatrix);
723
- }
724
- return this._frustumV;
725
- }
726
- /** The camera controller */ get controller() {
727
- return this._controller || null;
728
- }
729
- set controller(controller) {
730
- this.setController(controller);
731
- }
732
- /** {@inheritDoc SceneNode.isCamera} */ isCamera() {
733
- return true;
734
- }
735
- /** Gets the near clip plane of the camera */ getNearPlane() {
736
- return this.getProjectionMatrix().getNearPlane();
737
- }
738
- /** Gets the far clip plane of the camera */ getFarPlane() {
739
- return this.getProjectionMatrix().getFarPlane();
740
- }
741
- /** Gets the vertical field of view of the camera */ getFOV() {
742
- return this.getProjectionMatrix().getFov();
743
- }
744
- /** Gets the tangent of half of the vertical field of view */ getTanHalfFovy() {
745
- return this.getProjectionMatrix().getTanHalfFov();
746
- }
747
- /** Gets the aspect ratio */ getAspect() {
748
- return this.getProjectionMatrix().getAspect();
749
- }
750
- /** Returns true if the camera is perspective */ isPerspective() {
751
- return this.getProjectionMatrix().isPerspective();
752
- }
753
- /** Returns true if the camera is orthographic */ isOrtho() {
754
- return this.getProjectionMatrix().isOrtho();
755
- }
756
- /**
757
- * Gets the camera history data which is used in temporal reprojection
758
- * @returns Camera history data
759
- */ getHistoryData() {
760
- let data = Camera._historyData.get(this);
761
- if (!data) {
762
- data = {
763
- prevColorTex: null,
764
- prevMotionVectorTex: null
765
- };
766
- Camera._historyData.set(this, data);
767
- }
768
- return data;
769
- }
770
- /**
771
- * Clears the camera history data which is used in temporal reprojection
772
- */ clearHistoryData() {
773
- const data = Camera._historyData.get(this);
774
- if (data) {
775
- if (data.prevColorTex) {
776
- Application.instance.device.pool.releaseTexture(data.prevColorTex);
777
- }
778
- if (data.prevMotionVectorTex) {
779
- Application.instance.device.pool.releaseTexture(data.prevMotionVectorTex);
780
- }
781
- Camera._historyData.delete(this);
782
- }
783
- this._prevVPMatrix = null;
784
- this._prevPosition = null;
785
- this._prevJitteredVPMatrix = null;
786
- this._prevJitterValue = null;
787
- }
788
- /** @internal */ updatePostProcessing() {
789
- this._compositor.clear();
790
- if (!this._postEffectSSR.get()) {
791
- const ssr = new SSR();
792
- ssr.enabled = false;
793
- this._postEffectSSR.set(ssr);
794
- this._compositor.appendPostEffect(ssr);
795
- }
796
- if (!this._postEffectSSAO.get()) {
797
- const ssao = new SAO();
798
- ssao.enabled = false;
799
- ssao.scale = this._SSAOScale;
800
- ssao.bias = this._SSAOBias;
801
- ssao.radius = this._SSAORadius;
802
- ssao.intensity = this._SSAOIntensity;
803
- ssao.blurDepthCutoff = this._SSAOBlurDepthCutoff;
804
- this._postEffectSSAO.set(ssao);
805
- this._compositor.appendPostEffect(ssao);
806
- }
807
- if (!this._postEffectTAA.get()) {
808
- const taa = new TAA();
809
- taa.enabled = false;
810
- this._postEffectTAA.set(taa);
811
- this._compositor.appendPostEffect(taa);
812
- }
813
- if (!this._postEffectMotionBlur.get()) {
814
- const motionBlur = new MotionBlur();
815
- motionBlur.enabled = false;
816
- motionBlur.strength = this._motionBlurStrength;
817
- this._postEffectMotionBlur.set(motionBlur);
818
- this._compositor.appendPostEffect(motionBlur);
819
- }
820
- if (!this._postEffectTonemap.get()) {
821
- const tonemap = new Tonemap();
822
- tonemap.enabled = true;
823
- tonemap.exposure = this._tonemapExposure;
824
- this._postEffectTonemap.set(tonemap);
825
- this._compositor.appendPostEffect(tonemap);
826
- }
827
- if (!this._postEffectFXAA.get()) {
828
- const fxaa = new FXAA();
829
- fxaa.enabled = false;
830
- this._postEffectFXAA.set(fxaa);
831
- this._compositor.appendPostEffect(fxaa);
832
- }
833
- if (!this._postEffectBloom.get()) {
834
- const bloom = new Bloom();
835
- bloom.enabled = false;
836
- bloom.maxDownsampleLevel = this._bloomMaxDownsampleLevels;
837
- bloom.downsampleLimit = this._bloomDownsampleLimit;
838
- bloom.threshold = this._bloomThreshold;
839
- bloom.thresholdKnee = this._bloomThresholdKnee;
840
- bloom.intensity = this._bloomIntensity;
841
- this._postEffectBloom.set(bloom);
842
- this._compositor.appendPostEffect(bloom);
843
- }
844
- }
845
- /**
846
- * Renders a scene
847
- * @param scene - The scene to be rendered
848
- * @param compositor - Compositor instance that will be used to apply postprocess effects
849
- */ render(scene) {
850
- const device = Application.instance.device;
851
- //this.updatePostProcessing(device);
852
- const useMotionVector = (this.TAA || this.motionBlur) && device.type !== 'webgl';
853
- const useTAA = useMotionVector && this.TAA;
854
- scene.dispatchEvent('startrender', scene, this, this._compositor);
855
- if (useMotionVector) {
856
- const width = device.getDrawingBufferWidth();
857
- const height = device.getDrawingBufferHeight();
858
- if (useTAA) {
859
- const halton = Camera._halton23[device.frameInfo.frameCounter % Camera._halton23.length];
860
- this._jitterValue.setXY(halton[0] * 2 / width, halton[1] * 2 / height);
861
- } else {
862
- this._jitterValue.setXY(0, 0);
863
- }
864
- this._jitteredVPMatrix.set(this.getProjectionMatrix());
865
- this._jitteredVPMatrix[8] += this._jitterValue.x;
866
- this._jitteredVPMatrix[9] += this._jitterValue.y;
867
- this._jitteredVPMatrix.multiplyRight(this.viewMatrix);
868
- Matrix4x4.invert(this._jitteredVPMatrix, this._jitteredInvVPMatrix);
869
- if (!this._prevJitteredVPMatrix) {
870
- this._prevJitteredVPMatrix = new Matrix4x4();
871
- this._prevJitteredVPMatrix.set(this._jitteredVPMatrix);
872
- this._prevJitterValue = new Vector2(this._jitterValue);
873
- }
874
- if (!this._prevVPMatrix) {
875
- this._prevVPMatrix = new Matrix4x4();
876
- this._prevVPMatrix.set(this.viewProjectionMatrix);
877
- this._prevPosition = this.getWorldPosition();
878
- }
879
- } else {
880
- this._jitterValue.setXY(0, 0);
881
- this._prevVPMatrix = null;
882
- this._prevPosition = null;
883
- this._prevJitteredVPMatrix = null;
884
- this._prevJitterValue = null;
885
- this._jitteredInvVPMatrix.set(this.invViewProjectionMatrix);
886
- }
887
- device.pushDeviceStates();
888
- device.reverseVertexWindingOrder(false);
889
- scene.getRenderer().renderScene(scene, this);
890
- device.popDeviceStates();
891
- if (useMotionVector) {
892
- this._prevJitteredVPMatrix.set(this._jitteredVPMatrix);
893
- this._prevJitterValue.set(this._jitterValue);
894
- this._prevVPMatrix.set(this.viewProjectionMatrix);
895
- this._prevPosition = this.getWorldPosition();
896
- }
897
- scene.dispatchEvent('endrender', scene, this, this._compositor);
898
- }
899
- async pickAsync(posX, posY) {
900
- this._pickPosX = posX;
901
- this._pickPosY = posY;
902
- if (!this._pickResultPromise) {
903
- this._pickResultPromise = new Promise((resolve)=>{
904
- this._pickResultResolve = (result)=>{
905
- resolve(result);
906
- this._pickResultPromise = null;
907
- this._pickResultResolve = null;
908
- };
909
- });
910
- }
911
- return this._pickResultPromise;
912
- }
913
- /** @internal */ getPickResultResolveFunc() {
914
- return this._pickResultResolve;
915
- }
916
- /** @internal */ getPickPosX() {
917
- return this._pickPosX;
918
- }
919
- /** @internal */ getPickPosY() {
920
- return this._pickPosY;
921
- }
922
- /**
923
- * Updates the controller state
924
- */ updateController() {
925
- this._controller?.update();
926
- }
927
- /**
928
- * Reset the controller
929
- */ resetController() {
930
- this._controller?.reset();
931
- }
932
- /** @internal */ get jitteredVPMatrix() {
933
- return this._jitteredVPMatrix;
934
- }
935
- /** @internal */ get jitteredInvVPMatrix() {
936
- return this._jitteredInvVPMatrix;
937
- }
938
- /** @internal */ get jitterValue() {
939
- return this._jitterValue;
940
- }
941
- /** @internal */ get prevJitteredVPMatrix() {
942
- return this._prevJitteredVPMatrix;
943
- }
944
- /** @internal */ get prevJitterValue() {
945
- return this._prevJitterValue;
946
- }
947
- /** @internal */ get prevVPMatrix() {
948
- return this._prevVPMatrix;
949
- }
950
- /** @internal */ get prevPosition() {
951
- return this._prevPosition;
952
- }
953
- /** @internal */ setController(controller) {
954
- if (this._controller !== controller) {
955
- if (controller && controller._getCamera() && controller._getCamera() !== this) {
956
- throw new Error('Camera.setController failed: one camera controller object cannot be assigned to multiple camera');
957
- }
958
- this._controller?._setCamera(null);
959
- this._controller = controller;
960
- this._controller?._setCamera(this);
961
- }
962
- return this;
963
- }
964
- /** @internal */ _invalidate(projectMatrixChanged) {
965
- this._dirty = true;
966
- if (projectMatrixChanged) {
967
- this._frustumV = null;
968
- }
969
- }
970
- /** @internal */ _compute() {
971
- this._computeProj();
972
- Matrix4x4.invertAffine(this.worldMatrix, this._viewMatrix);
973
- Matrix4x4.multiply(this._projMatrix, this._viewMatrix, this._viewProjMatrix);
974
- Matrix4x4.invert(this._viewProjMatrix, this._invViewProjMatrix);
975
- if (!this._frustum) {
976
- this._frustum = new Frustum(this._viewProjMatrix);
977
- } else {
978
- this._frustum.initWithMatrix(this._viewProjMatrix);
979
- }
980
- }
981
- /** @internal */ _computeProj() {}
982
- /** @internal */ _onTransformChanged(invalidateLocal) {
983
- super._onTransformChanged(invalidateLocal);
984
- this._invalidate(false);
985
- }
986
- /** {@inheritdoc SceneNode.dispose} */ dispose() {
987
- this.setController(null);
988
- this.clearHistoryData();
989
- this._projMatrix = null;
990
- this._viewMatrix = null;
991
- this._viewProjMatrix = null;
992
- this._postEffectBloom.dispose();
993
- this._postEffectFXAA.dispose();
994
- this._postEffectMotionBlur.dispose();
995
- this._postEffectSSAO.dispose();
996
- this._postEffectSSR.dispose();
997
- this._postEffectTAA.dispose();
998
- this._postEffectTonemap.dispose();
999
- this._oit.dispose();
1000
- super.dispose();
1001
- }
1002
- }
1003
-
1004
- export { Camera };
1005
- //# sourceMappingURL=camera.js.map