@zephyr3d/scene 0.9.26 → 0.10.0

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 (506) hide show
  1. package/README.md +60 -27
  2. package/dist/animation/animation_bank.js +634 -0
  3. package/dist/animation/animation_bank.js.map +1 -0
  4. package/dist/animation/animation_bank_gpu.js +256 -0
  5. package/dist/animation/animation_bank_gpu.js.map +1 -0
  6. package/dist/animation/animationset.js +146 -30
  7. package/dist/animation/animationset.js.map +1 -1
  8. package/dist/animation/cloth/gpu_cloth_component.js +406 -0
  9. package/dist/animation/cloth/gpu_cloth_component.js.map +1 -0
  10. package/dist/animation/cloth/gpu_cloth_system.js +332 -202
  11. package/dist/animation/cloth/gpu_cloth_system.js.map +1 -1
  12. package/dist/animation/gpu_animation_driver.js +289 -0
  13. package/dist/animation/gpu_animation_driver.js.map +1 -0
  14. package/dist/animation/joint_dynamics/collision.js +112 -1
  15. package/dist/animation/joint_dynamics/collision.js.map +1 -1
  16. package/dist/animation/joint_dynamics/controller.js +6 -0
  17. package/dist/animation/joint_dynamics/controller.js.map +1 -1
  18. package/dist/animation/joint_dynamics/joint_dynamics_system.js +11 -0
  19. package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
  20. package/dist/animation/joint_dynamics/solver.js +50 -12
  21. package/dist/animation/joint_dynamics/solver.js.map +1 -1
  22. package/dist/animation/joint_dynamics/types.js.map +1 -1
  23. package/dist/animation/skeleton.js +300 -56
  24. package/dist/animation/skeleton.js.map +1 -1
  25. package/dist/animation/skin_palette_atlas.js +252 -0
  26. package/dist/animation/skin_palette_atlas.js.map +1 -0
  27. package/dist/animation/spring/multi_chain_spring_system.js +298 -38
  28. package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
  29. package/dist/animation/spring/spring_chain.js +2 -0
  30. package/dist/animation/spring/spring_chain.js.map +1 -1
  31. package/dist/animation/spring/spring_collider.js +159 -21
  32. package/dist/animation/spring/spring_collider.js.map +1 -1
  33. package/dist/animation/spring/spring_particle.js +1 -0
  34. package/dist/animation/spring/spring_particle.js.map +1 -1
  35. package/dist/animation/spring/spring_solver.js +173 -0
  36. package/dist/animation/spring/spring_solver.js.map +1 -0
  37. package/dist/animation/spring/spring_system.js +249 -24
  38. package/dist/animation/spring/spring_system.js.map +1 -1
  39. package/dist/animation/spring_modifier.js +32 -1
  40. package/dist/animation/spring_modifier.js.map +1 -1
  41. package/dist/app/app.js +26 -0
  42. package/dist/app/app.js.map +1 -1
  43. package/dist/app/engine.js +86 -15
  44. package/dist/app/engine.js.map +1 -1
  45. package/dist/app/gamepad.js +191 -0
  46. package/dist/app/gamepad.js.map +1 -0
  47. package/dist/app/inputactions.js +271 -0
  48. package/dist/app/inputactions.js.map +1 -0
  49. package/dist/app/inputmgr.js +331 -22
  50. package/dist/app/inputmgr.js.map +1 -1
  51. package/dist/app/loading.js +138 -0
  52. package/dist/app/loading.js.map +1 -0
  53. package/dist/app/pipelinecache.js +209 -0
  54. package/dist/app/pipelinecache.js.map +1 -0
  55. package/dist/app/runtimescript.js +25 -0
  56. package/dist/app/runtimescript.js.map +1 -1
  57. package/dist/app/scriptingsystem.js +54 -0
  58. package/dist/app/scriptingsystem.js.map +1 -1
  59. package/dist/app/scriptregistry.js +7 -2
  60. package/dist/app/scriptregistry.js.map +1 -1
  61. package/dist/asset/asset_manifest.js +59 -0
  62. package/dist/asset/asset_manifest.js.map +1 -0
  63. package/dist/asset/asset_preload.js +258 -0
  64. package/dist/asset/asset_preload.js.map +1 -0
  65. package/dist/asset/assetmanager.js +117 -65
  66. package/dist/asset/assetmanager.js.map +1 -1
  67. package/dist/asset/loaders/ktx2/basis/LICENSE +201 -0
  68. package/dist/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
  69. package/dist/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
  70. package/dist/asset/loaders/ktx2/basis_location.js +17 -0
  71. package/dist/asset/loaders/ktx2/basis_location.js.map +1 -0
  72. package/dist/asset/loaders/ktx2/ktx2_loader.js +88 -0
  73. package/dist/asset/loaders/ktx2/ktx2_loader.js.map +1 -0
  74. package/dist/asset/loaders/ktx2/ktx2_targets.js +118 -0
  75. package/dist/asset/loaders/ktx2/ktx2_targets.js.map +1 -0
  76. package/dist/asset/loaders/ktx2/transcoder_pool.js +259 -0
  77. package/dist/asset/loaders/ktx2/transcoder_pool.js.map +1 -0
  78. package/dist/asset/mesh_lod_builder.js +104 -0
  79. package/dist/asset/mesh_lod_builder.js.map +1 -0
  80. package/dist/asset/mesh_settings.js +111 -0
  81. package/dist/asset/mesh_settings.js.map +1 -0
  82. package/dist/asset/meshopt_decoder.js +18 -0
  83. package/dist/asset/meshopt_decoder.js.map +1 -0
  84. package/dist/asset/meshopt_simplifier.js +26 -0
  85. package/dist/asset/meshopt_simplifier.js.map +1 -0
  86. package/dist/asset/model.js +177 -3
  87. package/dist/asset/model.js.map +1 -1
  88. package/dist/asset/texture_settings.js +231 -0
  89. package/dist/asset/texture_settings.js.map +1 -0
  90. package/dist/asset/zmsh_binary.js +131 -0
  91. package/dist/asset/zmsh_binary.js.map +1 -0
  92. package/dist/asset/zsdf_binary.js +111 -0
  93. package/dist/asset/zsdf_binary.js.map +1 -0
  94. package/dist/blitter/bilateralblur.js +1 -2
  95. package/dist/blitter/bilateralblur.js.map +1 -1
  96. package/dist/blitter/gaussianblur.js +1 -6
  97. package/dist/blitter/gaussianblur.js.map +1 -1
  98. package/dist/camera/base.js +31 -10
  99. package/dist/camera/base.js.map +1 -1
  100. package/dist/camera/camera.js +178 -200
  101. package/dist/camera/camera.js.map +1 -1
  102. package/dist/camera/follow.js +342 -0
  103. package/dist/camera/follow.js.map +1 -0
  104. package/dist/camera/fps.js +9 -7
  105. package/dist/camera/fps.js.map +1 -1
  106. package/dist/camera/orbit.js +46 -19
  107. package/dist/camera/orbit.js.map +1 -1
  108. package/dist/index.d.ts +30475 -19865
  109. package/dist/index.js +67 -12
  110. package/dist/index.js.map +1 -1
  111. package/dist/material/blinn.js +3 -0
  112. package/dist/material/blinn.js.map +1 -1
  113. package/dist/material/eye.js +1 -1
  114. package/dist/material/eye.js.map +1 -1
  115. package/dist/material/hair.js +2 -3
  116. package/dist/material/hair.js.map +1 -1
  117. package/dist/material/hairstrand.js +235 -235
  118. package/dist/material/hairstrand.js.map +1 -1
  119. package/dist/material/lambert.js +4 -1
  120. package/dist/material/lambert.js.map +1 -1
  121. package/dist/material/material.js +362 -300
  122. package/dist/material/material.js.map +1 -1
  123. package/dist/material/meshmaterial.js +118 -45
  124. package/dist/material/meshmaterial.js.map +1 -1
  125. package/dist/material/mixins/lightmodel/blinnphong.js +1 -1
  126. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  127. package/dist/material/mixins/lightmodel/lambert.js +1 -1
  128. package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
  129. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +34 -61
  130. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
  131. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +16 -2
  132. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  133. package/dist/material/mixins/lightmodel/pbrspecularglossness.js +2 -1
  134. package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
  135. package/dist/material/mixins/lit.js +223 -83
  136. package/dist/material/mixins/lit.js.map +1 -1
  137. package/dist/material/mixins/pbr/common.js +31 -206
  138. package/dist/material/mixins/pbr/common.js.map +1 -1
  139. package/dist/material/mtoon.js +1 -1
  140. package/dist/material/mtoon.js.map +1 -1
  141. package/dist/material/pbrmr.js +3 -0
  142. package/dist/material/pbrmr.js.map +1 -1
  143. package/dist/material/pbrsg.js +3 -0
  144. package/dist/material/pbrsg.js.map +1 -1
  145. package/dist/material/sdf_debug.js +78 -0
  146. package/dist/material/sdf_debug.js.map +1 -0
  147. package/dist/material/shader/helper.js +733 -190
  148. package/dist/material/shader/helper.js.map +1 -1
  149. package/dist/material/shader/terrain_blend.js +204 -43
  150. package/dist/material/shader/terrain_blend.js.map +1 -1
  151. package/dist/material/skin.js +331 -297
  152. package/dist/material/skin.js.map +1 -1
  153. package/dist/material/skinprofile.js +1058 -0
  154. package/dist/material/skinprofile.js.map +1 -0
  155. package/dist/material/sss.js +353 -0
  156. package/dist/material/sss.js.map +1 -0
  157. package/dist/material/sss_kernel.js +265 -0
  158. package/dist/material/sss_kernel.js.map +1 -0
  159. package/dist/material/sssprofile.js +879 -0
  160. package/dist/material/sssprofile.js.map +1 -0
  161. package/dist/material/subsurfaceprofile.js +4 -8
  162. package/dist/material/subsurfaceprofile.js.map +1 -1
  163. package/dist/material/terrain-cm.js +464 -188
  164. package/dist/material/terrain-cm.js.map +1 -1
  165. package/dist/material/unlit.js +3 -0
  166. package/dist/material/unlit.js.map +1 -1
  167. package/dist/material/water.js +2009 -201
  168. package/dist/material/water.js.map +1 -1
  169. package/dist/node_modules/meshoptimizer/LICENSE +21 -0
  170. package/dist/node_modules/meshoptimizer/meshopt_decoder.js +197 -0
  171. package/dist/node_modules/meshoptimizer/meshopt_decoder.js.map +1 -0
  172. package/dist/node_modules/meshoptimizer/meshopt_simplifier.js +677 -0
  173. package/dist/node_modules/meshoptimizer/meshopt_simplifier.js.map +1 -0
  174. package/dist/physics/character.js +226 -0
  175. package/dist/physics/character.js.map +1 -0
  176. package/dist/physics/collider.js +209 -0
  177. package/dist/physics/collider.js.map +1 -0
  178. package/dist/physics/events.js +79 -0
  179. package/dist/physics/events.js.map +1 -0
  180. package/dist/physics/joint.js +272 -0
  181. package/dist/physics/joint.js.map +1 -0
  182. package/dist/physics/node_physics.js +234 -0
  183. package/dist/physics/node_physics.js.map +1 -0
  184. package/dist/physics/part.js +91 -0
  185. package/dist/physics/part.js.map +1 -0
  186. package/dist/physics/rigid_body.js +379 -0
  187. package/dist/physics/rigid_body.js.map +1 -0
  188. package/dist/physics/vehicle.js +335 -0
  189. package/dist/physics/vehicle.js.map +1 -0
  190. package/dist/physics/world.js +25 -0
  191. package/dist/physics/world.js.map +1 -0
  192. package/dist/posteffect/bloom.js +49 -14
  193. package/dist/posteffect/bloom.js.map +1 -1
  194. package/dist/posteffect/motionblur.js +668 -63
  195. package/dist/posteffect/motionblur.js.map +1 -1
  196. package/dist/posteffect/posteffect.js +12 -1
  197. package/dist/posteffect/posteffect.js.map +1 -1
  198. package/dist/posteffect/postsss.js +572 -0
  199. package/dist/posteffect/postsss.js.map +1 -0
  200. package/dist/posteffect/sao.js +48 -50
  201. package/dist/posteffect/sao.js.map +1 -1
  202. package/dist/posteffect/skinsss.js +605 -355
  203. package/dist/posteffect/skinsss.js.map +1 -1
  204. package/dist/posteffect/ssgi.js +91 -162
  205. package/dist/posteffect/ssgi.js.map +1 -1
  206. package/dist/posteffect/ssr.js +3 -11
  207. package/dist/posteffect/ssr.js.map +1 -1
  208. package/dist/posteffect/sss.js +34 -15
  209. package/dist/posteffect/sss.js.map +1 -1
  210. package/dist/posteffect/taa.js +1 -0
  211. package/dist/posteffect/taa.js.map +1 -1
  212. package/dist/render/abuffer_oit.js +40 -39
  213. package/dist/render/abuffer_oit.js.map +1 -1
  214. package/dist/render/clipmap.js +328 -62
  215. package/dist/render/clipmap.js.map +1 -1
  216. package/dist/render/cluster_light.js +958 -224
  217. package/dist/render/cluster_light.js.map +1 -1
  218. package/dist/render/cull_visitor.js +26 -5
  219. package/dist/render/cull_visitor.js.map +1 -1
  220. package/dist/render/debug_views.js +37 -0
  221. package/dist/render/debug_views.js.map +1 -0
  222. package/dist/render/depthpass.js +5 -1
  223. package/dist/render/depthpass.js.map +1 -1
  224. package/dist/render/drawable_mixin.js +53 -6
  225. package/dist/render/drawable_mixin.js.map +1 -1
  226. package/dist/render/dualdepthpeeling_oit.js +53 -53
  227. package/dist/render/dualdepthpeeling_oit.js.map +1 -1
  228. package/dist/render/envlight.js +196 -113
  229. package/dist/render/envlight.js.map +1 -1
  230. package/dist/render/fbm_wavegenerator.js +8 -13
  231. package/dist/render/fbm_wavegenerator.js.map +1 -1
  232. package/dist/render/fft_wavegenerator.js +268 -136
  233. package/dist/render/fft_wavegenerator.js.map +1 -1
  234. package/dist/render/gerstner_wavegenerator.js +113 -28
  235. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  236. package/dist/render/gi/probe_volume.js +1334 -0
  237. package/dist/render/gi/probe_volume.js.map +1 -0
  238. package/dist/render/gi/scene_gi.js +282 -0
  239. package/dist/render/gi/scene_gi.js.map +1 -0
  240. package/dist/render/gi/voxel_atlas.js +198 -0
  241. package/dist/render/gi/voxel_atlas.js.map +1 -0
  242. package/dist/render/gi/voxel_lighting.js +652 -0
  243. package/dist/render/gi/voxel_lighting.js.map +1 -0
  244. package/dist/render/gi/voxel_scene.js +642 -0
  245. package/dist/render/gi/voxel_scene.js.map +1 -0
  246. package/dist/render/gi/voxelize_pass.js +223 -0
  247. package/dist/render/gi/voxelize_pass.js.map +1 -0
  248. package/dist/render/globalbindgroup_allocator.js +3 -2
  249. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  250. package/dist/render/gpu_picking.js +9 -36
  251. package/dist/render/gpu_picking.js.map +1 -1
  252. package/dist/render/hzb.js +80 -22
  253. package/dist/render/hzb.js.map +1 -1
  254. package/dist/render/instance_culling.js +499 -0
  255. package/dist/render/instance_culling.js.map +1 -0
  256. package/dist/render/lightpass.js +23 -9
  257. package/dist/render/lightpass.js.map +1 -1
  258. package/dist/render/lod.js +46 -0
  259. package/dist/render/lod.js.map +1 -0
  260. package/dist/render/oit.js +11 -11
  261. package/dist/render/oit.js.map +1 -1
  262. package/dist/render/primitive.js +301 -9
  263. package/dist/render/primitive.js.map +1 -1
  264. package/dist/render/primitive_readback.js +209 -0
  265. package/dist/render/primitive_readback.js.map +1 -0
  266. package/dist/render/render_queue.js +198 -11
  267. package/dist/render/render_queue.js.map +1 -1
  268. package/dist/render/renderer.js +14 -7
  269. package/dist/render/renderer.js.map +1 -1
  270. package/dist/render/rendergraph/blackboard.js +15 -1
  271. package/dist/render/rendergraph/blackboard.js.map +1 -1
  272. package/dist/render/rendergraph/executor.js +136 -0
  273. package/dist/render/rendergraph/executor.js.map +1 -1
  274. package/dist/render/rendergraph/forward_plus_builder.js +585 -59
  275. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
  276. package/dist/render/rendergraph/frame_resource_requirements.js +1 -0
  277. package/dist/render/rendergraph/frame_resource_requirements.js.map +1 -1
  278. package/dist/render/rendergraph/history_resources.js +8 -1
  279. package/dist/render/rendergraph/history_resources.js.map +1 -1
  280. package/dist/render/rendergraph/scene_render_context.js +31 -2
  281. package/dist/render/rendergraph/scene_render_context.js.map +1 -1
  282. package/dist/render/rendergraph/types.js.map +1 -1
  283. package/dist/render/renderpass.js +28 -5
  284. package/dist/render/renderpass.js.map +1 -1
  285. package/dist/render/sdf/box_allocator.js +98 -0
  286. package/dist/render/sdf/box_allocator.js.map +1 -0
  287. package/dist/render/sdf/global_sdf.js +865 -0
  288. package/dist/render/sdf/global_sdf.js.map +1 -0
  289. package/dist/render/sdf/scene_sdf.js +562 -0
  290. package/dist/render/sdf/scene_sdf.js.map +1 -0
  291. package/dist/render/sdf/sdf_atlas.js +227 -0
  292. package/dist/render/sdf/sdf_atlas.js.map +1 -0
  293. package/dist/render/sdf/sdf_programs.js +42 -0
  294. package/dist/render/sdf/sdf_programs.js.map +1 -0
  295. package/dist/render/sdf/sdf_view.js +199 -0
  296. package/dist/render/sdf/sdf_view.js.map +1 -0
  297. package/dist/render/sdf/waterline.js +610 -0
  298. package/dist/render/sdf/waterline.js.map +1 -0
  299. package/dist/render/shadow_mask_pass.js +142 -25
  300. package/dist/render/shadow_mask_pass.js.map +1 -1
  301. package/dist/render/shore_wave_generator.js +1193 -0
  302. package/dist/render/shore_wave_generator.js.map +1 -0
  303. package/dist/render/sky.js +516 -86
  304. package/dist/render/sky.js.map +1 -1
  305. package/dist/render/transmission_thickness_pass.js +477 -0
  306. package/dist/render/transmission_thickness_pass.js.map +1 -0
  307. package/dist/render/underwater.js +524 -0
  308. package/dist/render/underwater.js.map +1 -0
  309. package/dist/render/virtualtexture/virtual_texture.js +1214 -0
  310. package/dist/render/virtualtexture/virtual_texture.js.map +1 -0
  311. package/dist/render/volumetric_cloud/cloud_common.js +472 -0
  312. package/dist/render/volumetric_cloud/cloud_common.js.map +1 -0
  313. package/dist/render/volumetric_cloud/cloud_noise.js +189 -0
  314. package/dist/render/volumetric_cloud/cloud_noise.js.map +1 -0
  315. package/dist/render/volumetric_cloud/debug_view.js +131 -0
  316. package/dist/render/volumetric_cloud/debug_view.js.map +1 -0
  317. package/dist/render/volumetric_cloud/resources.js +380 -0
  318. package/dist/render/volumetric_cloud/resources.js.map +1 -0
  319. package/dist/render/volumetric_cloud/sky_cache.js +380 -0
  320. package/dist/render/volumetric_cloud/sky_cache.js.map +1 -0
  321. package/dist/render/volumetric_cloud/volumetric_cloud.js +318 -0
  322. package/dist/render/volumetric_cloud/volumetric_cloud.js.map +1 -0
  323. package/dist/render/water_caustics.js +1195 -0
  324. package/dist/render/water_caustics.js.map +1 -0
  325. package/dist/render/water_foam.js +627 -0
  326. package/dist/render/water_foam.js.map +1 -0
  327. package/dist/render/water_interaction.js +1795 -0
  328. package/dist/render/water_interaction.js.map +1 -0
  329. package/dist/render/weightedblended_oit.js +36 -36
  330. package/dist/render/weightedblended_oit.js.map +1 -1
  331. package/dist/scene/basesprite.js +9 -4
  332. package/dist/scene/basesprite.js.map +1 -1
  333. package/dist/scene/batchgroup.js +108 -12
  334. package/dist/scene/batchgroup.js.map +1 -1
  335. package/dist/scene/environment.js +28 -7
  336. package/dist/scene/environment.js.map +1 -1
  337. package/dist/scene/foliage.js +1020 -0
  338. package/dist/scene/foliage.js.map +1 -0
  339. package/dist/scene/foliage_buckets.js +147 -0
  340. package/dist/scene/foliage_buckets.js.map +1 -0
  341. package/dist/scene/foliage_mask.js +358 -0
  342. package/dist/scene/foliage_mask.js.map +1 -0
  343. package/dist/scene/hair.js +15 -4
  344. package/dist/scene/hair.js.map +1 -1
  345. package/dist/scene/light.js +179 -13
  346. package/dist/scene/light.js.map +1 -1
  347. package/dist/scene/mesh.js +327 -45
  348. package/dist/scene/mesh.js.map +1 -1
  349. package/dist/scene/meshdrawable.js +6 -0
  350. package/dist/scene/meshdrawable.js.map +1 -1
  351. package/dist/scene/msdftext.js +9 -3
  352. package/dist/scene/msdftext.js.map +1 -1
  353. package/dist/scene/msdftextsprite.js +9 -3
  354. package/dist/scene/msdftextsprite.js.map +1 -1
  355. package/dist/scene/particlesys.js +8 -2
  356. package/dist/scene/particlesys.js.map +1 -1
  357. package/dist/scene/physics_settings.js +157 -0
  358. package/dist/scene/physics_settings.js.map +1 -0
  359. package/dist/scene/scene.js +190 -44
  360. package/dist/scene/scene.js.map +1 -1
  361. package/dist/scene/scene_node.js +147 -6
  362. package/dist/scene/scene_node.js.map +1 -1
  363. package/dist/scene/terrain-cm/bladegrassmaterial.js +735 -0
  364. package/dist/scene/terrain-cm/bladegrassmaterial.js.map +1 -0
  365. package/dist/scene/terrain-cm/grass.js +881 -42
  366. package/dist/scene/terrain-cm/grass.js.map +1 -1
  367. package/dist/scene/terrain-cm/grass_gpu.js +929 -0
  368. package/dist/scene/terrain-cm/grass_gpu.js.map +1 -0
  369. package/dist/scene/terrain-cm/grassmaterial.js +180 -9
  370. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  371. package/dist/scene/terrain-cm/terrain-cm.js +465 -36
  372. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  373. package/dist/scene/terrain-cm/terrain_gi_albedo.js +257 -0
  374. package/dist/scene/terrain-cm/terrain_gi_albedo.js.map +1 -0
  375. package/dist/scene/terrain-cm/terrain_rvt.js +395 -0
  376. package/dist/scene/terrain-cm/terrain_rvt.js.map +1 -0
  377. package/dist/scene/update_queue.js +54 -0
  378. package/dist/scene/update_queue.js.map +1 -0
  379. package/dist/scene/water.js +997 -96
  380. package/dist/scene/water.js.map +1 -1
  381. package/dist/scene/water_surface_sampler.js +324 -0
  382. package/dist/scene/water_surface_sampler.js.map +1 -0
  383. package/dist/scene/wind.js +317 -0
  384. package/dist/scene/wind.js.map +1 -0
  385. package/dist/shaders/atmosphere.js +388 -166
  386. package/dist/shaders/atmosphere.js.map +1 -1
  387. package/dist/shaders/fog.js +100 -32
  388. package/dist/shaders/fog.js.map +1 -1
  389. package/dist/shaders/gi.js +365 -0
  390. package/dist/shaders/gi.js.map +1 -0
  391. package/dist/shaders/ltc_rect.js +202 -0
  392. package/dist/shaders/ltc_rect.js.map +1 -0
  393. package/dist/shaders/misc.js +1 -10
  394. package/dist/shaders/misc.js.map +1 -1
  395. package/dist/shaders/noise.js +5 -1
  396. package/dist/shaders/noise.js.map +1 -1
  397. package/dist/shaders/probes.js +309 -0
  398. package/dist/shaders/probes.js.map +1 -0
  399. package/dist/shaders/sdf.js +537 -0
  400. package/dist/shaders/sdf.js.map +1 -0
  401. package/dist/shaders/shadow.js +104 -70
  402. package/dist/shaders/shadow.js.map +1 -1
  403. package/dist/shaders/skin_brdf.js +243 -0
  404. package/dist/shaders/skin_brdf.js.map +1 -0
  405. package/dist/shaders/ssr.js +6 -159
  406. package/dist/shaders/ssr.js.map +1 -1
  407. package/dist/shaders/temporal.js +38 -27
  408. package/dist/shaders/temporal.js.map +1 -1
  409. package/dist/shaders/water.js +40 -87
  410. package/dist/shaders/water.js.map +1 -1
  411. package/dist/shaders/water_medium.js +42 -0
  412. package/dist/shaders/water_medium.js.map +1 -0
  413. package/dist/shadow/dom.js +110 -19
  414. package/dist/shadow/dom.js.map +1 -1
  415. package/dist/shadow/esm.js +3 -3
  416. package/dist/shadow/esm.js.map +1 -1
  417. package/dist/shadow/pcf_opt.js +15 -48
  418. package/dist/shadow/pcf_opt.js.map +1 -1
  419. package/dist/shadow/pcf_pd.js +15 -53
  420. package/dist/shadow/pcf_pd.js.map +1 -1
  421. package/dist/shadow/pcss.js +34 -9
  422. package/dist/shadow/pcss.js.map +1 -1
  423. package/dist/shadow/shadow_impl.js +3 -8
  424. package/dist/shadow/shadow_impl.js.map +1 -1
  425. package/dist/shadow/shadow_region.js +87 -49
  426. package/dist/shadow/shadow_region.js.map +1 -1
  427. package/dist/shadow/shadowmapper.js +93 -53
  428. package/dist/shadow/shadowmapper.js.map +1 -1
  429. package/dist/shadow/ssm.js +18 -72
  430. package/dist/shadow/ssm.js.map +1 -1
  431. package/dist/shadow/vsm.js +3 -3
  432. package/dist/shadow/vsm.js.map +1 -1
  433. package/dist/shapes/shape.js +44 -1
  434. package/dist/shapes/shape.js.map +1 -1
  435. package/dist/utility/buoyancy.js +287 -0
  436. package/dist/utility/buoyancy.js.map +1 -0
  437. package/dist/utility/physical.js +10 -1
  438. package/dist/utility/physical.js.map +1 -1
  439. package/dist/utility/pmrem.js +17 -43
  440. package/dist/utility/pmrem.js.map +1 -1
  441. package/dist/utility/sdf/bake.js +435 -0
  442. package/dist/utility/sdf/bake.js.map +1 -0
  443. package/dist/utility/sdf/bvh.js +576 -0
  444. package/dist/utility/sdf/bvh.js.map +1 -0
  445. package/dist/utility/serialization/manager.js +36 -6
  446. package/dist/utility/serialization/manager.js.map +1 -1
  447. package/dist/utility/serialization/scene/animation.js +77 -7
  448. package/dist/utility/serialization/scene/animation.js.map +1 -1
  449. package/dist/utility/serialization/scene/batch.js +11 -4
  450. package/dist/utility/serialization/scene/batch.js.map +1 -1
  451. package/dist/utility/serialization/scene/camera.js +140 -279
  452. package/dist/utility/serialization/scene/camera.js.map +1 -1
  453. package/dist/utility/serialization/scene/cloth.js +25 -0
  454. package/dist/utility/serialization/scene/cloth.js.map +1 -0
  455. package/dist/utility/serialization/scene/common.js +14 -6
  456. package/dist/utility/serialization/scene/common.js.map +1 -1
  457. package/dist/utility/serialization/scene/foliage.js +821 -0
  458. package/dist/utility/serialization/scene/foliage.js.map +1 -0
  459. package/dist/utility/serialization/scene/hair.js +11 -4
  460. package/dist/utility/serialization/scene/hair.js.map +1 -1
  461. package/dist/utility/serialization/scene/light.js +115 -7
  462. package/dist/utility/serialization/scene/light.js.map +1 -1
  463. package/dist/utility/serialization/scene/material.js +388 -220
  464. package/dist/utility/serialization/scene/material.js.map +1 -1
  465. package/dist/utility/serialization/scene/mesh.js +69 -4
  466. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  467. package/dist/utility/serialization/scene/node.js +140 -5
  468. package/dist/utility/serialization/scene/node.js.map +1 -1
  469. package/dist/utility/serialization/scene/node_physics.js +1318 -0
  470. package/dist/utility/serialization/scene/node_physics.js.map +1 -0
  471. package/dist/utility/serialization/scene/particle.js +11 -4
  472. package/dist/utility/serialization/scene/particle.js.map +1 -1
  473. package/dist/utility/serialization/scene/physics.js +120 -0
  474. package/dist/utility/serialization/scene/physics.js.map +1 -0
  475. package/dist/utility/serialization/scene/primitive.js +124 -10
  476. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  477. package/dist/utility/serialization/scene/scene.js +1687 -51
  478. package/dist/utility/serialization/scene/scene.js.map +1 -1
  479. package/dist/utility/serialization/scene/sprite.js +11 -4
  480. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  481. package/dist/utility/serialization/scene/terrain.js +163 -33
  482. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  483. package/dist/utility/serialization/scene/text.js +11 -4
  484. package/dist/utility/serialization/scene/text.js.map +1 -1
  485. package/dist/utility/serialization/scene/water.js +2473 -114
  486. package/dist/utility/serialization/scene/water.js.map +1 -1
  487. package/dist/utility/serialization/types.js.map +1 -1
  488. package/dist/utility/shprojector.js +97 -109
  489. package/dist/utility/shprojector.js.map +1 -1
  490. package/dist/utility/textures/foam.js +170 -0
  491. package/dist/utility/textures/foam.js.map +1 -0
  492. package/dist/utility/textures/ggxlut.js +17 -43
  493. package/dist/utility/textures/ggxlut.js.map +1 -1
  494. package/dist/utility/textures/ltcdata.js +4 -4
  495. package/dist/utility/textures/ltcdata.js.map +1 -1
  496. package/dist/utility/textures/ltclut.js +16 -6
  497. package/dist/utility/textures/ltclut.js.map +1 -1
  498. package/dist/utility/unsupported.js +24 -0
  499. package/dist/utility/unsupported.js.map +1 -0
  500. package/dist/values.js +13 -1
  501. package/dist/values.js.map +1 -1
  502. package/package.json +25 -12
  503. package/src/asset/loaders/ktx2/basis/LICENSE +201 -0
  504. package/src/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
  505. package/src/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
  506. package/src/asset/meshoptimizer/LICENSE +21 -0
@@ -1,15 +1,33 @@
1
- import { AABB, Vector3, Disposable, Matrix4x4, ClipState, Vector2 } from '@zephyr3d/base';
1
+ import { AABB, Vector3, Vector2, BoxSide, Disposable, Matrix4x4, ClipState } from '@zephyr3d/base';
2
2
  import { Primitive } from './primitive.js';
3
3
  import { getVertexAttributeIndex, VERTEX_ATTRIB_POSITION, VERTEX_ATTRIB_TEXCOORD0, getVertexAttributeFormat } from '@zephyr3d/device';
4
4
 
5
5
  const tmpAABB = new AABB();
6
6
  const tmpV3 = new Vector3();
7
+ // Scratch vectors for gather() and calcLevelAABB(), which run per camera every frame
8
+ const tmpSnappedPos = new Vector2();
9
+ const tmpTileSize = new Vector2();
10
+ const tmpBase = new Vector2();
11
+ const tmpOffset = new Vector2();
12
+ const tmpNextSnappedPos = new Vector2();
13
+ const tmpTileCentre = new Vector2();
14
+ const tmpNextBase = new Vector2();
7
15
  const rotationValues = [
8
16
  0,
9
17
  Math.PI * 1.5,
10
18
  Math.PI * 0.5,
11
19
  Math.PI
12
20
  ];
21
+ /**
22
+ * Frustum plane mask covering everything but the far plane, for a clipmap that
23
+ * reaches past it. @internal
24
+ */ /**
25
+ * Instance data is rewritten for every camera every frame: dynamic buffers keep their upload
26
+ * staging buffers for reuse instead of creating and destroying one per upload
27
+ */ const INSTANCE_BUFFER_OPTIONS = {
28
+ dynamic: true
29
+ };
30
+ const ALL_PLANES_EXCEPT_FAR = 0b111111 & ~(1 << BoxSide.BACK);
13
31
  /** @internal */ class Clipmap extends Disposable {
14
32
  _instanceDataPool;
15
33
  _instanceDataPoolSize;
@@ -37,7 +55,13 @@ const rotationValues = [
37
55
  _seamMesh;
38
56
  _seamMeshLines;
39
57
  _seamMeshAABB;
58
+ _skirtMesh;
59
+ _skirtMeshLines;
40
60
  _wireframe;
61
+ _levelAABBs;
62
+ /** Grid origin of the gather/cull call in progress, see ClipmapGatherContext.gridOriginX */ _originX;
63
+ _originZ;
64
+ _cullScratch;
41
65
  constructor(resolution, extraInstanceBuffers, maxMipLevels = 64){
42
66
  super();
43
67
  if (extraInstanceBuffers && extraInstanceBuffers.findIndex((val)=>getVertexAttributeIndex(val) === VERTEX_ATTRIB_POSITION || getVertexAttributeIndex(val) === VERTEX_ATTRIB_TEXCOORD0 || getVertexAttributeFormat(val) !== 'f32') >= 0) {
@@ -55,11 +79,16 @@ const rotationValues = [
55
79
  this._nonInstanceMipLevelDataPool = [];
56
80
  this._nonInstanceMipLevelDataPoolSize = 0;
57
81
  this._wireframe = false;
82
+ this._levelAABBs = [];
83
+ this._originX = 0;
84
+ this._originZ = 0;
85
+ this._cullScratch = new Map();
58
86
  this.generateCrossMesh();
59
87
  this.generateFillerMesh();
60
88
  this.generateSeamMesh();
61
89
  this.generateTileMesh();
62
90
  this.generateTrimMesh();
91
+ this.generateSkirtMesh();
63
92
  }
64
93
  get wireframe() {
65
94
  return this._wireframe;
@@ -73,11 +102,13 @@ const rotationValues = [
73
102
  set tileResolution(val) {
74
103
  if (val !== this._tileResolution) {
75
104
  this._tileResolution = val;
105
+ this._cullScratch.clear();
76
106
  this.generateCrossMesh();
77
107
  this.generateFillerMesh();
78
108
  this.generateSeamMesh();
79
109
  this.generateTileMesh();
80
110
  this.generateTrimMesh();
111
+ this.generateSkirtMesh();
81
112
  }
82
113
  }
83
114
  allocInstanceBuffer() {
@@ -175,10 +206,10 @@ const rotationValues = [
175
206
  }
176
207
  }
177
208
  this._tileMesh.createAndSetVertexBuffer('position_f32x3', vertices);
178
- this._tileMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
209
+ this._tileMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
179
210
  this._instanceDataPoolSize++;
180
211
  for (const fmt of this._extraInstanceBuffers){
181
- this._tileMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
212
+ this._tileMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
182
213
  this._instanceDataPoolSize++;
183
214
  }
184
215
  this._tileMesh.createAndSetIndexBuffer(indices);
@@ -198,10 +229,10 @@ const rotationValues = [
198
229
  this._tileMeshLines?.dispose();
199
230
  this._tileMeshLines = new Primitive();
200
231
  this._tileMeshLines.setVertexBuffer(this._tileMesh.getVertexBuffer('position'));
201
- this._tileMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
232
+ this._tileMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
202
233
  this._instanceDataPoolSize++;
203
234
  for (const fmt of this._extraInstanceBuffers){
204
- this._tileMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
235
+ this._tileMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
205
236
  this._instanceDataPoolSize++;
206
237
  }
207
238
  this._tileMeshLines.createAndSetIndexBuffer(indicesLines);
@@ -273,10 +304,10 @@ const rotationValues = [
273
304
  }
274
305
  }
275
306
  this._fillerMesh.createAndSetVertexBuffer('position_f32x3', vertices);
276
- this._fillerMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
307
+ this._fillerMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
277
308
  this._instanceDataPoolSize++;
278
309
  for (const fmt of this._extraInstanceBuffers){
279
- this._fillerMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
310
+ this._fillerMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
280
311
  this._instanceDataPoolSize++;
281
312
  }
282
313
  this._fillerMesh.createAndSetIndexBuffer(indices);
@@ -296,10 +327,10 @@ const rotationValues = [
296
327
  this._fillerMeshLines?.dispose();
297
328
  this._fillerMeshLines = new Primitive();
298
329
  this._fillerMeshLines.setVertexBuffer(this._fillerMesh.getVertexBuffer('position'));
299
- this._fillerMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
330
+ this._fillerMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
300
331
  this._instanceDataPoolSize++;
301
332
  for (const fmt of this._extraInstanceBuffers){
302
- this._fillerMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
333
+ this._fillerMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
303
334
  this._instanceDataPoolSize++;
304
335
  }
305
336
  this._fillerMeshLines.createAndSetIndexBuffer(indicesLines);
@@ -350,10 +381,10 @@ const rotationValues = [
350
381
  indices[n++] = startOfHorizonal + (i + 0) * 2 + 1;
351
382
  }
352
383
  this._trimMesh.createAndSetVertexBuffer('position_f32x3', vertices);
353
- this._trimMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
384
+ this._trimMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
354
385
  this._instanceDataPoolSize++;
355
386
  for (const fmt of this._extraInstanceBuffers){
356
- this._trimMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
387
+ this._trimMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
357
388
  this._instanceDataPoolSize++;
358
389
  }
359
390
  this._trimMesh.createAndSetIndexBuffer(indices);
@@ -373,10 +404,10 @@ const rotationValues = [
373
404
  this._trimMeshLines?.dispose();
374
405
  this._trimMeshLines = new Primitive();
375
406
  this._trimMeshLines.setVertexBuffer(this._trimMesh.getVertexBuffer('position'));
376
- this._trimMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
407
+ this._trimMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
377
408
  this._instanceDataPoolSize++;
378
409
  for (const fmt of this._extraInstanceBuffers){
379
- this._trimMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
410
+ this._trimMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
380
411
  this._instanceDataPoolSize++;
381
412
  }
382
413
  this._trimMeshLines.createAndSetIndexBuffer(indicesLines);
@@ -437,10 +468,10 @@ const rotationValues = [
437
468
  this._crossMesh?.dispose();
438
469
  this._crossMesh = new Primitive();
439
470
  this._crossMesh.createAndSetVertexBuffer('position_f32x3', vertices);
440
- this._crossMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance');
471
+ this._crossMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
441
472
  this._nonInstanceDataPoolSize++;
442
473
  for (const fmt of this._extraInstanceBuffers){
443
- this._crossMesh.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance');
474
+ this._crossMesh.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
444
475
  this._nonInstanceDataPoolSize++;
445
476
  }
446
477
  this._crossMesh.createAndSetIndexBuffer(indices);
@@ -460,10 +491,10 @@ const rotationValues = [
460
491
  this._crossMeshLines?.dispose();
461
492
  this._crossMeshLines = new Primitive();
462
493
  this._crossMeshLines.setVertexBuffer(this._crossMesh.getVertexBuffer('position'));
463
- this._crossMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance');
494
+ this._crossMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
464
495
  this._nonInstanceDataPoolSize++;
465
496
  for (const fmt of this._extraInstanceBuffers){
466
- this._crossMeshLines.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance');
497
+ this._crossMeshLines.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
467
498
  this._nonInstanceDataPoolSize++;
468
499
  }
469
500
  this._crossMeshLines.createAndSetIndexBuffer(indicesLines);
@@ -490,6 +521,16 @@ const rotationValues = [
490
521
  vertices[(clipmapVertResolution * 3 + i) * 3 + 1] = clipmapVertResolution - i;
491
522
  vertices[(clipmapVertResolution * 3 + i) * 3 + 2] = 0;
492
523
  }
524
+ // Seam triangles are collinear in XZ by design: each odd vertex is the midpoint between two
525
+ // coarse-level vertices. Flag those midpoints with position.z = -side (1..4) so a shader
526
+ // clamping the grid to a finite region can snap them onto their previous neighbour when
527
+ // the whole seam edge lies outside it; otherwise the flap they form stands up as a vertical
528
+ // curtain along the region border. Negative, so it never reads as the skirt flag.
529
+ for(let side = 0; side < 4; side++){
530
+ for(let i = 1; i < clipmapVertResolution; i += 2){
531
+ vertices[(clipmapVertResolution * side + i) * 3 + 2] = -(side + 1);
532
+ }
533
+ }
493
534
  const indices = new Uint16Array(clipmapVertResolution * 6);
494
535
  let n = 0;
495
536
  for(let i = 0; i < clipmapVertResolution * 4; i += 2){
@@ -499,10 +540,10 @@ const rotationValues = [
499
540
  }
500
541
  indices[indices.length - 1] = 0;
501
542
  this._seamMesh.createAndSetVertexBuffer('position_f32x3', vertices);
502
- this._seamMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
543
+ this._seamMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
503
544
  this._instanceDataPoolSize++;
504
545
  for (const fmt of this._extraInstanceBuffers){
505
- this._seamMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
546
+ this._seamMesh.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
506
547
  this._instanceDataPoolSize++;
507
548
  }
508
549
  this._seamMesh.createAndSetIndexBuffer(indices);
@@ -522,10 +563,10 @@ const rotationValues = [
522
563
  this._seamMeshLines?.dispose();
523
564
  this._seamMeshLines = new Primitive();
524
565
  this._seamMeshLines.setVertexBuffer(this._seamMesh.getVertexBuffer('position'));
525
- this._seamMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance');
566
+ this._seamMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
526
567
  this._instanceDataPoolSize++;
527
568
  for (const fmt of this._extraInstanceBuffers){
528
- this._seamMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance');
569
+ this._seamMeshLines.createAndSetVertexBuffer(fmt, this.allocInstanceBuffer(), 'instance', INSTANCE_BUFFER_OPTIONS);
529
570
  this._instanceDataPoolSize++;
530
571
  }
531
572
  this._seamMeshLines.createAndSetIndexBuffer(indicesLines);
@@ -533,6 +574,112 @@ const rotationValues = [
533
574
  this._seamMeshLines.indexCount = indicesLines.length;
534
575
  this._seamMeshLines.primitiveType = 'line-list';
535
576
  }
577
+ /**
578
+ * Ring of quads welded to the outer boundary of the outermost level, whose
579
+ * outer edge the vertex shader is expected to push towards the horizon.
580
+ *
581
+ * The inner edge has to land on exactly the vertices the outermost tiles end
582
+ * on, or a displaced surface tears along the join: both sides evaluate the
583
+ * same wave function, so identical world positions are what keeps them
584
+ * identical. That boundary runs from `-2 * tileResolution` to
585
+ * `2 * tileResolution + 1` in the level's local units - the asymmetry is the
586
+ * `fillX`/`fillY` shift `gather` applies to the far tiles - which is
587
+ * `clipmapVertResolution` vertices a side, the same density the seam mesh
588
+ * uses.
589
+ *
590
+ * Outer vertices are flagged with `position.z = 1`. Every other clipmap mesh
591
+ * leaves z at 0 and the shader's clipmap matrix only reads xy, so the
592
+ * component is free to carry the flag without a second vertex stream.
593
+ */ generateSkirtMesh() {
594
+ const clipmapVertResolution = this._tileResolution * 4 + 2;
595
+ const lo = -2 * this._tileResolution;
596
+ const hi = 2 * this._tileResolution + 1;
597
+ // Unique positions around the perimeter: each side contributes all but its
598
+ // last vertex, which is the next side's first, so the loop closes without
599
+ // doubling the corners.
600
+ const perSide = clipmapVertResolution - 1;
601
+ const ringCount = perSide * 4;
602
+ const vertices = new Float32Array(ringCount * 2 * 3);
603
+ // Placeholder extent for the outer ring. The vertex shader relocates these
604
+ // vertices, so this only has to be outside the inner ring and finite.
605
+ const outerFactor = 8;
606
+ const centre = (lo + hi) * 0.5;
607
+ let n = 0;
608
+ const putRing = (index, x, y, outer)=>{
609
+ const px = outer ? centre + (x - centre) * outerFactor : x;
610
+ const py = outer ? centre + (y - centre) * outerFactor : y;
611
+ const base = (index + (outer ? ringCount : 0)) * 3;
612
+ vertices[base + 0] = px;
613
+ vertices[base + 1] = py;
614
+ vertices[base + 2] = outer ? 1 : 0;
615
+ };
616
+ for(let i = 0; i < perSide; i++){
617
+ putRing(n, lo + i, lo, false);
618
+ putRing(n, lo + i, lo, true);
619
+ n++;
620
+ }
621
+ for(let i = 0; i < perSide; i++){
622
+ putRing(n, hi, lo + i, false);
623
+ putRing(n, hi, lo + i, true);
624
+ n++;
625
+ }
626
+ for(let i = 0; i < perSide; i++){
627
+ putRing(n, hi - i, hi, false);
628
+ putRing(n, hi - i, hi, true);
629
+ n++;
630
+ }
631
+ for(let i = 0; i < perSide; i++){
632
+ putRing(n, lo, hi - i, false);
633
+ putRing(n, lo, hi - i, true);
634
+ n++;
635
+ }
636
+ const indices = new Uint16Array(ringCount * 6);
637
+ n = 0;
638
+ for(let k = 0; k < ringCount; k++){
639
+ const j = (k + 1) % ringCount;
640
+ indices[n++] = k;
641
+ indices[n++] = j;
642
+ indices[n++] = ringCount + j;
643
+ indices[n++] = k;
644
+ indices[n++] = ringCount + j;
645
+ indices[n++] = ringCount + k;
646
+ }
647
+ this._skirtMesh?.dispose();
648
+ this._skirtMesh = new Primitive();
649
+ this._skirtMesh.createAndSetVertexBuffer('position_f32x3', vertices);
650
+ this._skirtMesh.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
651
+ this._nonInstanceDataPoolSize++;
652
+ for (const fmt of this._extraInstanceBuffers){
653
+ this._skirtMesh.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
654
+ this._nonInstanceDataPoolSize++;
655
+ }
656
+ this._skirtMesh.createAndSetIndexBuffer(indices);
657
+ this._skirtMesh.indexStart = 0;
658
+ this._skirtMesh.indexCount = indices.length;
659
+ this._skirtMesh.primitiveType = 'triangle-list';
660
+ const indicesLines = new Uint16Array(indices.length * 2);
661
+ for(let i = 0; i < indices.length / 3; i++){
662
+ indicesLines[i * 6 + 0] = indices[i * 3 + 0];
663
+ indicesLines[i * 6 + 1] = indices[i * 3 + 1];
664
+ indicesLines[i * 6 + 2] = indices[i * 3 + 1];
665
+ indicesLines[i * 6 + 3] = indices[i * 3 + 2];
666
+ indicesLines[i * 6 + 4] = indices[i * 3 + 2];
667
+ indicesLines[i * 6 + 5] = indices[i * 3 + 0];
668
+ }
669
+ this._skirtMeshLines?.dispose();
670
+ this._skirtMeshLines = new Primitive();
671
+ this._skirtMeshLines.setVertexBuffer(this._skirtMesh.getVertexBuffer('position'));
672
+ this._skirtMeshLines.createAndSetVertexBuffer('tex0_f32x4', this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
673
+ this._nonInstanceDataPoolSize++;
674
+ for (const fmt of this._extraInstanceBuffers){
675
+ this._skirtMeshLines.createAndSetVertexBuffer(fmt, this.allocNonInstanceBuffer(0, 0, 0, 0), 'instance', INSTANCE_BUFFER_OPTIONS);
676
+ this._nonInstanceDataPoolSize++;
677
+ }
678
+ this._skirtMeshLines.createAndSetIndexBuffer(indicesLines);
679
+ this._skirtMeshLines.indexStart = 0;
680
+ this._skirtMeshLines.indexCount = indicesLines.length;
681
+ this._skirtMeshLines.primitiveType = 'line-list';
682
+ }
536
683
  intervalsOverlap(a0, a1, b0, b1) {
537
684
  return a0 <= b1 && b0 <= a1;
538
685
  }
@@ -543,10 +690,10 @@ const rotationValues = [
543
690
  } else {
544
691
  AABB.transform(aabb, Matrix4x4.rotationZ(rotation), tmpAABB);
545
692
  }
546
- const minX = (tmpAABB.minPoint.x * scale + offset.x) * gridScale;
547
- const maxX = (tmpAABB.maxPoint.x * scale + offset.x) * gridScale;
548
- const minZ = (tmpAABB.minPoint.y * scale + offset.y) * gridScale;
549
- const maxZ = (tmpAABB.maxPoint.y * scale + offset.y) * gridScale;
693
+ const minX = (tmpAABB.minPoint.x * scale + offset.x) * gridScale + this._originX;
694
+ const maxX = (tmpAABB.maxPoint.x * scale + offset.x) * gridScale + this._originX;
695
+ const minZ = (tmpAABB.minPoint.y * scale + offset.y) * gridScale + this._originZ;
696
+ const maxZ = (tmpAABB.maxPoint.y * scale + offset.y) * gridScale + this._originZ;
550
697
  if (minX < outAABB.minPoint.x) {
551
698
  outAABB.minPoint.x = minX;
552
699
  }
@@ -567,27 +714,46 @@ const rotationValues = [
567
714
  } else {
568
715
  AABB.transform(aabb, Matrix4x4.rotationZ(rotation), tmpAABB);
569
716
  }
570
- const minX = (tmpAABB.minPoint.x * scale + offset.x) * gridScale;
571
- const maxX = (tmpAABB.maxPoint.x * scale + offset.x) * gridScale;
572
- const minZ = (tmpAABB.minPoint.y * scale + offset.y) * gridScale;
573
- const maxZ = (tmpAABB.maxPoint.y * scale + offset.y) * gridScale;
717
+ const minX = (tmpAABB.minPoint.x * scale + offset.x) * gridScale + this._originX;
718
+ const maxX = (tmpAABB.maxPoint.x * scale + offset.x) * gridScale + this._originX;
719
+ const minZ = (tmpAABB.minPoint.y * scale + offset.y) * gridScale + this._originZ;
720
+ const maxZ = (tmpAABB.maxPoint.y * scale + offset.y) * gridScale + this._originZ;
574
721
  ctx.calcAABB(ctx.userData, minX, maxX, minZ, maxZ, tmpAABB, level);
722
+ if (camera.clipMask) {
723
+ // Shadow cull cameras test only some planes: a directional cascade keeps casters at any
724
+ // depth along the light.
725
+ const mask = ctx.skirt ? camera.clipMask & ALL_PLANES_EXCEPT_FAR : camera.clipMask;
726
+ return tmpAABB.getClipStateWithFrustumMask(camera.frustum, mask) !== ClipState.NOT_CLIPPED;
727
+ }
728
+ if (ctx.skirt) {
729
+ // Every plane except the far one. A skirted clipmap deliberately reaches
730
+ // past the far plane and pins the depth of whatever lands beyond it, so
731
+ // culling against that plane here would throw away exactly the tiles the
732
+ // skirt is there to lead up to - leaving a gap between the last surviving
733
+ // tile and the ring, with the sky showing through it.
734
+ return tmpAABB.getClipStateWithFrustumMask(camera.frustum, ALL_PLANES_EXCEPT_FAR) !== ClipState.NOT_CLIPPED;
735
+ }
575
736
  return tmpAABB.getClipStateWithFrustum(camera.frustum) !== ClipState.NOT_CLIPPED;
576
737
  }
577
- calcLevelAABB(camera, minMaxWorldPos, gridScale) {
738
+ calcLevelAABB(camera, minMaxWorldPos, gridScale, gridOriginX = 0, gridOriginZ = 0) {
739
+ this._originX = gridOriginX;
740
+ this._originZ = gridOriginZ;
578
741
  const mipLevels = this.calcMipLevels(camera, minMaxWorldPos, gridScale);
579
742
  camera.getWorldPosition(tmpV3);
580
- const snappedPos = new Vector2();
581
- const tileSize = new Vector2();
582
- const base = new Vector2();
583
- const offset = new Vector2();
584
- const posX = tmpV3.x / gridScale;
585
- const posY = tmpV3.z / gridScale;
586
- const outAABB = [];
587
- for(let i = 0; i < mipLevels; i++){
588
- const aabb = new AABB();
743
+ const snappedPos = tmpSnappedPos;
744
+ const tileSize = tmpTileSize;
745
+ const base = tmpBase;
746
+ const offset = tmpOffset;
747
+ const posX = (tmpV3.x - gridOriginX) / gridScale;
748
+ const posY = (tmpV3.z - gridOriginZ) / gridScale;
749
+ // Reused across calls: callers consume the result before the next one
750
+ const outAABB = this._levelAABBs;
751
+ while(outAABB.length < mipLevels){
752
+ outAABB.push(new AABB());
753
+ }
754
+ outAABB.length = mipLevels;
755
+ for (const aabb of outAABB){
589
756
  aabb.beginExtend();
590
- outAABB.push(aabb);
591
757
  }
592
758
  snappedPos.setXY(Math.floor(posX), Math.floor(posY));
593
759
  // cross
@@ -613,25 +779,29 @@ const rotationValues = [
613
779
  // draw filler
614
780
  this.updateAABB(this._fillerMeshAABB, null, snappedPos, scale, gridScale, aabb);
615
781
  const nextScale = scale * 2;
616
- const nextSnappedPos = new Vector2(Math.floor(posX / nextScale) * nextScale, Math.floor(posY / nextScale) * nextScale);
782
+ const nextSnappedPos = tmpNextSnappedPos.setXY(Math.floor(posX / nextScale) * nextScale, Math.floor(posY / nextScale) * nextScale);
617
783
  // draw trim
618
- const tileCentre = new Vector2(snappedPos.x + scale * 0.5, snappedPos.y + scale * 0.5);
619
- const d = new Vector2(posX - nextSnappedPos.x, posY - nextSnappedPos.y);
784
+ const tileCentre = tmpTileCentre.setXY(snappedPos.x + scale * 0.5, snappedPos.y + scale * 0.5);
620
785
  let r = 0;
621
- r |= d.x >= scale ? 0 : 2;
622
- r |= d.y >= scale ? 0 : 1;
786
+ r |= posX - nextSnappedPos.x >= scale ? 0 : 2;
787
+ r |= posY - nextSnappedPos.y >= scale ? 0 : 1;
623
788
  this.updateAABB(this._trimMeshAABB, rotationValues[r], tileCentre, scale, gridScale, aabb);
624
789
  // draw seam
625
- const nextBase = new Vector2(nextSnappedPos.x - (this._tileResolution << l + 1), nextSnappedPos.y - (this._tileResolution << l + 1));
790
+ const nextBase = tmpNextBase.setXY(nextSnappedPos.x - (this._tileResolution << l + 1), nextSnappedPos.y - (this._tileResolution << l + 1));
626
791
  this.updateAABB(this._seamMeshAABB, null, nextBase, scale, gridScale, aabb);
627
792
  }
628
793
  return outAABB;
629
794
  }
630
- calcMipLevels(camera, minMaxWorldPos, gridScale) {
795
+ calcMipLevels(camera, minMaxWorldPos, gridScale, viewDistance) {
631
796
  camera.getWorldPosition(tmpV3);
632
797
  const distX = Math.max(Math.abs(tmpV3.x - minMaxWorldPos.x), Math.abs(tmpV3.x - minMaxWorldPos.z));
633
798
  const distY = Math.max(Math.abs(tmpV3.z - minMaxWorldPos.y), Math.abs(tmpV3.z - minMaxWorldPos.w));
634
- const maxDist = Math.min(Math.max(distX, distY), camera.getFarPlane());
799
+ // The reach is the caller's when it supplies one; the far plane is only the
800
+ // default. An infinite water surface draws its horizon ring beyond the far
801
+ // plane and clamps the depth in the vertex shader, so capping the levels
802
+ // here would starve it of the very tiles it needs.
803
+ const maxReach = viewDistance && viewDistance > 0 ? viewDistance : camera.getFarPlane();
804
+ const maxDist = Math.min(Math.max(distX, distY), maxReach);
635
805
  return Math.min(Math.max(Math.ceil(Math.log2(maxDist / (this._tileResolution * gridScale))), 0) + 1, this._maxMipLevels);
636
806
  }
637
807
  addInstance(info, rotation, offsetX, offsetY, scale, mipLevel) {
@@ -649,14 +819,16 @@ const rotationValues = [
649
819
  this._nonInstanceDataPoolSize = this._nonInstanceDataPool.length;
650
820
  this._nonInstanceMipLevelDataPoolSize = this._nonInstanceMipLevelDataPool.length;
651
821
  const renderData = [];
652
- const mipLevels = this.calcMipLevels(context.camera, context.minMaxWorldPos, context.gridScale);
822
+ const mipLevels = this.calcMipLevels(context.camera, context.minMaxWorldPos, context.gridScale, context.viewDistance);
653
823
  context.camera.getWorldPosition(tmpV3);
654
- const snappedPos = new Vector2();
655
- const tileSize = new Vector2();
656
- const base = new Vector2();
657
- const offset = new Vector2();
658
- const posX = tmpV3.x / context.gridScale;
659
- const posY = tmpV3.z / context.gridScale;
824
+ const snappedPos = tmpSnappedPos;
825
+ const tileSize = tmpTileSize;
826
+ const base = tmpBase;
827
+ const offset = tmpOffset;
828
+ this._originX = context.gridOriginX ?? 0;
829
+ this._originZ = context.gridOriginZ ?? 0;
830
+ const posX = (tmpV3.x - this._originX) / context.gridScale;
831
+ const posY = (tmpV3.z - this._originZ) / context.gridScale;
660
832
  // draw cross
661
833
  snappedPos.setXY(Math.floor(posX), Math.floor(posY));
662
834
  if (!context.frustumCulling || this.visible(context, this._crossMeshAABB, context.camera, null, snappedPos, 1, context.gridScale, 0)) {
@@ -711,7 +883,13 @@ const rotationValues = [
711
883
  const fillX = x >= 2 ? scale : 0;
712
884
  const fillY = y >= 2 ? scale : 0;
713
885
  offset.setXY(base.x + x * tileSize.x + fillX, base.y + y * tileSize.y + fillY);
714
- if (this.intervalsOverlap(offset.x * context.gridScale, (offset.x + tileSize.x) * context.gridScale, context.minMaxWorldPos.x, context.minMaxWorldPos.z) && this.intervalsOverlap(offset.y * context.gridScale, (offset.y + tileSize.y) * context.gridScale, context.minMaxWorldPos.y, context.minMaxWorldPos.w)) {
886
+ if (// An unbounded surface has no rectangle to keep tiles inside of.
887
+ // Passing a very large one instead does not work: the clipmap's
888
+ // outermost level reaches 2 * tileResolution << (levels - 1), which
889
+ // at a raised camera is tens of kilometres and outgrows any sentinel
890
+ // rectangle - dropping the outer tiles and opening a band of sky
891
+ // between the last one drawn and the horizon skirt.
892
+ context.skirt || this.intervalsOverlap(offset.x * context.gridScale + this._originX, (offset.x + tileSize.x) * context.gridScale + this._originX, context.minMaxWorldPos.x, context.minMaxWorldPos.z) && this.intervalsOverlap(offset.y * context.gridScale + this._originZ, (offset.y + tileSize.y) * context.gridScale + this._originZ, context.minMaxWorldPos.y, context.minMaxWorldPos.w)) {
715
893
  if (!context.frustumCulling || this.visible(context, this._tileMeshBBox, context.camera, null, offset, scale, context.gridScale, l)) {
716
894
  this.addInstance(tilePrimitives, rotationValues[0], offset.x, offset.y, scale, l);
717
895
  }
@@ -724,18 +902,17 @@ const rotationValues = [
724
902
  }
725
903
  if (l !== mipLevels - 1) {
726
904
  const nextScale = scale * 2;
727
- const nextSnappedPos = new Vector2(Math.floor(posX / nextScale) * nextScale, Math.floor(posY / nextScale) * nextScale);
905
+ const nextSnappedPos = tmpNextSnappedPos.setXY(Math.floor(posX / nextScale) * nextScale, Math.floor(posY / nextScale) * nextScale);
728
906
  // draw trim
729
- const tileCentre = new Vector2(snappedPos.x + scale * 0.5, snappedPos.y + scale * 0.5);
730
- const d = new Vector2(posX - nextSnappedPos.x, posY - nextSnappedPos.y);
907
+ const tileCentre = tmpTileCentre.setXY(snappedPos.x + scale * 0.5, snappedPos.y + scale * 0.5);
731
908
  let r = 0;
732
- r |= d.x >= scale ? 0 : 2;
733
- r |= d.y >= scale ? 0 : 1;
909
+ r |= posX - nextSnappedPos.x >= scale ? 0 : 2;
910
+ r |= posY - nextSnappedPos.y >= scale ? 0 : 1;
734
911
  if (!context.frustumCulling || this.visible(context, this._trimMeshAABB, context.camera, rotationValues[r], tileCentre, scale, context.gridScale, l)) {
735
912
  this.addInstance(trimPrimitives, rotationValues[r], tileCentre.x, tileCentre.y, scale, l);
736
913
  }
737
914
  // draw seam
738
- const nextBase = new Vector2(nextSnappedPos.x - (this._tileResolution << l + 1), nextSnappedPos.y - (this._tileResolution << l + 1));
915
+ const nextBase = tmpNextBase.setXY(nextSnappedPos.x - (this._tileResolution << l + 1), nextSnappedPos.y - (this._tileResolution << l + 1));
739
916
  if (!context.frustumCulling || this.visible(context, this._seamMeshAABB, context.camera, null, nextBase, scale, context.gridScale, l)) {
740
917
  this.addInstance(seamPrimitives, rotationValues[0], nextBase.x, nextBase.y, scale, l);
741
918
  }
@@ -753,11 +930,98 @@ const rotationValues = [
753
930
  if (seamPrimitives.numInstances > 0) {
754
931
  renderData.push(seamPrimitives);
755
932
  }
933
+ if (context.skirt) {
934
+ // Welded to the outer boundary of the outermost level, so it carries that
935
+ // level's scale and snapped origin. Never frustum-culled: the ring spans
936
+ // the whole horizon, and its outer edge is relocated by the vertex shader,
937
+ // so the AABB tested here would not describe where it actually lands.
938
+ const outerLevel = mipLevels - 1;
939
+ const outerScale = 1 << outerLevel;
940
+ snappedPos.setXY(Math.floor(posX / outerScale) * outerScale, Math.floor(posY / outerScale) * outerScale);
941
+ renderData.push({
942
+ primitive: this._wireframe ? this._skirtMeshLines : this._skirtMesh,
943
+ numInstances: 1,
944
+ instanceDatas: this.allocNonInstanceBuffer(rotationValues[0], outerScale, snappedPos.x, snappedPos.y),
945
+ mipLevels: this.allocNonInstanceMipLevelBuffer(outerLevel),
946
+ maxMiplevel: outerLevel
947
+ });
948
+ }
756
949
  for (const info of renderData){
757
950
  info.primitive.getVertexBuffer('texCoord0').bufferSubData(0, info.instanceDatas, 0, info.numInstances * 4);
758
951
  }
759
952
  return renderData;
760
953
  }
954
+ /**
955
+ * Keeps the instances of a set returned by {@link Clipmap.gather} that `context.camera` can
956
+ * see, and uploads them in place of the gathered ones.
957
+ *
958
+ * For passes that render the same clipmap from several cameras - a shadow map culls each
959
+ * cascade or cube face with its own - gather once without frustum culling, then call this
960
+ * before each draw. The source set is left untouched, so it can be culled again for the next
961
+ * camera; the returned set is only valid until the next call.
962
+ *
963
+ * Non-instanced meshes (the cross and the skirt) are always kept.
964
+ *
965
+ * @param renderData - A set returned by gather() for this clipmap in the current frame
966
+ * @param context - Gather context whose camera is the one to cull with
967
+ * @returns The culled set
968
+ */ cullInstances(renderData, context) {
969
+ this._originX = context.gridOriginX ?? 0;
970
+ this._originZ = context.gridOriginZ ?? 0;
971
+ const result = [];
972
+ for (const info of renderData){
973
+ const meshAABB = this.getInstancedMeshAABB(info.primitive);
974
+ if (!meshAABB) {
975
+ result.push(info);
976
+ continue;
977
+ }
978
+ let scratch = this._cullScratch.get(info.primitive);
979
+ if (!scratch) {
980
+ scratch = {
981
+ instanceDatas: new Float32Array(info.instanceDatas.length),
982
+ mipLevels: new Float32Array(info.mipLevels.length)
983
+ };
984
+ this._cullScratch.set(info.primitive, scratch);
985
+ }
986
+ let numInstances = 0;
987
+ let maxMiplevel = 0;
988
+ for(let i = 0; i < info.numInstances; i++){
989
+ const rotation = info.instanceDatas[i * 4 + 0];
990
+ const scale = info.instanceDatas[i * 4 + 1];
991
+ const level = info.mipLevels[i];
992
+ tmpOffset.setXY(info.instanceDatas[i * 4 + 2], info.instanceDatas[i * 4 + 3]);
993
+ if (this.visible(context, meshAABB, context.camera, rotation, tmpOffset, scale, context.gridScale, level)) {
994
+ scratch.instanceDatas.set(info.instanceDatas.subarray(i * 4, i * 4 + 4), numInstances * 4);
995
+ scratch.mipLevels[numInstances] = level;
996
+ maxMiplevel = Math.max(maxMiplevel, level);
997
+ numInstances++;
998
+ }
999
+ }
1000
+ if (numInstances > 0) {
1001
+ info.primitive.getVertexBuffer('texCoord0').bufferSubData(0, scratch.instanceDatas, 0, numInstances * 4);
1002
+ result.push({
1003
+ primitive: info.primitive,
1004
+ numInstances,
1005
+ instanceDatas: scratch.instanceDatas,
1006
+ mipLevels: scratch.mipLevels,
1007
+ maxMiplevel
1008
+ });
1009
+ }
1010
+ }
1011
+ return result;
1012
+ }
1013
+ /** Local bounds of the instanced mesh behind a primitive, null for the non-instanced ones */ getInstancedMeshAABB(primitive) {
1014
+ if (primitive === this._tileMesh || primitive === this._tileMeshLines) {
1015
+ return this._tileMeshBBox;
1016
+ } else if (primitive === this._fillerMesh || primitive === this._fillerMeshLines) {
1017
+ return this._fillerMeshAABB;
1018
+ } else if (primitive === this._trimMesh || primitive === this._trimMeshLines) {
1019
+ return this._trimMeshAABB;
1020
+ } else if (primitive === this._seamMesh || primitive === this._seamMeshLines) {
1021
+ return this._seamMeshAABB;
1022
+ }
1023
+ return null;
1024
+ }
761
1025
  /** Disposes the clipmap and release all meshes */ onDispose() {
762
1026
  super.onDispose();
763
1027
  this._crossMesh.dispose();
@@ -770,6 +1034,8 @@ const rotationValues = [
770
1034
  this._trimMeshLines.dispose();
771
1035
  this._tileMesh.dispose();
772
1036
  this._tileMeshLines.dispose();
1037
+ this._skirtMesh.dispose();
1038
+ this._skirtMeshLines.dispose();
773
1039
  }
774
1040
  }
775
1041