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