@zephyr3d/scene 0.9.2 → 0.9.4

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 (513) hide show
  1. package/dist/animation/animationset.js +135 -135
  2. package/dist/animation/animationset.js.map +1 -1
  3. package/dist/animation/ik/ik_chain_builder.js +68 -0
  4. package/dist/animation/ik/ik_chain_builder.js.map +1 -0
  5. package/dist/animation/ik/ik_pole_constraint.js +2 -7
  6. package/dist/animation/ik/ik_pole_constraint.js.map +1 -1
  7. package/dist/animation/joint_dynamics/controller.js +146 -146
  8. package/dist/animation/joint_dynamics/controller.js.map +1 -1
  9. package/dist/animation/joint_dynamics/math.js +16 -0
  10. package/dist/animation/joint_dynamics/math.js.map +1 -0
  11. package/dist/animation/spring/spring_system.js +75 -75
  12. package/dist/animation/spring/spring_system.js.map +1 -1
  13. package/dist/animation/spring2/constraints.js.map +1 -1
  14. package/dist/animation/spring2/controller.js +64 -64
  15. package/dist/animation/spring2/controller.js.map +1 -1
  16. package/dist/animation/spring2/math.js.map +1 -1
  17. package/dist/animation/spring2/spring_system.js +8 -8
  18. package/dist/animation/spring2/spring_system.js.map +1 -1
  19. package/dist/app/engine.js +119 -71
  20. package/dist/app/engine.js.map +1 -1
  21. package/dist/asset/assetmanager.js +296 -244
  22. package/dist/asset/assetmanager.js.map +1 -1
  23. package/dist/asset/loaders/gltf/gltf_loader.js +1 -0
  24. package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
  25. package/dist/camera/camera.js +184 -184
  26. package/dist/camera/camera.js.map +1 -1
  27. package/dist/index.d.ts +685 -38
  28. package/dist/index.js +11 -2
  29. package/dist/index.js.map +1 -1
  30. package/dist/material/material.js +290 -290
  31. package/dist/material/material.js.map +1 -1
  32. package/dist/material/msdf_text.js +180 -0
  33. package/dist/material/msdf_text.js.map +1 -0
  34. package/dist/material/msdf_text_sprite.js +64 -0
  35. package/dist/material/msdf_text_sprite.js.map +1 -0
  36. package/dist/material/pbrblueprint.js +123 -108
  37. package/dist/material/pbrblueprint.js.map +1 -1
  38. package/dist/material/shader/helper.js +6 -3
  39. package/dist/material/shader/helper.js.map +1 -1
  40. package/dist/material/sprite_sdf.js +106 -0
  41. package/dist/material/sprite_sdf.js.map +1 -0
  42. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +38 -0
  43. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +1 -0
  44. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +10 -0
  45. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +1 -0
  46. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +127 -0
  47. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +1 -0
  48. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +263 -0
  49. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +1 -0
  50. package/dist/posteffect/ssr.js +1 -0
  51. package/dist/posteffect/ssr.js.map +1 -1
  52. package/dist/render/abuffer_oit.js +1 -0
  53. package/dist/render/abuffer_oit.js.map +1 -1
  54. package/dist/render/cluster_light.js +3 -4
  55. package/dist/render/cluster_light.js.map +1 -1
  56. package/dist/render/cull_visitor.js +28 -0
  57. package/dist/render/cull_visitor.js.map +1 -1
  58. package/dist/render/drawable.js.map +1 -1
  59. package/dist/render/drawable_mixin.js +1 -0
  60. package/dist/render/drawable_mixin.js.map +1 -1
  61. package/dist/render/fbm_wavegenerator.js +1 -0
  62. package/dist/render/fbm_wavegenerator.js.map +1 -1
  63. package/dist/render/gerstner_wavegenerator.js +1 -0
  64. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  65. package/dist/render/globalbindgroup_allocator.js +1 -0
  66. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  67. package/dist/render/render_queue.js +1 -0
  68. package/dist/render/render_queue.js.map +1 -1
  69. package/dist/render/rendergraph/history_resource_manager.js +93 -93
  70. package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
  71. package/dist/render/rendergraph/history_resources.js +3 -3
  72. package/dist/render/rendergraph/history_resources.js.map +1 -1
  73. package/dist/render/rendergraph/types.js +22 -22
  74. package/dist/render/rendergraph/types.js.map +1 -1
  75. package/dist/scene/basesprite.js +1 -5
  76. package/dist/scene/basesprite.js.map +1 -1
  77. package/dist/scene/batchgroup.js +29 -17
  78. package/dist/scene/batchgroup.js.map +1 -1
  79. package/dist/scene/environment.js +1 -0
  80. package/dist/scene/environment.js.map +1 -1
  81. package/dist/scene/mesh.js +8 -9
  82. package/dist/scene/mesh.js.map +1 -1
  83. package/dist/scene/meshdrawable.js +96 -0
  84. package/dist/scene/meshdrawable.js.map +1 -0
  85. package/dist/scene/msdftext.js +341 -0
  86. package/dist/scene/msdftext.js.map +1 -0
  87. package/dist/scene/msdftextsprite.js +349 -0
  88. package/dist/scene/msdftextsprite.js.map +1 -0
  89. package/dist/scene/particlesys.js +1 -0
  90. package/dist/scene/particlesys.js.map +1 -1
  91. package/dist/scene/scene.js +1 -0
  92. package/dist/scene/scene.js.map +1 -1
  93. package/dist/scene/scene_node.js +6 -0
  94. package/dist/scene/scene_node.js.map +1 -1
  95. package/dist/scene/sdftextsprite.js +322 -0
  96. package/dist/scene/sdftextsprite.js.map +1 -0
  97. package/dist/scene/terrain-cm/grass.js +1 -0
  98. package/dist/scene/terrain-cm/grass.js.map +1 -1
  99. package/dist/scene/terrain-cm/grassmaterial.js +1 -0
  100. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  101. package/dist/scene/terrain-cm/terrain-cm.js +1 -0
  102. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  103. package/dist/scene/textsprite.js +120 -0
  104. package/dist/scene/textsprite.js.map +1 -0
  105. package/dist/scene/water.js +1 -0
  106. package/dist/scene/water.js.map +1 -1
  107. package/dist/shadow/shader.js +1 -0
  108. package/dist/shadow/shader.js.map +1 -1
  109. package/dist/shapes/torus.js +90 -59
  110. package/dist/shapes/torus.js.map +1 -1
  111. package/dist/src/animation/animation.js +127 -0
  112. package/dist/src/animation/animation.js.map +1 -0
  113. package/dist/src/animation/animationset.js +255 -0
  114. package/dist/src/animation/animationset.js.map +1 -0
  115. package/dist/src/animation/animationtrack.js +34 -0
  116. package/dist/src/animation/animationtrack.js.map +1 -0
  117. package/dist/src/animation/eulerrotationtrack.js +52 -0
  118. package/dist/src/animation/eulerrotationtrack.js.map +1 -0
  119. package/dist/src/animation/morphtarget.js +93 -0
  120. package/dist/src/animation/morphtarget.js.map +1 -0
  121. package/dist/src/animation/morphtrack.js +70 -0
  122. package/dist/src/animation/morphtrack.js.map +1 -0
  123. package/dist/src/animation/proptrack.js +161 -0
  124. package/dist/src/animation/proptrack.js.map +1 -0
  125. package/dist/src/animation/rotationtrack.js +51 -0
  126. package/dist/src/animation/rotationtrack.js.map +1 -0
  127. package/dist/src/animation/scaletrack.js +50 -0
  128. package/dist/src/animation/scaletrack.js.map +1 -0
  129. package/dist/src/animation/skeleton.js +204 -0
  130. package/dist/src/animation/skeleton.js.map +1 -0
  131. package/dist/src/animation/translationtrack.js +50 -0
  132. package/dist/src/animation/translationtrack.js.map +1 -0
  133. package/dist/src/app/app.js +129 -0
  134. package/dist/src/app/app.js.map +1 -0
  135. package/dist/src/app/inputmgr.js +267 -0
  136. package/dist/src/app/inputmgr.js.map +1 -0
  137. package/dist/src/asset/assetmanager.js +404 -0
  138. package/dist/src/asset/assetmanager.js.map +1 -0
  139. package/dist/src/asset/builtin.js +337 -0
  140. package/dist/src/asset/builtin.js.map +1 -0
  141. package/dist/src/asset/loaders/dds/dds.js +470 -0
  142. package/dist/src/asset/loaders/dds/dds.js.map +1 -0
  143. package/dist/src/asset/loaders/dds/dds_loader.js +28 -0
  144. package/dist/src/asset/loaders/dds/dds_loader.js.map +1 -0
  145. package/dist/src/asset/loaders/gltf/gltf_loader.js +1265 -0
  146. package/dist/src/asset/loaders/gltf/gltf_loader.js.map +1 -0
  147. package/dist/src/asset/loaders/gltf/helpers.js +327 -0
  148. package/dist/src/asset/loaders/gltf/helpers.js.map +1 -0
  149. package/dist/src/asset/loaders/hdr/hdr.js +180 -0
  150. package/dist/src/asset/loaders/hdr/hdr.js.map +1 -0
  151. package/dist/src/asset/loaders/image/tga_Loader.js +116 -0
  152. package/dist/src/asset/loaders/image/tga_Loader.js.map +1 -0
  153. package/dist/src/asset/loaders/image/webimage_loader.js +63 -0
  154. package/dist/src/asset/loaders/image/webimage_loader.js.map +1 -0
  155. package/dist/src/asset/loaders/loader.js +45 -0
  156. package/dist/src/asset/loaders/loader.js.map +1 -0
  157. package/dist/src/asset/model.js +414 -0
  158. package/dist/src/asset/model.js.map +1 -0
  159. package/dist/src/blitter/bilateralblur.js +221 -0
  160. package/dist/src/blitter/bilateralblur.js.map +1 -0
  161. package/dist/src/blitter/blitter.js +390 -0
  162. package/dist/src/blitter/blitter.js.map +1 -0
  163. package/dist/src/blitter/box.js +118 -0
  164. package/dist/src/blitter/box.js.map +1 -0
  165. package/dist/src/blitter/copy.js +22 -0
  166. package/dist/src/blitter/copy.js.map +1 -0
  167. package/dist/src/blitter/gaussianblur.js +228 -0
  168. package/dist/src/blitter/gaussianblur.js.map +1 -0
  169. package/dist/src/camera/base.js +92 -0
  170. package/dist/src/camera/base.js.map +1 -0
  171. package/dist/src/camera/camera.js +1005 -0
  172. package/dist/src/camera/camera.js.map +1 -0
  173. package/dist/src/camera/fps.js +238 -0
  174. package/dist/src/camera/fps.js.map +1 -0
  175. package/dist/src/camera/orbit.js +245 -0
  176. package/dist/src/camera/orbit.js.map +1 -0
  177. package/dist/src/camera/orthocamera.js +167 -0
  178. package/dist/src/camera/orthocamera.js.map +1 -0
  179. package/dist/src/camera/perspectivecamera.js +141 -0
  180. package/dist/src/camera/perspectivecamera.js.map +1 -0
  181. package/dist/src/index.js +120 -0
  182. package/dist/src/index.js.map +1 -0
  183. package/dist/src/material/blinn.js +81 -0
  184. package/dist/src/material/blinn.js.map +1 -0
  185. package/dist/src/material/grassmaterial.js +113 -0
  186. package/dist/src/material/grassmaterial.js.map +1 -0
  187. package/dist/src/material/lambert.js +92 -0
  188. package/dist/src/material/lambert.js.map +1 -0
  189. package/dist/src/material/material.js +301 -0
  190. package/dist/src/material/material.js.map +1 -0
  191. package/dist/src/material/meshmaterial.js +704 -0
  192. package/dist/src/material/meshmaterial.js.map +1 -0
  193. package/dist/src/material/mixins/albedocolor.js +76 -0
  194. package/dist/src/material/mixins/albedocolor.js.map +1 -0
  195. package/dist/src/material/mixins/foliage.js +47 -0
  196. package/dist/src/material/mixins/foliage.js.map +1 -0
  197. package/dist/src/material/mixins/lightmodel/blinnphong.js +112 -0
  198. package/dist/src/material/mixins/lightmodel/blinnphong.js.map +1 -0
  199. package/dist/src/material/mixins/lightmodel/lambert.js +58 -0
  200. package/dist/src/material/mixins/lightmodel/lambert.js.map +1 -0
  201. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +178 -0
  202. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
  203. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +139 -0
  204. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
  205. package/dist/src/material/mixins/lit.js +476 -0
  206. package/dist/src/material/mixins/lit.js.map +1 -0
  207. package/dist/src/material/mixins/pbr/common.js +918 -0
  208. package/dist/src/material/mixins/pbr/common.js.map +1 -0
  209. package/dist/src/material/mixins/texture.js +172 -0
  210. package/dist/src/material/mixins/texture.js.map +1 -0
  211. package/dist/src/material/mixins/vertexcolor.js +56 -0
  212. package/dist/src/material/mixins/vertexcolor.js.map +1 -0
  213. package/dist/src/material/particle.js +178 -0
  214. package/dist/src/material/particle.js.map +1 -0
  215. package/dist/src/material/pbrmr.js +97 -0
  216. package/dist/src/material/pbrmr.js.map +1 -0
  217. package/dist/src/material/pbrsg.js +97 -0
  218. package/dist/src/material/pbrsg.js.map +1 -0
  219. package/dist/src/material/shader/helper.js +1209 -0
  220. package/dist/src/material/shader/helper.js.map +1 -0
  221. package/dist/src/material/terrain-cm.js +606 -0
  222. package/dist/src/material/terrain-cm.js.map +1 -0
  223. package/dist/src/material/terrainmaterial.js +375 -0
  224. package/dist/src/material/terrainmaterial.js.map +1 -0
  225. package/dist/src/material/unlit.js +41 -0
  226. package/dist/src/material/unlit.js.map +1 -0
  227. package/dist/src/material/water.js +417 -0
  228. package/dist/src/material/water.js.map +1 -0
  229. package/dist/src/posteffect/bloom.js +361 -0
  230. package/dist/src/posteffect/bloom.js.map +1 -0
  231. package/dist/src/posteffect/compositor.js +226 -0
  232. package/dist/src/posteffect/compositor.js.map +1 -0
  233. package/dist/src/posteffect/fxaa.js +273 -0
  234. package/dist/src/posteffect/fxaa.js.map +1 -0
  235. package/dist/src/posteffect/grayscale.js +69 -0
  236. package/dist/src/posteffect/grayscale.js.map +1 -0
  237. package/dist/src/posteffect/motionblur.js +96 -0
  238. package/dist/src/posteffect/motionblur.js.map +1 -0
  239. package/dist/src/posteffect/posteffect.js +126 -0
  240. package/dist/src/posteffect/posteffect.js.map +1 -0
  241. package/dist/src/posteffect/sao.js +324 -0
  242. package/dist/src/posteffect/sao.js.map +1 -0
  243. package/dist/src/posteffect/ssr.js +489 -0
  244. package/dist/src/posteffect/ssr.js.map +1 -0
  245. package/dist/src/posteffect/taa.js +172 -0
  246. package/dist/src/posteffect/taa.js.map +1 -0
  247. package/dist/src/posteffect/tonemap.js +94 -0
  248. package/dist/src/posteffect/tonemap.js.map +1 -0
  249. package/dist/src/render/abuffer_oit.js +361 -0
  250. package/dist/src/render/abuffer_oit.js.map +1 -0
  251. package/dist/src/render/clipmap.js +851 -0
  252. package/dist/src/render/clipmap.js.map +1 -0
  253. package/dist/src/render/cluster_light.js +333 -0
  254. package/dist/src/render/cluster_light.js.map +1 -0
  255. package/dist/src/render/cull_visitor.js +187 -0
  256. package/dist/src/render/cull_visitor.js.map +1 -0
  257. package/dist/src/render/depthpass.js +68 -0
  258. package/dist/src/render/depthpass.js.map +1 -0
  259. package/dist/src/render/drawable_mixin.js +227 -0
  260. package/dist/src/render/drawable_mixin.js.map +1 -0
  261. package/dist/src/render/envlight.js +463 -0
  262. package/dist/src/render/envlight.js.map +1 -0
  263. package/dist/src/render/fbm_wavegenerator.js +251 -0
  264. package/dist/src/render/fbm_wavegenerator.js.map +1 -0
  265. package/dist/src/render/fft_wavegenerator.js +1006 -0
  266. package/dist/src/render/fft_wavegenerator.js.map +1 -0
  267. package/dist/src/render/fullscreenquad.js +38 -0
  268. package/dist/src/render/fullscreenquad.js.map +1 -0
  269. package/dist/src/render/gerstner_wavegenerator.js +314 -0
  270. package/dist/src/render/gerstner_wavegenerator.js.map +1 -0
  271. package/dist/src/render/globalbindgroup_allocator.js +60 -0
  272. package/dist/src/render/globalbindgroup_allocator.js.map +1 -0
  273. package/dist/src/render/hzb.js +273 -0
  274. package/dist/src/render/hzb.js.map +1 -0
  275. package/dist/src/render/lightpass.js +172 -0
  276. package/dist/src/render/lightpass.js.map +1 -0
  277. package/dist/src/render/objectcolorpass.js +51 -0
  278. package/dist/src/render/objectcolorpass.js.map +1 -0
  279. package/dist/src/render/primitive.js +364 -0
  280. package/dist/src/render/primitive.js.map +1 -0
  281. package/dist/src/render/render_queue.js +467 -0
  282. package/dist/src/render/render_queue.js.map +1 -0
  283. package/dist/src/render/renderbundle_wrapper.js +152 -0
  284. package/dist/src/render/renderbundle_wrapper.js.map +1 -0
  285. package/dist/src/render/renderer.js +455 -0
  286. package/dist/src/render/renderer.js.map +1 -0
  287. package/dist/src/render/renderpass.js +200 -0
  288. package/dist/src/render/renderpass.js.map +1 -0
  289. package/dist/src/render/shadowmap_pass.js +56 -0
  290. package/dist/src/render/shadowmap_pass.js.map +1 -0
  291. package/dist/src/render/sky.js +1103 -0
  292. package/dist/src/render/sky.js.map +1 -0
  293. package/dist/src/render/weightedblended_oit.js +168 -0
  294. package/dist/src/render/weightedblended_oit.js.map +1 -0
  295. package/dist/src/scene/batchgroup.js +162 -0
  296. package/dist/src/scene/batchgroup.js.map +1 -0
  297. package/dist/src/scene/environment.js +209 -0
  298. package/dist/src/scene/environment.js.map +1 -0
  299. package/dist/src/scene/graph_node.js +72 -0
  300. package/dist/src/scene/graph_node.js.map +1 -0
  301. package/dist/src/scene/light.js +416 -0
  302. package/dist/src/scene/light.js.map +1 -0
  303. package/dist/src/scene/mesh.js +341 -0
  304. package/dist/src/scene/mesh.js.map +1 -0
  305. package/dist/src/scene/octree.js +649 -0
  306. package/dist/src/scene/octree.js.map +1 -0
  307. package/dist/src/scene/particlesys.js +738 -0
  308. package/dist/src/scene/particlesys.js.map +1 -0
  309. package/dist/src/scene/raycast_visitor.js +103 -0
  310. package/dist/src/scene/raycast_visitor.js.map +1 -0
  311. package/dist/src/scene/scene.js +284 -0
  312. package/dist/src/scene/scene.js.map +1 -0
  313. package/dist/src/scene/scene_node.js +732 -0
  314. package/dist/src/scene/scene_node.js.map +1 -0
  315. package/dist/src/scene/terrain/grass.js +278 -0
  316. package/dist/src/scene/terrain/grass.js.map +1 -0
  317. package/dist/src/scene/terrain/heightfield.js +475 -0
  318. package/dist/src/scene/terrain/heightfield.js.map +1 -0
  319. package/dist/src/scene/terrain/patch.js +530 -0
  320. package/dist/src/scene/terrain/patch.js.map +1 -0
  321. package/dist/src/scene/terrain/quadtree.js +461 -0
  322. package/dist/src/scene/terrain/quadtree.js.map +1 -0
  323. package/dist/src/scene/terrain/terrain.js +246 -0
  324. package/dist/src/scene/terrain/terrain.js.map +1 -0
  325. package/dist/src/scene/terrain-cm/grass.js +594 -0
  326. package/dist/src/scene/terrain-cm/grass.js.map +1 -0
  327. package/dist/src/scene/terrain-cm/grassmaterial.js +159 -0
  328. package/dist/src/scene/terrain-cm/grassmaterial.js.map +1 -0
  329. package/dist/src/scene/terrain-cm/terrain-cm.js +538 -0
  330. package/dist/src/scene/terrain-cm/terrain-cm.js.map +1 -0
  331. package/dist/src/scene/water.js +374 -0
  332. package/dist/src/scene/water.js.map +1 -0
  333. package/dist/src/shaders/atmosphere.js +957 -0
  334. package/dist/src/shaders/atmosphere.js.map +1 -0
  335. package/dist/src/shaders/fog.js +112 -0
  336. package/dist/src/shaders/fog.js.map +1 -0
  337. package/dist/src/shaders/misc.js +266 -0
  338. package/dist/src/shaders/misc.js.map +1 -0
  339. package/dist/src/shaders/noise.js +222 -0
  340. package/dist/src/shaders/noise.js.map +1 -0
  341. package/dist/src/shaders/pbr.js +51 -0
  342. package/dist/src/shaders/pbr.js.map +1 -0
  343. package/dist/src/shaders/shadow.js +636 -0
  344. package/dist/src/shaders/shadow.js.map +1 -0
  345. package/dist/src/shaders/ssr.js +490 -0
  346. package/dist/src/shaders/ssr.js.map +1 -0
  347. package/dist/src/shaders/temporal.js +215 -0
  348. package/dist/src/shaders/temporal.js.map +1 -0
  349. package/dist/src/shaders/water.js +756 -0
  350. package/dist/src/shaders/water.js.map +1 -0
  351. package/dist/src/shadow/esm.js +237 -0
  352. package/dist/src/shadow/esm.js.map +1 -0
  353. package/dist/src/shadow/pcf_opt.js +181 -0
  354. package/dist/src/shadow/pcf_opt.js.map +1 -0
  355. package/dist/src/shadow/pcf_pd.js +189 -0
  356. package/dist/src/shadow/pcf_pd.js.map +1 -0
  357. package/dist/src/shadow/shader.js +37 -0
  358. package/dist/src/shadow/shader.js.map +1 -0
  359. package/dist/src/shadow/shadow_impl.js +15 -0
  360. package/dist/src/shadow/shadow_impl.js.map +1 -0
  361. package/dist/src/shadow/shadowmapper.js +790 -0
  362. package/dist/src/shadow/shadowmapper.js.map +1 -0
  363. package/dist/src/shadow/ssm.js +159 -0
  364. package/dist/src/shadow/ssm.js.map +1 -0
  365. package/dist/src/shadow/vsm.js +297 -0
  366. package/dist/src/shadow/vsm.js.map +1 -0
  367. package/dist/src/shapes/box.js +386 -0
  368. package/dist/src/shapes/box.js.map +1 -0
  369. package/dist/src/shapes/cylinder.js +125 -0
  370. package/dist/src/shapes/cylinder.js.map +1 -0
  371. package/dist/src/shapes/plane.js +88 -0
  372. package/dist/src/shapes/plane.js.map +1 -0
  373. package/dist/src/shapes/shape.js +87 -0
  374. package/dist/src/shapes/shape.js.map +1 -0
  375. package/dist/src/shapes/sphere.js +114 -0
  376. package/dist/src/shapes/sphere.js.map +1 -0
  377. package/dist/src/shapes/tetrahedron.js +188 -0
  378. package/dist/src/shapes/tetrahedron.js.map +1 -0
  379. package/dist/src/shapes/torus.js +111 -0
  380. package/dist/src/shapes/torus.js.map +1 -0
  381. package/dist/src/utility/aabbtree.js +400 -0
  382. package/dist/src/utility/aabbtree.js.map +1 -0
  383. package/dist/src/utility/bounding_volume.js +29 -0
  384. package/dist/src/utility/bounding_volume.js.map +1 -0
  385. package/dist/src/utility/debug.js +28 -0
  386. package/dist/src/utility/debug.js.map +1 -0
  387. package/dist/src/utility/draco/decoder.js +116 -0
  388. package/dist/src/utility/draco/decoder.js.map +1 -0
  389. package/dist/src/utility/misc.js +105 -0
  390. package/dist/src/utility/misc.js.map +1 -0
  391. package/dist/src/utility/panorama.js +163 -0
  392. package/dist/src/utility/panorama.js.map +1 -0
  393. package/dist/src/utility/pmrem.js +354 -0
  394. package/dist/src/utility/pmrem.js.map +1 -0
  395. package/dist/src/utility/rendermipmap.js +115 -0
  396. package/dist/src/utility/rendermipmap.js.map +1 -0
  397. package/dist/src/utility/serialization/json.js +402 -0
  398. package/dist/src/utility/serialization/json.js.map +1 -0
  399. package/dist/src/utility/serialization/manager.js +623 -0
  400. package/dist/src/utility/serialization/manager.js.map +1 -0
  401. package/dist/src/utility/serialization/scene/animation.js +248 -0
  402. package/dist/src/utility/serialization/scene/animation.js.map +1 -0
  403. package/dist/src/utility/serialization/scene/batch.js +59 -0
  404. package/dist/src/utility/serialization/scene/batch.js.map +1 -0
  405. package/dist/src/utility/serialization/scene/camera.js +790 -0
  406. package/dist/src/utility/serialization/scene/camera.js.map +1 -0
  407. package/dist/src/utility/serialization/scene/common.js +222 -0
  408. package/dist/src/utility/serialization/scene/common.js.map +1 -0
  409. package/dist/src/utility/serialization/scene/light.js +575 -0
  410. package/dist/src/utility/serialization/scene/light.js.map +1 -0
  411. package/dist/src/utility/serialization/scene/material.js +1111 -0
  412. package/dist/src/utility/serialization/scene/material.js.map +1 -0
  413. package/dist/src/utility/serialization/scene/mesh.js +148 -0
  414. package/dist/src/utility/serialization/scene/mesh.js.map +1 -0
  415. package/dist/src/utility/serialization/scene/misc.js +39 -0
  416. package/dist/src/utility/serialization/scene/misc.js.map +1 -0
  417. package/dist/src/utility/serialization/scene/node.js +451 -0
  418. package/dist/src/utility/serialization/scene/node.js.map +1 -0
  419. package/dist/src/utility/serialization/scene/particle.js +425 -0
  420. package/dist/src/utility/serialization/scene/particle.js.map +1 -0
  421. package/dist/src/utility/serialization/scene/primitive.js +692 -0
  422. package/dist/src/utility/serialization/scene/primitive.js.map +1 -0
  423. package/dist/src/utility/serialization/scene/scene.js +704 -0
  424. package/dist/src/utility/serialization/scene/scene.js.map +1 -0
  425. package/dist/src/utility/serialization/scene/terrain.js +488 -0
  426. package/dist/src/utility/serialization/scene/terrain.js.map +1 -0
  427. package/dist/src/utility/serialization/scene/water.js +465 -0
  428. package/dist/src/utility/serialization/scene/water.js.map +1 -0
  429. package/dist/src/utility/shprojector.js +297 -0
  430. package/dist/src/utility/shprojector.js.map +1 -0
  431. package/dist/src/utility/textures/ggxlut.js +213 -0
  432. package/dist/src/utility/textures/ggxlut.js.map +1 -0
  433. package/dist/src/utility/textures/gradientnoise.js +62 -0
  434. package/dist/src/utility/textures/gradientnoise.js.map +1 -0
  435. package/dist/src/utility/textures/randomnoise.js +41 -0
  436. package/dist/src/utility/textures/randomnoise.js.map +1 -0
  437. package/dist/src/values.js +162 -0
  438. package/dist/src/values.js.map +1 -0
  439. package/dist/text/font/font_asset.js +884 -0
  440. package/dist/text/font/font_asset.js.map +1 -0
  441. package/dist/text/font/sfnt_reader.js +43 -0
  442. package/dist/text/font/sfnt_reader.js.map +1 -0
  443. package/dist/text/msdf/generator.js +417 -0
  444. package/dist/text/msdf/generator.js.map +1 -0
  445. package/dist/text/msdf/shape.js +143 -0
  446. package/dist/text/msdf/shape.js.map +1 -0
  447. package/dist/text/runtime/msdf_glyph_atlas.js +146 -0
  448. package/dist/text/runtime/msdf_glyph_atlas.js.map +1 -0
  449. package/dist/text/runtime/msdf_text_atlas_manager.js +47 -0
  450. package/dist/text/runtime/msdf_text_atlas_manager.js.map +1 -0
  451. package/dist/text/runtime/text_layout.js +96 -0
  452. package/dist/text/runtime/text_layout.js.map +1 -0
  453. package/dist/utility/blueprint/material/common.js +7 -0
  454. package/dist/utility/blueprint/material/common.js.map +1 -0
  455. package/dist/utility/blueprint/material/inputs.js +1275 -1091
  456. package/dist/utility/blueprint/material/inputs.js.map +1 -1
  457. package/dist/utility/blueprint/material/ir.js +505 -490
  458. package/dist/utility/blueprint/material/ir.js.map +1 -1
  459. package/dist/utility/blueprint/material/pbr.js +32 -0
  460. package/dist/utility/blueprint/material/pbr.js.map +1 -1
  461. package/dist/utility/serialization/blueprint/constants.js +255 -0
  462. package/dist/utility/serialization/blueprint/constants.js.map +1 -0
  463. package/dist/utility/serialization/blueprint/material/constants.js +203 -0
  464. package/dist/utility/serialization/blueprint/material/constants.js.map +1 -0
  465. package/dist/utility/serialization/blueprint/material/texture.js +165 -0
  466. package/dist/utility/serialization/blueprint/material/texture.js.map +1 -0
  467. package/dist/utility/serialization/manager.js +55 -11
  468. package/dist/utility/serialization/manager.js.map +1 -1
  469. package/dist/utility/serialization/scene/animation.js +2 -0
  470. package/dist/utility/serialization/scene/animation.js.map +1 -1
  471. package/dist/utility/serialization/scene/batch.js +2 -0
  472. package/dist/utility/serialization/scene/batch.js.map +1 -1
  473. package/dist/utility/serialization/scene/camera.js +2 -0
  474. package/dist/utility/serialization/scene/camera.js.map +1 -1
  475. package/dist/utility/serialization/scene/common.js.map +1 -1
  476. package/dist/utility/serialization/scene/light.js +2 -0
  477. package/dist/utility/serialization/scene/light.js.map +1 -1
  478. package/dist/utility/serialization/scene/material.js +1 -0
  479. package/dist/utility/serialization/scene/material.js.map +1 -1
  480. package/dist/utility/serialization/scene/mesh.js +2 -0
  481. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  482. package/dist/utility/serialization/scene/node.js +2 -0
  483. package/dist/utility/serialization/scene/node.js.map +1 -1
  484. package/dist/utility/serialization/scene/particle.js +2 -0
  485. package/dist/utility/serialization/scene/particle.js.map +1 -1
  486. package/dist/utility/serialization/scene/primitive.js +1 -0
  487. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  488. package/dist/utility/serialization/scene/scene.js.map +1 -1
  489. package/dist/utility/serialization/scene/sprite.js +2 -0
  490. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  491. package/dist/utility/serialization/scene/terrain.js +2 -0
  492. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  493. package/dist/utility/serialization/scene/text.js +516 -0
  494. package/dist/utility/serialization/scene/text.js.map +1 -0
  495. package/dist/utility/serialization/scene/water.js +2 -0
  496. package/dist/utility/serialization/scene/water.js.map +1 -1
  497. package/dist/utility/serialization/types.js +4 -4
  498. package/dist/utility/serialization/types.js.map +1 -1
  499. package/dist/values.js +1 -5
  500. package/dist/values.js.map +1 -1
  501. package/package.json +3 -3
  502. package/dist/animation/joint_dynamics/vrm_spring_bone.js +0 -46
  503. package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +0 -1
  504. package/dist/animation/spring/spring_bone.js +0 -240
  505. package/dist/animation/spring/spring_bone.js.map +0 -1
  506. package/dist/animation/spring/spring_bone_collider.js +0 -198
  507. package/dist/animation/spring/spring_bone_collider.js.map +0 -1
  508. package/dist/animation/spring/spring_bone_constraint.js +0 -170
  509. package/dist/animation/spring/spring_bone_constraint.js.map +0 -1
  510. package/dist/animation/spring/spring_bone_system.js +0 -328
  511. package/dist/animation/spring/spring_bone_system.js.map +0 -1
  512. package/dist/render/sky_motion_vector.js +0 -85
  513. package/dist/render/sky_motion_vector.js.map +0 -1
@@ -24,6 +24,7 @@ import '../material/pbrsg.js';
24
24
  import { PBRBluePrintMaterial } from '../material/pbrblueprint.js';
25
25
  import '../material/sprite.js';
26
26
  import '../material/sprite_std.js';
27
+ import '../material/msdf_text.js';
27
28
  import { SpriteBlueprintMaterial } from '../material/spriteblueprint.js';
28
29
  import { BoundingBox } from '../utility/bounding_volume.js';
29
30
  import { MaterialBlueprintIR } from '../utility/blueprint/material/ir.js';
@@ -32,21 +33,22 @@ import '../render/rendergraph/forward_plus_builder.js';
32
33
  import '../render/sky.js';
33
34
  import '../render/clipmap.js';
34
35
  import '../shaders/atmosphere.js';
36
+ import { FontAsset } from '../text/font/font_asset.js';
35
37
 
36
- /**
37
- * Centralized asset manager for loading and caching resources.
38
- *
39
- * Responsibilities:
40
- * - Abstracts resource loading via VFS (text/json/binary).
41
- * - Dispatches texture/model loading to registered loaders by MIME type.
42
- * - Caches results and uses weak references to allow GPU resources to be GC'd when unused.
43
- * - Harmonizes cross-backend constraints (e.g., WebGL non-power-of-two rules and sRGB handling).
44
- * - Provides access to built-in textures with device-restore handlers.
45
- *
46
- * Threading/async model:
47
- * - All I/O is async; repeated calls are coalesced via internal promise caches keyed by URL or hash.
48
- *
49
- * @public
38
+ /**
39
+ * Centralized asset manager for loading and caching resources.
40
+ *
41
+ * Responsibilities:
42
+ * - Abstracts resource loading via VFS (text/json/binary).
43
+ * - Dispatches texture/model loading to registered loaders by MIME type.
44
+ * - Caches results and uses weak references to allow GPU resources to be GC'd when unused.
45
+ * - Harmonizes cross-backend constraints (e.g., WebGL non-power-of-two rules and sRGB handling).
46
+ * - Provides access to built-in textures with device-restore handlers.
47
+ *
48
+ * Threading/async model:
49
+ * - All I/O is async; repeated calls are coalesced via internal promise caches keyed by URL or hash.
50
+ *
51
+ * @public
50
52
  */ class AssetManager {
51
53
  /** @internal */ static _builtinTextures = {};
52
54
  /** @internal */ static _builtinTextureLoaders = {
@@ -64,6 +66,7 @@ import '../shaders/atmosphere.js';
64
66
  /** @internal */ _textures;
65
67
  /** @internal */ _models;
66
68
  /** @internal */ _binaryDatas;
69
+ /** @internal */ _fontAssets;
67
70
  /** @internal */ _textDatas;
68
71
  /** @internal */ _bluePrints;
69
72
  /** @internal */ _materials;
@@ -71,8 +74,8 @@ import '../shaders/atmosphere.js';
71
74
  /** @internal */ _skeletons;
72
75
  /** @internal */ _jsonDatas;
73
76
  /** @internal */ _resourceManager;
74
- /**
75
- * Creates an instance of AssetManager
77
+ /**
78
+ * Creates an instance of AssetManager
76
79
  */ constructor(resourceManager){
77
80
  this._resourceManager = resourceManager ?? getEngine().resourceManager;
78
81
  this._textures = {};
@@ -82,21 +85,22 @@ import '../shaders/atmosphere.js';
82
85
  this._skeletons = {};
83
86
  this._bluePrints = {};
84
87
  this._binaryDatas = {};
88
+ this._fontAssets = {};
85
89
  this._textDatas = {};
86
90
  this._jsonDatas = {};
87
91
  }
88
- /**
89
- * VFS used to read resources (files, URLs, virtual mounts).
92
+ /**
93
+ * VFS used to read resources (files, URLs, virtual mounts).
90
94
  */ get vfs() {
91
95
  return this._resourceManager.VFS;
92
96
  }
93
- /**
94
- * Clear cached references and promises.
95
- *
96
- * - Disposes any DWeakRef holders maintained by this manager.
97
- * - Empties internal maps for textures, models, and raw data (text/json/binary).
98
- * - Does not forcibly dispose GPU resources; it only clears references so they can be GC'd
99
- * if no other owners are holding them.
97
+ /**
98
+ * Clear cached references and promises.
99
+ *
100
+ * - Disposes any DWeakRef holders maintained by this manager.
101
+ * - Empties internal maps for textures, models, and raw data (text/json/binary).
102
+ * - Does not forcibly dispose GPU resources; it only clears references so they can be GC'd
103
+ * if no other owners are holding them.
100
104
  */ clearCache() {
101
105
  for(const k in Object.keys(this._textures)){
102
106
  const v = this._textures[k];
@@ -133,43 +137,58 @@ import '../shaders/atmosphere.js';
133
137
  }
134
138
  }
135
139
  this._skeletons = {};
140
+ this._fontAssets = {};
136
141
  this._binaryDatas = {};
137
142
  this._textDatas = {};
138
143
  this._jsonDatas = {};
139
144
  }
140
- /**
141
- * Register a texture loader (highest priority first).
142
- *
143
- * Note: This is a static registry shared by all AssetManager instances.
144
- *
145
- * @param loader - A concrete texture loader implementation.
145
+ /**
146
+ * Removes a cached font asset entry by URL.
147
+ *
148
+ * This only evicts the cache entry. It does not dispose any external references to the FontAsset.
149
+ *
150
+ * @param url - Resource URL or VFS path.
151
+ * @returns `true` if a cache entry existed and was removed.
152
+ */ releaseFontAsset(url) {
153
+ if (url in this._fontAssets) {
154
+ delete this._fontAssets[url];
155
+ return true;
156
+ }
157
+ return false;
158
+ }
159
+ /**
160
+ * Register a texture loader (highest priority first).
161
+ *
162
+ * Note: This is a static registry shared by all AssetManager instances.
163
+ *
164
+ * @param loader - A concrete texture loader implementation.
146
165
  */ static addTextureLoader(loader) {
147
166
  if (loader) {
148
167
  this._textureLoaders.unshift(loader);
149
168
  }
150
169
  }
151
- /**
152
- * Register a model loader (highest priority first).
153
- *
154
- * Note: This is a static registry shared by all AssetManager instances.
155
- *
156
- * @param loader - A concrete model loader implementation.
170
+ /**
171
+ * Register a model loader (highest priority first).
172
+ *
173
+ * Note: This is a static registry shared by all AssetManager instances.
174
+ *
175
+ * @param loader - A concrete model loader implementation.
157
176
  */ static addModelLoader(loader) {
158
177
  if (loader) {
159
178
  this._modelLoaders.unshift(loader);
160
179
  }
161
180
  }
162
- /**
163
- * Fetch a UTF-8 text resource via VFS.
164
- *
165
- * - Results are cached per resolved URL (via HttpRequest.urlResolver if provided; otherwise the raw URL).
166
- * - If cached, any provided postProcess is ignored for subsequent calls; create a separate AssetManager
167
- * if you need different post-processing of the same URL.
168
- *
169
- * @param url - Resource URL or VFS path.
170
- * @param postProcess - Optional transformation applied to the loaded text.
171
- * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
172
- * @returns A promise that resolves to the loaded (and optionally processed) text.
181
+ /**
182
+ * Fetch a UTF-8 text resource via VFS.
183
+ *
184
+ * - Results are cached per resolved URL (via HttpRequest.urlResolver if provided; otherwise the raw URL).
185
+ * - If cached, any provided postProcess is ignored for subsequent calls; create a separate AssetManager
186
+ * if you need different post-processing of the same URL.
187
+ *
188
+ * @param url - Resource URL or VFS path.
189
+ * @param postProcess - Optional transformation applied to the loaded text.
190
+ * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
191
+ * @returns A promise that resolves to the loaded (and optionally processed) text.
173
192
  */ async fetchTextData(url, postProcess, httpRequest, VFSs) {
174
193
  const hash = httpRequest?.urlResolver?.(url) ?? url;
175
194
  let P = this._textDatas[hash];
@@ -179,16 +198,16 @@ import '../shaders/atmosphere.js';
179
198
  }
180
199
  return P;
181
200
  }
182
- /**
183
- * Fetch a JSON resource via VFS.
184
- *
185
- * - Parses as JSON after text load.
186
- * - Cached per resolved URL. Post-process is applied only on the first load for a given cache key.
187
- *
188
- * @param url - Resource URL or VFS path.
189
- * @param postProcess - Optional transformation applied to the parsed JSON object.
190
- * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
191
- * @returns A promise that resolves to the loaded (and optionally processed) JSON value.
201
+ /**
202
+ * Fetch a JSON resource via VFS.
203
+ *
204
+ * - Parses as JSON after text load.
205
+ * - Cached per resolved URL. Post-process is applied only on the first load for a given cache key.
206
+ *
207
+ * @param url - Resource URL or VFS path.
208
+ * @param postProcess - Optional transformation applied to the parsed JSON object.
209
+ * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
210
+ * @returns A promise that resolves to the loaded (and optionally processed) JSON value.
192
211
  */ async fetchJsonData(url, postProcess, httpRequest, VFSs) {
193
212
  const hash = httpRequest?.urlResolver?.(url) ?? url;
194
213
  let P = this._jsonDatas[hash];
@@ -198,15 +217,15 @@ import '../shaders/atmosphere.js';
198
217
  }
199
218
  return P;
200
219
  }
201
- /**
202
- * Fetch a binary resource via VFS.
203
- *
204
- * - Cached per resolved URL. Post-process is applied only on first load for a given key.
205
- *
206
- * @param url - Resource URL or VFS path.
207
- * @param postProcess - Optional transformation applied to the loaded ArrayBuffer.
208
- * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
209
- * @returns A promise that resolves to the loaded (and optionally processed) ArrayBuffer.
220
+ /**
221
+ * Fetch a binary resource via VFS.
222
+ *
223
+ * - Cached per resolved URL. Post-process is applied only on first load for a given key.
224
+ *
225
+ * @param url - Resource URL or VFS path.
226
+ * @param postProcess - Optional transformation applied to the loaded ArrayBuffer.
227
+ * @param httpRequest - Optional HttpRequest for custom URL resolution/headers.
228
+ * @returns A promise that resolves to the loaded (and optionally processed) ArrayBuffer.
210
229
  */ async fetchBinaryData(url, postProcess, httpRequest, VFSs) {
211
230
  const hash = httpRequest?.urlResolver?.(url) ?? url;
212
231
  let P = this._binaryDatas[hash];
@@ -216,6 +235,39 @@ import '../shaders/atmosphere.js';
216
235
  }
217
236
  return P;
218
237
  }
238
+ /**
239
+ * Fetch a font asset via VFS.
240
+ *
241
+ * - Cached per URL only.
242
+ * - `options` are applied only when the font is first loaded for that URL.
243
+ * - If the URL is already cached, later calls ignore `options` and reuse the cached FontAsset.
244
+ *
245
+ * @param url - Resource URL or VFS path.
246
+ * @param options - Optional MSDF atlas settings bound to the loaded FontAsset.
247
+ * @returns A promise that resolves to the loaded (and optionally processed) font asset.
248
+ */ async fetchFontAsset(url, options, VFSs) {
249
+ const hash = url;
250
+ let P = this._fontAssets[hash];
251
+ if (!P) {
252
+ P = new Promise((resolve, reject)=>{
253
+ this.loadBinaryData(url, null, VFSs).then((data)=>{
254
+ resolve(data ? FontAsset.fromBuffer(data, options) : null);
255
+ }).catch((err)=>{
256
+ reject(new Error(`Failed to load font asset from ${url}: ${err instanceof Error ? err.message : err}`));
257
+ });
258
+ });
259
+ this._fontAssets[hash] = P;
260
+ }
261
+ return P;
262
+ }
263
+ /**
264
+ * Fetch a font asset via VFS if already cached.
265
+ * @param url - Resource URL or VFS path.
266
+ * @returns The cached FontAsset if it exists and is loaded, or null if not cached or still loading.
267
+ */ getFontAsset(url) {
268
+ const hash = url;
269
+ return this._fontAssets[hash] instanceof Promise ? null : this._fontAssets[hash] ?? null;
270
+ }
219
271
  async fetchBluePrint(url, VFSs) {
220
272
  const hash = url;
221
273
  let P = this._bluePrints[hash];
@@ -225,12 +277,12 @@ import '../shaders/atmosphere.js';
225
277
  }
226
278
  return P;
227
279
  }
228
- /**
229
- * Fetch a material resource.
230
- *
231
- * @typeParam T - Expected concrete material type.
232
- * @param url - Resource URL or VFS path.
233
- * @returns A promise that resolves to the loaded material.
280
+ /**
281
+ * Fetch a material resource.
282
+ *
283
+ * @typeParam T - Expected concrete material type.
284
+ * @param url - Resource URL or VFS path.
285
+ * @returns A promise that resolves to the loaded material.
234
286
  */ async fetchMaterial(url, VFSs) {
235
287
  const hash = url;
236
288
  let P = this._materials[hash];
@@ -246,12 +298,12 @@ import '../shaders/atmosphere.js';
246
298
  }
247
299
  return material;
248
300
  }
249
- /**
250
- * Fetch a primitive resource.
251
- *
252
- * @typeParam T - Expected concrete primitive type.
253
- * @param url - Resource URL or VFS path.
254
- * @returns A promise that resolves to the loaded primitive.
301
+ /**
302
+ * Fetch a primitive resource.
303
+ *
304
+ * @typeParam T - Expected concrete primitive type.
305
+ * @param url - Resource URL or VFS path.
306
+ * @returns A promise that resolves to the loaded primitive.
255
307
  */ async fetchPrimitive(url, VFSs) {
256
308
  const hash = url;
257
309
  let P = this._primitives[hash];
@@ -267,19 +319,19 @@ import '../shaders/atmosphere.js';
267
319
  }
268
320
  return primitive;
269
321
  }
270
- /**
271
- * Fetch a texture resource via registered loaders.
272
- *
273
- * - Chooses loader by explicit MIME type or by VFS file extension inference.
274
- * - Deduplicates in-flight requests and caches ready textures.
275
- * - If `options.texture` is provided, the asset will be uploaded/blitted into that texture.
276
- * - On WebGL backends, enforces constraints by repacking non-power-of-two or sRGB textures.
277
- *
278
- * @typeParam T - Expected concrete texture type.
279
- * @param url - Resource URL or VFS path.
280
- * @param options - Texture fetching options (color space, sampler, target texture).
281
- * @param httpRequest - Optional HttpRequest (not used for binary read but may supply URL resolver for hashing).
282
- * @returns A promise that resolves to the loaded texture.
322
+ /**
323
+ * Fetch a texture resource via registered loaders.
324
+ *
325
+ * - Chooses loader by explicit MIME type or by VFS file extension inference.
326
+ * - Deduplicates in-flight requests and caches ready textures.
327
+ * - If `options.texture` is provided, the asset will be uploaded/blitted into that texture.
328
+ * - On WebGL backends, enforces constraints by repacking non-power-of-two or sRGB textures.
329
+ *
330
+ * @typeParam T - Expected concrete texture type.
331
+ * @param url - Resource URL or VFS path.
332
+ * @param options - Texture fetching options (color space, sampler, target texture).
333
+ * @param httpRequest - Optional HttpRequest (not used for binary read but may supply URL resolver for hashing).
334
+ * @returns A promise that resolves to the loaded texture.
283
335
  */ async fetchTexture(url, options, VFSs) {
284
336
  if (options?.texture) {
285
337
  return this.loadTexture(url, options.mimeType ?? null, !options.linearColorSpace, options.samplerOptions, options.texture, VFSs);
@@ -299,16 +351,16 @@ import '../shaders/atmosphere.js';
299
351
  return tex;
300
352
  }
301
353
  }
302
- /**
303
- * Fetch a model resource via registered model loaders (data only).
304
- *
305
- * - Returns a SharedModel which can create scene nodes in any Scene.
306
- * - Uses DWeakRef to cache and allow model data to be reclaimed if unused.
307
- *
308
- * @param url - Model URL or VFS path.
309
- * @param options - Model loader options (MIME override, Draco, instancing hint, post-process).
310
- * @returns A promise that resolves to the SharedModel.
311
- * @internal
354
+ /**
355
+ * Fetch a model resource via registered model loaders (data only).
356
+ *
357
+ * - Returns a SharedModel which can create scene nodes in any Scene.
358
+ * - Uses DWeakRef to cache and allow model data to be reclaimed if unused.
359
+ *
360
+ * @param url - Model URL or VFS path.
361
+ * @param options - Model loader options (MIME override, Draco, instancing hint, post-process).
362
+ * @returns A promise that resolves to the SharedModel.
363
+ * @internal
312
364
  */ async fetchModelData(url, options, VFSs) {
313
365
  const hash = url;
314
366
  let P = this._models[hash];
@@ -324,17 +376,17 @@ import '../shaders/atmosphere.js';
324
376
  }
325
377
  return sharedModel;
326
378
  }
327
- /**
328
- * Fetch a model resource and instantiate it under a scene.
329
- *
330
- * - Loads or retrieves a cached SharedModel, then creates a SceneNode hierarchy.
331
- * - Returns both the created group node and any associated AnimationSet.
332
- *
333
- * @param scene - Scene into which the model node will be created.
334
- * @param url - Model URL or VFS path.
335
- * @param options - Model loader options and instancing hint.
336
- * @param httpRequest - Optional HttpRequest (unused for binary read; present for API symmetry).
337
- * @returns A promise with the created node group and animation set info.
379
+ /**
380
+ * Fetch a model resource and instantiate it under a scene.
381
+ *
382
+ * - Loads or retrieves a cached SharedModel, then creates a SceneNode hierarchy.
383
+ * - Returns both the created group node and any associated AnimationSet.
384
+ *
385
+ * @param scene - Scene into which the model node will be created.
386
+ * @param url - Model URL or VFS path.
387
+ * @param options - Model loader options and instancing hint.
388
+ * @param httpRequest - Optional HttpRequest (unused for binary read; present for API symmetry).
389
+ * @returns A promise with the created node group and animation set info.
338
390
  */ async fetchModel(scene, url, options, VFSs) {
339
391
  const sharedModel = await this.fetchModelData(url, options, VFSs);
340
392
  const node = sharedModel.createSceneNode(scene, !!options?.enableInstancing);
@@ -343,15 +395,15 @@ import '../shaders/atmosphere.js';
343
395
  animationSet: node.animationSet
344
396
  };
345
397
  }
346
- /**
347
- * Load a text resource via VFS and optionally post-process it.
348
- *
349
- * - Does not use or modify the internal cache; use fetchTextData for cached loads.
350
- *
351
- * @param url - Resource URL or VFS path.
352
- * @param postProcess - Optional transformation applied to the text.
353
- * @returns A promise that resolves to the loaded (and optionally processed) text.
354
- * @internal
398
+ /**
399
+ * Load a text resource via VFS and optionally post-process it.
400
+ *
401
+ * - Does not use or modify the internal cache; use fetchTextData for cached loads.
402
+ *
403
+ * @param url - Resource URL or VFS path.
404
+ * @param postProcess - Optional transformation applied to the text.
405
+ * @returns A promise that resolves to the loaded (and optionally processed) text.
406
+ * @internal
355
407
  */ async loadTextData(url, postProcess, VFSs) {
356
408
  let text = await this.readFileFromVFSs(url, {
357
409
  encoding: 'utf8'
@@ -365,15 +417,15 @@ import '../shaders/atmosphere.js';
365
417
  }
366
418
  return text;
367
419
  }
368
- /**
369
- * Load a JSON resource via VFS and optionally post-process it.
370
- *
371
- * - Does not use or modify the internal cache; use fetchJsonData for cached loads.
372
- *
373
- * @param url - Resource URL or VFS path.
374
- * @param postProcess - Optional transformation applied to the parsed JSON.
375
- * @returns A promise that resolves to the loaded (and optionally processed) JSON.
376
- * @internal
420
+ /**
421
+ * Load a JSON resource via VFS and optionally post-process it.
422
+ *
423
+ * - Does not use or modify the internal cache; use fetchJsonData for cached loads.
424
+ *
425
+ * @param url - Resource URL or VFS path.
426
+ * @param postProcess - Optional transformation applied to the parsed JSON.
427
+ * @returns A promise that resolves to the loaded (and optionally processed) JSON.
428
+ * @internal
377
429
  */ async loadJsonData(url, postProcess, VFSs) {
378
430
  let json = JSON.parse(await this.readFileFromVFSs(url, {
379
431
  encoding: 'utf8'
@@ -387,15 +439,15 @@ import '../shaders/atmosphere.js';
387
439
  }
388
440
  return json;
389
441
  }
390
- /**
391
- * Load a binary resource via VFS and optionally post-process it.
392
- *
393
- * - Does not use or modify the internal cache; use fetchBinaryData for cached loads.
394
- *
395
- * @param url - Resource URL or VFS path.
396
- * @param postProcess - Optional transformation applied to the ArrayBuffer.
397
- * @returns A promise that resolves to the loaded (and optionally processed) ArrayBuffer.
398
- * @internal
442
+ /**
443
+ * Load a binary resource via VFS and optionally post-process it.
444
+ *
445
+ * - Does not use or modify the internal cache; use fetchBinaryData for cached loads.
446
+ *
447
+ * @param url - Resource URL or VFS path.
448
+ * @param postProcess - Optional transformation applied to the ArrayBuffer.
449
+ * @returns A promise that resolves to the loaded (and optionally processed) ArrayBuffer.
450
+ * @internal
399
451
  */ async loadBinaryData(url, postProcess, VFSs) {
400
452
  try {
401
453
  let data = await this.readFileFromVFSs(url, {
@@ -528,14 +580,14 @@ import '../shaders/atmosphere.js';
528
580
  return null;
529
581
  }
530
582
  }
531
- /**
532
- * Load a material.
533
- *
534
- * - Does not use or modify the internal cache; use fetchMaterial for cached loads.
535
- *
536
- * @param url - Resource URL or VFS path.
537
- * @returns A promise that resolves to the loaded material.
538
- * @internal
583
+ /**
584
+ * Load a material.
585
+ *
586
+ * - Does not use or modify the internal cache; use fetchMaterial for cached loads.
587
+ *
588
+ * @param url - Resource URL or VFS path.
589
+ * @returns A promise that resolves to the loaded material.
590
+ * @internal
539
591
  */ async loadMaterial(url, reload, VFSs) {
540
592
  try {
541
593
  const data = await this.readFileFromVFSs(url, {
@@ -721,19 +773,19 @@ import '../shaders/atmosphere.js';
721
773
  return null;
722
774
  }
723
775
  }
724
- /**
725
- * Load a texture directly from an ArrayBuffer or typed array.
726
- *
727
- * - Chooses an appropriate loader based on the provided MIME type.
728
- * - Can upload into an existing texture if `texture` is specified.
729
- *
730
- * @typeParam T - Expected concrete texture type.
731
- * @param arrayBuffer - Raw texture data buffer.
732
- * @param mimeType - MIME type of the texture (must be supported by a registered loader).
733
- * @param srgb - If true, treat image as sRGB; otherwise linear.
734
- * @param samplerOptions - Optional sampler options passed to the loader path.
735
- * @param texture - Optional destination texture to populate.
736
- * @returns A promise that resolves to the created or populated texture.
776
+ /**
777
+ * Load a texture directly from an ArrayBuffer or typed array.
778
+ *
779
+ * - Chooses an appropriate loader based on the provided MIME type.
780
+ * - Can upload into an existing texture if `texture` is specified.
781
+ *
782
+ * @typeParam T - Expected concrete texture type.
783
+ * @param arrayBuffer - Raw texture data buffer.
784
+ * @param mimeType - MIME type of the texture (must be supported by a registered loader).
785
+ * @param srgb - If true, treat image as sRGB; otherwise linear.
786
+ * @param samplerOptions - Optional sampler options passed to the loader path.
787
+ * @param texture - Optional destination texture to populate.
788
+ * @returns A promise that resolves to the created or populated texture.
737
789
  */ async loadTextureFromBuffer(arrayBuffer, mimeType, srgb, samplerOptions, texture) {
738
790
  for (const loader of AssetManager._textureLoaders){
739
791
  if (!loader.supportMIMEType(mimeType)) {
@@ -744,20 +796,20 @@ import '../shaders/atmosphere.js';
744
796
  }
745
797
  throw new Error(`Can not find loader for MIME type '${mimeType}'`);
746
798
  }
747
- /**
748
- * Load a texture via VFS by URL and MIME type.
749
- *
750
- * - Uses the first loader that supports the inferred or provided MIME type.
751
- * - On WebGL, may repack textures (resample to power-of-two, convert formats) to meet backend constraints.
752
- * - If `texture` is provided, the source is blitted into it, possibly resizing or changing sampling accordingly.
753
- *
754
- * @param url - Texture URL or VFS path.
755
- * @param mimeType - Optional explicit MIME type; otherwise inferred by VFS.
756
- * @param srgb - If true, treat image as sRGB; otherwise linear.
757
- * @param samplerOptions - Optional sampler options for loader or blit path.
758
- * @param texture - Optional destination texture to populate.
759
- * @returns A promise that resolves to the created or populated texture.
760
- * @internal
799
+ /**
800
+ * Load a texture via VFS by URL and MIME type.
801
+ *
802
+ * - Uses the first loader that supports the inferred or provided MIME type.
803
+ * - On WebGL, may repack textures (resample to power-of-two, convert formats) to meet backend constraints.
804
+ * - If `texture` is provided, the source is blitted into it, possibly resizing or changing sampling accordingly.
805
+ *
806
+ * @param url - Texture URL or VFS path.
807
+ * @param mimeType - Optional explicit MIME type; otherwise inferred by VFS.
808
+ * @param srgb - If true, treat image as sRGB; otherwise linear.
809
+ * @param samplerOptions - Optional sampler options for loader or blit path.
810
+ * @param texture - Optional destination texture to populate.
811
+ * @returns A promise that resolves to the created or populated texture.
812
+ * @internal
761
813
  */ async loadTexture(url, mimeType, srgb, samplerOptions, texture, VFSs) {
762
814
  const data = await this.readFileFromVFSs(url, {
763
815
  encoding: 'binary'
@@ -775,18 +827,18 @@ import '../shaders/atmosphere.js';
775
827
  }
776
828
  throw new Error(`Can not find loader for asset ${url}`);
777
829
  }
778
- /**
779
- * Internal routine that executes the texture load using a specific loader and applies
780
- * backend-specific compatibility steps (e.g., WebGL NPOT/sRGB rules).
781
- *
782
- * @param loader - Concrete loader to use for decoding/creation.
783
- * @param mimeType - Texture MIME type.
784
- * @param data - Raw binary data.
785
- * @param srgb - If true, treat image as sRGB; otherwise linear.
786
- * @param samplerOptions - Optional sampler options.
787
- * @param texture - Optional destination texture to populate.
788
- * @returns A promise that resolves to the created or populated texture.
789
- * @internal
830
+ /**
831
+ * Internal routine that executes the texture load using a specific loader and applies
832
+ * backend-specific compatibility steps (e.g., WebGL NPOT/sRGB rules).
833
+ *
834
+ * @param loader - Concrete loader to use for decoding/creation.
835
+ * @param mimeType - Texture MIME type.
836
+ * @param data - Raw binary data.
837
+ * @param srgb - If true, treat image as sRGB; otherwise linear.
838
+ * @param samplerOptions - Optional sampler options.
839
+ * @param texture - Optional destination texture to populate.
840
+ * @returns A promise that resolves to the created or populated texture.
841
+ * @internal
790
842
  */ async doLoadTexture(loader, mimeType, data, srgb, samplerOptions, texture) {
791
843
  const device = getDevice();
792
844
  if (device.type !== 'webgl') {
@@ -837,17 +889,17 @@ import '../shaders/atmosphere.js';
837
889
  return tex;
838
890
  }
839
891
  }
840
- /**
841
- * Load a model via registered model loaders.
842
- *
843
- * - Selects loader by MIME type (explicit or inferred).
844
- * - Optionally applies a post-process transform to the SharedModel.
845
- * - Sets the model's name from the source filename for convenience.
846
- *
847
- * @param url - Model URL or VFS path.
848
- * @param options - Model load options (MIME override, Draco module, post-process hook).
849
- * @returns A promise that resolves to the loaded SharedModel.
850
- * @internal
892
+ /**
893
+ * Load a model via registered model loaders.
894
+ *
895
+ * - Selects loader by MIME type (explicit or inferred).
896
+ * - Optionally applies a post-process transform to the SharedModel.
897
+ * - Sets the model's name from the source filename for convenience.
898
+ *
899
+ * @param url - Model URL or VFS path.
900
+ * @param options - Model load options (MIME override, Draco module, post-process hook).
901
+ * @returns A promise that resolves to the loaded SharedModel.
902
+ * @internal
851
903
  */ async loadModel(url, options, VFSs) {
852
904
  const arrayBuffer = await this.readFileFromVFSs(url, {
853
905
  encoding: 'binary'
@@ -879,17 +931,17 @@ import '../shaders/atmosphere.js';
879
931
  }
880
932
  throw new Error(`Can not find loader for asset ${url}`);
881
933
  }
882
- /**
883
- * Fetch a built-in texture synchronously by name.
884
- *
885
- * - If this built-in was not created yet, the registered loader is invoked.
886
- * - Registers a device restore handler so the texture can be re-initialized after device loss.
887
- * - If an existing texture is provided, the loader uploads into it.
888
- *
889
- * @typeParam T - Expected concrete texture type.
890
- * @param name - Built-in texture identifier.
891
- * @param texture - Optional destination texture to populate.
892
- * @returns The built-in texture (created or populated).
934
+ /**
935
+ * Fetch a built-in texture synchronously by name.
936
+ *
937
+ * - If this built-in was not created yet, the registered loader is invoked.
938
+ * - Registers a device restore handler so the texture can be re-initialized after device loss.
939
+ * - If an existing texture is provided, the loader uploads into it.
940
+ *
941
+ * @typeParam T - Expected concrete texture type.
942
+ * @param name - Built-in texture identifier.
943
+ * @param texture - Optional destination texture to populate.
944
+ * @returns The built-in texture (created or populated).
893
945
  */ fetchBuiltinTexture(name, texture) {
894
946
  const loader = AssetManager._builtinTextureLoaders[name];
895
947
  if (!loader) {
@@ -909,14 +961,14 @@ import '../shaders/atmosphere.js';
909
961
  return texture;
910
962
  }
911
963
  }
912
- /**
913
- * Override or unregister the loader for a named built-in texture.
914
- *
915
- * - Passing a valid loader function sets/overrides the creation path.
916
- * - Passing `undefined` removes the loader mapping for the given name.
917
- *
918
- * @param name - Built-in texture identifier.
919
- * @param loader - Factory that creates the built-in texture using the provided AssetManager.
964
+ /**
965
+ * Override or unregister the loader for a named built-in texture.
966
+ *
967
+ * - Passing a valid loader function sets/overrides the creation path.
968
+ * - Passing `undefined` removes the loader mapping for the given name.
969
+ *
970
+ * @param name - Built-in texture identifier.
971
+ * @param loader - Factory that creates the built-in texture using the provided AssetManager.
920
972
  */ static setBuiltinTextureLoader(name, loader) {
921
973
  if (loader) {
922
974
  this._builtinTextureLoaders[name] = loader;
@@ -924,29 +976,29 @@ import '../shaders/atmosphere.js';
924
976
  delete this._builtinTextureLoaders[name];
925
977
  }
926
978
  }
927
- /**
928
- * Compute a cache key for texture requests.
929
- *
930
- * Includes texture type tag, URL, and color space choice to avoid cross-color-space cache collisions.
931
- *
932
- * @typeParam T - Texture type parameter (not used for runtime behavior; helps preserve generic intent).
933
- * @param type - Logical texture type tag (e.g., '2d', 'cube').
934
- * @param url - Resource URL or VFS path.
935
- * @param options - Texture fetch options to incorporate into the key.
936
- * @returns A string cache key combining type, URL, and color space choice.
937
- * @internal
979
+ /**
980
+ * Compute a cache key for texture requests.
981
+ *
982
+ * Includes texture type tag, URL, and color space choice to avoid cross-color-space cache collisions.
983
+ *
984
+ * @typeParam T - Texture type parameter (not used for runtime behavior; helps preserve generic intent).
985
+ * @param type - Logical texture type tag (e.g., '2d', 'cube').
986
+ * @param url - Resource URL or VFS path.
987
+ * @param options - Texture fetch options to incorporate into the key.
988
+ * @returns A string cache key combining type, URL, and color space choice.
989
+ * @internal
938
990
  */ getHash(type, url, options) {
939
991
  return `${type}:${url}:${!options?.linearColorSpace}`;
940
992
  }
941
- /**
942
- * Try reading from file from a list of VFSs
943
- *
944
- * @param path - File path
945
- * @param options - Read options
946
- * @param vfsList - VFS list
947
- * @returns File content
948
- *
949
- * @internal
993
+ /**
994
+ * Try reading from file from a list of VFSs
995
+ *
996
+ * @param path - File path
997
+ * @param options - Read options
998
+ * @param vfsList - VFS list
999
+ * @returns File content
1000
+ *
1001
+ * @internal
950
1002
  */ async readFileFromVFSs(path, options, vfsList) {
951
1003
  vfsList = vfsList ?? [
952
1004
  this.vfs
@@ -958,13 +1010,13 @@ import '../shaders/atmosphere.js';
958
1010
  }
959
1011
  throw new VFSError(`File does not exist: ${path}`, 'ENOENT', path);
960
1012
  }
961
- /**
962
- * Write file to a list of VFSs
963
- *
964
- * @param path - File path
965
- * @param data - Data to write
966
- * @param options - Write options
967
- * @param vfsList - Which VFSs will be written to
1013
+ /**
1014
+ * Write file to a list of VFSs
1015
+ *
1016
+ * @param path - File path
1017
+ * @param data - Data to write
1018
+ * @param options - Write options
1019
+ * @param vfsList - Which VFSs will be written to
968
1020
  */ async writeFileToVFSs(path, data, options, vfsList) {
969
1021
  vfsList = vfsList ?? [
970
1022
  this.vfs