@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
package/dist/scene/scene_node.js
CHANGED
|
@@ -3,33 +3,33 @@ import { AnimationSet } from '../animation/animationset.js';
|
|
|
3
3
|
import { getEngine } from '../app/api.js';
|
|
4
4
|
import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttachments } from './script_attachment.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The base class of all scene graph objects.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Responsibilities:
|
|
11
|
-
* - Defines hierarchical transform (position, rotation, scale) with lazily computed matrices.
|
|
12
|
-
* - Integrates with the scene graph (parent/children, attachment notifications).
|
|
13
|
-
* - Provides traversal utilities (`iterate`, `iterateBottomToTop`, `traverse`).
|
|
14
|
-
* - Manages visibility state and CPU/GPU picking flags.
|
|
15
|
-
* - Computes and caches local/world bounding volumes, notifies scene for spatial updates.
|
|
16
|
-
* - Supports cloning and shared model instancing.
|
|
17
|
-
* - Emits events on visibility, transform, bounding volume, attachment, and disposal.
|
|
18
|
-
*
|
|
19
|
-
* Performance:
|
|
20
|
-
* - `localMatrix`, `worldMatrix`, and `invWorldMatrix` are cached until invalidated.
|
|
21
|
-
* - Transform mutations and `invalidateBoundingVolume` update caches and spatial structures.
|
|
22
|
-
*
|
|
23
|
-
* Events:
|
|
24
|
-
* - `nodeattached`, `noderemoved`, `visiblechanged`, `transformchanged`, `bvchanged`, `dispose`.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
6
|
+
/**
|
|
7
|
+
* The base class of all scene graph objects.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Responsibilities:
|
|
11
|
+
* - Defines hierarchical transform (position, rotation, scale) with lazily computed matrices.
|
|
12
|
+
* - Integrates with the scene graph (parent/children, attachment notifications).
|
|
13
|
+
* - Provides traversal utilities (`iterate`, `iterateBottomToTop`, `traverse`).
|
|
14
|
+
* - Manages visibility state and CPU/GPU picking flags.
|
|
15
|
+
* - Computes and caches local/world bounding volumes, notifies scene for spatial updates.
|
|
16
|
+
* - Supports cloning and shared model instancing.
|
|
17
|
+
* - Emits events on visibility, transform, bounding volume, attachment, and disposal.
|
|
18
|
+
*
|
|
19
|
+
* Performance:
|
|
20
|
+
* - `localMatrix`, `worldMatrix`, and `invWorldMatrix` are cached until invalidated.
|
|
21
|
+
* - Transform mutations and `invalidateBoundingVolume` update caches and spatial structures.
|
|
22
|
+
*
|
|
23
|
+
* Events:
|
|
24
|
+
* - `nodeattached`, `noderemoved`, `visiblechanged`, `transformchanged`, `bvchanged`, `dispose`.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
27
|
*/ class SceneNode extends makeObservable(Disposable)() {
|
|
28
28
|
static _runTimeId = 1;
|
|
29
|
-
/*
|
|
30
|
-
static readonly PICK_INHERITED = -1;
|
|
31
|
-
static readonly PICK_DISABLED = 0;
|
|
32
|
-
static readonly PICK_ENABLED = 1;
|
|
29
|
+
/*
|
|
30
|
+
static readonly PICK_INHERITED = -1;
|
|
31
|
+
static readonly PICK_DISABLED = 0;
|
|
32
|
+
static readonly PICK_ENABLED = 1;
|
|
33
33
|
*/ /** Bounding-box draw mode inherited from nearest graph ancestor. */ static BBOXDRAW_INHERITED = -1;
|
|
34
34
|
/** Disable bounding-box visualization. */ static BBOXDRAW_DISABLED = 0;
|
|
35
35
|
/** Draw local-space bounding box. */ static BBOXDRAW_LOCAL = 1;
|
|
@@ -70,14 +70,14 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
70
70
|
/** @internal Arbitrary metadata payload for this node. */ _metaData;
|
|
71
71
|
/** @internal If greater than zero, suppress transform-change callbacks (during bulk updates). */ _disableCallback;
|
|
72
72
|
/** @internal User-attached script entries (engine-defined). */ _scripts;
|
|
73
|
-
/**
|
|
74
|
-
* Construct a scene node.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* If a `scene` is provided and this is not the root node, the node is reparented
|
|
78
|
-
* under the scene's root immediately.
|
|
79
|
-
*
|
|
80
|
-
* @param scene - Scene that will own this node.
|
|
73
|
+
/**
|
|
74
|
+
* Construct a scene node.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* If a `scene` is provided and this is not the root node, the node is reparented
|
|
78
|
+
* under the scene's root immediately.
|
|
79
|
+
*
|
|
80
|
+
* @param scene - Scene that will own this node.
|
|
81
81
|
*/ constructor(scene){
|
|
82
82
|
super();
|
|
83
83
|
this._runtimeId = SceneNode._runTimeId++;
|
|
@@ -118,11 +118,11 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
118
118
|
this._parent = null;
|
|
119
119
|
this.reparent(scene?.rootNode ?? null);
|
|
120
120
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Whether the node should be inserted into the scene's spatial structure.
|
|
123
|
-
*
|
|
124
|
-
* @remarks
|
|
125
|
-
* Toggling this hints the scene to (re)place the node in octree/acceleration structures.
|
|
121
|
+
/**
|
|
122
|
+
* Whether the node should be inserted into the scene's spatial structure.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* Toggling this hints the scene to (re)place the node in octree/acceleration structures.
|
|
126
126
|
*/ get placeToOctree() {
|
|
127
127
|
return this._placeToOctree;
|
|
128
128
|
}
|
|
@@ -134,88 +134,88 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Node's runtime unique identifier
|
|
137
|
+
/**
|
|
138
|
+
* Node's runtime unique identifier
|
|
139
139
|
*/ get runtimeId() {
|
|
140
140
|
return this._runtimeId;
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Node's persistent identifier.
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* Changing this affects serialization and registry lookup; ensure uniqueness.
|
|
142
|
+
/**
|
|
143
|
+
* Node's persistent identifier.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Changing this affects serialization and registry lookup; ensure uniqueness.
|
|
147
147
|
*/ get persistentId() {
|
|
148
148
|
return this._id;
|
|
149
149
|
}
|
|
150
150
|
set persistentId(id) {
|
|
151
151
|
this._id = id;
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
154
|
-
* If not empty, this node was loaded from a prefab
|
|
155
|
-
*
|
|
156
|
-
* @remarks
|
|
157
|
-
* Internal used for serialization
|
|
153
|
+
/**
|
|
154
|
+
* If not empty, this node was loaded from a prefab
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* Internal used for serialization
|
|
158
158
|
*/ get prefabId() {
|
|
159
159
|
return this._prefabId;
|
|
160
160
|
}
|
|
161
161
|
set prefabId(id) {
|
|
162
162
|
this._prefabId = id;
|
|
163
163
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Get prefab node this node belongs to, or null if this node does not belongs to any prefab
|
|
166
|
-
* @returns prefab node this node belongs to
|
|
164
|
+
/**
|
|
165
|
+
* Get prefab node this node belongs to, or null if this node does not belongs to any prefab
|
|
166
|
+
* @returns prefab node this node belongs to
|
|
167
167
|
*/ getPrefabNode() {
|
|
168
168
|
return this._prefabId ? this : this.parent?.getPrefabNode() ?? null;
|
|
169
169
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Translation type if this is a joint node of any skeleton
|
|
172
|
-
*
|
|
173
|
-
* @remarks
|
|
174
|
-
* Internal used for serialization
|
|
170
|
+
/**
|
|
171
|
+
* Translation type if this is a joint node of any skeleton
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* Internal used for serialization
|
|
175
175
|
*/ get jointTypeT() {
|
|
176
176
|
return this._jointTypeT;
|
|
177
177
|
}
|
|
178
178
|
set jointTypeT(val) {
|
|
179
179
|
this._jointTypeT = val;
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Scale type if this is a joint node of any skeleton
|
|
183
|
-
*
|
|
184
|
-
* @remarks
|
|
185
|
-
* Internal used for serialization
|
|
181
|
+
/**
|
|
182
|
+
* Scale type if this is a joint node of any skeleton
|
|
183
|
+
*
|
|
184
|
+
* @remarks
|
|
185
|
+
* Internal used for serialization
|
|
186
186
|
*/ get jointTypeS() {
|
|
187
187
|
return this._jointTypeS;
|
|
188
188
|
}
|
|
189
189
|
set jointTypeS(val) {
|
|
190
190
|
this._jointTypeS = val;
|
|
191
191
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Rotation type if this is a joint node of any skeleton
|
|
194
|
-
*
|
|
195
|
-
* @remarks
|
|
196
|
-
* Internal used for serialization
|
|
192
|
+
/**
|
|
193
|
+
* Rotation type if this is a joint node of any skeleton
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* Internal used for serialization
|
|
197
197
|
*/ get jointTypeR() {
|
|
198
198
|
return this._jointTypeR;
|
|
199
199
|
}
|
|
200
200
|
set jointTypeR(val) {
|
|
201
201
|
this._jointTypeR = val;
|
|
202
202
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Arbitrary metadata associated with this node.
|
|
205
|
-
*
|
|
206
|
-
* @remarks
|
|
207
|
-
* Stored and transported with the node; format is application-defined.
|
|
203
|
+
/**
|
|
204
|
+
* Arbitrary metadata associated with this node.
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* Stored and transported with the node; format is application-defined.
|
|
208
208
|
*/ get metaData() {
|
|
209
209
|
return this._metaData;
|
|
210
210
|
}
|
|
211
211
|
set metaData(val) {
|
|
212
212
|
this._metaData = val;
|
|
213
213
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Attached script filename or identifier (engine-specific).
|
|
216
|
-
*
|
|
217
|
-
* @remarks
|
|
218
|
-
* Integrates with the engine’s scripting system if available.
|
|
214
|
+
/**
|
|
215
|
+
* Attached script filename or identifier (engine-specific).
|
|
216
|
+
*
|
|
217
|
+
* @remarks
|
|
218
|
+
* Integrates with the engine’s scripting system if available.
|
|
219
219
|
*/ get script() {
|
|
220
220
|
return this._scripts[0]?.script ?? '';
|
|
221
221
|
}
|
|
@@ -229,8 +229,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
229
229
|
this._scripts.unshift(new ScriptAttachment(script));
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Script component configuration payload used by editor/runtime script components.
|
|
232
|
+
/**
|
|
233
|
+
* Script component configuration payload used by editor/runtime script components.
|
|
234
234
|
*/ get scriptConfig() {
|
|
235
235
|
return this._scripts[0]?.config ?? null;
|
|
236
236
|
}
|
|
@@ -245,16 +245,16 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
245
245
|
this._scripts.splice(0, 1);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
/**
|
|
249
|
-
* All script attachments on this node.
|
|
248
|
+
/**
|
|
249
|
+
* All script attachments on this node.
|
|
250
250
|
*/ get scripts() {
|
|
251
251
|
return this._scripts;
|
|
252
252
|
}
|
|
253
253
|
set scripts(value) {
|
|
254
254
|
this._scripts = normalizeScriptAttachments(value);
|
|
255
255
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Script configs for all script attachments.
|
|
256
|
+
/**
|
|
257
|
+
* Script configs for all script attachments.
|
|
258
258
|
*/ get scriptConfigs() {
|
|
259
259
|
return this._scripts.map((item)=>item.config);
|
|
260
260
|
}
|
|
@@ -270,8 +270,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
270
270
|
}
|
|
271
271
|
this._scripts = this._scripts.filter((item)=>item.script || item.config != null);
|
|
272
272
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Display name of the node (for UI/debugging).
|
|
273
|
+
/**
|
|
274
|
+
* Display name of the node (for UI/debugging).
|
|
275
275
|
*/ get name() {
|
|
276
276
|
return this._name;
|
|
277
277
|
}
|
|
@@ -281,8 +281,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
281
281
|
/** The owning scene. */ get scene() {
|
|
282
282
|
return this._scene;
|
|
283
283
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Whether this node is currently attached under the scene's root.
|
|
284
|
+
/**
|
|
285
|
+
* Whether this node is currently attached under the scene's root.
|
|
286
286
|
*/ get attached() {
|
|
287
287
|
if (!this._scene) {
|
|
288
288
|
return false;
|
|
@@ -293,20 +293,20 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
293
293
|
}
|
|
294
294
|
return node === this._scene.rootNode;
|
|
295
295
|
}
|
|
296
|
-
/**
|
|
297
|
-
* If true, the node is logically sealed; some operations (like cloning as child)
|
|
298
|
-
* may be restricted by engine policies.
|
|
296
|
+
/**
|
|
297
|
+
* If true, the node is logically sealed; some operations (like cloning as child)
|
|
298
|
+
* may be restricted by engine policies.
|
|
299
299
|
*/ get sealed() {
|
|
300
300
|
return this._sealed;
|
|
301
301
|
}
|
|
302
302
|
set sealed(val) {
|
|
303
303
|
this._sealed = val;
|
|
304
304
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Lazily created animation set for this node.
|
|
307
|
-
*
|
|
308
|
-
* @remarks
|
|
309
|
-
* Accessing this schedules the node for update in the scene.
|
|
305
|
+
/**
|
|
306
|
+
* Lazily created animation set for this node.
|
|
307
|
+
*
|
|
308
|
+
* @remarks
|
|
309
|
+
* Accessing this schedules the node for update in the scene.
|
|
310
310
|
*/ get animationSet() {
|
|
311
311
|
if (!this._animationSet.get()) {
|
|
312
312
|
this._animationSet.set(new AnimationSet(this));
|
|
@@ -314,24 +314,24 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
314
314
|
}
|
|
315
315
|
return this._animationSet.get();
|
|
316
316
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Shared model reference for instancing/streaming systems.
|
|
317
|
+
/**
|
|
318
|
+
* Shared model reference for instancing/streaming systems.
|
|
319
319
|
*/ get sharedModel() {
|
|
320
320
|
return this._sharedModel.get();
|
|
321
321
|
}
|
|
322
322
|
set sharedModel(model) {
|
|
323
323
|
this._sharedModel.set(model);
|
|
324
324
|
}
|
|
325
|
-
/**
|
|
326
|
-
* Clone this node.
|
|
327
|
-
*
|
|
328
|
-
* @remarks
|
|
329
|
-
* If a shared model exists, it may create an instanced node. The clone is
|
|
330
|
-
* attached under the same parent; children are cloned based on `method` and `recursive`.
|
|
331
|
-
*
|
|
332
|
-
* @param method - Clone method ('deep' or 'instance').
|
|
333
|
-
* @param recursive - Whether children are cloned recursively.
|
|
334
|
-
* @returns New node instance
|
|
325
|
+
/**
|
|
326
|
+
* Clone this node.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
* If a shared model exists, it may create an instanced node. The clone is
|
|
330
|
+
* attached under the same parent; children are cloned based on `method` and `recursive`.
|
|
331
|
+
*
|
|
332
|
+
* @param method - Clone method ('deep' or 'instance').
|
|
333
|
+
* @param recursive - Whether children are cloned recursively.
|
|
334
|
+
* @returns New node instance
|
|
335
335
|
*/ async clone() {
|
|
336
336
|
this.iterate((node)=>{
|
|
337
337
|
if (node.isClipmapTerrain()) {
|
|
@@ -357,53 +357,53 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
357
357
|
}
|
|
358
358
|
return other;
|
|
359
359
|
}
|
|
360
|
-
/**
|
|
361
|
-
* Whether the given node is a direct child of this node.
|
|
362
|
-
* @param child - The node to be checked
|
|
363
|
-
* @returns true if the given node is a direct child of this node, false otherwise
|
|
360
|
+
/**
|
|
361
|
+
* Whether the given node is a direct child of this node.
|
|
362
|
+
* @param child - The node to be checked
|
|
363
|
+
* @returns true if the given node is a direct child of this node, false otherwise
|
|
364
364
|
*/ hasChild(child) {
|
|
365
365
|
return child && child.parent === this;
|
|
366
366
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Remove all children from this node.
|
|
367
|
+
/**
|
|
368
|
+
* Remove all children from this node.
|
|
369
369
|
*/ removeChildren() {
|
|
370
370
|
while(this._children.length){
|
|
371
371
|
this._children[0].get().remove();
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Whether this node is an ancestor (direct or indirect) of the given node.
|
|
374
|
+
/**
|
|
375
|
+
* Whether this node is an ancestor (direct or indirect) of the given node.
|
|
376
376
|
*/ isParentOf(child) {
|
|
377
377
|
while(child && child !== this){
|
|
378
378
|
child = child.parent;
|
|
379
379
|
}
|
|
380
380
|
return child === this;
|
|
381
381
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Detach this node from its parent.
|
|
384
|
-
*
|
|
385
|
-
* @returns this
|
|
382
|
+
/**
|
|
383
|
+
* Detach this node from its parent.
|
|
384
|
+
*
|
|
385
|
+
* @returns this
|
|
386
386
|
*/ remove() {
|
|
387
387
|
this.parent = null;
|
|
388
388
|
return this;
|
|
389
389
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Depth-first traversal of this node's subtree (pre-order).
|
|
392
|
-
*
|
|
393
|
-
* @param v - Visitor invoked on each node.
|
|
390
|
+
/**
|
|
391
|
+
* Depth-first traversal of this node's subtree (pre-order).
|
|
392
|
+
*
|
|
393
|
+
* @param v - Visitor invoked on each node.
|
|
394
394
|
*/ traverse(v) {
|
|
395
395
|
v.visit(this);
|
|
396
396
|
for (const child of this._children){
|
|
397
397
|
child.get().traverse(v);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
/**
|
|
401
|
-
* Iterate self and descendants in pre-order.
|
|
402
|
-
*
|
|
403
|
-
* Warning: Do not remove children during this iteration. To allow removal, use `iterateBottomToTop`.
|
|
404
|
-
*
|
|
405
|
-
* @param callback - Called for each node; if returns true, iteration stops.
|
|
406
|
-
* @returns true
|
|
400
|
+
/**
|
|
401
|
+
* Iterate self and descendants in pre-order.
|
|
402
|
+
*
|
|
403
|
+
* Warning: Do not remove children during this iteration. To allow removal, use `iterateBottomToTop`.
|
|
404
|
+
*
|
|
405
|
+
* @param callback - Called for each node; if returns true, iteration stops.
|
|
406
|
+
* @returns If returns true, the iteration will immediately stop.
|
|
407
407
|
*/ iterate(callback) {
|
|
408
408
|
if (callback(this)) {
|
|
409
409
|
return true;
|
|
@@ -415,13 +415,13 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
415
415
|
}
|
|
416
416
|
return false;
|
|
417
417
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Iterate self and descendants in reverse post-order (bottom-to-top).
|
|
420
|
-
*
|
|
421
|
-
* Child nodes can be safely removed during this iteration.
|
|
422
|
-
*
|
|
423
|
-
* @param callback - Called for each node; if returns true, iteration stops.
|
|
424
|
-
* @returns true
|
|
418
|
+
/**
|
|
419
|
+
* Iterate self and descendants in reverse post-order (bottom-to-top).
|
|
420
|
+
*
|
|
421
|
+
* Child nodes can be safely removed during this iteration.
|
|
422
|
+
*
|
|
423
|
+
* @param callback - Called for each node; if returns true, iteration stops.
|
|
424
|
+
* @returns If returns true, the iteration will immediately stop.
|
|
425
425
|
*/ iterateBottomToTop(callback) {
|
|
426
426
|
for(let i = this._children.length - 1; i >= 0; i--){
|
|
427
427
|
const child = this._children[i];
|
|
@@ -464,15 +464,15 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
464
464
|
/** true if this is a punctual light node, false otherwise */ isPunctualLight() {
|
|
465
465
|
return false;
|
|
466
466
|
}
|
|
467
|
-
/**
|
|
468
|
-
* Computes the bounding volume of the node
|
|
469
|
-
* @returns The output bounding volume
|
|
467
|
+
/**
|
|
468
|
+
* Computes the bounding volume of the node
|
|
469
|
+
* @returns The output bounding volume
|
|
470
470
|
*/ computeBoundingVolume() {
|
|
471
471
|
return null;
|
|
472
472
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Gets the bounding volume of the node
|
|
475
|
-
* @returns The bounding volume of the node
|
|
473
|
+
/**
|
|
474
|
+
* Gets the bounding volume of the node
|
|
475
|
+
* @returns The bounding volume of the node
|
|
476
476
|
*/ getBoundingVolume() {
|
|
477
477
|
if (this._bvDirty) {
|
|
478
478
|
this._bv = this.computeBoundingVolume();
|
|
@@ -480,9 +480,9 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
480
480
|
}
|
|
481
481
|
return this._bv;
|
|
482
482
|
}
|
|
483
|
-
/**
|
|
484
|
-
* Sets the bounding volume of the node
|
|
485
|
-
* @param bv - The bounding volume to set
|
|
483
|
+
/**
|
|
484
|
+
* Sets the bounding volume of the node
|
|
485
|
+
* @param bv - The bounding volume to set
|
|
486
486
|
*/ setBoundingVolume(bv) {
|
|
487
487
|
if (bv !== this._bv) {
|
|
488
488
|
this._bv = bv;
|
|
@@ -490,23 +490,23 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
490
490
|
this.invalidateWorldBoundingVolume(false);
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
/**
|
|
494
|
-
* Gets the world space bounding volume of the node
|
|
495
|
-
* @returns The world space bounding volume of the node
|
|
493
|
+
/**
|
|
494
|
+
* Gets the world space bounding volume of the node
|
|
495
|
+
* @returns The world space bounding volume of the node
|
|
496
496
|
*/ getWorldBoundingVolume() {
|
|
497
497
|
if (!this._bvWorld) {
|
|
498
498
|
this._bvWorld = this.computeWorldBoundingVolume(this.getBoundingVolume());
|
|
499
499
|
}
|
|
500
500
|
return this._bvWorld;
|
|
501
501
|
}
|
|
502
|
-
/**
|
|
503
|
-
* Computes the world space bounding volume of the node
|
|
504
|
-
* @returns The output bounding volume
|
|
502
|
+
/**
|
|
503
|
+
* Computes the world space bounding volume of the node
|
|
504
|
+
* @returns The output bounding volume
|
|
505
505
|
*/ computeWorldBoundingVolume(localBV) {
|
|
506
506
|
return localBV?.transform(this.worldMatrix) ?? null;
|
|
507
507
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Force the bounding volume to be recalculated
|
|
508
|
+
/**
|
|
509
|
+
* Force the bounding volume to be recalculated
|
|
510
510
|
*/ invalidateBoundingVolume() {
|
|
511
511
|
this._bvDirty = true;
|
|
512
512
|
this.invalidateWorldBoundingVolume(false);
|
|
@@ -571,12 +571,12 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
571
571
|
set gpuPickable(val) {
|
|
572
572
|
this._gpuPickable = !!val;
|
|
573
573
|
}
|
|
574
|
-
/**
|
|
575
|
-
* Finds a scene node by its persistent ID.
|
|
576
|
-
*
|
|
577
|
-
* @typeParam T - Expected node type.
|
|
578
|
-
* @param id - Persistent identifier to match against `SceneNode.persistentId`.
|
|
579
|
-
* @returns The first matching node, or `null` if not found.
|
|
574
|
+
/**
|
|
575
|
+
* Finds a scene node by its persistent ID.
|
|
576
|
+
*
|
|
577
|
+
* @typeParam T - Expected node type.
|
|
578
|
+
* @param id - Persistent identifier to match against `SceneNode.persistentId`.
|
|
579
|
+
* @returns The first matching node, or `null` if not found.
|
|
580
580
|
*/ findNodeById(id) {
|
|
581
581
|
let node = null;
|
|
582
582
|
this.iterate((child)=>{
|
|
@@ -587,10 +587,10 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
587
587
|
});
|
|
588
588
|
return node;
|
|
589
589
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Finds a skeleton object by its persistent ID.
|
|
592
|
-
* @param id - Persistent identifier to match against `Skeleton.persistentId`.
|
|
593
|
-
* @returns The first matchign node, or `null` if not found.
|
|
590
|
+
/**
|
|
591
|
+
* Finds a skeleton object by its persistent ID.
|
|
592
|
+
* @param id - Persistent identifier to match against `Skeleton.persistentId`.
|
|
593
|
+
* @returns The first matchign node, or `null` if not found.
|
|
594
594
|
*/ findSkeletonById(id) {
|
|
595
595
|
const prefabNode = this.getPrefabNode() ?? this;
|
|
596
596
|
let sk = null;
|
|
@@ -601,18 +601,18 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
601
601
|
// avoid ts2339 compilation error (maybe a typescript bug?)
|
|
602
602
|
return sk?.get() ?? null;
|
|
603
603
|
}
|
|
604
|
-
/**
|
|
605
|
-
* Finds a scene node by name.
|
|
606
|
-
*
|
|
607
|
-
* If multiple nodes share the same name, returns the first match encountered
|
|
608
|
-
* during traversal.
|
|
609
|
-
*
|
|
610
|
-
* @typeParam T - Expected node type.
|
|
611
|
-
* @param name - Node name to match.
|
|
612
|
-
* @returns The first matching node, or `null` if not found.
|
|
613
|
-
*
|
|
614
|
-
* @remarks
|
|
615
|
-
* Names are not guaranteed unique. Prefer IDs for stable references.
|
|
604
|
+
/**
|
|
605
|
+
* Finds a scene node by name.
|
|
606
|
+
*
|
|
607
|
+
* If multiple nodes share the same name, returns the first match encountered
|
|
608
|
+
* during traversal.
|
|
609
|
+
*
|
|
610
|
+
* @typeParam T - Expected node type.
|
|
611
|
+
* @param name - Node name to match.
|
|
612
|
+
* @returns The first matching node, or `null` if not found.
|
|
613
|
+
*
|
|
614
|
+
* @remarks
|
|
615
|
+
* Names are not guaranteed unique. Prefer IDs for stable references.
|
|
616
616
|
*/ findNodeByName(name) {
|
|
617
617
|
let node = null;
|
|
618
618
|
this.iterate((child)=>{
|
|
@@ -704,11 +704,11 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
|
-
/**
|
|
708
|
-
* Get called when this node is attached to scene
|
|
707
|
+
/**
|
|
708
|
+
* Get called when this node is attached to scene
|
|
709
709
|
*/ _onAttached() {}
|
|
710
|
-
/**
|
|
711
|
-
* Get called when this node is detached from scene
|
|
710
|
+
/**
|
|
711
|
+
* Get called when this node is detached from scene
|
|
712
712
|
*/ _onDetached() {}
|
|
713
713
|
/** @internal */ _attached() {
|
|
714
714
|
this.iterate((child)=>{
|
|
@@ -741,24 +741,24 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
741
741
|
/** Children of this xform */ get children() {
|
|
742
742
|
return this._children.map((child)=>child.get());
|
|
743
743
|
}
|
|
744
|
-
/**
|
|
745
|
-
* Position of the xform relative to it's parent
|
|
744
|
+
/**
|
|
745
|
+
* Position of the xform relative to it's parent
|
|
746
746
|
*/ get position() {
|
|
747
747
|
return this._position;
|
|
748
748
|
}
|
|
749
749
|
set position(val) {
|
|
750
750
|
this._position.setXYZ(val[0], val[1], val[2]);
|
|
751
751
|
}
|
|
752
|
-
/**
|
|
753
|
-
* Scaling of the xform
|
|
752
|
+
/**
|
|
753
|
+
* Scaling of the xform
|
|
754
754
|
*/ get scale() {
|
|
755
755
|
return this._scaling;
|
|
756
756
|
}
|
|
757
757
|
set scale(val) {
|
|
758
758
|
this._scaling.setXYZ(val[0], val[1], val[2]);
|
|
759
759
|
}
|
|
760
|
-
/**
|
|
761
|
-
* Rotation of the xform
|
|
760
|
+
/**
|
|
761
|
+
* Rotation of the xform
|
|
762
762
|
*/ get rotation() {
|
|
763
763
|
return this._rotation;
|
|
764
764
|
}
|
|
@@ -793,32 +793,32 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
793
793
|
thisToOther(other, v, result) {
|
|
794
794
|
return other.worldToThis(this.thisToWorld(v, result), result);
|
|
795
795
|
}
|
|
796
|
-
/**
|
|
797
|
-
* Gets the position of the xform in world space
|
|
798
|
-
* @returns position of the xform in world space
|
|
796
|
+
/**
|
|
797
|
+
* Gets the position of the xform in world space
|
|
798
|
+
* @returns position of the xform in world space
|
|
799
799
|
*/ getWorldPosition(outPos) {
|
|
800
800
|
return outPos?.setXYZ(this.worldMatrix.m03, this.worldMatrix.m13, this.worldMatrix.m23) ?? new Vector3(this.worldMatrix.m03, this.worldMatrix.m13, this.worldMatrix.m23);
|
|
801
801
|
}
|
|
802
|
-
/**
|
|
803
|
-
* Moves the xform by an offset vector
|
|
804
|
-
* @param delta - The offset vector
|
|
805
|
-
* @returns self
|
|
802
|
+
/**
|
|
803
|
+
* Moves the xform by an offset vector
|
|
804
|
+
* @param delta - The offset vector
|
|
805
|
+
* @returns self
|
|
806
806
|
*/ moveBy(delta) {
|
|
807
807
|
this._position.addBy(delta);
|
|
808
808
|
return this;
|
|
809
809
|
}
|
|
810
|
-
/**
|
|
811
|
-
* Scales the xform by a given scale factor
|
|
812
|
-
* @param factor - The scale factor
|
|
813
|
-
* @returns self
|
|
810
|
+
/**
|
|
811
|
+
* Scales the xform by a given scale factor
|
|
812
|
+
* @param factor - The scale factor
|
|
813
|
+
* @returns self
|
|
814
814
|
*/ scaleBy(factor) {
|
|
815
815
|
this._scaling.mulBy(factor);
|
|
816
816
|
return this;
|
|
817
817
|
}
|
|
818
|
-
/**
|
|
819
|
-
* Sets the local transform matrix of the xform
|
|
820
|
-
* @param matrix - The transform matrix to set
|
|
821
|
-
* @returns self
|
|
818
|
+
/**
|
|
819
|
+
* Sets the local transform matrix of the xform
|
|
820
|
+
* @param matrix - The transform matrix to set
|
|
821
|
+
* @returns self
|
|
822
822
|
*/ setLocalTransform(matrix) {
|
|
823
823
|
this._disableCallback++;
|
|
824
824
|
matrix.decompose(this._scaling, this._rotation, this._position);
|
|
@@ -848,15 +848,15 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
848
848
|
this.syncTransform();
|
|
849
849
|
return this._invWorldMatrix;
|
|
850
850
|
}
|
|
851
|
-
/**
|
|
852
|
-
* Calculate local transform matrix
|
|
853
|
-
* @param outMatrix - Matrix object that holds the result of calculation
|
|
851
|
+
/**
|
|
852
|
+
* Calculate local transform matrix
|
|
853
|
+
* @param outMatrix - Matrix object that holds the result of calculation
|
|
854
854
|
*/ calculateLocalTransform(outMatrix) {
|
|
855
855
|
outMatrix.compose(this._scaling, this._rotation, this._position);
|
|
856
856
|
}
|
|
857
|
-
/**
|
|
858
|
-
* Calculate world transform matrix
|
|
859
|
-
* @param outMatrix - Matrix object that holds the result of calculation
|
|
857
|
+
/**
|
|
858
|
+
* Calculate world transform matrix
|
|
859
|
+
* @param outMatrix - Matrix object that holds the result of calculation
|
|
860
860
|
*/ calculateWorldTransform(outMatrix) {
|
|
861
861
|
if (this._parent) {
|
|
862
862
|
Matrix4x4.multiplyAffine(this._parent.worldMatrix, this.localMatrix, outMatrix);
|
|
@@ -864,21 +864,21 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
864
864
|
outMatrix.set(this.localMatrix);
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
|
-
/**
|
|
868
|
-
* Sets the local tranformation matrix by a look-at matrix
|
|
869
|
-
* @param eye - The eye position used to make the look-at matrix
|
|
870
|
-
* @param target - The target position used to make the look-at matrix
|
|
871
|
-
* @param up - The up vector used to make the look-at matrix
|
|
872
|
-
* @returns self
|
|
867
|
+
/**
|
|
868
|
+
* Sets the local tranformation matrix by a look-at matrix
|
|
869
|
+
* @param eye - The eye position used to make the look-at matrix
|
|
870
|
+
* @param target - The target position used to make the look-at matrix
|
|
871
|
+
* @param up - The up vector used to make the look-at matrix
|
|
872
|
+
* @returns self
|
|
873
873
|
*/ lookAt(eye, target, up) {
|
|
874
874
|
this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
|
|
875
875
|
return this;
|
|
876
876
|
}
|
|
877
|
-
/**
|
|
878
|
-
* Update node state once per-frame
|
|
879
|
-
* @param frameId - Current frame id
|
|
880
|
-
* @param elapsedInSeconds - Elapsed time from game start in seconds
|
|
881
|
-
* @param deltaInSeconds - Elapsed time since previous frame in seconds
|
|
877
|
+
/**
|
|
878
|
+
* Update node state once per-frame
|
|
879
|
+
* @param frameId - Current frame id
|
|
880
|
+
* @param elapsedInSeconds - Elapsed time from game start in seconds
|
|
881
|
+
* @param deltaInSeconds - Elapsed time since previous frame in seconds
|
|
882
882
|
*/ update(frameId, elapsedInSeconds, deltaInSeconds) {
|
|
883
883
|
if (!this.attached) {
|
|
884
884
|
return;
|
|
@@ -893,16 +893,16 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
|
-
/**
|
|
897
|
-
* Update node state once per-camera
|
|
898
|
-
* @param _camera - Updates according to which camera
|
|
899
|
-
* @param _elapsedInSeconds - Elapsed time from game start in seconds
|
|
900
|
-
* @param _deltaInSeconds - Elapsed time since previous frame in seconds
|
|
896
|
+
/**
|
|
897
|
+
* Update node state once per-camera
|
|
898
|
+
* @param _camera - Updates according to which camera
|
|
899
|
+
* @param _elapsedInSeconds - Elapsed time from game start in seconds
|
|
900
|
+
* @param _deltaInSeconds - Elapsed time since previous frame in seconds
|
|
901
901
|
*/ updatePerCamera(_camera, _elapsedInSeconds, _deltaInSeconds) {}
|
|
902
|
-
/**
|
|
903
|
-
* Removes this node from it's parent and add this node to another parent node if required
|
|
904
|
-
* @param p - The new parent node that this node should be added to or null
|
|
905
|
-
* @returns self
|
|
902
|
+
/**
|
|
903
|
+
* Removes this node from it's parent and add this node to another parent node if required
|
|
904
|
+
* @param p - The new parent node that this node should be added to or null
|
|
905
|
+
* @returns self
|
|
906
906
|
*/ reparent(p) {
|
|
907
907
|
this.parent = p ?? null;
|
|
908
908
|
return this;
|