This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ void AnimationClip::SetLoop(bool looping) {
5454 loop_ = looping;
5555}
5656
57- Scalar AnimationClip::GetPlaybackSpeed () const {
58- return playback_speed_ ;
57+ Scalar AnimationClip::GetPlaybackTimeScale () const {
58+ return playback_time_scale_ ;
5959}
6060
61- void AnimationClip::SetPlaybackSpeed (Scalar playback_speed) {
62- playback_speed_ = playback_speed;
61+ void AnimationClip::SetPlaybackTimeScale (Scalar playback_speed) {
62+ playback_time_scale_ = playback_speed;
6363}
6464
6565Scalar AnimationClip::GetWeight () const {
@@ -82,7 +82,7 @@ void AnimationClip::Advance(Scalar delta_time) {
8282 if (!playing_ || delta_time <= 0 ) {
8383 return ;
8484 }
85- delta_time *= playback_speed_ ;
85+ delta_time *= playback_time_scale_ ;
8686 playback_time_ += delta_time;
8787
8888 // / Handle looping behavior.
Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ class AnimationClip final {
3838
3939 void SetLoop (bool looping);
4040
41- Scalar GetPlaybackSpeed () const ;
41+ Scalar GetPlaybackTimeScale () const ;
4242
4343 // / @brief Sets the animation playback speed. Negative values make the clip
4444 // / play in reverse.
45- void SetPlaybackSpeed (Scalar playback_speed);
45+ void SetPlaybackTimeScale (Scalar playback_speed);
4646
4747 Scalar GetWeight () const ;
4848
@@ -74,7 +74,7 @@ class AnimationClip final {
7474 std::vector<ChannelBinding> bindings_;
7575
7676 Scalar playback_time_ = 0 ;
77- Scalar playback_speed_ = 1 ; // Seconds multiplier, can be negative.
77+ Scalar playback_time_scale_ = 1 ; // Seconds multiplier, can be negative.
7878 Scalar weight_ = 1 ;
7979 bool playing_ = false ;
8080 bool loop_ = false ;
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ AnimationClip& AnimationPlayer::AddAnimation(
2626 // Record all of the unique default transforms that this AnimationClip
2727 // will mutate.
2828 for (const auto & binding : clip.bindings_ ) {
29- default_target_transforms_.insert (DefaultTransform{
30- . node = binding.node , . transform = binding.node ->GetLocalTransform ()});
29+ default_target_transforms_.insert (
30+ { binding.node , binding.node ->GetLocalTransform ()});
3131 }
3232
3333 clips_.push_back (std::move (clip));
@@ -52,8 +52,8 @@ void AnimationPlayer::Update() {
5252}
5353
5454void AnimationPlayer::Reset () {
55- for (auto & default_transform : default_target_transforms_) {
56- default_transform. node ->SetLocalTransform (default_transform. transform );
55+ for (auto & [node, transform] : default_target_transforms_) {
56+ node->SetLocalTransform (transform);
5757 }
5858}
5959
Original file line number Diff line number Diff line change @@ -38,28 +38,7 @@ class AnimationPlayer final {
3838 void Reset ();
3939
4040 private:
41- struct DefaultTransform {
42- Node* node;
43- Matrix transform;
44-
45- struct Hash {
46- std::size_t operator ()(const DefaultTransform& o) const {
47- return fml::HashCombine (o.node );
48- }
49- };
50-
51- struct Equal {
52- bool operator ()(const DefaultTransform& lhs,
53- const DefaultTransform& rhs) const {
54- return lhs.node == rhs.node ;
55- }
56- };
57- };
58-
59- std::unordered_set<DefaultTransform,
60- DefaultTransform::Hash,
61- DefaultTransform::Equal>
62- default_target_transforms_;
41+ std::unordered_map<Node*, Matrix> default_target_transforms_;
6342
6443 std::vector<AnimationClip> clips_;
6544
You can’t perform that action at this time.
0 commit comments