@zephyr3d/scene 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/animation/animationset.js +52 -55
  2. package/dist/animation/animationset.js.map +1 -1
  3. package/dist/animation/joint_dynamics_modifier.js +19 -19
  4. package/dist/animation/joint_dynamics_modifier.js.map +1 -1
  5. package/dist/app/engine.js +131 -131
  6. package/dist/app/engine.js.map +1 -1
  7. package/dist/avatar/wardrobe.js +13 -13
  8. package/dist/avatar/wardrobe.js.map +1 -1
  9. package/dist/camera/camera.js +201 -201
  10. package/dist/camera/camera.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +5 -5
  13. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  14. package/dist/material/mtoon.js +4 -4
  15. package/dist/material/mtoon.js.map +1 -1
  16. package/dist/material/pbrblueprint.js +11 -11
  17. package/dist/material/pbrblueprint.js.map +1 -1
  18. package/dist/material/shader/helper.js +284 -284
  19. package/dist/material/shader/helper.js.map +1 -1
  20. package/dist/posteffect/ssr.js +9 -9
  21. package/dist/posteffect/ssr.js.map +1 -1
  22. package/dist/render/lightpass.js +5 -5
  23. package/dist/render/lightpass.js.map +1 -1
  24. package/dist/render/renderer.js +7 -7
  25. package/dist/render/renderer.js.map +1 -1
  26. package/dist/shadow/esm.js +1 -1
  27. package/dist/shadow/esm.js.map +1 -1
  28. package/dist/shadow/shadow_region.js +45 -45
  29. package/dist/shadow/shadow_region.js.map +1 -1
  30. package/dist/utility/serialization/manager.js +275 -275
  31. package/dist/utility/serialization/manager.js.map +1 -1
  32. package/dist/utility/serialization/scene/camera.js.map +1 -1
  33. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  34. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  35. package/package.json +1 -1
@@ -641,7 +641,7 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
641
641
  * Start (or update) playback of an animation clip.
642
642
  *
643
643
  * Behavior:
644
- * - If the clip is already playing, updates its fade-in (resets fade-out).
644
+ * - If the clip is already playing, stops it first.
645
645
  * - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
646
646
  * - Registers clip tracks and skeletons into the active sets for blending and application.
647
647
  *
@@ -653,62 +653,59 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
653
653
  console.error(`Animation ${name} not exists`);
654
654
  return;
655
655
  }
656
+ if (this.isPlayingAnimation(name)) {
657
+ this.stopAnimation(name);
658
+ }
656
659
  const fadeIn = Math.max(options?.fadeIn ?? 0, 0);
657
- const info = this._activeAnimations.get(ani);
658
- if (info) {
659
- info.fadeOut = 0;
660
- info.fadeIn = fadeIn;
661
- } else {
662
- const repeat = options?.repeat ?? 0;
663
- const speedRatio = options?.speedRatio ?? 1;
664
- const weight = options?.weight ?? ani.weight ?? 1;
665
- this._activeAnimations.set(ani, {
666
- repeat,
667
- weight,
668
- speedRatio,
669
- fadeIn,
670
- fadeOut: 0,
671
- repeatCounter: 0,
672
- currentTime: speedRatio < 0 ? ani.timeDuration : 0,
673
- animateTime: 0,
674
- fadeOutStart: 0,
675
- firstFrame: true
676
- });
677
- ani.tracks?.forEach((v, k)=>{
678
- let nodeTracks = this._activeTracks.get(k);
679
- if (!nodeTracks) {
680
- nodeTracks = new Map();
681
- this._activeTracks.set(k, nodeTracks);
682
- }
683
- for (const track of v){
684
- const blendId = track.getBlendId();
685
- let blendedTracks = nodeTracks.get(blendId);
686
- if (!blendedTracks) {
687
- blendedTracks = [];
688
- nodeTracks.set(blendId, blendedTracks);
689
- }
690
- blendedTracks.push(track);
691
- }
692
- });
693
- ani.skeletons?.forEach((v, k)=>{
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;
660
+ const repeat = options?.repeat ?? 0;
661
+ const speedRatio = options?.speedRatio ?? 1;
662
+ const weight = options?.weight ?? ani.weight ?? 1;
663
+ this._activeAnimations.set(ani, {
664
+ repeat,
665
+ weight,
666
+ speedRatio,
667
+ fadeIn,
668
+ fadeOut: 0,
669
+ repeatCounter: 0,
670
+ currentTime: speedRatio < 0 ? ani.timeDuration : 0,
671
+ animateTime: 0,
672
+ fadeOutStart: 0,
673
+ firstFrame: true
674
+ });
675
+ ani.tracks?.forEach((v, k)=>{
676
+ let nodeTracks = this._activeTracks.get(k);
677
+ if (!nodeTracks) {
678
+ nodeTracks = new Map();
679
+ this._activeTracks.set(k, nodeTracks);
680
+ }
681
+ for (const track of v){
682
+ const blendId = track.getBlendId();
683
+ let blendedTracks = nodeTracks.get(blendId);
684
+ if (!blendedTracks) {
685
+ blendedTracks = [];
686
+ nodeTracks.set(blendId, blendedTracks);
709
687
  }
710
- });
711
- }
688
+ blendedTracks.push(track);
689
+ }
690
+ });
691
+ ani.skeletons?.forEach((v, k)=>{
692
+ const rig = this.model.findSkeletonRigById(k);
693
+ if (rig) {
694
+ const refcount = this._activeRigs.get(rig);
695
+ this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
696
+ rig.playing = true;
697
+ return;
698
+ }
699
+ const binding = this.model.findSkinBindingById(k);
700
+ if (binding) {
701
+ const refcount = this._activeSkinBindings.get(binding);
702
+ this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
703
+ binding.playing = true;
704
+ const rigRefcount = this._activeRigs.get(binding.rig);
705
+ this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
706
+ binding.rig.playing = true;
707
+ }
708
+ });
712
709
  }
713
710
  /**
714
711
  * Stop playback of an animation clip.