@zephyr3d/scene 0.9.4 → 0.9.6
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/animationmask.js +224 -0
- package/dist/animation/animationmask.js.map +1 -0
- package/dist/animation/animationset.js +268 -67
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/animationtrack.js.map +1 -1
- package/dist/animation/eulerrotationtrack.js +3 -0
- package/dist/animation/eulerrotationtrack.js.map +1 -1
- package/dist/animation/fixed_geometry_cache_track.js +7 -0
- package/dist/animation/fixed_geometry_cache_track.js.map +1 -1
- package/dist/animation/ik_modifier.js.map +1 -1
- package/dist/animation/joint_dynamics/collision.js +6 -4
- package/dist/animation/joint_dynamics/collision.js.map +1 -1
- package/dist/animation/joint_dynamics/controller.js +390 -43
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +62 -3
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
- package/dist/animation/joint_dynamics/solver.js +4 -3
- package/dist/animation/joint_dynamics/solver.js.map +1 -1
- package/dist/animation/joint_dynamics/types.js.map +1 -1
- package/dist/animation/joint_dynamics_modifier.js +2 -0
- package/dist/animation/joint_dynamics_modifier.js.map +1 -1
- package/dist/animation/morphtarget.js +3 -72
- package/dist/animation/morphtarget.js.map +1 -1
- package/dist/animation/morphtrack.js +3 -0
- package/dist/animation/morphtrack.js.map +1 -1
- package/dist/animation/pca_geometry_cache_track.js +3 -0
- package/dist/animation/pca_geometry_cache_track.js.map +1 -1
- package/dist/animation/proptrack.js +3 -0
- package/dist/animation/proptrack.js.map +1 -1
- package/dist/animation/rotationtrack.js +3 -0
- package/dist/animation/rotationtrack.js.map +1 -1
- package/dist/animation/scaletrack.js +3 -0
- package/dist/animation/scaletrack.js.map +1 -1
- package/dist/animation/skeleton.js +254 -79
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js.map +1 -1
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/animation/translationtrack.js +3 -0
- package/dist/animation/translationtrack.js.map +1 -1
- package/dist/app/engine.js +171 -107
- package/dist/app/engine.js.map +1 -1
- package/dist/app/scriptregistry.js +251 -80
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +344 -365
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/loader.js +1 -6
- package/dist/asset/loaders/loader.js.map +1 -1
- package/dist/asset/loaders/zabc/zabc_loader.js.map +1 -1
- package/dist/asset/model.js +1000 -131
- package/dist/asset/model.js.map +1 -1
- package/dist/avatar/wardrobe.js +474 -0
- package/dist/avatar/wardrobe.js.map +1 -0
- package/dist/index.d.ts +1126 -199
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +6 -3
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +72 -15
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/msdf_text.js +3 -3
- package/dist/material/msdf_text.js.map +1 -1
- package/dist/material/msdf_text_sprite.js +4 -4
- package/dist/material/msdf_text_sprite.js.map +1 -1
- package/dist/material/pbrblueprint.js +102 -102
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/render/envlight.js +54 -1
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/sky.js +9 -0
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/batchgroup.js +11 -13
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +15 -2
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/mesh.js +79 -16
- package/dist/scene/mesh.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 +203 -2
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/text/font/cff_font.js +890 -0
- package/dist/text/font/cff_font.js.map +1 -0
- package/dist/text/font/font_asset.js +17 -3
- package/dist/text/font/font_asset.js.map +1 -1
- package/dist/text/msdf/generator.js.map +1 -1
- package/dist/text/msdf/shape.js +4 -1
- package/dist/text/msdf/shape.js.map +1 -1
- package/dist/text/runtime/msdf_text_atlas_manager.js +4 -1
- package/dist/text/runtime/msdf_text_atlas_manager.js.map +1 -1
- package/dist/utility/blueprint/material/inputs.js +1157 -1154
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/bounding_volume.js.map +1 -1
- package/dist/utility/pmrem.js +34 -8
- package/dist/utility/pmrem.js.map +1 -1
- package/dist/utility/serialization/manager.js +22 -9
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +700 -7
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +64 -4
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +187 -8
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/utility/textures/sheenlut.js +138 -0
- package/dist/utility/textures/sheenlut.js.map +1 -0
- package/package.json +2 -2
- package/dist/animation/ik/ik_chain_builder.js +0 -68
- package/dist/animation/ik/ik_chain_builder.js.map +0 -1
- package/dist/animation/ik/ik_pole_constraint.js +0 -123
- package/dist/animation/ik/ik_pole_constraint.js.map +0 -1
- package/dist/animation/ik/ik_track.js +0 -96
- package/dist/animation/ik/ik_track.js.map +0 -1
- package/dist/animation/ik_postprocessor.js +0 -71
- package/dist/animation/ik_postprocessor.js.map +0 -1
- package/dist/animation/joint_dynamics/math.js +0 -16
- package/dist/animation/joint_dynamics/math.js.map +0 -1
- package/dist/animation/manual_transform_processor.js +0 -156
- package/dist/animation/manual_transform_processor.js.map +0 -1
- package/dist/animation/skeleton_postprocessor.js +0 -50
- package/dist/animation/skeleton_postprocessor.js.map +0 -1
- package/dist/animation/spring2/collision.js +0 -469
- package/dist/animation/spring2/collision.js.map +0 -1
- package/dist/animation/spring2/constraints.js +0 -329
- package/dist/animation/spring2/constraints.js.map +0 -1
- package/dist/animation/spring2/controller.js +0 -434
- package/dist/animation/spring2/controller.js.map +0 -1
- package/dist/animation/spring2/math.js +0 -16
- package/dist/animation/spring2/math.js.map +0 -1
- package/dist/animation/spring2/solver.js +0 -624
- package/dist/animation/spring2/solver.js.map +0 -1
- package/dist/animation/spring2/spring_system.js +0 -118
- package/dist/animation/spring2/spring_system.js.map +0 -1
- package/dist/animation/spring2/types.js +0 -19
- package/dist/animation/spring2/types.js.map +0 -1
- package/dist/animation/spring_postprocessor.js +0 -54
- package/dist/animation/spring_postprocessor.js.map +0 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +0 -1273
- package/dist/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/asset/loaders/gltf/helpers.js +0 -331
- package/dist/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/material/sprite3d.js +0 -301
- package/dist/material/sprite3d.js.map +0 -1
- package/dist/material/sprite3d_std.js +0 -116
- package/dist/material/sprite3d_std.js.map +0 -1
- package/dist/material/sprite3dblueprint.js +0 -235
- package/dist/material/sprite3dblueprint.js.map +0 -1
- package/dist/material/sprite_sdf.js +0 -106
- package/dist/material/sprite_sdf.js.map +0 -1
- package/dist/material/terrainmaterial.js +0 -368
- package/dist/material/terrainmaterial.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
- package/dist/render/deferredlightpass.js +0 -510
- package/dist/render/deferredlightpass.js.map +0 -1
- package/dist/render/deferredshadowlightpass.js +0 -428
- package/dist/render/deferredshadowlightpass.js.map +0 -1
- package/dist/render/gbufferpass.js +0 -50
- package/dist/render/gbufferpass.js.map +0 -1
- package/dist/scene/sdftextsprite.js +0 -322
- package/dist/scene/sdftextsprite.js.map +0 -1
- package/dist/scene/sprite3d.js +0 -18
- package/dist/scene/sprite3d.js.map +0 -1
- package/dist/scene/terrain/grass.js +0 -280
- package/dist/scene/terrain/grass.js.map +0 -1
- package/dist/scene/terrain/heightfield.js +0 -475
- package/dist/scene/terrain/heightfield.js.map +0 -1
- package/dist/scene/terrain/patch.js +0 -532
- package/dist/scene/terrain/patch.js.map +0 -1
- package/dist/scene/terrain/quadtree.js +0 -461
- package/dist/scene/terrain/quadtree.js.map +0 -1
- package/dist/scene/terrain/terrain.js +0 -231
- package/dist/scene/terrain/terrain.js.map +0 -1
- package/dist/src/animation/animation.js +0 -127
- package/dist/src/animation/animation.js.map +0 -1
- package/dist/src/animation/animationset.js +0 -255
- package/dist/src/animation/animationset.js.map +0 -1
- package/dist/src/animation/animationtrack.js +0 -34
- package/dist/src/animation/animationtrack.js.map +0 -1
- package/dist/src/animation/eulerrotationtrack.js +0 -52
- package/dist/src/animation/eulerrotationtrack.js.map +0 -1
- package/dist/src/animation/morphtarget.js +0 -93
- package/dist/src/animation/morphtarget.js.map +0 -1
- package/dist/src/animation/morphtrack.js +0 -70
- package/dist/src/animation/morphtrack.js.map +0 -1
- package/dist/src/animation/proptrack.js +0 -161
- package/dist/src/animation/proptrack.js.map +0 -1
- package/dist/src/animation/rotationtrack.js +0 -51
- package/dist/src/animation/rotationtrack.js.map +0 -1
- package/dist/src/animation/scaletrack.js +0 -50
- package/dist/src/animation/scaletrack.js.map +0 -1
- package/dist/src/animation/skeleton.js +0 -204
- package/dist/src/animation/skeleton.js.map +0 -1
- package/dist/src/animation/translationtrack.js +0 -50
- package/dist/src/animation/translationtrack.js.map +0 -1
- package/dist/src/app/app.js +0 -129
- package/dist/src/app/app.js.map +0 -1
- package/dist/src/app/inputmgr.js +0 -267
- package/dist/src/app/inputmgr.js.map +0 -1
- package/dist/src/asset/assetmanager.js +0 -404
- package/dist/src/asset/assetmanager.js.map +0 -1
- package/dist/src/asset/builtin.js +0 -337
- package/dist/src/asset/builtin.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds.js +0 -470
- package/dist/src/asset/loaders/dds/dds.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
- package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/helpers.js +0 -327
- package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/src/asset/loaders/hdr/hdr.js +0 -180
- package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
- package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
- package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
- package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
- package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
- package/dist/src/asset/loaders/loader.js +0 -45
- package/dist/src/asset/loaders/loader.js.map +0 -1
- package/dist/src/asset/model.js +0 -414
- package/dist/src/asset/model.js.map +0 -1
- package/dist/src/blitter/bilateralblur.js +0 -221
- package/dist/src/blitter/bilateralblur.js.map +0 -1
- package/dist/src/blitter/blitter.js +0 -390
- package/dist/src/blitter/blitter.js.map +0 -1
- package/dist/src/blitter/box.js +0 -118
- package/dist/src/blitter/box.js.map +0 -1
- package/dist/src/blitter/copy.js +0 -22
- package/dist/src/blitter/copy.js.map +0 -1
- package/dist/src/blitter/gaussianblur.js +0 -228
- package/dist/src/blitter/gaussianblur.js.map +0 -1
- package/dist/src/camera/base.js +0 -92
- package/dist/src/camera/base.js.map +0 -1
- package/dist/src/camera/camera.js +0 -1005
- package/dist/src/camera/camera.js.map +0 -1
- package/dist/src/camera/fps.js +0 -238
- package/dist/src/camera/fps.js.map +0 -1
- package/dist/src/camera/orbit.js +0 -245
- package/dist/src/camera/orbit.js.map +0 -1
- package/dist/src/camera/orthocamera.js +0 -167
- package/dist/src/camera/orthocamera.js.map +0 -1
- package/dist/src/camera/perspectivecamera.js +0 -141
- package/dist/src/camera/perspectivecamera.js.map +0 -1
- package/dist/src/index.js +0 -120
- package/dist/src/index.js.map +0 -1
- package/dist/src/material/blinn.js +0 -81
- package/dist/src/material/blinn.js.map +0 -1
- package/dist/src/material/grassmaterial.js +0 -113
- package/dist/src/material/grassmaterial.js.map +0 -1
- package/dist/src/material/lambert.js +0 -92
- package/dist/src/material/lambert.js.map +0 -1
- package/dist/src/material/material.js +0 -301
- package/dist/src/material/material.js.map +0 -1
- package/dist/src/material/meshmaterial.js +0 -704
- package/dist/src/material/meshmaterial.js.map +0 -1
- package/dist/src/material/mixins/albedocolor.js +0 -76
- package/dist/src/material/mixins/albedocolor.js.map +0 -1
- package/dist/src/material/mixins/foliage.js +0 -47
- package/dist/src/material/mixins/foliage.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
- package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
- package/dist/src/material/mixins/lit.js +0 -476
- package/dist/src/material/mixins/lit.js.map +0 -1
- package/dist/src/material/mixins/pbr/common.js +0 -918
- package/dist/src/material/mixins/pbr/common.js.map +0 -1
- package/dist/src/material/mixins/texture.js +0 -172
- package/dist/src/material/mixins/texture.js.map +0 -1
- package/dist/src/material/mixins/vertexcolor.js +0 -56
- package/dist/src/material/mixins/vertexcolor.js.map +0 -1
- package/dist/src/material/particle.js +0 -178
- package/dist/src/material/particle.js.map +0 -1
- package/dist/src/material/pbrmr.js +0 -97
- package/dist/src/material/pbrmr.js.map +0 -1
- package/dist/src/material/pbrsg.js +0 -97
- package/dist/src/material/pbrsg.js.map +0 -1
- package/dist/src/material/shader/helper.js +0 -1209
- package/dist/src/material/shader/helper.js.map +0 -1
- package/dist/src/material/terrain-cm.js +0 -606
- package/dist/src/material/terrain-cm.js.map +0 -1
- package/dist/src/material/terrainmaterial.js +0 -375
- package/dist/src/material/terrainmaterial.js.map +0 -1
- package/dist/src/material/unlit.js +0 -41
- package/dist/src/material/unlit.js.map +0 -1
- package/dist/src/material/water.js +0 -417
- package/dist/src/material/water.js.map +0 -1
- package/dist/src/posteffect/bloom.js +0 -361
- package/dist/src/posteffect/bloom.js.map +0 -1
- package/dist/src/posteffect/compositor.js +0 -226
- package/dist/src/posteffect/compositor.js.map +0 -1
- package/dist/src/posteffect/fxaa.js +0 -273
- package/dist/src/posteffect/fxaa.js.map +0 -1
- package/dist/src/posteffect/grayscale.js +0 -69
- package/dist/src/posteffect/grayscale.js.map +0 -1
- package/dist/src/posteffect/motionblur.js +0 -96
- package/dist/src/posteffect/motionblur.js.map +0 -1
- package/dist/src/posteffect/posteffect.js +0 -126
- package/dist/src/posteffect/posteffect.js.map +0 -1
- package/dist/src/posteffect/sao.js +0 -324
- package/dist/src/posteffect/sao.js.map +0 -1
- package/dist/src/posteffect/ssr.js +0 -489
- package/dist/src/posteffect/ssr.js.map +0 -1
- package/dist/src/posteffect/taa.js +0 -172
- package/dist/src/posteffect/taa.js.map +0 -1
- package/dist/src/posteffect/tonemap.js +0 -94
- package/dist/src/posteffect/tonemap.js.map +0 -1
- package/dist/src/render/abuffer_oit.js +0 -361
- package/dist/src/render/abuffer_oit.js.map +0 -1
- package/dist/src/render/clipmap.js +0 -851
- package/dist/src/render/clipmap.js.map +0 -1
- package/dist/src/render/cluster_light.js +0 -333
- package/dist/src/render/cluster_light.js.map +0 -1
- package/dist/src/render/cull_visitor.js +0 -187
- package/dist/src/render/cull_visitor.js.map +0 -1
- package/dist/src/render/depthpass.js +0 -68
- package/dist/src/render/depthpass.js.map +0 -1
- package/dist/src/render/drawable_mixin.js +0 -227
- package/dist/src/render/drawable_mixin.js.map +0 -1
- package/dist/src/render/envlight.js +0 -463
- package/dist/src/render/envlight.js.map +0 -1
- package/dist/src/render/fbm_wavegenerator.js +0 -251
- package/dist/src/render/fbm_wavegenerator.js.map +0 -1
- package/dist/src/render/fft_wavegenerator.js +0 -1006
- package/dist/src/render/fft_wavegenerator.js.map +0 -1
- package/dist/src/render/fullscreenquad.js +0 -38
- package/dist/src/render/fullscreenquad.js.map +0 -1
- package/dist/src/render/gerstner_wavegenerator.js +0 -314
- package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
- package/dist/src/render/globalbindgroup_allocator.js +0 -60
- package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
- package/dist/src/render/hzb.js +0 -273
- package/dist/src/render/hzb.js.map +0 -1
- package/dist/src/render/lightpass.js +0 -172
- package/dist/src/render/lightpass.js.map +0 -1
- package/dist/src/render/objectcolorpass.js +0 -51
- package/dist/src/render/objectcolorpass.js.map +0 -1
- package/dist/src/render/primitive.js +0 -364
- package/dist/src/render/primitive.js.map +0 -1
- package/dist/src/render/render_queue.js +0 -467
- package/dist/src/render/render_queue.js.map +0 -1
- package/dist/src/render/renderbundle_wrapper.js +0 -152
- package/dist/src/render/renderbundle_wrapper.js.map +0 -1
- package/dist/src/render/renderer.js +0 -455
- package/dist/src/render/renderer.js.map +0 -1
- package/dist/src/render/renderpass.js +0 -200
- package/dist/src/render/renderpass.js.map +0 -1
- package/dist/src/render/shadowmap_pass.js +0 -56
- package/dist/src/render/shadowmap_pass.js.map +0 -1
- package/dist/src/render/sky.js +0 -1103
- package/dist/src/render/sky.js.map +0 -1
- package/dist/src/render/weightedblended_oit.js +0 -168
- package/dist/src/render/weightedblended_oit.js.map +0 -1
- package/dist/src/scene/batchgroup.js +0 -162
- package/dist/src/scene/batchgroup.js.map +0 -1
- package/dist/src/scene/environment.js +0 -209
- package/dist/src/scene/environment.js.map +0 -1
- package/dist/src/scene/graph_node.js +0 -72
- package/dist/src/scene/graph_node.js.map +0 -1
- package/dist/src/scene/light.js +0 -416
- package/dist/src/scene/light.js.map +0 -1
- package/dist/src/scene/mesh.js +0 -341
- package/dist/src/scene/mesh.js.map +0 -1
- package/dist/src/scene/octree.js +0 -649
- package/dist/src/scene/octree.js.map +0 -1
- package/dist/src/scene/particlesys.js +0 -738
- package/dist/src/scene/particlesys.js.map +0 -1
- package/dist/src/scene/raycast_visitor.js +0 -103
- package/dist/src/scene/raycast_visitor.js.map +0 -1
- package/dist/src/scene/scene.js +0 -284
- package/dist/src/scene/scene.js.map +0 -1
- package/dist/src/scene/scene_node.js +0 -732
- package/dist/src/scene/scene_node.js.map +0 -1
- package/dist/src/scene/terrain/grass.js +0 -278
- package/dist/src/scene/terrain/grass.js.map +0 -1
- package/dist/src/scene/terrain/heightfield.js +0 -475
- package/dist/src/scene/terrain/heightfield.js.map +0 -1
- package/dist/src/scene/terrain/patch.js +0 -530
- package/dist/src/scene/terrain/patch.js.map +0 -1
- package/dist/src/scene/terrain/quadtree.js +0 -461
- package/dist/src/scene/terrain/quadtree.js.map +0 -1
- package/dist/src/scene/terrain/terrain.js +0 -246
- package/dist/src/scene/terrain/terrain.js.map +0 -1
- package/dist/src/scene/terrain-cm/grass.js +0 -594
- package/dist/src/scene/terrain-cm/grass.js.map +0 -1
- package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
- package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
- package/dist/src/scene/water.js +0 -374
- package/dist/src/scene/water.js.map +0 -1
- package/dist/src/shaders/atmosphere.js +0 -957
- package/dist/src/shaders/atmosphere.js.map +0 -1
- package/dist/src/shaders/fog.js +0 -112
- package/dist/src/shaders/fog.js.map +0 -1
- package/dist/src/shaders/misc.js +0 -266
- package/dist/src/shaders/misc.js.map +0 -1
- package/dist/src/shaders/noise.js +0 -222
- package/dist/src/shaders/noise.js.map +0 -1
- package/dist/src/shaders/pbr.js +0 -51
- package/dist/src/shaders/pbr.js.map +0 -1
- package/dist/src/shaders/shadow.js +0 -636
- package/dist/src/shaders/shadow.js.map +0 -1
- package/dist/src/shaders/ssr.js +0 -490
- package/dist/src/shaders/ssr.js.map +0 -1
- package/dist/src/shaders/temporal.js +0 -215
- package/dist/src/shaders/temporal.js.map +0 -1
- package/dist/src/shaders/water.js +0 -756
- package/dist/src/shaders/water.js.map +0 -1
- package/dist/src/shadow/esm.js +0 -237
- package/dist/src/shadow/esm.js.map +0 -1
- package/dist/src/shadow/pcf_opt.js +0 -181
- package/dist/src/shadow/pcf_opt.js.map +0 -1
- package/dist/src/shadow/pcf_pd.js +0 -189
- package/dist/src/shadow/pcf_pd.js.map +0 -1
- package/dist/src/shadow/shader.js +0 -37
- package/dist/src/shadow/shader.js.map +0 -1
- package/dist/src/shadow/shadow_impl.js +0 -15
- package/dist/src/shadow/shadow_impl.js.map +0 -1
- package/dist/src/shadow/shadowmapper.js +0 -790
- package/dist/src/shadow/shadowmapper.js.map +0 -1
- package/dist/src/shadow/ssm.js +0 -159
- package/dist/src/shadow/ssm.js.map +0 -1
- package/dist/src/shadow/vsm.js +0 -297
- package/dist/src/shadow/vsm.js.map +0 -1
- package/dist/src/shapes/box.js +0 -386
- package/dist/src/shapes/box.js.map +0 -1
- package/dist/src/shapes/cylinder.js +0 -125
- package/dist/src/shapes/cylinder.js.map +0 -1
- package/dist/src/shapes/plane.js +0 -88
- package/dist/src/shapes/plane.js.map +0 -1
- package/dist/src/shapes/shape.js +0 -87
- package/dist/src/shapes/shape.js.map +0 -1
- package/dist/src/shapes/sphere.js +0 -114
- package/dist/src/shapes/sphere.js.map +0 -1
- package/dist/src/shapes/tetrahedron.js +0 -188
- package/dist/src/shapes/tetrahedron.js.map +0 -1
- package/dist/src/shapes/torus.js +0 -111
- package/dist/src/shapes/torus.js.map +0 -1
- package/dist/src/utility/aabbtree.js +0 -400
- package/dist/src/utility/aabbtree.js.map +0 -1
- package/dist/src/utility/bounding_volume.js +0 -29
- package/dist/src/utility/bounding_volume.js.map +0 -1
- package/dist/src/utility/debug.js +0 -28
- package/dist/src/utility/debug.js.map +0 -1
- package/dist/src/utility/draco/decoder.js +0 -116
- package/dist/src/utility/draco/decoder.js.map +0 -1
- package/dist/src/utility/misc.js +0 -105
- package/dist/src/utility/misc.js.map +0 -1
- package/dist/src/utility/panorama.js +0 -163
- package/dist/src/utility/panorama.js.map +0 -1
- package/dist/src/utility/pmrem.js +0 -354
- package/dist/src/utility/pmrem.js.map +0 -1
- package/dist/src/utility/rendermipmap.js +0 -115
- package/dist/src/utility/rendermipmap.js.map +0 -1
- package/dist/src/utility/serialization/json.js +0 -402
- package/dist/src/utility/serialization/json.js.map +0 -1
- package/dist/src/utility/serialization/manager.js +0 -623
- package/dist/src/utility/serialization/manager.js.map +0 -1
- package/dist/src/utility/serialization/scene/animation.js +0 -248
- package/dist/src/utility/serialization/scene/animation.js.map +0 -1
- package/dist/src/utility/serialization/scene/batch.js +0 -59
- package/dist/src/utility/serialization/scene/batch.js.map +0 -1
- package/dist/src/utility/serialization/scene/camera.js +0 -790
- package/dist/src/utility/serialization/scene/camera.js.map +0 -1
- package/dist/src/utility/serialization/scene/common.js +0 -222
- package/dist/src/utility/serialization/scene/common.js.map +0 -1
- package/dist/src/utility/serialization/scene/light.js +0 -575
- package/dist/src/utility/serialization/scene/light.js.map +0 -1
- package/dist/src/utility/serialization/scene/material.js +0 -1111
- package/dist/src/utility/serialization/scene/material.js.map +0 -1
- package/dist/src/utility/serialization/scene/mesh.js +0 -148
- package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
- package/dist/src/utility/serialization/scene/misc.js +0 -39
- package/dist/src/utility/serialization/scene/misc.js.map +0 -1
- package/dist/src/utility/serialization/scene/node.js +0 -451
- package/dist/src/utility/serialization/scene/node.js.map +0 -1
- package/dist/src/utility/serialization/scene/particle.js +0 -425
- package/dist/src/utility/serialization/scene/particle.js.map +0 -1
- package/dist/src/utility/serialization/scene/primitive.js +0 -692
- package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
- package/dist/src/utility/serialization/scene/scene.js +0 -704
- package/dist/src/utility/serialization/scene/scene.js.map +0 -1
- package/dist/src/utility/serialization/scene/terrain.js +0 -488
- package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
- package/dist/src/utility/serialization/scene/water.js +0 -465
- package/dist/src/utility/serialization/scene/water.js.map +0 -1
- package/dist/src/utility/shprojector.js +0 -297
- package/dist/src/utility/shprojector.js.map +0 -1
- package/dist/src/utility/textures/ggxlut.js +0 -213
- package/dist/src/utility/textures/ggxlut.js.map +0 -1
- package/dist/src/utility/textures/gradientnoise.js +0 -62
- package/dist/src/utility/textures/gradientnoise.js.map +0 -1
- package/dist/src/utility/textures/randomnoise.js +0 -41
- package/dist/src/utility/textures/randomnoise.js.map +0 -1
- package/dist/src/values.js +0 -162
- package/dist/src/values.js.map +0 -1
- package/dist/utility/blueprint/material/common.js +0 -7
- package/dist/utility/blueprint/material/common.js.map +0 -1
- package/dist/utility/serialization/blueprint/constants.js +0 -255
- package/dist/utility/serialization/blueprint/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/constants.js +0 -203
- package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/texture.js +0 -165
- package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
- package/dist/utility/serialization/scene/cloth_script.js +0 -834
- package/dist/utility/serialization/scene/cloth_script.js.map +0 -1
- package/dist/utility/serialization/scene/spring_script.js +0 -596
- package/dist/utility/serialization/scene/spring_script.js.map +0 -1
|
@@ -4,7 +4,8 @@ import { NodeRotationTrack } from './rotationtrack.js';
|
|
|
4
4
|
import { NodeEulerRotationTrack } from './eulerrotationtrack.js';
|
|
5
5
|
import { NodeTranslationTrack } from './translationtrack.js';
|
|
6
6
|
import { NodeScaleTrack } from './scaletrack.js';
|
|
7
|
-
import {
|
|
7
|
+
import { HumanoidBodyRig } from './skeleton.js';
|
|
8
|
+
import { createSkeletalMaskedAnimationClip } from './animationmask.js';
|
|
8
9
|
|
|
9
10
|
function cloneInterpolator(src) {
|
|
10
11
|
return new Interpolator(src.mode, src.target, src.inputs instanceof Float32Array ? new Float32Array(src.inputs) : [
|
|
@@ -13,7 +14,7 @@ function cloneInterpolator(src) {
|
|
|
13
14
|
...src.outputs
|
|
14
15
|
]);
|
|
15
16
|
}
|
|
16
|
-
function createJointRetargetRemap(srcSkeleton, dstSkeleton, srcJoint, dstJoint, translationRotation) {
|
|
17
|
+
function createJointRetargetRemap(srcSkeleton, dstSkeleton, srcJoint, dstJoint, translationRotation, translationScale, translationAxisLocks) {
|
|
17
18
|
const si = srcSkeleton.joints.indexOf(srcJoint);
|
|
18
19
|
const di = dstSkeleton.joints.indexOf(dstJoint);
|
|
19
20
|
const srcBindPose = srcSkeleton.bindPose[si];
|
|
@@ -28,10 +29,94 @@ function createJointRetargetRemap(srcSkeleton, dstSkeleton, srcJoint, dstJoint,
|
|
|
28
29
|
dstBindRot: dstBindPose.rotation.clone(),
|
|
29
30
|
srcBindPos: srcBindPose.position.clone(),
|
|
30
31
|
dstBindPos: dstBindPose.position.clone(),
|
|
31
|
-
translationScale: srcLen > 1e-6 ? dstLen / srcLen : 1,
|
|
32
|
-
translationRotation
|
|
32
|
+
translationScale: (srcLen > 1e-6 ? dstLen / srcLen : 1),
|
|
33
|
+
translationRotation,
|
|
34
|
+
translationAxisLocks
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function createTranslationRetargetRemap(srcNode, dstNode, srcBindPos, dstBindPos, dstJointIndex, translationScale, translationRotation, translationAxisLocks) {
|
|
38
|
+
return {
|
|
39
|
+
dstNode,
|
|
40
|
+
dstJointIndex,
|
|
41
|
+
srcNode,
|
|
42
|
+
srcBindRotInv: Quaternion.identity(),
|
|
43
|
+
dstBindRot: Quaternion.identity(),
|
|
44
|
+
srcBindPos: srcBindPos.clone(),
|
|
45
|
+
dstBindPos: dstBindPos.clone(),
|
|
46
|
+
translationScale,
|
|
47
|
+
translationRotation,
|
|
48
|
+
translationAxisLocks
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function getBindPosition(skeleton, joint) {
|
|
52
|
+
const index = skeleton.joints.indexOf(joint);
|
|
53
|
+
return index >= 0 ? skeleton.bindPose[index].position : null;
|
|
54
|
+
}
|
|
55
|
+
function getRigBindPoseForNode(skeleton, node) {
|
|
56
|
+
return skeleton.getBindPoseForJoint(node) ?? (node === skeleton.rootJoint ? skeleton.rootBindPose : {
|
|
57
|
+
position: node.position,
|
|
58
|
+
rotation: node.rotation,
|
|
59
|
+
scale: node.scale
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function getBindDistanceToAncestor(skeleton, joint, ancestor) {
|
|
63
|
+
let distance = 0;
|
|
64
|
+
let node = joint;
|
|
65
|
+
while(node && node !== ancestor){
|
|
66
|
+
const bindPosition = getBindPosition(skeleton, node);
|
|
67
|
+
if (!bindPosition) {
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
distance += bindPosition.magnitude;
|
|
71
|
+
node = node.parent;
|
|
72
|
+
}
|
|
73
|
+
return node === ancestor ? distance : 0;
|
|
74
|
+
}
|
|
75
|
+
function getHumanoidLegLength(skeleton, side) {
|
|
76
|
+
const mapping = skeleton.humanoidJointMapping;
|
|
77
|
+
if (!mapping) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
const body = mapping.body;
|
|
81
|
+
const hips = body[HumanoidBodyRig.Hips];
|
|
82
|
+
const foot = side === 'left' ? body[HumanoidBodyRig.LeftFoot] : body[HumanoidBodyRig.RightFoot];
|
|
83
|
+
const toes = side === 'left' ? body[HumanoidBodyRig.LeftToes] : body[HumanoidBodyRig.RightToes];
|
|
84
|
+
return Math.max(getBindDistanceToAncestor(skeleton, foot, hips), getBindDistanceToAncestor(skeleton, toes, hips));
|
|
85
|
+
}
|
|
86
|
+
function getHumanoidRootMotionScale(srcSkeleton, dstSkeleton) {
|
|
87
|
+
const srcLeftLeg = getHumanoidLegLength(srcSkeleton, 'left');
|
|
88
|
+
const srcRightLeg = getHumanoidLegLength(srcSkeleton, 'right');
|
|
89
|
+
const dstLeftLeg = getHumanoidLegLength(dstSkeleton, 'left');
|
|
90
|
+
const dstRightLeg = getHumanoidLegLength(dstSkeleton, 'right');
|
|
91
|
+
const srcLegLength = Math.max(srcLeftLeg, srcRightLeg);
|
|
92
|
+
const dstLegLength = Math.max(dstLeftLeg, dstRightLeg);
|
|
93
|
+
return srcLegLength > 1e-6 && dstLegLength > 1e-6 ? dstLegLength / srcLegLength : 1;
|
|
94
|
+
}
|
|
95
|
+
function findTranslationTrack(tracks) {
|
|
96
|
+
return tracks?.find((track)=>track instanceof NodeTranslationTrack) ?? null;
|
|
97
|
+
}
|
|
98
|
+
function applyTranslationAxisLocks(value, bindValue, locks) {
|
|
99
|
+
if (locks?.x) {
|
|
100
|
+
value.x = bindValue.x;
|
|
101
|
+
}
|
|
102
|
+
if (locks?.y) {
|
|
103
|
+
value.y = bindValue.y;
|
|
104
|
+
}
|
|
105
|
+
if (locks?.z) {
|
|
106
|
+
value.z = bindValue.z;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function applyTranslationTangentAxisLocks(value, locks) {
|
|
110
|
+
if (locks?.x) {
|
|
111
|
+
value.x = 0;
|
|
112
|
+
}
|
|
113
|
+
if (locks?.y) {
|
|
114
|
+
value.y = 0;
|
|
115
|
+
}
|
|
116
|
+
if (locks?.z) {
|
|
117
|
+
value.z = 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
35
120
|
function retargetRotation(qSrcAnim, remap, out) {
|
|
36
121
|
Quaternion.multiply(remap.srcBindRotInv, qSrcAnim, out);
|
|
37
122
|
Quaternion.multiply(remap.dstBindRot, out, out);
|
|
@@ -50,6 +135,7 @@ function retargetTranslationValue(srcValue, remap, out) {
|
|
|
50
135
|
remap.translationRotation.transform(out, out);
|
|
51
136
|
}
|
|
52
137
|
out.addBy(remap.dstBindPos);
|
|
138
|
+
applyTranslationAxisLocks(out, remap.dstBindPos, remap.translationAxisLocks);
|
|
53
139
|
return out;
|
|
54
140
|
}
|
|
55
141
|
function retargetTranslationTangent(srcValue, remap, out) {
|
|
@@ -58,6 +144,7 @@ function retargetTranslationTangent(srcValue, remap, out) {
|
|
|
58
144
|
if (remap.translationRotation) {
|
|
59
145
|
remap.translationRotation.transform(out, out);
|
|
60
146
|
}
|
|
147
|
+
applyTranslationTangentAxisLocks(out, remap.translationAxisLocks);
|
|
61
148
|
return out;
|
|
62
149
|
}
|
|
63
150
|
function retargetRotationTrack(src, remap) {
|
|
@@ -128,6 +215,15 @@ function retargetTranslationTrack(src, remap) {
|
|
|
128
215
|
}
|
|
129
216
|
return new NodeTranslationTrack(new Interpolator(src.interpolator.mode, 'vec3', new Float32Array(src.interpolator.inputs), newOutputs));
|
|
130
217
|
}
|
|
218
|
+
function createConstantTranslationTrack(value) {
|
|
219
|
+
return new NodeTranslationTrack(new Interpolator('step', 'vec3', new Float32Array([
|
|
220
|
+
0
|
|
221
|
+
]), new Float32Array([
|
|
222
|
+
value.x,
|
|
223
|
+
value.y,
|
|
224
|
+
value.z
|
|
225
|
+
])));
|
|
226
|
+
}
|
|
131
227
|
function findRotationTrack(tracks) {
|
|
132
228
|
return tracks?.find((track)=>track instanceof NodeRotationTrack || track instanceof NodeEulerRotationTrack) ?? null;
|
|
133
229
|
}
|
|
@@ -315,8 +411,10 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
315
411
|
/** @internal */ _model;
|
|
316
412
|
/** @internal */ _animations;
|
|
317
413
|
/** @internal */ _skeletons;
|
|
414
|
+
/** @internal */ _rigs;
|
|
318
415
|
/** @internal */ _activeTracks;
|
|
319
|
-
/** @internal */
|
|
416
|
+
/** @internal */ _activeSkinBindings;
|
|
417
|
+
/** @internal */ _activeRigs;
|
|
320
418
|
/** @internal */ _activeAnimations;
|
|
321
419
|
/**
|
|
322
420
|
* Create an AnimationSet controlling the provided model.
|
|
@@ -327,9 +425,11 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
327
425
|
this._model = model;
|
|
328
426
|
this._animations = {};
|
|
329
427
|
this._activeTracks = new Map();
|
|
330
|
-
this.
|
|
428
|
+
this._activeSkinBindings = new Map();
|
|
429
|
+
this._activeRigs = new Map();
|
|
331
430
|
this._activeAnimations = new Map();
|
|
332
431
|
this._skeletons = [];
|
|
432
|
+
this._rigs = [];
|
|
333
433
|
}
|
|
334
434
|
/**
|
|
335
435
|
* The model (SceneNode) controlled by this animation set.
|
|
@@ -347,6 +447,34 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
347
447
|
return this._skeletons;
|
|
348
448
|
}
|
|
349
449
|
/**
|
|
450
|
+
* The shared rigs used by animations in this set.
|
|
451
|
+
*/ get rigs() {
|
|
452
|
+
return this._rigs;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Per-skin bindings used by skinned meshes in this set.
|
|
456
|
+
*/ get skinBindings() {
|
|
457
|
+
return this._skeletons;
|
|
458
|
+
}
|
|
459
|
+
resolveRigByAnimationBindingId(id) {
|
|
460
|
+
return this._model.findSkeletonRigById(id) ?? this._model.findSkinBindingById(id)?.rig ?? null;
|
|
461
|
+
}
|
|
462
|
+
resolveClipRig(clip) {
|
|
463
|
+
let rig = null;
|
|
464
|
+
for (const id of clip.skeletons){
|
|
465
|
+
const nextRig = this.resolveRigByAnimationBindingId(id);
|
|
466
|
+
if (!nextRig) {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
if (!rig) {
|
|
470
|
+
rig = nextRig;
|
|
471
|
+
} else if (rig !== nextRig) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return rig;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
350
478
|
* Retrieve an animation clip by name.
|
|
351
479
|
*
|
|
352
480
|
* @param name - Name of the animation.
|
|
@@ -400,7 +528,7 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
400
528
|
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
401
529
|
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
402
530
|
* and apply the resulting state to the target.
|
|
403
|
-
* - Apply
|
|
531
|
+
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
404
532
|
*
|
|
405
533
|
* @param deltaInSeconds - Time step in seconds since last update.
|
|
406
534
|
*/ update(deltaInSeconds) {
|
|
@@ -415,12 +543,14 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
415
543
|
const timeAdvance = deltaInSeconds * v.speedRatio;
|
|
416
544
|
v.currentTime += timeAdvance;
|
|
417
545
|
v.animateTime += timeAdvance;
|
|
418
|
-
if (
|
|
419
|
-
v.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
v.
|
|
423
|
-
|
|
546
|
+
if (k.timeDuration > 0) {
|
|
547
|
+
if (v.currentTime > k.timeDuration) {
|
|
548
|
+
v.repeatCounter += Math.max(1, Math.floor(v.currentTime / k.timeDuration));
|
|
549
|
+
v.currentTime %= k.timeDuration;
|
|
550
|
+
} else if (v.currentTime < 0) {
|
|
551
|
+
v.repeatCounter += Math.max(1, Math.ceil(-v.currentTime / k.timeDuration));
|
|
552
|
+
v.currentTime = (v.currentTime % k.timeDuration + k.timeDuration) % k.timeDuration;
|
|
553
|
+
}
|
|
424
554
|
}
|
|
425
555
|
if (v.repeat !== 0 && v.repeatCounter >= v.repeat) {
|
|
426
556
|
this.stopAnimation(k.name);
|
|
@@ -459,10 +589,13 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
459
589
|
}
|
|
460
590
|
});
|
|
461
591
|
});
|
|
462
|
-
// Update
|
|
463
|
-
this.
|
|
592
|
+
// Update rigs once before computing per-skin palettes.
|
|
593
|
+
this._rigs.forEach((v)=>{
|
|
464
594
|
v.get()?.apply(deltaInSeconds);
|
|
465
595
|
});
|
|
596
|
+
this._skeletons.forEach((v)=>{
|
|
597
|
+
v.get()?.apply();
|
|
598
|
+
});
|
|
466
599
|
}
|
|
467
600
|
/**
|
|
468
601
|
* Check whether an animation is currently playing.
|
|
@@ -558,15 +691,21 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
558
691
|
}
|
|
559
692
|
});
|
|
560
693
|
ani.skeletons?.forEach((v, k)=>{
|
|
561
|
-
const
|
|
562
|
-
if (
|
|
563
|
-
const refcount = this.
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
694
|
+
const rig = this.model.findSkeletonRigById(k);
|
|
695
|
+
if (rig) {
|
|
696
|
+
const refcount = this._activeRigs.get(rig);
|
|
697
|
+
this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
|
|
698
|
+
rig.playing = true;
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const binding = this.model.findSkinBindingById(k);
|
|
702
|
+
if (binding) {
|
|
703
|
+
const refcount = this._activeSkinBindings.get(binding);
|
|
704
|
+
this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
|
|
705
|
+
binding.playing = true;
|
|
706
|
+
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
707
|
+
this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
|
|
708
|
+
binding.rig.playing = true;
|
|
570
709
|
}
|
|
571
710
|
});
|
|
572
711
|
}
|
|
@@ -603,14 +742,32 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
603
742
|
});
|
|
604
743
|
});
|
|
605
744
|
ani.skeletons?.forEach((v, k)=>{
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
const refcount = this.
|
|
745
|
+
const rig = this.model.findSkeletonRigById(k);
|
|
746
|
+
if (rig) {
|
|
747
|
+
const refcount = this._activeRigs.get(rig);
|
|
609
748
|
if (refcount === 1) {
|
|
610
|
-
|
|
611
|
-
this.
|
|
749
|
+
rig.reset();
|
|
750
|
+
this._activeRigs.delete(rig);
|
|
612
751
|
} else {
|
|
613
|
-
this.
|
|
752
|
+
this._activeRigs.set(rig, refcount - 1);
|
|
753
|
+
}
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const binding = this.model.findSkinBindingById(k);
|
|
757
|
+
if (binding) {
|
|
758
|
+
const refcount = this._activeSkinBindings.get(binding);
|
|
759
|
+
if (refcount === 1) {
|
|
760
|
+
binding.reset();
|
|
761
|
+
this._activeSkinBindings.delete(binding);
|
|
762
|
+
} else {
|
|
763
|
+
this._activeSkinBindings.set(binding, refcount - 1);
|
|
764
|
+
}
|
|
765
|
+
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
766
|
+
if (rigRefcount === 1) {
|
|
767
|
+
binding.rig.reset();
|
|
768
|
+
this._activeRigs.delete(binding.rig);
|
|
769
|
+
} else {
|
|
770
|
+
this._activeRigs.set(binding.rig, rigRefcount - 1);
|
|
614
771
|
}
|
|
615
772
|
}
|
|
616
773
|
});
|
|
@@ -618,19 +775,34 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
618
775
|
}
|
|
619
776
|
}
|
|
620
777
|
/**
|
|
621
|
-
*
|
|
778
|
+
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
622
779
|
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
* -
|
|
626
|
-
* - The source clip must exist in `sourceSet` and must be driven by exactly one skeleton.
|
|
780
|
+
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
781
|
+
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
782
|
+
* Non-skeletal tracks are skipped by default.
|
|
627
783
|
*
|
|
628
|
-
* @param
|
|
629
|
-
* @param
|
|
630
|
-
* @param
|
|
631
|
-
* @returns The
|
|
632
|
-
*/
|
|
633
|
-
const
|
|
784
|
+
* @param sourceName - Name of the source clip.
|
|
785
|
+
* @param targetName - Name of the generated clip.
|
|
786
|
+
* @param options - Humanoid semantic or joint-name based mask options.
|
|
787
|
+
* @returns The generated clip, or null on failure.
|
|
788
|
+
*/ createSkeletalMaskedAnimation(sourceName, targetName, options) {
|
|
789
|
+
const sourceClip = this.get(sourceName);
|
|
790
|
+
if (!sourceClip) {
|
|
791
|
+
console.error(`createSkeletalMaskedAnimation: animation '${sourceName}' not found`);
|
|
792
|
+
return null;
|
|
793
|
+
}
|
|
794
|
+
const rig = this.resolveClipRig(sourceClip);
|
|
795
|
+
if (!rig) {
|
|
796
|
+
console.error(`createSkeletalMaskedAnimation: source animation must resolve to exactly one rig`);
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
return createSkeletalMaskedAnimationClip(this, sourceClip, targetName, rig, options);
|
|
800
|
+
}
|
|
801
|
+
copyHumanoidAnimationFrom(sourceSet, animationName, targetNameOrOptions, copyOptions) {
|
|
802
|
+
const options = typeof targetNameOrOptions === 'string' ? copyOptions ?? {} : targetNameOrOptions ?? {};
|
|
803
|
+
const destName = typeof targetNameOrOptions === 'string' ? targetNameOrOptions : options.targetName ?? animationName;
|
|
804
|
+
const rootMotion = options.rootMotion ?? 'scaled';
|
|
805
|
+
const jointTranslations = options.jointTranslations ?? 'skip';
|
|
634
806
|
const sourceClip = sourceSet.get(animationName);
|
|
635
807
|
if (!sourceClip) {
|
|
636
808
|
console.error(`copyHumanoidAnimationFrom: animation '${animationName}' not found in source set`);
|
|
@@ -640,16 +812,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
640
812
|
console.error(`copyHumanoidAnimationFrom: animation '${destName}' already exists in target set`);
|
|
641
813
|
return null;
|
|
642
814
|
}
|
|
643
|
-
if (sourceClip.skeletons.size !== 1) {
|
|
644
|
-
console.error(`copyHumanoidAnimationFrom: source animation clip must be affected by exactly one skeleton`);
|
|
645
|
-
return null;
|
|
646
|
-
}
|
|
647
815
|
const srcSkeletonId = [
|
|
648
816
|
...sourceClip.skeletons
|
|
649
|
-
][0];
|
|
650
|
-
const srcSkeleton =
|
|
817
|
+
][0] ?? '';
|
|
818
|
+
const srcSkeleton = sourceSet.resolveClipRig(sourceClip);
|
|
651
819
|
if (!srcSkeleton) {
|
|
652
|
-
console.error(`copyHumanoidAnimationFrom: source
|
|
820
|
+
console.error(`copyHumanoidAnimationFrom: source animation clip must resolve to exactly one humanoid rig`);
|
|
653
821
|
return null;
|
|
654
822
|
}
|
|
655
823
|
// Check that source skeleton has humanoid mapping
|
|
@@ -663,7 +831,7 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
663
831
|
// Find a destination skeleton that has a humanoid mapping and share at least the body rig keys
|
|
664
832
|
let srcJointsFiltered = [];
|
|
665
833
|
let dstJointsFiltered = [];
|
|
666
|
-
const dstSkeleton = this.
|
|
834
|
+
const dstSkeleton = this._rigs.map((ref)=>ref.get()).find((sk)=>{
|
|
667
835
|
if (!sk) {
|
|
668
836
|
return false;
|
|
669
837
|
}
|
|
@@ -717,15 +885,15 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
717
885
|
console.error(`copyHumanoidAnimationFrom: no matching humanoid skeleton in target set for '${srcSkeletonId}'`);
|
|
718
886
|
return null;
|
|
719
887
|
}
|
|
720
|
-
// Compute the world-space rotation of the parent chain above
|
|
888
|
+
// Compute the world-space rotation of the parent chain above a motion node,
|
|
721
889
|
// walking ALL ancestor nodes up to (but not including) the model root.
|
|
722
890
|
// This must include non-joint nodes such as "Armature" in Mixamo rigs, which
|
|
723
891
|
// carry a 90° X rotation that is NOT captured by humanoidRootRotation (which
|
|
724
892
|
// only traverses nodes inside the skeleton joints list).
|
|
725
|
-
function
|
|
893
|
+
function computeParentChainRotation(node, modelRoot, skeleton) {
|
|
726
894
|
const result = Quaternion.identity();
|
|
727
895
|
const jointSet = new Set(skeleton.joints);
|
|
728
|
-
let p =
|
|
896
|
+
let p = node.parent;
|
|
729
897
|
while(p && p !== modelRoot){
|
|
730
898
|
if (!jointSet.has(p)) {
|
|
731
899
|
Quaternion.multiply(p.rotation, result, result);
|
|
@@ -736,9 +904,17 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
736
904
|
}
|
|
737
905
|
const srcHipsNode = srcSkeleton.humanoidJointMapping.body[HumanoidBodyRig.Hips];
|
|
738
906
|
const dstHipsNode = dstSkeleton.humanoidJointMapping.body[HumanoidBodyRig.Hips];
|
|
739
|
-
const
|
|
740
|
-
const
|
|
741
|
-
const
|
|
907
|
+
const srcRootNode = srcSkeleton.rootJoint ?? srcHipsNode;
|
|
908
|
+
const dstRootNode = dstSkeleton.rootJoint ?? dstHipsNode;
|
|
909
|
+
const srcRootRot = computeParentChainRotation(srcRootNode, sourceSet.model, srcSkeleton);
|
|
910
|
+
const dstRootRot = computeParentChainRotation(dstRootNode, this._model, dstSkeleton);
|
|
911
|
+
const srcRootTranslationTrack = findTranslationTrack(sourceClip.tracks.get(srcRootNode));
|
|
912
|
+
const srcFallbackHipsTranslationTrack = !srcRootTranslationTrack && srcRootNode !== srcHipsNode ? findTranslationTrack(sourceClip.tracks.get(srcHipsNode)) : null;
|
|
913
|
+
const srcMotionTrack = srcRootTranslationTrack ?? srcFallbackHipsTranslationTrack;
|
|
914
|
+
const srcMotionNode = srcRootTranslationTrack ? srcRootNode : srcFallbackHipsTranslationTrack ? srcHipsNode : null;
|
|
915
|
+
const srcMotionParentRot = srcMotionNode ? computeParentChainRotation(srcMotionNode, sourceSet.model, srcSkeleton) : srcRootRot;
|
|
916
|
+
const rootTranslationRotation = Quaternion.multiply(Quaternion.inverse(dstRootRot), srcMotionParentRot);
|
|
917
|
+
const rootTranslationScale = rootMotion === 'scaled' ? typeof options.rootMotionScale === 'number' ? options.rootMotionScale : options.rootMotionScale === 'none' ? 1 : getHumanoidRootMotionScale(srcSkeleton, dstSkeleton) : 1;
|
|
742
918
|
const jointRemaps = [];
|
|
743
919
|
const mappedSrcNodes = new Set();
|
|
744
920
|
const mappedDstNodes = new Set();
|
|
@@ -751,9 +927,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
751
927
|
}
|
|
752
928
|
mappedSrcNodes.add(srcJoint);
|
|
753
929
|
mappedDstNodes.add(dstJoint);
|
|
754
|
-
const isHipsBone = srcJoint === srcHipsNode;
|
|
755
930
|
nodeMap.set(srcJoint, dstJoint);
|
|
756
|
-
const remap = createJointRetargetRemap(srcSkeleton, dstSkeleton, srcJoint, dstJoint
|
|
931
|
+
const remap = createJointRetargetRemap(srcSkeleton, dstSkeleton, srcJoint, dstJoint);
|
|
757
932
|
jointRemaps.push(remap);
|
|
758
933
|
jointRemapBySrcNode.set(srcJoint, remap);
|
|
759
934
|
}
|
|
@@ -767,6 +942,23 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
767
942
|
// Register destination skeleton
|
|
768
943
|
dstClip.addSkeleton(dstSkeleton.persistentId);
|
|
769
944
|
bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRootRot, dstRootRot, dstClip, jointRemaps);
|
|
945
|
+
if (rootMotion !== 'none') {
|
|
946
|
+
const dstRootBindPose = getRigBindPoseForNode(dstSkeleton, dstRootNode);
|
|
947
|
+
let dstRootTrack = null;
|
|
948
|
+
if (rootMotion === 'locked') {
|
|
949
|
+
dstRootTrack = createConstantTranslationTrack(dstRootBindPose.position);
|
|
950
|
+
} else if (srcMotionTrack && srcMotionNode) {
|
|
951
|
+
const srcMotionBindPose = getRigBindPoseForNode(srcSkeleton, srcMotionNode);
|
|
952
|
+
const rootRemap = createTranslationRetargetRemap(srcMotionNode, dstRootNode, srcMotionBindPose.position, dstRootBindPose.position, dstSkeleton.joints.indexOf(dstRootNode), rootTranslationScale, rootTranslationRotation, options.lockRootMotionAxes);
|
|
953
|
+
dstRootTrack = retargetTranslationTrack(srcMotionTrack, rootRemap);
|
|
954
|
+
}
|
|
955
|
+
if (dstRootTrack) {
|
|
956
|
+
dstRootTrack.name = srcMotionTrack?.name ?? 'translation';
|
|
957
|
+
dstRootTrack.target = dstRootNode.persistentId;
|
|
958
|
+
dstRootTrack.jointIndex = dstSkeleton.joints.indexOf(dstRootNode);
|
|
959
|
+
dstClip.addTrack(dstRootNode, dstRootTrack);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
770
962
|
for (const srcNode of srcJointsFiltered){
|
|
771
963
|
const srcTracks = sourceClip.tracks.get(srcNode);
|
|
772
964
|
if (!srcTracks) {
|
|
@@ -781,6 +973,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
781
973
|
} else if (srcTrack instanceof NodeEulerRotationTrack) {
|
|
782
974
|
continue;
|
|
783
975
|
} else if (srcTrack instanceof NodeTranslationTrack) {
|
|
976
|
+
if (srcNode === srcRootNode || srcTrack === srcMotionTrack || jointTranslations !== 'preserve') {
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
784
979
|
dstTrack = retargetTranslationTrack(srcTrack, remap);
|
|
785
980
|
} else if (srcTrack instanceof NodeScaleTrack) {
|
|
786
981
|
dstTrack = new NodeScaleTrack(cloneInterpolator(srcTrack.interpolator));
|
|
@@ -810,7 +1005,7 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
810
1005
|
* skeleton structure matching.
|
|
811
1006
|
* @returns The newly created AnimationClip, or null on failure.
|
|
812
1007
|
*
|
|
813
|
-
* @deprecated Use
|
|
1008
|
+
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
814
1009
|
*/ copyAnimationFrom(sourceSet, animationName, targetName, excludeJoint) {
|
|
815
1010
|
const destName = targetName ?? animationName;
|
|
816
1011
|
const sourceClip = sourceSet.get(animationName);
|
|
@@ -822,16 +1017,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
822
1017
|
console.error(`copyAnimationFrom: animation '${destName}' already exists in target set`);
|
|
823
1018
|
return null;
|
|
824
1019
|
}
|
|
825
|
-
if (sourceClip.skeletons.size !== 1) {
|
|
826
|
-
console.error(`copyAnimationFrom: source animation clip must be affected by exactly one skeleton`);
|
|
827
|
-
return null;
|
|
828
|
-
}
|
|
829
1020
|
const srcSkeletonId = [
|
|
830
1021
|
...sourceClip.skeletons
|
|
831
|
-
][0];
|
|
832
|
-
const srcSkeleton =
|
|
1022
|
+
][0] ?? '';
|
|
1023
|
+
const srcSkeleton = sourceSet.resolveClipRig(sourceClip);
|
|
833
1024
|
if (!srcSkeleton) {
|
|
834
|
-
console.error(`copyAnimationFrom: source
|
|
1025
|
+
console.error(`copyAnimationFrom: source animation clip must resolve to exactly one rig`);
|
|
835
1026
|
return null;
|
|
836
1027
|
}
|
|
837
1028
|
const nodeMap = new Map();
|
|
@@ -849,7 +1040,7 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
849
1040
|
return null;
|
|
850
1041
|
}
|
|
851
1042
|
let dstJointsFiltered = [];
|
|
852
|
-
const dstSkeleton = this.
|
|
1043
|
+
const dstSkeleton = this._rigs.map((ref)=>ref.get()).find((sk)=>{
|
|
853
1044
|
if (!sk) {
|
|
854
1045
|
return false;
|
|
855
1046
|
}
|
|
@@ -961,6 +1152,15 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
961
1152
|
}
|
|
962
1153
|
}
|
|
963
1154
|
/**
|
|
1155
|
+
* Reset all skeleton modifiers
|
|
1156
|
+
*/ resetSkeletonModifiers() {
|
|
1157
|
+
for (const sk of this._skeletons){
|
|
1158
|
+
for (const modifier of sk.get().modifiers){
|
|
1159
|
+
modifier.reset();
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
964
1164
|
* Dispose the animation set and release owned resources.
|
|
965
1165
|
*
|
|
966
1166
|
* - Disposes the weak reference to the model.
|
|
@@ -973,7 +1173,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
973
1173
|
}
|
|
974
1174
|
this._animations = {};
|
|
975
1175
|
this._activeAnimations.clear();
|
|
976
|
-
this.
|
|
1176
|
+
this._activeSkinBindings.clear();
|
|
1177
|
+
this._activeRigs.clear();
|
|
977
1178
|
this._activeTracks.clear();
|
|
978
1179
|
}
|
|
979
1180
|
}
|