@zephyr3d/scene 0.9.2 → 0.9.3

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 (420) 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_particle.js +4 -4
  12. package/dist/animation/spring/spring_particle.js.map +1 -1
  13. package/dist/animation/spring/spring_system.js +75 -75
  14. package/dist/animation/spring/spring_system.js.map +1 -1
  15. package/dist/animation/spring2/constraints.js.map +1 -1
  16. package/dist/animation/spring2/controller.js +64 -64
  17. package/dist/animation/spring2/controller.js.map +1 -1
  18. package/dist/animation/spring2/math.js.map +1 -1
  19. package/dist/animation/spring2/spring_system.js +8 -8
  20. package/dist/animation/spring2/spring_system.js.map +1 -1
  21. package/dist/asset/model.js +57 -57
  22. package/dist/asset/model.js.map +1 -1
  23. package/dist/camera/camera.js +184 -184
  24. package/dist/camera/camera.js.map +1 -1
  25. package/dist/index.d.ts +2 -6
  26. package/dist/index.js +1 -1
  27. package/dist/material/material.js +288 -288
  28. package/dist/material/material.js.map +1 -1
  29. package/dist/material/shader/helper.js +281 -278
  30. package/dist/material/shader/helper.js.map +1 -1
  31. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +38 -0
  32. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +1 -0
  33. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +10 -0
  34. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +1 -0
  35. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +127 -0
  36. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +1 -0
  37. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +263 -0
  38. package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +1 -0
  39. package/dist/render/cluster_light.js +3 -4
  40. package/dist/render/cluster_light.js.map +1 -1
  41. package/dist/render/rendergraph/history_resource_manager.js +93 -93
  42. package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
  43. package/dist/render/rendergraph/history_resources.js +3 -3
  44. package/dist/render/rendergraph/history_resources.js.map +1 -1
  45. package/dist/render/rendergraph/types.js +22 -22
  46. package/dist/render/rendergraph/types.js.map +1 -1
  47. package/dist/scene/mesh.js +80 -80
  48. package/dist/scene/mesh.js.map +1 -1
  49. package/dist/scene/scene_node.js +228 -228
  50. package/dist/scene/scene_node.js.map +1 -1
  51. package/dist/shapes/torus.js +90 -59
  52. package/dist/shapes/torus.js.map +1 -1
  53. package/dist/src/animation/animation.js +127 -0
  54. package/dist/src/animation/animation.js.map +1 -0
  55. package/dist/src/animation/animationset.js +255 -0
  56. package/dist/src/animation/animationset.js.map +1 -0
  57. package/dist/src/animation/animationtrack.js +34 -0
  58. package/dist/src/animation/animationtrack.js.map +1 -0
  59. package/dist/src/animation/eulerrotationtrack.js +52 -0
  60. package/dist/src/animation/eulerrotationtrack.js.map +1 -0
  61. package/dist/src/animation/morphtarget.js +93 -0
  62. package/dist/src/animation/morphtarget.js.map +1 -0
  63. package/dist/src/animation/morphtrack.js +70 -0
  64. package/dist/src/animation/morphtrack.js.map +1 -0
  65. package/dist/src/animation/proptrack.js +161 -0
  66. package/dist/src/animation/proptrack.js.map +1 -0
  67. package/dist/src/animation/rotationtrack.js +51 -0
  68. package/dist/src/animation/rotationtrack.js.map +1 -0
  69. package/dist/src/animation/scaletrack.js +50 -0
  70. package/dist/src/animation/scaletrack.js.map +1 -0
  71. package/dist/src/animation/skeleton.js +204 -0
  72. package/dist/src/animation/skeleton.js.map +1 -0
  73. package/dist/src/animation/translationtrack.js +50 -0
  74. package/dist/src/animation/translationtrack.js.map +1 -0
  75. package/dist/src/app/app.js +129 -0
  76. package/dist/src/app/app.js.map +1 -0
  77. package/dist/src/app/inputmgr.js +267 -0
  78. package/dist/src/app/inputmgr.js.map +1 -0
  79. package/dist/src/asset/assetmanager.js +404 -0
  80. package/dist/src/asset/assetmanager.js.map +1 -0
  81. package/dist/src/asset/builtin.js +337 -0
  82. package/dist/src/asset/builtin.js.map +1 -0
  83. package/dist/src/asset/loaders/dds/dds.js +470 -0
  84. package/dist/src/asset/loaders/dds/dds.js.map +1 -0
  85. package/dist/src/asset/loaders/dds/dds_loader.js +28 -0
  86. package/dist/src/asset/loaders/dds/dds_loader.js.map +1 -0
  87. package/dist/src/asset/loaders/gltf/gltf_loader.js +1265 -0
  88. package/dist/src/asset/loaders/gltf/gltf_loader.js.map +1 -0
  89. package/dist/src/asset/loaders/gltf/helpers.js +327 -0
  90. package/dist/src/asset/loaders/gltf/helpers.js.map +1 -0
  91. package/dist/src/asset/loaders/hdr/hdr.js +180 -0
  92. package/dist/src/asset/loaders/hdr/hdr.js.map +1 -0
  93. package/dist/src/asset/loaders/image/tga_Loader.js +116 -0
  94. package/dist/src/asset/loaders/image/tga_Loader.js.map +1 -0
  95. package/dist/src/asset/loaders/image/webimage_loader.js +63 -0
  96. package/dist/src/asset/loaders/image/webimage_loader.js.map +1 -0
  97. package/dist/src/asset/loaders/loader.js +45 -0
  98. package/dist/src/asset/loaders/loader.js.map +1 -0
  99. package/dist/src/asset/model.js +414 -0
  100. package/dist/src/asset/model.js.map +1 -0
  101. package/dist/src/blitter/bilateralblur.js +221 -0
  102. package/dist/src/blitter/bilateralblur.js.map +1 -0
  103. package/dist/src/blitter/blitter.js +390 -0
  104. package/dist/src/blitter/blitter.js.map +1 -0
  105. package/dist/src/blitter/box.js +118 -0
  106. package/dist/src/blitter/box.js.map +1 -0
  107. package/dist/src/blitter/copy.js +22 -0
  108. package/dist/src/blitter/copy.js.map +1 -0
  109. package/dist/src/blitter/gaussianblur.js +228 -0
  110. package/dist/src/blitter/gaussianblur.js.map +1 -0
  111. package/dist/src/camera/base.js +92 -0
  112. package/dist/src/camera/base.js.map +1 -0
  113. package/dist/src/camera/camera.js +1005 -0
  114. package/dist/src/camera/camera.js.map +1 -0
  115. package/dist/src/camera/fps.js +238 -0
  116. package/dist/src/camera/fps.js.map +1 -0
  117. package/dist/src/camera/orbit.js +245 -0
  118. package/dist/src/camera/orbit.js.map +1 -0
  119. package/dist/src/camera/orthocamera.js +167 -0
  120. package/dist/src/camera/orthocamera.js.map +1 -0
  121. package/dist/src/camera/perspectivecamera.js +141 -0
  122. package/dist/src/camera/perspectivecamera.js.map +1 -0
  123. package/dist/src/index.js +120 -0
  124. package/dist/src/index.js.map +1 -0
  125. package/dist/src/material/blinn.js +81 -0
  126. package/dist/src/material/blinn.js.map +1 -0
  127. package/dist/src/material/grassmaterial.js +113 -0
  128. package/dist/src/material/grassmaterial.js.map +1 -0
  129. package/dist/src/material/lambert.js +92 -0
  130. package/dist/src/material/lambert.js.map +1 -0
  131. package/dist/src/material/material.js +301 -0
  132. package/dist/src/material/material.js.map +1 -0
  133. package/dist/src/material/meshmaterial.js +704 -0
  134. package/dist/src/material/meshmaterial.js.map +1 -0
  135. package/dist/src/material/mixins/albedocolor.js +76 -0
  136. package/dist/src/material/mixins/albedocolor.js.map +1 -0
  137. package/dist/src/material/mixins/foliage.js +47 -0
  138. package/dist/src/material/mixins/foliage.js.map +1 -0
  139. package/dist/src/material/mixins/lightmodel/blinnphong.js +112 -0
  140. package/dist/src/material/mixins/lightmodel/blinnphong.js.map +1 -0
  141. package/dist/src/material/mixins/lightmodel/lambert.js +58 -0
  142. package/dist/src/material/mixins/lightmodel/lambert.js.map +1 -0
  143. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +178 -0
  144. package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
  145. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +139 -0
  146. package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
  147. package/dist/src/material/mixins/lit.js +476 -0
  148. package/dist/src/material/mixins/lit.js.map +1 -0
  149. package/dist/src/material/mixins/pbr/common.js +918 -0
  150. package/dist/src/material/mixins/pbr/common.js.map +1 -0
  151. package/dist/src/material/mixins/texture.js +172 -0
  152. package/dist/src/material/mixins/texture.js.map +1 -0
  153. package/dist/src/material/mixins/vertexcolor.js +56 -0
  154. package/dist/src/material/mixins/vertexcolor.js.map +1 -0
  155. package/dist/src/material/particle.js +178 -0
  156. package/dist/src/material/particle.js.map +1 -0
  157. package/dist/src/material/pbrmr.js +97 -0
  158. package/dist/src/material/pbrmr.js.map +1 -0
  159. package/dist/src/material/pbrsg.js +97 -0
  160. package/dist/src/material/pbrsg.js.map +1 -0
  161. package/dist/src/material/shader/helper.js +1209 -0
  162. package/dist/src/material/shader/helper.js.map +1 -0
  163. package/dist/src/material/terrain-cm.js +606 -0
  164. package/dist/src/material/terrain-cm.js.map +1 -0
  165. package/dist/src/material/terrainmaterial.js +375 -0
  166. package/dist/src/material/terrainmaterial.js.map +1 -0
  167. package/dist/src/material/unlit.js +41 -0
  168. package/dist/src/material/unlit.js.map +1 -0
  169. package/dist/src/material/water.js +417 -0
  170. package/dist/src/material/water.js.map +1 -0
  171. package/dist/src/posteffect/bloom.js +361 -0
  172. package/dist/src/posteffect/bloom.js.map +1 -0
  173. package/dist/src/posteffect/compositor.js +226 -0
  174. package/dist/src/posteffect/compositor.js.map +1 -0
  175. package/dist/src/posteffect/fxaa.js +273 -0
  176. package/dist/src/posteffect/fxaa.js.map +1 -0
  177. package/dist/src/posteffect/grayscale.js +69 -0
  178. package/dist/src/posteffect/grayscale.js.map +1 -0
  179. package/dist/src/posteffect/motionblur.js +96 -0
  180. package/dist/src/posteffect/motionblur.js.map +1 -0
  181. package/dist/src/posteffect/posteffect.js +126 -0
  182. package/dist/src/posteffect/posteffect.js.map +1 -0
  183. package/dist/src/posteffect/sao.js +324 -0
  184. package/dist/src/posteffect/sao.js.map +1 -0
  185. package/dist/src/posteffect/ssr.js +489 -0
  186. package/dist/src/posteffect/ssr.js.map +1 -0
  187. package/dist/src/posteffect/taa.js +172 -0
  188. package/dist/src/posteffect/taa.js.map +1 -0
  189. package/dist/src/posteffect/tonemap.js +94 -0
  190. package/dist/src/posteffect/tonemap.js.map +1 -0
  191. package/dist/src/render/abuffer_oit.js +361 -0
  192. package/dist/src/render/abuffer_oit.js.map +1 -0
  193. package/dist/src/render/clipmap.js +851 -0
  194. package/dist/src/render/clipmap.js.map +1 -0
  195. package/dist/src/render/cluster_light.js +333 -0
  196. package/dist/src/render/cluster_light.js.map +1 -0
  197. package/dist/src/render/cull_visitor.js +187 -0
  198. package/dist/src/render/cull_visitor.js.map +1 -0
  199. package/dist/src/render/depthpass.js +68 -0
  200. package/dist/src/render/depthpass.js.map +1 -0
  201. package/dist/src/render/drawable_mixin.js +227 -0
  202. package/dist/src/render/drawable_mixin.js.map +1 -0
  203. package/dist/src/render/envlight.js +463 -0
  204. package/dist/src/render/envlight.js.map +1 -0
  205. package/dist/src/render/fbm_wavegenerator.js +251 -0
  206. package/dist/src/render/fbm_wavegenerator.js.map +1 -0
  207. package/dist/src/render/fft_wavegenerator.js +1006 -0
  208. package/dist/src/render/fft_wavegenerator.js.map +1 -0
  209. package/dist/src/render/fullscreenquad.js +38 -0
  210. package/dist/src/render/fullscreenquad.js.map +1 -0
  211. package/dist/src/render/gerstner_wavegenerator.js +314 -0
  212. package/dist/src/render/gerstner_wavegenerator.js.map +1 -0
  213. package/dist/src/render/globalbindgroup_allocator.js +60 -0
  214. package/dist/src/render/globalbindgroup_allocator.js.map +1 -0
  215. package/dist/src/render/hzb.js +273 -0
  216. package/dist/src/render/hzb.js.map +1 -0
  217. package/dist/src/render/lightpass.js +172 -0
  218. package/dist/src/render/lightpass.js.map +1 -0
  219. package/dist/src/render/objectcolorpass.js +51 -0
  220. package/dist/src/render/objectcolorpass.js.map +1 -0
  221. package/dist/src/render/primitive.js +364 -0
  222. package/dist/src/render/primitive.js.map +1 -0
  223. package/dist/src/render/render_queue.js +467 -0
  224. package/dist/src/render/render_queue.js.map +1 -0
  225. package/dist/src/render/renderbundle_wrapper.js +152 -0
  226. package/dist/src/render/renderbundle_wrapper.js.map +1 -0
  227. package/dist/src/render/renderer.js +455 -0
  228. package/dist/src/render/renderer.js.map +1 -0
  229. package/dist/src/render/renderpass.js +200 -0
  230. package/dist/src/render/renderpass.js.map +1 -0
  231. package/dist/src/render/shadowmap_pass.js +56 -0
  232. package/dist/src/render/shadowmap_pass.js.map +1 -0
  233. package/dist/src/render/sky.js +1103 -0
  234. package/dist/src/render/sky.js.map +1 -0
  235. package/dist/src/render/weightedblended_oit.js +168 -0
  236. package/dist/src/render/weightedblended_oit.js.map +1 -0
  237. package/dist/src/scene/batchgroup.js +162 -0
  238. package/dist/src/scene/batchgroup.js.map +1 -0
  239. package/dist/src/scene/environment.js +209 -0
  240. package/dist/src/scene/environment.js.map +1 -0
  241. package/dist/src/scene/graph_node.js +72 -0
  242. package/dist/src/scene/graph_node.js.map +1 -0
  243. package/dist/src/scene/light.js +416 -0
  244. package/dist/src/scene/light.js.map +1 -0
  245. package/dist/src/scene/mesh.js +341 -0
  246. package/dist/src/scene/mesh.js.map +1 -0
  247. package/dist/src/scene/octree.js +649 -0
  248. package/dist/src/scene/octree.js.map +1 -0
  249. package/dist/src/scene/particlesys.js +738 -0
  250. package/dist/src/scene/particlesys.js.map +1 -0
  251. package/dist/src/scene/raycast_visitor.js +103 -0
  252. package/dist/src/scene/raycast_visitor.js.map +1 -0
  253. package/dist/src/scene/scene.js +284 -0
  254. package/dist/src/scene/scene.js.map +1 -0
  255. package/dist/src/scene/scene_node.js +732 -0
  256. package/dist/src/scene/scene_node.js.map +1 -0
  257. package/dist/src/scene/terrain/grass.js +278 -0
  258. package/dist/src/scene/terrain/grass.js.map +1 -0
  259. package/dist/src/scene/terrain/heightfield.js +475 -0
  260. package/dist/src/scene/terrain/heightfield.js.map +1 -0
  261. package/dist/src/scene/terrain/patch.js +530 -0
  262. package/dist/src/scene/terrain/patch.js.map +1 -0
  263. package/dist/src/scene/terrain/quadtree.js +461 -0
  264. package/dist/src/scene/terrain/quadtree.js.map +1 -0
  265. package/dist/src/scene/terrain/terrain.js +246 -0
  266. package/dist/src/scene/terrain/terrain.js.map +1 -0
  267. package/dist/src/scene/terrain-cm/grass.js +594 -0
  268. package/dist/src/scene/terrain-cm/grass.js.map +1 -0
  269. package/dist/src/scene/terrain-cm/grassmaterial.js +159 -0
  270. package/dist/src/scene/terrain-cm/grassmaterial.js.map +1 -0
  271. package/dist/src/scene/terrain-cm/terrain-cm.js +538 -0
  272. package/dist/src/scene/terrain-cm/terrain-cm.js.map +1 -0
  273. package/dist/src/scene/water.js +374 -0
  274. package/dist/src/scene/water.js.map +1 -0
  275. package/dist/src/shaders/atmosphere.js +957 -0
  276. package/dist/src/shaders/atmosphere.js.map +1 -0
  277. package/dist/src/shaders/fog.js +112 -0
  278. package/dist/src/shaders/fog.js.map +1 -0
  279. package/dist/src/shaders/misc.js +266 -0
  280. package/dist/src/shaders/misc.js.map +1 -0
  281. package/dist/src/shaders/noise.js +222 -0
  282. package/dist/src/shaders/noise.js.map +1 -0
  283. package/dist/src/shaders/pbr.js +51 -0
  284. package/dist/src/shaders/pbr.js.map +1 -0
  285. package/dist/src/shaders/shadow.js +636 -0
  286. package/dist/src/shaders/shadow.js.map +1 -0
  287. package/dist/src/shaders/ssr.js +490 -0
  288. package/dist/src/shaders/ssr.js.map +1 -0
  289. package/dist/src/shaders/temporal.js +215 -0
  290. package/dist/src/shaders/temporal.js.map +1 -0
  291. package/dist/src/shaders/water.js +756 -0
  292. package/dist/src/shaders/water.js.map +1 -0
  293. package/dist/src/shadow/esm.js +237 -0
  294. package/dist/src/shadow/esm.js.map +1 -0
  295. package/dist/src/shadow/pcf_opt.js +181 -0
  296. package/dist/src/shadow/pcf_opt.js.map +1 -0
  297. package/dist/src/shadow/pcf_pd.js +189 -0
  298. package/dist/src/shadow/pcf_pd.js.map +1 -0
  299. package/dist/src/shadow/shader.js +37 -0
  300. package/dist/src/shadow/shader.js.map +1 -0
  301. package/dist/src/shadow/shadow_impl.js +15 -0
  302. package/dist/src/shadow/shadow_impl.js.map +1 -0
  303. package/dist/src/shadow/shadowmapper.js +790 -0
  304. package/dist/src/shadow/shadowmapper.js.map +1 -0
  305. package/dist/src/shadow/ssm.js +159 -0
  306. package/dist/src/shadow/ssm.js.map +1 -0
  307. package/dist/src/shadow/vsm.js +297 -0
  308. package/dist/src/shadow/vsm.js.map +1 -0
  309. package/dist/src/shapes/box.js +386 -0
  310. package/dist/src/shapes/box.js.map +1 -0
  311. package/dist/src/shapes/cylinder.js +125 -0
  312. package/dist/src/shapes/cylinder.js.map +1 -0
  313. package/dist/src/shapes/plane.js +88 -0
  314. package/dist/src/shapes/plane.js.map +1 -0
  315. package/dist/src/shapes/shape.js +87 -0
  316. package/dist/src/shapes/shape.js.map +1 -0
  317. package/dist/src/shapes/sphere.js +114 -0
  318. package/dist/src/shapes/sphere.js.map +1 -0
  319. package/dist/src/shapes/tetrahedron.js +188 -0
  320. package/dist/src/shapes/tetrahedron.js.map +1 -0
  321. package/dist/src/shapes/torus.js +111 -0
  322. package/dist/src/shapes/torus.js.map +1 -0
  323. package/dist/src/utility/aabbtree.js +400 -0
  324. package/dist/src/utility/aabbtree.js.map +1 -0
  325. package/dist/src/utility/bounding_volume.js +29 -0
  326. package/dist/src/utility/bounding_volume.js.map +1 -0
  327. package/dist/src/utility/debug.js +28 -0
  328. package/dist/src/utility/debug.js.map +1 -0
  329. package/dist/src/utility/draco/decoder.js +116 -0
  330. package/dist/src/utility/draco/decoder.js.map +1 -0
  331. package/dist/src/utility/misc.js +105 -0
  332. package/dist/src/utility/misc.js.map +1 -0
  333. package/dist/src/utility/panorama.js +163 -0
  334. package/dist/src/utility/panorama.js.map +1 -0
  335. package/dist/src/utility/pmrem.js +354 -0
  336. package/dist/src/utility/pmrem.js.map +1 -0
  337. package/dist/src/utility/rendermipmap.js +115 -0
  338. package/dist/src/utility/rendermipmap.js.map +1 -0
  339. package/dist/src/utility/serialization/json.js +402 -0
  340. package/dist/src/utility/serialization/json.js.map +1 -0
  341. package/dist/src/utility/serialization/manager.js +623 -0
  342. package/dist/src/utility/serialization/manager.js.map +1 -0
  343. package/dist/src/utility/serialization/scene/animation.js +248 -0
  344. package/dist/src/utility/serialization/scene/animation.js.map +1 -0
  345. package/dist/src/utility/serialization/scene/batch.js +59 -0
  346. package/dist/src/utility/serialization/scene/batch.js.map +1 -0
  347. package/dist/src/utility/serialization/scene/camera.js +790 -0
  348. package/dist/src/utility/serialization/scene/camera.js.map +1 -0
  349. package/dist/src/utility/serialization/scene/common.js +222 -0
  350. package/dist/src/utility/serialization/scene/common.js.map +1 -0
  351. package/dist/src/utility/serialization/scene/light.js +575 -0
  352. package/dist/src/utility/serialization/scene/light.js.map +1 -0
  353. package/dist/src/utility/serialization/scene/material.js +1111 -0
  354. package/dist/src/utility/serialization/scene/material.js.map +1 -0
  355. package/dist/src/utility/serialization/scene/mesh.js +148 -0
  356. package/dist/src/utility/serialization/scene/mesh.js.map +1 -0
  357. package/dist/src/utility/serialization/scene/misc.js +39 -0
  358. package/dist/src/utility/serialization/scene/misc.js.map +1 -0
  359. package/dist/src/utility/serialization/scene/node.js +451 -0
  360. package/dist/src/utility/serialization/scene/node.js.map +1 -0
  361. package/dist/src/utility/serialization/scene/particle.js +425 -0
  362. package/dist/src/utility/serialization/scene/particle.js.map +1 -0
  363. package/dist/src/utility/serialization/scene/primitive.js +692 -0
  364. package/dist/src/utility/serialization/scene/primitive.js.map +1 -0
  365. package/dist/src/utility/serialization/scene/scene.js +704 -0
  366. package/dist/src/utility/serialization/scene/scene.js.map +1 -0
  367. package/dist/src/utility/serialization/scene/terrain.js +488 -0
  368. package/dist/src/utility/serialization/scene/terrain.js.map +1 -0
  369. package/dist/src/utility/serialization/scene/water.js +465 -0
  370. package/dist/src/utility/serialization/scene/water.js.map +1 -0
  371. package/dist/src/utility/shprojector.js +297 -0
  372. package/dist/src/utility/shprojector.js.map +1 -0
  373. package/dist/src/utility/textures/ggxlut.js +213 -0
  374. package/dist/src/utility/textures/ggxlut.js.map +1 -0
  375. package/dist/src/utility/textures/gradientnoise.js +62 -0
  376. package/dist/src/utility/textures/gradientnoise.js.map +1 -0
  377. package/dist/src/utility/textures/randomnoise.js +41 -0
  378. package/dist/src/utility/textures/randomnoise.js.map +1 -0
  379. package/dist/src/values.js +162 -0
  380. package/dist/src/values.js.map +1 -0
  381. package/dist/utility/blueprint/material/common.js +7 -0
  382. package/dist/utility/blueprint/material/common.js.map +1 -0
  383. package/dist/utility/blueprint/material/ir.js +489 -489
  384. package/dist/utility/blueprint/material/ir.js.map +1 -1
  385. package/dist/utility/serialization/blueprint/constants.js +255 -0
  386. package/dist/utility/serialization/blueprint/constants.js.map +1 -0
  387. package/dist/utility/serialization/blueprint/material/constants.js +203 -0
  388. package/dist/utility/serialization/blueprint/material/constants.js.map +1 -0
  389. package/dist/utility/serialization/blueprint/material/texture.js +165 -0
  390. package/dist/utility/serialization/blueprint/material/texture.js.map +1 -0
  391. package/dist/utility/serialization/manager.js +271 -271
  392. package/dist/utility/serialization/manager.js.map +1 -1
  393. package/dist/utility/serialization/scene/animation.js.map +1 -1
  394. package/dist/utility/serialization/scene/camera.js.map +1 -1
  395. package/dist/utility/serialization/scene/common.js.map +1 -1
  396. package/dist/utility/serialization/scene/light.js.map +1 -1
  397. package/dist/utility/serialization/scene/material.js.map +1 -1
  398. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  399. package/dist/utility/serialization/scene/node.js.map +1 -1
  400. package/dist/utility/serialization/scene/particle.js.map +1 -1
  401. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  402. package/dist/utility/serialization/scene/scene.js.map +1 -1
  403. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  404. package/dist/utility/serialization/types.js +4 -4
  405. package/dist/utility/serialization/types.js.map +1 -1
  406. package/dist/values.js +49 -53
  407. package/dist/values.js.map +1 -1
  408. package/package.json +1 -1
  409. package/dist/animation/joint_dynamics/vrm_spring_bone.js +0 -46
  410. package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +0 -1
  411. package/dist/animation/spring/spring_bone.js +0 -240
  412. package/dist/animation/spring/spring_bone.js.map +0 -1
  413. package/dist/animation/spring/spring_bone_collider.js +0 -198
  414. package/dist/animation/spring/spring_bone_collider.js.map +0 -1
  415. package/dist/animation/spring/spring_bone_constraint.js +0 -170
  416. package/dist/animation/spring/spring_bone_constraint.js.map +0 -1
  417. package/dist/animation/spring/spring_bone_system.js +0 -328
  418. package/dist/animation/spring/spring_bone_system.js.map +0 -1
  419. package/dist/render/sky_motion_vector.js +0 -85
  420. package/dist/render/sky_motion_vector.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ import { ScriptingSystem } from './scriptingsystem.js';
2
+
3
+ class RuntimeManager {
4
+ scriptingSystem;
5
+ enabled;
6
+ constructor(VFS, scriptsRoot, editorMode, enabled){
7
+ this.scriptingSystem = new ScriptingSystem({
8
+ VFS,
9
+ scriptsRoot,
10
+ editorMode
11
+ });
12
+ this.enabled = enabled ?? true;
13
+ }
14
+ get VFS() {
15
+ return this.scriptingSystem.registry.VFS;
16
+ }
17
+ detachAllScripts() {
18
+ if (this.enabled) {
19
+ this.scriptingSystem.detachAllScripts();
20
+ }
21
+ }
22
+ async attachScript(host, module) {
23
+ return this.enabled ? await this.scriptingSystem.attachScript(host, module) : null;
24
+ }
25
+ detachScript(host, idOrInstance) {
26
+ if (this.enabled) {
27
+ this.scriptingSystem.detachScript(host, idOrInstance);
28
+ }
29
+ }
30
+ update(deltaTime, elapsedTime) {
31
+ if (this.enabled) {
32
+ this.scriptingSystem.update(deltaTime, elapsedTime);
33
+ }
34
+ }
35
+ }
36
+
37
+ export { RuntimeManager };
38
+ //# sourceMappingURL=runtimemgr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimemgr.js","sources":["../../../../../../node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js"],"sourcesContent":["import { ScriptingSystem } from './scriptingsystem.js';\n\nclass RuntimeManager {\n scriptingSystem;\n enabled;\n constructor(VFS, scriptsRoot, editorMode, enabled){\n this.scriptingSystem = new ScriptingSystem({\n VFS,\n scriptsRoot,\n editorMode\n });\n this.enabled = enabled ?? true;\n }\n get VFS() {\n return this.scriptingSystem.registry.VFS;\n }\n detachAllScripts() {\n if (this.enabled) {\n this.scriptingSystem.detachAllScripts();\n }\n }\n async attachScript(host, module) {\n return this.enabled ? await this.scriptingSystem.attachScript(host, module) : null;\n }\n detachScript(host, idOrInstance) {\n if (this.enabled) {\n this.scriptingSystem.detachScript(host, idOrInstance);\n }\n }\n update(deltaTime, elapsedTime) {\n if (this.enabled) {\n this.scriptingSystem.update(deltaTime, elapsedTime);\n }\n }\n}\n\nexport { RuntimeManager };\n//# sourceMappingURL=runtimemgr.js.map\n"],"names":[],"mappings":";;AAEA,MAAM,cAAc,CAAC;AACrB,IAAI,eAAe;AACnB,IAAI,OAAO;AACX,IAAI,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;AACtD,QAAQ,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC;AACnD,YAAY,GAAG;AACf,YAAY,WAAW;AACvB,YAAY;AACZ,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI;AACtC;AACA,IAAI,IAAI,GAAG,GAAG;AACd,QAAQ,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG;AAChD;AACA,IAAI,gBAAgB,GAAG;AACvB,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;AAC1B,YAAY,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE;AACnD;AACA;AACA,IAAI,MAAM,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE;AACrC,QAAQ,OAAO,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI;AAC1F;AACA,IAAI,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE;AACrC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;AAC1B,YAAY,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC;AACjE;AACA;AACA,IAAI,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE;AACnC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;AAC1B,YAAY,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;AAC/D;AACA;AACA;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,10 @@
1
+ class RuntimeScript {
2
+ onCreated() {}
3
+ onAttached(_host) {}
4
+ onUpdate(_deltaTime, _elapsedTime) {}
5
+ onDetached() {}
6
+ onDestroy() {}
7
+ }
8
+
9
+ export { RuntimeScript };
10
+ //# sourceMappingURL=runtimescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimescript.js","sources":["../../../../../../node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js"],"sourcesContent":["class RuntimeScript {\n onCreated() {}\n onAttached(_host) {}\n onUpdate(_deltaTime, _elapsedTime) {}\n onDetached() {}\n onDestroy() {}\n}\n\nexport { RuntimeScript };\n//# sourceMappingURL=runtimescript.js.map\n"],"names":[],"mappings":"AAAA,MAAM,aAAa,CAAC;AACpB,IAAI,SAAS,GAAG;AAChB,IAAI,UAAU,CAAC,KAAK,EAAE;AACtB,IAAI,QAAQ,CAAC,UAAU,EAAE,YAAY,EAAE;AACvC,IAAI,UAAU,GAAG;AACjB,IAAI,SAAS,GAAG;AAChB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,127 @@
1
+ import { ScriptRegistry } from './scriptregistry.js';
2
+ import { HttpFS } from '@zephyr3d/base';
3
+ import { RuntimeScript } from './runtimescript.js';
4
+
5
+ class ScriptingSystem {
6
+ _registry;
7
+ _hostScripts = new Map();
8
+ _onLoadError;
9
+ _importComment;
10
+ constructor(opts = {}){
11
+ this._registry = new ScriptRegistry(opts.VFS ?? new HttpFS('./'), opts.scriptsRoot ?? '/', opts.editorMode ?? false);
12
+ this._importComment = opts.importComment;
13
+ this._onLoadError = opts.onLoadError;
14
+ }
15
+ get registry() {
16
+ return this._registry;
17
+ }
18
+ // Attachs a script to object and returns the script instance
19
+ async attachScript(host, module) {
20
+ try {
21
+ const url = await this._registry.resolveRuntimeUrl(module);
22
+ if (!url) {
23
+ return null;
24
+ }
25
+ const mod = await import(url + (this._importComment ?? ''));
26
+ let instance;
27
+ if (typeof mod?.default === 'function') {
28
+ // default export
29
+ instance = new mod.default();
30
+ if (instance instanceof RuntimeScript) {
31
+ const P = instance.onCreated();
32
+ if (P instanceof Promise) {
33
+ await P;
34
+ }
35
+ }
36
+ } else {
37
+ console.warn(`Script '${module}' does not have RuntimeScript class exported as default`);
38
+ return null;
39
+ }
40
+ const attached = {
41
+ id: module,
42
+ url,
43
+ instance
44
+ };
45
+ let list = this._hostScripts.get(host);
46
+ if (!list) {
47
+ list = [];
48
+ this._hostScripts.set(host, list);
49
+ if (host) {
50
+ host.on('dispose', ()=>{
51
+ this.detachScript(host);
52
+ });
53
+ }
54
+ }
55
+ list.push(attached);
56
+ this.registerHost(host);
57
+ const P = instance.onAttached(host);
58
+ if (P instanceof Promise) {
59
+ await P;
60
+ }
61
+ return attached.instance;
62
+ } catch (e) {
63
+ this._onLoadError?.(e, module);
64
+ return null;
65
+ }
66
+ }
67
+ // Detach script from host object
68
+ detachScript(host, idOrInstance) {
69
+ const list = this._hostScripts.get(host);
70
+ if (!list || list.length === 0) {
71
+ return false;
72
+ }
73
+ let removed = false;
74
+ for(let i = list.length - 1; i >= 0; i--){
75
+ const it = list[i];
76
+ const hit = !idOrInstance || typeof idOrInstance === 'string' ? it.id === idOrInstance : it.instance === idOrInstance;
77
+ if (hit) {
78
+ try {
79
+ it.instance.onDetached();
80
+ } catch (err) {
81
+ console.error(`Error occured at onDetach() of module '${it.id}': ${err}`);
82
+ }
83
+ try {
84
+ it.instance.onDestroy();
85
+ } catch (err) {
86
+ console.error(`Error occured at onDestroy() of module '${it.id}': ${err}`);
87
+ }
88
+ list.splice(i, 1);
89
+ removed = true;
90
+ }
91
+ }
92
+ if (list.length === 0) {
93
+ this._hostScripts.delete(host);
94
+ this.unregisterHost(host);
95
+ }
96
+ return removed;
97
+ }
98
+ // Update script instances
99
+ update(deltaTime, elapsedTime) {
100
+ if (this._hostScripts.size === 0) {
101
+ return;
102
+ }
103
+ for (const list of this._hostScripts.values()){
104
+ for (const s of list){
105
+ try {
106
+ s.instance.onUpdate(deltaTime, elapsedTime);
107
+ } catch (err) {
108
+ console.error(`Error occured at onUpdate() of module '${s.id}': ${err}`);
109
+ }
110
+ }
111
+ }
112
+ }
113
+ // Detach all script instances
114
+ detachAllScripts() {
115
+ while(this._hostScripts.size > 0){
116
+ for (const entry of this._hostScripts){
117
+ this.detachScript(entry[0]);
118
+ }
119
+ }
120
+ }
121
+ // Preserved functions
122
+ registerHost(_host) {}
123
+ unregisterHost(_host) {}
124
+ }
125
+
126
+ export { ScriptingSystem };
127
+ //# sourceMappingURL=scriptingsystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptingsystem.js","sources":["../../../../../../node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js"],"sourcesContent":["import { ScriptRegistry } from './scriptregistry.js';\nimport { HttpFS } from '@zephyr3d/base';\nimport { RuntimeScript } from './runtimescript.js';\n\nclass ScriptingSystem {\n _registry;\n _hostScripts = new Map();\n _onLoadError;\n _importComment;\n constructor(opts = {}){\n this._registry = new ScriptRegistry(opts.VFS ?? new HttpFS('./'), opts.scriptsRoot ?? '/', opts.editorMode ?? false);\n this._importComment = opts.importComment;\n this._onLoadError = opts.onLoadError;\n }\n get registry() {\n return this._registry;\n }\n // Attachs a script to object and returns the script instance\n async attachScript(host, module) {\n try {\n const url = await this._registry.resolveRuntimeUrl(module);\n if (!url) {\n return null;\n }\n const mod = await import(url + (this._importComment ?? ''));\n let instance;\n if (typeof mod?.default === 'function') {\n // default export\n instance = new mod.default();\n if (instance instanceof RuntimeScript) {\n const P = instance.onCreated();\n if (P instanceof Promise) {\n await P;\n }\n }\n } else {\n console.warn(`Script '${module}' does not have RuntimeScript class exported as default`);\n return null;\n }\n const attached = {\n id: module,\n url,\n instance\n };\n let list = this._hostScripts.get(host);\n if (!list) {\n list = [];\n this._hostScripts.set(host, list);\n if (host) {\n host.on('dispose', ()=>{\n this.detachScript(host);\n });\n }\n }\n list.push(attached);\n this.registerHost(host);\n const P = instance.onAttached(host);\n if (P instanceof Promise) {\n await P;\n }\n return attached.instance;\n } catch (e) {\n this._onLoadError?.(e, module);\n return null;\n }\n }\n // Detach script from host object\n detachScript(host, idOrInstance) {\n const list = this._hostScripts.get(host);\n if (!list || list.length === 0) {\n return false;\n }\n let removed = false;\n for(let i = list.length - 1; i >= 0; i--){\n const it = list[i];\n const hit = !idOrInstance || typeof idOrInstance === 'string' ? it.id === idOrInstance : it.instance === idOrInstance;\n if (hit) {\n try {\n it.instance.onDetached();\n } catch (err) {\n console.error(`Error occured at onDetach() of module '${it.id}': ${err}`);\n }\n try {\n it.instance.onDestroy();\n } catch (err) {\n console.error(`Error occured at onDestroy() of module '${it.id}': ${err}`);\n }\n list.splice(i, 1);\n removed = true;\n }\n }\n if (list.length === 0) {\n this._hostScripts.delete(host);\n this.unregisterHost(host);\n }\n return removed;\n }\n // Update script instances\n update(deltaTime, elapsedTime) {\n if (this._hostScripts.size === 0) {\n return;\n }\n for (const list of this._hostScripts.values()){\n for (const s of list){\n try {\n s.instance.onUpdate(deltaTime, elapsedTime);\n } catch (err) {\n console.error(`Error occured at onUpdate() of module '${s.id}': ${err}`);\n }\n }\n }\n }\n // Detach all script instances\n detachAllScripts() {\n while(this._hostScripts.size > 0){\n for (const entry of this._hostScripts){\n this.detachScript(entry[0]);\n }\n }\n }\n // Preserved functions\n registerHost(_host) {}\n unregisterHost(_host) {}\n}\n\nexport { ScriptingSystem };\n//# sourceMappingURL=scriptingsystem.js.map\n"],"names":[],"mappings":";;;;AAIA,MAAM,eAAe,CAAC;AACtB,IAAI,SAAS;AACb,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE;AAC5B,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;AAC1B,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,IAAI,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC;AAC5H,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa;AAChD,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW;AAC5C;AACA,IAAI,IAAI,QAAQ,GAAG;AACnB,QAAQ,OAAO,IAAI,CAAC,SAAS;AAC7B;AACA;AACA,IAAI,MAAM,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE;AACrC,QAAQ,IAAI;AACZ,YAAY,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC;AACtE,YAAY,IAAI,CAAC,GAAG,EAAE;AACtB,gBAAgB,OAAO,IAAI;AAC3B;AACA,YAAY,MAAM,GAAG,GAAG,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;AACvE,YAAY,IAAI,QAAQ;AACxB,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'@zephyr3d/base';
2
+
3
+ function toDataUrl(js, id) {
4
+ const b64 = textToBase64(js);
5
+ return `data:text/javascript;base64,${b64}#${encodeURIComponent(String(id))}`;
6
+ }
7
+ function isAbsoluteUrl(spec) {
8
+ return /^https?:\/\//i.test(spec);
9
+ }
10
+ function isSpecialUrl(spec) {
11
+ return /^(data|blob):/i.test(spec);
12
+ }
13
+ function isBareModule(spec) {
14
+ return !spec.startsWith('./') && !spec.startsWith('../') && !spec.startsWith('/') && !spec.startsWith('#/');
15
+ }
16
+ class ScriptRegistry {
17
+ _vfs;
18
+ _scriptsRoot;
19
+ _built = new Map();
20
+ _editorMode = false;
21
+ constructor(vfs, scriptsRoot, editorMode){
22
+ this._vfs = vfs;
23
+ this._scriptsRoot = scriptsRoot;
24
+ this._editorMode = editorMode;
25
+ }
26
+ get VFS() {
27
+ return this._vfs;
28
+ }
29
+ set VFS(vfs) {
30
+ this._vfs = vfs;
31
+ }
32
+ get editorMode() {
33
+ return this._editorMode;
34
+ }
35
+ set editorMode(val) {
36
+ this._editorMode = val;
37
+ }
38
+ get scriptsRoot() {
39
+ return this._scriptsRoot;
40
+ }
41
+ set scriptsRoot(path) {
42
+ this._scriptsRoot = path;
43
+ }
44
+ async fetchSource(_id) {
45
+ let type = null;
46
+ let pathWithExt = '';
47
+ if (_id.endsWith('.ts')) {
48
+ pathWithExt = _id;
49
+ type = 'ts';
50
+ } else if (_id.endsWith('.js')) {
51
+ pathWithExt = _id;
52
+ type = 'js';
53
+ }
54
+ if (type) {
55
+ const exists = await this._vfs.exists(pathWithExt);
56
+ if (!exists) {
57
+ type = null;
58
+ }
59
+ const stat = await this._vfs.stat(pathWithExt);
60
+ if (stat.isDirectory) {
61
+ type = null;
62
+ }
63
+ }
64
+ const types = [
65
+ 'ts',
66
+ 'js'
67
+ ];
68
+ if (!type) {
69
+ for (const t of types){
70
+ pathWithExt = `${_id}.${t}`;
71
+ const exists = await this._vfs.exists(pathWithExt);
72
+ if (exists) {
73
+ const stats = await this._vfs.stat(pathWithExt);
74
+ if (stats.isFile) {
75
+ type = t;
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ }
81
+ if (type) {
82
+ const code = await this._vfs.readFile(pathWithExt, {
83
+ encoding: 'utf8'
84
+ });
85
+ return {
86
+ code,
87
+ type,
88
+ path: pathWithExt
89
+ };
90
+ }
91
+ }
92
+ async resolveRuntimeUrl(entryId) {
93
+ const id = this.resolveLogicalId(entryId);
94
+ return this._editorMode ? await this.build(String(id)) : id;
95
+ }
96
+ async getDependencies(entryId, fromId, dependencies) {
97
+ const reStatic = /\b(?:import|export)\s+[^"']*?from\s+(['"])([^'"]+)\1/g;
98
+ const reDynamic = /\bimport\s*\(\s*(['"])([^'"]+)\1\s*\)/g;
99
+ const normalizedId = this.resolveLogicalId(entryId, fromId);
100
+ const srcPath = await this.resolveSourcePath(normalizedId);
101
+ if (!srcPath || dependencies[srcPath.path] !== undefined) {
102
+ return;
103
+ }
104
+ const code = await this._vfs.readFile(srcPath.path, {
105
+ encoding: 'utf8'
106
+ });
107
+ dependencies[srcPath.path] = code;
108
+ const gather = async (input, re)=>{
109
+ for(;;){
110
+ const m = re.exec(input);
111
+ if (!m) {
112
+ break;
113
+ }
114
+ const spec = m[2];
115
+ if (spec.startsWith('./') || spec.startsWith('../')) {
116
+ await this.getDependencies(spec, normalizedId, dependencies);
117
+ }
118
+ }
119
+ };
120
+ await gather(code, reStatic);
121
+ await gather(code, reDynamic);
122
+ }
123
+ async build(id) {
124
+ const key = String(id);
125
+ const cached = this._built.get(key);
126
+ if (cached) {
127
+ return cached;
128
+ }
129
+ const srcPath = await this.resolveSourcePath(key);
130
+ if (!srcPath) {
131
+ return '';
132
+ }
133
+ const code = await this._vfs.readFile(srcPath.path, {
134
+ encoding: 'utf8'
135
+ });
136
+ const rewritten = await this.rewriteImports(code, key);
137
+ const js = await this.transpile(rewritten, key, srcPath.type);
138
+ const url = toDataUrl(js, key);
139
+ this._built.set(key, url);
140
+ return url;
141
+ }
142
+ async transpile(code, _id, type) {
143
+ const logicalId = String(_id);
144
+ if (type === 'js') {
145
+ return `${code}\n//# sourceURL=${logicalId}`;
146
+ }
147
+ const ts = window.ts;
148
+ if (!ts) {
149
+ throw new Error('TypeScript runtime (window.ts) not found. Load typescript.js first.');
150
+ }
151
+ const res = ts.transpileModule(code, {
152
+ compilerOptions: {
153
+ target: ts.ScriptTarget.ES2015,
154
+ module: ts.ModuleKind.ESNext,
155
+ sourceMap: true,
156
+ inlineSources: true,
157
+ experimentalDecorators: true,
158
+ useDefineForClassFields: false
159
+ },
160
+ fileName: logicalId
161
+ });
162
+ let out = res.outputText || '';
163
+ if (res.sourceMapText) {
164
+ const mapBase64 = btoa(unescape(encodeURIComponent(res.sourceMapText)));
165
+ out += `\n//# sourceMappingURL=data:application/json;base64,${mapBase64}`;
166
+ }
167
+ out += `\n//# sourceURL=${logicalId}`;
168
+ return out;
169
+ }
170
+ async rewriteImports(code, fromId) {
171
+ const reStatic = /\b(?:import|export)\s+[^"']*?from\s+(['"])([^'"]+)\1/g;
172
+ const reDynamic = /\bimport\s*\(\s*(['"])([^'"]+)\1\s*\)/g;
173
+ const replaceAsync = async (input, re)=>{
174
+ let out = '';
175
+ let last = 0;
176
+ for(;;){
177
+ const m = re.exec(input);
178
+ if (!m) {
179
+ break;
180
+ }
181
+ out += input.slice(last, m.index);
182
+ const quote = m[1];
183
+ const spec = m[2];
184
+ let replacement = spec;
185
+ if (isAbsoluteUrl(spec) || isSpecialUrl(spec) || isBareModule(spec)) {
186
+ replacement = spec;
187
+ } else {
188
+ const depId = this.resolveLogicalId(spec, String(fromId));
189
+ replacement = await this.build(depId); // 递归构建为 data URL
190
+ }
191
+ const replaced = m[0].replace(`${quote}${spec}${quote}`, `${quote}${replacement}${quote}`);
192
+ out += replaced;
193
+ last = m.index + m[0].length;
194
+ }
195
+ out += input.slice(last);
196
+ return out;
197
+ };
198
+ let out = await replaceAsync(code, reStatic);
199
+ out = await replaceAsync(out, reDynamic);
200
+ return out;
201
+ }
202
+ resolveLogicalId(spec, fromId) {
203
+ let path;
204
+ if (spec.startsWith('#/')) {
205
+ path = this._vfs.normalizePath(this._vfs.join(this._scriptsRoot, spec.slice(2)));
206
+ } else if (spec.startsWith('./') || spec.startsWith('../')) {
207
+ if (!fromId) {
208
+ throw new Error(`Relative import "${spec}" requires fromId`);
209
+ }
210
+ path = this._vfs.normalizePath(this._vfs.join(this._vfs.dirname(this._vfs.normalizePath(fromId)), spec));
211
+ } else if (spec.startsWith('/')) {
212
+ path = spec.replace(/^\/+/, '/');
213
+ } else {
214
+ return spec;
215
+ }
216
+ return path;
217
+ }
218
+ async resolveSourcePath(logicalId) {
219
+ let type = null;
220
+ let pathWithExt = '';
221
+ if (logicalId.endsWith('.ts')) {
222
+ pathWithExt = logicalId;
223
+ type = 'ts';
224
+ } else if (logicalId.endsWith('.js')) {
225
+ pathWithExt = logicalId;
226
+ type = 'js';
227
+ }
228
+ if (type) {
229
+ const exists = await this._vfs.exists(pathWithExt);
230
+ if (!exists) {
231
+ type = null;
232
+ }
233
+ const stat = await this._vfs.stat(pathWithExt);
234
+ if (stat.isDirectory) {
235
+ type = null;
236
+ }
237
+ }
238
+ const types = [
239
+ 'ts',
240
+ 'js'
241
+ ];
242
+ if (!type) {
243
+ for (const t of types){
244
+ pathWithExt = `${logicalId}.${t}`;
245
+ const exists = await this._vfs.exists(pathWithExt);
246
+ if (exists) {
247
+ const stats = await this._vfs.stat(pathWithExt);
248
+ if (stats.isFile) {
249
+ type = t;
250
+ break;
251
+ }
252
+ }
253
+ }
254
+ }
255
+ return type ? {
256
+ type,
257
+ path: pathWithExt
258
+ } : null;
259
+ }
260
+ }
261
+
262
+ export { ScriptRegistry };
263
+ //# sourceMappingURL=scriptregistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptregistry.js","sources":["../../../../../../node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js"],"sourcesContent":["import { textToBase64 } from '@zephyr3d/base';\n\nfunction toDataUrl(js, id) {\n const b64 = textToBase64(js);\n return `data:text/javascript;base64,${b64}#${encodeURIComponent(String(id))}`;\n}\nfunction isAbsoluteUrl(spec) {\n return /^https?:\\/\\//i.test(spec);\n}\nfunction isSpecialUrl(spec) {\n return /^(data|blob):/i.test(spec);\n}\nfunction isBareModule(spec) {\n return !spec.startsWith('./') && !spec.startsWith('../') && !spec.startsWith('/') && !spec.startsWith('#/');\n}\nclass ScriptRegistry {\n _vfs;\n _scriptsRoot;\n _built = new Map();\n _editorMode = false;\n constructor(vfs, scriptsRoot, editorMode){\n this._vfs = vfs;\n this._scriptsRoot = scriptsRoot;\n this._editorMode = editorMode;\n }\n get VFS() {\n return this._vfs;\n }\n set VFS(vfs) {\n this._vfs = vfs;\n }\n get editorMode() {\n return this._editorMode;\n }\n set editorMode(val) {\n this._editorMode = val;\n }\n get scriptsRoot() {\n return this._scriptsRoot;\n }\n set scriptsRoot(path) {\n this._scriptsRoot = path;\n }\n async fetchSource(_id) {\n let type = null;\n let pathWithExt = '';\n if (_id.endsWith('.ts')) {\n pathWithExt = _id;\n type = 'ts';\n } else if (_id.endsWith('.js')) {\n pathWithExt = _id;\n type = 'js';\n }\n if (type) {\n const exists = await this._vfs.exists(pathWithExt);\n if (!exists) {\n type = null;\n }\n const stat = await this._vfs.stat(pathWithExt);\n if (stat.isDirectory) {\n type = null;\n }\n }\n const types = [\n 'ts',\n 'js'\n ];\n if (!type) {\n for (const t of types){\n pathWithExt = `${_id}.${t}`;\n const exists = await this._vfs.exists(pathWithExt);\n if (exists) {\n const stats = await this._vfs.stat(pathWithExt);\n if (stats.isFile) {\n type = t;\n break;\n }\n }\n }\n }\n if (type) {\n const code = await this._vfs.readFile(pathWithExt, {\n encoding: 'utf8'\n });\n return {\n code,\n type,\n path: pathWithExt\n };\n }\n }\n async resolveRuntimeUrl(entryId) {\n const id = this.resolveLogicalId(entryId);\n return this._editorMode ? await this.build(String(id)) : id;\n }\n async getDependencies(entryId, fromId, dependencies) {\n const reStatic = /\\b(?:import|export)\\s+[^\"']*?from\\s+(['\"])([^'\"]+)\\1/g;\n const reDynamic = /\\bimport\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\)/g;\n const normalizedId = this.resolveLogicalId(entryId, fromId);\n const srcPath = await this.resolveSourcePath(normalizedId);\n if (!srcPath || dependencies[srcPath.path] !== undefined) {\n return;\n }\n const code = await this._vfs.readFile(srcPath.path, {\n encoding: 'utf8'\n });\n dependencies[srcPath.path] = code;\n const gather = async (input, re)=>{\n for(;;){\n const m = re.exec(input);\n if (!m) {\n break;\n }\n const spec = m[2];\n if (spec.startsWith('./') || spec.startsWith('../')) {\n await this.getDependencies(spec, normalizedId, dependencies);\n }\n }\n };\n await gather(code, reStatic);\n await gather(code, reDynamic);\n }\n async build(id) {\n const key = String(id);\n const cached = this._built.get(key);\n if (cached) {\n return cached;\n }\n const srcPath = await this.resolveSourcePath(key);\n if (!srcPath) {\n return '';\n }\n const code = await this._vfs.readFile(srcPath.path, {\n encoding: 'utf8'\n });\n const rewritten = await this.rewriteImports(code, key);\n const js = await this.transpile(rewritten, key, srcPath.type);\n const url = toDataUrl(js, key);\n this._built.set(key, url);\n return url;\n }\n async transpile(code, _id, type) {\n const logicalId = String(_id);\n if (type === 'js') {\n return `${code}\\n//# sourceURL=${logicalId}`;\n }\n const ts = window.ts;\n if (!ts) {\n throw new Error('TypeScript runtime (window.ts) not found. Load typescript.js first.');\n }\n const res = ts.transpileModule(code, {\n compilerOptions: {\n target: ts.ScriptTarget.ES2015,\n module: ts.ModuleKind.ESNext,\n sourceMap: true,\n inlineSources: true,\n experimentalDecorators: true,\n useDefineForClassFields: false\n },\n fileName: logicalId\n });\n let out = res.outputText || '';\n if (res.sourceMapText) {\n const mapBase64 = btoa(unescape(encodeURIComponent(res.sourceMapText)));\n out += `\\n//# sourceMappingURL=data:application/json;base64,${mapBase64}`;\n }\n out += `\\n//# sourceURL=${logicalId}`;\n return out;\n }\n async rewriteImports(code, fromId) {\n const reStatic = /\\b(?:import|export)\\s+[^\"']*?from\\s+(['\"])([^'\"]+)\\1/g;\n const reDynamic = /\\bimport\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\)/g;\n const replaceAsync = async (input, re)=>{\n let out = '';\n let last = 0;\n for(;;){\n const m = re.exec(input);\n if (!m) {\n break;\n }\n out += input.slice(last, m.index);\n const quote = m[1];\n const spec = m[2];\n let replacement = spec;\n if (isAbsoluteUrl(spec) || isSpecialUrl(spec) || isBareModule(spec)) {\n replacement = spec;\n } else {\n const depId = this.resolveLogicalId(spec, String(fromId));\n replacement = await this.build(depId); // 递归构建为 data URL\n }\n const replaced = m[0].replace(`${quote}${spec}${quote}`, `${quote}${replacement}${quote}`);\n out += replaced;\n last = m.index + m[0].length;\n }\n out += input.slice(last);\n return out;\n };\n let out = await replaceAsync(code, reStatic);\n out = await replaceAsync(out, reDynamic);\n return out;\n }\n resolveLogicalId(spec, fromId) {\n let path;\n if (spec.startsWith('#/')) {\n path = this._vfs.normalizePath(this._vfs.join(this._scriptsRoot, spec.slice(2)));\n } else if (spec.startsWith('./') || spec.startsWith('../')) {\n if (!fromId) {\n throw new Error(`Relative import \"${spec}\" requires fromId`);\n }\n path = this._vfs.normalizePath(this._vfs.join(this._vfs.dirname(this._vfs.normalizePath(fromId)), spec));\n } else if (spec.startsWith('/')) {\n path = spec.replace(/^\\/+/, '/');\n } else {\n return spec;\n }\n return path;\n }\n async resolveSourcePath(logicalId) {\n let type = null;\n let pathWithExt = '';\n if (logicalId.endsWith('.ts')) {\n pathWithExt = logicalId;\n type = 'ts';\n } else if (logicalId.endsWith('.js')) {\n pathWithExt = logicalId;\n type = 'js';\n }\n if (type) {\n const exists = await this._vfs.exists(pathWithExt);\n if (!exists) {\n type = null;\n }\n const stat = await this._vfs.stat(pathWithExt);\n if (stat.isDirectory) {\n type = null;\n }\n }\n const types = [\n 'ts',\n 'js'\n ];\n if (!type) {\n for (const t of types){\n pathWithExt = `${logicalId}.${t}`;\n const exists = await this._vfs.exists(pathWithExt);\n if (exists) {\n const stats = await this._vfs.stat(pathWithExt);\n if (stats.isFile) {\n type = t;\n break;\n }\n }\n }\n }\n return type ? {\n type,\n path: pathWithExt\n } : null;\n }\n}\n\nexport { ScriptRegistry };\n//# sourceMappingURL=scriptregistry.js.map\n"],"names":[],"mappings":";;AAEA,SAAS,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE;AAC3B,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,CAAC;AAChC,IAAI,OAAO,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjF;AACA,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC;AACA,SAAS,YAAY,CAAC,IAAI,EAAE;AAC5B,IAAI,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AACtC;AACA,SAAS,YAAY,CAAC,IAAI,EAAE;AAC5B,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AAC/G;AACA,MAAM,cAAc,CAAC;AACrB,IAAI,IAAI;AACR,IAAI,YAAY;AAChB,IAAI,MAAM,GAAG,IAAI,GAAG,EAAE;AACtB,IAAI,WAAW,GAAG,KAAK;AACvB,IAAI,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,UAAU,CAAC;AAC7C,QAAQ,IAAI,CAAC,IAAI,GAAG,GAAG;AACvB,QAAQ,IAAI,CAAC,YAAY,GAAG,WAAW;AACvC,QAAQ,IAAI,CAAC,WAAW,GAAG,UAAU;AACrC;AACA,IAAI,IAAI,GAAG,GAAG;AACd,QAA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BAAgB,IAAI,GAAG,IAAI;AAC3B;AACA,YAAY,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;AAC1D,YAAY,IAAI,IAAI,CAAC,WAAW,EAAE;AAClC,gBAAgB,IAAI,GAAG,IAAI;AAC3B;AACA;AACA,QAAQ,MAAM,KAAK,GAAG;AACtB,YAAY,IAAI;AAChB,YAAY;AACZ,SAAS;AACT,QAAQ,IAAI,CAAC,IAAI,EAAE;AACnB,YAAY,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC;AAClC,gBAAgB,WAAW,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACjD,gBAAgB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;AAClE,gBAAgB,IAAI,MAAM,EAAE;AAC5B,oBAAoB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;AACnE,oBAAoB,IAAI,KAAK,CAAC,MAAM,EAAE;AACtC,wBAAwB,IAAI,GAAG,CAAC;AAChC,wBAAwB;AACxB;AACA;AACA;AACA;AACA,QAAQ,OAAO,IAAI,GAAG;AACtB,YAAY,IAAI;AAChB,YAAY,IAAI,EAAE;AAClB,SAAS,GAAG,IAAI;AAChB;AACA;;;;","x_google_ignoreList":[0]}
@@ -1,5 +1,4 @@
1
1
  import { Vector4 } from '@zephyr3d/base';
2
- import { MAX_CLUSTERED_LIGHTS } from '../values.js';
3
2
  import { ShaderHelper } from '../material/shader/helper.js';
4
3
  import { getDevice } from '../app/api.js';
5
4
 
@@ -22,7 +21,7 @@ class ClusteredLight {
22
21
  this._tileCountX = 16;
23
22
  this._tileCountY = 16;
24
23
  this._tileCountZ = 32;
25
- this._lights = new Float32Array(16 * (MAX_CLUSTERED_LIGHTS + 1));
24
+ this._lights = new Float32Array(16 * (ShaderHelper.getMaxClusteredLightCount() + 1));
26
25
  this._lightIndexTexture = null;
27
26
  this._lightIndexFramebuffer = null;
28
27
  this._lightIndexProgram = null;
@@ -91,7 +90,7 @@ class ClusteredLight {
91
90
  this.viewMatrix = pb.mat4().uniform(0);
92
91
  this.sizeParam = pb.vec4().uniform(0);
93
92
  this.countParam = pb.ivec4().uniform(0);
94
- this[ShaderHelper.getLightBufferUniformName()] = pb.vec4[(MAX_CLUSTERED_LIGHTS + 1) * 4]().uniformBuffer(0);
93
+ this[ShaderHelper.getLightBufferUniformName()] = pb.vec4[(ShaderHelper.getMaxClusteredLightCount() + 1) * 4]().uniformBuffer(0);
95
94
  pb.func('lineIntersectionToZPlane', [
96
95
  pb.vec3('a'),
97
96
  pb.vec3('b'),
@@ -320,7 +319,7 @@ class ClusteredLight {
320
319
  device.popDeviceStates();
321
320
  }
322
321
  getVisibleLights(renderQueue, lights) {
323
- const numLights = Math.min(renderQueue.unshadowedLights.length, MAX_CLUSTERED_LIGHTS);
322
+ const numLights = Math.min(renderQueue.unshadowedLights.length, ShaderHelper.getMaxClusteredLightCount());
324
323
  for(let i = 1; i <= numLights; i++){
325
324
  const light = renderQueue.unshadowedLights[i - 1];
326
325
  const offset = i * 16;