@zephyr3d/scene 0.9.1 → 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.
- package/dist/animation/animationset.js +2 -0
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/cloth/gpu_cloth_system.js +9 -1
- package/dist/animation/cloth/gpu_cloth_system.js.map +1 -1
- package/dist/animation/fixed_geometry_cache_track.js +5 -1
- package/dist/animation/fixed_geometry_cache_track.js.map +1 -1
- package/dist/animation/geometry_cache_utils.js +20 -4
- package/dist/animation/geometry_cache_utils.js.map +1 -1
- package/dist/animation/ik/ik_angle_constraint.js +2 -6
- package/dist/animation/ik/ik_angle_constraint.js.map +1 -1
- package/dist/animation/ik/ik_chain_builder.js +68 -0
- package/dist/animation/ik/ik_chain_builder.js.map +1 -0
- package/dist/animation/ik/ik_pole_constraint.js +2 -7
- package/dist/animation/ik/ik_pole_constraint.js.map +1 -1
- package/dist/animation/ik/two_bone_ik_solver.js +2 -6
- package/dist/animation/ik/two_bone_ik_solver.js.map +1 -1
- package/dist/animation/joint_dynamics/collision.js +60 -12
- package/dist/animation/joint_dynamics/collision.js.map +1 -1
- package/dist/animation/joint_dynamics/constraints.js +20 -4
- package/dist/animation/joint_dynamics/constraints.js.map +1 -1
- package/dist/animation/joint_dynamics/controller.js +94 -46
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/math.js +16 -0
- package/dist/animation/joint_dynamics/math.js.map +1 -0
- package/dist/animation/joint_dynamics/solver.js +21 -11
- package/dist/animation/joint_dynamics/solver.js.map +1 -1
- package/dist/animation/joint_dynamics/types.js +15 -3
- package/dist/animation/joint_dynamics/types.js.map +1 -1
- package/dist/animation/pca_geometry_cache_track.js +5 -1
- package/dist/animation/pca_geometry_cache_track.js.map +1 -1
- package/dist/animation/skeleton.js +2 -2
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js +2 -6
- package/dist/animation/skeleton_modifier.js.map +1 -1
- package/dist/animation/spring/spring_particle.js +4 -4
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_system.js +13 -40
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring2/constraints.js.map +1 -1
- package/dist/animation/spring2/controller.js +64 -64
- package/dist/animation/spring2/controller.js.map +1 -1
- package/dist/animation/spring2/math.js.map +1 -1
- package/dist/animation/spring2/spring_system.js +8 -8
- package/dist/animation/spring2/spring_system.js.map +1 -1
- package/dist/app/app.js.map +1 -1
- package/dist/app/engine.js +1 -1
- package/dist/app/engine.js.map +1 -1
- package/dist/app/screen.js +4 -4
- package/dist/app/screen.js.map +1 -1
- package/dist/app/scriptingsystem.js +24 -1
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +22 -1
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +2 -2
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/model.js +60 -60
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/camera.js +1 -1
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +795 -266
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/material/material.js +3 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/shader/helper.js +281 -278
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/sprite.js +6 -6
- package/dist/material/sprite.js.map +1 -1
- package/dist/material/terrain-cm.js +2 -2
- package/dist/material/terrain-cm.js.map +1 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +38 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +10 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +127 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +263 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +1 -0
- package/dist/posteffect/taa.js +31 -39
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/cluster_light.js +3 -4
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/drawable.js +5 -1
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/rendergraph/device_pool_allocator.js +29 -3
- package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
- package/dist/render/rendergraph/executor.js +283 -33
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +338 -108
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +195 -115
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
- package/dist/render/rendergraph/history_resources.js +10 -0
- package/dist/render/rendergraph/history_resources.js.map +1 -0
- package/dist/render/rendergraph/rendergraph.js +162 -35
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/types.js +25 -5
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/rendertarget.js +5 -1
- package/dist/render/rendertarget.js.map +1 -1
- package/dist/render/screenrendertarget.js +5 -1
- package/dist/render/screenrendertarget.js.map +1 -1
- package/dist/render/sky.js +4 -4
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/basesprite.js +2 -2
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/graph_node.js +1 -1
- package/dist/scene/graph_node.js.map +1 -1
- package/dist/scene/mesh.js +81 -97
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/particlesys.js +1 -1
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/scene_node.js +228 -228
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/script_attachment.js +15 -3
- package/dist/scene/script_attachment.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +3 -3
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shapes/box.js +1 -1
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/capsule.js +0 -3
- package/dist/shapes/capsule.js.map +1 -1
- package/dist/shapes/cylinder.js +0 -3
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +0 -3
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/tetrahedron.js +3 -9
- package/dist/shapes/tetrahedron.js.map +1 -1
- package/dist/shapes/torus.js +94 -66
- package/dist/shapes/torus.js.map +1 -1
- package/dist/src/animation/animation.js +127 -0
- package/dist/src/animation/animation.js.map +1 -0
- package/dist/src/animation/animationset.js +255 -0
- package/dist/src/animation/animationset.js.map +1 -0
- package/dist/src/animation/animationtrack.js +34 -0
- package/dist/src/animation/animationtrack.js.map +1 -0
- package/dist/src/animation/eulerrotationtrack.js +52 -0
- package/dist/src/animation/eulerrotationtrack.js.map +1 -0
- package/dist/src/animation/morphtarget.js +93 -0
- package/dist/src/animation/morphtarget.js.map +1 -0
- package/dist/src/animation/morphtrack.js +70 -0
- package/dist/src/animation/morphtrack.js.map +1 -0
- package/dist/src/animation/proptrack.js +161 -0
- package/dist/src/animation/proptrack.js.map +1 -0
- package/dist/src/animation/rotationtrack.js +51 -0
- package/dist/src/animation/rotationtrack.js.map +1 -0
- package/dist/src/animation/scaletrack.js +50 -0
- package/dist/src/animation/scaletrack.js.map +1 -0
- package/dist/src/animation/skeleton.js +204 -0
- package/dist/src/animation/skeleton.js.map +1 -0
- package/dist/src/animation/translationtrack.js +50 -0
- package/dist/src/animation/translationtrack.js.map +1 -0
- package/dist/src/app/app.js +129 -0
- package/dist/src/app/app.js.map +1 -0
- package/dist/src/app/inputmgr.js +267 -0
- package/dist/src/app/inputmgr.js.map +1 -0
- package/dist/src/asset/assetmanager.js +404 -0
- package/dist/src/asset/assetmanager.js.map +1 -0
- package/dist/src/asset/builtin.js +337 -0
- package/dist/src/asset/builtin.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds.js +470 -0
- package/dist/src/asset/loaders/dds/dds.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds_loader.js +28 -0
- package/dist/src/asset/loaders/dds/dds_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js +1265 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/helpers.js +327 -0
- package/dist/src/asset/loaders/gltf/helpers.js.map +1 -0
- package/dist/src/asset/loaders/hdr/hdr.js +180 -0
- package/dist/src/asset/loaders/hdr/hdr.js.map +1 -0
- package/dist/src/asset/loaders/image/tga_Loader.js +116 -0
- package/dist/src/asset/loaders/image/tga_Loader.js.map +1 -0
- package/dist/src/asset/loaders/image/webimage_loader.js +63 -0
- package/dist/src/asset/loaders/image/webimage_loader.js.map +1 -0
- package/dist/src/asset/loaders/loader.js +45 -0
- package/dist/src/asset/loaders/loader.js.map +1 -0
- package/dist/src/asset/model.js +414 -0
- package/dist/src/asset/model.js.map +1 -0
- package/dist/src/blitter/bilateralblur.js +221 -0
- package/dist/src/blitter/bilateralblur.js.map +1 -0
- package/dist/src/blitter/blitter.js +390 -0
- package/dist/src/blitter/blitter.js.map +1 -0
- package/dist/src/blitter/box.js +118 -0
- package/dist/src/blitter/box.js.map +1 -0
- package/dist/src/blitter/copy.js +22 -0
- package/dist/src/blitter/copy.js.map +1 -0
- package/dist/src/blitter/gaussianblur.js +228 -0
- package/dist/src/blitter/gaussianblur.js.map +1 -0
- package/dist/src/camera/base.js +92 -0
- package/dist/src/camera/base.js.map +1 -0
- package/dist/src/camera/camera.js +1005 -0
- package/dist/src/camera/camera.js.map +1 -0
- package/dist/src/camera/fps.js +238 -0
- package/dist/src/camera/fps.js.map +1 -0
- package/dist/src/camera/orbit.js +245 -0
- package/dist/src/camera/orbit.js.map +1 -0
- package/dist/src/camera/orthocamera.js +167 -0
- package/dist/src/camera/orthocamera.js.map +1 -0
- package/dist/src/camera/perspectivecamera.js +141 -0
- package/dist/src/camera/perspectivecamera.js.map +1 -0
- package/dist/src/index.js +120 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/material/blinn.js +81 -0
- package/dist/src/material/blinn.js.map +1 -0
- package/dist/src/material/grassmaterial.js +113 -0
- package/dist/src/material/grassmaterial.js.map +1 -0
- package/dist/src/material/lambert.js +92 -0
- package/dist/src/material/lambert.js.map +1 -0
- package/dist/src/material/material.js +301 -0
- package/dist/src/material/material.js.map +1 -0
- package/dist/src/material/meshmaterial.js +704 -0
- package/dist/src/material/meshmaterial.js.map +1 -0
- package/dist/src/material/mixins/albedocolor.js +76 -0
- package/dist/src/material/mixins/albedocolor.js.map +1 -0
- package/dist/src/material/mixins/foliage.js +47 -0
- package/dist/src/material/mixins/foliage.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js +112 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/lambert.js +58 -0
- package/dist/src/material/mixins/lightmodel/lambert.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +178 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +139 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
- package/dist/src/material/mixins/lit.js +476 -0
- package/dist/src/material/mixins/lit.js.map +1 -0
- package/dist/src/material/mixins/pbr/common.js +918 -0
- package/dist/src/material/mixins/pbr/common.js.map +1 -0
- package/dist/src/material/mixins/texture.js +172 -0
- package/dist/src/material/mixins/texture.js.map +1 -0
- package/dist/src/material/mixins/vertexcolor.js +56 -0
- package/dist/src/material/mixins/vertexcolor.js.map +1 -0
- package/dist/src/material/particle.js +178 -0
- package/dist/src/material/particle.js.map +1 -0
- package/dist/src/material/pbrmr.js +97 -0
- package/dist/src/material/pbrmr.js.map +1 -0
- package/dist/src/material/pbrsg.js +97 -0
- package/dist/src/material/pbrsg.js.map +1 -0
- package/dist/src/material/shader/helper.js +1209 -0
- package/dist/src/material/shader/helper.js.map +1 -0
- package/dist/src/material/terrain-cm.js +606 -0
- package/dist/src/material/terrain-cm.js.map +1 -0
- package/dist/src/material/terrainmaterial.js +375 -0
- package/dist/src/material/terrainmaterial.js.map +1 -0
- package/dist/src/material/unlit.js +41 -0
- package/dist/src/material/unlit.js.map +1 -0
- package/dist/src/material/water.js +417 -0
- package/dist/src/material/water.js.map +1 -0
- package/dist/src/posteffect/bloom.js +361 -0
- package/dist/src/posteffect/bloom.js.map +1 -0
- package/dist/src/posteffect/compositor.js +226 -0
- package/dist/src/posteffect/compositor.js.map +1 -0
- package/dist/src/posteffect/fxaa.js +273 -0
- package/dist/src/posteffect/fxaa.js.map +1 -0
- package/dist/src/posteffect/grayscale.js +69 -0
- package/dist/src/posteffect/grayscale.js.map +1 -0
- package/dist/src/posteffect/motionblur.js +96 -0
- package/dist/src/posteffect/motionblur.js.map +1 -0
- package/dist/src/posteffect/posteffect.js +126 -0
- package/dist/src/posteffect/posteffect.js.map +1 -0
- package/dist/src/posteffect/sao.js +324 -0
- package/dist/src/posteffect/sao.js.map +1 -0
- package/dist/src/posteffect/ssr.js +489 -0
- package/dist/src/posteffect/ssr.js.map +1 -0
- package/dist/src/posteffect/taa.js +172 -0
- package/dist/src/posteffect/taa.js.map +1 -0
- package/dist/src/posteffect/tonemap.js +94 -0
- package/dist/src/posteffect/tonemap.js.map +1 -0
- package/dist/src/render/abuffer_oit.js +361 -0
- package/dist/src/render/abuffer_oit.js.map +1 -0
- package/dist/src/render/clipmap.js +851 -0
- package/dist/src/render/clipmap.js.map +1 -0
- package/dist/src/render/cluster_light.js +333 -0
- package/dist/src/render/cluster_light.js.map +1 -0
- package/dist/src/render/cull_visitor.js +187 -0
- package/dist/src/render/cull_visitor.js.map +1 -0
- package/dist/src/render/depthpass.js +68 -0
- package/dist/src/render/depthpass.js.map +1 -0
- package/dist/src/render/drawable_mixin.js +227 -0
- package/dist/src/render/drawable_mixin.js.map +1 -0
- package/dist/src/render/envlight.js +463 -0
- package/dist/src/render/envlight.js.map +1 -0
- package/dist/src/render/fbm_wavegenerator.js +251 -0
- package/dist/src/render/fbm_wavegenerator.js.map +1 -0
- package/dist/src/render/fft_wavegenerator.js +1006 -0
- package/dist/src/render/fft_wavegenerator.js.map +1 -0
- package/dist/src/render/fullscreenquad.js +38 -0
- package/dist/src/render/fullscreenquad.js.map +1 -0
- package/dist/src/render/gerstner_wavegenerator.js +314 -0
- package/dist/src/render/gerstner_wavegenerator.js.map +1 -0
- package/dist/src/render/globalbindgroup_allocator.js +60 -0
- package/dist/src/render/globalbindgroup_allocator.js.map +1 -0
- package/dist/src/render/hzb.js +273 -0
- package/dist/src/render/hzb.js.map +1 -0
- package/dist/src/render/lightpass.js +172 -0
- package/dist/src/render/lightpass.js.map +1 -0
- package/dist/src/render/objectcolorpass.js +51 -0
- package/dist/src/render/objectcolorpass.js.map +1 -0
- package/dist/src/render/primitive.js +364 -0
- package/dist/src/render/primitive.js.map +1 -0
- package/dist/src/render/render_queue.js +467 -0
- package/dist/src/render/render_queue.js.map +1 -0
- package/dist/src/render/renderbundle_wrapper.js +152 -0
- package/dist/src/render/renderbundle_wrapper.js.map +1 -0
- package/dist/src/render/renderer.js +455 -0
- package/dist/src/render/renderer.js.map +1 -0
- package/dist/src/render/renderpass.js +200 -0
- package/dist/src/render/renderpass.js.map +1 -0
- package/dist/src/render/shadowmap_pass.js +56 -0
- package/dist/src/render/shadowmap_pass.js.map +1 -0
- package/dist/src/render/sky.js +1103 -0
- package/dist/src/render/sky.js.map +1 -0
- package/dist/src/render/weightedblended_oit.js +168 -0
- package/dist/src/render/weightedblended_oit.js.map +1 -0
- package/dist/src/scene/batchgroup.js +162 -0
- package/dist/src/scene/batchgroup.js.map +1 -0
- package/dist/src/scene/environment.js +209 -0
- package/dist/src/scene/environment.js.map +1 -0
- package/dist/src/scene/graph_node.js +72 -0
- package/dist/src/scene/graph_node.js.map +1 -0
- package/dist/src/scene/light.js +416 -0
- package/dist/src/scene/light.js.map +1 -0
- package/dist/src/scene/mesh.js +341 -0
- package/dist/src/scene/mesh.js.map +1 -0
- package/dist/src/scene/octree.js +649 -0
- package/dist/src/scene/octree.js.map +1 -0
- package/dist/src/scene/particlesys.js +738 -0
- package/dist/src/scene/particlesys.js.map +1 -0
- package/dist/src/scene/raycast_visitor.js +103 -0
- package/dist/src/scene/raycast_visitor.js.map +1 -0
- package/dist/src/scene/scene.js +284 -0
- package/dist/src/scene/scene.js.map +1 -0
- package/dist/src/scene/scene_node.js +732 -0
- package/dist/src/scene/scene_node.js.map +1 -0
- package/dist/src/scene/terrain/grass.js +278 -0
- package/dist/src/scene/terrain/grass.js.map +1 -0
- package/dist/src/scene/terrain/heightfield.js +475 -0
- package/dist/src/scene/terrain/heightfield.js.map +1 -0
- package/dist/src/scene/terrain/patch.js +530 -0
- package/dist/src/scene/terrain/patch.js.map +1 -0
- package/dist/src/scene/terrain/quadtree.js +461 -0
- package/dist/src/scene/terrain/quadtree.js.map +1 -0
- package/dist/src/scene/terrain/terrain.js +246 -0
- package/dist/src/scene/terrain/terrain.js.map +1 -0
- package/dist/src/scene/terrain-cm/grass.js +594 -0
- package/dist/src/scene/terrain-cm/grass.js.map +1 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js +159 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +1 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js +538 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +1 -0
- package/dist/src/scene/water.js +374 -0
- package/dist/src/scene/water.js.map +1 -0
- package/dist/src/shaders/atmosphere.js +957 -0
- package/dist/src/shaders/atmosphere.js.map +1 -0
- package/dist/src/shaders/fog.js +112 -0
- package/dist/src/shaders/fog.js.map +1 -0
- package/dist/src/shaders/misc.js +266 -0
- package/dist/src/shaders/misc.js.map +1 -0
- package/dist/src/shaders/noise.js +222 -0
- package/dist/src/shaders/noise.js.map +1 -0
- package/dist/src/shaders/pbr.js +51 -0
- package/dist/src/shaders/pbr.js.map +1 -0
- package/dist/src/shaders/shadow.js +636 -0
- package/dist/src/shaders/shadow.js.map +1 -0
- package/dist/src/shaders/ssr.js +490 -0
- package/dist/src/shaders/ssr.js.map +1 -0
- package/dist/src/shaders/temporal.js +215 -0
- package/dist/src/shaders/temporal.js.map +1 -0
- package/dist/src/shaders/water.js +756 -0
- package/dist/src/shaders/water.js.map +1 -0
- package/dist/src/shadow/esm.js +237 -0
- package/dist/src/shadow/esm.js.map +1 -0
- package/dist/src/shadow/pcf_opt.js +181 -0
- package/dist/src/shadow/pcf_opt.js.map +1 -0
- package/dist/src/shadow/pcf_pd.js +189 -0
- package/dist/src/shadow/pcf_pd.js.map +1 -0
- package/dist/src/shadow/shader.js +37 -0
- package/dist/src/shadow/shader.js.map +1 -0
- package/dist/src/shadow/shadow_impl.js +15 -0
- package/dist/src/shadow/shadow_impl.js.map +1 -0
- package/dist/src/shadow/shadowmapper.js +790 -0
- package/dist/src/shadow/shadowmapper.js.map +1 -0
- package/dist/src/shadow/ssm.js +159 -0
- package/dist/src/shadow/ssm.js.map +1 -0
- package/dist/src/shadow/vsm.js +297 -0
- package/dist/src/shadow/vsm.js.map +1 -0
- package/dist/src/shapes/box.js +386 -0
- package/dist/src/shapes/box.js.map +1 -0
- package/dist/src/shapes/cylinder.js +125 -0
- package/dist/src/shapes/cylinder.js.map +1 -0
- package/dist/src/shapes/plane.js +88 -0
- package/dist/src/shapes/plane.js.map +1 -0
- package/dist/src/shapes/shape.js +87 -0
- package/dist/src/shapes/shape.js.map +1 -0
- package/dist/src/shapes/sphere.js +114 -0
- package/dist/src/shapes/sphere.js.map +1 -0
- package/dist/src/shapes/tetrahedron.js +188 -0
- package/dist/src/shapes/tetrahedron.js.map +1 -0
- package/dist/src/shapes/torus.js +111 -0
- package/dist/src/shapes/torus.js.map +1 -0
- package/dist/src/utility/aabbtree.js +400 -0
- package/dist/src/utility/aabbtree.js.map +1 -0
- package/dist/src/utility/bounding_volume.js +29 -0
- package/dist/src/utility/bounding_volume.js.map +1 -0
- package/dist/src/utility/debug.js +28 -0
- package/dist/src/utility/debug.js.map +1 -0
- package/dist/src/utility/draco/decoder.js +116 -0
- package/dist/src/utility/draco/decoder.js.map +1 -0
- package/dist/src/utility/misc.js +105 -0
- package/dist/src/utility/misc.js.map +1 -0
- package/dist/src/utility/panorama.js +163 -0
- package/dist/src/utility/panorama.js.map +1 -0
- package/dist/src/utility/pmrem.js +354 -0
- package/dist/src/utility/pmrem.js.map +1 -0
- package/dist/src/utility/rendermipmap.js +115 -0
- package/dist/src/utility/rendermipmap.js.map +1 -0
- package/dist/src/utility/serialization/json.js +402 -0
- package/dist/src/utility/serialization/json.js.map +1 -0
- package/dist/src/utility/serialization/manager.js +623 -0
- package/dist/src/utility/serialization/manager.js.map +1 -0
- package/dist/src/utility/serialization/scene/animation.js +248 -0
- package/dist/src/utility/serialization/scene/animation.js.map +1 -0
- package/dist/src/utility/serialization/scene/batch.js +59 -0
- package/dist/src/utility/serialization/scene/batch.js.map +1 -0
- package/dist/src/utility/serialization/scene/camera.js +790 -0
- package/dist/src/utility/serialization/scene/camera.js.map +1 -0
- package/dist/src/utility/serialization/scene/common.js +222 -0
- package/dist/src/utility/serialization/scene/common.js.map +1 -0
- package/dist/src/utility/serialization/scene/light.js +575 -0
- package/dist/src/utility/serialization/scene/light.js.map +1 -0
- package/dist/src/utility/serialization/scene/material.js +1111 -0
- package/dist/src/utility/serialization/scene/material.js.map +1 -0
- package/dist/src/utility/serialization/scene/mesh.js +148 -0
- package/dist/src/utility/serialization/scene/mesh.js.map +1 -0
- package/dist/src/utility/serialization/scene/misc.js +39 -0
- package/dist/src/utility/serialization/scene/misc.js.map +1 -0
- package/dist/src/utility/serialization/scene/node.js +451 -0
- package/dist/src/utility/serialization/scene/node.js.map +1 -0
- package/dist/src/utility/serialization/scene/particle.js +425 -0
- package/dist/src/utility/serialization/scene/particle.js.map +1 -0
- package/dist/src/utility/serialization/scene/primitive.js +692 -0
- package/dist/src/utility/serialization/scene/primitive.js.map +1 -0
- package/dist/src/utility/serialization/scene/scene.js +704 -0
- package/dist/src/utility/serialization/scene/scene.js.map +1 -0
- package/dist/src/utility/serialization/scene/terrain.js +488 -0
- package/dist/src/utility/serialization/scene/terrain.js.map +1 -0
- package/dist/src/utility/serialization/scene/water.js +465 -0
- package/dist/src/utility/serialization/scene/water.js.map +1 -0
- package/dist/src/utility/shprojector.js +297 -0
- package/dist/src/utility/shprojector.js.map +1 -0
- package/dist/src/utility/textures/ggxlut.js +213 -0
- package/dist/src/utility/textures/ggxlut.js.map +1 -0
- package/dist/src/utility/textures/gradientnoise.js +62 -0
- package/dist/src/utility/textures/gradientnoise.js.map +1 -0
- package/dist/src/utility/textures/randomnoise.js +41 -0
- package/dist/src/utility/textures/randomnoise.js.map +1 -0
- package/dist/src/values.js +162 -0
- package/dist/src/values.js.map +1 -0
- package/dist/utility/blueprint/material/common.js +7 -0
- package/dist/utility/blueprint/material/common.js.map +1 -0
- package/dist/utility/blueprint/material/inputs.js +3 -3
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +4 -4
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/serialization/blueprint/constants.js +255 -0
- package/dist/utility/serialization/blueprint/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/constants.js +203 -0
- package/dist/utility/serialization/blueprint/material/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/texture.js +165 -0
- package/dist/utility/serialization/blueprint/material/texture.js.map +1 -0
- package/dist/utility/serialization/manager.js +299 -268
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +45 -0
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +53 -0
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/common.js +10 -0
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +30 -0
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +63 -0
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +11 -0
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/misc.js +2 -0
- package/dist/utility/serialization/scene/misc.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +19 -0
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +22 -0
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +33 -0
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +39 -0
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/script.js +2 -0
- package/dist/utility/serialization/scene/script.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +6 -0
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +9 -0
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +21 -0
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js +5 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/values.js +49 -53
- package/dist/values.js.map +1 -1
- package/package.json +2 -2
- package/dist/animation/joint_dynamics/vrm_spring_bone.js +0 -46
- package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +0 -1
- package/dist/animation/spring/spring_bone.js +0 -240
- package/dist/animation/spring/spring_bone.js.map +0 -1
- package/dist/animation/spring/spring_bone_collider.js +0 -198
- package/dist/animation/spring/spring_bone_collider.js.map +0 -1
- package/dist/animation/spring/spring_bone_constraint.js +0 -170
- package/dist/animation/spring/spring_bone_constraint.js.map +0 -1
- package/dist/animation/spring/spring_bone_system.js +0 -328
- package/dist/animation/spring/spring_bone_system.js.map +0 -1
- package/dist/render/sky_motion_vector.js +0 -85
- package/dist/render/sky_motion_vector.js.map +0 -1
|
@@ -111,29 +111,29 @@ const defaultValues = {
|
|
|
111
111
|
],
|
|
112
112
|
command: null
|
|
113
113
|
};
|
|
114
|
-
/**
|
|
115
|
-
* Manages serialization and deserialization of engine objects to/from JSON,
|
|
116
|
-
* including asset resolution via a virtual file system (VFS) and asset manager.
|
|
117
|
-
*
|
|
118
|
-
* @remarks
|
|
119
|
-
* - Keeps a registry of serializable classes and their properties.
|
|
120
|
-
* - Converts object graphs to JSON using per-class metadata and property accessors.
|
|
121
|
-
* - Supports async asset embedding/export and lazy deserialization via phases.
|
|
122
|
-
* - Maps loaded assets/objects back to their source IDs for caching and deduplication.
|
|
123
|
-
*
|
|
124
|
-
* Typical workflow:
|
|
125
|
-
* 1. Construct with a `VFS`.
|
|
126
|
-
* 2. Optionally `registerClass` for custom types.
|
|
127
|
-
* 3. Use `serializeObject` and `deserializeObject` to convert between runtime objects and JSON.
|
|
128
|
-
* 4. Use `saveScene` / `loadScene` for scene I/O.
|
|
129
|
-
*
|
|
130
|
-
* Caching:
|
|
131
|
-
* - `getAssetId` returns the known source ID for an allocated asset when available.
|
|
132
|
-
*
|
|
133
|
-
* Threading:
|
|
134
|
-
* - Methods returning Promises perform async I/O using the provided `VFS`/AssetManager.
|
|
135
|
-
*
|
|
136
|
-
* @public
|
|
114
|
+
/**
|
|
115
|
+
* Manages serialization and deserialization of engine objects to/from JSON,
|
|
116
|
+
* including asset resolution via a virtual file system (VFS) and asset manager.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* - Keeps a registry of serializable classes and their properties.
|
|
120
|
+
* - Converts object graphs to JSON using per-class metadata and property accessors.
|
|
121
|
+
* - Supports async asset embedding/export and lazy deserialization via phases.
|
|
122
|
+
* - Maps loaded assets/objects back to their source IDs for caching and deduplication.
|
|
123
|
+
*
|
|
124
|
+
* Typical workflow:
|
|
125
|
+
* 1. Construct with a `VFS`.
|
|
126
|
+
* 2. Optionally `registerClass` for custom types.
|
|
127
|
+
* 3. Use `serializeObject` and `deserializeObject` to convert between runtime objects and JSON.
|
|
128
|
+
* 4. Use `saveScene` / `loadScene` for scene I/O.
|
|
129
|
+
*
|
|
130
|
+
* Caching:
|
|
131
|
+
* - `getAssetId` returns the known source ID for an allocated asset when available.
|
|
132
|
+
*
|
|
133
|
+
* Threading:
|
|
134
|
+
* - Methods returning Promises perform async I/O using the provided `VFS`/AssetManager.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
137
|
*/ class ResourceManager {
|
|
138
138
|
_classMap;
|
|
139
139
|
_vfs;
|
|
@@ -143,10 +143,10 @@ const defaultValues = {
|
|
|
143
143
|
_assetManager;
|
|
144
144
|
_editorMode;
|
|
145
145
|
_allocated;
|
|
146
|
-
/**
|
|
147
|
-
* Create a ResourceManager bound to a virtual file system.
|
|
148
|
-
*
|
|
149
|
-
* @param vfs - Virtual file system used for reading/writing assets and scenes.
|
|
146
|
+
/**
|
|
147
|
+
* Create a ResourceManager bound to a virtual file system.
|
|
148
|
+
*
|
|
149
|
+
* @param vfs - Virtual file system used for reading/writing assets and scenes.
|
|
150
150
|
*/ constructor(vfs, editorMode = false){
|
|
151
151
|
this._vfs = vfs;
|
|
152
152
|
this._editorMode = editorMode;
|
|
@@ -330,67 +330,75 @@ const defaultValues = {
|
|
|
330
330
|
this.registerProps(k[1]);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
/**
|
|
334
|
-
* The virtual file system used by this manager.
|
|
335
|
-
*
|
|
336
|
-
* @remarks
|
|
337
|
-
* Used by asset fetchers and scene save/load operations.
|
|
333
|
+
/**
|
|
334
|
+
* The virtual file system used by this manager.
|
|
335
|
+
*
|
|
336
|
+
* @remarks
|
|
337
|
+
* Used by asset fetchers and scene save/load operations.
|
|
338
338
|
*/ get VFS() {
|
|
339
339
|
return this._vfs;
|
|
340
340
|
}
|
|
341
341
|
set VFS(vfs) {
|
|
342
342
|
this._vfs = vfs;
|
|
343
343
|
}
|
|
344
|
-
/**
|
|
345
|
-
* Wethether editor mode is enabled
|
|
346
|
-
*
|
|
347
|
-
* @remarks
|
|
348
|
-
* In editor mode, some properties will be disabled
|
|
344
|
+
/**
|
|
345
|
+
* Wethether editor mode is enabled
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
* In editor mode, some properties will be disabled
|
|
349
349
|
*/ get editorMode() {
|
|
350
350
|
return this._editorMode;
|
|
351
351
|
}
|
|
352
|
-
/**
|
|
353
|
-
* AssetManager
|
|
352
|
+
/**
|
|
353
|
+
* AssetManager
|
|
354
354
|
*/ get assetManager() {
|
|
355
355
|
return this._assetManager;
|
|
356
356
|
}
|
|
357
|
-
/**
|
|
358
|
-
* Get the list of all registered serializable classes.
|
|
359
|
-
*
|
|
360
|
-
* @remarks
|
|
361
|
-
* Includes built-in classes registered during construction and any custom classes
|
|
362
|
-
* registered via `registerClass`.
|
|
363
|
-
*
|
|
364
|
-
* @returns An array of `SerializableClass` metadata.
|
|
357
|
+
/**
|
|
358
|
+
* Get the list of all registered serializable classes.
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Includes built-in classes registered during construction and any custom classes
|
|
362
|
+
* registered via `registerClass`.
|
|
363
|
+
*
|
|
364
|
+
* @returns An array of `SerializableClass` metadata.
|
|
365
365
|
*/ getClasses() {
|
|
366
366
|
return [
|
|
367
367
|
...this._classMap.values()
|
|
368
368
|
];
|
|
369
369
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Get serialization metadata by a constructor function.
|
|
372
|
-
*
|
|
373
|
-
* @param ctor - The class constructor to look up.
|
|
374
|
-
*
|
|
375
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
370
|
+
/**
|
|
371
|
+
* Get serialization metadata by a constructor function.
|
|
372
|
+
*
|
|
373
|
+
* @param ctor - The class constructor to look up.
|
|
374
|
+
*
|
|
375
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
376
376
|
*/ getClassByConstructor(ctor) {
|
|
377
|
-
|
|
377
|
+
let current = ctor;
|
|
378
|
+
while(typeof current === 'function' && current !== Function.prototype){
|
|
379
|
+
const cls = this._classMap.get(current);
|
|
380
|
+
if (cls) {
|
|
381
|
+
return cls;
|
|
382
|
+
}
|
|
383
|
+
current = Object.getPrototypeOf(current);
|
|
384
|
+
}
|
|
385
|
+
return null;
|
|
378
386
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Get serialization metadata by an object instance.
|
|
381
|
-
*
|
|
382
|
-
* @param obj - The object whose constructor will be used for the lookup.
|
|
383
|
-
*
|
|
384
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
387
|
+
/**
|
|
388
|
+
* Get serialization metadata by an object instance.
|
|
389
|
+
*
|
|
390
|
+
* @param obj - The object whose constructor will be used for the lookup.
|
|
391
|
+
*
|
|
392
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
385
393
|
*/ getClassByObject(obj) {
|
|
386
394
|
return this.getClassByConstructor(obj.constructor);
|
|
387
395
|
}
|
|
388
|
-
/**
|
|
389
|
-
* Get serialization metadata by class name.
|
|
390
|
-
*
|
|
391
|
-
* @param className - Fully qualified class name as stored in JSON.
|
|
392
|
-
*
|
|
393
|
-
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
396
|
+
/**
|
|
397
|
+
* Get serialization metadata by class name.
|
|
398
|
+
*
|
|
399
|
+
* @param className - Fully qualified class name as stored in JSON.
|
|
400
|
+
*
|
|
401
|
+
* @returns The `SerializableClass` metadata, or `null` if not found.
|
|
394
402
|
*/ getClassByName(className) {
|
|
395
403
|
for (const val of this._classMap){
|
|
396
404
|
if (val[0].name === className) {
|
|
@@ -399,12 +407,12 @@ const defaultValues = {
|
|
|
399
407
|
}
|
|
400
408
|
return null;
|
|
401
409
|
}
|
|
402
|
-
/**
|
|
403
|
-
* Find the class that owns a given property accessor.
|
|
404
|
-
*
|
|
405
|
-
* @param prop - Property accessor to search for.
|
|
406
|
-
*
|
|
407
|
-
* @returns The `SerializableClass` that declares the property, or `null` if unknown.
|
|
410
|
+
/**
|
|
411
|
+
* Find the class that owns a given property accessor.
|
|
412
|
+
*
|
|
413
|
+
* @param prop - Property accessor to search for.
|
|
414
|
+
*
|
|
415
|
+
* @returns The `SerializableClass` that declares the property, or `null` if unknown.
|
|
408
416
|
*/ getClassByProperty(prop) {
|
|
409
417
|
for (const k of this._clsPropMap){
|
|
410
418
|
if (k[1].indexOf(prop) >= 0) {
|
|
@@ -413,81 +421,104 @@ const defaultValues = {
|
|
|
413
421
|
}
|
|
414
422
|
return null;
|
|
415
423
|
}
|
|
416
|
-
/**
|
|
417
|
-
* Get the properties declared on a given class.
|
|
418
|
-
*
|
|
419
|
-
* @param cls - Serializable class metadata.
|
|
420
|
-
*
|
|
421
|
-
* @returns An array of `PropertyAccessor` entries, or `null` if none.
|
|
424
|
+
/**
|
|
425
|
+
* Get the properties declared on a given class.
|
|
426
|
+
*
|
|
427
|
+
* @param cls - Serializable class metadata.
|
|
428
|
+
*
|
|
429
|
+
* @returns An array of `PropertyAccessor` entries, or `null` if none.
|
|
422
430
|
*/ getPropertiesByClass(cls) {
|
|
423
431
|
return this._clsPropMap.get(cls) ?? null;
|
|
424
432
|
}
|
|
425
|
-
/**
|
|
426
|
-
* Get
|
|
427
|
-
*
|
|
428
|
-
* @param cls - Serializable class metadata.
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
|
|
433
|
+
/**
|
|
434
|
+
* Get all properties declared on a given class and its ancestors.
|
|
435
|
+
*
|
|
436
|
+
* @param cls - Serializable class metadata.
|
|
437
|
+
*
|
|
438
|
+
* @returns An array of `PropertyAccessor` entries, or `null` if none.
|
|
439
|
+
*/ getAllPropertiesByClass(cls) {
|
|
440
|
+
const props = new Map();
|
|
441
|
+
while(cls){
|
|
442
|
+
const classProps = this.getPropertiesByClass(cls);
|
|
443
|
+
if (classProps) {
|
|
444
|
+
for (const prop of classProps){
|
|
445
|
+
if (!props.has(prop.name)) {
|
|
446
|
+
props.set(prop.name, prop);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
cls = this.getClassByConstructor(cls.parent);
|
|
451
|
+
}
|
|
452
|
+
return [
|
|
453
|
+
...props.values()
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Get a property accessor by class and property name.
|
|
458
|
+
*
|
|
459
|
+
* @param cls - Serializable class metadata.
|
|
460
|
+
* @param name - Property name to search for.
|
|
461
|
+
*
|
|
462
|
+
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
432
463
|
*/ getPropertyByClass(cls, name) {
|
|
433
464
|
return this.getPropertiesByClass(cls)?.find((value)=>value.name === name) ?? null;
|
|
434
465
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Get a property accessor by its canonical path.
|
|
437
|
-
*
|
|
438
|
-
* @remarks
|
|
439
|
-
* The canonical path format is `/ClassName/propName`.
|
|
440
|
-
*
|
|
441
|
-
* @param name - Canonical property path.
|
|
442
|
-
*
|
|
443
|
-
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
466
|
+
/**
|
|
467
|
+
* Get a property accessor by its canonical path.
|
|
468
|
+
*
|
|
469
|
+
* @remarks
|
|
470
|
+
* The canonical path format is `/ClassName/propName`.
|
|
471
|
+
*
|
|
472
|
+
* @param name - Canonical property path.
|
|
473
|
+
*
|
|
474
|
+
* @returns The `PropertyAccessor`, or `null` if not found.
|
|
444
475
|
*/ getPropertyByName(name) {
|
|
445
476
|
return this._propMap[name] ?? null;
|
|
446
477
|
}
|
|
447
|
-
/**
|
|
448
|
-
* Get the canonical path for a property accessor.
|
|
449
|
-
*
|
|
450
|
-
* @remarks
|
|
451
|
-
* Returns a string like `/ClassName/propName` if the property is registered.
|
|
452
|
-
*
|
|
453
|
-
* @param prop - Property accessor.
|
|
454
|
-
*
|
|
455
|
-
* @returns The canonical path, or `null` if unknown.
|
|
478
|
+
/**
|
|
479
|
+
* Get the canonical path for a property accessor.
|
|
480
|
+
*
|
|
481
|
+
* @remarks
|
|
482
|
+
* Returns a string like `/ClassName/propName` if the property is registered.
|
|
483
|
+
*
|
|
484
|
+
* @param prop - Property accessor.
|
|
485
|
+
*
|
|
486
|
+
* @returns The canonical path, or `null` if unknown.
|
|
456
487
|
*/ getPropertyName(prop) {
|
|
457
488
|
return this._propNameMap.get(prop) ?? null;
|
|
458
489
|
}
|
|
459
|
-
/**
|
|
460
|
-
* Register a serializable class and its properties.
|
|
461
|
-
*
|
|
462
|
-
* @remarks
|
|
463
|
-
* - No effect if the class is already registered.
|
|
464
|
-
* - Also registers the class's properties with canonical paths.
|
|
465
|
-
*
|
|
466
|
-
* @param cls - Serializable class metadata to register.
|
|
490
|
+
/**
|
|
491
|
+
* Register a serializable class and its properties.
|
|
492
|
+
*
|
|
493
|
+
* @remarks
|
|
494
|
+
* - No effect if the class is already registered.
|
|
495
|
+
* - Also registers the class's properties with canonical paths.
|
|
496
|
+
*
|
|
497
|
+
* @param cls - Serializable class metadata to register.
|
|
467
498
|
*/ registerClass(cls) {
|
|
468
499
|
if (!this._classMap.has(cls.ctor)) {
|
|
469
500
|
this._classMap.set(cls.ctor, cls);
|
|
470
501
|
this.registerProps(cls);
|
|
471
502
|
}
|
|
472
503
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Get the known asset ID previously associated with a loaded/allocated asset.
|
|
475
|
-
*
|
|
476
|
-
* @remarks
|
|
477
|
-
* Returns `null` if the asset was not loaded or tracked by this manager.
|
|
478
|
-
*
|
|
479
|
-
* @param asset - Asset instance (e.g., texture, model group) to look up.
|
|
480
|
-
*
|
|
481
|
-
* @returns The asset ID string, or `null` if unknown.
|
|
504
|
+
/**
|
|
505
|
+
* Get the known asset ID previously associated with a loaded/allocated asset.
|
|
506
|
+
*
|
|
507
|
+
* @remarks
|
|
508
|
+
* Returns `null` if the asset was not loaded or tracked by this manager.
|
|
509
|
+
*
|
|
510
|
+
* @param asset - Asset instance (e.g., texture, model group) to look up.
|
|
511
|
+
*
|
|
512
|
+
* @returns The asset ID string, or `null` if unknown.
|
|
482
513
|
*/ getAssetId(asset) {
|
|
483
514
|
return this._allocated.get(asset) ?? null;
|
|
484
515
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Associate an asset ID to a loaded/allocated asset.
|
|
487
|
-
*
|
|
488
|
-
* @param asset - Asset instance (e.g., texture, model group) to set Id.
|
|
489
|
-
* @param id - Asset ID to associated to this asset.
|
|
490
|
-
*
|
|
516
|
+
/**
|
|
517
|
+
* Associate an asset ID to a loaded/allocated asset.
|
|
518
|
+
*
|
|
519
|
+
* @param asset - Asset instance (e.g., texture, model group) to set Id.
|
|
520
|
+
* @param id - Asset ID to associated to this asset.
|
|
521
|
+
*
|
|
491
522
|
*/ setAssetId(asset, id) {
|
|
492
523
|
if (asset) {
|
|
493
524
|
if (id) {
|
|
@@ -497,16 +528,16 @@ const defaultValues = {
|
|
|
497
528
|
}
|
|
498
529
|
}
|
|
499
530
|
}
|
|
500
|
-
/**
|
|
501
|
-
* Fetch a binary asset by ID via the asset manager.
|
|
502
|
-
*
|
|
503
|
-
* @remarks
|
|
504
|
-
* - Associates the returned data with the given ID for future reverse lookup.
|
|
505
|
-
* - The ID is typically a VFS path or locator.
|
|
506
|
-
*
|
|
507
|
-
* @param id - Asset identifier or path.
|
|
508
|
-
*
|
|
509
|
-
* @returns A Promise that resolves to the binary content, or `null` if not found.
|
|
531
|
+
/**
|
|
532
|
+
* Fetch a binary asset by ID via the asset manager.
|
|
533
|
+
*
|
|
534
|
+
* @remarks
|
|
535
|
+
* - Associates the returned data with the given ID for future reverse lookup.
|
|
536
|
+
* - The ID is typically a VFS path or locator.
|
|
537
|
+
*
|
|
538
|
+
* @param id - Asset identifier or path.
|
|
539
|
+
*
|
|
540
|
+
* @returns A Promise that resolves to the binary content, or `null` if not found.
|
|
510
541
|
*/ async fetchBinary(id) {
|
|
511
542
|
const data = await this._assetManager.fetchBinaryData(id);
|
|
512
543
|
if (data) {
|
|
@@ -514,18 +545,18 @@ const defaultValues = {
|
|
|
514
545
|
}
|
|
515
546
|
return data;
|
|
516
547
|
}
|
|
517
|
-
/**
|
|
518
|
-
* Serialize an object to a JSON structure using registered class metadata.
|
|
519
|
-
*
|
|
520
|
-
* @remarks
|
|
521
|
-
* - Throws if the object's class is not registered.
|
|
522
|
-
* - Populates `asyncTasks` with pending I/O tasks for embedded resources.
|
|
523
|
-
*
|
|
524
|
-
* @param obj - The object to serialize.
|
|
525
|
-
* @param json - Optional existing JSON object to fill.
|
|
526
|
-
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
527
|
-
*
|
|
528
|
-
* @returns The serialized JSON structure.
|
|
548
|
+
/**
|
|
549
|
+
* Serialize an object to a JSON structure using registered class metadata.
|
|
550
|
+
*
|
|
551
|
+
* @remarks
|
|
552
|
+
* - Throws if the object's class is not registered.
|
|
553
|
+
* - Populates `asyncTasks` with pending I/O tasks for embedded resources.
|
|
554
|
+
*
|
|
555
|
+
* @param obj - The object to serialize.
|
|
556
|
+
* @param json - Optional existing JSON object to fill.
|
|
557
|
+
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
558
|
+
*
|
|
559
|
+
* @returns The serialized JSON structure.
|
|
529
560
|
*/ async serializeObject(obj, json, asyncTasks) {
|
|
530
561
|
if (obj === null || obj === undefined) {
|
|
531
562
|
return obj;
|
|
@@ -551,14 +582,14 @@ const defaultValues = {
|
|
|
551
582
|
}
|
|
552
583
|
return json;
|
|
553
584
|
}
|
|
554
|
-
/**
|
|
555
|
-
* Serialize object properties into a JSON structure.
|
|
556
|
-
*
|
|
557
|
-
* @param obj - The target object to serialize.
|
|
558
|
-
* @param json - The JSON structure to populate.
|
|
559
|
-
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
560
|
-
* @param info - Optional serialization metadata for the object's class.
|
|
561
|
-
* @returns A Promise that resolves when serialization is complete.
|
|
585
|
+
/**
|
|
586
|
+
* Serialize object properties into a JSON structure.
|
|
587
|
+
*
|
|
588
|
+
* @param obj - The target object to serialize.
|
|
589
|
+
* @param json - The JSON structure to populate.
|
|
590
|
+
* @param asyncTasks - Optional list to collect async tasks for embedded asset export.
|
|
591
|
+
* @param info - Optional serialization metadata for the object's class.
|
|
592
|
+
* @returns A Promise that resolves when serialization is complete.
|
|
562
593
|
*/ async serializeObjectProps(obj, json, asyncTasks, info) {
|
|
563
594
|
if (!info) {
|
|
564
595
|
const cls = this.getClasses();
|
|
@@ -575,17 +606,17 @@ const defaultValues = {
|
|
|
575
606
|
}
|
|
576
607
|
return json;
|
|
577
608
|
}
|
|
578
|
-
/**
|
|
579
|
-
* Deserialize a JSON structure into an object instance.
|
|
580
|
-
*
|
|
581
|
-
* @remarks
|
|
582
|
-
* - Uses the `ClassName` field to locate the registered class.
|
|
583
|
-
* - Supports custom `createFunc` and phased property loading.
|
|
584
|
-
*
|
|
585
|
-
* @param ctx - Context object passed to custom constructors/resolvers.
|
|
586
|
-
* @param json - The serialized JSON structure.
|
|
587
|
-
*
|
|
588
|
-
* @returns A Promise resolving to the reconstructed object instance, or `null` on failure.
|
|
609
|
+
/**
|
|
610
|
+
* Deserialize a JSON structure into an object instance.
|
|
611
|
+
*
|
|
612
|
+
* @remarks
|
|
613
|
+
* - Uses the `ClassName` field to locate the registered class.
|
|
614
|
+
* - Supports custom `createFunc` and phased property loading.
|
|
615
|
+
*
|
|
616
|
+
* @param ctx - Context object passed to custom constructors/resolvers.
|
|
617
|
+
* @param json - The serialized JSON structure.
|
|
618
|
+
*
|
|
619
|
+
* @returns A Promise resolving to the reconstructed object instance, or `null` on failure.
|
|
589
620
|
*/ async deserializeObject(ctx, json) {
|
|
590
621
|
const cls = this.getClasses();
|
|
591
622
|
const className = json['ClassName'];
|
|
@@ -618,12 +649,12 @@ const defaultValues = {
|
|
|
618
649
|
}
|
|
619
650
|
return obj;
|
|
620
651
|
}
|
|
621
|
-
/**
|
|
622
|
-
* Deserialize object properties from JSON into an existing object instance.
|
|
623
|
-
*
|
|
624
|
-
* @param obj - The target object to populate.
|
|
625
|
-
* @param json - The JSON structure containing serialized properties.
|
|
626
|
-
* @param info - Optional serialization metadata for the object's class.
|
|
652
|
+
/**
|
|
653
|
+
* Deserialize object properties from JSON into an existing object instance.
|
|
654
|
+
*
|
|
655
|
+
* @param obj - The target object to populate.
|
|
656
|
+
* @param json - The JSON structure containing serialized properties.
|
|
657
|
+
* @param info - Optional serialization metadata for the object's class.
|
|
627
658
|
*/ async deserializeObjectProps(obj, json, info) {
|
|
628
659
|
if (!info) {
|
|
629
660
|
const cls = this.getClasses();
|
|
@@ -638,14 +669,14 @@ const defaultValues = {
|
|
|
638
669
|
info = this.getClassByConstructor(info.parent);
|
|
639
670
|
}
|
|
640
671
|
}
|
|
641
|
-
/**
|
|
642
|
-
* Load a model by ID and track the allocation for reverse lookup.
|
|
643
|
-
*
|
|
644
|
-
* @param id - Model identifier or path.
|
|
645
|
-
* @param scene - Scene into which the model is loaded.
|
|
646
|
-
* @param options - Optional model fetch options.
|
|
647
|
-
*
|
|
648
|
-
* @returns A Promise resolving to the loaded model object, or `null` if failed.
|
|
672
|
+
/**
|
|
673
|
+
* Load a model by ID and track the allocation for reverse lookup.
|
|
674
|
+
*
|
|
675
|
+
* @param id - Model identifier or path.
|
|
676
|
+
* @param scene - Scene into which the model is loaded.
|
|
677
|
+
* @param options - Optional model fetch options.
|
|
678
|
+
*
|
|
679
|
+
* @returns A Promise resolving to the loaded model object, or `null` if failed.
|
|
649
680
|
*/ async fetchModel(id, scene, options) {
|
|
650
681
|
const model = await this._assetManager.fetchModel(scene, id, options);
|
|
651
682
|
if (model) {
|
|
@@ -653,29 +684,29 @@ const defaultValues = {
|
|
|
653
684
|
}
|
|
654
685
|
return model;
|
|
655
686
|
}
|
|
656
|
-
/**
|
|
657
|
-
* Load a texture directly from an ArrayBuffer or typed array.
|
|
658
|
-
*
|
|
659
|
-
* - Chooses an appropriate loader based on the provided MIME type.
|
|
660
|
-
* - Can upload into an existing texture if `texture` is specified.
|
|
661
|
-
*
|
|
662
|
-
* @typeParam T - Expected concrete texture type.
|
|
663
|
-
* @param arrayBuffer - Raw texture data buffer.
|
|
664
|
-
* @param mimeType - MIME type of the texture (must be supported by a registered loader).
|
|
665
|
-
* @param srgb - If true, treat image as sRGB; otherwise linear.
|
|
666
|
-
* @param samplerOptions - Optional sampler options passed to the loader path.
|
|
667
|
-
* @param texture - Optional destination texture to populate.
|
|
668
|
-
* @returns A promise that resolves to the created or populated texture.
|
|
687
|
+
/**
|
|
688
|
+
* Load a texture directly from an ArrayBuffer or typed array.
|
|
689
|
+
*
|
|
690
|
+
* - Chooses an appropriate loader based on the provided MIME type.
|
|
691
|
+
* - Can upload into an existing texture if `texture` is specified.
|
|
692
|
+
*
|
|
693
|
+
* @typeParam T - Expected concrete texture type.
|
|
694
|
+
* @param arrayBuffer - Raw texture data buffer.
|
|
695
|
+
* @param mimeType - MIME type of the texture (must be supported by a registered loader).
|
|
696
|
+
* @param srgb - If true, treat image as sRGB; otherwise linear.
|
|
697
|
+
* @param samplerOptions - Optional sampler options passed to the loader path.
|
|
698
|
+
* @param texture - Optional destination texture to populate.
|
|
699
|
+
* @returns A promise that resolves to the created or populated texture.
|
|
669
700
|
*/ async loadTextureFromBuffer(arrayBuffer, mimeType, srgb, samplerOptions, texture) {
|
|
670
701
|
return this._assetManager.loadTextureFromBuffer(arrayBuffer, mimeType, srgb, samplerOptions, texture);
|
|
671
702
|
}
|
|
672
|
-
/**
|
|
673
|
-
* Load a texture by ID and track the allocation for reverse lookup.
|
|
674
|
-
*
|
|
675
|
-
* @param id - Texture identifier or path.
|
|
676
|
-
* @param options - Optional texture fetch options.
|
|
677
|
-
*
|
|
678
|
-
* @returns A Promise resolving to the loaded texture, or `null` if failed.
|
|
703
|
+
/**
|
|
704
|
+
* Load a texture by ID and track the allocation for reverse lookup.
|
|
705
|
+
*
|
|
706
|
+
* @param id - Texture identifier or path.
|
|
707
|
+
* @param options - Optional texture fetch options.
|
|
708
|
+
*
|
|
709
|
+
* @returns A Promise resolving to the loaded texture, or `null` if failed.
|
|
679
710
|
*/ async fetchTexture(id, options) {
|
|
680
711
|
const texture = await this._assetManager.fetchTexture(id, options);
|
|
681
712
|
if (texture) {
|
|
@@ -683,12 +714,12 @@ const defaultValues = {
|
|
|
683
714
|
}
|
|
684
715
|
return texture;
|
|
685
716
|
}
|
|
686
|
-
/**
|
|
687
|
-
* Load a material by ID and track the allocation for reverse lookup.
|
|
688
|
-
*
|
|
689
|
-
* @param id - Material identifier or path.
|
|
690
|
-
*
|
|
691
|
-
* @returns A Promise resolving to the loaded material, or `null` if failed.
|
|
717
|
+
/**
|
|
718
|
+
* Load a material by ID and track the allocation for reverse lookup.
|
|
719
|
+
*
|
|
720
|
+
* @param id - Material identifier or path.
|
|
721
|
+
*
|
|
722
|
+
* @returns A Promise resolving to the loaded material, or `null` if failed.
|
|
692
723
|
*/ async fetchMaterial(id) {
|
|
693
724
|
const material = await this._assetManager.fetchMaterial(id);
|
|
694
725
|
if (material) {
|
|
@@ -696,26 +727,26 @@ const defaultValues = {
|
|
|
696
727
|
}
|
|
697
728
|
return material;
|
|
698
729
|
}
|
|
699
|
-
/**
|
|
700
|
-
* Reload specific blue print materials
|
|
701
|
-
*
|
|
702
|
-
* @param filter - Determine whether a blue print material should reload.
|
|
703
|
-
*
|
|
730
|
+
/**
|
|
731
|
+
* Reload specific blue print materials
|
|
732
|
+
*
|
|
733
|
+
* @param filter - Determine whether a blue print material should reload.
|
|
734
|
+
*
|
|
704
735
|
*/ async reloadBluePrintMaterials(filter) {
|
|
705
736
|
await this._assetManager.reloadBluePrintMaterials(filter);
|
|
706
737
|
}
|
|
707
|
-
/**
|
|
708
|
-
* Mark specific blue print as changed
|
|
709
|
-
* @param path - BluePrint file path
|
|
738
|
+
/**
|
|
739
|
+
* Mark specific blue print as changed
|
|
740
|
+
* @param path - BluePrint file path
|
|
710
741
|
*/ invalidateBluePrint(path) {
|
|
711
742
|
this._assetManager.invalidateBluePrint(path);
|
|
712
743
|
}
|
|
713
|
-
/**
|
|
714
|
-
* Load a primitive by ID and track the allocation for reverse lookup.
|
|
715
|
-
*
|
|
716
|
-
* @param id - Primitive identifier or path.
|
|
717
|
-
*
|
|
718
|
-
* @returns A Promise resolving to the loaded primitive, or `null` if failed.
|
|
744
|
+
/**
|
|
745
|
+
* Load a primitive by ID and track the allocation for reverse lookup.
|
|
746
|
+
*
|
|
747
|
+
* @param id - Primitive identifier or path.
|
|
748
|
+
*
|
|
749
|
+
* @returns A Promise resolving to the loaded primitive, or `null` if failed.
|
|
719
750
|
*/ async fetchPrimitive(id) {
|
|
720
751
|
const primitive = await this._assetManager.fetchPrimitive(id);
|
|
721
752
|
if (primitive) {
|
|
@@ -723,10 +754,10 @@ const defaultValues = {
|
|
|
723
754
|
}
|
|
724
755
|
return primitive;
|
|
725
756
|
}
|
|
726
|
-
/**
|
|
727
|
-
* Load a prefab content.
|
|
728
|
-
* @param path - Path to the prefab JSON file in VFS.
|
|
729
|
-
* @returns A Promise resolving to the prefab json object, or `null` on failure.
|
|
757
|
+
/**
|
|
758
|
+
* Load a prefab content.
|
|
759
|
+
* @param path - Path to the prefab JSON file in VFS.
|
|
760
|
+
* @returns A Promise resolving to the prefab json object, or `null` on failure.
|
|
730
761
|
*/ async loadPrefabContent(path) {
|
|
731
762
|
try {
|
|
732
763
|
const content = await this._vfs.readFile(path, {
|
|
@@ -739,11 +770,11 @@ const defaultValues = {
|
|
|
739
770
|
return null;
|
|
740
771
|
}
|
|
741
772
|
}
|
|
742
|
-
/**
|
|
743
|
-
* Instantiate a prefab from a JSON file via VFS.
|
|
744
|
-
* @param parent - Parent node to attach the instantiated prefab to.
|
|
745
|
-
* @param path - Path to the prefab JSON file in VFS.
|
|
746
|
-
* @returns A Promise resolving to the instantiated `SceneNode`, or `null` on failure.
|
|
773
|
+
/**
|
|
774
|
+
* Instantiate a prefab from a JSON file via VFS.
|
|
775
|
+
* @param parent - Parent node to attach the instantiated prefab to.
|
|
776
|
+
* @param path - Path to the prefab JSON file in VFS.
|
|
777
|
+
* @returns A Promise resolving to the instantiated `SceneNode`, or `null` on failure.
|
|
747
778
|
*/ async instantiatePrefab(parent, path) {
|
|
748
779
|
try {
|
|
749
780
|
const json = await this.loadPrefabContent(path);
|
|
@@ -762,16 +793,16 @@ const defaultValues = {
|
|
|
762
793
|
return null;
|
|
763
794
|
}
|
|
764
795
|
}
|
|
765
|
-
/**
|
|
766
|
-
* Load a scene from a JSON file via VFS.
|
|
767
|
-
*
|
|
768
|
-
* @remarks
|
|
769
|
-
* - Deserializes the scene graph.
|
|
770
|
-
* - Attaches scripts referenced by nodes after load (asynchronous).
|
|
771
|
-
*
|
|
772
|
-
* @param filename - Path to the scene JSON file in VFS.
|
|
773
|
-
*
|
|
774
|
-
* @returns A Promise resolving to the loaded `Scene`.
|
|
796
|
+
/**
|
|
797
|
+
* Load a scene from a JSON file via VFS.
|
|
798
|
+
*
|
|
799
|
+
* @remarks
|
|
800
|
+
* - Deserializes the scene graph.
|
|
801
|
+
* - Attaches scripts referenced by nodes after load (asynchronous).
|
|
802
|
+
*
|
|
803
|
+
* @param filename - Path to the scene JSON file in VFS.
|
|
804
|
+
*
|
|
805
|
+
* @returns A Promise resolving to the loaded `Scene`.
|
|
775
806
|
*/ async loadScene(filename) {
|
|
776
807
|
const content = await this._vfs.readFile(filename, {
|
|
777
808
|
encoding: 'utf8'
|
|
@@ -779,15 +810,15 @@ const defaultValues = {
|
|
|
779
810
|
const json = JSON.parse(content);
|
|
780
811
|
return await this.deserializeObject(null, json);
|
|
781
812
|
}
|
|
782
|
-
/**
|
|
783
|
-
* Save a scene to a JSON file via VFS.
|
|
784
|
-
*
|
|
785
|
-
* @remarks
|
|
786
|
-
* - Collects async export tasks for embedded resources and awaits them.
|
|
787
|
-
* - Writes a UTF-8 JSON representation to VFS.
|
|
788
|
-
*
|
|
789
|
-
* @param scene - Scene to serialize and save.
|
|
790
|
-
* @param filename - Destination path in VFS.
|
|
813
|
+
/**
|
|
814
|
+
* Save a scene to a JSON file via VFS.
|
|
815
|
+
*
|
|
816
|
+
* @remarks
|
|
817
|
+
* - Collects async export tasks for embedded resources and awaits them.
|
|
818
|
+
* - Writes a UTF-8 JSON representation to VFS.
|
|
819
|
+
*
|
|
820
|
+
* @param scene - Scene to serialize and save.
|
|
821
|
+
* @param filename - Destination path in VFS.
|
|
791
822
|
*/ async saveScene(scene, filename) {
|
|
792
823
|
const asyncTasks = [];
|
|
793
824
|
const content = await this.serializeObject(scene, null, asyncTasks);
|
|
@@ -837,7 +868,7 @@ const defaultValues = {
|
|
|
837
868
|
const u = q.shift();
|
|
838
869
|
const ins = gs.incoming[u] || [];
|
|
839
870
|
for (const conn of ins){
|
|
840
|
-
const v = conn.targetNodeId; //
|
|
871
|
+
const v = conn.targetNodeId; // predecessor
|
|
841
872
|
if (!reachable.has(v)) {
|
|
842
873
|
reachable.add(v);
|
|
843
874
|
q.push(v);
|
|
@@ -877,7 +908,7 @@ const defaultValues = {
|
|
|
877
908
|
for (const u of currentLevel){
|
|
878
909
|
const ins = gs.incoming[u] || [];
|
|
879
910
|
for (const conn of ins){
|
|
880
|
-
const v = conn.targetNodeId; //
|
|
911
|
+
const v = conn.targetNodeId; // predecessor
|
|
881
912
|
if (!sub.has(v)) {
|
|
882
913
|
continue;
|
|
883
914
|
}
|
|
@@ -919,11 +950,11 @@ const defaultValues = {
|
|
|
919
950
|
async loadBluePrint(path) {
|
|
920
951
|
return this._assetManager.loadBluePrint(path);
|
|
921
952
|
}
|
|
922
|
-
/**
|
|
923
|
-
* Clear cached allocations and asset-manager caches.
|
|
924
|
-
*
|
|
925
|
-
* @remarks
|
|
926
|
-
* Useful when reloading content or changing VFS mounts.
|
|
953
|
+
/**
|
|
954
|
+
* Clear cached allocations and asset-manager caches.
|
|
955
|
+
*
|
|
956
|
+
* @remarks
|
|
957
|
+
* Useful when reloading content or changing VFS mounts.
|
|
927
958
|
*/ clearCache() {
|
|
928
959
|
this._allocated = new WeakMap();
|
|
929
960
|
this._assetManager.clearCache();
|
|
@@ -942,18 +973,18 @@ const defaultValues = {
|
|
|
942
973
|
}
|
|
943
974
|
return null;
|
|
944
975
|
}
|
|
945
|
-
/**
|
|
946
|
-
* Find the object targeted by an animation track starting from a node.
|
|
947
|
-
*
|
|
948
|
-
* @remarks
|
|
949
|
-
* - Parses a target path like `prop/subprop[0]/child` where indexed entries
|
|
950
|
-
* require `object_array` type and non-indexed entries require `object` type.
|
|
951
|
-
* - Returns `null` if any segment cannot be resolved through registered metadata.
|
|
952
|
-
*
|
|
953
|
-
* @param node - Root node used as the starting point.
|
|
954
|
-
* @param track - Property track containing a target path.
|
|
955
|
-
*
|
|
956
|
-
* @returns The resolved target object, or `null` if not found.
|
|
976
|
+
/**
|
|
977
|
+
* Find the object targeted by an animation track starting from a node.
|
|
978
|
+
*
|
|
979
|
+
* @remarks
|
|
980
|
+
* - Parses a target path like `prop/subprop[0]/child` where indexed entries
|
|
981
|
+
* require `object_array` type and non-indexed entries require `object` type.
|
|
982
|
+
* - Returns `null` if any segment cannot be resolved through registered metadata.
|
|
983
|
+
*
|
|
984
|
+
* @param node - Root node used as the starting point.
|
|
985
|
+
* @param track - Property track containing a target path.
|
|
986
|
+
*
|
|
987
|
+
* @returns The resolved target object, or `null` if not found.
|
|
957
988
|
*/ findAnimationTarget(node, track) {
|
|
958
989
|
const target = track.target ?? '';
|
|
959
990
|
const value = {
|